diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/enums/ProjectRoleEnum.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/enums/ProjectRoleEnum.java index e07b4c2d9..858e0e1c2 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/enums/ProjectRoleEnum.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/enums/ProjectRoleEnum.java @@ -73,4 +73,8 @@ public enum ProjectRoleEnum { } return null; } + + public int getIntValue() { + return Integer.valueOf(value); + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/feishu/enums/TemplateInfoEnum2.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/feishu/enums/TemplateInfoEnum2.java index 420f4414d..64efabd13 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/feishu/enums/TemplateInfoEnum2.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/feishu/enums/TemplateInfoEnum2.java @@ -114,6 +114,10 @@ public enum TemplateInfoEnum2 { CERTIFICATION_MESSAGE24("发起人审查退回,责任人接收-任务","ctp_AArfOgl3mr4z",""), // 已同步飞书开放平台 CERTIFICATION_MESSAGE25("发起人审查通过,责任人接收通知-通知","ctp_AArffopvM8vQ",""),// 已同步飞书开放平台 + CERTIFICATION_PUBLIC_MESSAGE_G("认证清单-公用消息-绿色","ctp_AAmcXtKz4z6r",""),// 已同步飞书开放平台 + CERTIFICATION_PUBLIC_MESSAGE_Y("认证清单-公用消息-黄色","ctp_AAmcKcXLbh0H",""), // 已同步飞书开放平台 + CERTIFICATION_PUBLIC_MESSAGE_R("认证清单-公用消息-红色","ctp_AAmcLxM85y9p",""),// 已同步飞书开放平台 + // 法规清单发布相关消息模板 REGULATION_LIST_RELEASE1("Studio发起或stuido催办,法规工程师收到消息","ctp_AArfOhy7O9R4",""),// 已同步飞书开放平台 REGULATION_LIST_RELEASE2("法规清单发布-公用消息-绿色","ctp_AArYJam3JTyg",""), // 已同步飞书开放平台 diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/ProjectMessageEnum.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/ProjectMessageEnum.java index 594228b3b..cfa4b10da 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/ProjectMessageEnum.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/ProjectMessageEnum.java @@ -7,13 +7,20 @@ import com.jero.common.constant.enums.CutEnum; * 认证流程 节点枚举类 */ public enum ProjectMessageEnum { - + //法规消息 SJFHXLC("sjfhxlc","设计符合性流程","Design Compliance Process"), YZFHXLC("yzfhxlc","验证符合性流程","Verify Compliance Process"), RWBFQRCH("rwbfqrch","您好,您以下任务已被发起人撤回。","Hello! Your task has been withdrawn by the initiator."), RWJZSJBXG("rwjzsjbxg","您好,以下符合性任务的截止时间已被发起人修改。","Hello! The due date of the compliance task has been modified by the initiator."), RWJFWLXBXG("rwjfwlxbxg","您好,以下符合性任务的交付物类型已被发起人修改。","Hello! The type of deliverables of the compliance task has been modified by the initiator."), RWJFWMBBXG("rwjfwmbbxg","您好,以下符合性任务的交付物模板已被发起人修改。","Hello! The deliverable template of the compliance task has been modified by the initiator."), + //认证消息 + RZRWQR("rzrwqr","认证任务确认","Homologation Task Confirmation"), + PREHOMEQR("Pre-Homoqr","Pre-Homo确认","Pre-Homo Confirmation"), + RZQRRWYQ("rzqrrwyq","您好,请及时查看确认以下任务要求,谢谢!","Hello! Please check and confirm the following task requirement in a timely manner. Thank you!"), + RZRWJZSJBXG("rzrwjzsjbxg","您好,以下任务的截止时间已被发起人修改。","Hello! The due date of the task has been modified by the initiator."), + RZRWJFWLXBXG("rzrwjfwlxbxg","您好,以下任务的交付物类型已被发起人修改。","Hello! The type of deliverables of the task has been modified by the initiator."), + RZRWJFWMBBXG("rzrwjfwmbbxg","您好,以下任务的交付物模板已被发起人修改。","Hello! The deliverable template of the task has been modified by the initiator."), ; String key; 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 bda52b6dd..5ac60ebbb 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 @@ -210,21 +210,32 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl certificationQueryWrap = new QueryWrapper<>(); certificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,projectCertificationInventoryEO.getId()); List oldPciEoList = this.list(certificationQueryWrap); - if(projectCertificationInventoryEO.getEndTime() != null){ - // 编辑截至日期处理逻辑 - this.editEndTime(projectCertificationInventoryEO, oldPciEoList); + if (StringUtils.isNotEmpty(projectCertificationInventoryEO.getSdt())) { + // 编辑工程接口人处理逻辑 + this.editSdt(projectCertificationInventoryEO, oldPciEoList, currentUser); } - if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDutyPerson())){ + if (StringUtils.isNotEmpty(projectCertificationInventoryEO.getDutyPerson())) { // 编辑责任人处理逻辑 - this.editDutyPerson(projectCertificationInventoryEO,oldPciEoList); + this.editDutyPerson(projectCertificationInventoryEO, oldPciEoList, currentUser); } - if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableType()) || StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableTemplate())){ - // 编辑交付物类型、交付物模板逻辑 - // TODO 此处逻辑需要详细需求。如何操作。 + if (projectCertificationInventoryEO.getEndTime() != null) { + // 编辑截至日期处理逻辑 + this.editEndTime(projectCertificationInventoryEO, oldPciEoList, currentUser); + } + if (StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableType())) { + // 编辑交付物类型逻辑 + this.editDeliverableType(projectCertificationInventoryEO, oldPciEoList, currentUser); + } + if (StringUtils.isNotEmpty(projectCertificationInventoryEO.getDeliverableTemplate())) { + // 编辑交付物模板逻辑 + this.editDeliverableTemplate(projectCertificationInventoryEO, oldPciEoList, currentUser); + } // 获取编辑前的数据 @@ -247,8 +258,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl params = new HashMap<>(); params.put("projectLibraryId",projectId); params.put("userId",currentUser.getId()); @@ -396,11 +405,213 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl oldPciEoList, LoginUser currentUser) { + String newDeliverableTemplate = newPciEo.getDeliverableTemplate(); + List oldPciEos = oldPciEoList.stream().filter(pldPciEo -> { + boolean flag = ( + !newDeliverableTemplate.equals(pldPciEo.getDeliverableTemplate()) + && ( + StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ) + ); + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(oldPciEos)){ + ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(oldPciEos.get(0).getProjectLibraryId()); + if(ObjectUtils.isNotEmpty(projectLibraryBase)){ + int role = checkUserRole(oldPciEos.get(0).getProjectLibraryId(),currentUser.getId()); + for (ProjectCertificationInventoryEO oldPciEo : oldPciEos) { + String msgTitleCn = ""; + String msgTitleEn = ""; + String taskDefinitionKey = ""; + if (StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + msgTitleCn = ProjectMessageEnum.RZRWQR.getCnName(); + msgTitleEn = ProjectMessageEnum.RZRWQR.getEnName(); + taskDefinitionKey = CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(); + }else if(StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())) { + msgTitleCn = ProjectMessageEnum.PREHOMEQR.getCnName(); + msgTitleEn = ProjectMessageEnum.PREHOMEQR.getEnName(); + taskDefinitionKey = CertificationFlowNodeEnum.TASK_HANDLING.getKey(); + } + List userIdList = new ArrayList<>(); + userIdList.add(oldPciEo.getDutyPerson()); + if(role == ProjectRoleEnum.STUDIO_ENGINEER.getIntValue()){ + userIdList.addAll(Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","))); + } + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + oldPciEo.setEndTime(newPciEo.getEndTime()); + List PciEoList = new ArrayList<>(); + PciEoList.add(oldPciEo); + this.sendMessageByTemplateId( + PciEoList, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + oldPciEo.getEndTime(), + taskDefinitionKey, + msgTitleCn, + msgTitleEn, + ProjectMessageEnum.RZRWJFWMBBXG.getCnName(), + ProjectMessageEnum.RZRWJFWMBBXG.getEnName() + ); + } + } + } + } + + private void editDeliverableType(ProjectCertificationInventoryEO newPciEo, List oldPciEoList, LoginUser currentUser) { + String newDeliverableType = newPciEo.getDeliverableType(); + List oldPciEos = oldPciEoList.stream().filter(pldPciEo -> { + boolean flag = ( + !newDeliverableType.equals(pldPciEo.getDeliverableType()) + && ( + StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ) + ); + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(oldPciEos)){ + ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(oldPciEos.get(0).getProjectLibraryId()); + if(ObjectUtils.isNotEmpty(projectLibraryBase)){ + int role = checkUserRole(oldPciEos.get(0).getProjectLibraryId(),currentUser.getId()); + for (ProjectCertificationInventoryEO oldPciEo : oldPciEos) { + String msgTitleCn = ""; + String msgTitleEn = ""; + String taskDefinitionKey = ""; + if (StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + msgTitleCn = ProjectMessageEnum.RZRWQR.getCnName(); + msgTitleEn = ProjectMessageEnum.RZRWQR.getEnName(); + taskDefinitionKey = CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(); + }else if(StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())) { + msgTitleCn = ProjectMessageEnum.PREHOMEQR.getCnName(); + msgTitleEn = ProjectMessageEnum.PREHOMEQR.getEnName(); + taskDefinitionKey = CertificationFlowNodeEnum.TASK_HANDLING.getKey(); + } + List userIdList = new ArrayList<>(); + userIdList.add(oldPciEo.getDutyPerson()); + if(role == ProjectRoleEnum.STUDIO_ENGINEER.getIntValue()){ + userIdList.addAll(Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","))); + } + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + oldPciEo.setEndTime(newPciEo.getEndTime()); + List PciEoList = new ArrayList<>(); + PciEoList.add(oldPciEo); + this.sendMessageByTemplateId( + PciEoList, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + oldPciEo.getEndTime(), + taskDefinitionKey, + msgTitleCn, + msgTitleEn, + ProjectMessageEnum.RZRWJFWLXBXG.getCnName(), + ProjectMessageEnum.RZRWJFWLXBXG.getEnName() + ); + } + } + } + } + + /** + * 编辑工程接口人处理逻辑 + */ + private void editSdt(ProjectCertificationInventoryEO pciEo, List oldPciEoList,LoginUser currentUser) { + // 过滤出来,旧数据的接口人与新修改的接口人不是同一个人 + List oldPciEos = oldPciEoList.stream().filter(oldPciEo -> { + boolean flag = ( + !StringUtils.equals(oldPciEo.getDutyPerson(), pciEo.getDutyPerson()) + && ( + StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue()) + ) + ); + return flag; + }).collect(Collectors.toList()); + for (ProjectCertificationInventoryEO oldPciEo : oldPciEos) { + List userIdList = new ArrayList<>(); + userIdList.add(oldPciEo.getSdt()); + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + + List PciEoList = new ArrayList<>(); + PciEoList.add(oldPciEo); + if (StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + this.sendMessageByTemplateId( + PciEoList, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(), + ProjectMessageEnum.RZRWQR.getCnName(), + ProjectMessageEnum.RZRWQR.getEnName(), + ProjectMessageEnum.RWBFQRCH.getCnName(), + ProjectMessageEnum.RWBFQRCH.getEnName() + ); + }else if(StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())){ + this.sendMessageByTemplateId( + PciEoList, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + CertificationFlowNodeEnum.TASK_HANDLING.getKey(), + ProjectMessageEnum.PREHOMEQR.getCnName(), + ProjectMessageEnum.PREHOMEQR.getEnName(), + ProjectMessageEnum.RWBFQRCH.getCnName(), + ProjectMessageEnum.RWBFQRCH.getEnName() + ); + } + } + if (CollectionUtils.isNotEmpty(oldPciEos)) { + List userIdList = oldPciEos.stream().map(ProjectCertificationInventoryEO::getSdt).distinct().collect(Collectors.toList()); + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + if (StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + this.sendMessageByTemplateId( + oldPciEos, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(), + ProjectMessageEnum.RZRWQR.getCnName(), + ProjectMessageEnum.RZRWQR.getEnName(), + ProjectMessageEnum.RZQRRWYQ.getCnName(), + ProjectMessageEnum.RZQRRWYQ.getEnName() + ); + }else if(StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())){ + this.sendMessageByTemplateId( + oldPciEos, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + CertificationFlowNodeEnum.TASK_HANDLING.getKey(), + ProjectMessageEnum.PREHOMEQR.getCnName(), + ProjectMessageEnum.PREHOMEQR.getEnName(), + ProjectMessageEnum.RZQRRWYQ.getCnName(), + ProjectMessageEnum.RZQRRWYQ.getEnName() + ); + } + } + } + /** * 编辑责任人处理逻辑 * @param pciEo */ - private void editDutyPerson(ProjectCertificationInventoryEO pciEo,List oldPciEoList) { + private void editDutyPerson(ProjectCertificationInventoryEO pciEo,List oldPciEoList,LoginUser currentUser) { // 过滤出来,旧数据的责任人与新修改的责任人不是同一个人,并且流程状态是 任务待确认、结果待提交、审查退回的数据,这三个状态的流程数据在责任人节点。 List oldPciEos = oldPciEoList.stream().filter(oldPciEo -> { boolean flag = ( @@ -413,18 +624,72 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl userIdList = new ArrayList<>(); + userIdList.add(oldPciEo.getDutyPerson()); + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + List PciEoList = new ArrayList<>(); + PciEoList.add(oldPciEo); + if (StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + this.sendMessageByTemplateId( + PciEoList, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(), + ProjectMessageEnum.RZRWQR.getCnName(), + ProjectMessageEnum.RZRWQR.getEnName(), + ProjectMessageEnum.RWBFQRCH.getCnName(), + ProjectMessageEnum.RWBFQRCH.getEnName() + ); + }else if(StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())){ + this.sendMessageByTemplateId( + PciEoList, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + CertificationFlowNodeEnum.TASK_HANDLING.getKey(), + ProjectMessageEnum.PREHOMEQR.getCnName(), + ProjectMessageEnum.PREHOMEQR.getEnName(), + ProjectMessageEnum.RWBFQRCH.getCnName(), + ProjectMessageEnum.RWBFQRCH.getEnName() + ); + } + } if (CollectionUtils.isNotEmpty(oldPciEos)) { List userIdList = oldPciEos.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); - this.sendMessageByTemplateId( - oldPciEos, - TemplateInfoEnum2.CERTIFICATION_MESSAGE15.getValue(), - userIdList, - userInfoList, - pciEo.getEndTime(), - "" - ); + if (StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + this.sendMessageByTemplateId( + oldPciEos, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(), + ProjectMessageEnum.RZRWQR.getCnName(), + ProjectMessageEnum.RZRWQR.getEnName(), + ProjectMessageEnum.RZQRRWYQ.getCnName(), + ProjectMessageEnum.RZQRRWYQ.getEnName() + ); + }else if(StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(pciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())){ + this.sendMessageByTemplateId( + oldPciEos, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + pciEo.getEndTime(), + CertificationFlowNodeEnum.TASK_HANDLING.getKey(), + ProjectMessageEnum.PREHOMEQR.getCnName(), + ProjectMessageEnum.PREHOMEQR.getEnName(), + ProjectMessageEnum.RZQRRWYQ.getCnName(), + ProjectMessageEnum.RZQRRWYQ.getEnName() + ); + } // 如果责任人有变更,将之前责任人的待办中心任务,移交给新的责任人。 QueryWrapper detailQueryWrap = new QueryWrapper<>(); @@ -452,7 +717,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl oldPciEoList) { + private void editEndTime(ProjectCertificationInventoryEO newPciEo, List oldPciEoList,LoginUser currentUser) { Date newEndTime = newPciEo.getEndTime(); // 过滤出来,旧的截止日期不等于更改后的新截止日期,并且数据状态为 任务待确认、结果待提交、审查退回的数据。 List oldPciEos = oldPciEoList.stream().filter(pldPciEo -> { @@ -468,23 +733,49 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl userIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); - List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); - - oldPciEos.get(0).setEndTime(newPciEo.getEndTime()); - this.sendMessageByTemplateId( - oldPciEos, - TemplateInfoEnum2.CERTIFICATION_MESSAGE14.getValue(), - userIdList, - userInfoList, - newEndTime, - "" - ); + // 同步更新待办中心-流程明细截止日期 + this.syncProcessInfoDetailEndTime(newEndTime, oldPciEos); + int role = checkUserRole(oldPciEos.get(0).getProjectLibraryId(),currentUser.getId()); + for (ProjectCertificationInventoryEO oldPciEo : oldPciEos) { + String msgTitleCn = ""; + String msgTitleEn = ""; + String taskDefinitionKey = ""; + if (StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())) { + msgTitleCn = ProjectMessageEnum.RZRWQR.getCnName(); + msgTitleEn = ProjectMessageEnum.RZRWQR.getEnName(); + taskDefinitionKey = CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey(); + }else if(StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + || StringUtils.equals(oldPciEo.getFlowStatus(), CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue())) { + msgTitleCn = ProjectMessageEnum.PREHOMEQR.getCnName(); + msgTitleEn = ProjectMessageEnum.PREHOMEQR.getEnName(); + taskDefinitionKey = CertificationFlowNodeEnum.TASK_HANDLING.getKey(); + } + List userIdList = new ArrayList<>(); + userIdList.add(oldPciEo.getDutyPerson()); + if(role == ProjectRoleEnum.STUDIO_ENGINEER.getIntValue()){ + userIdList.addAll(Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","))); + }else if(role == ProjectRoleEnum.HOMOLOGATION_ENGINEER.getIntValue()){ + userIdList.add(projectLibraryBase.getStudioEngineer()); + } + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + oldPciEo.setEndTime(newPciEo.getEndTime()); + List PciEoList = new ArrayList<>(); + PciEoList.add(oldPciEo); + this.sendMessageByTemplateId( + PciEoList, + TemplateInfoEnum2.CERTIFICATION_PUBLIC_MESSAGE_G.getValue(), + userIdList, + userInfoList, + oldPciEo.getEndTime(), + taskDefinitionKey, + msgTitleCn, + msgTitleEn, + ProjectMessageEnum.RZRWJZSJBXG.getCnName(), + ProjectMessageEnum.RZRWJZSJBXG.getEnName() + ); + } } } } @@ -605,6 +896,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl setBatch(ProjectCertificationInventoryEO projectCertificationInventoryEO) { + //获取当前用户 + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String ids = projectCertificationInventoryEO.getIds(); if(StringUtils.isEmpty(ids)){ throw new JeroBootException("至少选择一条数据进行批量设置!"); @@ -647,18 +940,25 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl flowStatusList = new ArrayList<>(); @@ -728,8 +1028,6 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl projectCertificationInventoryEOS, @@ -738,6 +1036,22 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl userInfoList, Date endTime, String taskDefinitionKey){ + this.sendMessageByTemplateId(projectCertificationInventoryEOS,templeteId,userIdList,userInfoList,endTime,taskDefinitionKey,"","","",""); + } + + /** + * 根据模板发送消息(可发送公共消息) + */ + private void sendMessageByTemplateId(List projectCertificationInventoryEOS, + String templeteId, + List userIdList, + List userInfoList, + Date endTime, + String taskDefinitionKey, + String msgTitleCn, + String msgTitleEn, + String contentCn, + String contentEn){ LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(projectCertificationInventoryEOS.get(0).getProjectLibraryId()); @@ -772,6 +1086,18 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl templateVariableMap = new HashMap<>(); + if(StringUtils.isNotEmpty(msgTitleCn)){ + templateVariableMap.put("msgTitleCn",msgTitleCn); + } + if(StringUtils.isNotEmpty(msgTitleEn)){ + templateVariableMap.put("msgTitleEn",msgTitleEn); + } + if(StringUtils.isNotEmpty(contentCn)){ + templateVariableMap.put("contentCn",contentCn); + } + if(StringUtils.isNotEmpty(contentEn)){ + templateVariableMap.put("contentEn",contentEn); + } templateVariableMap.put("projectNameCn",PRN_CN); templateVariableMap.put("projectNameEn",PRN_EN); templateVariableMap.put("standName",standName); @@ -6323,6 +6649,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl> replacementUserList = (List>) json.get("replacementUserList"); @@ -6348,7 +6676,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl oldPciEoList = this.list(certificationQueryWrap); List oldPciEoList = pciEoList.stream().filter(p -> StringUtils.equals(p.getId(),pciEo.getId())).distinct().collect(Collectors.toList()); // 编辑责任人处理逻辑 - this.editDutyPerson(newPciEo, oldPciEoList); + this.editDutyPerson(newPciEo, oldPciEoList,currentUser); pciEo.setDutyPerson(newUserId); }