@@ -100,16 +100,10 @@ public class EarlyWarningWithoutSubmitTask { | |||||
StopWatch stopWatch = new StopWatch(); | StopWatch stopWatch = new StopWatch(); | ||||
stopWatch.start(); | stopWatch.start(); | ||||
// 获取项目库所有建设单位不为空的项目 | // 获取项目库所有建设单位不为空的项目 | ||||
LambdaQueryWrapper<Project> queryWrapper = Wrappers.lambdaQuery(Project.class).isNotNull(Project::getBuildOrgCode); | |||||
LambdaQueryWrapper<Project> queryWrapper = Wrappers.lambdaQuery(Project.class) | |||||
.isNotNull(Project::getBuildOrgCode) | |||||
.eq(Project::getNewest, Boolean.TRUE); | |||||
List<Project> projects = projectService.list(queryWrapper); | List<Project> projects = projectService.list(queryWrapper); | ||||
// 根据项目code分组 获取最新的一条数据 | |||||
Map<String, Project> projectMap = projects.stream().collect(Collectors.groupingBy(Project::getProjectCode, Collectors.collectingAndThen( | |||||
// 根据创建日期找到最新的记录 | |||||
Collectors.maxBy(Comparator.comparing(Project::getCreateOn)), | |||||
// 如果没有记录则返回null | |||||
optional -> optional.orElse(null) | |||||
))); | |||||
List<Project> projectList = new ArrayList<>(projectMap.values()); | |||||
List<ProjectEarlyWarning> projectEarlyWarnings = Lists.newArrayList(); | List<ProjectEarlyWarning> projectEarlyWarnings = Lists.newArrayList(); | ||||
List<WflowEarlyWarningRecords> earlyWarningRecords = Lists.newArrayList(); | List<WflowEarlyWarningRecords> earlyWarningRecords = Lists.newArrayList(); | ||||
List<ProjectEarlyWarning> needRemoved = Lists.newArrayList(); | List<ProjectEarlyWarning> needRemoved = Lists.newArrayList(); | ||||
@@ -119,7 +113,7 @@ public class EarlyWarningWithoutSubmitTask { | |||||
List<ProjectEarlyWarning> earlyWarnings = projectEarlyWarningService.list(warningQuery); | List<ProjectEarlyWarning> earlyWarnings = projectEarlyWarningService.list(warningQuery); | ||||
Map<String, ProjectEarlyWarning> projectEarlyWarningMap = CollUtils.listToMap(earlyWarnings, c -> c.getProjectCode() + StrPool.DASH + c.getStepName()); | Map<String, ProjectEarlyWarning> projectEarlyWarningMap = CollUtils.listToMap(earlyWarnings, c -> c.getProjectCode() + StrPool.DASH + c.getStepName()); | ||||
// 遍历项目 获取对应申报单位的滞后预警规则 | // 遍历项目 获取对应申报单位的滞后预警规则 | ||||
for (Project project : projectList) { | |||||
for (Project project : projects) { | |||||
String buildOrgCode = project.getBuildOrgCode(); | String buildOrgCode = project.getBuildOrgCode(); | ||||
String projectCode = project.getProjectCode(); | String projectCode = project.getProjectCode(); | ||||
Long mhUnitId = Long.valueOf(buildOrgCode); | Long mhUnitId = Long.valueOf(buildOrgCode); | ||||
@@ -114,16 +114,10 @@ public class DelayWarningTest extends AppTests { | |||||
StopWatch stopWatch = new StopWatch(); | StopWatch stopWatch = new StopWatch(); | ||||
stopWatch.start(); | stopWatch.start(); | ||||
// 获取项目库所有建设单位不为空的项目 | // 获取项目库所有建设单位不为空的项目 | ||||
LambdaQueryWrapper<Project> queryWrapper = Wrappers.lambdaQuery(Project.class).isNotNull(Project::getBuildOrgCode); | |||||
LambdaQueryWrapper<Project> queryWrapper = Wrappers.lambdaQuery(Project.class) | |||||
.isNotNull(Project::getBuildOrgCode) | |||||
.eq(Project::getNewest, Boolean.TRUE); | |||||
List<Project> projects = projectService.list(queryWrapper); | List<Project> projects = projectService.list(queryWrapper); | ||||
// 根据项目code分组 获取最新的一条数据 | |||||
Map<String, Project> projectMap = projects.stream().collect(Collectors.groupingBy(Project::getProjectCode, Collectors.collectingAndThen( | |||||
// 根据创建日期找到最新的记录 | |||||
Collectors.maxBy(Comparator.comparing(Project::getCreateOn)), | |||||
// 如果没有记录则返回null | |||||
optional -> optional.orElse(null) | |||||
))); | |||||
List<Project> projectList = new ArrayList<>(projectMap.values()); | |||||
List<ProjectEarlyWarning> projectEarlyWarnings = Lists.newArrayList(); | List<ProjectEarlyWarning> projectEarlyWarnings = Lists.newArrayList(); | ||||
List<WflowEarlyWarningRecords> earlyWarningRecords = Lists.newArrayList(); | List<WflowEarlyWarningRecords> earlyWarningRecords = Lists.newArrayList(); | ||||
List<ProjectEarlyWarning> needRemoved = Lists.newArrayList(); | List<ProjectEarlyWarning> needRemoved = Lists.newArrayList(); | ||||
@@ -133,7 +127,7 @@ public class DelayWarningTest extends AppTests { | |||||
List<ProjectEarlyWarning> earlyWarnings = projectEarlyWarningService.list(warningQuery); | List<ProjectEarlyWarning> earlyWarnings = projectEarlyWarningService.list(warningQuery); | ||||
Map<String, ProjectEarlyWarning> projectEarlyWarningMap = CollUtils.listToMap(earlyWarnings, c -> c.getProjectCode() + StrPool.DASH + c.getStepName()); | Map<String, ProjectEarlyWarning> projectEarlyWarningMap = CollUtils.listToMap(earlyWarnings, c -> c.getProjectCode() + StrPool.DASH + c.getStepName()); | ||||
// 遍历项目 获取对应申报单位的滞后预警规则 | // 遍历项目 获取对应申报单位的滞后预警规则 | ||||
for (Project project : projectList) { | |||||
for (Project project : projects) { | |||||
String buildOrgCode = project.getBuildOrgCode(); | String buildOrgCode = project.getBuildOrgCode(); | ||||
String projectCode = project.getProjectCode(); | String projectCode = project.getProjectCode(); | ||||
Long mhUnitId = Long.valueOf(buildOrgCode); | Long mhUnitId = Long.valueOf(buildOrgCode); | ||||