Kaynağa Gözat

滞后预警任务修改-获取最新的项目信息

tags/24090601
CMM 2 ay önce
ebeveyn
işleme
4fa8407657
2 değiştirilmiş dosya ile 8 ekleme ve 20 silme
  1. +4
    -10
      hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningWithoutSubmitTask.java
  2. +4
    -10
      hz-pm-api/src/test/java/com/hz/pm/api/warning/DelayWarningTest.java

+ 4
- 10
hz-pm-api/src/main/java/com/hz/pm/api/scheduler/task/EarlyWarningWithoutSubmitTask.java Dosyayı Görüntüle

@@ -100,16 +100,10 @@ public class EarlyWarningWithoutSubmitTask {
StopWatch stopWatch = new StopWatch();
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);
// 根据项目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<WflowEarlyWarningRecords> earlyWarningRecords = Lists.newArrayList();
List<ProjectEarlyWarning> needRemoved = Lists.newArrayList();
@@ -119,7 +113,7 @@ public class EarlyWarningWithoutSubmitTask {
List<ProjectEarlyWarning> earlyWarnings = projectEarlyWarningService.list(warningQuery);
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 projectCode = project.getProjectCode();
Long mhUnitId = Long.valueOf(buildOrgCode);


+ 4
- 10
hz-pm-api/src/test/java/com/hz/pm/api/warning/DelayWarningTest.java Dosyayı Görüntüle

@@ -114,16 +114,10 @@ public class DelayWarningTest extends AppTests {
StopWatch stopWatch = new StopWatch();
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);
// 根据项目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<WflowEarlyWarningRecords> earlyWarningRecords = Lists.newArrayList();
List<ProjectEarlyWarning> needRemoved = Lists.newArrayList();
@@ -133,7 +127,7 @@ public class DelayWarningTest extends AppTests {
List<ProjectEarlyWarning> earlyWarnings = projectEarlyWarningService.list(warningQuery);
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 projectCode = project.getProjectCode();
Long mhUnitId = Long.valueOf(buildOrgCode);


Yükleniyor…
İptal
Kaydet