|
|
@@ -94,9 +94,10 @@ import java.util.stream.Collectors; |
|
|
|
|
|
|
|
import static com.hz.pm.api.common.statemachine.event.AdaptStateChangeEvent.ADAPT_INFO_PASSED; |
|
|
|
import static com.hz.pm.api.common.statemachine.event.SelfTestStateChangeEvent.SELF_TEST_PASSED; |
|
|
|
import static com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM; |
|
|
|
import static com.hz.pm.api.common.statemachine.event.TenderStateChangeEvent.*; |
|
|
|
import static com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent.TEST_VALID_INFO_PASSED; |
|
|
|
import static com.hz.pm.api.projectlib.helper.ProjectManageUtil.projectQueryByProjectStatusChange; |
|
|
|
import static com.hz.pm.api.projectlib.helper.ProjectManageUtil.projectQueryExistsProjectStatusChange; |
|
|
|
import static com.hz.pm.api.projectlib.helper.ProjectManageUtil.projectQueryNotExistsProjectStatusChange; |
|
|
|
import static com.hz.pm.api.workbench.model.vo.ProjectProcessStatVO.TenderAdaptFinishStatVO; |
|
|
|
|
|
|
|
/** |
|
|
@@ -202,7 +203,7 @@ public class WorkbenchManage { |
|
|
|
|
|
|
|
private void initWorkbenchDefaultParam(WorkbenchReq req) { |
|
|
|
if (req.getUnitId() == null) { |
|
|
|
req.setUnitId(LoginUserUtil.userDetail().getMhUnitId()); |
|
|
|
req.setUnitId(LoginUserUtil.userDetailNotNull().getMhUnitId()); |
|
|
|
} |
|
|
|
if (req.getProjectYear() == null) { |
|
|
|
req.setProjectYear(LocalDate.now().getYear()); |
|
|
@@ -215,12 +216,10 @@ public class WorkbenchManage { |
|
|
|
LambdaQueryWrapper<Project> projectQuery = Wrappers.lambdaQuery(Project.class) |
|
|
|
.select(Project::getReviewAmount, Project::getApprovalAmount, Project::getId, Project::getStage, |
|
|
|
Project::getApprovalGovOwnFinanceAmount, Project::getApprovalGovSuperiorFinanceAmount, |
|
|
|
Project::getDeclareAmount) |
|
|
|
Project::getDeclareAmount, Project::getStatus) |
|
|
|
.eq(Project::getProjectYear, req.getProjectYear()) |
|
|
|
.eq(req.getUnitStrip() != null, Project::getUnitStrip, req.getUnitStrip()) |
|
|
|
.notIn(Project::getStatus, ProjectStatusConstant.CHANGE_DELETE_PASSED) |
|
|
|
.exists(ExistsSqlConst.PROJECT_EXISTS_STATUS_CHANGE |
|
|
|
+ "and npsc.event = {0}", ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS) |
|
|
|
.eq(Project::getNewest, Boolean.TRUE); |
|
|
|
List<Long> viewUnitIds = mhUnitCache.getViewChildIdsRecursion(req.getUnitId()); |
|
|
|
projectQuery.in(Project::getBuildOrgCode, CollUtils.convert(viewUnitIds, String::valueOf)); |
|
|
@@ -228,7 +227,12 @@ public class WorkbenchManage { |
|
|
|
if (projects.isEmpty()) { |
|
|
|
return retDetail; |
|
|
|
} |
|
|
|
List<Project> validProjects = CollUtils.filter(projects, w -> !ProjectStatus.STOPPED.eq(w.getStage())); |
|
|
|
retDetail.setTotalProjectCount(projects.size()); |
|
|
|
retDetail.setStoppedProjectCount(CollUtil.count(projects, w -> ProjectStatus.STOPPED_PASSED.eq(w.getStatus()))); |
|
|
|
retDetail.setOngoingProjectCount(retDetail.getTotalProjectCount() - retDetail.getStoppedProjectCount()); |
|
|
|
List<Project> validProjects = CollUtils.filter(projects, w -> !ProjectStatus.STOPPED.eq(w.getStage()) |
|
|
|
&& !ProjectStatus.COMPLIANCE_REVIEW_FAILED.eq(w.getStatus()) && !ProjectStatus.TO_BE_DECLARED.eq(w.getStatus()) |
|
|
|
&& !ProjectStatus.ON_COMPLIANCE_REVIEW.eq(w.getStatus())); |
|
|
|
retDetail.setTotalApprovalAmount(DecimalUtil.sum(validProjects, Project::getApprovalAmount)); |
|
|
|
retDetail.setTotalDeclareAmount(DecimalUtil.sum(validProjects, Project::getDeclareAmount)); |
|
|
|
retDetail.setTotalReviewAmount(DecimalUtil.sum(validProjects, Project::getReviewAmount)); |
|
|
@@ -327,14 +331,28 @@ public class WorkbenchManage { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<String> getProjectCodes(List<String> projectCodes, ProjectStateChangeEvent event) { |
|
|
|
Wrapper<ProjectStatusChange> query = Wrappers.lambdaQuery(ProjectStatusChange.class) |
|
|
|
.select(ProjectStatusChange::getProjectCode) |
|
|
|
.in(ProjectStatusChange::getProjectCode, projectCodes) |
|
|
|
.eq(ProjectStatusChange::getEvent, event); |
|
|
|
return CollUtils.fieldList(projectStatusChangeService.list(query), ProjectStatusChange::getProjectCode); |
|
|
|
public List<String> getProjectCodes(Map<String, List<ProjectStatusChange>> projectStatusChanges, |
|
|
|
List<String> projectCodes, |
|
|
|
ProjectStateChangeEvent event) { |
|
|
|
return projectStatusChanges.entrySet().stream() |
|
|
|
.filter(w -> projectCodes.contains(w.getKey())) |
|
|
|
.filter(w -> CollUtil.anyMatch(w.getValue(), w1 -> event.eq(w1.getEvent()))) |
|
|
|
.map(Map.Entry::getKey) |
|
|
|
.filter(projectCodes::contains) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
public Integer processNodeNotFinishedCount(Map<String, List<ProjectStatusChange>> projectStatusChanges, |
|
|
|
ProjectStateChangeEvent startEvent, |
|
|
|
ProjectStateChangeEvent finishEvent) { |
|
|
|
return CollUtil.count(projectStatusChanges.entrySet(), w -> { |
|
|
|
List<ProjectStatusChange> changes = w.getValue(); |
|
|
|
return CollUtil.anyMatch(changes, w1 -> startEvent.eq(w1.getEvent())) |
|
|
|
&& CollUtil.anyMatch(changes, w1 -> !finishEvent.eq(w1.getEvent())); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<ProjectProcessStatVO> projectProcessStageStatistics(WorkbenchReq req) { |
|
|
|
initWorkbenchDefaultParam(req); |
|
|
|
List<ProjectProcessStatVO> retData = new ArrayList<>(); |
|
|
@@ -404,7 +422,8 @@ public class WorkbenchManage { |
|
|
|
} |
|
|
|
break; |
|
|
|
case PROJECT_REVIEW: { |
|
|
|
List<String> projectCodes = getProjectCodes(allProjectCodes, ProjectStateChangeEvent.PROJECT_REVIEW_PASS); |
|
|
|
List<String> projectCodes = getProjectCodes(projectStatusChangeMap, allProjectCodes, |
|
|
|
ProjectStateChangeEvent.PROJECT_REVIEW_PASS); |
|
|
|
currStat.setProjectCount(projectCodes.size()); |
|
|
|
Pair<Integer, Integer> systemReplaceCount = countReplaceSystemByProjectCodes(projectCodes); |
|
|
|
currStat.setSourceCount(systemReplaceCount.getKey()); |
|
|
@@ -415,6 +434,8 @@ public class WorkbenchManage { |
|
|
|
ProjectStateChangeEvent.PROJECT_REVIEW_RESUBMIT); |
|
|
|
currStat.setReviewingCount(reviewing); |
|
|
|
currStat.setReviewFailedCount(reviewFailed); |
|
|
|
currStat.setPendingCount(processNodeNotFinishedCount(projectStatusChangeMap, |
|
|
|
ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS, ProjectStateChangeEvent.PROJECT_REVIEW_PASS)); |
|
|
|
} |
|
|
|
break; |
|
|
|
case APPROVAL_AMOUNT: { |
|
|
@@ -428,15 +449,20 @@ public class WorkbenchManage { |
|
|
|
currStat.setSourceCount(systemReplaceCount.getKey()); |
|
|
|
currStat.setTargetCount(systemReplaceCount.getValue()); |
|
|
|
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap, projectCodes)); |
|
|
|
currStat.setPendingCount(CollUtil.count(projects, w -> w.getApprovalAmount() == null |
|
|
|
|| NumberUtil.isLessOrEqual(w.getApprovalAmount(), BigDecimal.ZERO))); |
|
|
|
} |
|
|
|
break; |
|
|
|
case PROJECT_APPROVAL: { |
|
|
|
List<String> projectCodes = getProjectCodes(allProjectCodes, ProjectStateChangeEvent.DECLARED_RECORD_PASS); |
|
|
|
List<String> projectCodes = getProjectCodes(projectStatusChangeMap, allProjectCodes, |
|
|
|
ProjectStateChangeEvent.DECLARED_RECORD_PASS); |
|
|
|
currStat.setProjectCount(projectCodes.size()); |
|
|
|
Pair<Integer, Integer> systemReplaceCount = countReplaceSystemByProjectCodes(projectCodes); |
|
|
|
currStat.setSourceCount(systemReplaceCount.getKey()); |
|
|
|
currStat.setTargetCount(systemReplaceCount.getValue()); |
|
|
|
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap, projectCodes)); |
|
|
|
currStat.setPendingCount(processNodeNotFinishedCount(projectStatusChangeMap, |
|
|
|
ProjectStateChangeEvent.ANNUAL_PLAN_PASS, ProjectStateChangeEvent.DECLARED_RECORD_PASS)); |
|
|
|
} |
|
|
|
break; |
|
|
|
case PROJECT_PURCHASE: { |
|
|
@@ -477,6 +503,8 @@ public class WorkbenchManage { |
|
|
|
w -> CollUtils.groupCount(w, PurchaseStatusChange::getProjectId)))); |
|
|
|
purchaseEventMap.putAll(purchaseEventMapTmp); |
|
|
|
} |
|
|
|
currStat.setPendingCount(processNodeNotFinishedCount(projectStatusChangeMap, |
|
|
|
ProjectStateChangeEvent.DECLARED_RECORD_PASS, ProjectStateChangeEvent.SUBMIT_PURCHASE_CONTRACT_RECORD)); |
|
|
|
} |
|
|
|
break; |
|
|
|
case PROJECT_ADAPTION: { |
|
|
@@ -520,6 +548,8 @@ public class WorkbenchManage { |
|
|
|
currStat.setSourceCount(replaceSystemCount.getKey()); |
|
|
|
currStat.setTargetCount(replaceSystemCount.getValue()); |
|
|
|
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap, projectCodes)); |
|
|
|
currStat.setPendingCount(processNodeNotFinishedCount(projectStatusChangeMap, |
|
|
|
ProjectStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM, ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES)); |
|
|
|
} |
|
|
|
break; |
|
|
|
case FINAL_INSPECTED: { |
|
|
@@ -531,6 +561,8 @@ public class WorkbenchManage { |
|
|
|
currStat.setSourceCount(replaceSystemCount.getKey()); |
|
|
|
currStat.setTargetCount(replaceSystemCount.getValue()); |
|
|
|
currStat.setStoppedCount(stoppedProjectCount(projectStatusChangeMap, projectCodes)); |
|
|
|
currStat.setPendingCount(processNodeNotFinishedCount(projectStatusChangeMap, |
|
|
|
ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES, ProjectStateChangeEvent.FINAL_ACCEPTANCE_PASS)); |
|
|
|
} |
|
|
|
break; |
|
|
|
default: |
|
|
@@ -559,6 +591,14 @@ public class WorkbenchManage { |
|
|
|
stat.setFinishAdaptionInfo(countAdaptBranchStatus(ADAPT_INFO_PASSED, projectIds, projectPurchaseCountMap, projectPurchaseStatusChangeMap)); |
|
|
|
stat.setFinishOrgConfirmCount(countAdaptBranchStatus(SUBMIT_PURCHASE_ORG_CONFIRM, projectIds, projectPurchaseCountMap, projectPurchaseStatusChangeMap)); |
|
|
|
stat.setFinishSelfTestCount(countAdaptBranchStatus(SELF_TEST_PASSED, projectIds, projectPurchaseCountMap, projectPurchaseStatusChangeMap)); |
|
|
|
stat.setPendingAdaptionInfo(projectPurchaseProcessNodeNotFinishCount(projectPurchaseCountMap, |
|
|
|
projectPurchaseStatusChangeMap, SUBMIT_PURCHASE_CONSTRUCTION_INFO, ADAPT_INFO_PASSED)); |
|
|
|
stat.setPendingSelfTestCount(projectPurchaseProcessNodeNotFinishCount(projectPurchaseCountMap, |
|
|
|
projectPurchaseStatusChangeMap, ADAPT_INFO_PASSED, SELF_TEST_PASSED)); |
|
|
|
stat.setPendingTestValidCount(projectPurchaseProcessNodeNotFinishCount(projectPurchaseCountMap, |
|
|
|
projectPurchaseStatusChangeMap, SELF_TEST_PASSED, TEST_VALID_INFO_PASSED)); |
|
|
|
stat.setPendingOrgConfirmCount(projectPurchaseProcessNodeNotFinishCount(projectPurchaseCountMap, |
|
|
|
projectPurchaseStatusChangeMap, TEST_VALID_INFO_PASSED, SUBMIT_PURCHASE_ORG_CONFIRM)); |
|
|
|
return stat; |
|
|
|
} |
|
|
|
|
|
|
@@ -578,6 +618,27 @@ public class WorkbenchManage { |
|
|
|
}).count(); |
|
|
|
} |
|
|
|
|
|
|
|
private static <T extends AbstractStateChangeEvent> int projectPurchaseProcessNodeNotFinishCount(Map<Long, List<Purchase>> projectPurchaseCountMap, |
|
|
|
Map<Long, List<PurchaseStatusChange>> projectPurchaseChangeMap, |
|
|
|
T startEvent, |
|
|
|
T finishEvent) { |
|
|
|
return (int) projectPurchaseCountMap.entrySet().stream().filter(w -> { |
|
|
|
Long projectId = w.getKey(); |
|
|
|
int bidCount = CollUtil.count(projectPurchaseCountMap.getOrDefault(projectId, Collections.emptyList()), |
|
|
|
w1 -> BidTypeEnum.BUILD_APP.eq(w1.getBidType())); |
|
|
|
List<PurchaseStatusChange> purchaseStatusChanges = projectPurchaseChangeMap.getOrDefault(projectId, Collections.emptyList()); |
|
|
|
int startFinishBidCount = purchaseStatusChanges.stream() |
|
|
|
.filter(w1 -> w1.getProjectId().equals(projectId) && startEvent.eq(w1.getEvent())) |
|
|
|
.map(PurchaseStatusChange::getBidId) |
|
|
|
.collect(Collectors.toSet()).size(); |
|
|
|
int finishBidCount = purchaseStatusChanges.stream() |
|
|
|
.filter(w1 -> w1.getProjectId().equals(projectId) && finishEvent.eq(w1.getEvent())) |
|
|
|
.map(PurchaseStatusChange::getBidId) |
|
|
|
.collect(Collectors.toSet()).size(); |
|
|
|
return bidCount != 0 && startFinishBidCount == bidCount && finishBidCount != bidCount; |
|
|
|
}).count(); |
|
|
|
} |
|
|
|
|
|
|
|
private static int stoppedProjectCount(Map<String, List<ProjectStatusChange>> projectStatusChangeMap, List<String> projectCodes) { |
|
|
|
return CollUtil.count(projectStatusChangeMap.entrySet(), |
|
|
|
w -> projectCodes.contains(w.getKey()) |
|
|
@@ -601,51 +662,62 @@ public class WorkbenchManage { |
|
|
|
} |
|
|
|
ProjectManageUtil.projectBaseQuery(query); |
|
|
|
query.notIn(Project::getStatus, ProjectStatusConstant.CHANGE_STOP_DELETE_PASSED); |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT); |
|
|
|
projectQueryExistsProjectStatusChange(query, ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT); |
|
|
|
switch (req.getProcessNode()) { |
|
|
|
case PROJECT_DECLARED: |
|
|
|
break; |
|
|
|
case PROJECT_REVIEW: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.PROJECT_REVIEW_PASS); |
|
|
|
projectProcessNodeFinishedQuery(query, req.getProcessNodeFinished(), |
|
|
|
ProjectStateChangeEvent.COMPLIANCE_REVIEW_PASS, ProjectStateChangeEvent.PROJECT_REVIEW_PASS); |
|
|
|
break; |
|
|
|
case APPROVAL_AMOUNT: |
|
|
|
query.isNotNull(Project::getApprovalAmount).gt(Project::getApprovalAmount, BigDecimal.ZERO); |
|
|
|
if (Boolean.FALSE.equals(req.getProcessNodeFinished())) { |
|
|
|
query.and(q1 -> q1.isNull(Project::getApprovalAmount) |
|
|
|
.or(q2 -> q2.le(Project::getApprovalAmount, BigDecimal.ZERO))); |
|
|
|
} else { |
|
|
|
query.isNotNull(Project::getApprovalAmount).gt(Project::getApprovalAmount, BigDecimal.ZERO); |
|
|
|
} |
|
|
|
break; |
|
|
|
case PROJECT_APPROVAL: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.DECLARED_RECORD_PASS); |
|
|
|
projectProcessNodeFinishedQuery(query, req.getProcessNodeFinished(), |
|
|
|
ProjectStateChangeEvent.ANNUAL_PLAN_PASS, ProjectStateChangeEvent.DECLARED_RECORD_PASS); |
|
|
|
break; |
|
|
|
case PROJECT_PURCHASE: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_PURCHASE_CONTRACT_RECORD); |
|
|
|
projectProcessNodeFinishedQuery(query, req.getProcessNodeFinished(), |
|
|
|
ProjectStateChangeEvent.DECLARED_RECORD_PASS, ProjectStateChangeEvent.SUBMIT_PURCHASE_CONTRACT_RECORD); |
|
|
|
break; |
|
|
|
case FIRST_INSPECTED: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES); |
|
|
|
projectProcessNodeFinishedQuery(query, req.getProcessNodeFinished(), |
|
|
|
ProjectStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM, ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES); |
|
|
|
break; |
|
|
|
case ORG_CONFIRM: |
|
|
|
purchaseProcessNodeFinishedQuery(query, req.getProcessNodeFinished(), |
|
|
|
TEST_VALID_INFO_PASSED, SUBMIT_PURCHASE_ORG_CONFIRM); |
|
|
|
break; |
|
|
|
case PROJECT_ADAPTION: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM); |
|
|
|
projectProcessNodeFinishedQuery(query, req.getProcessNodeFinished(), |
|
|
|
ProjectStateChangeEvent.SUBMIT_PURCHASE_CONTRACT_RECORD, ProjectStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM); |
|
|
|
break; |
|
|
|
case FINAL_INSPECTED: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.FINAL_ACCEPTANCE_PASS); |
|
|
|
projectProcessNodeFinishedQuery(query, req.getProcessNodeFinished(), |
|
|
|
ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES, ProjectStateChangeEvent.FINAL_ACCEPTANCE_PASS); |
|
|
|
break; |
|
|
|
case FINISHED: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_PURCHASE_CONTRACT_RECORD); |
|
|
|
projectQueryExistsProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_PURCHASE_CONTRACT_RECORD); |
|
|
|
query.notExists("select 1 from nd_purchase np where np.project_id = nd_project.id and bid_type = {0}", |
|
|
|
BidTypeEnum.BUILD_APP.getCode()); |
|
|
|
break; |
|
|
|
case TEST_VALID: |
|
|
|
query.apply("(select t.bidCnt from (select count(1) bidCnt from nd_purchase np where np.project_id = nd_project.id and bid_type = {0}) t where bidCnt > 0) " + |
|
|
|
"= (select count(distinct bid_id) from nd_purchase_status_change npsc where npsc.project_code = nd_project.project_code " + |
|
|
|
"and event = {1})", BidTypeEnum.BUILD_APP.getCode(), TEST_VALID_INFO_PASSED); |
|
|
|
purchaseProcessNodeFinishedQuery(query, req.getProcessNodeFinished(), |
|
|
|
SELF_TEST_PASSED, TEST_VALID_INFO_PASSED); |
|
|
|
break; |
|
|
|
case SELF_TEST: |
|
|
|
query.apply("(select t.bidCnt from (select count(1) bidCnt from nd_purchase np where np.project_id = nd_project.id and bid_type = {0}) t where bidCnt > 0) " + |
|
|
|
"= (select count(distinct bid_id) from nd_purchase_status_change npsc where npsc.project_code = nd_project.project_code " + |
|
|
|
"and event = {1})", BidTypeEnum.BUILD_APP.getCode(), SELF_TEST_PASSED); |
|
|
|
purchaseProcessNodeFinishedQuery(query, req.getProcessNodeFinished(), |
|
|
|
ADAPT_INFO_PASSED, SELF_TEST_PASSED); |
|
|
|
break; |
|
|
|
case SUBMIT_START_FILE: |
|
|
|
query.apply("(select t.bidCnt from (select count(1) bidCnt from nd_purchase np where np.project_id = nd_project.id and bid_type = {0}) t where bidCnt > 0) " + |
|
|
|
"= (select count(distinct bid_id) from nd_purchase_status_change npsc where npsc.project_code = nd_project.project_code " + |
|
|
|
"and event = {1})", BidTypeEnum.BUILD_APP.getCode(), ADAPT_INFO_PASSED); |
|
|
|
purchaseProcessNodeFinishedQuery(query, req.getProcessNodeFinished(), |
|
|
|
SUBMIT_OPERATION_PLAN, ADAPT_INFO_PASSED); |
|
|
|
break; |
|
|
|
default: |
|
|
|
return PageVo.empty(); |
|
|
@@ -682,6 +754,42 @@ public class WorkbenchManage { |
|
|
|
return PageVo.of(records, page.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
private static void projectProcessNodeFinishedQuery(LambdaQueryWrapper<Project> query, |
|
|
|
Boolean processNodeFinished, |
|
|
|
AbstractStateChangeEvent startEvent, |
|
|
|
AbstractStateChangeEvent finishEvent) { |
|
|
|
if (Boolean.FALSE.equals(processNodeFinished)) { |
|
|
|
projectQueryExistsProjectStatusChange(query, startEvent); |
|
|
|
projectQueryNotExistsProjectStatusChange(query, finishEvent); |
|
|
|
} else { |
|
|
|
projectQueryExistsProjectStatusChange(query, finishEvent); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static void purchaseProcessNodeFinishedQuery(LambdaQueryWrapper<Project> query, |
|
|
|
Boolean processNodeFinished, |
|
|
|
AbstractStateChangeEvent startEvent, |
|
|
|
AbstractStateChangeEvent finishEvent) { |
|
|
|
if (Boolean.FALSE.equals(processNodeFinished)) { |
|
|
|
allPurchaseFinished(query, startEvent); |
|
|
|
anyPurchaseNotFinished(query, finishEvent); |
|
|
|
} else { |
|
|
|
allPurchaseFinished(query, finishEvent); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static void allPurchaseFinished(LambdaQueryWrapper<Project> query, AbstractStateChangeEvent event) { |
|
|
|
query.apply("(select t.bidCnt from (select count(1) bidCnt from nd_purchase np where np.project_id = nd_project.id and bid_type = {0}) t where bidCnt > 0) " + |
|
|
|
"= (select count(distinct bid_id) from nd_purchase_status_change npsc where npsc.project_code = nd_project.project_code " + |
|
|
|
"and event = {1})", BidTypeEnum.BUILD_APP.getCode(), event); |
|
|
|
} |
|
|
|
|
|
|
|
private static void anyPurchaseNotFinished(LambdaQueryWrapper<Project> query, AbstractStateChangeEvent event) { |
|
|
|
query.apply("(select t.bidCnt from (select count(1) bidCnt from nd_purchase np where np.project_id = nd_project.id and bid_type = {0}) t where bidCnt > 0) " + |
|
|
|
"!= (select count(distinct bid_id) from nd_purchase_status_change npsc where npsc.project_code = nd_project.project_code " + |
|
|
|
"and event = {1})", BidTypeEnum.BUILD_APP.getCode(), event); |
|
|
|
} |
|
|
|
|
|
|
|
private void fillSystemReplaceInfosAndReferBidStatus(List<String> projectCodes, |
|
|
|
Map<String, List<ProjectGovSystemReplaceInfos>> systemReplaceInfoMap, |
|
|
|
Map<Long, Integer> bidStatusMap) { |
|
|
@@ -723,30 +831,30 @@ public class WorkbenchManage { |
|
|
|
query.notIn(Project::getStatus, ProjectStatusConstant.CHANGE_STOP_DELETE_PASSED) |
|
|
|
.select(Project::getProjectCode, Project::getProjectName, Project::getId, |
|
|
|
Project::getBuildOrgCode, Project::getBuildOrgName); |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT); |
|
|
|
projectQueryExistsProjectStatusChange(query, ProjectStateChangeEvent.PROJECT_APPLICATION_SUBMIT); |
|
|
|
switch (req.getProcessNode()) { |
|
|
|
case PROJECT_DECLARED: |
|
|
|
break; |
|
|
|
case PROJECT_REVIEW: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.PROJECT_REVIEW_PASS); |
|
|
|
projectQueryExistsProjectStatusChange(query, ProjectStateChangeEvent.PROJECT_REVIEW_PASS); |
|
|
|
break; |
|
|
|
case APPROVAL_AMOUNT: |
|
|
|
query.isNotNull(Project::getApprovalAmount).gt(Project::getApprovalAmount, BigDecimal.ZERO); |
|
|
|
break; |
|
|
|
case PROJECT_APPROVAL: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.DECLARED_RECORD_SUBMIT); |
|
|
|
projectQueryExistsProjectStatusChange(query, ProjectStateChangeEvent.DECLARED_RECORD_SUBMIT); |
|
|
|
break; |
|
|
|
case PROJECT_PURCHASE: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_PURCHASE_CONTRACT_RECORD); |
|
|
|
projectQueryExistsProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_PURCHASE_CONTRACT_RECORD); |
|
|
|
break; |
|
|
|
case FIRST_INSPECTED: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES); |
|
|
|
projectQueryExistsProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES); |
|
|
|
break; |
|
|
|
case PROJECT_ADAPTION: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM); |
|
|
|
projectQueryExistsProjectStatusChange(query, ProjectStateChangeEvent.SUBMIT_PURCHASE_ORG_CONFIRM); |
|
|
|
break; |
|
|
|
case FINAL_INSPECTED: |
|
|
|
projectQueryByProjectStatusChange(query, ProjectStateChangeEvent.FINAL_ACCEPTANCE_PASS); |
|
|
|
projectQueryExistsProjectStatusChange(query, ProjectStateChangeEvent.FINAL_ACCEPTANCE_PASS); |
|
|
|
break; |
|
|
|
default: |
|
|
|
return null; |
|
|
|