From fcd013f2bf7934b62c69f45e917f6fad24aca1d9 Mon Sep 17 00:00:00 2001 From: wangzhijiang Date: Tue, 21 Mar 2023 18:05:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E6=B8=85=E5=8D=95=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E6=93=8D=E4=BD=9C-=E5=8F=91=E9=80=81=E9=A3=9E?= =?UTF-8?q?=E4=B9=A6=E6=B6=88=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feishu/enums/TemplateInfoEnum2.java | 13 + .../job/CertificationInventoryJob.java | 91 +++++- ...rojectCertificationInventoryEOService.java | 10 + ...ctCertificationInventoryEOServiceImpl.java | 309 +++++++++++++++++- 4 files changed, 410 insertions(+), 13 deletions(-) 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..7c754a8ef 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,19 @@ 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"), ; String name; 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/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/impl/ProjectCertificationInventoryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/ProjectCertificationInventoryEOServiceImpl.java index 25bc52893..4eb30489a 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)){ @@ -1201,6 +1347,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList); + try { this.updateBatchById(projectCertificationInventoryEOList); @@ -1217,6 +1366,13 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl projectCertificationInventoryLogEOList = new ArrayList<>(); List processInfoDetailEOList = new ArrayList<>(); @@ -1279,6 +1439,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 +1467,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 +1564,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 +1610,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 +2158,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 +2315,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 +2373,13 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl templateVariableMap = new HashMap<>(); @@ -2094,7 +2397,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl