消息
This commit is contained in:
+73
-39
@@ -2124,11 +2124,12 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
|
||||||
String hrefTemp = backUrl + "/docManage/library/detail?id=" + idTemp;
|
String hrefTemp = backUrl + "/docManage/library/detail?id=" + idTemp;
|
||||||
String content = sysUser.getUsername() + " add " + serialNumber + ",Please pay attention to check.";
|
String content = "In the "+ technologyTerritoryName
|
||||||
|
+ " technical field you subscribed to, the "+category+" "+serialNumber+" has been updated.";
|
||||||
//In the XXXX technical field you subscribed to, the standard "GBXXX" has been updated.
|
//In the XXXX technical field you subscribed to, the standard "GBXXX" has been updated.
|
||||||
String contentInfo = "In the "+ technologyTerritoryName
|
String contentInfo = "In the "+ technologyTerritoryName
|
||||||
+ " technical field you subscribed to, the "+ category + " "
|
+ " technical field you subscribed to, the "
|
||||||
+ serialNumber +" has been updated.";
|
+ href +" has been updated.";
|
||||||
// String contentInfo = sysUser.getUsername() + " add " + serialNumber + ",Please pay attention to check.";
|
// String contentInfo = sysUser.getUsername() + " add " + serialNumber + ",Please pay attention to check.";
|
||||||
//封装消息的实体类
|
//封装消息的实体类
|
||||||
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, content, contentInfo);
|
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, content, contentInfo);
|
||||||
@@ -2136,7 +2137,10 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
sendWebsocket(idTemp, contentInfo);
|
sendWebsocket(idTemp, contentInfo);
|
||||||
//飞书
|
//飞书
|
||||||
try {
|
try {
|
||||||
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfo, MessageTypeEnum.PUSH.getName(), hrefTemp);
|
String contentInfoFeiShu = "In the "+ technologyTerritoryName
|
||||||
|
+ " technical field you subscribed to, the "
|
||||||
|
+ serialNumber +" has been updated.";
|
||||||
|
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoFeiShu, MessageTypeEnum.PUSH.getName(), hrefTemp);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("飞书消息推送失败");
|
log.error("飞书消息推送失败");
|
||||||
}
|
}
|
||||||
@@ -3005,6 +3009,18 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
String serialNumber = (String) dataList.get(0).get("serial_number");
|
String serialNumber = (String) dataList.get(0).get("serial_number");
|
||||||
String category = (String)map.get("lei4_bie2");
|
String category = (String)map.get("lei4_bie2");
|
||||||
String technologyTerritory = (String) map.get("technology_territory");
|
String technologyTerritory = (String) map.get("technology_territory");
|
||||||
|
if(StringUtils.isNotBlank(category)){
|
||||||
|
List<SysDictItem> dictItemList = sysDictItemServiceImpl.selectItemsAll();
|
||||||
|
String finalCategory = category;
|
||||||
|
List<SysDictItem> stateDictItemList = dictItemList.stream()
|
||||||
|
.filter(e -> "type".equals(e.getDictCode()) && finalCategory.equals(e.getItemValue()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if(stateDictItemList.size() != 0){
|
||||||
|
category = stateDictItemList.get(0).getEnName();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
category = "";
|
||||||
|
}
|
||||||
//只要修改了标准,就需要向订阅用户发送消息(内容为-->XXX对“GB 7258 进行了修改请及时查看”)
|
//只要修改了标准,就需要向订阅用户发送消息(内容为-->XXX对“GB 7258 进行了修改请及时查看”)
|
||||||
//向订阅领域管理中订阅了该技术领域的人和文档库中订阅了该条文档的人发送消息
|
//向订阅领域管理中订阅了该技术领域的人和文档库中订阅了该条文档的人发送消息
|
||||||
Map<String, Object> mapTemp = new HashMap<>();
|
Map<String, Object> mapTemp = new HashMap<>();
|
||||||
@@ -3014,8 +3030,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
// List<String> userIdList = domainUserRelService.queryDomainUserRelInfo(mapTemp);
|
// List<String> userIdList = domainUserRelService.queryDomainUserRelInfo(mapTemp);
|
||||||
//订阅技术领域发消息
|
//订阅技术领域发消息
|
||||||
List<DomainUserRel> domainUserRelList = domainManageService.list();
|
List<DomainUserRel> domainUserRelList = domainManageService.list();
|
||||||
List<String> thirdIdListAll = new ArrayList<>();
|
// List<String> thirdIdListAll = new ArrayList<>();
|
||||||
List<String> userListAll = new ArrayList<>();
|
// List<String> userListAll = new ArrayList<>();
|
||||||
List<String> thirdIdList = new ArrayList<>();
|
List<String> thirdIdList = new ArrayList<>();
|
||||||
List<String> userList = new ArrayList<>();
|
List<String> userList = new ArrayList<>();
|
||||||
String technologyTerritoryNameEn = "";
|
String technologyTerritoryNameEn = "";
|
||||||
@@ -3031,12 +3047,12 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
if(sysUsersFeishu.size() != 0){
|
if(sysUsersFeishu.size() != 0){
|
||||||
thirdIdList = sysUsersFeishu.stream().map(SysUser::getThirdId).collect(Collectors.toList());
|
thirdIdList = sysUsersFeishu.stream().map(SysUser::getThirdId).collect(Collectors.toList());
|
||||||
userList = sysUsersFeishu.stream().map(SysUser::getId).collect(Collectors.toList());
|
userList = sysUsersFeishu.stream().map(SysUser::getId).collect(Collectors.toList());
|
||||||
if(thirdIdList.size() != 0){
|
// if(thirdIdList.size() != 0){
|
||||||
thirdIdListAll.addAll(thirdIdList);
|
// thirdIdListAll.addAll(thirdIdList);
|
||||||
}
|
// }
|
||||||
if(userList.size() != 0){
|
// if(userList.size() != 0){
|
||||||
userListAll.addAll(userList);
|
// userListAll.addAll(userList);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(domainIdList.size() != 0){
|
if(domainIdList.size() != 0){
|
||||||
@@ -3072,33 +3088,30 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(sysUsers)) {
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(sysUsers)) {
|
||||||
userIdListUpdate = sysUsers.stream().map(SysUser::getId).collect(Collectors.toList());
|
userIdListUpdate = sysUsers.stream().map(SysUser::getId).collect(Collectors.toList());
|
||||||
userIdListUpdateFeishu = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
|
userIdListUpdateFeishu = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
|
||||||
if(userIdListUpdate.size() != 0){
|
// if(userIdListUpdate.size() != 0){
|
||||||
userListAll.addAll(userIdListUpdate);
|
// userListAll.addAll(userIdListUpdate);
|
||||||
}
|
// }
|
||||||
if(userIdListUpdateFeishu.size() != 0){
|
// if(userIdListUpdateFeishu.size() != 0){
|
||||||
thirdIdListAll.addAll(userIdListUpdateFeishu);
|
// thirdIdListAll.addAll(userIdListUpdateFeishu);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//飞书消息
|
//订阅管理
|
||||||
if(thirdIdListAll.size() != 0){
|
if(thirdIdList.size() != 0){
|
||||||
thirdIdListAll = thirdIdListAll.stream().distinct().collect(Collectors.toList());
|
// thirdIdListAll = thirdIdListAll.stream().distinct().collect(Collectors.toList());
|
||||||
|
String contentInfoFei = "In the " + technologyTerritoryNameEn + " technical field you subscribed to, the " +
|
||||||
|
category + " " + serialNumber+" has been updated.";
|
||||||
try {
|
try {
|
||||||
String contentInfoFei = "In the " + technologyTerritoryNameEn + " technical field you subscribed to, the " +
|
|
||||||
category + " " + serialNumber+" has been updated.";
|
|
||||||
//跳转文档详情
|
//跳转文档详情
|
||||||
String url = backUrl + "/docManage/library/detail?id=" + id;
|
String url = backUrl + "/docManage/library/detail?id=" + id;
|
||||||
iFeishuService.batchSendMessage(thirdIdListAll.toArray(new String[]{}), contentInfoFei, MessageTypeEnum.READ.getName(), url);
|
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoFei, MessageTypeEnum.READ.getName(), url);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("文档新增飞书消息推送失败");
|
log.error("文档新增飞书消息推送失败");
|
||||||
}
|
}
|
||||||
}
|
//站内消息(在文档中订阅和订阅管理中订阅中,因为站内消息和飞书消息的内容不一样所以都要独立发送)
|
||||||
|
//userList
|
||||||
//站内消息
|
|
||||||
if(CollectionUtils.isNotEmpty(userListAll)){
|
|
||||||
userListAll = userListAll.stream().distinct().collect(Collectors.toList());
|
|
||||||
String title = (String) map.get("title");
|
String title = (String) map.get("title");
|
||||||
String href = "<a href='/docManage/library/detail?id=" + id +
|
String href = "<a href='/docManage/library/detail?id=" + id +
|
||||||
"&title=" + title +
|
"&title=" + title +
|
||||||
@@ -3107,23 +3120,44 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
//去掉a标签
|
//去掉a标签
|
||||||
sbStr = sbStr.replaceAll("<text class='highlight-class'>", "").replaceAll("</text>", "");
|
sbStr = sbStr.replaceAll("<text class='highlight-class'>", "").replaceAll("</text>", "");
|
||||||
//您订阅的XXX已被修改
|
//您订阅的XXX已被修改
|
||||||
String content = "In the "+serialNumber+" you subscribed to, has been modified,Please pay attention to check.";
|
String contentInfo = "In the " + technologyTerritoryNameEn + " technical field you subscribed to," +sysUser.getUsername()+" changed the "+ href + " " + sbStr.toString();
|
||||||
String contentInfo = "In the "+href+" you subscribed to, "+sysUser.getUsername()+" changed the "+ href + " " + sbStr.toString();
|
// String contentInfo = "In the "+category + " " + href+" you subscribed to, "+sysUser.getUsername()+" changed the "+ href + " " + sbStr.toString();
|
||||||
//封装消息的实体类
|
//封装消息的实体类
|
||||||
SysAnnouncement sysAnnouncement = getSysAnnouncement(userListAll, content, contentInfo);
|
SysAnnouncement sysAnnouncement = getSysAnnouncement(userList, contentInfoFei, contentInfo);
|
||||||
|
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
|
||||||
|
sendWebsocket((String) map.get("id"), contentInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//文档订阅
|
||||||
|
if(CollectionUtils.isNotEmpty(userIdListUpdate)){
|
||||||
|
// userListAll = userListAll.stream().distinct().collect(Collectors.toList());
|
||||||
|
String title = (String) map.get("title");
|
||||||
|
String href = "<a href='/docManage/library/detail?id=" + id +
|
||||||
|
"&title=" + title +
|
||||||
|
"&serial_number=" + serialNumber + "'" + " target='_blank'>" + serialNumber + "</a>";
|
||||||
|
String content = "";
|
||||||
|
if (StringUtils.isNotBlank(sbStr.toString())) {
|
||||||
|
//去掉a标签
|
||||||
|
sbStr = sbStr.replaceAll("<text class='highlight-class'>", "").replaceAll("</text>", "");
|
||||||
|
//您订阅的XXX已被修改
|
||||||
|
content = "In the "+category + " " + serialNumber+" you subscribed to, has been modified,Please pay attention to check.";
|
||||||
|
String contentInfo = "In the "+category + " " + href+" you subscribed to, "+sysUser.getUsername()+" changed the "+ href + " " + sbStr.toString();
|
||||||
|
//封装消息的实体类
|
||||||
|
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdListUpdate, content, contentInfo);
|
||||||
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
|
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
|
||||||
sendWebsocket((String) map.get("id"), contentInfo);
|
sendWebsocket((String) map.get("id"), contentInfo);
|
||||||
}
|
}
|
||||||
//订阅文档的飞书消息
|
//订阅文档的飞书消息
|
||||||
// try {
|
try {
|
||||||
// String contentInfoFei = "In the " + technologyTerritoryNameEn + " technical field you subscribed to, the " +
|
// String contentInfoFei = "In the " + technologyTerritoryNameEn + " technical field you subscribed to, the " +
|
||||||
// category + " " + serialNumber+" has been updated.";
|
// category + " " + serialNumber+" has been updated.";
|
||||||
// //跳转文档详情
|
//跳转文档详情
|
||||||
// String url = backUrl + "/docManage/library/detail?id=" + id;
|
String url = backUrl + "/docManage/library/detail?id=" + id;
|
||||||
// iFeishuService.batchSendMessage(userIdListUpdateFeishu.toArray(new String[]{}), contentInfoFei, MessageTypeEnum.READ.getName(), url);
|
iFeishuService.batchSendMessage(userIdListUpdateFeishu.toArray(new String[]{}), content, MessageTypeEnum.READ.getName(), url);
|
||||||
// } catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// log.error("文档新增飞书消息推送失败");
|
log.error("文档新增飞书消息推送失败");
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
//2. 处理修改代替标准的发送消息(法规负责人)
|
//2. 处理修改代替标准的发送消息(法规负责人)
|
||||||
|
|||||||
Reference in New Issue
Block a user