飞书消息--预警(当前,6,12个月)
This commit is contained in:
+5
@@ -77,6 +77,11 @@ public enum TemplateInfoEnum2 {
|
||||
*/
|
||||
TRANSPOND_PUSH("转发推送","","Share / Forward"),
|
||||
|
||||
/**
|
||||
* 法规预警
|
||||
*/
|
||||
LAWS_WARN("法规预警","ctp_AArYGerQrOcE","Regulation Early Warning"),
|
||||
|
||||
|
||||
|
||||
;
|
||||
|
||||
+7
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
+43
@@ -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("飞书消息推送失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+44
-20
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user