diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java index 8dac6c1..0343cbe 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java @@ -88,7 +88,6 @@ import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.BiFunction; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -366,28 +365,10 @@ public class WorkbenchManage { List allProjectCodes = new ArrayList<>(); Map> purchaseEventMap = new HashMap<>(); Map> projectPurchaseCountMap = new HashMap<>(); - BiFunction> computeProjectIds = (event, node) -> { - Map projBizMap = purchaseEventMap.getOrDefault(event.name(), Collections.emptyMap()); - if (node.equals(WorkbenchProcessNode.PROJECT_ADAPTION) - || node.equals(WorkbenchProcessNode.FIRST_INSPECTED) - || node.equals(WorkbenchProcessNode.FINAL_INSPECTED)) { - return projectPurchaseCountMap.entrySet().stream().filter(w -> { - Long finishedBizCount = projBizMap.get(w.getKey()); - return finishedBizCount != null && finishedBizCount > 0 - && finishedBizCount == CollUtil.count(w.getValue(), x -> BidTypeEnum.BUILD_APP.eq(x.getBidType())); - }).map(Map.Entry::getKey).collect(Collectors.toList()); - } else { - return projectPurchaseCountMap.entrySet().stream().filter(w -> { - Long finishedBizCount = projBizMap.get(w.getKey()); - return finishedBizCount != null && finishedBizCount == w.getValue().size(); - }).map(Map.Entry::getKey).collect(Collectors.toList()); - } - }; - // 查询完成立项备案的项目 List viewUnitIds = mhUnitCache.getViewChildIdsRecursion(req.getUnitId()); Wrapper query = Wrappers.lambdaQuery(Project.class) - .select(Project::getId, Project::getApprovalAmount, Project::getProjectCode) + .select(Project::getId, Project::getApprovalAmount, Project::getProjectCode, Project::getStatus) .eq(Project::getProjectYear, req.getProjectYear()) .eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip()) .eq(Project::getNewest, Boolean.TRUE) @@ -514,9 +495,9 @@ public class WorkbenchManage { } break; case PROJECT_ADAPTION: { - List projectIds = computeProjectIds.apply(SUBMIT_PURCHASE_ORG_CONFIRM, node); + List projectIds = getProjectCodes(projectStatusChangeMap, ProjectStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM); currStat.setProjectCount(projectIds.size()); - Pair replaceSystemCount = countReplaceSystemByProjectIds(projectIds); + Pair replaceSystemCount = countReplaceSystemByProjectCodes(projectIds); currStat.setSourceCount(replaceSystemCount.getKey()); currStat.setTargetCount(replaceSystemCount.getValue()); Map submitPurcahseRecordMap = purchaseEventMap.get(TenderStateChangeEvent.SUBMIT_PURCHASE_CONSTRUCTION_INFO.name()); @@ -546,9 +527,7 @@ public class WorkbenchManage { } break; case FIRST_INSPECTED: { - List projectCodes = CollUtils.filter(projectStatusChangeMap.entrySet(), - w -> CollUtil.anyMatch(w.getValue(), w1 -> ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES.eq(w1.getEvent())), - Map.Entry::getKey); + List projectCodes = getProjectCodes(projectStatusChangeMap, ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES); Pair replaceSystemCount = countReplaceSystemByProjectCodes(projectCodes); currStat.setProjectCount(projectCodes.size()); currStat.setSourceCount(replaceSystemCount.getKey()); @@ -560,9 +539,7 @@ public class WorkbenchManage { } break; case FINAL_INSPECTED: { - List projectCodes = CollUtils.filter(projectStatusChangeMap.entrySet(), - w -> CollUtil.anyMatch(w.getValue(), w1 -> ProjectStateChangeEvent.FINAL_ACCEPTANCE_PASS.eq(w1.getEvent())), - Map.Entry::getKey); + List projectCodes = getProjectCodes(projectStatusChangeMap, ProjectStateChangeEvent.FINAL_ACCEPTANCE_PASS); Pair replaceSystemCount = countReplaceSystemByProjectCodes(projectCodes); currStat.setProjectCount(projectCodes.size()); currStat.setSourceCount(replaceSystemCount.getKey()); @@ -622,7 +599,7 @@ public class WorkbenchManage { .filter(w1 -> w1.getProjectId().equals(w) && event.eq(w1.getEvent())) .map(PurchaseStatusChange::getBidId) .collect(Collectors.toSet()).size(); - return finishedBidCount != 0 && finishedBidCount == bidCount; + return bidCount > 0 && finishedBidCount == bidCount; }).count(); }