Merge remote-tracking branch 'origin/master'

This commit is contained in:
wangchengjun
2022-06-07 15:38:34 +08:00
@@ -36,7 +36,9 @@ import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.document.utils.ReadPdfUtil; import com.jero.modules.document.utils.ReadPdfUtil;
import com.jero.modules.document.utils.ReadWordUtil; import com.jero.modules.document.utils.ReadWordUtil;
import com.jero.modules.document.vo.QueryConditionVO; import com.jero.modules.document.vo.QueryConditionVO;
import com.jero.modules.domain.entity.DomainUserRel;
import com.jero.modules.domain.service.DomainUserRelService; import com.jero.modules.domain.service.DomainUserRelService;
import com.jero.modules.domain.service.impl.DomainManageServiceImpl;
import com.jero.modules.feishu.service.IFeishuService; import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.home.entity.HomeDocumentDynamicEO; import com.jero.modules.home.entity.HomeDocumentDynamicEO;
import com.jero.modules.home.service.IHomeDocumentDynamicEOService; import com.jero.modules.home.service.IHomeDocumentDynamicEOService;
@@ -50,6 +52,7 @@ import com.jero.modules.split.common.FileUnZip;
import com.jero.modules.split.entity.SarFileSplitInfoEO; import com.jero.modules.split.entity.SarFileSplitInfoEO;
import com.jero.modules.split.service.ISarFileSplitInfoService; import com.jero.modules.split.service.ISarFileSplitInfoService;
import com.jero.modules.subscribe.entity.OnlCgformSubscribe; import com.jero.modules.subscribe.entity.OnlCgformSubscribe;
import com.jero.modules.subscribe.mapper.OnlCgformSubscribeMapper;
import com.jero.modules.subscribe.service.IOnlCgformSubscribeService; import com.jero.modules.subscribe.service.IOnlCgformSubscribeService;
import com.jero.modules.system.entity.SysAnnouncement; import com.jero.modules.system.entity.SysAnnouncement;
import com.jero.modules.system.entity.SysCategory; import com.jero.modules.system.entity.SysCategory;
@@ -171,6 +174,10 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
private IHomeDocumentDynamicEOService homeDocumentDynamicEOService; private IHomeDocumentDynamicEOService homeDocumentDynamicEOService;
@Autowired @Autowired
private IOcrRecordEOService ocrRecordEOService; private IOcrRecordEOService ocrRecordEOService;
@Autowired
private DomainManageServiceImpl domainManageService;
@Autowired
private OnlCgformSubscribeMapper onlCgformSubscribeMapper;
@Value(value = "${jero.path.upload}") @Value(value = "${jero.path.upload}")
private String uploadpath; private String uploadpath;
@@ -2118,7 +2125,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//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 "+ category + " "
+ href +" has been added."; + 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);
@@ -2980,10 +2987,13 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
List<OnlCgformField> fieldFileList, List<OnlCgformField> fieldFileList,
List<OnlCgformField> fieldPullList, List<OnlCgformField> fieldPullList,
String cut) { String cut) {
String technologyTerritoryNew = (String) dataList.get(0).get("technology_territory");
//1. 处理订阅的发送消息 //1. 处理订阅的发送消息
//修改的内容 //修改的内容
String flag ="1";//消息的标识(英文) String flag ="1";//消息的标识(英文)
StringBuilder sb = getUpdateInfo(map, dataList, fieldList, fieldDateList, fieldFileList, fieldPullList, null,flag); StringBuilder sb = getUpdateInfo(map, dataList, fieldList, fieldDateList, fieldFileList, fieldPullList, null,flag);
//树形数据字典
List<SysCategory> categoryList = sysCategoryService.list();
String sbStr = ""; String sbStr = "";
if (ObjectUtils.isNotEmpty(sb)) { if (ObjectUtils.isNotEmpty(sb)) {
sbStr = sb.substring(0, sb.length() - 1); sbStr = sb.substring(0, sb.length() - 1);
@@ -2991,55 +3001,94 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
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");
//只要修改了标准,就需要向订阅用户发送消息(内容为-->XXX对“GB 7258 进行了修改请及时查看”) //只要修改了标准,就需要向订阅用户发送消息(内容为-->XXX对“GB 7258 进行了修改请及时查看”)
//向订阅领域管理中订阅了该技术领域的人和文档库中订阅了该条文档的人发送消息 //向订阅领域管理中订阅了该技术领域的人和文档库中订阅了该条文档的人发送消息
Map<String, Object> mapTemp = new HashMap<>(); Map<String, Object> mapTemp = new HashMap<>();
mapTemp.put("domainId", map.get("technology_territory")); mapTemp.put("domainId", map.get("technology_territory"));
mapTemp.put("documentId", map.get("id")); mapTemp.put("documentId", map.get("id"));
//订阅技术领域的人和订阅该条标准的人 //订阅技术领域的人和订阅该条标准的人
List<String> userIdList = domainUserRelService.queryDomainUserRelInfo(mapTemp); // List<String> userIdList = domainUserRelService.queryDomainUserRelInfo(mapTemp);
if(CollectionUtils.isNotEmpty(userIdList)){ //订阅技术领域发消息
LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>(); List<DomainUserRel> domainUserRelList = domainManageService.list();
wrapper.in(SysUser::getId,userIdList); List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUserList = sysUserService.list(wrapper); String technologyTerritoryNameEn = "";
sysUserList = sysUserList.stream().filter(e->StringUtils.isNotBlank(e.getThirdId())).collect(Collectors.toList()); if(StringUtils.isNotBlank(technologyTerritory) && !technologyTerritory.equals(technologyTerritoryNew) && domainUserRelList.size() != 0){
List<String> thirdIdList = sysUserList.stream().map(SysUser::getThirdId).collect(Collectors.toList()); List<DomainUserRel> collect = domainUserRelList.stream()
.filter(e -> technologyTerritory.contains(e.getDomainId()))
.collect(Collectors.toList());
if(collect.size() != 0){
List<String> userIdList = collect.stream().map(DomainUserRel::getUserId).collect(Collectors.toList());
List<String> domainIdList = collect.stream().map(DomainUserRel::getDomainId).distinct().collect(Collectors.toList());
if(userIdList.size() != 0){
List<SysUser> sysUsersFeishu = this.sysUserMapper.selectBatchIds(userIdList);
if(sysUsersFeishu.size() != 0){
thirdIdList = sysUsersFeishu.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
}
if(domainIdList.size() != 0){
StringBuilder sbTemp = new StringBuilder();
for (String s : domainIdList) {
List<SysCategory> collect1 = categoryList.stream().filter(e -> s.equals(e.getId())).collect(Collectors.toList());
if(collect1.size() != 0){
String enName = collect1.get(0).getEnName().trim();
sbTemp.append(enName + ",");
}
}
if(StringUtils.isNotBlank(sbTemp)){
technologyTerritoryNameEn = sbTemp.substring(0, sbTemp.length() - 1);
}
String id = (String) map.get("id"); }
}
}
//订阅标准
List<String> userIdListUpdate = new ArrayList<>();
String id = (String) map.get("id");
if (StringUtils.isNotBlank(id)) {
QueryWrapper<OnlCgformSubscribe> querySubscribe = new QueryWrapper<>();
querySubscribe.lambda().eq(OnlCgformSubscribe::getDocumentId, id);
List<OnlCgformSubscribe> onlCgformSubscribeList = onlCgformSubscribeMapper.selectList(querySubscribe);
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(onlCgformSubscribeList)) {
List<String> userNameList = onlCgformSubscribeList.stream().map(OnlCgformSubscribe::getCreateBy).distinct().collect(Collectors.toList());
QueryWrapper<SysUser> userQuery = new QueryWrapper<>();
userQuery.lambda().in(SysUser::getUsername, userNameList);
List<SysUser> sysUsers = this.sysUserMapper.selectList(userQuery);
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(sysUsers)) {
userIdListUpdate = sysUsers.stream().map(SysUser::getId).collect(Collectors.toList());
}
}
}
//飞书消息
if(thirdIdList.size() != 0){
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;
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoFei, MessageTypeEnum.READ.getName(), url);
} catch (IOException e) {
log.error("文档新增飞书消息推送失败");
}
}
//站内消息
if(CollectionUtils.isNotEmpty(userIdListUpdate)){
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 +
"&serial_number=" + serialNumber + "'" + " target='_blank'>" + serialNumber + "</a>"; "&serial_number=" + serialNumber + "'" + " target='_blank'>" + serialNumber + "</a>";
if (StringUtils.isNotBlank(sbStr.toString())) { if (StringUtils.isNotBlank(sbStr.toString())) {
//您订阅的XXX已被修改 //您订阅的XXX已被修改
String content = "In the "+serialNumber+" you subscribed to, has been modified,Please pay attention to check."; String content = "In the "+serialNumber+" you subscribed to, has been modified,Please pay attention to check.";
// String content = sysUser.getUsername() + " update " + serialNumber + ",Please pay attention to check."; String contentInfo = "In the "+href+" you subscribed to, "+sysUser.getUsername()+" changed the "+ href + " " + sbStr.toString();
//您订阅的GB 7258-2021 中,由张三将技术领域"车身"改为"车门"
String contentInfo = "In the "+serialNumber+" you subscribed to, "+sysUser.getUsername()+" changed the "+ href+ sbStr.toString();
// String contentInfo = sysUser.getUsername() + " update " + href + sbStr.toString();
//封装消息的实体类 //封装消息的实体类
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, content, contentInfo); 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 {
String hrefTemp = "<a href='/docManage/library/detail?id=" + id +
"'" + " target='_blank'>" + serialNumber + "</a>";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String replace = sbStr.replaceAll("<text class='highlight-class'>", "").replaceAll("</text>", "");
String contentInfoFei = "In the " + category + serialNumber+" you subscribed to, "+sysUser.getUsername()+" changed the " + replace;
String contentInfo = "In the " + category + hrefTemp+" you subscribed to, "+sysUser.getUsername()+" changed the " + sbStr;
String content = "In the "+serialNumber+" you subscribed to, has been modified,Please pay attention to check.";
String encodeContent = UriEncoder.encode(content);
String encodeContentInfo = UriEncoder.encode(contentInfo);
String url = backUrl + "/system/MessageDetails?msgContent="+encodeContent+"&sendTime="+sdf.format(new Date())+"&msgContentInfo="+encodeContentInfo;
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoFei, MessageTypeEnum.READ.getName(), url);
} catch (IOException e) {
log.error("文档新增飞书消息推送失败");
}
} }
// } // }
//2. 处理修改代替标准的发送消息(法规负责人) //2. 处理修改代替标准的发送消息(法规负责人)