Selaa lähdekoodia

工作台修改

tags/24080901
WendyYang 6 kuukautta sitten
vanhempi
commit
ee6e312a00
1 muutettua tiedostoa jossa 72 lisäystä ja 71 poistoa
  1. +72
    -71
      hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java

+ 72
- 71
hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java Näytä tiedosto

@@ -220,81 +220,82 @@ 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> countPurchase = event -> purchaseEventMap.getOrDefault(event.name(), 0L);
// 查询完成立项备案的项目
List<Long> viewUnitIds = mhUnitCache.getViewChildIdsRecursion(req.getUnitId());
Wrapper<Project> query = Wrappers.lambdaQuery(Project.class)
.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);
for (ProcessNode node : ProcessNode.ALL) {
long count;
switch (node) {
case PROJECT_DECLARED:
List<Long> viewUnitIds = mhUnitCache.getViewChildIdsRecursion(req.getUnitId());
Wrapper<Project> query = Wrappers.lambdaQuery(Project.class)
.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));
projects.addAll(projectService.list(query));
if (projects.isEmpty()) {
return retData;
}
count = projects.size();
projectIds.addAll(CollUtils.fieldList(projects, Project::getId));
break;
case PROJECT_REVIEW:
count = getProjectCount(projectIds, ProjectStateChangeEvent.PROJECT_REVIEW_PASS);
break;
case APPROVAL_AMOUNT:
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);
break;
case PROJECT_PURCHASE:
count = purchaseService.count(Wrappers.lambdaQuery(Purchase.class)
.in(Purchase::getProjectId, projectIds));
if (count > 0) {
Wrapper<PurchaseStatusChange> pQuery = Wrappers.lambdaQuery(PurchaseStatusChange.class)
.select(PurchaseStatusChange::getEvent)
.in(PurchaseStatusChange::getProjectId, projectIds)
.in(PurchaseStatusChange::getEvent, AdaptStateChangeEvent.ADAPT_INFO_PASSED,
SelfTestStateChangeEvent.SELF_TEST_PASSED,
TestValidStateChangeEvent.TEST_VALID_INFO_PASSED,
TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES,
XcfhxStateChangeEvent.XCFHX_APPLY_PASSED,
TenderStateChangeEvent.FINALLY_INSPECTED_PASSED);
List<PurchaseStatusChange> changes = purchaseStatusChangeService.list(pQuery);
changes.forEach(change -> purchaseEventMap.merge(change.getEvent(), 1L, Long::sum));
}
break;
case PROJECT_ADAPTION:
count = countPurchase.applyAsLong(AdaptStateChangeEvent.ADAPT_INFO_PASSED);
break;
case SYSTEM_SELF_TEST:
count = countPurchase.applyAsLong(SelfTestStateChangeEvent.SELF_TEST_PASSED);
break;
case SYSTEM_TEST_VALID:
count = countPurchase.applyAsLong(TestValidStateChangeEvent.TEST_VALID_INFO_PASSED);
break;
case FIRST_INSPECTED:
case PILOT_RUNNING:
// 初验试运行数量同步
count = countPurchase.applyAsLong(TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES);
break;
case XCFHX_REVIEW:
count = countPurchase.applyAsLong(XcfhxStateChangeEvent.XCFHX_APPLY_PASSED);
break;
case FINAL_INSPECTED:
count = countPurchase.applyAsLong(TenderStateChangeEvent.FINALLY_INSPECTED_PASSED);
break;
default:
count = 0;
break;
if (projects.isEmpty()) {
count = 0;
} else {
switch (node) {
case PROJECT_DECLARED:
count = projects.size();
projectIds.addAll(CollUtils.fieldList(projects, Project::getId));
break;
case PROJECT_REVIEW:
count = getProjectCount(projectIds, ProjectStateChangeEvent.PROJECT_REVIEW_PASS);
break;
case APPROVAL_AMOUNT:
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);
break;
case PROJECT_PURCHASE:
count = purchaseService.count(Wrappers.lambdaQuery(Purchase.class)
.in(Purchase::getProjectId, projectIds));
if (count > 0) {
Wrapper<PurchaseStatusChange> pQuery = Wrappers.lambdaQuery(PurchaseStatusChange.class)
.select(PurchaseStatusChange::getEvent)
.in(PurchaseStatusChange::getProjectId, projectIds)
.in(PurchaseStatusChange::getEvent, AdaptStateChangeEvent.ADAPT_INFO_PASSED,
SelfTestStateChangeEvent.SELF_TEST_PASSED,
TestValidStateChangeEvent.TEST_VALID_INFO_PASSED,
TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES,
XcfhxStateChangeEvent.XCFHX_APPLY_PASSED,
TenderStateChangeEvent.FINALLY_INSPECTED_PASSED);
List<PurchaseStatusChange> changes = purchaseStatusChangeService.list(pQuery);
changes.forEach(change -> purchaseEventMap.merge(change.getEvent(), 1L, Long::sum));
}
break;
case PROJECT_ADAPTION:
count = countPurchase.applyAsLong(AdaptStateChangeEvent.ADAPT_INFO_PASSED);
break;
case SYSTEM_SELF_TEST:
count = countPurchase.applyAsLong(SelfTestStateChangeEvent.SELF_TEST_PASSED);
break;
case SYSTEM_TEST_VALID:
count = countPurchase.applyAsLong(TestValidStateChangeEvent.TEST_VALID_INFO_PASSED);
break;
case FIRST_INSPECTED:
case PILOT_RUNNING:
// 初验试运行数量同步
count = countPurchase.applyAsLong(TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES);
break;
case XCFHX_REVIEW:
count = countPurchase.applyAsLong(XcfhxStateChangeEvent.XCFHX_APPLY_PASSED);
break;
case FINAL_INSPECTED:
count = countPurchase.applyAsLong(TenderStateChangeEvent.FINALLY_INSPECTED_PASSED);
break;
default:
count = 0;
break;
}
}
retData.add(ProjectProcessStageStatisticsVO.builder()
.stage(node)


Loading…
Peruuta
Tallenna