Merge remote-tracking branch 'origin/feature_dev_20221025_message' into dev_2nd_period_test

# Conflicts:
#	jero-boot/jero-boot-modules/src/main/java/com/jero/modules/wkflow/feginClient/WorkFlowFeignClient.java
This commit is contained in:
高嵩
2022-10-28 09:52:04 +08:00
8 changed files with 329 additions and 46 deletions
@@ -58,6 +58,15 @@ public interface IFeishuService {
*/
String sendCardMsgTerritory(String[] userIds, FeishuMsgVo feishuMsgVo) throws IOException;
/**
* 预警推送(飞书消息)
* @param userIds
* @param feishuMsgVo
* @return
* @throws IOException
*/
String sendCardMsgWarn(String[] userIds, FeishuMsgVo feishuMsgVo) throws IOException;
/**
* 虚拟清单(飞书消息)
* @param userIds
@@ -453,6 +453,114 @@ public class FeishuServiceImpl implements IFeishuService {
contentSb.append("\"header\": {");
contentSb.append("\"template\": \"green\",");
contentSb.append("\"title\": {");
contentSb.append("\"content\": \" " + feishuMsgVo.getTitle() + " \",");
contentSb.append("\"tag\": \"plain_text\"");
contentSb.append("}");
contentSb.append("}");
contentSb.append("}");
JSONObject jsonObject = JSONObject.parseObject(contentSb.toString());
// 设置请求参数
JSONObject paramsMap = new JSONObject();
paramsMap.put("user_ids", userIds);
paramsMap.put("msg_type", "interactive");
paramsMap.put("card", jsonObject);
// 发送请求给飞书
String response = HttpRequestUtil.getResponseOfPOST(batchSendMessageUrl, headerMap, paramsMap.toJSONString());
// 获取返回结果
JSONObject tokenJson = JSONObject.parseObject(response);
if(!tokenJson.get("code").toString().equals("0")) {
log.error("请求出现异常:" + tokenJson.get("msg") + " " + tokenJson);
}
return tokenJson.get("msg").toString();
}
/**
* 预警推送(飞书消息)
* @param userIds
* @param feishuMsgVo
* @return
* @throws IOException
*/
public String sendCardMsgWarn(String[] userIds, FeishuMsgVo feishuMsgVo) throws IOException {
String token = getTenantAccessToken();
// 设置请求头
Map<String, String> headerMap = new HashMap<>();
headerMap.put("Authorization", "Bearer " + token);
headerMap.put("Content-Type", "application/json; charset=utf-8");
// 示例
StringBuilder contentSb = new StringBuilder();
contentSb.append("{");
contentSb.append("\"elements\": [");
// 内容中文
if (StrUtil.isNotEmpty(feishuMsgVo.getContent())){
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + feishuMsgVo.getContent() + "\"\n,");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
};
// 编号,标题,新车型实施日期,在产车实施日期
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + "编号: " + feishuMsgVo.getRegulationNo() + "\n")
.append("标题: "+feishuMsgVo.getDocumentTitleCn() + "\n")
.append("新车型实施日期: "+feishuMsgVo.getNewTypeExecutionDate()+ "\n")
.append("在产车实施日期: "+feishuMsgVo.getNewVehicleExecutionDate()+ "\",");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
contentSb.append("{\"tag\": \"hr\"},");
//内容英文
if (StrUtil.isNotEmpty(feishuMsgVo.getContentEn())){
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + feishuMsgVo.getContentEn() + "\"\n,");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
};
// 编号,标题,新车型实施日期,在产车实施日期
contentSb.append("{");
contentSb.append("\"tag\": \"div\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"" + "Regulation No: " + feishuMsgVo.getRegulationNo() + "\n")
.append("Title: " + feishuMsgVo.getDocumentTitleEn() + "\n")
.append("New Type Execution Date: " + feishuMsgVo.getNewTypeExecutionDate() + "\n")
.append("New Vehicle Execution Date: " + feishuMsgVo.getNewVehicleExecutionDate() + "\",");
contentSb.append("\"tag\": \"lark_md\"");
contentSb.append("}");
contentSb.append("},");
contentSb.append("{");
contentSb.append("\"actions\": [");
contentSb.append("{");
contentSb.append("\"tag\": \"button\",");
contentSb.append("\"text\": {");
contentSb.append("\"content\": \"view\",");
contentSb.append("\"tag\": \"plain_text\"");
contentSb.append("},");
contentSb.append("\"type\": \"primary\",");
contentSb.append("\"url\": \" "+ feishuMsgVo.getUrl() +" \"");
contentSb.append("}");
contentSb.append("],");
contentSb.append("\"tag\": \"action\"");
contentSb.append("}");
contentSb.append("],");
contentSb.append("\"header\": {");
contentSb.append("\"template\": \"green\",");
contentSb.append("\"title\": {");
@@ -28,13 +28,13 @@ public class FeishuMsgVo {
private String assignee; //评估人 适用范围:责任人提交通知发起人(设计符合性,pre-homo符合性,验证符合性)
private String RegulationNo; //编号
private String documentTitleCn; //文档标题中文
private String documentTitle; //文档标题
private String documentTitleEn; //文档标题英文
private String NewTypeExecutionDate; //新车型实施日期
private String newTypeExecutionDate; //新车型实施日期
private String NewVehicleExecutionDate; //在产车实施日期
private String newVehicleExecutionDate; //在产车实施日期
}
@@ -2,6 +2,7 @@ package com.jero.modules.lawsOpinionGather.job;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.lawsOpinionGather.entity.LawsOpinionGatherEO;
import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum;
import com.jero.modules.lawsOpinionGather.service.ILawsOpinionGatherEOService;
@@ -41,18 +42,45 @@ public class LawsOpinionGatherRemindJob implements Job {
if(CollectionUtils.isNotEmpty(lawsOpinionGatherEOList)){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date currentDate = new Date();
//Date currentDate = new Date();
String now = sdf.format(new Date());
//获取后一天的时间
Calendar calendar=new GregorianCalendar();
calendar.setTime(new Date());
calendar.add(Calendar.DATE,1);
Date nextDay = calendar.getTime();
//Calendar calendar=new GregorianCalendar();
//calendar.setTime(new Date());
//calendar.add(Calendar.DATE,1);
//Date nextDay = calendar.getTime();
String nextDayStr = sdf.format(nextDay);
//String nextDayStr = sdf.format(nextDay);
lawsOpinionGatherEOList.forEach(lawsOpinionGatherEO -> {
if(StringUtils.equals(nextDayStr,sdf.format(lawsOpinionGatherEO.getEndTime()))){
String endTime = sdf.format(lawsOpinionGatherEO.getEndTime());
int days = 0;
try {
days = (int) (sdf.parse(endTime).getTime() - sdf.parse(now).getTime()) / (24 * 60 * 60 * 1000);
} catch (Exception e) {
e.printStackTrace();
throw new JeroBootException("日期转换错误");
}
if (days == 3) {
List<String> userIdList = this.workFlowFeignClient.getLawsOpinionGatherFlowAssigneeList(lawsOpinionGatherEO.getId());
if(CollectionUtils.isNotEmpty(userIdList)){
JSONObject sendJsonObject = new JSONObject();
sendJsonObject.put("msgType", MsgTypeEnum.LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG.getValue());
sendJsonObject.put("lawsOpinionGatherId",lawsOpinionGatherEO.getId());
sendJsonObject.put("userIdList",userIdList);
this.lawsOpinionGatherEOService.workFlowSendMsg(sendJsonObject);
}
} else if (endTime.equals(now)) {
List<String> userIdList = this.workFlowFeignClient.getLawsOpinionGatherFlowAssigneeList(lawsOpinionGatherEO.getId());
if(CollectionUtils.isNotEmpty(userIdList)){
JSONObject sendJsonObject = new JSONObject();
sendJsonObject.put("msgType", MsgTypeEnum.LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_TODAY_MSG.getValue());
sendJsonObject.put("lawsOpinionGatherId",lawsOpinionGatherEO.getId());
sendJsonObject.put("userIdList",userIdList);
this.lawsOpinionGatherEOService.workFlowSendMsg(sendJsonObject);
}
}
/*if(StringUtils.equals(nextDayStr,sdf.format(lawsOpinionGatherEO.getEndTime()))){
List<String> userIdList = this.workFlowFeignClient.getLawsOpinionGatherFlowAssigneeList(lawsOpinionGatherEO.getId());
if(CollectionUtils.isNotEmpty(userIdList)){
JSONObject sendJsonObject = new JSONObject();
@@ -62,7 +90,7 @@ public class LawsOpinionGatherRemindJob implements Job {
sendJsonObject.put("userIdList",userIdList);
this.lawsOpinionGatherEOService.workFlowSendMsg(sendJsonObject);
}
}
}*/
});
}
@@ -5,9 +5,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.jero.common.api.vo.Result;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.constant.enums.MessageType2Enum;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.constant.enums.MsgColorEnum;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.lawsOpinionGather.entity.LawsOpinionGatherEO;
import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum;
@@ -36,6 +40,7 @@ import com.jero.modules.todoCenter.service.IProcessInfoEOService;
import com.jero.modules.wkflow.enums.FlowTypeEnum;
import com.jero.modules.wkflow.feginClient.WorkFlowFeignClient;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.modules.jmreport.common.constant.CommonConstant;
@@ -43,6 +48,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -77,6 +83,8 @@ public class LawsOpinionGatherEOServiceImpl extends ServiceImpl<LawsOpinionGathe
private WorkFlowFeignClient workFlowFeignClient;
@Autowired
private IProcessInfoEOService processInfoEOService;
@Autowired
private IFeishuService feishuService;
/**
* 保存
@@ -196,6 +204,13 @@ public class LawsOpinionGatherEOServiceImpl extends ServiceImpl<LawsOpinionGathe
lawsOpinionGatherEO.setId(jsonObject.getString("id"));
lawsOpinionGatherEO.setGatherResult(jsonObject.getString("gatherResult"));
this.baseMapper.updateById(lawsOpinionGatherEO);
//飞书
JSONObject sendMsgJson = new JSONObject();
sendMsgJson.put("lawsOpinionGatherId",jsonObject.getString("id"));
sendMsgJson.put("initiatorUserId",jsonObject.getString("initiatorUserId"));
sendMsgJson.put("msgType", MsgTypeEnum.LAWS_OPOMOPM_GATHER_COMPLETE_MSG.getValue());
workFlowSendMsg(sendMsgJson);
}
// 发送消息
@@ -273,51 +288,143 @@ public class LawsOpinionGatherEOServiceImpl extends ServiceImpl<LawsOpinionGathe
}
String lawsOpinionGatherId = jsonObject.getString("lawsOpinionGatherId");
String serialNumber = jsonObject.getString("serialNumber"); //文档库编号
//String serialNumber = jsonObject.getString("serialNumber"); //文档库编号
List<String> userIdList = new ArrayList<>();
String msgContentEN = "";
String msgTitle = "";
//String msgContentEN = "";
//String msgTitle = "";
LawsOpinionGatherEO lawsOpinionGatherEO = queryById(lawsOpinionGatherId);
Map<String, String> lawsOpinionGatherPrcInfo = this.workFlowFeignClient.getLawsOpinionGatherPrcInfo(lawsOpinionGatherId);
String initiator = "";
String title = MessageType2Enum.REGULATION_OPINION_COLLECTION.getCn() + "/" + MessageType2Enum.REGULATION_OPINION_COLLECTION.getEn();
String endTime = new SimpleDateFormat("yyyy-MM-dd").format(lawsOpinionGatherEO.getEndTime());//截止日期
String prcNum = lawsOpinionGatherPrcInfo.get("prcNum");
String prcName = lawsOpinionGatherPrcInfo.get("prcName");
String cnContentUpper = "";
String cnContentLower = "";
String enContentUpper = "";
String enContentLower = "";
if(StringUtils.equals(msgType,MsgTypeEnum.LAWS_OPOMOPM_GATHER_START_MSG.getValue())){
userIdList.addAll(Arrays.asList(jsonObject.getString("evaluatorIds").split(",")));
String endTime = jsonObject.getString("endTime"); //截止日期
msgContentEN = "You recieved the Collection of Legislative Comments of "+serialNumber+" . The due date is "+endTime+". Please check and address it in a timely manner.";
msgTitle = "You have a Collection of Legislative Comments task to complete";
//msgContentEN = "You recieved the Collection of Legislative Comments of "+serialNumber+" . The due date is "+endTime+". Please check and address it in a timely manner.";
//msgTitle = "You have a Collection of Legislative Comments task to complete";
String currentUserId = jsonObject.getString("currentUserId"); //当前操作用户id
SysUser currentUser = sysUserService.getBaseMapper().selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, currentUserId));
initiator = currentUser.getUsername();
cnContentUpper = "您好,请及时查看处理此项任务,谢谢!";
cnContentLower = "编号: " + prcNum +
"\n标题: " + prcName +
"\n发起人: " + initiator +
"\n截止时间: " + endTime;
enContentUpper = "Hello! Please check and address the task in a timely manner. Thank you!";
enContentLower = "Regulation No: " + prcNum +
"\nTitle: " + prcName +
"\nInitiator: " + initiator +
"\nDue Date: " + endTime;
}else if(StringUtils.equals(msgType,MsgTypeEnum.LAWS_OPOMOPM_GATHER_ENALUATOR_SUBMIT_MSG.getValue())){
String currentUserId = jsonObject.getString("currentUserId"); //当前操作用户id
SysUser currentUser = sysUserService.getBaseMapper().selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, currentUserId));
userIdList.add(jsonObject.getString("initiatorUserId"));
msgContentEN = currentUser.getUsername() + " has submitted the collection process of Collection of Legislative Comments of "+serialNumber+", please check it in time.";
msgTitle = "You have a Collection of Legislative Comments task completed";
//msgContentEN = currentUser.getUsername() + " has submitted the collection process of Collection of Legislative Comments of "+serialNumber+", please check it in time.";
//msgTitle = "You have a Collection of Legislative Comments task completed";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
}else if(StringUtils.equals(msgType, MsgTypeEnum.LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_MSG.getValue())){
cnContentUpper = "您好,"+ currentUser.getUsername() +"已提交反馈意见,请查看";
cnContentLower = "编号: " + prcNum +
"\n标题: " + prcName +
"\n发起人: " + initiator +
"\n截止时间: " + endTime;
enContentUpper = "Hello! "+ currentUser.getUsername() +" has submitted the comments. Please check it";
enContentLower = "Regulation No: " + lawsOpinionGatherPrcInfo.get("prcNum") +
"\nTitle: " + lawsOpinionGatherPrcInfo.get("prcName") +
"\nInitiator: " + initiator +
"\nDue Date: " + endTime;
} else if (StringUtils.equals(msgType, MsgTypeEnum.LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG.getValue())) {
userIdList = (List<String>) jsonObject.get("userIdList");
msgContentEN = "The the Collection of Legislative Comments of "+serialNumber+" will expire tomorrow . Please check and address it in time.";
msgTitle = "You have a Collection of Legislative Comments task to complete";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
cnContentUpper = "您好,该任务将于3天后到期,请及时查看处理,谢谢!";
cnContentLower = "编号: " + prcNum +
"\n标题: " + prcName +
"\n发起人: " + initiator +
"\n截止时间: " + endTime;
enContentUpper = "Hello! This task will expire in 3 days. Please check and address the task in a timely manner. Thank you!";
enContentLower = "Regulation No: " + lawsOpinionGatherPrcInfo.get("prcNum") +
"\nTitle: " + lawsOpinionGatherPrcInfo.get("prcName") +
"\nInitiator: " + initiator +
"\nDue Date: " + endTime;
} else if (StringUtils.equals(msgType, MsgTypeEnum.LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_TODAY_MSG.getValue())){
userIdList = (List<String>) jsonObject.get("userIdList");
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
cnContentUpper = "您好,该任务将于今天到期,请尽快查看处理,谢谢!";
cnContentLower = "编号: " + prcNum +
"\n标题: " + prcName +
"\n发起人: " + initiator;
enContentUpper = "Hello! This task will expire today. Please check and address the task ASAP. Thank you!";
enContentLower = "Regulation No: " + lawsOpinionGatherPrcInfo.get("prcNum") +
"\nTitle: " + lawsOpinionGatherPrcInfo.get("prcName") +
"\nInitiator: " + initiator;
} else if (StringUtils.equals(msgType, MsgTypeEnum.LAWS_OPOMOPM_GATHER_COMPLETE_MSG.getValue())) {
userIdList.add((String) jsonObject.get("initiatorUserId"));
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
cnContentUpper = "您好,该任务已完成,请查看";
cnContentLower = "编号: " + prcNum +
"\n标题: " + prcName +
"\n发起人: " + initiator;
enContentUpper = "Hello! The task is completed. Please check it.";
enContentLower = "Regulation No: " + lawsOpinionGatherPrcInfo.get("prcNum") +
"\nTitle: " + lawsOpinionGatherPrcInfo.get("prcName") +
"\nInitiator: " + initiator;
}
/*else if(StringUtils.equals(msgType, MsgTypeEnum.LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_MSG.getValue())){
userIdList = (List<String>) jsonObject.get("userIdList");
//msgContentEN = "The the Collection of Legislative Comments of "+serialNumber+" will expire tomorrow . Please check and address it in time.";
//msgTitle = "You have a Collection of Legislative Comments task to complete";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
}
}*/
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(userIdList);
if (ObjectUtils.isNotEmpty(sysUsers)) {
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//飞书跳转链接
String hrefFeishu = backUrl + JumpLinkEnum.TASK_AFFIRM_LINK.getLink();
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(title);
feishuMsgVo.setCnContentUpper(cnContentUpper);
feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper(enContentUpper);
feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
//系统内部跳转链接
String href = "<a href='" + JumpLinkEnum.TASK_AFFIRM_LINK.getLink() + "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
//String href = "<a href='" + JumpLinkEnum.TASK_AFFIRM_LINK.getLink() + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
SendMessageUtils.sendMessage(msgTitle,msgContentEN,userIdList,lawsOpinionGatherId,sendMessageMap,null,MessageTypeEnum.COLLECTION_OF_LEGISLATIVE_COMMENTS,initiator);
//SendMessageUtils.sendMessage(msgTitle,msgContentEN,userIdList,lawsOpinionGatherId,sendMessageMap,null,MessageTypeEnum.COLLECTION_OF_LEGISLATIVE_COMMENTS,initiator);
}
@Override
@@ -34,6 +34,10 @@ public enum MsgTypeEnum {
LAWS_OPOMOPM_GATHER_START_MSG("法规意见收集发起消息","lawsOpomopmGatherStartMsg"),
LAWS_OPOMOPM_GATHER_ENALUATOR_SUBMIT_MSG("法规意见收集评估人提交任务消息","lawsOpomopmGatherEnaluatorSubmitMsg"),
LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_MSG("法规意见收集到期前一天消息","lawsOpomopmGatherExpireRemindMsg"),
LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG("法规意见收集到期前三天消息","lawsOpomopmGatherExpireRemindThreeDaysBeforeMsg"),
LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_TODAY_MSG("法规意见收集到期当天消息","lawsOpomopmGatherExpireRemindTodayMsg"),
LAWS_OPOMOPM_GATHER_COMPLETE_MSG("法规意见收集任务完成通知消息","lawsOpomopmGatherCompleteMsg"),
LAWS_TECHNOLOGY_EVALUATION_START_MSG("法规技术评估发起消息","lawsTechnologyEvaluationStartMsg"),
LAWS_TECHNOLOGY_EVALUATION_ENALUATOR_SUBMIT_MSG("法规技术评估,评估人提交任务消息","lawsTechnologyEvaluationEnaluatorSubmitMsg"),
@@ -426,12 +426,17 @@ public class LawsWarnService {
bussDocumentLibraryEOService.sendWebsocket(StringUtils.join(thirdIdList, ","), contentInfo);
//飞书
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (String s : urlList) {
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
String encode = UriEncoder.encode(s);
List<String> list = new ArrayList<>();
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);
String timeContent = "";
if("1".equals(flag)){
String value = StringUtils.valueOf(e.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"));
@@ -453,24 +458,11 @@ public class LawsWarnService {
list.add(serialNumber + timeContent);
}
});
String contentTemp = sysUser.getUsername() + " has pushed " + StringUtils.join(list, ",") + ", Please be reminded to check it out.";
iFeishuService.sendCardMsgWarn(thirdIdList.toArray(new String[]{}), feishuMsgVo);
//XXX向您分享了法规预警信息。
//XXX shared Regulation Early Warning infomation with you.
String contentInfoFei = sysUser.getUsername() +" shared Regulation Early Warning infomation with you..";
String contentInfoFeiCn = sysUser.getUsername() +"向您分享了法规预警信息";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
feishuMsgVo.setUrl(encode);
feishuMsgVo.setContentEn(contentInfoFei);
feishuMsgVo.setContent(contentInfoFeiCn);
// feishuMsgVo.setRegulationNo();
// feishuMsgVo.setDocumentTitle();
// feishuMsgVo.setNewTypeExecutionDate();
// feishuMsgVo.setNewVehicleExecutionDate();
// 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.batchSendMessage(thirdIdList.toArray(new String[]{}), contentTemp, MessageTypeEnum.PUSH.getName(), encode);
}
} catch (IOException e) {
e.printStackTrace();
@@ -478,6 +470,38 @@ public class LawsWarnService {
bussDocumentLibraryEOService.sendWebsocket(documentIds, contentInfo);
return "推送成功";
}
private void setFeishuMsgVo(LoginUser sysUser, SimpleDateFormat sdf, FeishuMsgVo feishuMsgVo, String encode, Map<String, Object> e, String serialNumber) {
String documentTitleCn = ""; //文档标题
String documentTitleEn = ""; //文档标题
String newTypeExecutionDate = ""; //新车型实施日期
String newVehicleExecutionDate = ""; //在产车实施日期
if(ObjectUtils.isNotEmpty(e.get("title"))){
documentTitleCn = String.valueOf(e.get("title"));
}
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"));
}
String contentInfoFei = sysUser.getUsername() +" shared Regulation Early Warning infomation with you.";
String contentInfoFeiCn = sysUser.getUsername() +"向您分享了法规预警信息.";
feishuMsgVo.setTitle(MessageTypeEnum.WARN.getNameCn()+"/"+MessageTypeEnum.WARN.getName());
feishuMsgVo.setUrl(encode);
feishuMsgVo.setContentEn(contentInfoFei);
feishuMsgVo.setContent(contentInfoFeiCn);
feishuMsgVo.setRegulationNo(serialNumber);
feishuMsgVo.setNewTypeExecutionDate(newTypeExecutionDate);
feishuMsgVo.setNewVehicleExecutionDate(newVehicleExecutionDate);
feishuMsgVo.setDocumentTitleCn(documentTitleCn);
feishuMsgVo.setDocumentTitleEn(documentTitleEn);
}
// public String warnPullMessage(String departIds, String userIds, String documentIds,String flag) {
// Set<String> allDepartIds = new HashSet<>();
// //查询当前部门下所有部门
@@ -182,6 +182,9 @@ public interface WorkFlowFeignClient {
@RequestMapping(value = "/bat-wkflow/deleteProcessInstanceByPrcIds",method = RequestMethod.GET)
Result<String> deleteProcessInstanceByPrcIds(@RequestParam("prcIds") String prcIds);
@RequestMapping(value = "/bat-wkflow/task/getLawsOpinionGatherPrcInfo",method = RequestMethod.GET)
Map<String,String> getLawsOpinionGatherPrcInfo(@RequestParam("lawsOpinionGatherId") String lawsOpinionGatherId);
/**
* 根据流程类型,查询未完成的流程信息
* @param prcType