diff --git a/jero-boot/db/蔚来标准sql/dev_2nd_period.sql b/jero-boot/db/蔚来标准sql/dev_2nd_period.sql index ac06098eb..4a52eed53 100644 --- a/jero-boot/db/蔚来标准sql/dev_2nd_period.sql +++ b/jero-boot/db/蔚来标准sql/dev_2nd_period.sql @@ -605,4 +605,9 @@ where id in ( ); +-- 认证清单,增加字段 2023-04-17 未同步生产环境 +ALTER TABLE `project_certification_inventory` + ADD COLUMN `inventory_verify_end_time` datetime(0) NULL COMMENT '清单校核截止时间' AFTER `project_library_id`, + ADD COLUMN `task_confirm_end_time` datetime(0) NULL COMMENT '责任确认截止时间' AFTER `inventory_verify_end_time`; + diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryEO.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryEO.java index e31fbc852..4191fd9f2 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryEO.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/entity/ProjectCertificationInventoryEO.java @@ -230,4 +230,16 @@ public class ProjectCertificationInventoryEO implements Serializable { //排序字段 @TableField(exist = false) private String orderByField; + + /**清单校核截止时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "清单校核截止时间") + private Date inventoryVerifyEndTime; + + /**责任确认截止时间*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "责任确认截止时间") + private Date taskConfirmEndTime; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/CertificationFlowNodeEnum.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/CertificationFlowNodeEnum.java index 9925ad9f6..34609c13c 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/CertificationFlowNodeEnum.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/enums/CertificationFlowNodeEnum.java @@ -17,6 +17,18 @@ public enum CertificationFlowNodeEnum { RZGCSSC ("rzgcssc","认证工程师审查","Certified engineer review"), RZGCSSC_TG ("rzgcssc_tg","认证工程师审查-通过","Certified engineer review through"), RZGCSSC_TH ("rzgcssc_th","认证工程师审查-退回","Certified engineer review returned"), + + /** + * 待办中心,展示任务节点key + * 清单校核-> studio发给认证工程师处理 + * 任务责任确认 -> 认证工程师发给责任人 + * 任务办理 -> 责任人接受之后,等待提交交付物 + * 任务审查 -> 责任人提交交付物之后,认证工程师审查。 + */ + CHECKLIST_VERIFICATION ("Checklist verification","清单校核","Checklist verification"), + TASK_RESPONSIBILITY_CONFIRMATION ("Task responsibility confirmation","任务责任确认","Task responsibility confirmation"), + TASK_HANDLING ("Task handling","任务办理","Task handling"), + TASK_REVIEW ("Task Review","任务审查","Task Review"), ; String key; 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 93f199d22..92fd32efe 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 @@ -89,17 +89,14 @@ public class CertificationInventoryJob implements Job { * @param projectCertificationInventoryEOS */ private void remindCertificationEngineer( List projectCertificationInventoryEOS,ProjectLibraryBase projectLibraryBase) { - List certificationInventoryEOList = projectCertificationInventoryEOS.stream().filter(data -> { + List toBeReviewedCiEoList = projectCertificationInventoryEOS.stream().filter(data -> { boolean flag = ( - StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) - || StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()) - || StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) + StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue()) ); return flag; }).collect(Collectors.toList()); - - if(CollectionUtils.isNotEmpty(certificationInventoryEOList)){ - Map sendMsgDataListMap = this.disposeSendMsgDataList(certificationInventoryEOList); + if(CollectionUtils.isNotEmpty(toBeReviewedCiEoList)){ + Map sendMsgDataListMap = this.disposeSendMsgDataList(toBeReviewedCiEoList); List certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); List certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList); @@ -113,7 +110,8 @@ public class CertificationInventoryJob implements Job { certificationEngineerList, certificationEngineerId, threeDaysList, - TemplateInfoEnum2.CERTIFICATION_MESSAGE6.getValue() + TemplateInfoEnum2.CERTIFICATION_MESSAGE6.getValue(), + threeDaysList.get(0).getEndTime() ); } } @@ -126,7 +124,8 @@ public class CertificationInventoryJob implements Job { certificationEngineerList, certificationEngineerId, currentDaysList, - TemplateInfoEnum2.CERTIFICATION_MESSAGE7.getValue() + TemplateInfoEnum2.CERTIFICATION_MESSAGE7.getValue(), + currentDaysList.get(0).getEndTime() ); } } @@ -139,7 +138,66 @@ public class CertificationInventoryJob implements Job { certificationEngineerList, certificationEngineerId, overdueList, - TemplateInfoEnum2.CERTIFICATION_MESSAGE8.getValue() + TemplateInfoEnum2.CERTIFICATION_MESSAGE8.getValue(), + overdueList.get(0).getEndTime() + ); + } + } + } + + List toBeCheckedCiEoList = projectCertificationInventoryEOS.stream().filter(data -> { + boolean flag = ( + StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()) + ); + return flag; + }).collect(Collectors.toList()); + + if(CollectionUtils.isNotEmpty(toBeCheckedCiEoList)){ + Map sendMsgDataListMap = this.disposeSendMsgDataListByInventoryVerifyEndTime(toBeCheckedCiEoList); + + List certificationEngineerIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(",")); + List certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList); + + // 三天后结束的 + List threeDaysList = (List) sendMsgDataListMap.get("threeDaysList"); + if(CollectionUtils.isNotEmpty(threeDaysList)){ + for (String certificationEngineerId : certificationEngineerIdList) { + this.sendLarkCardMsgByTemplate( + projectLibraryBase, + certificationEngineerList, + certificationEngineerId, + threeDaysList, + TemplateInfoEnum2.CERTIFICATION_MESSAGE6.getValue(), + threeDaysList.get(0).getInventoryVerifyEndTime() + ); + } + } + // 当天结束的 + List currentDaysList = (List) sendMsgDataListMap.get("currentDaysList"); + if(CollectionUtils.isNotEmpty(currentDaysList)){ + for (String certificationEngineerId : certificationEngineerIdList) { + this.sendLarkCardMsgByTemplate( + projectLibraryBase, + certificationEngineerList, + certificationEngineerId, + currentDaysList, + TemplateInfoEnum2.CERTIFICATION_MESSAGE7.getValue(), + currentDaysList.get(0).getInventoryVerifyEndTime() + ); + } + } + // 逾期的 + List overdueList = (List) sendMsgDataListMap.get("overdueList"); + if(CollectionUtils.isNotEmpty(overdueList)){ + for (String certificationEngineerId : certificationEngineerIdList) { + this.sendLarkCardMsgByTemplate( + projectLibraryBase, + certificationEngineerList, + certificationEngineerId, + overdueList, + TemplateInfoEnum2.CERTIFICATION_MESSAGE8.getValue(), + overdueList.get(0).getInventoryVerifyEndTime() ); } } @@ -193,7 +251,8 @@ public class CertificationInventoryJob implements Job { dutyPersonList, dutyPersonUserId, fourteenDaysList, - TemplateInfoEnum2.CERTIFICATION_MESSAGE19.getValue() + TemplateInfoEnum2.CERTIFICATION_MESSAGE19.getValue(), + fourteenDaysList.get(0).getEndTime() ); } @@ -205,7 +264,8 @@ public class CertificationInventoryJob implements Job { dutyPersonList, dutyPersonUserId, sevenDaysList, - TemplateInfoEnum2.CERTIFICATION_MESSAGE20.getValue() + TemplateInfoEnum2.CERTIFICATION_MESSAGE20.getValue(), + sevenDaysList.get(0).getEndTime() ); } @@ -217,7 +277,8 @@ public class CertificationInventoryJob implements Job { dutyPersonList, dutyPersonUserId, currentDaysList, - TemplateInfoEnum2.CERTIFICATION_MESSAGE21.getValue() + TemplateInfoEnum2.CERTIFICATION_MESSAGE21.getValue(), + currentDaysList.get(0).getEndTime() ); } // 逾期的 @@ -228,7 +289,8 @@ public class CertificationInventoryJob implements Job { dutyPersonList, dutyPersonUserId, overdueList, - TemplateInfoEnum2.CERTIFICATION_MESSAGE22.getValue() + TemplateInfoEnum2.CERTIFICATION_MESSAGE22.getValue(), + overdueList.get(0).getEndTime() ); } } @@ -351,6 +413,101 @@ public class CertificationInventoryJob implements Job { return result; } + /** + * 处理需要发送消息的数据 + * @param pciEoList + * @return + */ + private Map disposeSendMsgDataListByInventoryVerifyEndTime(List pciEoList) { + Map result = new HashMap<>(); + Date currentDate = new Date(); + + //获取后三天前的时间 + Calendar calendar=new GregorianCalendar(); + calendar.setTime(new Date()); + 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(); + + //获取后十四天后的时间 + Calendar fourteenCalendar=new GregorianCalendar(); + fourteenCalendar.setTime(new Date()); + fourteenCalendar.add(Calendar.DATE,14); + Date fourteenDays = fourteenCalendar.getTime(); + + String threeDaysStr = sdf.format(threeDays); + String sevenDaysStr = sdf.format(sevenDays); + String fourteenDaysStr = sdf.format(fourteenDays); + String currentDateStr = sdf.format(currentDate); + + // 当天结束的 + List currentDaysList = pciEoList.stream().filter(data -> { + boolean flag = false; + //结束日期是当前日期 + if(data.getInventoryVerifyEndTime() != null){ + if (StringUtils.equals(currentDateStr, sdf.format(data.getInventoryVerifyEndTime()))) { + flag = true; + } + } + return flag; + }).collect(Collectors.toList()); + + // 三天后结束的 + List threeDaysList = pciEoList.stream().filter(data -> { + boolean flag = false; + if(data.getInventoryVerifyEndTime() != null){ + if (StringUtils.equals(threeDaysStr, sdf.format(data.getInventoryVerifyEndTime()))) { + flag = true; + } + } + return flag; + }).collect(Collectors.toList()); + + // 七天后结束的 + List sevenDaysList = pciEoList.stream().filter(data -> { + boolean flag = false; + if(data.getInventoryVerifyEndTime()!=null){ + if (StringUtils.equals(sevenDaysStr, sdf.format(data.getInventoryVerifyEndTime()))) { + flag = true; + } + } + return flag; + }).collect(Collectors.toList()); + + // 十四天后结束的 + List fourteenDaysList = pciEoList.stream().filter(data -> { + boolean flag = false; + if(data.getInventoryVerifyEndTime() != null){ + if (StringUtils.equals(fourteenDaysStr, sdf.format(data.getInventoryVerifyEndTime()))) { + flag = true; + } + } + return flag; + }).collect(Collectors.toList()); + + // 逾期的 + List overdueList = pciEoList.stream().filter(data -> { + // 只要早于当前日期都算逾期 + boolean flag = false; + if(data.getInventoryVerifyEndTime() != null){ + flag = (data.getInventoryVerifyEndTime().before(currentDate) && !StringUtils.equals(currentDateStr, sdf.format(data.getInventoryVerifyEndTime()))); + } + 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; + } + /** * 根据模板 发送飞书消息 * @param projectLibraryBase @@ -358,7 +515,11 @@ public class CertificationInventoryJob implements Job { * @param userId * @param list */ - private void sendLarkCardMsgByTemplate(ProjectLibraryBase projectLibraryBase, List userList,String userId,List list,String templateId) { + private void sendLarkCardMsgByTemplate(ProjectLibraryBase projectLibraryBase, + List userList,String userId, + List list, + String templateId, + Date endTime) { String thirdId = this.sysUserService.getUserThirdIdByUserId(userList,userId); if(StringUtils.isNotEmpty(thirdId)){ @@ -385,7 +546,7 @@ public class CertificationInventoryJob implements Job { templateVariableMap.put("standName",standName); templateVariableMap.put("itemName",itemName); templateVariableMap.put("Initiator", projectLibraryBase.getStudioEngineerName()); - templateVariableMap.put("endTime", DateUtils.formatDate(list.get(0).getEndTime())); + templateVariableMap.put("endTime", DateUtils.formatDate(endTime)); templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); 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 65d04bd5a..fc087b9d6 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 @@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.util.Date; import java.util.List; import java.util.Map; @@ -225,7 +226,7 @@ public interface IProjectCertificationInventoryEOService extends IService projectCertificationInventoryEOS,String templeteId,List userIdList,List userInfoList); + void sendMessageByTemplateId(List projectCertificationInventoryEOS, String templeteId, List userIdList, List userInfoList, Date endTime); /** * 数据唯一校验。 @@ -248,4 +249,8 @@ public interface IProjectCertificationInventoryEOService extends IService addConfigByIds(JSONObject json); + + void certificationInventoryEOListSortByEndTimeAsc(List projectCertificationInventoryEOList); + void certificationInventoryEOListSortByInventoryVerifyEndTimeAsc(List projectCertificationInventoryEOList); + void certificationInventoryEOListSortByTaskConfirmEndTimeAsc(List projectCertificationInventoryEOList); } 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 69869e9d2..efda570e4 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 @@ -222,7 +222,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl projectCertificationInventoryEOS,String templeteId,List userIdList,List userInfoList){ + public void sendMessageByTemplateId(List projectCertificationInventoryEOS, + String templeteId, + List userIdList, + List userInfoList, + Date endTime){ LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(projectCertificationInventoryEOS.get(0).getProjectLibraryId()); @@ -686,8 +693,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl idList = Arrays.asList(ids.split(",")); @@ -1055,13 +1064,13 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl processInfoDetailEOList = new ArrayList<>(); List certificationEngineerList = Arrays.asList(certificationEngineer.split(",")); // 给认证工程师分配任务 @@ -2050,6 +2067,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl idList = Arrays.asList(ids.split(",")); @@ -2277,10 +2298,11 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl processInfoDetailEOList = new ArrayList<>(); for (ProjectCertificationInventoryEO projectCertificationInventoryEO : projectCertificationInventoryEOList) { projectCertificationInventoryEO.setFlowStatus(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue()); + projectCertificationInventoryEO.setTaskConfirmEndTime(taskConfirmEndTime); ProcessInfoDetailEO processInfoDetailEO = new ProcessInfoDetailEO(); processInfoDetailEO.setUserId(projectCertificationInventoryEO.getDutyPerson()); - processInfoDetailEO.setEndTime(projectCertificationInventoryEO.getEndTime()); + processInfoDetailEO.setEndTime(taskConfirmEndTime); processInfoDetailEO.setProjectLawsInventoryId(projectCertificationInventoryEO.getId()); processInfoDetailEOList.add(processInfoDetailEO); } @@ -2314,8 +2336,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl projectCertificationInventoryEOList) { + @Override + public void certificationInventoryEOListSortByEndTimeAsc(List projectCertificationInventoryEOList) { Collections.sort(projectCertificationInventoryEOList, new Comparator() { @Override public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) { @@ -2365,6 +2388,39 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl pciEoList) { + Collections.sort(pciEoList, new Comparator() { + @Override + public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) { + if(p1.getInventoryVerifyEndTime() != null && p2.getInventoryVerifyEndTime() != null){ + return p1.getInventoryVerifyEndTime().compareTo(p2.getInventoryVerifyEndTime()); + } + return 1; + } + }); + } + /** + * 认证清单数据排序,根据任务确认截至时间顺序排序 + * @param pciEoList + */ + @Override + public void certificationInventoryEOListSortByTaskConfirmEndTimeAsc(List pciEoList) { + Collections.sort(pciEoList, new Comparator() { + @Override + public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) { + if(p1.getTaskConfirmEndTime() != null && p2.getTaskConfirmEndTime() != null){ + return p1.getTaskConfirmEndTime().compareTo(p2.getTaskConfirmEndTime()); + } + return 1; + } + }); + } + @Override public Result saveBatch(JSONObject json) { Date now = new Date(); @@ -2633,7 +2689,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl certificationInventoryEOList = projectCertificationInventoryEOList.stream().filter(data -> { - return (StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) - || StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue()) - || StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue())); + // 结果待审查 + List toBeReviewedCiEoList = projectCertificationInventoryEOList.stream().filter(data -> { + return (StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue())); }).collect(Collectors.toList()); - if(CollectionUtils.isNotEmpty(certificationInventoryEOList)){ + if(CollectionUtils.isNotEmpty(toBeReviewedCiEoList)){ String certificationEngineerIds = projectLibraryBase.getCertificationEngineer(); if(StringUtils.isNotEmpty(certificationEngineerIds)){ List certificationEngineerIdList = Arrays.asList(certificationEngineerIds.split(",")); @@ -2723,7 +2779,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList); // 根据结束时间进行排序,获取最近的时间,发消息时使用。 - Collections.sort(certificationInventoryEOList, new Comparator() { + Collections.sort(toBeReviewedCiEoList, new Comparator() { @Override public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) { if(p1.getEndTime() != null && p2.getEndTime() != null){ @@ -2732,9 +2788,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl standNameAndItemName = this.getStandNameAndItemName(certificationInventoryEOList); + Map standNameAndItemName = this.getStandNameAndItemName(toBeReviewedCiEoList); String standName = (String) standNameAndItemName.get("standName"); String itemName = (String) standNameAndItemName.get("itemName"); @@ -2768,6 +2824,65 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl toBeCheckedCiEoList = projectCertificationInventoryEOList.stream().filter(data -> { + return (StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.LIST_TO_BE_CHECKED.getValue()) + || StringUtils.equals(data.getFlowStatus(), CertificationInventoryFlowStatusEnum.REFUSAL_OF_RESPONSIBLE_PERSON.getValue())); + }).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(toBeCheckedCiEoList)) { + String certificationEngineerIds = projectLibraryBase.getCertificationEngineer(); + if(StringUtils.isNotEmpty(certificationEngineerIds)){ + List certificationEngineerIdList = Arrays.asList(certificationEngineerIds.split(",")); + + List certificationEngineerList = this.sysUserService.querySysUserListByIdList(certificationEngineerIdList); + + // 根据结束时间进行排序,获取最近的时间,发消息时使用。 + Collections.sort(toBeCheckedCiEoList, new Comparator() { + @Override + public int compare(ProjectCertificationInventoryEO p1, ProjectCertificationInventoryEO p2) { + if(p1.getInventoryVerifyEndTime() != null && p2.getInventoryVerifyEndTime() != null){ + return p1.getInventoryVerifyEndTime().compareTo(p2.getInventoryVerifyEndTime()); + } + return 1; + } + }); + Date inventoryVerifyEndTime = toBeCheckedCiEoList.get(0).getInventoryVerifyEndTime(); + + Map standNameAndItemName = this.getStandNameAndItemName(toBeCheckedCiEoList); + String standName = (String) standNameAndItemName.get("standName"); + String itemName = (String) standNameAndItemName.get("itemName"); + + if(CollectionUtils.isNotEmpty(certificationEngineerList)){ + for (String certificationEngineerId : certificationEngineerIdList) { + String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineerList,certificationEngineerId); + + if(StringUtils.isNotEmpty(thirdId)){ + try { + JSONObject larkMesJson = new JSONObject(); + larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE1.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(inventoryVerifyEndTime)); + templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN); + templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN); + + larkMesJson.put("templateVariableMap",templateVariableMap); + this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson); + } catch (Exception e) { + log.error("飞书消息推送失败"); + } + } + } + } + } + } } List dutyPersonIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList()); @@ -2792,13 +2907,16 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl projectCertificationInventoryEOList = this.projectCertificationInventoryEOService.list(certificationInventoryEOQueryWrapper); if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOList)){ + this.projectCertificationInventoryEOService.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList); List userInfoList = this.sysUserService.querySysUserListByIdList(originalCertificationEngineerIdList); this.projectCertificationInventoryEOService.sendMessageByTemplateId( projectCertificationInventoryEOList, TemplateInfoEnum2.CERTIFICATION_MESSAGE13.getValue(), originalCertificationEngineerIdList, - userInfoList + userInfoList, + projectCertificationInventoryEOList.get(0).getEndTime() ); } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/mapper/xml/ProcessInfoEOMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/mapper/xml/ProcessInfoEOMapper.xml index 1081945ae..686c871a7 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/mapper/xml/ProcessInfoEOMapper.xml +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/todoCenter/mapper/xml/ProcessInfoEOMapper.xml @@ -245,7 +245,7 @@ pid.end_time from process_info_detail pid - where pid.process_info_id = pi.id and pid.STATUS = 'NotDone' order by pid.end_time asc limit 1 + where pid.process_info_id = pi.id and pid.STATUS = 'NotDone' and pid.end_time is not null order by pid.end_time asc limit 1 ) as end_time,