From dda9e3962d3bdcca21211141dccaf0ea3a84ff5a Mon Sep 17 00:00:00 2001 From: caihaohan Date: Tue, 19 Dec 2023 18:23:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=81=E6=A0=87=E5=88=B6=E4=BF=AE?= =?UTF-8?q?=E8=AE=A2=E5=8F=91=E8=B5=B7=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../process/common/enums/ProcessType.java | 18 +- .../esRevision/entity/ProcessEsRevision.java | 163 ++++++------------ .../listener/RevisionTaskNameConstant.java | 26 +++ .../service/impl/EsRevisionServiceImpl.java | 60 ++++++- 4 files changed, 139 insertions(+), 128 deletions(-) create mode 100644 laws-modules/src/main/java/com/jero/modules/activiti/process/esRevision/listener/RevisionTaskNameConstant.java diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/common/enums/ProcessType.java b/laws-modules/src/main/java/com/jero/modules/activiti/process/common/enums/ProcessType.java index 375e5c7e..08a215e2 100644 --- a/laws-modules/src/main/java/com/jero/modules/activiti/process/common/enums/ProcessType.java +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/common/enums/ProcessType.java @@ -1,11 +1,14 @@ package com.jero.modules.activiti.process.common.enums; +import lombok.Getter; + /** * @author: Mzaxd * @Date: 2023/10/12 9:37 * 流程类型 */ +@Getter public enum ProcessType { /** @@ -20,6 +23,7 @@ public enum ProcessType { ES_CHANGE("企标变更流程", "7", "es-change", "ProcessEsChangeServiceImpl"), ES_RECHECK("企标复审流程", "8", "es-recheck", "ProcessEsRecheckServiceImpl"), ES_ENABLE("已封存企标启用流程", "9", "es-enable", "ProcessEsEnableServiceImpl"), + ES_REVISION("企标制修订流程", "10", "es-revision", "ProcessEsRevisionServiceImpl"), ES_INSPECT_PLAN("企标稽查计划", "16", "inspect_plan", "ProcessEsInspectPlanServiceImpl"), ES_INSPECT("企标稽查流程", "17", "inspect_process", "ProcessEsInspectServiceImpl"), ES_INSPECT_DELAY_APPLY("稽查延期申请流程", "18", "inspect_delay_apply_process", "ProcessEsInspectDelayApplyServiceImpl"), @@ -50,20 +54,6 @@ public enum ProcessType { return null; } - public String getName() { - return name; - } - - public String getValue() { - return value; - } - - public String getProcessKey() { - return processKey; - } - - public String getServiceClassName() { - return serviceClassName;} } diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/esRevision/entity/ProcessEsRevision.java b/laws-modules/src/main/java/com/jero/modules/activiti/process/esRevision/entity/ProcessEsRevision.java index 671b9430..3be457d3 100644 --- a/laws-modules/src/main/java/com/jero/modules/activiti/process/esRevision/entity/ProcessEsRevision.java +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/esRevision/entity/ProcessEsRevision.java @@ -1,10 +1,13 @@ package com.jero.modules.activiti.process.esRevision.entity; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.util.Date; + +import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -17,236 +20,170 @@ public class ProcessEsRevision implements Serializable { /** * 主键ID */ - @TableId + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键ID") private String id; /** * 创建人 */ + @ApiModelProperty(value = "创建人") private String createBy; /** * 创建时间 */ + @ApiModelProperty(value = "创建时间") private Date createTime; /** * 更新人 */ + @ApiModelProperty(value = "更新人") private String updateBy; /** * 更新时间 */ + @ApiModelProperty(value = "更新时间") private Date updateTime; /** * 所属部门 */ + @ApiModelProperty(value = "所属部门") private String orgCode; - /** - * 业务json数据 - */ - private String businessJson; - /** * 0表示未删除,1表示删除 */ + @ApiModelProperty(value = "0表示未删除,1表示删除") private Integer delFlag; /** * 流程实例Id */ + @ApiModelProperty(value = "流程实例Id") private String processInstanceId; + + /** + * 业务json数据 + */ + @ApiModelProperty(value = "业务JSON数据") + private String businessJson; + /** * 执行id */ + @ApiModelProperty(value = "执行id") private String executionId; /** * 是否需要稽查 0不需要 1需要 */ + @TableField(exist = false) + @ApiModelProperty(value = "是否需要稽查 0不需要 1需要") private String inspectFlag; /** * 是否可以进行评审会 */ + @TableField(exist = false) + @ApiModelProperty(value = "是否可以进行评审会") private String reviewMeetingFlag; /** * 评审人 */ + @TableField(exist = false) + @ApiModelProperty(value = "评审人") private String reviewUser; /** * 评分人 */ + @TableField(exist = false) + @ApiModelProperty(value = "评分人") private String raters; /** * 评审日期 */ + @TableField(exist = false) + @ApiModelProperty(value = "评审日期") private Date reviewDate; /** * 评审地点 */ + @TableField(exist = false) + @ApiModelProperty(value = "评审地点") private String reviewPlace; /** * 是否开启征求意见 0不征求 1征求 */ + @TableField(exist = false) + @ApiModelProperty(value = "是否开启征求意见 0不征求 1征求") private String adviceFlag; /** * 部门联络人 */ + @TableField(exist = false) + @ApiModelProperty(value = "部门联络人") private String contactUser; /** * 会议纪要 */ + @TableField(exist = false) + @ApiModelProperty(value = "会议纪要") private String meetingSummary; /** * 参会人员 */ + @TableField(exist = false) + @ApiModelProperty(value = "参会人员") private String meetingUsers; /** * 校对人 */ + @TableField(exist = false) + @ApiModelProperty(value = "校对人") private String proofreader; /** * 审批人(主管级领导) */ + @TableField(exist = false) + @ApiModelProperty(value = "审批人(主管级领导)") private String approvalUser; /** * 审批人(标准化) */ + @TableField(exist = false) + @ApiModelProperty(value = "审批人(标准化)") private String approvalUserStandard; /** * 相关部门领导 */ + @TableField(exist = false) + @ApiModelProperty(value = "相关部门领导") private String relatedLeader; /** * 总工程师 */ + @TableField(exist = false) + @ApiModelProperty(value = "总工程师") private String chiefEngineer; @TableField(exist = false) private static final long serialVersionUID = 1L; - - @Override - public boolean equals(Object that) { - if (this == that) { - return true; - } - if (that == null) { - return false; - } - if (getClass() != that.getClass()) { - return false; - } - ProcessEsRevision other = (ProcessEsRevision) that; - return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) - && (this.getCreateBy() == null ? other.getCreateBy() == null : this.getCreateBy().equals(other.getCreateBy())) - && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) - && (this.getUpdateBy() == null ? other.getUpdateBy() == null : this.getUpdateBy().equals(other.getUpdateBy())) - && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) - && (this.getOrgCode() == null ? other.getOrgCode() == null : this.getOrgCode().equals(other.getOrgCode())) - && (this.getBusinessJson() == null ? other.getBusinessJson() == null : this.getBusinessJson().equals(other.getBusinessJson())) - && (this.getDelFlag() == null ? other.getDelFlag() == null : this.getDelFlag().equals(other.getDelFlag())) - && (this.getProcessInstanceId() == null ? other.getProcessInstanceId() == null : this.getProcessInstanceId().equals(other.getProcessInstanceId())) - && (this.getExecutionId() == null ? other.getExecutionId() == null : this.getExecutionId().equals(other.getExecutionId())) - && (this.getInspectFlag() == null ? other.getInspectFlag() == null : this.getInspectFlag().equals(other.getInspectFlag())) - && (this.getReviewMeetingFlag() == null ? other.getReviewMeetingFlag() == null : this.getReviewMeetingFlag().equals(other.getReviewMeetingFlag())) - && (this.getReviewUser() == null ? other.getReviewUser() == null : this.getReviewUser().equals(other.getReviewUser())) - && (this.getRaters() == null ? other.getRaters() == null : this.getRaters().equals(other.getRaters())) - && (this.getReviewDate() == null ? other.getReviewDate() == null : this.getReviewDate().equals(other.getReviewDate())) - && (this.getReviewPlace() == null ? other.getReviewPlace() == null : this.getReviewPlace().equals(other.getReviewPlace())) - && (this.getAdviceFlag() == null ? other.getAdviceFlag() == null : this.getAdviceFlag().equals(other.getAdviceFlag())) - && (this.getContactUser() == null ? other.getContactUser() == null : this.getContactUser().equals(other.getContactUser())) - && (this.getMeetingSummary() == null ? other.getMeetingSummary() == null : this.getMeetingSummary().equals(other.getMeetingSummary())) - && (this.getMeetingUsers() == null ? other.getMeetingUsers() == null : this.getMeetingUsers().equals(other.getMeetingUsers())) - && (this.getProofreader() == null ? other.getProofreader() == null : this.getProofreader().equals(other.getProofreader())) - && (this.getApprovalUser() == null ? other.getApprovalUser() == null : this.getApprovalUser().equals(other.getApprovalUser())) - && (this.getApprovalUserStandard() == null ? other.getApprovalUserStandard() == null : this.getApprovalUserStandard().equals(other.getApprovalUserStandard())) - && (this.getRelatedLeader() == null ? other.getRelatedLeader() == null : this.getRelatedLeader().equals(other.getRelatedLeader())) - && (this.getChiefEngineer() == null ? other.getChiefEngineer() == null : this.getChiefEngineer().equals(other.getChiefEngineer())); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); - result = prime * result + ((getCreateBy() == null) ? 0 : getCreateBy().hashCode()); - result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); - result = prime * result + ((getUpdateBy() == null) ? 0 : getUpdateBy().hashCode()); - result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); - result = prime * result + ((getOrgCode() == null) ? 0 : getOrgCode().hashCode()); - result = prime * result + ((getBusinessJson() == null) ? 0 : getBusinessJson().hashCode()); - result = prime * result + ((getDelFlag() == null) ? 0 : getDelFlag().hashCode()); - result = prime * result + ((getProcessInstanceId() == null) ? 0 : getProcessInstanceId().hashCode()); - result = prime * result + ((getExecutionId() == null) ? 0 : getExecutionId().hashCode()); - result = prime * result + ((getInspectFlag() == null) ? 0 : getInspectFlag().hashCode()); - result = prime * result + ((getReviewMeetingFlag() == null) ? 0 : getReviewMeetingFlag().hashCode()); - result = prime * result + ((getReviewUser() == null) ? 0 : getReviewUser().hashCode()); - result = prime * result + ((getRaters() == null) ? 0 : getRaters().hashCode()); - result = prime * result + ((getReviewDate() == null) ? 0 : getReviewDate().hashCode()); - result = prime * result + ((getReviewPlace() == null) ? 0 : getReviewPlace().hashCode()); - result = prime * result + ((getAdviceFlag() == null) ? 0 : getAdviceFlag().hashCode()); - result = prime * result + ((getContactUser() == null) ? 0 : getContactUser().hashCode()); - result = prime * result + ((getMeetingSummary() == null) ? 0 : getMeetingSummary().hashCode()); - result = prime * result + ((getMeetingUsers() == null) ? 0 : getMeetingUsers().hashCode()); - result = prime * result + ((getProofreader() == null) ? 0 : getProofreader().hashCode()); - result = prime * result + ((getApprovalUser() == null) ? 0 : getApprovalUser().hashCode()); - result = prime * result + ((getApprovalUserStandard() == null) ? 0 : getApprovalUserStandard().hashCode()); - result = prime * result + ((getRelatedLeader() == null) ? 0 : getRelatedLeader().hashCode()); - result = prime * result + ((getChiefEngineer() == null) ? 0 : getChiefEngineer().hashCode()); - return result; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(getClass().getSimpleName()); - sb.append(" ["); - sb.append("Hash = ").append(hashCode()); - sb.append(", id=").append(id); - sb.append(", createBy=").append(createBy); - sb.append(", createTime=").append(createTime); - sb.append(", updateBy=").append(updateBy); - sb.append(", updateTime=").append(updateTime); - sb.append(", orgCode=").append(orgCode); - sb.append(", businessJson=").append(businessJson); - sb.append(", delFlag=").append(delFlag); - sb.append(", processInstanceId=").append(processInstanceId); - sb.append(", executionId=").append(executionId); - sb.append(", inspectFlag=").append(inspectFlag); - sb.append(", reviewMeetingFlag=").append(reviewMeetingFlag); - sb.append(", reviewUser=").append(reviewUser); - sb.append(", raters=").append(raters); - sb.append(", reviewDate=").append(reviewDate); - sb.append(", reviewPlace=").append(reviewPlace); - sb.append(", adviceFlag=").append(adviceFlag); - sb.append(", contactUser=").append(contactUser); - sb.append(", meetingSummary=").append(meetingSummary); - sb.append(", meetingUsers=").append(meetingUsers); - sb.append(", proofreader=").append(proofreader); - sb.append(", approvalUser=").append(approvalUser); - sb.append(", approvalUserStandard=").append(approvalUserStandard); - sb.append(", relatedLeader=").append(relatedLeader); - sb.append(", chiefEngineer=").append(chiefEngineer); - sb.append(", serialVersionUID=").append(serialVersionUID); - sb.append("]"); - return sb.toString(); - } } \ No newline at end of file diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/esRevision/listener/RevisionTaskNameConstant.java b/laws-modules/src/main/java/com/jero/modules/activiti/process/esRevision/listener/RevisionTaskNameConstant.java new file mode 100644 index 00000000..e12e4305 --- /dev/null +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/esRevision/listener/RevisionTaskNameConstant.java @@ -0,0 +1,26 @@ +package com.jero.modules.activiti.process.esRevision.listener; + +/** + * @author: Mzaxd + * @Date: 2023/12/19 15:14 + */ +public class RevisionTaskNameConstant { + + public static final String MAIN_DRAFT_USER_DISTRIBUTE = "主起草人起草分发"; + public static final String OTHER_DRAFT_USER_UPLOAD = "其他起草人上传企标"; + public static final String STANDARDIZATION_CHECK = "标准化审核"; + public static final String RATER_RATE = "评分人打分"; + public static final String CONFIRM_ADVISE = "标准化确认是否开启征求意见"; + public static final String CONTACT_USER_DISTRIBUTE = "部所联络人下发"; + public static final String ADVICE = "征求意见对象填写意见"; + public static final String CONTACT_USER_COLLECT = "部所联络人汇总数据"; + public static final String CONTACT_USER_LEADER_APPROVAL = "部所联络人主管级领导审批"; + public static final String MAIN_DRAFT_USER_COLLECT = "主起草人汇总"; + public static final String MAIN_DRAFT_USER_UPLOAD = "主起草人上传会议纪要"; + public static final String LEADER_APPROVAL = "主管级领导审批"; + public static final String STANDARDIZATION_APPROVAL = "标准化审批"; + public static final String RELATED_LEADER_APPROVAL = "相关部门领导会签"; + public static final String CHIEF_ENGINEER_APPROVAL = "总工程师审批"; + public static final String MAIN_DRAFT_USER_RELEASE = "主起草人发布"; + +} diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/esRevision/service/impl/EsRevisionServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/activiti/process/esRevision/service/impl/EsRevisionServiceImpl.java index 83d117bf..1b0484e5 100644 --- a/laws-modules/src/main/java/com/jero/modules/activiti/process/esRevision/service/impl/EsRevisionServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/esRevision/service/impl/EsRevisionServiceImpl.java @@ -3,8 +3,9 @@ package com.jero.modules.activiti.process.esRevision.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.jero.common.exception.JeroBootException; import com.jero.modules.activiti.enums.ProcessTypeEnum; +import com.jero.modules.activiti.process.common.entity.CommonVO; +import com.jero.modules.activiti.process.common.enums.ProcessType; import com.jero.modules.activiti.process.common.service.ActFlowCommonService; -import com.jero.modules.activiti.process.esRecheck.entity.ProcessEsRecheck; import com.jero.modules.activiti.process.esRecheck.entity.vo.ESRecheckDataVO; import com.jero.modules.activiti.process.esRevision.entity.ProcessEsRevision; import com.jero.modules.activiti.process.esRevision.entity.vo.ESRevisionDataVO; @@ -14,12 +15,15 @@ import com.jero.modules.activiti.process.fb.dto.BasicProcessInfoDTO; import com.jero.modules.activiti.process.fb.service.IProcessHandleService; import com.jero.modules.activiti.process.fb.vo.ProcessInfoVO; import com.jero.modules.activiti.service.ProcessNodeLinkService; +import com.jero.modules.sys.utils.UserUtils; import lombok.extern.slf4j.Slf4j; import org.activiti.engine.RuntimeService; +import org.activiti.engine.runtime.ProcessInstance; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.*; /** * @author ThinkBook @@ -47,7 +51,61 @@ public class EsRevisionServiceImpl extends ServiceImpl actVariables = this.setVariables(revisionData); + // 删除草稿 + actFlowCommonService.getExistDraftAndRemove(commonVO, ProcessTypeEnum.ES_REVISION); + // 启动流程 + ProcessInstance processInstance = actFlowCommonService.startProcess(processDefinitionKey, actVariables); + // 获取流程实例ID + String processDefinitionId = processInstance.getProcessDefinitionId(); + String processInstanceId = processInstance.getId(); + // 手动设置所有流程变量 + actFlowCommonService.setProcessVariables(processInstanceId, actVariables); + // 自动完成第一个任务 + actFlowCommonService.autoCompleteFirstTask(userId, processInstanceId, processDefinitionId, commonVO); + // 保存选人信息 + processNodeLinkService.saveNodeUserLink(processDefinitionId, processInstanceId, this.getUserMap(actVariables)); + // 保存数据 + data.setProcessInstanceId(processInstanceId); + save(data); + // 根据流程实例id更新流程总表 + String prcName = commonVO.getPrcName(); + String prcMes = commonVO.getPrcMes(); + Date dueTime = commonVO.getDueTime(); + Integer prcType = ProcessTypeEnum.ES_REVISION.getValue(); + actFlowCommonService.updateProcessAll(processInstanceId, userId, prcName, prcMes, prcType, dueTime); + } + private Map setVariables(ESRevisionDataVO revisionData) { + Map actVariables = new HashMap<>(); + Map flowUser = revisionData.getFlowUser(); + ProcessEsRevision data = revisionData.getData(); + actVariables.put("mainDraftUser", flowUser.get("mainDraftUser")); + // 获取分发人 + return actVariables; + } + + private Map getUserMap(Map variables) { + // 转成逗号拼接 + variables.put("mainDraftUser", Optional.ofNullable((HashSet) variables.get("contactUserList")) + .map(list -> String.join(",", list)) + .orElse("")); + return variables; + } + + public void startRunTask(ESRevisionDataVO revisionData) { + // do nothing now } @Override