虚拟清单--发布发消息

This commit is contained in:
zhn
2022-10-28 18:03:18 +08:00
parent 4395297f40
commit 5682840fd1
@@ -42,6 +42,7 @@ import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.system.service.impl.SysCategoryServiceImpl; import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -409,31 +410,83 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
//发消息 //发消息
int count = 1; int count = 1;
List<String> hrefListAdd = new ArrayList<>();
if(serialNumberAddList.size() != 0){ if(serialNumberAddList.size() != 0){
List<String> hrefList = new ArrayList<>();
for (DummyInventoryInfoEO dummyInventoryInfoEO : collectAdd) { for (DummyInventoryInfoEO dummyInventoryInfoEO : collectAdd) {
String href = "<a href='/docManage/library/detail?id=" + dummyInventoryInfoEO.getBussDocumentLibraryId() + String href = "<a href='/docManage/library/detail?id=" + dummyInventoryInfoEO.getBussDocumentLibraryId() +
"&title=" + dummyInventoryInfoEO.getTitle() + "&title=" + dummyInventoryInfoEO.getTitle() +
"&serial_number=" + dummyInventoryInfoEO.getSerialNumber() + "'" + " target='_blank'>" + dummyInventoryInfoEO.getSerialNumber() + "</a>"; "&serial_number=" + dummyInventoryInfoEO.getSerialNumber() + "'" + " target='_blank'>" + dummyInventoryInfoEO.getSerialNumber() + "</a>";
hrefList.add(href); hrefListAdd.add(href);
} }
contentLog += count+". New regulations: " + StringUtils.join(hrefList,",") + "</br>"; contentLog += count+". New regulations: " + StringUtils.join(hrefListAdd,",") + "</br>";
contentLogFeishu += count+". New regulations: " + StringUtils.join(serialNumberAddList,",") + " "; contentLogFeishu += count+". New regulations: " + StringUtils.join(serialNumberAddList,",") + " ";
count++; count++;
} }
List<String> hrefListDelete = new ArrayList<>();
if(serialNumberDeleteList.size() != 0){ if(serialNumberDeleteList.size() != 0){
List<String> hrefList = new ArrayList<>();
for (DummyInventoryInfoEO dummyInventoryInfoEO : collectDelete) { for (DummyInventoryInfoEO dummyInventoryInfoEO : collectDelete) {
String href = "<a href='/docManage/library/detail?id=" + dummyInventoryInfoEO.getBussDocumentLibraryId() + String href = "<a href='/docManage/library/detail?id=" + dummyInventoryInfoEO.getBussDocumentLibraryId() +
"&title=" + dummyInventoryInfoEO.getTitle() + "&title=" + dummyInventoryInfoEO.getTitle() +
"&serial_number=" + dummyInventoryInfoEO.getSerialNumber() + "'" + " target='_blank'>" + dummyInventoryInfoEO.getSerialNumber() + "</a>"; "&serial_number=" + dummyInventoryInfoEO.getSerialNumber() + "'" + " target='_blank'>" + dummyInventoryInfoEO.getSerialNumber() + "</a>";
hrefList.add(href); hrefListDelete.add(href);
} }
contentLog += count + ". Remove regulations: " + StringUtils.join(hrefList,",") + "</br>"; contentLog += count + ". Remove regulations: " + StringUtils.join(hrefListDelete,",") + "</br>";
contentLogFeishu += count + ". Remove regulations: " + StringUtils.join(serialNumberDeleteList,",") + " "; contentLogFeishu += count + ". Remove regulations: " + StringUtils.join(serialNumberDeleteList,",") + " ";
} }
if(serialNumberAddList.size() != 0 || serialNumberDeleteList.size() != 0){ 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,",")+"</br>");
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:"+ "</br>" + 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,",")+"</br>");
countInfoYes ++;
}
if(ObjectUtils.isNotEmpty(serialNumberDeleteList)){
sbContentInfoYes.append(countInfoYes+". 删除文档: "+StringUtils.join(hrefListDelete,","));
}
//消息中文--不带标签
String contentInfoNo = "您所订阅的"+baseEO.getName()+"虚拟清单已更新,更新内容如下:"+sbContentINfoNo;
//消息中文--带标签
String contentInfoYes = "您所订阅的"+baseEO.getName()+"虚拟清单已更新,更新内容如下:"+"</br>"+sbContentInfoYes;
List<String> userNameList = dummyReadEOService.queryReadUserInfo(dummyInventoryBaseEO.getId()); List<String> userNameList = dummyReadEOService.queryReadUserInfo(dummyInventoryBaseEO.getId());
List<String> thirdIdList = new ArrayList<>(); List<String> thirdIdList = new ArrayList<>();
if(userNameList.size() != 0){ if(userNameList.size() != 0){
@@ -444,12 +497,12 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
String title = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated."; String title = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated.";
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList, SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList,
title, title,
title, contentNo,
contentLog, contentYes,
MessageTypeEnum.READ.getValue(), MessageTypeEnum.READ.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(), MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
null, contentInfoNo,
null); contentInfoYes);
sysAnnouncementService.saveAnnouncement(sysAnnouncement); sysAnnouncementService.saveAnnouncement(sysAnnouncement);
bussDocumentLibraryEOService.sendWebsocket(dummyInventoryBaseEO.getId(), title); bussDocumentLibraryEOService.sendWebsocket(dummyInventoryBaseEO.getId(), title);
} }