|
|
@@ -218,8 +218,9 @@ public class WorkbenchManage { |
|
|
|
initWorkbenchDefaultParam(req); |
|
|
|
List<ProjectProcessStageStatisticsVO> retData = new ArrayList<>(); |
|
|
|
List<Long> projectIds = new ArrayList<>(); |
|
|
|
List<Project> projects = new ArrayList<>(); |
|
|
|
Map<String, Long> purchaseEventMap = new HashMap<>(); |
|
|
|
ToLongFunction<AbstractStateChangeEvent> getPurchaseCount = event -> purchaseEventMap.getOrDefault(event.name(), 0L); |
|
|
|
ToLongFunction<AbstractStateChangeEvent> 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<Long> viewUnitIds = mhUnitCache.getViewChildIdsRecursion(req.getUnitId()); |
|
|
|
Wrapper<Project> 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<Project> 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; |
|
|
|