From d3e8eb9779d06546cf4772575ddef277dfe02562 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 25 Sep 2024 09:07:29 +0800 Subject: [PATCH] =?UTF-8?q?modify:=201.=20=E5=A2=9E=E5=8A=A0=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=90=88=E8=A7=84=E6=80=A7=E5=AE=A1=E6=9F=A5=E8=8A=82?= =?UTF-8?q?=E7=82=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectlib/handle/AbstractProcessHandle.java | 4 +- .../handle/stage/ComplianceReviewHandle.java | 102 +++++++++++++++++++++ .../handle/stage/ProjectDeclareHandle.java | 95 ------------------- 3 files changed, 104 insertions(+), 97 deletions(-) create mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ComplianceReviewHandle.java delete mode 100644 hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectDeclareHandle.java diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessHandle.java index 943d2ed..cfcf84d 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessHandle.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/AbstractProcessHandle.java @@ -5,7 +5,6 @@ import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; import com.wflow.workflow.bean.vo.ProcessDetailVO; import com.wflow.workflow.bean.vo.ProcessInfoVO; -import com.wflow.workflow.bean.vo.ProcessInstanceVo; import com.wflow.workflow.bean.vo.ProcessProgressVo; import com.wflow.workflow.enums.ProcessStatusEnum; import com.wflow.workflow.enums.StepStatusEnum; @@ -36,7 +35,8 @@ public abstract class AbstractProcessHandle implements Ordered, ProcessHandle { @AllArgsConstructor public enum ProcessNode { - PROJECT_DECLARED("项目申报", 1), + PROJECT_DECLARED("项目申报", 0), + COMPLIANCE_REVIEW("合规性审查", 1), PROJECT_REVIEW("项目评审", 2), APPROVAL_AMOUNT("资金下达", 3), PROJECT_APPROVAL("项目立项", 4), diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ComplianceReviewHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ComplianceReviewHandle.java new file mode 100644 index 0000000..19dcb9e --- /dev/null +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ComplianceReviewHandle.java @@ -0,0 +1,102 @@ +package com.hz.pm.api.projectlib.handle.stage; + +import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; +import com.hz.pm.api.common.util.BizUtils; +import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; +import com.hz.pm.api.projectlib.handle.AbstractProcessHandle; +import com.hz.pm.api.projectlib.handle.HandleParamContext; +import com.hz.pm.api.projectlib.model.entity.Project; +import com.hz.pm.api.projectlib.model.entity.ProjectInst; +import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; +import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; +import com.hz.pm.api.projectlib.service.IProjectInstService; +import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; +import com.wflow.workflow.bean.vo.ProcessDetailVO; +import com.wflow.workflow.bean.vo.ProcessProgressVo; +import com.wflow.workflow.enums.StepStatusEnum; +import com.wflow.workflow.service.ProcessInstanceService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import static com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent.*; + +/** + * 项目申报处理 + * + * @author CMM + * @since 2023/02/24 14:35 + */ +@Component +@RequiredArgsConstructor +public class ComplianceReviewHandle extends AbstractProcessHandle { + + private final IProjectStatusChangeService projectStatusChangeService; + private final IProjectInstService projectInstService; + private final ProcessInstanceService processInstanceService; + + @Override + public ProcessNode getProcessNode() { + return ProcessNode.COMPLIANCE_REVIEW; + } + + @Override + public void handle(HandleParamContext ctx) { + Project project = ctx.getProject(); + // 项目申报节点 + ProcessDetailVO startNode = new ProcessDetailVO(); + startNode.setProcessName(ProcessNode.PROJECT_DECLARED.getName()); + startNode.setFinishTime(project.getCreateOn()); + startNode.setStepStatus(StepStatusEnum.COMPLETED); + ctx.getProcessDetails().add(startNode); + // 合规性审查 + ProcessDetailVO detail = new ProcessDetailVO(); + detail.setProcessName(getProcessNode().getName()); + ctx.getProcessDetails().add(detail); + // 项目状态为待立项批复之前的状态 + Map eventMap = projectStatusChangeService.listLastEventMap(project.getProjectCode()); + ctx.setProjectStatusChanges(eventMap); + if (!eventMap.containsKey(PROJECT_APPLICATION_SUBMIT)) { + detail.setStepStatus(StepStatusEnum.NOT_START); + } else { + List projectIds = ProjectIdCodeCacheUtil.get(project.getProjectCode()); + List projectInstList = projectInstService.listByProjectIds(projectIds); + Map instMap = BizUtils.groupFirstMap(projectInstList, + w -> InstTypeEnum.getNoNull(w.getInstType()), + Comparator.comparing(ProjectInst::getCreateOn).reversed()); + ctx.setProjectInstMap(instMap); + Optional event = eventMap.values().stream() + .filter(w -> PROJECT_APPLICATION_SUBMIT.eq(w.getEvent()) + || COMPLIANCE_REVIEW_FAILED.eq(w.getEvent()) + || COMPLIANCE_REVIEW_RESUBMIT.eq(w.getEvent()) + || COMPLIANCE_REVIEW_PASS.eq(w.getEvent()) + ).max(Comparator.comparing(ProjectStatusChange::getCreateOn)); + if (event.isPresent()) { + ProjectStatusChange change = event.get(); + ProjectInst inst = instMap.get(InstTypeEnum.COMPLIANCE_REVIEW); + if (COMPLIANCE_REVIEW_PASS.eq(change.getEvent()) && inst == null) { + detail.setStepStatus(StepStatusEnum.COMPLETED); + detail.setFinishTime(change.getCreateOn()); + } else if (inst != null) { + ProcessProgressVo progress = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode()); + buildStepStatus(detail, progress, change); + } else { + detail.setStepStatus(StepStatusEnum.NOT_START); + } + } else { + detail.setStepStatus(StepStatusEnum.NOT_START); + } + } + ctx.setPreStepStatus(detail.getStepStatus()); + } + + @Override + public int getOrder() { + return getProcessNode().getOrder(); + } + +} diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectDeclareHandle.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectDeclareHandle.java deleted file mode 100644 index 1bef11f..0000000 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/handle/stage/ProjectDeclareHandle.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.hz.pm.api.projectlib.handle.stage; - -import com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent; -import com.hz.pm.api.common.util.BizUtils; -import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; -import com.hz.pm.api.projectlib.handle.AbstractProcessHandle; -import com.hz.pm.api.projectlib.handle.HandleParamContext; -import com.hz.pm.api.projectlib.model.entity.Project; -import com.hz.pm.api.projectlib.model.entity.ProjectInst; -import com.hz.pm.api.projectlib.model.entity.ProjectStatusChange; -import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; -import com.hz.pm.api.projectlib.service.IProjectInstService; -import com.hz.pm.api.projectlib.service.IProjectStatusChangeService; -import com.wflow.workflow.bean.vo.ProcessDetailVO; -import com.wflow.workflow.bean.vo.ProcessProgressVo; -import com.wflow.workflow.enums.StepStatusEnum; -import com.wflow.workflow.service.ProcessInstanceService; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import static com.hz.pm.api.common.statemachine.event.ProjectStateChangeEvent.*; - -/** - * 项目申报处理 - * - * @author CMM - * @since 2023/02/24 14:35 - */ -@Component -@RequiredArgsConstructor -public class ProjectDeclareHandle extends AbstractProcessHandle { - - private final IProjectStatusChangeService projectStatusChangeService; - private final IProjectInstService projectInstService; - private final ProcessInstanceService processInstanceService; - - @Override - public ProcessNode getProcessNode() { - return ProcessNode.PROJECT_DECLARED; - } - - @Override - public void handle(HandleParamContext ctx) { - ProcessDetailVO detail = new ProcessDetailVO(); - detail.setProcessName(getProcessNode().getName()); - ctx.getProcessDetails().add(detail); - Project project = ctx.getProject(); - // 项目状态为待立项批复之前的状态 - Map eventMap = projectStatusChangeService.listLastEventMap(project.getProjectCode()); - ctx.setProjectStatusChanges(eventMap); - if (!eventMap.containsKey(PROJECT_APPLICATION_SUBMIT)) { - detail.setStepStatus(StepStatusEnum.NOT_START); - } else { - List projectIds = ProjectIdCodeCacheUtil.get(project.getProjectCode()); - List projectInstList = projectInstService.listByProjectIds(projectIds); - Map instMap = BizUtils.groupFirstMap(projectInstList, - w -> InstTypeEnum.getNoNull(w.getInstType()), - Comparator.comparing(ProjectInst::getCreateOn).reversed()); - ctx.setProjectInstMap(instMap); - Optional event = eventMap.values().stream() - .filter(w -> PROJECT_APPLICATION_SUBMIT.eq(w.getEvent()) - || COMPLIANCE_REVIEW_FAILED.eq(w.getEvent()) - || COMPLIANCE_REVIEW_RESUBMIT.eq(w.getEvent()) - || COMPLIANCE_REVIEW_PASS.eq(w.getEvent()) - ).max(Comparator.comparing(ProjectStatusChange::getCreateOn)); - if (event.isPresent()) { - ProjectStatusChange change = event.get(); - ProjectInst inst = instMap.get(InstTypeEnum.COMPLIANCE_REVIEW); - if (COMPLIANCE_REVIEW_PASS.eq(change.getEvent()) && inst == null) { - detail.setStepStatus(StepStatusEnum.COMPLETED); - detail.setFinishTime(change.getCreateOn()); - } else if (inst != null) { - ProcessProgressVo progress = processInstanceService.getProgressInstanceDetail(null, inst.getInstCode()); - buildStepStatus(detail, progress, change); - } else { - detail.setStepStatus(StepStatusEnum.NOT_START); - } - } else { - detail.setStepStatus(StepStatusEnum.NOT_START); - } - } - ctx.setPreStepStatus(detail.getStepStatus()); - } - - @Override - public int getOrder() { - return getProcessNode().getOrder(); - } - -}