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){