From 9593973ec5b877e8f8de6e4d443403f90cece704 Mon Sep 17 00:00:00 2001 From: zhn <947514737@qq.com> Date: Fri, 14 Apr 2023 11:36:26 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A3=9E=E4=B9=A6=E6=B6=88=E6=81=AF-=E8=AE=A4?= =?UTF-8?q?=E8=AF=81=E5=8F=82=E6=95=B0=E6=94=B6=E9=9B=86=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constant/enums/MessageTypeEnum.java | 2 +- .../ParamsCollectManifestEOServiceImpl.java | 162 +++++++++++++----- .../feishu/service/IFeishuService.java | 4 +- .../service/impl/FeishuServiceImpl.java | 14 +- 4 files changed, 129 insertions(+), 53 deletions(-) diff --git a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/constant/enums/MessageTypeEnum.java b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/constant/enums/MessageTypeEnum.java index f9d101325..d38ad0346 100644 --- a/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/constant/enums/MessageTypeEnum.java +++ b/jero-boot/jero-boot-base/jero-boot-base-core/src/main/java/com/jero/common/constant/enums/MessageTypeEnum.java @@ -21,7 +21,7 @@ public enum MessageTypeEnum { //DESIGN_COMPLIANCE_NOTIFICATION("Design Compliance Notification", "12"), // 设计符合性通知 //PRE_HOMO_NOTIFICATION("Pre-Homo Notification", "13"), // Pre-Homo通知 //VALIDATION_COMPLIANCE_NOTIFICATION("Validation Compliance Notification", "14"), // 验证符合性通知 - SYSTEMATIC_NOTIFICATION("Systematic Notification","", "15"), // 系统通知 + SYSTEMATIC_NOTIFICATION("Systematic Notification","系统通知", "15"), // 系统通知 LIST_CONFIRMATION("List Confirmation", "","17"), // 清单确认 TASK_CONFIRMATION("Task Confirmation", "","18"), // 任务确认 COMPLIANCE_CONFIRMATION("Compliance Confirmation","", "19"), // 符合性确认 diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java index 8d5551523..39af28dae 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/collect/service/impl/ParamsCollectManifestEOServiceImpl.java @@ -2312,7 +2312,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.eq("state", ManifestStateEnum.COLLECTING.getValue()); +// queryWrapper.eq("id","391e08fd7ed54740a20924f174aa83a2");//测试使用 List manifestEOS = paramsManifestEOService.list(queryWrapper); for (ParamsManifestEO manifestEO : manifestEOS) { //项目名称 ParamsManifestVO projectInfo = paramsManifestEOService.getProjectById(manifestEO.getProjectId(), manifestEO.getProjectVersion(), null); if (ObjectUtils.isNotEmpty(projectInfo)) { + manifestEO.setProjectName(projectInfo.getProjectName()); //url - String urlParamsStr = parseUrlParams(manifestEO,null,null); + String urlParamsStr = parseUrlParams(manifestEO,null,projectInfo.getProjectNameEn()); String hrefFeishu = backUrl + "/ParameterItemCollection" + urlParamsStr; + + String urlParamsStrCn = parseUrlParams(manifestEO,CutEnum.CN.getValue(),projectInfo.getProjectNameEn()); + String urlParamsStrEn = parseUrlParams(manifestEO,CutEnum.EN.getValue(),projectInfo.getProjectNameEn()); + String hrefFeishuCn = backUrl + "/ParameterItemCollection" + urlParamsStrCn; + String hrefFeishuEn = backUrl + "/ParameterItemCollection" + urlParamsStrEn; //查出对应清单 List collectManifestEOS = paramsCollectManifestEOMapper.queryByParamManifestId(manifestEO.getId()); Map> seven = new HashMap<>(); Map> three = new HashMap<>(); Map> today = new HashMap<>(); + List userIdList7 = new ArrayList<>(); + List userIdList3 = new ArrayList<>(); + List userIdList0 = new ArrayList<>(); + String dueDate = ""; for (ParamsCollectManifestEO collectManifestEO : collectManifestEOS) { String thirdId = null; if (CollectManifestStateEnum.WAIT_SDT.getValue().equals(collectManifestEO.getState()) @@ -6271,6 +6282,9 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl stringList = seven.get(key); String join = StringUtils.join(stringList, ","); try { - FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); - feishuMsgVo.setTitle(title); - feishuMsgVo.setCnContentUpper("您参与填写的参数" + join + ",还有7天到期,请及时查看处理"); - feishuMsgVo.setCnContentLower(cnContentLower); - feishuMsgVo.setEnContentUpper("The parameter " + join + " you filled in will expire in 7 days. Please check and address it in a timely manner"); - feishuMsgVo.setEnContentLower(enContentLower); - feishuMsgVo.setUrl(hrefFeishu); - feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色 - feishuService.sendCard(thirds, feishuMsgVo); - } catch (IOException e) { +// FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); +// feishuMsgVo.setTitle(title); +// feishuMsgVo.setCnContentUpper("您参与填写的参数" + join + ",还有7天到期,请及时查看处理"); +// feishuMsgVo.setCnContentLower(cnContentLower); +// feishuMsgVo.setEnContentUpper("The parameter " + join + " you filled in will expire in 7 days. Please check and address it in a timely manner"); +// feishuMsgVo.setEnContentLower(enContentLower); +// feishuMsgVo.setUrl(hrefFeishu); +// feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色 +// feishuService.sendCard(thirds, feishuMsgVo); +// + String contentInfoFeiCn = "您参与填写的参数" + join + ",还有7天到期,请及时查看处理。"; + String contentInfoFeiEn = "The parameter " + join + " you filled in will expire in 7 days. Please check and address it in a timely manner."; + userIdList7 = userIdList7.stream().distinct().collect(Collectors.toList()); + //飞书消息(模板-20230410) + Map params = new HashMap<>(); + params.put("contentInfoFeiCn",contentInfoFeiCn); + params.put("contentInfoFeiEn",contentInfoFeiEn); + params.put("userIdList",userIdList7); + params.put("projectCn",projectInfo.getProjectName()); + params.put("projectEn",projectInfo.getProjectNameEn()); + params.put("initiatorCn",MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getNameCn()); + params.put("initiatorEn",MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName()); + params.put("dueDate",dueDate); + params.put("back_url_cn",hrefFeishuCn); + params.put("back_url_en",hrefFeishuEn); + feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_GREEN.getValue(),params,flag); + } catch (Exception e) { log.error("飞书消息推送失败"); } } @@ -6339,16 +6375,34 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl stringList = three.get(key); String join = StringUtils.join(stringList, ","); try { - FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); - feishuMsgVo.setTitle(title); - feishuMsgVo.setCnContentUpper("您参与填写的参数" + join + ",还有3天到期,请及时查看处理"); - feishuMsgVo.setCnContentLower(cnContentLower); - feishuMsgVo.setEnContentUpper("The parameter " + join + " you filled in will expire in 3 days. Please check and address it in a timely manner"); - feishuMsgVo.setEnContentLower(enContentLower); - feishuMsgVo.setUrl(hrefFeishu); - feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色 - feishuService.sendCard(thirds, feishuMsgVo); - } catch (IOException e) { +// FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); +// feishuMsgVo.setTitle(title); +// feishuMsgVo.setCnContentUpper("您参与填写的参数" + join + ",还有3天到期,请及时查看处理"); +// feishuMsgVo.setCnContentLower(cnContentLower); +// feishuMsgVo.setEnContentUpper("The parameter " + join + " you filled in will expire in 3 days. Please check and address it in a timely manner"); +// feishuMsgVo.setEnContentLower(enContentLower); +// feishuMsgVo.setUrl(hrefFeishu); +// feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色 +// feishuService.sendCard(thirds, feishuMsgVo); + + String contentInfoFeiCn = "您参与填写的参数" + join + ",还有3天到期,请及时查看处理。"; + String contentInfoFeiEn = "The parameter " + join + " you filled in will expire in 3 days. Please check and address it in a timely manner."; + userIdList3 = userIdList3.stream().distinct().collect(Collectors.toList()); + //飞书消息(模板-20230410) + Map params = new HashMap<>(); + params.put("contentInfoFeiCn",contentInfoFeiCn); + params.put("contentInfoFeiEn",contentInfoFeiEn); + params.put("userIdList",userIdList3); + params.put("projectCn",projectInfo.getProjectName()); + params.put("projectEn",projectInfo.getProjectNameEn()); + params.put("initiatorCn",MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getNameCn()); + params.put("initiatorEn",MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName()); + params.put("dueDate",dueDate); + params.put("back_url_cn",hrefFeishuCn); + params.put("back_url_en",hrefFeishuEn); + feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_GREEN.getValue(),params,flag); + + } catch (Exception e) { log.error("飞书消息推送失败"); } } @@ -6360,16 +6414,34 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl stringList = today.get(key); String join = StringUtils.join(stringList, ","); try { - FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); - feishuMsgVo.setTitle(title); - feishuMsgVo.setCnContentUpper("您参与填写的参数" + join + ",将于今天到期,请及时查看处理"); - feishuMsgVo.setCnContentLower(cnContentLower); - feishuMsgVo.setEnContentUpper("The parameter " + join + " you filled in will expire today. Please check and address it in a timely manner"); - feishuMsgVo.setEnContentLower(enContentLower); - feishuMsgVo.setUrl(hrefFeishu); - feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色 - feishuService.sendCard(thirds, feishuMsgVo); - } catch (IOException e) { +// FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); +// feishuMsgVo.setTitle(title); +// feishuMsgVo.setCnContentUpper("您参与填写的参数" + join + ",将于今天到期,请及时查看处理"); +// feishuMsgVo.setCnContentLower(cnContentLower); +// feishuMsgVo.setEnContentUpper("The parameter " + join + " you filled in will expire today. Please check and address it in a timely manner"); +// feishuMsgVo.setEnContentLower(enContentLower); +// feishuMsgVo.setUrl(hrefFeishu); +// feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色 +// feishuService.sendCard(thirds, feishuMsgVo); + + String contentInfoFeiCn = "您参与填写的参数" + join + ",将于今天到期,请及时查看处理。"; + String contentInfoFeiEn = "The parameter " + join + " you filled in will expire today. Please check and address it in a timely manner."; + userIdList0 = userIdList0.stream().distinct().collect(Collectors.toList()); + //飞书消息(模板-20230410) + Map params = new HashMap<>(); + params.put("contentInfoFeiCn",contentInfoFeiCn); + params.put("contentInfoFeiEn",contentInfoFeiEn); + params.put("userIdList",userIdList0); + params.put("projectCn",projectInfo.getProjectName()); + params.put("projectEn",projectInfo.getProjectNameEn()); + params.put("initiatorCn",MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getNameCn()); + params.put("initiatorEn",MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName()); + params.put("dueDate",dueDate); + params.put("back_url_cn",hrefFeishuCn); + params.put("back_url_en",hrefFeishuEn); + feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_GREEN.getValue(),params,flag); + + } catch (Exception e) { log.error("飞书消息推送失败"); } } @@ -6732,7 +6804,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl stringList = today.get(thirdId); if (ObjectUtils.isEmpty(stringList)) { stringList = new ArrayList<>(); - stringList.add("NIO-" + collectManifestEO.getNioNumber()); + stringList.add(collectManifestEO.getNioNumber()); today.put(thirdId, stringList); } else { - stringList.add("NIO-" + collectManifestEO.getNioNumber()); + stringList.add(collectManifestEO.getNioNumber()); } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/feishu/service/IFeishuService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/feishu/service/IFeishuService.java index 53494a3a1..32b293848 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/feishu/service/IFeishuService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/feishu/service/IFeishuService.java @@ -153,10 +153,10 @@ public interface IFeishuService { void sendMessageRegulationOpinionCollection(String templeteId,Map params); /** - * 飞书消息模板--认证参数收集(主题颜色为红色或绿色) + * 飞书消息模板--认证参数收集(主题颜色为绿色) * @param templeteId * @param params */ - void sendMessageHomoParameterCollection(String templeteId,Map params); + void sendMessageHomoParameterCollection(String templeteId,Map params,String flag); } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/feishu/service/impl/FeishuServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/feishu/service/impl/FeishuServiceImpl.java index 6b0261dc1..e7c33753f 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/feishu/service/impl/FeishuServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/feishu/service/impl/FeishuServiceImpl.java @@ -1581,7 +1581,7 @@ public class FeishuServiceImpl implements IFeishuService { * @param params */ @Override - public void sendMessageHomoParameterCollection(String templeteId, Map params) { + public void sendMessageHomoParameterCollection(String templeteId, Map params,String flag) { List userIdList = (List) params.get("userIdList"); if (CollectionUtils.isNotEmpty(userIdList)) { List userInfoList = this.sysUserService.querySysUserListByIdList(userIdList); @@ -1592,8 +1592,8 @@ public class FeishuServiceImpl implements IFeishuService { String back_url_en = (String) params.get("back_url_en"); String projectCn = (String) params.get("projectCn"); String projectEn = (String) params.get("projectEn"); - String initiator = (String) params.get("initiator"); -// String initiatorEn = (String) params.get("initiatorEn"); + String initiatorCn = (String) params.get("initiatorCn"); + String initiatorEn = (String) params.get("initiatorEn"); String dueDate = (String) params.get("dueDate"); try { for (String userId : userIdList) { @@ -1610,8 +1610,12 @@ public class FeishuServiceImpl implements IFeishuService { templateVariableMap.put("view_url_en",back_url_en); templateVariableMap.put("projectCn"," " + projectCn); templateVariableMap.put("projectEn"," " + projectEn); - templateVariableMap.put("initiator"," " + initiator); -// templateVariableMap.put("initiatorEn",initiatorEn); + templateVariableMap.put("initiatorCn"," " + initiatorCn); + if(StringUtils.isNotBlank(flag)){ + templateVariableMap.put("initiatorEn"," " + initiatorEn); + }else{ + templateVariableMap.put("initiatorEn"," " + initiatorCn); + } templateVariableMap.put("dueDate"," " + dueDate); larkMesJson.put("templateVariableMap",templateVariableMap);