From 52b6e62d61a44e115b2364f9388699bdc3fcd171 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Fri, 24 Feb 2023 17:58:21 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BA=93=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=A4=84=E7=90=86=E8=BF=9B=E5=BA=A6=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/constant/CommonConstant.java | 11 ++++ .../controller/ProjectLibController.java | 7 +++ .../pmapi/projectlib/enumeration/InstTypeEnum.java | 43 +++++++++++++ .../projectlib/enumeration/StepStatusEnum.java | 41 +++++++++++++ .../handler/AbstractProcessBusinessHandler.java | 43 +++++++++++++ .../projectlib/handler/DeptUnitedReviewHandle.java | 70 ++++++++++++++++++++++ .../projectlib/handler/ProjectDeclareHandle.java | 44 ++++++++++++++ .../projectlib/handler/UnitInnerAuditHandle.java | 65 ++++++++++++++++++++ .../pmapi/projectlib/model/vo/ProcessDetailVO.java | 37 ++++++++++++ .../pmapi/todocenter/manage/TodoCenterManage.java | 1 + 10 files changed, 362 insertions(+) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/InstTypeEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/StepStatusEnum.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/AbstractProcessBusinessHandler.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/DeptUnitedReviewHandle.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/ProjectDeclareHandle.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/UnitInnerAuditHandle.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProcessDetailVO.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConstant.java index 7898300..8dc2105 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConstant.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConstant.java @@ -18,4 +18,15 @@ public class CommonConstant { public static final Integer SUB_COMMENT_SIZE_MIN = 0; public static final Integer SUB_COMMENT_SIZE_MAX = 160; + public static final String PROJECT_DECLARE_PREFIX = "projectDeclare"; + public static final String UNIT_INNER_AUDIT_PREFIX = "unitInnerAudit"; + public static final String PRELIMINARY_PREVIEW_PREFIX = "preliminaryPreview"; + public static final String DEPT_UNITED_REVIEW_PREFIX = "deptUnitedReview"; + public static final String ANNUAL_PLAN_PREFIX = "annualPlan"; + public static final String CONSTRUCTION_PLAN_REVIEW_PREFIX = "constructionPlanReview"; + public static final String PROJECT_APPROVAL_PREFIX = "projectApproval"; + public static final String TENDER_PURCHASE_PREFIX = "tenderPurchase"; + public static final String PROJECT_PRELIMINARY_INSPECTION_PREFIX = "projectPreliminaryInspection"; + public static final String PROJECT_FINAL_INSPECTION_PREFIX = "projectFinalInspection"; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java index 0f9a893..cb15ea2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/ProjectLibController.java @@ -5,6 +5,7 @@ import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; +import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; import io.swagger.annotations.Api; @@ -40,4 +41,10 @@ public class ProjectLibController { return projectLibManage.getProjectDetail(id); } + @GetMapping("/totalProcessDetail/{projectId}") + @ApiOperation("获取流程当前进度") + private ProcessDetailVO totalProcessDetail(@PathVariable Long projectId){ + return projectLibManage.totalProcessDetail(projectId); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/InstTypeEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/InstTypeEnum.java new file mode 100644 index 0000000..2fdc39a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/InstTypeEnum.java @@ -0,0 +1,43 @@ +package com.ningdatech.pmapi.projectlib.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * + * 实例类型枚举 + * @author CMM + * @since 2023/02/24 16:14 + */ +@Getter +@NoArgsConstructor +@AllArgsConstructor +public enum InstTypeEnum { + /** + * 流程实例类型 + */ + UNIT_INNER_AUDIT(1, "单位内部审批流程"), + PRELIMINARY_PREVIEW(2, "项目预审审批流程"), + DEPT_UNITED_REVIEW(3,"部门联合审批流程"), + CONSTRUCTION_PLAN_REVIEW(4,"建设方案审批流程"), + PROJECT_FINAL_INSPECTION(5,"验收申报审批流程"); + + private Integer code; + private String desc; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (InstTypeEnum t : InstTypeEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/StepStatusEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/StepStatusEnum.java new file mode 100644 index 0000000..0c398d0 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/StepStatusEnum.java @@ -0,0 +1,41 @@ +package com.ningdatech.pmapi.projectlib.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +/** + * 环节状态枚举 + * @author CMM + * @since 2023/02/24 11:51 + */ +public enum StepStatusEnum { + /** + * 环节状态 + */ + NOT_START(1, "未开始"), + ON_GOING(2, "进行中"), + REJECTED(3,"被驳回"), + COMPLETED(4,"已完成"); + + private Integer code; + private String desc; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (StepStatusEnum t : StepStatusEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/AbstractProcessBusinessHandler.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/AbstractProcessBusinessHandler.java new file mode 100644 index 0000000..c0f184e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/AbstractProcessBusinessHandler.java @@ -0,0 +1,43 @@ +package com.ningdatech.pmapi.projectlib.handler; + +import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; + +/** + * 流程业务抽象处理类 + * + * @author CMM + * @since 2023/02/24 14:22 + */ + +public abstract class AbstractProcessBusinessHandler { + /** + * 前缀,用于区分是什么业务 + */ + private String prefix; + + /** + * 构造,子类必须实现 + */ + public AbstractProcessBusinessHandler(){} + + /** + * 操作前缀属性的公开方法 + */ + public String getPrefix(){ + return prefix; + } + + public void setPrefix(String prefix){ + this.prefix = prefix; + } + + /** + * 抽象的,所有具体处理者应该实现的处理逻辑 + * @param projectId 项目ID + * @return void + * @author CMM + * @since 2023/02/24 14:33 + */ + abstract ProcessDetailVO businessHandle(Long projectId); + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/DeptUnitedReviewHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/DeptUnitedReviewHandle.java new file mode 100644 index 0000000..06a7290 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/DeptUnitedReviewHandle.java @@ -0,0 +1,70 @@ +package com.ningdatech.pmapi.projectlib.handler; + +import java.time.LocalDateTime; +import java.util.Objects; + +import org.springframework.stereotype.Component; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; +import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; +import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; +import com.ningdatech.pmapi.projectlib.service.IProjectInstService; +import com.wflow.workflow.bean.vo.ProcessProgressVo; +import com.wflow.workflow.enums.ProcessStatusEnum; +import com.wflow.workflow.service.ProcessInstanceService; + +/** + * 单位内部审核处理 + * + * @author CMM + * @since 2023/02/24 14:35 + */ +@Component +public class DeptUnitedReviewHandle extends AbstractProcessBusinessHandler{ + + private final IProjectInstService projectInstService; + + private final ProcessInstanceService processInstanceService; + + /** + * 设置该业务前缀 + */ + private static final String PREFIX = CommonConstant.DEPT_UNITED_REVIEW_PREFIX; + + public DeptUnitedReviewHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService){ + setPrefix(PREFIX); + this.projectInstService = projectInstService; + this.processInstanceService = processInstanceService; + } + + @Override + ProcessDetailVO businessHandle(Long projectId) { + ProcessDetailVO processDetailVO = new ProcessDetailVO(); + // 根据项目ID查询出单位内部审核流程的流程状态 + // 注意:已经在项目库中的项目,一定是已经开始的项目 + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getProjectId, projectId) + .eq(ProjectInst::getInstType, InstTypeEnum.DEPT_UNITED_REVIEW.getCode())); + if (Objects.isNull(projectInst)){ + processDetailVO.setStepStatus(StepStatusEnum.NOT_START); + return processDetailVO; + } + String instCode = projectInst.getInstCode(); + ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); + String status = instanceDetail.getStatus(); + if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ + processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); + } else if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(status)) { + processDetailVO.setStepStatus(StepStatusEnum.REJECTED); + } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { + processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); + } + // 根据流程处理详情获取流程完成时间 + LocalDateTime finishTime = processDetailVO.getFinishTime(); + processDetailVO.setFinishTime(finishTime); + return processDetailVO; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/ProjectDeclareHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/ProjectDeclareHandle.java new file mode 100644 index 0000000..2feeaf5 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/ProjectDeclareHandle.java @@ -0,0 +1,44 @@ +package com.ningdatech.pmapi.projectlib.handler; + +import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; +import com.ningdatech.pmapi.projectlib.service.IProjectService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.time.LocalDateTime; + +/** + * 项目申报处理 + * + * @author CMM + * @since 2023/02/24 14:35 + */ + +public class ProjectDeclareHandle extends AbstractProcessBusinessHandler{ + + @Autowired + private IProjectService projectService; + + /** + * 设置该业务前缀 + */ + private static final String PREFIX = CommonConstant.PROJECT_DECLARE_PREFIX; + + public ProjectDeclareHandle(){ + setPrefix(PREFIX); + } + + @Override + ProcessDetailVO businessHandle(Long projectId) { + // 因为此时在项目库中的项目,都是已经申报过的项目,所以直接设置环节状态为已完成 + ProcessDetailVO processDetailVO = new ProcessDetailVO(); + processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); + // 项目库中查出申报完成时间 + Project project = projectService.getById(projectId); + LocalDateTime createOn = project.getCreateOn(); + processDetailVO.setFinishTime(createOn); + return processDetailVO; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/UnitInnerAuditHandle.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/UnitInnerAuditHandle.java new file mode 100644 index 0000000..72e9d63 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/handler/UnitInnerAuditHandle.java @@ -0,0 +1,65 @@ +package com.ningdatech.pmapi.projectlib.handler; + +import java.time.LocalDateTime; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.pmapi.projectlib.enumeration.InstTypeEnum; +import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; +import com.ningdatech.pmapi.projectlib.service.IProjectInstService; + +import com.ningdatech.pmapi.common.constant.CommonConstant; +import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; +import com.ningdatech.pmapi.projectlib.model.vo.ProcessDetailVO; +import com.wflow.workflow.bean.vo.ProcessProgressVo; +import com.wflow.workflow.enums.ProcessStatusEnum; +import com.wflow.workflow.service.ProcessInstanceService; +import org.springframework.stereotype.Component; + +/** + * 单位内部审核处理 + * + * @author CMM + * @since 2023/02/24 14:35 + */ +@Component +public class UnitInnerAuditHandle extends AbstractProcessBusinessHandler{ + + private final IProjectInstService projectInstService; + + private final ProcessInstanceService processInstanceService; + + /** + * 设置该业务前缀 + */ + private static final String PREFIX = CommonConstant.UNIT_INNER_AUDIT_PREFIX; + + public UnitInnerAuditHandle(IProjectInstService projectInstService, ProcessInstanceService processInstanceService){ + setPrefix(PREFIX); + this.projectInstService = projectInstService; + this.processInstanceService = processInstanceService; + } + + @Override + ProcessDetailVO businessHandle(Long projectId) { + ProcessDetailVO processDetailVO = new ProcessDetailVO(); + // 根据项目ID查询出单位内部审核流程的流程状态 + // 注意:已经在项目库中的项目,一定是已经开始的项目 + ProjectInst projectInst = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) + .eq(ProjectInst::getProjectId, projectId) + .eq(ProjectInst::getInstType, InstTypeEnum.UNIT_INNER_AUDIT.getCode())); + String instCode = projectInst.getInstCode(); + ProcessProgressVo instanceDetail = processInstanceService.getProgressInstanceDetail(null, instCode); + String status = instanceDetail.getStatus(); + if (ProcessStatusEnum.UNDER_REVIEW.getDesc().equals(status)){ + processDetailVO.setStepStatus(StepStatusEnum.ON_GOING); + } else if (ProcessStatusEnum.BE_REJECTED.getDesc().equals(status)) { + processDetailVO.setStepStatus(StepStatusEnum.REJECTED); + } else if (ProcessStatusEnum.APPROVED.getDesc().equals(status)) { + processDetailVO.setStepStatus(StepStatusEnum.COMPLETED); + } + // 项目库中查出申报完成时间 + LocalDateTime finishTime = processDetailVO.getFinishTime(); + processDetailVO.setFinishTime(finishTime); + return processDetailVO; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProcessDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProcessDetailVO.java new file mode 100644 index 0000000..3f606ee --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProcessDetailVO.java @@ -0,0 +1,37 @@ +package com.ningdatech.pmapi.projectlib.model.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum; +import com.wflow.workflow.bean.vo.ProcessProgressVo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 流程进度详情VO + * + * @author CMM + * @since 2023/02/24 11:25 + */ +@ApiModel(value = "ProcessDetailVO", description = "流程进度详情VO") +@Data +public class ProcessDetailVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("环节状态") + private StepStatusEnum stepStatus; + + @ApiModelProperty("完成时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + private LocalDateTime finishTime; + + @ApiModelProperty("流程处理进度详情") + private ProcessProgressVo processProgressVo; + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 1b8a934..36e078d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -291,6 +291,7 @@ public class TodoCenterManage { break; // 盖章并通过 case SEAL_PASS: + // TODO 调用盖章接口,返回盖章后的文件流 // 通过该任务,流程到下一审核人处 processTaskService.handleTask(param, userId); break;