Bladeren bron

feat:

1. 项目总览已终止项目统计修改;
dev
WendyYang 5 dagen geleden
bovenliggende
commit
f52059e60c
1 gewijzigde bestanden met toevoegingen van 31 en 18 verwijderingen
  1. +31
    -18
      hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java

+ 31
- 18
hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java Bestand weergeven

@@ -382,7 +382,7 @@ public class WorkbenchManage {
.eq(Project::getProjectYear, req.getProjectYear())
.eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip())
.eq(Project::getNewest, Boolean.TRUE)
.notIn(Project::getStatus, ProjectStatusConstant.CHANGE_STOP_DELETE_PASSED)
.notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED)
.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE + " and npsc.event = {0}",
ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT)
.in(Project::getBuildOrgCode, CollUtils.convert(viewUnitIds, String::valueOf));
@@ -403,16 +403,20 @@ public class WorkbenchManage {
.build();
switch (node) {
case PROJECT_DECLARED: {
// 所有项目的状态变更记录
Wrapper<ProjectStatusChange> pscQuery = Wrappers.lambdaQuery(ProjectStatusChange.class)
.in(ProjectStatusChange::getProjectCode, CollUtils.fieldList(projects, Project::getProjectCode));
List<ProjectStatusChange> projectStatusChanges = projectStatusChangeService.list(pscQuery);
projectStatusChangeMap.putAll(CollUtils.group(projectStatusChanges, ProjectStatusChange::getProjectCode));
// 移除已停止项目
projects.removeIf(w -> ProjectStatus.STOPPED_PASSED.eq(w.getStatus()));
currStat.setProjectCount(projects.size());
for (Project project : projects) {
allProjectCodes.add(project.getProjectCode());
allProjectIds.addAll(ProjectIdCodeCacheUtil.get(project.getProjectCode()));
}
Wrapper<ProjectStatusChange> pscQuery = Wrappers.lambdaQuery(ProjectStatusChange.class)
.in(ProjectStatusChange::getProjectCode, allProjectCodes);
List<ProjectStatusChange> projectStatusChanges = projectStatusChangeService.list(pscQuery);
projectStatusChangeMap.putAll(CollUtils.group(projectStatusChanges, ProjectStatusChange::getProjectCode));
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap, allProjectCodes));
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap,
ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT, ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS));
Pair<Integer, Integer> replaceSystemCount = countReplaceSystemByProjectCodes(allProjectCodes);
currStat.setSourceCount(replaceSystemCount.getKey());
currStat.setTargetCount(replaceSystemCount.getValue());
@@ -424,7 +428,8 @@ public class WorkbenchManage {
Pair<Integer, Integer> systemReplaceCount = countReplaceSystemByProjectCodes(projectCodes);
currStat.setSourceCount(systemReplaceCount.getKey());
currStat.setTargetCount(systemReplaceCount.getValue());
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap, projectCodes));
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap,
ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS, ProjectStateChangeEvent.PROJECT_REVIEW_PASS));
int reviewFailed = lastMatchProjectCount(projectStatusChangeMap, ProjectStateChangeEvent.PROJECT_REVIEW_FAILED);
int reviewing = lastMatchProjectCount(projectStatusChangeMap, ProjectStateChangeEvent.PROJECT_REVIEW_SUBMIT,
ProjectStateChangeEvent.PROJECT_REVIEW_RESUBMIT);
@@ -444,7 +449,8 @@ public class WorkbenchManage {
Pair<Integer, Integer> systemReplaceCount = countReplaceSystemByProjectCodes(projectCodes);
currStat.setSourceCount(systemReplaceCount.getKey());
currStat.setTargetCount(systemReplaceCount.getValue());
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap, projectCodes));
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap,
ProjectStateChangeEvent.PROJECT_REVIEW_PASS, ProjectStateChangeEvent.ANNUAL_PLAN_PASS));
currStat.setPendingCount(CollUtil.count(projects, w -> w.getApprovalAmount() == null
|| NumberUtil.isLessOrEqual(w.getApprovalAmount(), BigDecimal.ZERO)));
}
@@ -455,7 +461,8 @@ public class WorkbenchManage {
Pair<Integer, Integer> systemReplaceCount = countReplaceSystemByProjectCodes(projectCodes);
currStat.setSourceCount(systemReplaceCount.getKey());
currStat.setTargetCount(systemReplaceCount.getValue());
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap, projectCodes));
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap,
ProjectStateChangeEvent.ANNUAL_PLAN_PASS, ProjectStateChangeEvent.DECLARED_RECORD_PASS));
currStat.setPendingCount(processNodeNotFinishedCount(projectStatusChangeMap,
ProjectStateChangeEvent.ANNUAL_PLAN_PASS, ProjectStateChangeEvent.DECLARED_RECORD_PASS));
}
@@ -472,7 +479,8 @@ public class WorkbenchManage {
Pair<Integer, Integer> systemReplaceCount = countReplaceSystemByProjectCodes(projectCodes);
currStat.setSourceCount(systemReplaceCount.getKey());
currStat.setTargetCount(systemReplaceCount.getValue());
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap, projectCodes));
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap,
ProjectStateChangeEvent.DECLARED_RECORD_PASS, ProjectStateChangeEvent.SUBMIT_PURCHASE_CONTRACT_RECORD));
Wrapper<PurchaseStatusChange> pQuery = Wrappers.lambdaQuery(PurchaseStatusChange.class)
.select(PurchaseStatusChange::getEvent, PurchaseStatusChange::getProjectId)
.in(PurchaseStatusChange::getBidId, CollUtils.fieldList(purchases, Purchase::getId))
@@ -502,7 +510,6 @@ public class WorkbenchManage {
Pair<Integer, Integer> replaceSystemCount = countReplaceSystemByProjectIds(projectIds);
currStat.setSourceCount(replaceSystemCount.getKey());
currStat.setTargetCount(replaceSystemCount.getValue());
List<String> projectCodes = CollUtils.convert(projectIds, ProjectIdCodeCacheUtil::get);
Map<Long, Long> submitPurcahseRecordMap = purchaseEventMap.get(TenderStateChangeEvent.SUBMIT_PURCHASE_CONSTRUCTION_INFO.name());

if (submitPurcahseRecordMap != null) {
@@ -525,7 +532,8 @@ public class WorkbenchManage {
adaptFinishStat = currStat.getAdaptFinishStat();
}
adaptFinishStat.setFinishPurchaseCountWithoutApp(finishPurchaseByWithoutApp);
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap, projectCodes));
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap,
ProjectStateChangeEvent.SUBMIT_PURCHASE_CONTRACT_RECORD, ProjectStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM));
}
break;
case FIRST_INSPECTED: {
@@ -536,7 +544,8 @@ public class WorkbenchManage {
currStat.setProjectCount(projectCodes.size());
currStat.setSourceCount(replaceSystemCount.getKey());
currStat.setTargetCount(replaceSystemCount.getValue());
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap, projectCodes));
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap,
ProjectStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM, ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES));
currStat.setPendingCount(processNodeNotFinishedCount(projectStatusChangeMap,
ProjectStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM, ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES));
}
@@ -549,7 +558,8 @@ public class WorkbenchManage {
currStat.setProjectCount(projectCodes.size());
currStat.setSourceCount(replaceSystemCount.getKey());
currStat.setTargetCount(replaceSystemCount.getValue());
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap, projectCodes));
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap,
ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES, ProjectStateChangeEvent.FINAL_ACCEPTANCE_PASS));
currStat.setPendingCount(processNodeNotFinishedCount(projectStatusChangeMap,
ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES, ProjectStateChangeEvent.FINAL_ACCEPTANCE_PASS));
}
@@ -628,10 +638,13 @@ public class WorkbenchManage {
}).count();
}

private static int stoppedProjectCount(Map<String, List<ProjectStatusChange>> projectStatusChangeMap, List<String> projectCodes) {
return CollUtil.count(projectStatusChangeMap.entrySet(),
w -> projectCodes.contains(w.getKey())
&& CollUtil.anyMatch(w.getValue(), x -> ProjectStateChangeEvent.STOPPED_APPLY_PASS.eq(x.getEvent())));
private static int stoppedProjectCount(Map<String, List<ProjectStatusChange>> projectStatusChangeMap,
AbstractStateChangeEvent startEvent,
AbstractStateChangeEvent nextStartEvent) {
return CollUtil.count(projectStatusChangeMap.values(), w ->
CollUtil.anyMatch(w, x -> startEvent.eq(x.getEvent())) &&
CollUtil.allMatch(w, x -> !nextStartEvent.eq(x.getEvent())) &&
CollUtil.anyMatch(w, x -> ProjectStateChangeEvent.STOPPED_APPLY_PASS.eq(x.getEvent())));
}

private static int lastMatchProjectCount(Map<String, List<ProjectStatusChange>> projectStatusChangeMap,


Laden…
Annuleren
Opslaan