From cc8aff1344f10a6e8de298efc4809e488a97c6b7 Mon Sep 17 00:00:00 2001 From: wangzhijiang <12345678> Date: Tue, 7 Mar 2023 18:02:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E6=B5=81=E7=A8=8B=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E6=8F=90=E4=BA=A4=E4=BB=BB=E5=8A=A1=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ectCertificationInventoryEOController.java | 7 ++ .../enums/CertificationFlowNodeEnum.java | 24 +++++- ...rojectCertificationInventoryEOService.java | 14 ++++ ...ctCertificationInventoryEOServiceImpl.java | 74 +++++++++++++++++++ 4 files changed, 115 insertions(+), 4 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectCertificationInventoryEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectCertificationInventoryEOController.java index a7db40a4c..dadbccd26 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectCertificationInventoryEOController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/controller/ProjectCertificationInventoryEOController.java @@ -206,4 +206,11 @@ public class ProjectCertificationInventoryEOController extends JeroController getFlowStatusList(@RequestParam("cut") String cut) { return this.projectCertificationInventoryEOService.getFlowStatusList(cut); } + + @AutoLog(value = "项目库-认证清单表-认证流程统一提交任务接口") + @ApiOperation(value="项目库-认证清单表-认证流程统一提交任务接口", notes="项目库-认证清单表-认证流程统一提交任务接口") + @PostMapping(value = "/submitTask") + public Result submitTask(@RequestBody JSONObject json) { + return this.projectCertificationInventoryEOService.submitTask(json); + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/CertificationFlowNodeEnum.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/CertificationFlowNodeEnum.java index 22257da14..afd94aca7 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/CertificationFlowNodeEnum.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/CertificationFlowNodeEnum.java @@ -10,6 +10,7 @@ public enum CertificationFlowNodeEnum { STUDIOFQ("studiofq","R&H Studio发起","R&H Studio initiate"), RZGCSJSRW ("rzgcsjsrw","认证工程师接受任务","Certified engineers accept tasks"), + RZGCSTHRW ("rzgcsthrw","认证工程师退回至studio任务","Certified engineer returns to studio task"), ZRRJSRW ("zrrjsrw","责任人接受任务","The responsible person accepts the task"), ZRRTJRW ("zrrtjrw","责任人提交任务","The responsible person submits the task"), RZGCSSC ("rzgcssc","认证工程师审查","Certified engineer review"), @@ -51,15 +52,30 @@ public enum CertificationFlowNodeEnum { public static String getTextByValue(String key,String cut) { CertificationFlowNodeEnum[] values = values(); - for (CertificationFlowNodeEnum inventoryAffirmNodeEnum : values) { - if (inventoryAffirmNodeEnum.key.equals(key)) { + for (CertificationFlowNodeEnum certificationFlowNodeEnum : values) { + if (certificationFlowNodeEnum.key.equals(key)) { if(StringUtils.equals(cut, CutEnum.CN.getValue())){ - return inventoryAffirmNodeEnum.cnName; + return certificationFlowNodeEnum.cnName; }else if(StringUtils.equals(cut,CutEnum.EN.getValue())){ - return inventoryAffirmNodeEnum.enName; + return certificationFlowNodeEnum.enName; } } } return null; } + + /** + * 根据key获取枚举类 + * @param key + * @return + */ + public static CertificationFlowNodeEnum getEnumByKey(String key) { + CertificationFlowNodeEnum[] values = values(); + for (CertificationFlowNodeEnum certificationFlowNodeEnum : values) { + if (certificationFlowNodeEnum.key.equals(key)) { + return certificationFlowNodeEnum; + } + } + return null; + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java index 51bb2538a..c0c51c178 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectCertificationInventoryEOService.java @@ -114,4 +114,18 @@ public interface IProjectCertificationInventoryEOService extends IService queryWrapper, String roleCode); + + /** + * 认证流程统一提交任务 + * @param json + * @return + */ + Result submitTask(JSONObject json); + + /** + * 认证工程师发起任务 + * @param json + * @return + */ + Result certificationInitiatingTask(JSONObject json); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java index cfcd8962d..76c7e1e0d 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java @@ -615,4 +615,78 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl submitTask(JSONObject json) { + String nodeKey = json.getString("nodeKey"); + + CertificationFlowNodeEnum flowNodeEnum = CertificationFlowNodeEnum.getEnumByKey(nodeKey); + if(ObjectUtils.isEmpty(flowNodeEnum)){ + throw new JeroBootException("根据" + nodeKey + " 的操作节点没有获取到节点信息,请联系管理员!"); + } + + switch (flowNodeEnum){ + case RZGCSJSRW: + return this.certificationInitiatingTask(json); + case RZGCSTHRW: + + break; + case ZRRJSRW: + + break; + case ZRRTJRW: + + break; + case RZGCSSC: + + break; + default: + throw new JeroBootException(nodeKey + " 的操作节点传递有误,请联系管理员!"); + } + + return Result.OK("提交任务成功!"); + } + + /** + * 认证工程师发起任务 + * @param json + * @return + */ + @Override + public Result certificationInitiatingTask(JSONObject json) { + String ids = json.getString("ids"); + if(StringUtils.isEmpty(ids)){ + throw new JeroBootException("至少选择一条数据进行操作!"); + } + + List idList = Arrays.asList(ids.split(",")); + List flowStatusList = new ArrayList<>(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + flowStatusList.add(CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getId,idList); + queryWrapper.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + List projectCertificationInventoryEOList = this.list(queryWrapper); + + if(CollectionUtils.isEmpty(projectCertificationInventoryEOList)){ + throw new JeroBootException("至少选择一条数据流程状态为'清单待校核 或 责任人拒绝的数据'!"); + } + + try { + for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { + projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()); + } + // 认证工程师发起任务,将数据的状态更新为 任务待确认。 + this.updateBatchById(projectCertificationInventoryEOList); + }catch (Exception ex){ + ex.printStackTrace(); + log.error("认证工程师-发起认证清单任务失败:" + ex.getMessage()); + throw new JeroBootException("发起任务失败!"); + } + + return Result.OK("发起任务成功!"); + } + }