法规预警推送--发消息
This commit is contained in:
+45
-20
@@ -373,7 +373,7 @@ public class LawsWarnService {
|
||||
thirdIdList.addAll(thirdId);
|
||||
}
|
||||
}
|
||||
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
//查询文档
|
||||
List<Map<String, Object>> mapList = bussDocumentLibraryEOMapper.selectMapsAll(documentIds);
|
||||
List<String> serialNumberList = new ArrayList<>();
|
||||
@@ -409,27 +409,52 @@ public class LawsWarnService {
|
||||
"&serial_number=" + map.get("serial_number") + "'" + " target='_blank'>" + map.get("serial_number") + "</a>";
|
||||
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, "+"</br>"
|
||||
+"Regulation No: "+href+"</br>"
|
||||
+"Title: "+titleEn+"</br>"
|
||||
+"New Type Execution Date: "+newType+"</br>"
|
||||
+"New Vehicle Execution Date: "+newVehicle;
|
||||
|
||||
|
||||
//消息中文
|
||||
String contentCnNo = sysUser.getUsername() +"向您分享了法规预警信息, "+"编号: "+serialNumber+",标题: "+titleCn+",新车型实施日期: "+newType+",在产车实施日期: "+newVehicle;
|
||||
String contentInfoCnYes = sysUser.getUsername() +"向您分享了法规预警信息,"+"</br>"
|
||||
+"编号: "+href+"</br>"
|
||||
+"标题: "+titleCn+"</br>"
|
||||
+"新车型实施日期: "+newType+"</br>"
|
||||
+"在产车实施日期: "+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 "推送成功";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user