From 8a64d6f0113b5a8c9afe56a10ca4cbc26510e0cf Mon Sep 17 00:00:00 2001 From: caihaohan Date: Fri, 13 Oct 2023 15:05:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=AB=8B=E9=A1=B9=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E9=80=89=E6=8B=A9=E4=BC=81=E6=A0=87=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProcessESInitChangeController.java | 20 +++++- .../entity/ProcessEsInitChange.java | 24 +++++-- ...m.java => ESPApplicationCategoryEnum.java} | 9 ++- .../entity/enums/ESPChangeType.java | 40 +++++++++++ .../entity/enums/ESPProjectStatus.java | 31 +++++++++ ...ESProjectType.java => ESPProjectType.java} | 4 +- .../ProcessESInitChangeEndListener.java | 68 +++++++++++++++++-- .../enterprise/entity/dto/ESPlanQueryDTO.java | 6 ++ .../xml/EnterpriseStandardPlanMapper.xml | 10 +++ .../EnterpriseStandardPlanService.java | 11 +++ .../EnterpriseStandardPlanServiceImpl.java | 39 ++++++++--- 11 files changed, 231 insertions(+), 31 deletions(-) rename laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/{ESApplicationCategoryEnum.java => ESPApplicationCategoryEnum.java} (70%) create mode 100644 laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESPChangeType.java create mode 100644 laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESPProjectStatus.java rename laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/{ESProjectType.java => ESPProjectType.java} (89%) diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/controller/ProcessESInitChangeController.java b/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/controller/ProcessESInitChangeController.java index e3c0bcf7..5e5522b7 100644 --- a/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/controller/ProcessESInitChangeController.java +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/controller/ProcessESInitChangeController.java @@ -134,8 +134,24 @@ public class ProcessESInitChangeController { */ @AutoLog(value = "企标立项变更流程-选择企标编号带出数据") @ApiOperation(value="企标立项变更流程-选择企标编号带出数据", notes="企标立项变更流程-选择企标编号带出数据") - @PostMapping(value = "/getESPInfo") - public Result getESPInfo(@RequestParam("id") String espId) { + @GetMapping(value = "/getESPDetail") + public Result getESPDetail(@RequestParam("id") String espId) { return Result.OK(espService.getDetailById(espId)); } + + /** + * 选择企标编号带出数据 + * + * @param projectType + * + */ + @AutoLog(value = "企标立项变更流程-选择企标编号带出数据") + @ApiOperation(value="企标立项变更流程-选择企标编号带出数据", notes="企标立项变更流程-选择企标编号带出数据") + @GetMapping(value = "/getESPList") + public Result getESPList(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + @RequestParam("projectType") String projectType, + @RequestParam(name="espApplicationCategory", required = false) String espApplicationCategory) { + return Result.OK(espService.getESPList(pageNo, pageSize, projectType, espApplicationCategory)); + } } diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/ProcessEsInitChange.java b/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/ProcessEsInitChange.java index 0f6aa56e..0d6cf919 100644 --- a/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/ProcessEsInitChange.java +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/ProcessEsInitChange.java @@ -35,32 +35,42 @@ public class ProcessEsInitChange implements Serializable { private String espId; /** - * 标准编号1 + * 标准计划Id1(合并流程字段) + */ + private String standardIdOne; + + /** + * 标准编号1(合并流程字段) */ private String standardNoOne; /** - * 标准名称1 + * 标准名称1(合并流程字段) */ private String standardNameOne; /** - * 制修订类型1 + * 制修订类型1(合并流程字段) */ private String projectTypeOne; /** - * 标准编号2 + * 标准计划Id2(合并流程字段) + */ + private String standardIdTwo; + + /** + * 标准编号2(合并流程字段) */ private String standardNoTwo; /** - * 标准名称2 + * 标准名称2(合并流程字段) */ private String standardNameTwo; /** - * 制修订类型2 + * 制修订类型2(合并流程字段) */ private String projectTypeTwo; @@ -260,7 +270,7 @@ public class ProcessEsInitChange implements Serializable { private String mainDraftingUnitResponsiblePerson; /** - * 新主起草单位责任人 + * 新主起草单位负责人 */ private String newMainDraftingUnitResponsiblePerson; diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESApplicationCategoryEnum.java b/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESPApplicationCategoryEnum.java similarity index 70% rename from laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESApplicationCategoryEnum.java rename to laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESPApplicationCategoryEnum.java index f83d5bb5..810e1409 100644 --- a/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESApplicationCategoryEnum.java +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESPApplicationCategoryEnum.java @@ -4,11 +4,10 @@ package com.jero.modules.activiti.process.esInitChange.entity.enums; * @author: Mzaxd * @Date: 2023/10/9 16:28 */ -public enum ESApplicationCategoryEnum { +public enum ESPApplicationCategoryEnum { + INITIATION("立项", "3"), - INITIATION("立项", "1"), - - CHANGE("变更", "2") + CHANGE("变更", "4") ; private final String name; @@ -23,7 +22,7 @@ public enum ESApplicationCategoryEnum { return value; } - ESApplicationCategoryEnum(String name, String value) { + ESPApplicationCategoryEnum(String name, String value) { this.name = name; this.value = value; } diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESPChangeType.java b/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESPChangeType.java new file mode 100644 index 00000000..1eadd941 --- /dev/null +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESPChangeType.java @@ -0,0 +1,40 @@ +package com.jero.modules.activiti.process.esInitChange.entity.enums; + +/** + * @author: Mzaxd + * @Date: 2023/10/13 10:57 + */ +public enum ESPChangeType { + + ADD("新增", "add", "新增计划入库时"), + + CHANGE("变更", "change", "变更类型为完成时间变更、责任部门变更、"), + + CANCEL("取消", "cancel", "项目类型为工作终止为取消"), + ; + + + private final String name; + private final String value; + private final String description; + + ESPChangeType(String name, String value, String description) { + this.name = name; + this.value = value; + this.description = description; + } + + public String getName() { + return name; + } + + public String getValue() { + return value; + } + + public String getDescription() { + return description; + } + + +} diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESPProjectStatus.java b/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESPProjectStatus.java new file mode 100644 index 00000000..40f929dc --- /dev/null +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESPProjectStatus.java @@ -0,0 +1,31 @@ +package com.jero.modules.activiti.process.esInitChange.entity.enums; + +/** + * @author: Mzaxd + * @Date: 2023/10/13 14:17 + */ +public enum ESPProjectStatus { + + NOT_STARTED("未开始", "1"), + IN_PROGRESS("进行中", "2"), + OVERDUE_COMPLETED("逾期完成", "3"), + OVERDUE("逾期", "4"), + COMPLETED("完成", "5"); + + private final String name; + + private final String value; + + ESPProjectStatus(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public String getValue() { + return value; + } +} diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESProjectType.java b/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESPProjectType.java similarity index 89% rename from laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESProjectType.java rename to laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESPProjectType.java index e208da8a..0a00fb52 100644 --- a/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESProjectType.java +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/entity/enums/ESPProjectType.java @@ -4,7 +4,7 @@ package com.jero.modules.activiti.process.esInitChange.entity.enums; * @author: Mzaxd * @Date: 2023/10/9 16:28 */ -public enum ESProjectType { +public enum ESPProjectType { /** 立项 **/ ENACT("制定", "1"), @@ -29,7 +29,7 @@ public enum ESProjectType { return value; } - ESProjectType(String name, String value) { + ESPProjectType(String name, String value) { this.name = name; this.value = value; } diff --git a/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/listener/ProcessESInitChangeEndListener.java b/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/listener/ProcessESInitChangeEndListener.java index 9b3af16f..de634820 100644 --- a/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/listener/ProcessESInitChangeEndListener.java +++ b/laws-modules/src/main/java/com/jero/modules/activiti/process/esInitChange/listener/ProcessESInitChangeEndListener.java @@ -1,8 +1,10 @@ package com.jero.modules.activiti.process.esInitChange.listener; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.jero.common.aspect.annotation.RedisLock; import com.jero.modules.activiti.process.esInitChange.entity.ProcessEsInitChange; +import com.jero.modules.activiti.process.esInitChange.entity.enums.ESPApplicationCategoryEnum; +import com.jero.modules.activiti.process.esInitChange.entity.enums.ESPChangeType; +import com.jero.modules.activiti.process.esInitChange.entity.enums.ESPProjectType; import com.jero.modules.activiti.process.esInitChange.service.ProcessEsInitChangeService; import com.jero.modules.laws.enterprise.entity.EnterpriseStandardPlan; import com.jero.modules.laws.enterprise.service.EnterpriseStandardPlanService; @@ -33,19 +35,71 @@ public class ProcessESInitChangeEndListener implements ExecutionListener { */ @Override public void notify(DelegateExecution delegateExecution) { + log.info("企标立项变更流程结束 监听执行器开始执行"); // 获取流程实例ID String processInstanceId = delegateExecution.getProcessInstanceId(); // 根据流程实例Id找到所有流程业务数据 LambdaQueryWrapper esInitChangeWrapper = new LambdaQueryWrapper<>(); esInitChangeWrapper.eq(ProcessEsInitChange::getProcessInstanceId, processInstanceId); List processEsInitChanges = esInitChangeService.list(esInitChangeWrapper); - List enterpriseStandardPlans = BeanCopyUtils.copyBeanList(processEsInitChanges, EnterpriseStandardPlan.class); - // TODO 立项新增-Id置空 - // TODO 变更编辑-Id换为espId -// espService.saveOrUpdateBatch(enterpriseStandardPlans); -// // 软删除流程数据 -// esInitChangeService.removeByProcessInstanceId(processInstanceId); + String applicationCategory = processEsInitChanges.get(0).getApplicationCategory(); + String projectType = processEsInitChanges.get(0).getProjectType(); + List enterpriseStandardPlans; + if (ESPApplicationCategoryEnum.INITIATION.getValue().equals(applicationCategory)) { + // 立项新增-Id置空 + for (ProcessEsInitChange processEsInitChange : processEsInitChanges) { + processEsInitChange.setId(null); + } + } else { + // 将Id设为企标计划的Id + for (ProcessEsInitChange processEsInitChange : processEsInitChanges) { + processEsInitChange.setId(processEsInitChange.getEspId()); + } + // 完成时间变更 + if (ESPProjectType.COMPLETE_TIME_CHANGE.getValue().equals(projectType)) { + enterpriseStandardPlans = BeanCopyUtils.copyBeanList(processEsInitChanges, EnterpriseStandardPlan.class); + espService.saveOrUpdateBatch(enterpriseStandardPlans); + } + + // 工作中止 + if (ESPProjectType.WORK_TERMINATE.getValue().equals(projectType)) { + // 将企标计划变更状态设为取消 + for (ProcessEsInitChange processEsInitChange : processEsInitChanges) { + processEsInitChange.setProjectStatus(ESPChangeType.CANCEL.getValue()); + } + enterpriseStandardPlans = BeanCopyUtils.copyBeanList(processEsInitChanges, EnterpriseStandardPlan.class); + espService.saveOrUpdateBatch(enterpriseStandardPlans); + } + + // 责任部门变更 + if (ESPProjectType.RESPONSIBLE_DEPT_CHANGE.getValue().equals(projectType)) { + // 将企标计划变更状态设为变更 + for (ProcessEsInitChange processEsInitChange : processEsInitChanges) { + processEsInitChange.setProjectStatus(ESPChangeType.CHANGE.getValue()); + } + enterpriseStandardPlans = BeanCopyUtils.copyBeanList(processEsInitChanges, EnterpriseStandardPlan.class); + espService.saveOrUpdateBatch(enterpriseStandardPlans); + } + + // 合并 + if (ESPProjectType.MERGE.getValue().equals(projectType)) { + for (ProcessEsInitChange processEsInitChange : processEsInitChanges) { + processEsInitChange.setId(null); + } + // 删除两个老企标计划 + espService.deleteById(processEsInitChanges.get(0).getStandardIdOne()); + espService.deleteById(processEsInitChanges.get(0).getStandardIdTwo()); + // 生成新企标计划 + enterpriseStandardPlans = BeanCopyUtils.copyBeanList(processEsInitChanges, EnterpriseStandardPlan.class); + espService.saveOrUpdateBatch(enterpriseStandardPlans); + } + } + log.info("数据存入企标计划数据库"); + // 软删除流程数据 + esInitChangeService.removeByProcessInstanceId(processInstanceId); + log.info("软删除流程数据"); //TODO 发起制修订流程 + log.info("自动发起企标制修订流程"); } } diff --git a/laws-modules/src/main/java/com/jero/modules/laws/enterprise/entity/dto/ESPlanQueryDTO.java b/laws-modules/src/main/java/com/jero/modules/laws/enterprise/entity/dto/ESPlanQueryDTO.java index d56bec26..2b711314 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/enterprise/entity/dto/ESPlanQueryDTO.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/enterprise/entity/dto/ESPlanQueryDTO.java @@ -65,6 +65,9 @@ public class ESPlanQueryDTO { private String standardType; @ApiModelProperty(value = "制修订类型") + private String revisionType; + + @ApiModelProperty(value = "申请类别") private String applicationCategory; @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @@ -87,6 +90,9 @@ public class ESPlanQueryDTO { @ApiModelProperty(value = "创建日期") private Date createEndDate; + @ApiModelProperty(value = "项目状态列表,流程中用") + private List projectStatusList; + public void transIdsToList() { if (StrUtil.isBlank(this.selections)) { return; diff --git a/laws-modules/src/main/java/com/jero/modules/laws/enterprise/mapper/xml/EnterpriseStandardPlanMapper.xml b/laws-modules/src/main/java/com/jero/modules/laws/enterprise/mapper/xml/EnterpriseStandardPlanMapper.xml index 367a9ad3..d1b0cf70 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/enterprise/mapper/xml/EnterpriseStandardPlanMapper.xml +++ b/laws-modules/src/main/java/com/jero/modules/laws/enterprise/mapper/xml/EnterpriseStandardPlanMapper.xml @@ -172,6 +172,10 @@ AND p.standard_type = #{param.standardType} + + AND p.application_category = #{param.revisionType} + + AND p.application_category = #{param.applicationCategory} @@ -189,6 +193,12 @@ #{item} + + AND p.project_status IN + + #{item} + +