diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java index d9b7e1175..42b30a509 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java @@ -5265,15 +5265,20 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl hrefListAdd = new ArrayList<>(); if(serialNumberAddList.size() != 0){ - List hrefList = new ArrayList<>(); + for (DummyInventoryInfoEO dummyInventoryInfoEO : collectAdd) { String href = "" + dummyInventoryInfoEO.getSerialNumber() + ""; - hrefList.add(href); + hrefListAdd.add(href); } - contentLog += count+". New regulations: " + StringUtils.join(hrefList,",") + "
"; + contentLog += count+". New regulations: " + StringUtils.join(hrefListAdd,",") + "
"; contentLogFeishu += count+". New regulations: " + StringUtils.join(serialNumberAddList,",") + " "; count++; } + List hrefListDelete = new ArrayList<>(); if(serialNumberDeleteList.size() != 0){ - List hrefList = new ArrayList<>(); for (DummyInventoryInfoEO dummyInventoryInfoEO : collectDelete) { String href = "" + dummyInventoryInfoEO.getSerialNumber() + ""; - hrefList.add(href); + hrefListDelete.add(href); } - contentLog += count + ". Remove regulations: " + StringUtils.join(hrefList,",") + "
"; + contentLog += count + ". Remove regulations: " + StringUtils.join(hrefListDelete,",") + "
"; contentLogFeishu += count + ". Remove regulations: " + StringUtils.join(serialNumberDeleteList,",") + " "; } if(serialNumberAddList.size() != 0 || serialNumberDeleteList.size() != 0){ + int countNo = 1; + StringBuilder sbContentNo = new StringBuilder(); + if(ObjectUtils.isNotEmpty(serialNumberAddList)){ + sbContentNo.append(countNo+". New regulations: "+StringUtils.join(serialNumberAddList,",")+", "); + countNo ++; + } + if(ObjectUtils.isNotEmpty(serialNumberDeleteList)){ + sbContentNo.append(countNo+". Remove regulations: "+StringUtils.join(serialNumberDeleteList,",")); + } + + int countYes = 1; + StringBuilder sbContentYes = new StringBuilder(); + if(ObjectUtils.isNotEmpty(serialNumberAddList)){ + sbContentYes.append(countYes+". New regulations: "+StringUtils.join(hrefListAdd,",")+"
"); + countYes ++; + } + if(ObjectUtils.isNotEmpty(serialNumberDeleteList)){ + sbContentYes.append(countYes+". Remove regulations: "+StringUtils.join(hrefListDelete,",")); + } + //消息英文--不带标签 + String contentNo = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated as follows:" + sbContentNo; + //消息英文--带标签 + String contentYes = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated as follows:"+ "
" + sbContentYes;; + + int countInfoNo = 1; + StringBuilder sbContentINfoNo = new StringBuilder(); + if(ObjectUtils.isNotEmpty(serialNumberAddList)){ + sbContentINfoNo.append(countInfoNo+". 新增文档: "+StringUtils.join(serialNumberAddList,",")+", "); + countInfoNo ++; + } + if(ObjectUtils.isNotEmpty(serialNumberDeleteList)){ + sbContentINfoNo.append(countInfoNo+". 删除文档: "+StringUtils.join(serialNumberDeleteList,",")); + } + + int countInfoYes = 1; + StringBuilder sbContentInfoYes = new StringBuilder(); + if(ObjectUtils.isNotEmpty(serialNumberAddList)){ + sbContentInfoYes.append(countInfoYes+". 新增文档: "+StringUtils.join(hrefListAdd,",")+"
"); + countInfoYes ++; + } + if(ObjectUtils.isNotEmpty(serialNumberDeleteList)){ + sbContentInfoYes.append(countInfoYes+". 删除文档: "+StringUtils.join(hrefListDelete,",")); + } + + //消息中文--不带标签 + String contentInfoNo = "您所订阅的"+baseEO.getName()+"虚拟清单已更新,更新内容如下:"+sbContentINfoNo; + //消息中文--带标签 + String contentInfoYes = "您所订阅的"+baseEO.getName()+"虚拟清单已更新,更新内容如下:"+"
"+sbContentInfoYes; + + + List userNameList = dummyReadEOService.queryReadUserInfo(dummyInventoryBaseEO.getId()); List thirdIdList = new ArrayList<>(); if(userNameList.size() != 0){ @@ -444,12 +497,12 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl" + " View details" + ""; String contentInfo = msgContentEN + " " + href; + + String ContentENNo = currentUser.getUsername()+" shared " + problemKnowledgeBaseTitle + " with you.Please be reminded to check it out."; + String ContentInfoENYes = currentUser.getUsername()+" shared " + problemKnowledgeBaseTitle + " with you.Please be reminded to check it out."+ " " + href; + + String contentCnNo = currentUser.getUsername()+"向您分享了"+problemKnowledgeBaseTitle+",请查看."; + String contentInfoCnYes = currentUser.getUsername()+"向您分享了"+problemKnowledgeBaseTitle+",请查看"+ " " + href; + + //封装消息的实体类 - SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, msgTitle, msgContentEN, contentInfo,MessageTypeEnum.PUSH.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName()); + SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, + msgTitle, + ContentENNo, + ContentInfoENYes, + MessageTypeEnum.PUSH.getValue(), + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(), + contentCnNo, + contentInfoCnYes); + this.sysAnnouncementService.saveAnnouncement(sysAnnouncement); this.sendWebsocket(StringUtils.join(thirdIdList, ","), contentInfo); //飞书 @@ -922,7 +938,9 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl> mapList = bussDocumentLibraryEOMapper.selectMapsAll(documentIds); List serialNumberList = new ArrayList<>(); @@ -409,27 +409,52 @@ public class LawsWarnService { "&serial_number=" + map.get("serial_number") + "'" + " target='_blank'>" + map.get("serial_number") + ""; urlList.add(url); hrefList.add(href+timeContent); + + //推送多条时, 每条单独发消息 + //编号, 标题, 新车型实施日期, 在产车实施日期 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String serialNumber = StringUtils.valueOf(map.get("serial_number")); + String titleCn = StringUtils.valueOf(map.get("title")); + String titleEn = StringUtils.valueOf(map.get("title_en")); + String newType = ""; + if(ObjectUtils.isNotEmpty(map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"))){ + newType = sdf.format(map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1")); + } + String newVehicle = ""; + if(ObjectUtils.isNotEmpty(map.get("implement_time"))){ + newVehicle = sdf.format(map.get("implement_time")); + } + //消息-英文 + String contentNo = sysUser.getUsername() +" shared Regulation Early Warning infomation with you, " + +"Regulation No: "+serialNumber+",Title: "+titleEn+",New Type Execution Date: "+newType+",New Vehicle Execution Date: "+newVehicle; + String contentInfoYes = sysUser.getUsername() +" shared Regulation Early Warning infomation with you, "+"
" + +"Regulation No: "+href+"
" + +"Title: "+titleEn+"
" + +"New Type Execution Date: "+newType+"
" + +"New Vehicle Execution Date: "+newVehicle; + + + //消息中文 + String contentCnNo = sysUser.getUsername() +"向您分享了法规预警信息, "+"编号: "+serialNumber+",标题: "+titleCn+",新车型实施日期: "+newType+",在产车实施日期: "+newVehicle; + String contentInfoCnYes = sysUser.getUsername() +"向您分享了法规预警信息,"+"
" + +"编号: "+href+"
" + +"标题: "+titleCn+"
" + +"新车型实施日期: "+newType+"
" + +"在产车实施日期: "+newVehicle; + + //封装消息的实体类 + SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList, + null, + contentNo, + contentInfoYes, + MessageTypeEnum.PUSH.getValue(), + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(), + contentCnNo,contentInfoCnYes); + sysAnnouncementService.saveAnnouncement(sysAnnouncement); + bussDocumentLibraryEOService.sendWebsocket(StringUtils.join(thirdIdList, ","), contentInfoCnYes); } - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String content = StringUtils.join(serialNumberList, ",") + " has been shared with you, please check."; - //消息详情模板 - // XXX has pushed GB 7258 to you as the implementation date of vehicle production is XXXX-XX-XX, - // GB 7258 to you as the implementation date of vehicle production is XXXX-XX-XX, Please be reminded to check it out. - String contentInfo = sysUser.getUsername() + " has pushed " + StringUtils.join(hrefList, ",") + ", Please be reminded to check it out."; - String title = content; - - //封装消息的实体类 - SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList, - title, - content, - contentInfo, - MessageTypeEnum.PUSH.getValue(), - MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(), - null,null); - sysAnnouncementService.saveAnnouncement(sysAnnouncement); - bussDocumentLibraryEOService.sendWebsocket(StringUtils.join(thirdIdList, ","), contentInfo); //飞书 try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); @@ -473,7 +498,7 @@ public class LawsWarnService { } catch (IOException e) { e.printStackTrace(); } - bussDocumentLibraryEOService.sendWebsocket(documentIds, contentInfo); + bussDocumentLibraryEOService.sendWebsocket(documentIds, documentIds); return "推送成功"; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/warn/service/TimedTaskWarn.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/warn/service/TimedTaskWarn.java index f8cc2140e..397ac8803 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/warn/service/TimedTaskWarn.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/warn/service/TimedTaskWarn.java @@ -124,27 +124,33 @@ public class TimedTaskWarn implements Job { //当前时间的前12个月 String beforeTimeSixTen = beforeTime(12,xin1Che1Xing2Shi2Shi1Ri4Qi1); - if(currentTime.equals(beforeTimeSix) || currentTime.equals(beforeTimeSixTen) || currentTime.equals(xin1Che1Xing2Shi2Shi1Ri4Qi1Str)){ - //发送站内消息和飞书消息 - String format = sdf.format(xin1Che1Xing2Shi2Shi1Ri4Qi1); - String content = "The implementation date of the " + category +" "+ serialNumber - + " new model you subscribed to is "+format+",please pay attention to check"; - String contentInfo = "The implementation date of the " + category +" "+ href - + " new model you subscribed to is "+format+",please pay attention to check"; - String msgTitle = content; - sendMessage(msgTitle, content,contentInfo,content, url, userIdList, thirdIdList); - } +// if(currentTime.equals(beforeTimeSix) || currentTime.equals(beforeTimeSixTen) || currentTime.equals(xin1Che1Xing2Shi2Shi1Ri4Qi1Str)){ +// //发送站内消息和飞书消息 +// String format = sdf.format(xin1Che1Xing2Shi2Shi1Ri4Qi1); +// String content = "The implementation date of the " + category +" "+ serialNumber +// + " new model you subscribed to is "+format+",please pay attention to check"; +// String contentInfo = "The implementation date of the " + category +" "+ href +// + " new model you subscribed to is "+format+",please pay attention to check"; +// String msgTitle = content; +// sendMessage(msgTitle, content,contentInfo,content, url, userIdList, thirdIdList); +// } if(currentTime.equals(beforeTimeSixTen)){ //发送飞书消息(提前一年) sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"1"); + //站内消息 + sendMessage(bussDocumentLibraryEO, userIdList,"1",sdf,href); } if(currentTime.equals(beforeTimeSix)){ //发送飞书消息(提前6个月) sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"6"); + //站内消息 + sendMessage(bussDocumentLibraryEO, userIdList,"6",sdf,href); } if(currentTime.equals(xin1Che1Xing2Shi2Shi1Ri4Qi1Str)){ //发送飞书消息(当天) sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"0"); + //站内消息 + sendMessage(bussDocumentLibraryEO, userIdList,"0",sdf,href); } } @@ -165,19 +171,25 @@ public class TimedTaskWarn implements Job { String contentInfo = "The implementation date of the " + category +" "+ href + " production vehicle you subscribed to is "+format+",please pay attention to check"; String msgTitle = content; - sendMessage(msgTitle, content,contentInfo,content, url, userIdList, thirdIdList); +// sendMessage(msgTitle, content,contentInfo,content, url, userIdList, thirdIdList); } if(currentTime.equals(beforeTimeSixTen)){ //发送飞书消息(提前一年) sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"1"); + //站内消息 + sendMessage(bussDocumentLibraryEO, userIdList,"1",sdf,href); } if(currentTime.equals(beforeTimeSix)){ //发送飞书消息(提前6个月) sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"6"); + //站内消息 + sendMessage(bussDocumentLibraryEO, userIdList,"6",sdf,href); } if(currentTime.equals(implementTimeStr)){ //发送飞书消息(当天) sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"0"); + //站内消息 + sendMessage(bussDocumentLibraryEO, userIdList,"0",sdf,href); } } } @@ -224,25 +236,98 @@ public class TimedTaskWarn implements Job { } } - private void sendMessage(String title, String content,String contentInfo,String contentFeiShu, String url, List userIdList, List thirdIdList) { - //站内消息 +// private void sendMessage(String title, String content,String contentInfo,String contentFeiShu, String url, List userIdList, List thirdIdList) { +// //站内消息 +// //封装消息的实体类 +// SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList, +// title, +// content, +// contentInfo, +// MessageTypeEnum.WARN.getValue(), +// MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(), +// null,null); +// sysAnnouncementService.saveAnnouncement(sysAnnouncement); +// bussDocumentLibraryEOService.sendWebsocket(StringUtils.join(userIdList, ","), content); +// +//// //飞书消息 +//// try { +//// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentFeiShu, MessageTypeEnum.WARN.getName(), url); +//// } catch (IOException e) { +//// e.printStackTrace(); +//// } +// } + private void sendMessage(BussDocumentLibraryEO bussDocumentLibraryEO, + List userIdList, + String flag, + SimpleDateFormat sdf, + String href) { + String number = bussDocumentLibraryEO.getSerialNumber(); + String title = bussDocumentLibraryEO.getTitle(); + String titleEn = bussDocumentLibraryEO.getTitleEn(); + Date xin1Che1Xing2Shi2Shi1Ri4Qi1 = bussDocumentLibraryEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1(); + Date implementTime = bussDocumentLibraryEO.getImplementTime(); + String newType = ""; + String newVehicle = ""; + if(ObjectUtils.isNotEmpty(xin1Che1Xing2Shi2Shi1Ri4Qi1)){ + newType = sdf.format(xin1Che1Xing2Shi2Shi1Ri4Qi1); + } + if(ObjectUtils.isNotEmpty(implementTime)){ + newVehicle = sdf.format(implementTime); + } + String contentCn = ""; + String contentInfoCn = ""; + String contentEn = ""; + String contentInfoEn = ""; + //"
" + + contentCn = ",编号: "+number + +",标题: "+title + +",新车型实施日期: "+newType + +",在产车实施日期: "+newVehicle; + contentInfoCn = "编号: "+href+"
" + +"标题: "+title+"
" + +"新车型实施日期: "+newType+"
" + +"在产车实施日期: "+newVehicle; + + contentEn = ",Regulation No: "+number + +",Title: "+titleEn + +",New Type Execution Date: "+newType + +",New Vehicle Execution Date: "+newVehicle; + + contentInfoEn = "Regulation No: "+href+"
" + +"Title: "+titleEn+"
" + +"New Type Execution Date: "+newType+"
" + +"New Vehicle Execution Date: "+newVehicle; + + if("1".equals(flag)){ + contentCn = "您所订阅的法规将于1年后实施"+contentCn; + contentInfoCn = "您所订阅的法规将于1年后实施"+"
"+contentInfoCn; + contentEn = "The regulation you subscribed to will be implemented in one year"+contentEn; + contentInfoEn = "The regulation you subscribed to will be implemented in one year"+"
"+contentInfoEn; + } + if("6".equals(flag)){ + contentCn = "您所订阅的法规将于6个月后实施"+contentCn; + contentInfoCn = "您所订阅的法规将于6个月后实施"+"
"+contentInfoCn; + contentEn = "The regulation you subscribed to will be implemented in six months"+contentEn; + contentInfoEn = "The regulation you subscribed to will be implemented in six months"+"
"+contentInfoEn; + } + if("0".equals(flag)){ + contentCn = "您所订阅的法规已实施"+contentCn; + contentInfoCn = "您所订阅的法规已实施"+"
"+contentInfoCn; + contentEn = "The regulation you subscribed to is implemented"+contentEn; + contentInfoEn = "The regulation you subscribed to is implemented"+"
"+contentInfoEn; + } + //封装消息的实体类 SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList, title, - content, - contentInfo, + contentEn, + contentInfoEn, MessageTypeEnum.WARN.getValue(), MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(), - null,null); + contentCn,contentInfoCn); sysAnnouncementService.saveAnnouncement(sysAnnouncement); - bussDocumentLibraryEOService.sendWebsocket(StringUtils.join(userIdList, ","), content); - -// //飞书消息 -// try { -// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentFeiShu, MessageTypeEnum.WARN.getName(), url); -// } catch (IOException e) { -// e.printStackTrace(); -// } + bussDocumentLibraryEOService.sendWebsocket(StringUtils.join(userIdList, ","), contentInfoEn); } private String beforeTime (int month,Date date){