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 2d41f0066..08ffc61a2 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 @@ -16,6 +16,31 @@ public enum TemplateInfoEnum2 { CERTIFICATION_MESSAGE8("认证清单-任务提醒,已逾期","ctp_AAuDMwOPU71H"), //CERTIFICATION_MESSAGE9("认证清单-责任人分发(转办),第二责任人收到消息","ctp_AAuDM8YP6soc"), CERTIFICATION_MESSAGE10("认证工程师发起流程,责任人收到消息","ctp_AAuePL6rUK1L"), + CERTIFICATION_MESSAGE11("责任人拒绝,认证工程师收到消息","ctp_AAu2ZrSEiB1V"), + CERTIFICATION_MESSAGE12("责任人接受,认证工程师收到消息","ctp_AAuePL6r3B0I"), + CERTIFICATION_MESSAGE13("studio修改认证工程师,被修改人收到消息",""), + CERTIFICATION_MESSAGE14("studio修改符合性截止时间,认证工程师收到消息","ctp_AAuePL6r3XqN"), + CERTIFICATION_MESSAGE15("认证工程师修改责任人,被修改人收到消息","ctp_AAu2ZrSE1z3f"), + CERTIFICATION_MESSAGE16("认证工程师催办,责任人收到消息","ctp_AAuPfn0M0H6i"), + CERTIFICATION_MESSAGE17("责任人下发工程师,工程师接收-任务","ctp_AAuPfn0MCwlH"), + CERTIFICATION_MESSAGE18("任务提醒,责任人接收-任务 发起人催办责任人","ctp_AAuPh3LJ2Nex"), + CERTIFICATION_MESSAGE19("任务提醒,责任人接收-任务 两周通知","ctp_AAuPh3LJKUZk"), + CERTIFICATION_MESSAGE20("任务提醒,责任人接收-任务 一周通知","ctp_AAuXnIIM45B0"), + CERTIFICATION_MESSAGE21("任务提醒,责任人接收-任务 当天","ctp_AAu2lBIgnWND"), + CERTIFICATION_MESSAGE22("任务提醒,责任人接收-任务 逾期之后 每天通知","ctp_AAuPfn0MDOYu"), + CERTIFICATION_MESSAGE23("责任人提交,发起人接收审查任务-任务","ctp_AAuPh3LJKoIX"), + CERTIFICATION_MESSAGE24("发起人审查退回,责任人接收-任务","ctp_AAu2lBIgZK5f"), + CERTIFICATION_MESSAGE25("发起人审查通过,责任人接收通知-通知","ctp_AAuPKJ9CDwIP"), + + + + /** + * 法规清单发布相关消息模板 + */ + REGULATION_LIST_RELEASE1("Studio发起或stuido催办,法规工程师收到消息","ctp_AAuL6mDxMKxu"), + REGULATION_LIST_RELEASE2("法规清单发布-公用消息-绿色","ctp_AAuPKJ9Cj9w5"), + REGULATION_LIST_RELEASE3("法规清单发布-公用消息-红色","ctp_AAu2lBIgaB79"), + REGULATION_LIST_RELEASE4("法规清单发布-公用消息-黄色","ctp_AAuPh3LJWg1x"), ; String name; diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectLawsInventoryEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectLawsInventoryEO.java index 267fac61b..009b2f163 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectLawsInventoryEO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectLawsInventoryEO.java @@ -257,7 +257,7 @@ public class ProjectLawsInventoryEO implements Serializable { /**设计符合性确认-责任人名称*/ @Excel(name = "责任人", width = 20,groupName = "设计符合性确认") @TableField(exist = false) - private String designDutyName; + private String designDutyIdName; /**设计符合性确认-截止时间*/ @Excel(name = "截止时间", width = 20, format = "yyyy-MM-dd",groupName = "设计符合性确认") @@ -391,7 +391,7 @@ public class ProjectLawsInventoryEO implements Serializable { /**验证符合性确认-责任人名称*/ @Excel(name = "责任人", width = 20,groupName = "验证符合性确认") @TableField(exist = false) - private String verifyDutyName; + private String verifyDutyIdName; /**验证符合性确认-截止时间*/ @Excel(name = "截止时间", width = 20, format = "yyyy-MM-dd",groupName = "验证符合性确认") diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/job/CertificationInventoryJob.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/job/CertificationInventoryJob.java index 55146d016..2875f1db0 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/job/CertificationInventoryJob.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/job/CertificationInventoryJob.java @@ -173,7 +173,7 @@ public class CertificationInventoryJob implements Job { } Map sendMsgDataListMap = this.disposeSendMsgDataList(dutyPersonDataList); - // 三天后结束的 + /*// 三天后结束的 List threeDaysList = (List) sendMsgDataListMap.get("threeDaysList"); if(CollectionUtils.isNotEmpty(threeDaysList)){ this.sendLarkCardMsgByTemplate( @@ -183,7 +183,32 @@ public class CertificationInventoryJob implements Job { threeDaysList, TemplateInfoEnum2.CERTIFICATION_MESSAGE6.getValue() ); + }*/ + + // 十四天后结束的 + List fourteenDaysList = (List) sendMsgDataListMap.get("fourteenDaysList"); + if(CollectionUtils.isNotEmpty(fourteenDaysList)){ + this.sendLarkCardMsgByTemplate( + projectLibraryBase, + dutyPersonList, + dutyPersonUserId, + fourteenDaysList, + TemplateInfoEnum2.CERTIFICATION_MESSAGE19.getValue() + ); } + + // 七天后结束的 + List sevenDaysList = (List) sendMsgDataListMap.get("sevenDaysList"); + if(CollectionUtils.isNotEmpty(sevenDaysList)){ + this.sendLarkCardMsgByTemplate( + projectLibraryBase, + dutyPersonList, + dutyPersonUserId, + sevenDaysList, + TemplateInfoEnum2.CERTIFICATION_MESSAGE20.getValue() + ); + } + // 当天结束的 List currentDaysList = (List) sendMsgDataListMap.get("currentDaysList"); if(CollectionUtils.isNotEmpty(currentDaysList)){ @@ -192,7 +217,7 @@ public class CertificationInventoryJob implements Job { dutyPersonList, dutyPersonUserId, currentDaysList, - TemplateInfoEnum2.CERTIFICATION_MESSAGE7.getValue() + TemplateInfoEnum2.CERTIFICATION_MESSAGE21.getValue() ); } // 逾期的 @@ -203,7 +228,7 @@ public class CertificationInventoryJob implements Job { dutyPersonList, dutyPersonUserId, overdueList, - TemplateInfoEnum2.CERTIFICATION_MESSAGE8.getValue() + TemplateInfoEnum2.CERTIFICATION_MESSAGE22.getValue() ); } } @@ -225,15 +250,31 @@ public class CertificationInventoryJob implements Job { calendar.add(Calendar.DATE,3); Date threeDays = calendar.getTime(); + //获取后七天后的时间 + Calendar sevenCalendar=new GregorianCalendar(); + sevenCalendar.setTime(new Date()); + sevenCalendar.add(Calendar.DATE,7); + Date sevenDays = sevenCalendar.getTime(); //fourteen + + //获取后十四天后的时间 + Calendar fourteenCalendar=new GregorianCalendar(); + fourteenCalendar.setTime(new Date()); + fourteenCalendar.add(Calendar.DATE,14); + Date fourteenDays = fourteenCalendar.getTime(); //fourteen + String threeDaysStr = sdf.format(threeDays); + String sevenDaysStr = sdf.format(sevenDays); + String fourteenDaysStr = sdf.format(fourteenDays); String currentDateStr = sdf.format(currentDate); // 当天结束的 List currentDaysList = dutyPersonDataList.stream().filter(data -> { boolean flag = false; //结束日期是当前日期 - if (StringUtils.equals(currentDateStr, sdf.format(data.getEndTime()))) { - flag = true; + if(data.getEndTime() != null){ + if (StringUtils.equals(currentDateStr, sdf.format(data.getEndTime()))) { + flag = true; + } } return flag; }).collect(Collectors.toList()); @@ -241,16 +282,39 @@ public class CertificationInventoryJob implements Job { // 三天后结束的 List threeDaysList = dutyPersonDataList.stream().filter(data -> { boolean flag = false; - //结束日期是当前日期 - if (StringUtils.equals(threeDaysStr, sdf.format(data.getEndTime()))) { - flag = true; + if(data.getEndTime() != null){ + if (StringUtils.equals(threeDaysStr, sdf.format(data.getEndTime()))) { + flag = true; + } + } + return flag; + }).collect(Collectors.toList()); + + // 七天后结束的 + List sevenDaysList = dutyPersonDataList.stream().filter(data -> { + boolean flag = false; + if(data.getEndTime()!=null){ + if (StringUtils.equals(sevenDaysStr, sdf.format(data.getEndTime()))) { + flag = true; + } + } + return flag; + }).collect(Collectors.toList()); + + // 十四天后结束的 + List fourteenDaysList = dutyPersonDataList.stream().filter(data -> { + boolean flag = false; + if(data.getEndTime() != null){ + if (StringUtils.equals(fourteenDaysStr, sdf.format(data.getEndTime()))) { + flag = true; + } } return flag; }).collect(Collectors.toList()); // 逾期的 List overdueList = dutyPersonDataList.stream().filter(data -> { - // 逾期3天、七天、14天 + /*// 逾期3天、七天、14天 Calendar day3Later = new GregorianCalendar(); day3Later.setTime(data.getEndTime()); day3Later.add(Calendar.DATE, 3); @@ -270,13 +334,20 @@ public class CertificationInventoryJob implements Job { StringUtils.equals(sdf.format(overdue3Days), sdf.format(currentDate)) || StringUtils.equals(sdf.format(overdue7Days), sdf.format(currentDate)) || StringUtils.equals(sdf.format(overdue14Days), sdf.format(currentDate)) - ); + );*/ + // 只要早于当前日期都算逾期 + boolean flag = false; + if(data.getEndTime() != null){ + flag = (data.getEndTime().before(currentDate)); + } return flag; }).collect(Collectors.toList()); result.put("currentDaysList",currentDaysList); result.put("threeDaysList",threeDaysList); result.put("overdueList",overdueList); + result.put("sevenDaysList",sevenDaysList); + result.put("fourteenDaysList",fourteenDaysList); return result; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/job/InventoryAffirmJob.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/job/InventoryAffirmJob.java index dae07a815..79ef222d6 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/job/InventoryAffirmJob.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/job/InventoryAffirmJob.java @@ -4,15 +4,15 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.jero.common.constant.enums.MessageType2Enum; import com.jero.common.constant.enums.MessageTypeEnum; import com.jero.common.constant.enums.MsgColorEnum; +import com.jero.common.util.DateUtils; import com.jero.modules.document.entity.BussDocumentLibraryEO; import com.jero.modules.document.service.IBussDocumentLibraryEOService; +import com.jero.modules.feishu.enums.TemplateInfoEnum2; import com.jero.modules.feishu.service.IFeishuService; import com.jero.modules.feishu.vo.FeishuMsg2Vo; import com.jero.modules.feishu.vo.FeishuMsgVo; -import com.jero.modules.project.entity.ProjectLawsInventoryEO; -import com.jero.modules.project.entity.ProjectLibraryBase; -import com.jero.modules.project.entity.ProjectNameInfoEO; -import com.jero.modules.project.entity.ProjectYearNameInfoEO; +import com.jero.modules.project.entity.*; +import com.jero.modules.project.enums.ComplianceFlowStatusEnum; import com.jero.modules.project.enums.InventoryAffirmStatusEnum; import com.jero.modules.project.enums.JumpLinkEnum; import com.jero.modules.project.enums.SendMsgFlagEnum; @@ -70,12 +70,105 @@ public class InventoryAffirmJob implements Job { @Autowired private IBussDocumentLibraryEOService bussDocumentLibraryEOService; + private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + /** * 清单任务到达截止时间后,给用户发送消息 */ @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { - log.info("清单确认流程,定时任务开启 ====================================================="); + log.info("清单确认流程,定时任务开启 ====================================================="); + // 获取法规清单 设计、验证符合性流程状态为 清单待校核的数据。 + QueryWrapper queryWrapperInventory = new QueryWrapper<>(); + queryWrapperInventory.and(queryWrapper -> { + queryWrapper.lambda().eq(ProjectLawsInventoryEO::getDesignFlowStatus, ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + queryWrapper.or(or -> { + or.lambda().eq(ProjectLawsInventoryEO::getDesignFlowStatus, ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()); + }); + }); + List projectLawsInventoryEOList = this.projectLawsInventoryEOMapper.selectList(queryWrapperInventory); + + if(CollectionUtils.isNotEmpty(projectLawsInventoryEOList)){ + // 根据项目进行分组 + Map> lawsInventoryByProjectLibraryIdGroupMap = projectLawsInventoryEOList.stream().collect(Collectors.groupingBy(ProjectLawsInventoryEO::getProjectLibraryId)); + + for (Map.Entry> lawsInventoryByProjectLibraryIdGroup : lawsInventoryByProjectLibraryIdGroupMap.entrySet()) { + String projectLibraryId = lawsInventoryByProjectLibraryIdGroup.getKey(); + List lawsInventoryListByProjectLibraryId = lawsInventoryByProjectLibraryIdGroup.getValue(); + // 根据法规工程师进行分组 + Map> lawsInventoryByRegulationOwnerGroupMap = lawsInventoryListByProjectLibraryId.stream().collect(Collectors.groupingBy(ProjectLawsInventoryEO::getRegulationOwnerId)); + for (Map.Entry> lawsInventoryByRegulationOwnerGroup : lawsInventoryByRegulationOwnerGroupMap.entrySet()) { + String regulationOwnerId = lawsInventoryByRegulationOwnerGroup.getKey(); + List regulationOwnerDataList = lawsInventoryByRegulationOwnerGroup.getValue(); + if(CollectionUtils.isEmpty(regulationOwnerDataList) || StringUtils.isEmpty(regulationOwnerId)){ + continue; + } + + List userIdList = Arrays.asList(regulationOwnerId.split(",")); + Map sendMsgDataListMap = this.disposeSendMsgDataList(regulationOwnerDataList); + + // 三条后结束的 + List threeDaysList = (List) sendMsgDataListMap.get("threeDaysList"); + if(CollectionUtils.isNotEmpty(threeDaysList)){ + Date inventoryAffirmDueDate = threeDaysList.get(0).getInventoryAffirmDueDate(); + String endTime = ""; + if(inventoryAffirmDueDate != null){ + endTime = DateUtils.formatDate(inventoryAffirmDueDate); + } + String serialNumbers = threeDaysList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + // 给法规工程师发消息 + Map params = new HashMap<>(); + params.put("contentCn","您好,以下待办任务距离截止日期仅剩3天,请及时查看处理。"); + params.put("contentEn","Hello! This task will expire in 3 days. Please check and address it in a timely manner. Thank you!"); + params.put("projectLibraryId",projectLibraryId); + params.put("endTime",endTime); + params.put("userIdList",userIdList); + params.put("serialNumbers",serialNumbers); + this.projectLawsInventoryEOService.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE4.getValue(),params); + } + // 当天结束的 + List currentDaysList = (List) sendMsgDataListMap.get("currentDaysList"); + if(CollectionUtils.isNotEmpty(currentDaysList)){ + Date inventoryAffirmDueDate = currentDaysList.get(0).getInventoryAffirmDueDate(); + String endTime = ""; + if(inventoryAffirmDueDate != null){ + endTime = DateUtils.formatDate(inventoryAffirmDueDate); + } + String serialNumbers = currentDaysList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + // 给法规工程师发消息 + Map params = new HashMap<>(); + params.put("contentCn","您好,以下待办任务已到截止日期,请尽快查看处理。"); + params.put("contentEn","Hello! This task will expire today. Please check and address it ASAP. Thank you!"); + params.put("projectLibraryId",projectLibraryId); + params.put("endTime",endTime); + params.put("userIdList",userIdList); + params.put("serialNumbers",serialNumbers); + this.projectLawsInventoryEOService.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE4.getValue(),params); + } + // 逾期的 + List overdueList = (List) sendMsgDataListMap.get("overdueList"); + if(CollectionUtils.isNotEmpty(overdueList)){ + Date inventoryAffirmDueDate = overdueList.get(0).getInventoryAffirmDueDate(); + String endTime = ""; + if(inventoryAffirmDueDate != null){ + endTime = DateUtils.formatDate(inventoryAffirmDueDate); + } + String serialNumbers = overdueList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + // 给法规工程师发消息 + Map params = new HashMap<>(); + params.put("contentCn","您好,以下待办任务已逾期,请尽快处理。"); + params.put("contentEn","Hello! This task is overdue. Please address it ASAP. Thank you!"); + params.put("projectLibraryId",projectLibraryId); + params.put("endTime",endTime); + params.put("userIdList",userIdList); + params.put("serialNumbers",serialNumbers); + this.projectLawsInventoryEOService.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE4.getValue(),params); + } + } + } + } + + /* //获取状态为待确认的数据 QueryWrapper queryWrapperInventory = new QueryWrapper<>(); queryWrapperInventory.lambda().eq(ProjectLawsInventoryEO::getInventoryAffirmStatus, InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue()); @@ -379,4 +472,61 @@ public class InventoryAffirmJob implements Job { }*/ log.info("清单确认流程,定时任务结束 ====================================================="); } + + + /*** + * 处理需要发消息的数据 + * @param projectLawsInventoryEOList + * @return + */ + private Map disposeSendMsgDataList(List projectLawsInventoryEOList) { + Map result = new HashMap<>(); + Date currentDate = new Date(); + String currentDateStr = sdf.format(currentDate); + + //获取后三天的时间 + Calendar calendar=new GregorianCalendar(); + calendar.setTime(new Date()); + calendar.add(Calendar.DATE,3); + Date threeDays = calendar.getTime(); + String threeDaysStr = sdf.format(threeDays); + + // 当天结束的 + List currentDaysList = projectLawsInventoryEOList.stream().filter(data -> { + boolean flag = false; + //结束日期是当前日期 + if(data.getInventoryAffirmDueDate() != null){ + if (StringUtils.equals(currentDateStr, sdf.format(data.getInventoryAffirmDueDate()))) { + flag = true; + } + } + return flag; + }).collect(Collectors.toList()); + + // 三天后结束的 + List threeDaysList = projectLawsInventoryEOList.stream().filter(data -> { + boolean flag = false; + if(data.getInventoryAffirmDueDate() != null){ + if (StringUtils.equals(threeDaysStr, sdf.format(data.getInventoryAffirmDueDate()))) { + flag = true; + } + } + return flag; + }).collect(Collectors.toList()); + + // 逾期的 + List overdueList = projectLawsInventoryEOList.stream().filter(data -> { + // 只要早于当前日期都算逾期 不算当天。 + boolean flag = false; + if(data.getInventoryAffirmDueDate() != null){ + flag = (data.getInventoryAffirmDueDate().before(currentDate) && !StringUtils.equals(currentDateStr, sdf.format(data.getInventoryAffirmDueDate()))); + } + return flag; + }).collect(Collectors.toList()); + + result.put("currentDaysList",currentDaysList); + result.put("threeDaysList",threeDaysList); + result.put("overdueList",overdueList); + return result; + } } 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 c24e7c499..3a6b6e9e9 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 @@ -9,6 +9,7 @@ import com.jero.modules.project.entity.ProjectCertificationInventoryEO; import com.baomidou.mybatisplus.extension.service.IService; import com.jero.modules.system.entity.SysCategory; import com.jero.modules.system.entity.SysRole; +import com.jero.modules.system.entity.SysUser; import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO; import com.jero.modules.todoCenter.entity.ProcessInfoEO; import org.springframework.web.multipart.MultipartFile; @@ -216,4 +217,13 @@ public interface IProjectCertificationInventoryEOService extends IService citeDeliverable(JSONObject json); + + /** + * 根据模板返送消息 + * @param projectCertificationInventoryEOS + * @param templeteId + * @param userIdList + * @param userInfoList + */ + void sendMessageByTemplateId(List projectCertificationInventoryEOS,String templeteId,List userIdList,List userInfoList); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLawsInventoryEOService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLawsInventoryEOService.java index 88bb14dae..ca0d79d06 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLawsInventoryEOService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/IProjectLawsInventoryEOService.java @@ -10,6 +10,7 @@ import com.jero.modules.feishu.vo.FeishuMsgVo; import com.jero.modules.project.entity.ProjectLawsInventoryEO; import com.jero.modules.project.vo.ProjectTaskUrgVo; import com.jero.modules.system.entity.SysCategory; +import com.jero.modules.system.entity.SysDictItem; import com.jero.modules.system.entity.SysRole; import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO; import com.jero.modules.todoCenter.entity.ProcessInfoEO; @@ -192,4 +193,25 @@ public interface IProjectLawsInventoryEOService extends IService projectLawsInventoryEOList,List categoryList); + + /** + * 根据id获取责任领域展示名称 + * @param projectLawsInventoryId + * @param cut + * @param projectLawsInventoryEOList + * @param sysDictItems + * @param dicCode + * @return + */ + String getDutyTerritoryNameById(String projectLawsInventoryId, String cut, List projectLawsInventoryEOList, List sysDictItems,String dicCode); + + void sendMessageByTemplateId(String templeteId,Map params); + + Map getProjectLawsInventoryLinkHrefFeishu(String projectLibraryId, String PRN_CN, String PRN_EN); + + /** + * 法规清单根据清单确认截至日期顺序排序 + * @param projectLawsInventoryEOS + */ + void lawsInventoryEOListSortByInventoryAffirmDueDate(List projectLawsInventoryEOS); } 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 25bc52893..d4ec8e3da 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 @@ -160,6 +160,66 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl flowStatusList = new ArrayList<>(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()); + + QueryWrapper certificationQueryWrap = new QueryWrapper<>(); + certificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,projectCertificationInventoryEO.getId()); + certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + List editEndTimeCertificationInventoryEOS = this.list(certificationQueryWrap); + + // 编辑截至日期发消息 + if(projectCertificationInventoryEO.getEndTime() != null){ + editEndTimeCertificationInventoryEOS = editEndTimeCertificationInventoryEOS.stream().filter(certificationInventory -> { + boolean flag = false; + if(!projectCertificationInventoryEO.getEndTime().equals(certificationInventory.getEndTime())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(editEndTimeCertificationInventoryEOS)){ + + ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(editEndTimeCertificationInventoryEOS.get(0).getProjectLibraryId()); + List userIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + + this.sendMessageByTemplateId( + editEndTimeCertificationInventoryEOS, + TemplateInfoEnum2.CERTIFICATION_MESSAGE14.getValue(), + userIdList, + userInfoList + ); + } + } + + // 如果编辑了责任人,给责任人发消息 + if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDutyPerson())){ + QueryWrapper editDutyPersonCertificationQueryWrap = new QueryWrapper<>(); + editDutyPersonCertificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,projectCertificationInventoryEO.getId()); + List editDutyPersonCertificationInventoryEOS = this.list(editDutyPersonCertificationQueryWrap); + + editDutyPersonCertificationInventoryEOS = editDutyPersonCertificationInventoryEOS.stream().filter(certificationInventory -> { + boolean flag = false; + if(!StringUtils.equals(certificationInventory.getDutyPerson(),projectCertificationInventoryEO.getDutyPerson())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(editDutyPersonCertificationInventoryEOS)){ + List userIdList = editDutyPersonCertificationInventoryEOS.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + this.sendMessageByTemplateId( + editDutyPersonCertificationInventoryEOS, + TemplateInfoEnum2.CERTIFICATION_MESSAGE15.getValue(), + userIdList, + userInfoList + ); + } + } + + Date now = new Date(); projectCertificationInventoryEO.setUpdateTime(now); saveOrUpdate(projectCertificationInventoryEO); @@ -293,6 +353,36 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl flowStatusList = new ArrayList<>(); + flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()); + + QueryWrapper certificationQueryWrap = new QueryWrapper<>(); + certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getId,idList); + certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList); + List projectCertificationInventoryEOS = this.list(certificationQueryWrap); + + if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOS)){ + projectCertificationInventoryEOS = projectCertificationInventoryEOS.stream().filter(certificationInventory -> { + boolean flag = false; + if(!projectCertificationInventoryEO.getEndTime().equals(certificationInventory.getEndTime())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(projectCertificationInventoryEOS)) { + ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(projectCertificationInventoryEOS.get(0).getProjectLibraryId()); + List userIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + + this.sendMessageByTemplateId( + projectCertificationInventoryEOS, + TemplateInfoEnum2.CERTIFICATION_MESSAGE14.getValue(), + userIdList, + userInfoList + ); + } + } if(CollectionUtils.isNotEmpty(updateList)){ this.updateBatchById(updateList); } @@ -302,6 +392,62 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl projectCertificationInventoryEOS,String templeteId,List userIdList,List userInfoList){ + LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(projectCertificationInventoryEOS.get(0).getProjectLibraryId()); + + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + + // 获取认证清单 - 飞书跳转链接 + Map hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN); + String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN"); + String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN"); + + Map standNameAndItemName = this.projectCertificationInventoryEOService.getStandNameAndItemName(projectCertificationInventoryEOS); + String standName = (String) standNameAndItemName.get("standName"); + String itemName = (String) standNameAndItemName.get("itemName"); + + try { + for (String userId : userIdList) { + String thirdId = this.sysUserService.getUserThirdIdByUserId(userInfoList,userId); + + if(StringUtils.isNotEmpty(thirdId)){ + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 + this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOS); + Date endTime = projectCertificationInventoryEOS.get(0).getEndTime(); + + JSONObject larkMesJson = new JSONObject(); + larkMesJson.put("template_id", templeteId); + larkMesJson.put("userIds",thirdId); + + Map templateVariableMap = new HashMap<>(); + templateVariableMap.put("projectNameCn",PRN_CN); + templateVariableMap.put("projectNameEn",PRN_EN); + templateVariableMap.put("standName",standName); + templateVariableMap.put("itemName",itemName); + templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("endTime",DateUtils.formatDate(endTime)); + templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); + templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); + templateVariableMap.put("operateUserName",currentUser.getUsername()); + + larkMesJson.put("templateVariableMap",templateVariableMap); + this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); + } + } + } catch (Exception e) { + log.error("飞书消息推送失败"); + } + } + @Override public void importDisposeData(List datas, String cut) { if(CollectionUtils.isNotEmpty(datas)){ @@ -1008,7 +1154,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); + List dutyPersonList = this.sysUserService.querySysUserListByIdList(dutyPersonIdList); try { // 更新数据状态为 审查退回 this.updateBatchById(projectCertificationInventoryEOList); @@ -1019,6 +1166,13 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); + List dutyPersonList = this.sysUserService.querySysUserListByIdList(dutyPersonIdList); try { // 更新数据状态为 审查通过 this.updateBatchById(projectCertificationInventoryEOList); @@ -1085,6 +1240,14 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList); + try { this.updateBatchById(projectCertificationInventoryEOList); @@ -1217,6 +1383,13 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl projectCertificationInventoryLogEOList = new ArrayList<>(); List processInfoDetailEOList = new ArrayList<>(); @@ -1279,6 +1456,18 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN); + String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN"); + String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN"); + + Map standNameAndItemName = this.projectCertificationInventoryEOService.getStandNameAndItemName(projectCertificationInventoryEOList); + String standName = (String) standNameAndItemName.get("standName"); + String itemName = (String) standNameAndItemName.get("itemName"); + try { List certificationIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getId).distinct().collect(Collectors.toList()); // 将当前责任人的待办任务转为已办 @@ -1295,6 +1484,41 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl certificationEngineerList = Arrays.asList(certificationEngineer.split(",")); + List certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList); + try { + for (String userId : certificationEngineerList) { + String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineers,userId); + + if(StringUtils.isNotEmpty(thirdId)){ + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 + this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); + Date endTime = projectCertificationInventoryEOList.get(0).getEndTime(); + + JSONObject larkMesJson = new JSONObject(); + larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE12.getValue()); + larkMesJson.put("userIds",thirdId); + + Map templateVariableMap = new HashMap<>(); + templateVariableMap.put("projectNameCn",PRN_CN); + templateVariableMap.put("projectNameEn",PRN_EN); + templateVariableMap.put("standName",standName); + templateVariableMap.put("itemName",itemName); + templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("endTime",DateUtils.formatDate(endTime)); + templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); + templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); + templateVariableMap.put("operateUserName",currentUser.getUsername()); + + larkMesJson.put("templateVariableMap",templateVariableMap); + this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); + } + } + } catch (Exception e) { + log.error("飞书消息推送失败"); + } }catch (Exception ex){ ex.printStackTrace(); log.error("责任人-接受任务失败:" + ex.getMessage()); @@ -1357,6 +1581,18 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN); + String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN"); + String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN"); + + Map standNameAndItemName = this.projectCertificationInventoryEOService.getStandNameAndItemName(projectCertificationInventoryEOList); + String standName = (String) standNameAndItemName.get("standName"); + String itemName = (String) standNameAndItemName.get("itemName"); + try { // 将当前责任人的待办任务转为已办 LambdaUpdateWrapper detailUpdateWrap = new LambdaUpdateWrapper<>(); @@ -1391,6 +1627,39 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList); + try { + for (String userId : certificationEngineerList) { + String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineers,userId); + + if(StringUtils.isNotEmpty(thirdId)){ + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 + this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); + Date endTime = projectCertificationInventoryEOList.get(0).getEndTime(); + + JSONObject larkMesJson = new JSONObject(); + larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE11.getValue()); + larkMesJson.put("userIds",thirdId); + + Map templateVariableMap = new HashMap<>(); + templateVariableMap.put("projectNameCn",PRN_CN); + templateVariableMap.put("projectNameEn",PRN_EN); + templateVariableMap.put("standName",standName); + templateVariableMap.put("itemName",itemName); + templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("endTime",DateUtils.formatDate(endTime)); + templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); + templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); + templateVariableMap.put("operateUserName",currentUser.getUsername()); + + larkMesJson.put("templateVariableMap",templateVariableMap); + this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); + } + } + } catch (Exception e) { + log.error("飞书消息推送失败"); + } }catch (Exception ex){ ex.printStackTrace(); log.error("责任人-拒绝任务失败:" + ex.getMessage()); @@ -1906,6 +2175,15 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl userIdList = Arrays.asList(transferUserId.split(",")); + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + this.sendMessageByTemplateId( + projectCertificationInventoryEOList, + TemplateInfoEnum2.CERTIFICATION_MESSAGE17.getValue(), + userIdList, + userInfoList + ); // 获取认证清单 - 飞书跳转链接 // 2023-03-15 去掉此消息 @@ -2054,10 +2332,46 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl> map : certifycationInventoryListByDutyPersonMap.entrySet()) { String key = map.getKey(); List value = map.getValue(); + List userIdList = Arrays.asList(key.split(",")); - String thirdId = this.sysUserService.getUserThirdIdByUserId(dutyPersonList,key); + // 给责任人发消息 + this.sendMessageByTemplateId( + value, + TemplateInfoEnum2.CERTIFICATION_MESSAGE18.getValue(), + userIdList, + dutyPersonList + ); + + /*// 待提交数据 单独发消息 + List toBeSubmitDataList = value.stream().filter(v -> { + boolean flag = false; + if(StringUtils.equals(v.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(toBeSubmitDataList)) { + + this.sendMessageByTemplateId( + toBeSubmitDataList, + TemplateInfoEnum2.CERTIFICATION_MESSAGE18.getValue(), + userIdList, + dutyPersonList + ); + }*/ + + /*String thirdId = this.sysUserService.getUserThirdIdByUserId(dutyPersonList,key); if(StringUtils.isNotEmpty(thirdId)){ + // 过滤掉 待提交的数据,正常发消息 + value = value.stream().filter(v -> { + boolean flag = false; + if(!StringUtils.equals(v.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 Collections.sort(value, new Comparator() { @Override @@ -2076,7 +2390,13 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl templateVariableMap = new HashMap<>(); @@ -2094,7 +2414,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl designDutyId.equals(e.getId())). map(SysUser::getUsername).collect(Collectors.joining(",")); - projectLawsInventoryEO.setDesignDutyName(designDutyName); + projectLawsInventoryEO.setDesignDutyIdName(designDutyName); } //prehomo确认 @@ -1527,7 +1528,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl verifyDutyId.equals(e.getId())). map(SysUser::getUsername).collect(Collectors.joining(",")); - projectLawsInventoryEO.setVerifyDutyName(verifyDutyName); + projectLawsInventoryEO.setVerifyDutyIdName(verifyDutyName); } } @@ -3552,6 +3553,15 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getDesignDutyId())).map(f -> f.getUsername()).collect(Collectors.toList()); if(collect.size() != 0){ String userName = collect.get(0); - projectLawsInventoryEO.setDesignDutyName(userName); + projectLawsInventoryEO.setDesignDutyIdName(userName); } } if (StringUtils.isNotBlank(projectLawsInventoryEO.getPrehomoDutyId())) { @@ -4092,7 +4102,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getVerifyDutyId())).map(f -> f.getUsername()).collect(Collectors.toList()); if(collect.size() != 0){ String userName = collect.get(0); - projectLawsInventoryEO.setVerifyDutyName(userName); + projectLawsInventoryEO.setVerifyDutyIdName(userName); } } } @@ -4397,7 +4407,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getDesignDutyId())).map(f -> f.getUsername()).collect(Collectors.toList()); if(collect.size() != 0){ String userName = collect.get(0); - projectLawsInventoryEO.setDesignDutyName(userName); + projectLawsInventoryEO.setDesignDutyIdName(userName); } } if (StringUtils.isNotBlank(projectLawsInventoryEO.getPrehomoDutyId())) { @@ -4485,7 +4495,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl collect = userList.stream().filter(e -> e.getId().equals(projectLawsInventoryEO.getVerifyDutyId())).map(f -> f.getUsername()).collect(Collectors.toList()); if(collect.size() != 0){ String userName = collect.get(0); - projectLawsInventoryEO.setVerifyDutyName(userName); + projectLawsInventoryEO.setVerifyDutyIdName(userName); } } } @@ -5707,7 +5717,14 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl change(JSONObject parmas) { String ids = parmas.getString("ids"); + String projectLibraryId = parmas.getString("projectLibraryId"); if(StringUtils.isNotEmpty(ids)){ + + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(ProjectLawsInventoryEO::getId, Arrays.asList(ids.split(","))); + queryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId); + List projectLawsInventoryEOS = this.list(queryWrapper); + List idList = Arrays.asList(ids.split(",")); String projectLawsInventoryIds = ids; String pIds = ""; @@ -5836,6 +5853,26 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl userIdList = projectLawsInventoryEOS.stream().map(ProjectLawsInventoryEO::getRegulationOwnerId).distinct().collect(Collectors.toList()); + String serialNumbers = projectLawsInventoryEOS.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + Map paramsMsg = new HashMap<>(); + paramsMsg.put("contentCn","您好,该法规已被发起人撤回。"); + paramsMsg.put("contentEn","Hello! This regulation has been withdrawn by the initiator."); + paramsMsg.put("projectLibraryId",projectLibraryId); + paramsMsg.put("endTime",endTime); + paramsMsg.put("userIdList",userIdList); + paramsMsg.put("serialNumbers",serialNumbers); + this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE2.getValue(),paramsMsg); } return Result.OK("变更成功!"); } @@ -7567,7 +7604,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl collect = sysUserList.stream() .filter(e -> e.getId().equals(projectLawsInventoryEO.getDesignDutyId())).collect(Collectors.toList()); if(collect.size() != 0){ - projectLawsInventoryEO.setDesignDutyName(collect.get(0).getUsername()); + projectLawsInventoryEO.setDesignDutyIdName(collect.get(0).getUsername()); } } @@ -7603,7 +7640,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl collect = sysUserList.stream() .filter(e -> e.getId().equals(projectLawsInventoryEO.getVerifyDutyId())).collect(Collectors.toList()); if(collect.size() != 0){ - projectLawsInventoryEO.setVerifyDutyName(collect.get(0).getUsername()); + projectLawsInventoryEO.setVerifyDutyIdName(collect.get(0).getUsername()); } } @@ -9979,6 +10016,8 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl params = new HashMap<>(); + params.put("contentCn","您好,请及时校核法规清单内容并发起符合性流程,谢谢!"); + params.put("contentEn","Please check the content of the regulation list and initiate the compliance process in a timely manner. Thank you!"); + params.put("projectLibraryId",projectLibraryId); + params.put("endTime",inventoryAffirmDueDate); + params.put("userIdList",userIdList); + this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE1.getValue(),params); + return Result.OK("发起清单确认成功!"); } @@ -10025,6 +10075,22 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl projectLawsInventoryEOS = this.baseMapper.selectList(queryWrapper); + + projectLawsInventoryEOS = projectLawsInventoryEOS.stream().filter(lawsInventory -> { + boolean flag = false; + if(StringUtils.equals(lawsInventory.getDesignFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue())||StringUtils.equals(lawsInventory.getVerifyFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + this.lawsInventoryEOListSortByInventoryAffirmDueDate(projectLawsInventoryEOS); + Date inventoryAffirmDueDate = projectLawsInventoryEOS.get(0).getInventoryAffirmDueDate(); + String endTime = ""; + if(inventoryAffirmDueDate != null){ + endTime = DateUtils.formatDate(inventoryAffirmDueDate); + } + for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOS) { if(StringUtils.equals(projectLawsInventoryEO.getDesignFlowStatus(), ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue())){ projectLawsInventoryEO.setDesignFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()); @@ -10034,8 +10100,21 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl userIdList = projectLawsInventoryEOS.stream().map(ProjectLawsInventoryEO::getRegulationOwnerId).distinct().collect(Collectors.toList()); + String serialNumbers = projectLawsInventoryEOS.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + this.updateBatchById(projectLawsInventoryEOS); + // 给法规工程师发消息 + Map params = new HashMap<>(); + params.put("contentCn","您好,该任务已被发起人撤回。"); + params.put("contentEn","Hello! This regulation has been withdrawn by the initiator."); + params.put("projectLibraryId",projectLibraryId); + params.put("endTime",endTime); + params.put("userIdList",userIdList); + params.put("serialNumbers",serialNumbers); + this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE2.getValue(),params); + return Result.OK("撤回成功!"); } @@ -10074,6 +10153,26 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl userIdList = Arrays.asList(studioUserInfo.getId().split(",")); + String serialNumbers = projectLawsInventoryEOS.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + // 给studio发消息 + Map params = new HashMap<>(); + String contentCn = "您好,该任务被"+ currentUser.getUsername() +"退回,请及时查看处理。"; + String contentEn = "Hello! This task is rejected by "+ currentUser.getUsername() +". Please check and address it in a timely manner."; + params.put("contentCn",contentCn); + params.put("contentEn",contentEn); + params.put("projectLibraryId",projectLibraryId); + params.put("endTime",endTime); + params.put("userIdList",userIdList); + params.put("serialNumbers",serialNumbers); + this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE3.getValue(),params); return Result.OK("退回成功!"); } @@ -10096,5 +10195,115 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl projectLawsInventoryEOList, List sysDictItems,String dicCode) { + String result = ""; + for (ProjectLawsInventoryEO lawsInventory : projectLawsInventoryEOList) { + if(StringUtils.equals(projectLawsInventoryId,lawsInventory.getId())){ + String dutyTerritory = lawsInventory.getDutyTerritory(); + result = disposeShowDictItemValue(sysDictItems, dutyTerritory,cut,ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue()); + break; + } + } + return result; + } + + @Override + public void sendMessageByTemplateId(String templeteId, Map params) { + LoginUser currentUser = null; + try { + currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + }catch (Exception ex) { + log.error("获取当前用户信息失败!"); + } + + List userIdList = (List) params.get("userIdList"); + if (CollectionUtils.isNotEmpty(userIdList)) { + List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); + + String projectLibraryId = (String) params.get("projectLibraryId"); + String endTime = (String) params.get("endTime"); + String Initiator = (String) params.get("Initiator"); + String serialNumbers = (String) params.get("serialNumbers"); + String contentCn = (String) params.get("contentCn"); + String contentEn = (String) params.get("contentEn"); + + ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(projectLibraryId); + + String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文 + String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文 + + // 获取认证清单 - 飞书跳转链接 + Map hrefFeishuMap = this.getProjectLawsInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN); + String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN"); + String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN"); + try { + for (String userId : userIdList) { + String thirdId = this.sysUserService.getUserThirdIdByUserId(userInfoList,userId); + + if(StringUtils.isNotEmpty(thirdId)){ + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 + JSONObject larkMesJson = new JSONObject(); + larkMesJson.put("template_id", templeteId); + larkMesJson.put("userIds",thirdId); + + Map templateVariableMap = new HashMap<>(); + templateVariableMap.put("contentCn",contentCn); + templateVariableMap.put("contentEn",contentEn); + templateVariableMap.put("projectNameCn",PRN_CN); + templateVariableMap.put("projectNameEn",PRN_EN); + templateVariableMap.put("Initiator",ObjectUtils.isNotEmpty(currentUser) ? currentUser.getUsername() : projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("studioEngineerName",projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("endTime",endTime); + templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); + templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); + templateVariableMap.put("operateUserName",ObjectUtils.isNotEmpty(currentUser) ? currentUser.getUsername() : projectLibraryBase.getStudioEngineerName()); + templateVariableMap.put("standName",serialNumbers); + + larkMesJson.put("templateVariableMap",templateVariableMap); + this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); + } + } + } catch (Exception e) { + log.error("飞书消息推送失败"); + } + } + } + + @Override + public Map getProjectLawsInventoryLinkHrefFeishu(String projectLibraryId, String PRN_CN, String PRN_EN) { + Map result = new HashMap<>(); + + String hrefFeishu_CN = backUrl + + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + + projectLibraryId + + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType() + + "&projectName=" + PRN_CN; + + //飞书跳转链接 + String hrefFeishu_EN = backUrl + + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + + projectLibraryId + + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType() + + "&projectName=" + PRN_EN; + + result.put("hrefFeishu_CN",hrefFeishu_CN); + result.put("hrefFeishu_EN",hrefFeishu_EN); + return result; + } + + @Override + public void lawsInventoryEOListSortByInventoryAffirmDueDate(List projectLawsInventoryEOS) { + Collections.sort(projectLawsInventoryEOS, new Comparator() { + @Override + public int compare(ProjectLawsInventoryEO p1, ProjectLawsInventoryEO p2) { + if(p1.getInventoryAffirmDueDate() != null && p2.getInventoryAffirmDueDate() != null){ + return p1.getInventoryAffirmDueDate().compareTo(p2.getInventoryAffirmDueDate()); + } + return 1; + } + }); + } + } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectTaskInventoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectTaskInventoryEOServiceImpl.java index 3529f24a3..3ef531cac 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectTaskInventoryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectTaskInventoryEOServiceImpl.java @@ -1900,7 +1900,7 @@ public class ProjectTaskInventoryEOServiceImpl extends ServiceImpl categoryList = sysCategoryService.list(); + List categoryList = this.sysCategoryService.list(); + + List sysDictItems = this.sysDictItemServiceImpl.getBaseMapper().selectItemsAll(); for (ProcessInfoVO data : datas) { - // 处理展示的交付物类型信息 if(CollectionUtils.isNotEmpty(projectLawsInventoryEOList)){ + // 处理展示的交付物类型信息 String projectLawsInventoryId = data.getProjectLawsInventoryId(); String deliverableTypeName = this.projectLawsInventoryEOService.getDeliverableTypeNameById(projectLawsInventoryId,cut,data.getFlowType(),projectLawsInventoryEOList,categoryList); data.setDeliverableTypeName(deliverableTypeName); + + // 处理责任领域展示信息 + String dutyTerritoryName = this.projectLawsInventoryEOService.getDutyTerritoryNameById(projectLawsInventoryId,cut,projectLawsInventoryEOList,sysDictItems,ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue()); + data.setDutyTerritoryName(dutyTerritoryName); } } datas.forEach(data -> { diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/vo/ProcessInfoVO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/vo/ProcessInfoVO.java index 7f97d363e..beae3265d 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/vo/ProcessInfoVO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/vo/ProcessInfoVO.java @@ -116,4 +116,6 @@ public class ProcessInfoVO implements Serializable { /**交付物类型展示名称**/ private String deliverableTypeName; + /**责任领域展示抿成**/ + private String dutyTerritoryName; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/wkflow/entity/ProcessHistoryEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/wkflow/entity/ProcessHistoryEO.java index 0cb75db7e..52e7abaa4 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/wkflow/entity/ProcessHistoryEO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/wkflow/entity/ProcessHistoryEO.java @@ -108,4 +108,7 @@ public class ProcessHistoryEO implements Serializable { /**附件名称,页面展示字段**/ @TableField(exist = false) private String approvalFileName;; + + @TableField(exist = false) + private String operatorResultName; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/wkflow/service/impl/ProcessHistoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/wkflow/service/impl/ProcessHistoryEOServiceImpl.java index fc9f17943..8b1a4d01c 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/wkflow/service/impl/ProcessHistoryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/wkflow/service/impl/ProcessHistoryEOServiceImpl.java @@ -164,6 +164,9 @@ public class ProcessHistoryEOServiceImpl extends ServiceImpl sysUser.getId().equals(data.getOperatorPersonId())).collect(Collectors.toList()).get(0); data.setAssignee(userInfo.getUsername()); diff --git a/jero-web/src/views/projectManagement/components/batSetting.vue b/jero-web/src/views/projectManagement/components/batSetting.vue index 4904dd5ef..e4371c4e2 100644 --- a/jero-web/src/views/projectManagement/components/batSetting.vue +++ b/jero-web/src/views/projectManagement/components/batSetting.vue @@ -15,7 +15,7 @@
{{$t('certificationType')}}
- + {{$t('certificationLevel')}} - + - +
@@ -55,25 +55,33 @@
- +
{{$t('engineeringInterfacePerson')}} + :title="$t('regulatoryEngineer')">{{$t('regulatoryEngineer')}}
- - + + + + + {{ item.name }} + + + @@ -85,19 +93,20 @@ - +
{{$t('regulatoryEngineer')}} + :title="$t('engineeringInterfacePerson')">{{$t('engineeringInterfacePerson')}}
- + @@ -118,13 +127,13 @@ {{$t('personLiable')}}
- - + + v-model="formInline.designDutyIdName"/> @@ -140,13 +149,13 @@ {{$t('cutoffTime')}}
- + @@ -189,7 +198,7 @@ {{$t('typeOfDeliverables')}} - + {{$t('personLiable')}} - - + + v-model="formInline.verifyDutyIdName"/> @@ -291,7 +300,7 @@ {{$t('typeOfDeliverables')}} - + { + if (res.success) { + this.regulatoryEngineerList = res.result.lawEngineerList //法规工程师 + } + }) + }, PersonnelSelectionChange(value, id) { this.formInline[value] = id this.formInline = { ...this.formInline } }, - edit(data,code) { + edit(data, code) { this.visible = true this.getDeliverableTree() this.code = code - console.log(this.code) this.$nextTick(() => { this.ids = data || [] this.formInline = {} @@ -375,9 +400,15 @@ }, handleOkOne() { let ids = JSON.parse(JSON.stringify(this.ids)) + let formInline = JSON.parse(JSON.stringify(this.formInline)) + Object.keys(formInline).forEach(res => { + if (formInline[res] && formInline[res] instanceof Array) { + formInline[res] = formInline[res].join(',') + } + }) let query = { ids: ids.join(','), - ...this.formInline + ...formInline } this.confirmLoading = true postAction(this.url.setBatch, query).then((res) => { @@ -398,9 +429,15 @@ content: _this.$t('batchmodify'), onOk() { let ids = JSON.parse(JSON.stringify(_this.ids)) + let formInline = JSON.parse(JSON.stringify(_this.formInline)) + Object.keys(formInline).forEach(res => { + if (formInline[res] && formInline[res] instanceof Array) { + formInline[res] = formInline[res].join(',') + } + }) let query = { ids: ids.join(','), - ..._this.formInline + ...formInline } _this.confirmLoading = true postAction(_this.url.setBatch, query).then((res) => { diff --git a/jero-web/src/views/projectManagement/components/listEditModel.vue b/jero-web/src/views/projectManagement/components/listEditModel.vue index 29b533712..7e428bf1b 100644 --- a/jero-web/src/views/projectManagement/components/listEditModel.vue +++ b/jero-web/src/views/projectManagement/components/listEditModel.vue @@ -252,19 +252,26 @@ {{$t('engineeringInterfacePerson')}} - - - - {{ item.name }} - - - + + + + + + + + + + + + + +
@@ -315,19 +322,25 @@ :title="$t('personLiable')">{{$t('personLiable')}} - - - - {{ item.name }} - - - + + + + + + + + + + + + + + @@ -644,25 +657,12 @@ :title="$t('personLiable')">{{$t('personLiable')}} - - - - {{ item.name }} - - - - - - - - - +
diff --git a/jero-web/src/views/projectManagement/components/listOfRegulations.vue b/jero-web/src/views/projectManagement/components/listOfRegulations.vue index 587a44a6b..48c48daf7 100644 --- a/jero-web/src/views/projectManagement/components/listOfRegulations.vue +++ b/jero-web/src/views/projectManagement/components/listOfRegulations.vue @@ -214,7 +214,7 @@
{{ $t('export') }} @@ -320,6 +320,22 @@ -- + + + {{text}} + + {{text}} + + + + {{text}} + + {{text}} +
{{ $t('total') + ' ' + this.dataSource.length + ' ' + $t('strip') }} @@ -440,17 +456,53 @@ + + + + +
+
+ * + {{ $t('roleSwitching') }} +
+ + + + + + {{ item.roleName }} + + + + +
+
+
+
+
{{ $t('dataLoading') }} {{ $t('Submitting') }} +