Browse Source

modify:

1. 工作台系统替代情况统计;
tags/24082201
WendyYang 2 months ago
parent
commit
2dc5bd3653
1 changed files with 37 additions and 8 deletions
  1. +37
    -8
      hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java

+ 37
- 8
hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java View File

@@ -221,19 +221,29 @@ public class WorkbenchManage {
}
}
replaceInfosMap.remove("其他");

List<SystemReplaceStatVO> systemReplaceStat = replaceInfosMap.entrySet().stream().map(w -> {
String replaceType = w.getKey();
List<ProjectGovSystemReplaceInfos> replaceInfosList = w.getValue();
int sourceCount = CollUtil.count(replaceInfosList, x -> isValidSystem.test(x.getSourceSystem()));
int targetCount = CollUtil.count(replaceInfosList, x -> isValidSystem.test(x.getTargetSystem()));
Map<String, List<ProjectGovSystemReplaceInfos>> replaceGroupProject = CollUtils.group(replaceInfosList,
t -> t.getProjectCode() + "#" + t.getBatchNo());
int sourceCount = 0;
int targetCount = 0;
for (List<ProjectGovSystemReplaceInfos> currSystems : replaceGroupProject.values()) {
sourceCount += CollUtil.count(CollUtils.fieldSet(currSystems, ProjectGovSystemReplaceInfos::getSourceSystem),
isValidSystem::test);
targetCount += CollUtil.count(CollUtils.fieldSet(currSystems, ProjectGovSystemReplaceInfos::getTargetSystem),
isValidSystem::test);
}
return SystemReplaceStatVO.builder()
.sourceCount(sourceCount)
.targetCount(targetCount)
.replaceType(replaceType)
.build();
}).collect(Collectors.toList());
retDetail.setTotalTargetSystemCount(CollUtil.count(systemReplaceInfos, x -> isValidSystem.test(x.getTargetSystem())));
retDetail.setTotalSourceSystemCount(CollUtil.count(systemReplaceInfos, x -> isValidSystem.test(x.getSourceSystem())));
Pair<Integer, Integer> totalCount = countSystemReplaceInfos(systemReplaceInfos);
retDetail.setTotalSourceSystemCount(totalCount.getKey());
retDetail.setTotalTargetSystemCount(totalCount.getValue());
retDetail.setSystemReplaceInfos(systemReplaceStat);
return retDetail;
}
@@ -250,12 +260,31 @@ public class WorkbenchManage {
return Pair.create(0, 0);
}
Wrapper<ProjectGovSystemReplaceInfos> query = Wrappers.lambdaQuery(ProjectGovSystemReplaceInfos.class)
.select(ProjectGovSystemReplaceInfos::getSourceSystem, ProjectGovSystemReplaceInfos::getTargetSystem)
.select(ProjectGovSystemReplaceInfos::getSourceSystem, ProjectGovSystemReplaceInfos::getTargetSystem,
ProjectGovSystemReplaceInfos::getProjectCode, ProjectGovSystemReplaceInfos::getBatchNo)
.in(ProjectGovSystemReplaceInfos::getProjectCode, projectCodes);
List<ProjectGovSystemReplaceInfos> systemReplaceInfos = systemReplaceInfosService.list(query);
int sourceCount = CollUtil.count(systemReplaceInfos, x -> isValidSystem.test(x.getSourceSystem()));
int targetCount = CollUtil.count(systemReplaceInfos, x -> isValidSystem.test(x.getTargetSystem()));
return Pair.create(sourceCount, targetCount);
return countSystemReplaceInfos(systemReplaceInfos);
}

private static Pair<Integer, Integer> countSystemReplaceInfos(List<ProjectGovSystemReplaceInfos> systemReplaceInfos) {
Collection<Pair<Integer, Integer>> countByProject = systemReplaceInfos.stream()
.collect(Collectors.groupingBy(w -> w.getProjectCode() + "#" + w.getBatchNo(),
Collectors.collectingAndThen(Collectors.toList(),
w -> {
Set<String> sourceNames = CollUtils.fieldSet(w, ProjectGovSystemReplaceInfos::getSourceSystem);
Set<String> targetNames = CollUtils.fieldSet(w, ProjectGovSystemReplaceInfos::getTargetSystem);
int targetCount = CollUtil.count(targetNames, isValidSystem::test);
int sourceCount = CollUtil.count(sourceNames, isValidSystem::test);
return Pair.create(sourceCount, targetCount);
}))).values();
int totalTargetCount = 0;
int totalSourceCount = 0;
for (Pair<Integer, Integer> pair : countByProject) {
totalSourceCount += pair.getKey();
totalTargetCount += pair.getValue();
}
return Pair.create(totalSourceCount, totalTargetCount);
}




Loading…
Cancel
Save