diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java index b4a7395..d44a0ed 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/PurchaseManage.java @@ -177,7 +177,7 @@ public class PurchaseManage { w -> CollUtil.anyMatch(w, x -> PURCHASING_STATUS.contains(x.getStatus())))); // 已采购 stat.setPurchaseFinishedCount(CollUtil.count(projectPurchaseMap.values(), - w -> !w.isEmpty() && CollUtil.anyMatch(w, x -> !PURCHASING_STATUS.contains(x.getStatus())))); + w -> !w.isEmpty() && CollUtil.allMatch(w, x -> !PURCHASING_STATUS.contains(x.getStatus())))); stat.setTotalCount(projects.size()); return stat; @@ -214,8 +214,8 @@ public class PurchaseManage { String inSql = BizUtils.inSqlJoin(CollUtils.convert(PURCHASING_STATUS, String::valueOf)); query.exists(ExistsSqlConst.PROJECT_EXISTS_PURCHASE + " and np.status in " + inSql); } else if (TenderMainStatus.PURCHASE_FINISHED.eq(req.getTabStatus())) { - query.exists(ExistsSqlConst.PROJECT_EXISTS_PURCHASE_STATUS_CHANGE + - " and npsc.event = {0} ", TenderStateChangeEvent.SUBMIT_PURCHASE_CONSTRUCTION_INFO); + query.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + + " and npsc.event = {0} ", ProjectStateChangeEvent.SUBMIT_PURCHASE_CONTRACT_RECORD); } else if (ProjectStatus.TO_BE_PURCHASED.eq(req.getTabStatus())) { query.eq(Project::getStatus, ProjectStatus.TO_BE_PURCHASED.getCode()); } else { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectManageTodoCountManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectManageTodoCountManage.java index db01eb1..c50cd79 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectManageTodoCountManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/manage/ProjectManageTodoCountManage.java @@ -89,7 +89,7 @@ public class ProjectManageTodoCountManage { // 招标采购 projReqOrg.setBuildOrgCode(req.getBuildOrgCode()); PurchaseProgressVO purchase = purchaseManage.purchaseProgress(projReqOrg); - ret.setProjectPurchase(sum(purchase, PurchaseProgressVO::getOnPurchaseCount)); + ret.setProjectPurchase(sum(purchase, PurchaseProgressVO::getOnPurchaseCount, PurchaseProgressVO::getToBePurchaseCount)); // 适配改造 PurchaseAdaptionListReq adaptionReq = new PurchaseAdaptionListReq(); adaptionReq.setBuildOrgCode(buildOrgCode); 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 151abc4..89cf1f6 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 @@ -332,13 +332,10 @@ public class WorkbenchManage { public List getProjectCodes(Map> projectStatusChanges, - List projectCodes, ProjectStateChangeEvent event) { return projectStatusChanges.entrySet().stream() - .filter(w -> projectCodes.contains(w.getKey())) .filter(w -> CollUtil.anyMatch(w.getValue(), w1 -> event.eq(w1.getEvent()))) .map(Map.Entry::getKey) - .filter(projectCodes::contains) .collect(Collectors.toList()); } @@ -348,7 +345,7 @@ public class WorkbenchManage { return CollUtil.count(projectStatusChanges.entrySet(), w -> { List changes = w.getValue(); return CollUtil.anyMatch(changes, w1 -> startEvent.eq(w1.getEvent())) - && CollUtil.anyMatch(changes, w1 -> !finishEvent.eq(w1.getEvent())); + && CollUtil.allMatch(changes, w1 -> !finishEvent.eq(w1.getEvent())); }); } @@ -422,8 +419,7 @@ public class WorkbenchManage { } break; case PROJECT_REVIEW: { - List projectCodes = getProjectCodes(projectStatusChangeMap, allProjectCodes, - ProjectStateChangeEvent.PROJECT_REVIEW_PASS); + List projectCodes = getProjectCodes(projectStatusChangeMap, ProjectStateChangeEvent.PROJECT_REVIEW_PASS); currStat.setProjectCount(projectCodes.size()); Pair systemReplaceCount = countReplaceSystemByProjectCodes(projectCodes); currStat.setSourceCount(systemReplaceCount.getKey()); @@ -454,8 +450,7 @@ public class WorkbenchManage { } break; case PROJECT_APPROVAL: { - List projectCodes = getProjectCodes(projectStatusChangeMap, allProjectCodes, - ProjectStateChangeEvent.DECLARED_RECORD_PASS); + List projectCodes = getProjectCodes(projectStatusChangeMap, ProjectStateChangeEvent.DECLARED_RECORD_PASS); currStat.setProjectCount(projectCodes.size()); Pair systemReplaceCount = countReplaceSystemByProjectCodes(projectCodes); currStat.setSourceCount(systemReplaceCount.getKey()); @@ -466,27 +461,21 @@ public class WorkbenchManage { } break; case PROJECT_PURCHASE: { - Wrapper purchaseQuery = Wrappers.lambdaQuery(Purchase.class) - .select(Purchase::getId, Purchase::getProjectId, Purchase::getBidType, - Purchase::getStatus, Purchase::getSupplier) - .in(Purchase::getProjectId, allProjectIds); - List purchases = purchaseService.list(purchaseQuery); - projectPurchaseCountMap.putAll(CollUtils.group(purchases, Purchase::getProjectId)); - List projectIds = projectPurchaseCountMap.entrySet().stream() - .filter(w -> CollUtil.allMatch(w.getValue(), - p -> StrUtil.isNotBlank(p.getSupplier()))) - .map(Map.Entry::getKey) - .collect(Collectors.toList()); - currStat.setProjectCount(projectIds.size()); - Pair systemReplaceCount = countReplaceSystemByProjectIds(projectIds); - currStat.setSourceCount(systemReplaceCount.getKey()); - currStat.setTargetCount(systemReplaceCount.getValue()); - List projectCodes = CollUtils.convert(projectIds, ProjectIdCodeCacheUtil::get); - currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap, projectCodes)); - if (!projectIds.isEmpty()) { + List projectCodes = getProjectCodes(projectStatusChangeMap, ProjectStateChangeEvent.SUBMIT_PURCHASE_CONTRACT_RECORD); + currStat.setProjectCount(projectCodes.size()); + if (!projectCodes.isEmpty()) { + Wrapper purchaseQuery = Wrappers.lambdaQuery(Purchase.class) + .select(Purchase::getId, Purchase::getProjectId, Purchase::getBidType, Purchase::getStatus) + .in(Purchase::getProjectId, allProjectIds); + List purchases = purchaseService.list(purchaseQuery); + projectPurchaseCountMap.putAll(CollUtils.group(purchases, Purchase::getProjectId)); + Pair systemReplaceCount = countReplaceSystemByProjectCodes(projectCodes); + currStat.setSourceCount(systemReplaceCount.getKey()); + currStat.setTargetCount(systemReplaceCount.getValue()); + currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap, projectCodes)); Wrapper pQuery = Wrappers.lambdaQuery(PurchaseStatusChange.class) .select(PurchaseStatusChange::getEvent, PurchaseStatusChange::getProjectId) - .in(PurchaseStatusChange::getProjectId, projectIds) + .in(PurchaseStatusChange::getBidId, CollUtils.fieldList(purchases, Purchase::getId)) .in(PurchaseStatusChange::getEvent, ADAPT_INFO_PASSED, SELF_TEST_PASSED,