From 589d99ff39df04bd52695f637d6161007cad7275 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 19 Apr 2024 14:48:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=A8=E5=B7=A5=E4=BD=9C=E5=8F=B0?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=94=B3=E6=8A=A5=E3=80=81=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pm/api/workbench/manage/WorkbenchManage.java | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) 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 8ac112b..299f140 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 @@ -218,8 +218,9 @@ public class WorkbenchManage { initWorkbenchDefaultParam(req); List retData = new ArrayList<>(); List projectIds = new ArrayList<>(); + List projects = new ArrayList<>(); Map purchaseEventMap = new HashMap<>(); - ToLongFunction getPurchaseCount = event -> purchaseEventMap.getOrDefault(event.name(), 0L); + ToLongFunction countPurchase = event -> purchaseEventMap.getOrDefault(event.name(), 0L); long firstInspectedCount = 0; for (ProcessNode node : ProcessNode.ALL) { long count; @@ -227,14 +228,14 @@ public class WorkbenchManage { case PROJECT_DECLARED: List viewUnitIds = mhUnitCache.getViewChildIdsRecursion(req.getUnitId()); Wrapper query = Wrappers.lambdaQuery(Project.class) - .select(Project::getId) + .select(Project::getId, Project::getApprovalAmount) .eq(Project::getProjectYear, req.getProjectYear()) .eq(Project::getNewest, Boolean.TRUE) .exists("select 1 from nd_project_status_change npsc " + "where npsc.project_code = nd_project.project_code and " + "npsc.event = {0}", ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS) .in(Project::getBuildOrgCode, CollUtils.convert(viewUnitIds, String::valueOf)); - List projects = projectService.list(query); + projects.addAll(projectService.list(query)); if (projects.isEmpty()) { return retData; } @@ -245,10 +246,10 @@ public class WorkbenchManage { count = getProjectCount(projectIds, ProjectStateChangeEvent.PROJECT_REVIEW_PASS); break; case APPROVAL_AMOUNT: - count = projectService.count(Wrappers.lambdaQuery(Project.class) - .in(Project::getId, projectIds) - .gt(Project::getApprovalAmount, BigDecimal.ZERO) - .isNotNull(Project::getApprovalAmount)); + count = projects.stream() + .filter(w -> w.getApprovalAmount() != null) + .filter(w -> w.getApprovalAmount().compareTo(BigDecimal.ZERO) > 0) + .count(); break; case PROJECT_APPROVAL: count = getProjectCount(projectIds, ProjectStateChangeEvent.DECLARED_RECORD_PASS); @@ -271,26 +272,26 @@ public class WorkbenchManage { } break; case PROJECT_ADAPTION: - count = getPurchaseCount.applyAsLong(AdaptStateChangeEvent.ADAPT_INFO_PASSED); + count = countPurchase.applyAsLong(AdaptStateChangeEvent.ADAPT_INFO_PASSED); break; case SYSTEM_SELF_TEST: - count = getPurchaseCount.applyAsLong(SelfTestStateChangeEvent.SELF_TEST_PASSED); + count = countPurchase.applyAsLong(SelfTestStateChangeEvent.SELF_TEST_PASSED); break; case SYSTEM_TEST_VALID: - count = getPurchaseCount.applyAsLong(TestValidStateChangeEvent.TEST_VALID_INFO_PASSED); + count = countPurchase.applyAsLong(TestValidStateChangeEvent.TEST_VALID_INFO_PASSED); break; case FIRST_INSPECTED: - count = getPurchaseCount.applyAsLong(TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES); + count = countPurchase.applyAsLong(TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES); firstInspectedCount = count; break; case PILOT_RUNNING: count = firstInspectedCount; break; case XCFHX_REVIEW: - count = getPurchaseCount.applyAsLong(XcfhxStateChangeEvent.XCFHX_APPLY_PASSED); + count = countPurchase.applyAsLong(XcfhxStateChangeEvent.XCFHX_APPLY_PASSED); break; case FINAL_INSPECTED: - count = getPurchaseCount.applyAsLong(TenderStateChangeEvent.FINALLY_INSPECTED_PASSED); + count = countPurchase.applyAsLong(TenderStateChangeEvent.FINALLY_INSPECTED_PASSED); break; default: count = 0;