Merge remote-tracking branch 'origin/dev_2nd_LCYH' into dev_2nd_LCYH

This commit is contained in:
wangzhijiang
2023-04-11 14:45:37 +08:00
15 changed files with 739 additions and 87 deletions
@@ -5669,18 +5669,26 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
list.add(serialNumber);
}
});
String contentTemp = sysUser.getUsername() + " shared " + StringUtils.join(list, ",") + " with you, please be reminded to check it out.";
String contentTempCn = sysUser.getUsername() + "向您分享了" + StringUtils.join(list, ",") + "请查看.";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.PUSH.getNameCn()+"/"+MessageTypeEnum.PUSH.getName());
feishuMsgVo.setUrl(encode);
feishuMsgVo.setContentEn(contentTemp);
feishuMsgVo.setContent(contentTempCn);
iFeishuService.sendCardMsgTerritory(thirdIdList.toArray(new String[]{}),feishuMsgVo);
String contentTemp = sysUser.getUsername() + " shared " + StringUtils.join(list, ",") + " with you, Please be reminded to check it out.";
String contentTempCn = sysUser.getUsername() + "向您分享了" + StringUtils.join(list, ",") + ",请查看。";
// FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
// feishuMsgVo.setTitle(MessageTypeEnum.PUSH.getNameCn()+"/"+MessageTypeEnum.PUSH.getName());
// feishuMsgVo.setUrl(encode);
// feishuMsgVo.setContentEn(contentTemp);
// feishuMsgVo.setContent(contentTempCn);
// iFeishuService.sendCardMsgTerritory(thirdIdList.toArray(new String[]{}),feishuMsgVo);
// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentTemp, MessageTypeEnum.PUSH.getName(), encode);
//飞书消息(模板-20230410)
Map<String,Object> params = new HashMap<>();
params.put("contentInfoFeiCn",contentTempCn);
params.put("contentInfoFeiEn",contentTemp);
params.put("userIdList",userIdList);
params.put("back_url",encode);
params.put("titleCn",TemplateInfoEnum2.TRANSPOND_PUSH.getNameCn());
params.put("titleEn",TemplateInfoEnum2.TRANSPOND_PUSH.getNameEn());
iFeishuService.sendMessageSubscriptionNotification(TemplateInfoEnum2.SUBSCRIPTION_INFORM.getValue(),params);
}
} catch (IOException e) {
} catch (Exception e) {
log.error("飞书推送失败");
}
sendWebsocket(documentIds, contentInfo);
@@ -75,7 +75,12 @@ public enum TemplateInfoEnum2 {
/**
* 转发推送
*/
TRANSPOND_PUSH("转发推送","ctp_AArfkau1GRMZ","Share / Forward"),
TRANSPOND_PUSH("转发推送","","Share / Forward"),
/**
* 法规预警
*/
LAWS_WARN("法规预警","ctp_AArYGerQrOcE","Regulation Early Warning"),
@@ -138,4 +138,11 @@ public interface IFeishuService {
*/
void sendMessageSubscriptionNotification(String templeteId,Map<String,Object> params);
/**
* 飞书消息模板--法规预警
* @param templeteId
* @param params
*/
void sendMessageLawsWarn(String templeteId,Map<String,Object> params);
}
@@ -1473,4 +1473,47 @@ public class FeishuServiceImpl implements IFeishuService {
}
}
@Override
public void sendMessageLawsWarn(String templeteId, Map<String, Object> params) {
List<String> userIdList = (List<String>) params.get("userIdList");
if (CollectionUtils.isNotEmpty(userIdList)) {
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
String contentCn = (String) params.get("contentInfoFeiCn");
String contentEn = (String) params.get("contentInfoFeiEn");
String back_url = (String) params.get("back_url");
String titleCn = (String) params.get("titleCn");
String titleEn = (String) params.get("titleEn");
String regulationNo = (String) params.get("regulationNo");
String newTypeExecutionDate = (String) params.get("newTypeExecutionDate");
String newVehicleExecutionDate = (String) params.get("newVehicleExecutionDate");
try {
for (String userId : userIdList) {
String thirdId = this.sysUserService.getUserThirdIdByUserId(userInfoList,userId);
if(StringUtils.isNotEmpty(thirdId)){
// 根据结束时间进行排序,获取最近的时间,发消息时使用。
JSONObject larkMesJson = new JSONObject();
larkMesJson.put("template_id", templeteId);
larkMesJson.put("userIds",thirdId);
Map<String,Object> templateVariableMap = new HashMap<>();
templateVariableMap.put("contentInfoFeiCn",contentCn);
templateVariableMap.put("contentInfoFeiEn",contentEn);
templateVariableMap.put("view_url_cn",back_url);
templateVariableMap.put("view_url_en",back_url);
templateVariableMap.put("titleCn",titleCn);
templateVariableMap.put("titleEn",titleEn);
templateVariableMap.put("regulationNo",regulationNo);
templateVariableMap.put("newTypeExecutionDate",newTypeExecutionDate);
templateVariableMap.put("newVehicleExecutionDate",newVehicleExecutionDate);
larkMesJson.put("templateVariableMap",templateVariableMap);
batchSendLarkCardMsgByTemplate2(larkMesJson);
}
}
} catch (Exception e) {
log.error("飞书消息推送失败");
}
}
}
}
@@ -6,6 +6,7 @@ import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl;
import com.jero.modules.feishu.enums.TemplateInfoEnum2;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.problemKnowledgeBase.entity.ProblemKnowledgeBaseCommentEO;
@@ -36,7 +37,9 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -94,7 +97,7 @@ public class ProblemKnowledgeBaseCommentEOServiceImpl extends ServiceImpl<Proble
String url = backUrl +"/problemknowledgeBase?id="+problemKnowledgeBaseEO.getId();
String href = "<a href='"+url + "'"+ " target='_blank'>"+ problemKnowledgeBaseEO.getTitle() + "</a>";
String contentINfoCNNo = "您发布的问题知识库信息"+href+"有新评论,请注意查看.";
String contentINfoCNNo = "您发布的问题知识库信息"+href+"有新评论,请注意查看。";
String contentInfoENNo = "In the Q&A knowledge "+href+" you created, a new comment has been added. Please be reminded to check it out.";
//发送消息(站内和飞书)
@@ -111,16 +114,24 @@ public class ProblemKnowledgeBaseCommentEOServiceImpl extends ServiceImpl<Proble
this.sysAnnouncementService.saveAnnouncement(sysAnnouncement);
bussDocumentLibraryEOService.sendWebsocket(com.jero.modules.system.util.StringUtils.join(sysUser.getThirdId(), ","), sysUser.getThirdId());
// String href = backUrl +"/problemknowledgeBase";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.PUSH.getNameCn()+"/"+MessageTypeEnum.PUSH.getName());
feishuMsgVo.setUrl(url);
feishuMsgVo.setContentEn(contentENNo);
feishuMsgVo.setContent(contentCNNo);
// FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
// feishuMsgVo.setTitle(MessageTypeEnum.PUSH.getNameCn()+"/"+MessageTypeEnum.PUSH.getName());
// feishuMsgVo.setUrl(url);
// feishuMsgVo.setContentEn(contentENNo);
// feishuMsgVo.setContent(contentCNNo);
try {
this.iFeishuService.sendCardMsgTerritory(sysUser.getThirdId().split(","), feishuMsgVo);
} catch (IOException e) {
// this.iFeishuService.sendCardMsgTerritory(sysUser.getThirdId().split(","), feishuMsgVo);
//飞书消息(模板-20230410)
Map<String,Object> params = new HashMap<>();
params.put("contentInfoFeiCn",contentCNNo);
params.put("contentInfoFeiEn",contentENNo);
params.put("userIdList",Arrays.asList(sysUser.getId().split(",")));
params.put("back_url",url);
params.put("titleCn", TemplateInfoEnum2.TRANSPOND_PUSH.getNameCn());
params.put("titleEn",TemplateInfoEnum2.TRANSPOND_PUSH.getNameEn());
iFeishuService.sendMessageSubscriptionNotification(TemplateInfoEnum2.SUBSCRIPTION_INFORM.getValue(),params);
} catch (Exception e) {
e.printStackTrace();
}
// }
@@ -17,6 +17,7 @@ import com.jero.common.system.vo.LoginUser;
import com.jero.modules.document.enums.SearchEnum;
import com.jero.modules.document.utils.ReadPdfUtil;
import com.jero.modules.document.utils.ReadWordUtil;
import com.jero.modules.feishu.enums.TemplateInfoEnum2;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.message.websocket.WebSocket;
@@ -908,18 +909,25 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
//XXX向您分享了XXXXXXXXX,请查看。
//XXX shared xxxxxxxx with you. Please be reminded to check it out.
String contentInfoFeiCn = currentUser.getUsername()+"向您分享了"+problemKnowledgeBaseTitle+",请查看";
String contentInfoFeiCn = currentUser.getUsername()+"向您分享了"+problemKnowledgeBaseTitle+",请查看。";
String msgContentENTemp = currentUser.getUsername()+" shared " + problemKnowledgeBaseTitle + " with you.Please be reminded to check it out.";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.PUSH.getNameCn()+"/"+MessageTypeEnum.PUSH.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setContentEn(msgContentENTemp);
feishuMsgVo.setContent(contentInfoFeiCn);
// FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
// feishuMsgVo.setTitle(MessageTypeEnum.PUSH.getNameCn()+"/"+MessageTypeEnum.PUSH.getName());
// feishuMsgVo.setUrl(hrefFeishu);
// feishuMsgVo.setContentEn(msgContentENTemp);
// feishuMsgVo.setContent(contentInfoFeiCn);
// this.iFeishuService.sendCardMsgTerritory(thirdIdList.toArray(new String[]{}), feishuMsgVo);
this.iFeishuService.sendCardMsgTerritory(thirdIdList.toArray(new String[]{}), feishuMsgVo);
// this.iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), msgContentEN, MessageTypeEnum.PUSH.getName(), hrefFeishu);
} catch (IOException e) {
//飞书消息(模板-20230410)
Map<String,Object> params = new HashMap<>();
params.put("contentInfoFeiCn",contentInfoFeiCn);
params.put("contentInfoFeiEn",msgContentENTemp);
params.put("userIdList",userIdList);
params.put("back_url",hrefFeishu);
params.put("titleCn", TemplateInfoEnum2.TRANSPOND_PUSH.getNameCn());
params.put("titleEn",TemplateInfoEnum2.TRANSPOND_PUSH.getNameEn());
iFeishuService.sendMessageSubscriptionNotification(TemplateInfoEnum2.SUBSCRIPTION_INFORM.getValue(),params);
} catch (Exception e) {
log.error("飞书推送失败");
}
this.sendWebsocket(problemKnowledgeBaseId, contentInfo);
@@ -18,6 +18,7 @@ import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper;
import com.jero.modules.document.service.IPhasedImplementationDetailsEOService;
import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl;
import com.jero.modules.dummy.entity.DummyInventoryInfoEO;
import com.jero.modules.feishu.enums.TemplateInfoEnum2;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.system.entity.SysAnnouncement;
@@ -55,6 +56,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
@@ -554,41 +556,50 @@ public class LawsWarnService {
for (String s : urlList) {
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
String encode = UriEncoder.encode(s);
List<String> list = new ArrayList<>();
String contentInfoFei = sysUser.getUsername() +" shared Regulation Early Warning infomation with you.";
String contentInfoFeiCn = sysUser.getUsername() +"向您分享了法规预警信息.";
List<String> userIdListNew = userIdList;
mapList.stream().forEach(e->{
if(s.contains((String)e.get("id"))){
String serialNumber = StringUtils.valueOf(e.get("serial_number"));
//封装飞书消息实体类
setFeishuMsgVo(sysUser, sdf, feishuMsgVo, encode, e, serialNumber);
// setFeishuMsgVo(sysUser, sdf, feishuMsgVo, encode, e, serialNumber);
String timeContent = "";
if("1".equals(flag)){
String value = StringUtils.valueOf(e.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"));
if(StringUtils.isNotBlank(value)){
if(value.contains(" ")){
value = value.split(" ")[0];
}
timeContent =" to you as the implementation date of the new model is " +value;
}
}else if("2".equals(flag)){
String value = StringUtils.valueOf(e.get("implement_time"));
if(StringUtils.isNotBlank(value)){
if(value.contains(" ")){
value = value.split(" ")[0];
}
timeContent =" to you as the implementation date of vehicle production is " +value;
}
String documentTitleCn = ""; //文档标题
String documentTitleEn = ""; //文档标题
String newTypeExecutionDate = ""; //新车型实施日期
String newVehicleExecutionDate = ""; //在产车实施日期
if(ObjectUtils.isNotEmpty(e.get("title"))){
documentTitleCn = String.valueOf(e.get("title"));
}
list.add(serialNumber + timeContent);
if(ObjectUtils.isNotEmpty(e.get("title_en"))){
documentTitleEn = String.valueOf(e.get("title_en"));
}
if(ObjectUtils.isNotEmpty(e.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"))){
newTypeExecutionDate = sdf.format(e.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"));
}
if(ObjectUtils.isNotEmpty(e.get("implement_time"))){
newVehicleExecutionDate = sdf.format(e.get("implement_time"));
}
//飞书消息(模板-20230410)
Map<String,Object> params = new HashMap<>();
params.put("contentInfoFeiCn",contentInfoFeiCn);
params.put("contentInfoFeiEn",contentInfoFei);
params.put("userIdList",userIdListNew);
params.put("back_url",encode);
params.put("titleCn", " "+documentTitleCn);
params.put("titleEn"," "+documentTitleEn);
params.put("regulationNo"," "+serialNumber);
params.put("newTypeExecutionDate"," "+newTypeExecutionDate);
params.put("newVehicleExecutionDate"," "+newVehicleExecutionDate);
iFeishuService.sendMessageLawsWarn(TemplateInfoEnum2.LAWS_WARN.getValue(),params);
}
});
iFeishuService.sendCardMsgWarn(thirdIdList.toArray(new String[]{}), feishuMsgVo);
// String contentTemp = sysUser.getUsername() + " has pushed " + StringUtils.join(list, ",") + ", Please be reminded to check it out.";
// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentTemp, MessageTypeEnum.PUSH.getName(), encode);
// iFeishuService.sendCardMsgWarn(thirdIdList.toArray(new String[]{}), feishuMsgVo);
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
bussDocumentLibraryEOService.sendWebsocket(documentIds, documentIds);
@@ -3,6 +3,7 @@ package com.jero.modules.warn.service;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl;
import com.jero.modules.feishu.enums.TemplateInfoEnum2;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.subscribe.entity.OnlCgformSubscribe;
@@ -28,7 +29,9 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -136,19 +139,19 @@ public class TimedTaskWarn implements Job {
// }
if(currentTime.equals(beforeTimeSixTen)){
//发送飞书消息(提前一年)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"1");
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"1",userIdList);
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"1",sdf,href);
}
if(currentTime.equals(beforeTimeSix)){
//发送飞书消息(提前6个月)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"6");
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"6",userIdList);
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"6",sdf,href);
}
if(currentTime.equals(xin1Che1Xing2Shi2Shi1Ri4Qi1Str)){
//发送飞书消息(当天)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"0");
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"0",userIdList);
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"0",sdf,href);
}
@@ -175,19 +178,19 @@ public class TimedTaskWarn implements Job {
}
if(currentTime.equals(beforeTimeSixTen)){
//发送飞书消息(提前一年)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"1");
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"1",userIdList);
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"1",sdf,href);
}
if(currentTime.equals(beforeTimeSix)){
//发送飞书消息(提前6个月)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"6");
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"6",userIdList);
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"6",sdf,href);
}
if(currentTime.equals(implementTimeStr)){
//发送飞书消息(当天)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"0");
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"0",userIdList);
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"0",sdf,href);
}
@@ -199,7 +202,8 @@ public class TimedTaskWarn implements Job {
BussDocumentLibraryEO bussDocumentLibraryEO,
String url,
List<String> thirdIdList,
String flag) {
String flag,
List<String> userIdList) {
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.WARN.getNameCn()+"/"+MessageTypeEnum.WARN.getName());
feishuMsgVo.setUrl(url);
@@ -217,21 +221,41 @@ public class TimedTaskWarn implements Job {
contentCn = "您所订阅的法规已实施.";
contentEn = "The regulation you subscribed to is implemented.";
}
feishuMsgVo.setContent(contentCn);
feishuMsgVo.setContentEn(contentEn);
feishuMsgVo.setRegulationNo(bussDocumentLibraryEO.getSerialNumber());
feishuMsgVo.setDocumentTitleCn(bussDocumentLibraryEO.getTitle());
feishuMsgVo.setDocumentTitleEn(bussDocumentLibraryEO.getTitleEn());
if(ObjectUtils.isNotEmpty(bussDocumentLibraryEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1())){
feishuMsgVo.setNewTypeExecutionDate(sdf.format(bussDocumentLibraryEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1()));
}
if(ObjectUtils.isNotEmpty(bussDocumentLibraryEO.getImplementTime())){
feishuMsgVo.setNewVehicleExecutionDate(sdf.format(bussDocumentLibraryEO.getImplementTime()));
}
// feishuMsgVo.setContent(contentCn);
// feishuMsgVo.setContentEn(contentEn);
// feishuMsgVo.setRegulationNo(bussDocumentLibraryEO.getSerialNumber());
// feishuMsgVo.setDocumentTitleCn(bussDocumentLibraryEO.getTitle());
// feishuMsgVo.setDocumentTitleEn(bussDocumentLibraryEO.getTitleEn());
// if(ObjectUtils.isNotEmpty(bussDocumentLibraryEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1())){
// feishuMsgVo.setNewTypeExecutionDate(sdf.format(bussDocumentLibraryEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1()));
// }
// if(ObjectUtils.isNotEmpty(bussDocumentLibraryEO.getImplementTime())){
// feishuMsgVo.setNewVehicleExecutionDate(sdf.format(bussDocumentLibraryEO.getImplementTime()));
// }
try {
iFeishuService.sendCardMsgWarn(thirdIdList.toArray(new String[]{}),feishuMsgVo);
} catch (IOException e) {
// iFeishuService.sendCardMsgWarn(thirdIdList.toArray(new String[]{}),feishuMsgVo);
//飞书消息(模板-20230410)
Map<String,Object> params = new HashMap<>();
params.put("contentInfoFeiCn",contentCn);
params.put("contentInfoFeiEn",contentEn);
params.put("userIdList",userIdList);
params.put("back_url",url);
params.put("titleCn", " "+ bussDocumentLibraryEO.getTitle());
params.put("titleEn", " "+ bussDocumentLibraryEO.getTitleEn());
params.put("regulationNo", " "+ bussDocumentLibraryEO.getSerialNumber());
if(ObjectUtils.isNotEmpty(bussDocumentLibraryEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1())){
params.put("newTypeExecutionDate", " "+ sdf.format(bussDocumentLibraryEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1()));
}else{
params.put("newTypeExecutionDate","");
}
if(ObjectUtils.isNotEmpty(bussDocumentLibraryEO.getImplementTime())){
params.put("newVehicleExecutionDate", " "+ sdf.format(bussDocumentLibraryEO.getImplementTime()));
}else{
params.put("newVehicleExecutionDate","");
}
iFeishuService.sendMessageLawsWarn(TemplateInfoEnum2.LAWS_WARN.getValue(),params);
} catch (Exception e) {
e.printStackTrace();
}
}