Browse Source

补全工作台项目申报、评审数据统计

tags/24080901
WendyYang 8 months ago
parent
commit
589d99ff39
1 changed files with 14 additions and 13 deletions
  1. +14
    -13
      hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java

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

@@ -218,8 +218,9 @@ public class WorkbenchManage {
initWorkbenchDefaultParam(req); initWorkbenchDefaultParam(req);
List<ProjectProcessStageStatisticsVO> retData = new ArrayList<>(); List<ProjectProcessStageStatisticsVO> retData = new ArrayList<>();
List<Long> projectIds = new ArrayList<>(); List<Long> projectIds = new ArrayList<>();
List<Project> projects = new ArrayList<>();
Map<String, Long> purchaseEventMap = new HashMap<>(); 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; long firstInspectedCount = 0;
for (ProcessNode node : ProcessNode.ALL) { for (ProcessNode node : ProcessNode.ALL) {
long count; long count;
@@ -227,14 +228,14 @@ public class WorkbenchManage {
case PROJECT_DECLARED: case PROJECT_DECLARED:
List<Long> viewUnitIds = mhUnitCache.getViewChildIdsRecursion(req.getUnitId()); List<Long> viewUnitIds = mhUnitCache.getViewChildIdsRecursion(req.getUnitId());
Wrapper<Project> query = Wrappers.lambdaQuery(Project.class) Wrapper<Project> query = Wrappers.lambdaQuery(Project.class)
.select(Project::getId)
.select(Project::getId, Project::getApprovalAmount)
.eq(Project::getProjectYear, req.getProjectYear()) .eq(Project::getProjectYear, req.getProjectYear())
.eq(Project::getNewest, Boolean.TRUE) .eq(Project::getNewest, Boolean.TRUE)
.exists("select 1 from nd_project_status_change npsc " + .exists("select 1 from nd_project_status_change npsc " +
"where npsc.project_code = nd_project.project_code and " + "where npsc.project_code = nd_project.project_code and " +
"npsc.event = {0}", ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS) "npsc.event = {0}", ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS)
.in(Project::getBuildOrgCode, CollUtils.convert(viewUnitIds, String::valueOf)); .in(Project::getBuildOrgCode, CollUtils.convert(viewUnitIds, String::valueOf));
List<Project> projects = projectService.list(query);
projects.addAll(projectService.list(query));
if (projects.isEmpty()) { if (projects.isEmpty()) {
return retData; return retData;
} }
@@ -245,10 +246,10 @@ public class WorkbenchManage {
count = getProjectCount(projectIds, ProjectStateChangeEvent.PROJECT_REVIEW_PASS); count = getProjectCount(projectIds, ProjectStateChangeEvent.PROJECT_REVIEW_PASS);
break; break;
case APPROVAL_AMOUNT: 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; break;
case PROJECT_APPROVAL: case PROJECT_APPROVAL:
count = getProjectCount(projectIds, ProjectStateChangeEvent.DECLARED_RECORD_PASS); count = getProjectCount(projectIds, ProjectStateChangeEvent.DECLARED_RECORD_PASS);
@@ -271,26 +272,26 @@ public class WorkbenchManage {
} }
break; break;
case PROJECT_ADAPTION: case PROJECT_ADAPTION:
count = getPurchaseCount.applyAsLong(AdaptStateChangeEvent.ADAPT_INFO_PASSED);
count = countPurchase.applyAsLong(AdaptStateChangeEvent.ADAPT_INFO_PASSED);
break; break;
case SYSTEM_SELF_TEST: case SYSTEM_SELF_TEST:
count = getPurchaseCount.applyAsLong(SelfTestStateChangeEvent.SELF_TEST_PASSED);
count = countPurchase.applyAsLong(SelfTestStateChangeEvent.SELF_TEST_PASSED);
break; break;
case SYSTEM_TEST_VALID: case SYSTEM_TEST_VALID:
count = getPurchaseCount.applyAsLong(TestValidStateChangeEvent.TEST_VALID_INFO_PASSED);
count = countPurchase.applyAsLong(TestValidStateChangeEvent.TEST_VALID_INFO_PASSED);
break; break;
case FIRST_INSPECTED: case FIRST_INSPECTED:
count = getPurchaseCount.applyAsLong(TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES);
count = countPurchase.applyAsLong(TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES);
firstInspectedCount = count; firstInspectedCount = count;
break; break;
case PILOT_RUNNING: case PILOT_RUNNING:
count = firstInspectedCount; count = firstInspectedCount;
break; break;
case XCFHX_REVIEW: case XCFHX_REVIEW:
count = getPurchaseCount.applyAsLong(XcfhxStateChangeEvent.XCFHX_APPLY_PASSED);
count = countPurchase.applyAsLong(XcfhxStateChangeEvent.XCFHX_APPLY_PASSED);
break; break;
case FINAL_INSPECTED: case FINAL_INSPECTED:
count = getPurchaseCount.applyAsLong(TenderStateChangeEvent.FINALLY_INSPECTED_PASSED);
count = countPurchase.applyAsLong(TenderStateChangeEvent.FINALLY_INSPECTED_PASSED);
break; break;
default: default:
count = 0; count = 0;


Loading…
Cancel
Save