diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/OperatorTypeEnum.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/OperatorTypeEnum.java index 64d746a4f..f39631239 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/OperatorTypeEnum.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/OperatorTypeEnum.java @@ -67,6 +67,15 @@ public enum OperatorTypeEnum { CERTIFICATION_INVENTORY_DUTY_PERSON_SUBMIT_TASK("认证清单-责任人提交任务","certificationInventoryDutyPersonSubmitTask"), CERTIFICATION_INVENTORY_REVIEW_THROUGH("认证清单-认证工程师审核通过","certificationInventoryReviewThrough"), CERTIFICATION_INVENTORY_REVIEW_RETURNED("认证清单-认证工程师审核退回","certificationInventoryReviewReturned"), + + /** + * 项目库-法规清单 + */ + LAWS_INVENTORY_DESIGN_EXPEDITING("法规清单-催办设计符合性流程","lawsInventoryDesignExpediting"), + LAWS_INVENTORY_VERIFY_EXPEDITING("法规清单-催办验证符合性流程","lawsInventoryVerifyExpediting"), + LAWS_INVENTORY_STUDIO_EXPEDITING("法规清单-studio催办","lawsInventoryStudioExpediting"), + LAWS_INVENTORY_REGULATION_OWNER_EXPEDITING("法规清单-法规工程师催办","lawsInventoryRegulationOwnerExpediting"), + LAWS_INVENTORY_ENGINEERING_INTERFACE_PERSON_EXPEDITING("法规清单-工程接口人催办","lawsInventoryEngineeringInterfacePersonExpediting"), ; String name; diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/job/VerifyComplianceJob.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/job/VerifyComplianceJob.java index 5a79ae3bb..f22a64f06 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/job/VerifyComplianceJob.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/job/VerifyComplianceJob.java @@ -4,12 +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.*; +import com.jero.modules.project.enums.ComplianceFlowStatusEnum; import com.jero.modules.project.enums.DesignComplianceStatusEnum; import com.jero.modules.project.enums.JumpLinkEnum; import com.jero.modules.project.enums.SendMsgFlagEnum; @@ -68,12 +71,122 @@ public class VerifyComplianceJob implements Job { private ISysUserService sysUserService; @Autowired private IFeishuService feishuService; + private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { log.info("验证符合性流程,定时任务开启 ====================================================="); + + // 查询出 结果待提交的数据 + QueryWrapper lawsInventoryEOQueryWrap = new QueryWrapper<>(); + lawsInventoryEOQueryWrap.lambda().eq(ProjectLawsInventoryEO::getVerifyFlowStatus, ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()); + List projectLawsInventoryEOList = this.projectLawsInventoryEOService.list(lawsInventoryEOQueryWrap); + 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(); + if(StringUtils.isEmpty(projectLibraryId) || CollectionUtils.isEmpty(lawsInventoryListByProjectLibraryId)){ + continue; + } + + Map> lawsInventoryByVerifyDutyIdGroupMap = lawsInventoryListByProjectLibraryId.stream().collect(Collectors.groupingBy(ProjectLawsInventoryEO::getVerifyDutyId)); + for (Map.Entry> lawsInventoryByVerifyDutyIdGroup : lawsInventoryByVerifyDutyIdGroupMap.entrySet()) { + String verifyDutyId = lawsInventoryByVerifyDutyIdGroup.getKey(); + List verifyDutyDataList = lawsInventoryByVerifyDutyIdGroup.getValue(); + if(StringUtils.isEmpty(verifyDutyId) || CollectionUtils.isEmpty(verifyDutyDataList)){ + continue; + } + + List userIdList = Arrays.asList(verifyDutyId.split(",")); + + Map sendMsgDataListMap = this.disposeSendMsgDataList(verifyDutyDataList); + + // 十四天后结束的 + List fourteenDaysList = (List) sendMsgDataListMap.get("fourteenDaysList"); + if(CollectionUtils.isNotEmpty(fourteenDaysList)){ + Date verifyDueDate = fourteenDaysList.get(0).getVerifyDueDate(); + String endTime = ""; + if(verifyDueDate != null){ + endTime = DateUtils.formatDate(verifyDueDate); + } + String serialNumbers = fourteenDaysList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + // 给责任人发消息 + Map params = new HashMap<>(); + params.put("contentCn","您好,您的任务将于14天后结束,请及时查看处理。"); + params.put("contentEn","Hello! Your task will end in 14 days. Please check and address it in a timely manner. "); + params.put("projectLibraryId",projectLibraryId); + params.put("endTime",endTime); + params.put("userIdList",userIdList); + params.put("serialNumbers",serialNumbers); + this.projectLawsInventoryEOService.sendMessageByTemplateId(TemplateInfoEnum2.VALIDATION_COMPLIANCE_CONFIRMATION1.getValue(),params); + } + + // 七天后结束的 + List sevenDaysList = (List) sendMsgDataListMap.get("sevenDaysList"); + if(CollectionUtils.isNotEmpty(sevenDaysList)){ + Date verifyDueDate = sevenDaysList.get(0).getVerifyDueDate(); + String endTime = ""; + if(verifyDueDate != null){ + endTime = DateUtils.formatDate(verifyDueDate); + } + String serialNumbers = sevenDaysList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + // 给责任人发消息 + Map params = new HashMap<>(); + params.put("contentCn","您好,您的任务将于7天后结束,请及时查看处理。"); + params.put("contentEn","Hello! Your task will end in 7 days. Please check and address it in a timely manner. "); + params.put("projectLibraryId",projectLibraryId); + params.put("endTime",endTime); + params.put("userIdList",userIdList); + params.put("serialNumbers",serialNumbers); + this.projectLawsInventoryEOService.sendMessageByTemplateId(TemplateInfoEnum2.VALIDATION_COMPLIANCE_CONFIRMATION1.getValue(),params); + } + + // 当天结束的 + List currentDaysList = (List) sendMsgDataListMap.get("currentDaysList"); + if(CollectionUtils.isNotEmpty(currentDaysList)){ + Date verifyDueDate = currentDaysList.get(0).getVerifyDueDate(); + String endTime = ""; + if(verifyDueDate != null){ + endTime = DateUtils.formatDate(verifyDueDate); + } + String serialNumbers = currentDaysList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + // 给法规工程师发消息 + Map params = new HashMap<>(); + params.put("contentCn","您好,您的任务将于今天到期,请尽快查看处理。"); + params.put("contentEn","Hello! Your task will expire today. Please check and address it ASAP. "); + params.put("projectLibraryId",projectLibraryId); + params.put("endTime",endTime); + params.put("userIdList",userIdList); + params.put("serialNumbers",serialNumbers); + this.projectLawsInventoryEOService.sendMessageByTemplateId(TemplateInfoEnum2.VALIDATION_COMPLIANCE_CONFIRMATION1.getValue(),params); + } + // 逾期的 + List overdueList = (List) sendMsgDataListMap.get("overdueList"); + if(CollectionUtils.isNotEmpty(overdueList)){ + Date verifyDueDate = overdueList.get(0).getVerifyDueDate(); + String endTime = ""; + if(verifyDueDate != null){ + endTime = DateUtils.formatDate(verifyDueDate); + } + String serialNumbers = overdueList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + // 给法规工程师发消息 + Map params = new HashMap<>(); + params.put("contentCn","您好,您的任务已逾期,请尽快查看处理。"); + params.put("contentEn","Hello! Your task is overdue. Please check and address it ASAP. "); + params.put("projectLibraryId",projectLibraryId); + params.put("endTime",endTime); + params.put("userIdList",userIdList); + params.put("serialNumbers",serialNumbers); + this.projectLawsInventoryEOService.sendMessageByTemplateId(TemplateInfoEnum2.VALIDATION_COMPLIANCE_CONFIRMATION3.getValue(),params); + } + } + } + } + //查询出已经启动了验证符合性流程的数据。 并且流程没有结束。 - QueryWrapper queryProjectTaskInventoryWrapper = new QueryWrapper<>(); + /*QueryWrapper queryProjectTaskInventoryWrapper = new QueryWrapper<>(); queryProjectTaskInventoryWrapper.isNotNull("verify_p_id"); List status = new ArrayList<>(); status.add(DesignComplianceStatusEnum.TO_SUBMIT.getValue()); @@ -364,7 +477,92 @@ public class VerifyComplianceJob implements Job { } } } - } + }*/ log.info("验证符合性流程,定时任务结束 ====================================================="); } + + private Map disposeSendMsgDataList(List projectLawsInventoryEOList) { + Map result = new HashMap<>(); + Date currentDate = new Date(); + String currentDateStr = sdf.format(currentDate); + + //获取十四天后的时间 + Calendar fourteenCalendar=new GregorianCalendar(); + fourteenCalendar.setTime(new Date()); + fourteenCalendar.add(Calendar.DATE,14); + Date fourteenDays = fourteenCalendar.getTime(); + String fourteenDaysStr = sdf.format(fourteenDays); + + //获取七天后的时间 + Calendar sevenCalendar=new GregorianCalendar(); + sevenCalendar.setTime(new Date()); + sevenCalendar.add(Calendar.DATE,7); + Date sevenDays = sevenCalendar.getTime(); + String sevenDaysStr = sdf.format(sevenDays); + + // 十四天后结束的 + List fourteenDaysList = projectLawsInventoryEOList.stream().filter(data -> { + boolean flag = false; + if(data.getVerifyDueDate() != null){ + if (StringUtils.equals(fourteenDaysStr, sdf.format(data.getVerifyDueDate()))) { + flag = true; + } + } + return flag; + }).collect(Collectors.toList()); + + // 七天后结束的 + List sevenDaysList = projectLawsInventoryEOList.stream().filter(data -> { + boolean flag = false; + if(data.getVerifyDueDate() != null){ + if (StringUtils.equals(sevenDaysStr, sdf.format(data.getVerifyDueDate()))) { + flag = true; + } + } + return flag; + }).collect(Collectors.toList()); + + // 当天结束的 + List currentDaysList = projectLawsInventoryEOList.stream().filter(data -> { + boolean flag = false; + //结束日期是当前日期 + if(data.getVerifyDueDate() != null){ + if (StringUtils.equals(currentDateStr, sdf.format(data.getVerifyDueDate()))) { + flag = true; + } + } + return flag; + }).collect(Collectors.toList()); + + // 逾期的 3天 7天 14天 + List overdueList = projectLawsInventoryEOList.stream().filter(data -> { + Calendar day3Later = new GregorianCalendar(); + day3Later.setTime(data.getVerifyDueDate()); + day3Later.add(Calendar.DATE, 3); + Date overdue3Days = day3Later.getTime(); + + Calendar day7Later = new GregorianCalendar(); + day7Later.setTime(data.getVerifyDueDate()); + day7Later.add(Calendar.DATE, 7); + Date overdue7Days = day7Later.getTime(); + + Calendar day14Later = new GregorianCalendar(); + day14Later.setTime(data.getVerifyDueDate()); + day14Later.add(Calendar.DATE, 14); + Date overdue14Days = day14Later.getTime(); + + boolean flag = ( + StringUtils.equals(sdf.format(overdue3Days), sdf.format(currentDate)) + || StringUtils.equals(sdf.format(overdue7Days), sdf.format(currentDate)) + || StringUtils.equals(sdf.format(overdue14Days), sdf.format(currentDate)) + ); + return flag; + }).collect(Collectors.toList()); + + result.put("currentDaysList",currentDaysList); + result.put("sevenDaysList",sevenDaysList); + result.put("overdueList",overdueList); + result.put("fourteenDaysList",fourteenDaysList); + return result; + } } 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 ca0d79d06..fd885984d 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 @@ -214,4 +214,16 @@ public interface IProjectLawsInventoryEOService extends IService projectLawsInventoryEOS); + + /** + * 法规清单根据设计符合性截至日期顺序排序 + * @param projectLawsInventoryEOS + */ + void lawsInventoryEOListSortByDesignDueDate(List projectLawsInventoryEOS); + + /** + * 法规清单根据验证符合性截至日期顺序排序 + * @param projectLawsInventoryEOS + */ + void lawsInventoryEOListSortByVerifyDueDate(List projectLawsInventoryEOS); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLawsInventoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLawsInventoryEOServiceImpl.java index bb1c9f47f..5f948f61e 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLawsInventoryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectLawsInventoryEOServiceImpl.java @@ -572,6 +572,8 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl params = new HashMap<>(); + params.put("contentCn","您好,"+currentUser.getUsername()+"向您分发了该任务,请及时查看处理。"); + params.put("contentEn","Hello! "+currentUser.getUsername()+" has assigned this task to you. Please check and address it in a timely manner."); + params.put("projectLibraryId", projectLawsInventoryEO.getProjectLibraryId()); + params.put("endTime",endTime); + params.put("userIdList",Arrays.asList(regulationOwnerId.split(","))); + params.put("serialNumbers",projectLawsInventoryEO.getSerialNumber()); + this.sendMessageByTemplateId(TemplateInfoEnum2.DESIGN_COMPLIANCE_CONFIRMATION1.getValue(),params); + } + + // 验证符合性 结果待审查、结果待提交 标识 判断法规工程师是否被修改了 如果被修改了,给新的法规工程师发消息 + boolean toBeReviewedVerifyFlag = ( + StringUtils.equals(projectLawsInventoryOld.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + || StringUtils.equals(projectLawsInventoryOld.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue()) + ); + if (toBeReviewedVerifyFlag) { + if(projectLawsInventoryEO.getVerifyDueDate() != null){ + endTime = DateUtils.formatDate(projectLawsInventoryEO.getVerifyDueDate()); + } + regulationOwnerId = projectLawsInventoryEO.getRegulationOwnerId(); + // 给法规工程师发消息 + Map params = new HashMap<>(); + params.put("contentCn","您好,"+currentUser.getUsername()+"向您分发了该任务,请及时查看处理。"); + params.put("contentEn","Hello! "+currentUser.getUsername()+" has assigned this task to you. Please check and address it in a timely manner."); + params.put("projectLibraryId", projectLawsInventoryEO.getProjectLibraryId()); + params.put("endTime",endTime); + params.put("userIdList",Arrays.asList(regulationOwnerId.split(","))); + params.put("serialNumbers",projectLawsInventoryEO.getSerialNumber()); + this.sendMessageByTemplateId(TemplateInfoEnum2.VALIDATION_COMPLIANCE_CONFIRMATION1.getValue(),params); + } + } + } } private void setProjectLawsInventoryPermission(String userId, String projectId,String lawsInventoryId,Date now, List adds, String belong) { @@ -9333,6 +9386,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl projectLawsInventoryEOList = this.baseMapper.selectList(lawsInventoryEOQueryWrapper); - //获取已经发起的 任务确认流程信息(当前处理人) + // 只有studio催办的时候,才会给法规工程师发消息 + if(StringUtils.equals(operateType,OperatorTypeEnum.LAWS_INVENTORY_STUDIO_EXPEDITING.getValue())){ + // 如果设计符合性或验证符合性流程状态其中一个为 清单待校核,催办时就需要给这一条数据的法规工程师发消息 + List toBeCheckedLawsInventoryList = projectLawsInventoryEOList.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()); + + if(CollectionUtils.isNotEmpty(toBeCheckedLawsInventoryList)){ + Map> regulationOwnerGroupMap = toBeCheckedLawsInventoryList.stream().collect(Collectors.groupingBy(ProjectLawsInventoryEO::getRegulationOwnerId)); + for (Map.Entry> regulationOwnerMap : regulationOwnerGroupMap.entrySet()) { + String regulationOwnerId = regulationOwnerMap.getKey(); + List lawsInventoryEOList = regulationOwnerMap.getValue(); + if(StringUtils.isEmpty(regulationOwnerId) || CollectionUtils.isEmpty(lawsInventoryEOList)){ + continue; + } + + this.lawsInventoryEOListSortByInventoryAffirmDueDate(lawsInventoryEOList); + Date inventoryAffirmDueDate = lawsInventoryEOList.get(0).getInventoryAffirmDueDate(); + String endTime = ""; + if(inventoryAffirmDueDate != null){ + endTime = DateUtils.formatDate(inventoryAffirmDueDate); + } + String serialNumbers = lawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + List userIdList = Arrays.asList(regulationOwnerId.split(",")); + // 给法规工程师发消息 + Map 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",endTime); + params.put("userIdList",userIdList); + params.put("serialNumbers",serialNumbers); + this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE1.getValue(),params); + } + } + } + + // 催办类型 可以只催设计符合性 也可以只催验证符合性 + String expeditingType = json.getString("expeditingType"); + if(StringUtils.contains(expeditingType,OperatorTypeEnum.LAWS_INVENTORY_DESIGN_EXPEDITING.getValue())){ + // 催办设计符合性流程状态为 清单待确认的 责任人 + List toBeConfirmedLawsInventoryList = projectLawsInventoryEOList.stream().filter(lawsInventory -> { + boolean flag =false; + if (StringUtils.equals(lawsInventory.getDesignFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(toBeConfirmedLawsInventoryList)) { + Map> designDutyGroupMap = toBeConfirmedLawsInventoryList.stream().collect(Collectors.groupingBy(ProjectLawsInventoryEO::getDesignDutyId)); + for (Map.Entry> designDutyMap : designDutyGroupMap.entrySet()) { + String designDutyId = designDutyMap.getKey(); + List lawsInventoryEOList = designDutyMap.getValue(); + if(StringUtils.isEmpty(designDutyId) || CollectionUtils.isEmpty(lawsInventoryEOList)){ + continue; + } + + this.lawsInventoryEOListSortByDesignDueDate(lawsInventoryEOList); + Date designDueDate = lawsInventoryEOList.get(0).getDesignDueDate(); + String endTime = ""; + if(designDueDate != null){ + endTime = DateUtils.formatDate(designDueDate); + } + String serialNumbers = lawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + List userIdList = Arrays.asList(designDutyId.split(",")); + // 给设计符合性流程责任人发消息 + Map params = new HashMap<>(); + params.put("contentCn","您好,请及时查看确认以下任务要求,谢谢!"); + params.put("contentEn","Hello! Please check and confirm the following task requirement in a timely manner. Thank you!"); + params.put("projectLibraryId",projectLibraryId); + params.put("endTime",endTime); + params.put("userIdList",userIdList); + params.put("serialNumbers",serialNumbers); + this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE2.getValue(),params); + } + } + + // 催办设计符合性流程状态为 结果待提交的 责任人 + List toBeSubmitLawsInventoryList = projectLawsInventoryEOList.stream().filter(lawsInventory -> { + boolean flag =false; + if (StringUtils.equals(lawsInventory.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(toBeSubmitLawsInventoryList)) { + Map> designDutyGroupMap = toBeSubmitLawsInventoryList.stream().collect(Collectors.groupingBy(ProjectLawsInventoryEO::getVerifyDutyId)); + for (Map.Entry> designDutyMap : designDutyGroupMap.entrySet()) { + String designDutyId = designDutyMap.getKey(); + List lawsInventoryEOList = designDutyMap.getValue(); + if(StringUtils.isEmpty(designDutyId) || CollectionUtils.isEmpty(lawsInventoryEOList)){ + continue; + } + this.lawsInventoryEOListSortByVerifyDueDate(lawsInventoryEOList); + + Date designDueDate = lawsInventoryEOList.get(0).getVerifyDueDate(); + String endTime = ""; + if(designDueDate != null){ + endTime = DateUtils.formatDate(designDueDate); + } + String serialNumbers = lawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + List userIdList = Arrays.asList(designDutyId.split(",")); + // 给设计符合性流程责任人发消息 + Map params = new HashMap<>(); + params.put("contentCn","您好,请尽快查看处理此项任务,谢谢!"); + params.put("contentEn","Hello! Please check and address the task ASAP. Thank you!"); + params.put("projectLibraryId",projectLibraryId); + params.put("endTime",endTime); + params.put("userIdList",userIdList); + params.put("serialNumbers",serialNumbers); + this.sendMessageByTemplateId(TemplateInfoEnum2.DESIGN_COMPLIANCE_CONFIRMATION1.getValue(),params); + } + } + } + if(StringUtils.contains(expeditingType,OperatorTypeEnum.LAWS_INVENTORY_VERIFY_EXPEDITING.getValue())){ + // 催办验证符合性流程状态为 清单待确认的 责任人 + List toBeConfirmedLawsInventoryList = projectLawsInventoryEOList.stream().filter(lawsInventory -> { + boolean flag =false; + if (StringUtils.equals(lawsInventory.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(toBeConfirmedLawsInventoryList)) { + Map> verifyDutyGroupMap = toBeConfirmedLawsInventoryList.stream().collect(Collectors.groupingBy(ProjectLawsInventoryEO::getVerifyDutyId)); + for (Map.Entry> verifyDutyMap : verifyDutyGroupMap.entrySet()) { + String verifyDutyId = verifyDutyMap.getKey(); + List lawsInventoryEOList = verifyDutyMap.getValue(); + if(StringUtils.isEmpty(verifyDutyId) || CollectionUtils.isEmpty(lawsInventoryEOList)){ + continue; + } + + this.lawsInventoryEOListSortByVerifyDueDate(lawsInventoryEOList); + Date verifyDueDate = lawsInventoryEOList.get(0).getVerifyDueDate(); + String endTime = ""; + if(verifyDueDate != null){ + endTime = DateUtils.formatDate(verifyDueDate); + } + String serialNumbers = lawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + List userIdList = Arrays.asList(verifyDutyId.split(",")); + // 给设计符合性流程责任人发消息 + Map params = new HashMap<>(); + params.put("contentCn","您好,请及时查看确认以下任务要求,谢谢!"); + params.put("contentEn","Hello! Please check and confirm the following task requirement in a timely manner. Thank you!"); + params.put("projectLibraryId",projectLibraryId); + params.put("endTime",endTime); + params.put("userIdList",userIdList); + params.put("serialNumbers",serialNumbers); + this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_LIST_RELEASE2.getValue(),params); + } + } + + // 催办验证符合性流程状态为 结果待提交的 责任人 + List toBeSubmitLawsInventoryList = projectLawsInventoryEOList.stream().filter(lawsInventory -> { + boolean flag =false; + if (StringUtils.equals(lawsInventory.getVerifyFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(toBeSubmitLawsInventoryList)) { + Map> verifyDutyGroupMap = toBeSubmitLawsInventoryList.stream().collect(Collectors.groupingBy(ProjectLawsInventoryEO::getVerifyDutyId)); + for (Map.Entry> verifyDutyMap : verifyDutyGroupMap.entrySet()) { + String verifyDutyId = verifyDutyMap.getKey(); + List lawsInventoryEOList = verifyDutyMap.getValue(); + if(StringUtils.isEmpty(verifyDutyId) || CollectionUtils.isEmpty(lawsInventoryEOList)){ + continue; + } + this.lawsInventoryEOListSortByVerifyDueDate(lawsInventoryEOList); + + Date verifyDueDate = lawsInventoryEOList.get(0).getVerifyDueDate(); + String endTime = ""; + if(verifyDueDate != null){ + endTime = DateUtils.formatDate(verifyDueDate); + } + String serialNumbers = lawsInventoryEOList.stream().map(ProjectLawsInventoryEO::getSerialNumber).distinct().collect(Collectors.joining(",")); + + List userIdList = Arrays.asList(verifyDutyId.split(",")); + // 给设计符合性流程责任人发消息 + Map params = new HashMap<>(); + params.put("contentCn","您好,请尽快查看处理此项任务,谢谢!"); + params.put("contentEn","Hello! Please check and address the task ASAP. Thank you!"); + params.put("projectLibraryId",projectLibraryId); + params.put("endTime",endTime); + params.put("userIdList",userIdList); + params.put("serialNumbers",serialNumbers); + this.sendMessageByTemplateId(TemplateInfoEnum2.VALIDATION_COMPLIANCE_CONFIRMATION1.getValue(),params); + } + } + } + + /*//获取已经发起的 任务确认流程信息(当前处理人) JSONObject queryFlowCurrentTaskJson = new JSONObject(); queryFlowCurrentTaskJson.put("projectLawsInventoryIdList",projectLawsInventoryIdList); queryFlowCurrentTaskJson.put("flowType",FlowTypeEnum.RWQRLC.getValue()); @@ -9556,7 +9810,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl projectLawsInventoryEOS) { + Collections.sort(projectLawsInventoryEOS, new Comparator() { + @Override + public int compare(ProjectLawsInventoryEO p1, ProjectLawsInventoryEO p2) { + if(p1.getDesignDueDate() != null && p2.getDesignDueDate() != null){ + return p1.getDesignDueDate().compareTo(p2.getDesignDueDate()); + } + return 1; + } + }); + } + + @Override + public void lawsInventoryEOListSortByVerifyDueDate(List projectLawsInventoryEOS) { + Collections.sort(projectLawsInventoryEOS, new Comparator() { + @Override + public int compare(ProjectLawsInventoryEO p1, ProjectLawsInventoryEO p2) { + if(p1.getDesignDueDate() != null && p2.getDesignDueDate() != null){ + return p1.getDesignDueDate().compareTo(p2.getDesignDueDate()); + } + return 1; + } + }); + } + }