飞书消息-法规技术评估

This commit is contained in:
zhn
2023-04-12 11:12:57 +08:00
parent a375c4da3d
commit 28d09986e4
4 changed files with 309 additions and 240 deletions
@@ -87,6 +87,11 @@ public enum TemplateInfoEnum2 {
*/ */
REGULATION_OPINION_COLLECTION("法规意见收集","ctp_AArfYGLozU47","Regulation Opinion Collection"), REGULATION_OPINION_COLLECTION("法规意见收集","ctp_AArfYGLozU47","Regulation Opinion Collection"),
/**
* 法规技术评估
*/
REGULATION_TECHNICAL_ASSESSMENT("法规技术评估","ctp_AArfYGLozU47","Regulation Technical Assessment"),
; ;
@@ -146,7 +146,7 @@ public interface IFeishuService {
void sendMessageLawsWarn(String templeteId,Map<String,Object> params); void sendMessageLawsWarn(String templeteId,Map<String,Object> params);
/** /**
* 飞书消息模板--法规意见收集 * 飞书消息模板--法规意见收集和法规技术评估
* @param templeteId * @param templeteId
* @param params * @param params
*/ */
@@ -1,147 +1,147 @@
package com.jero.modules.lawsTechnologyEvaluation.job; package com.jero.modules.lawsTechnologyEvaluation.job;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.exception.JeroBootException; import com.jero.common.exception.JeroBootException;
import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum; import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationEO; import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationEO;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationFlowDetailEO; import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationFlowDetailEO;
import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationEOService; import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationEOService;
import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationFlowDetailEOService; import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationFlowDetailEOService;
import com.jero.modules.project.enums.MsgTypeEnum; import com.jero.modules.project.enums.MsgTypeEnum;
import com.jero.modules.wkflow.feginClient.WorkFlowFeignClient; import com.jero.modules.wkflow.feginClient.WorkFlowFeignClient;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException; import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* 法规技术评估 - 定时器 * 法规技术评估 - 定时器
* 作用:数据还有一天过期时,给代办人发消息 * 作用:数据还有一天过期时,给代办人发消息
*/ */
@Slf4j @Slf4j
public class LawsTechnologyEvaluationRemindJob implements Job { public class LawsTechnologyEvaluationRemindJob implements Job {
@Autowired @Autowired
private WorkFlowFeignClient workFlowFeignClient; private WorkFlowFeignClient workFlowFeignClient;
@Autowired @Autowired
private ILawsTechnologyEvaluationEOService lawsTechnologyEvaluationEOService; private ILawsTechnologyEvaluationEOService lawsTechnologyEvaluationEOService;
@Autowired @Autowired
private ILawsTechnologyEvaluationFlowDetailEOService lawsTechnologyEvaluationFlowDetail; private ILawsTechnologyEvaluationFlowDetailEOService lawsTechnologyEvaluationFlowDetail;
@Override @Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
QueryWrapper<LawsTechnologyEvaluationEO> queryWrapper = new QueryWrapper<>(); QueryWrapper<LawsTechnologyEvaluationEO> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(LawsTechnologyEvaluationEO::getFlowStatus, GatherResultEnum.UNDERWAY.getValue()); queryWrapper.lambda().eq(LawsTechnologyEvaluationEO::getFlowStatus, GatherResultEnum.UNDERWAY.getValue());
List<LawsTechnologyEvaluationEO> LawsTechnologyEvaluationEOList = this.lawsTechnologyEvaluationEOService.list(queryWrapper); List<LawsTechnologyEvaluationEO> LawsTechnologyEvaluationEOList = this.lawsTechnologyEvaluationEOService.list(queryWrapper);
if(CollectionUtils.isNotEmpty(LawsTechnologyEvaluationEOList)){ if(CollectionUtils.isNotEmpty(LawsTechnologyEvaluationEOList)){
List<String> LawsTechnologyEvaluationIdList = LawsTechnologyEvaluationEOList.stream().map(LawsTechnologyEvaluationEO::getId).distinct().collect(Collectors.toList()); List<String> LawsTechnologyEvaluationIdList = LawsTechnologyEvaluationEOList.stream().map(LawsTechnologyEvaluationEO::getId).distinct().collect(Collectors.toList());
QueryWrapper<LawsTechnologyEvaluationFlowDetailEO> detailQueryWrapper = new QueryWrapper<>(); QueryWrapper<LawsTechnologyEvaluationFlowDetailEO> detailQueryWrapper = new QueryWrapper<>();
detailQueryWrapper.lambda().in(LawsTechnologyEvaluationFlowDetailEO::getLawsTechnologyEvaluationId,LawsTechnologyEvaluationIdList); detailQueryWrapper.lambda().in(LawsTechnologyEvaluationFlowDetailEO::getLawsTechnologyEvaluationId,LawsTechnologyEvaluationIdList);
List<LawsTechnologyEvaluationFlowDetailEO> flowDetailList = this.lawsTechnologyEvaluationFlowDetail.list(detailQueryWrapper); List<LawsTechnologyEvaluationFlowDetailEO> flowDetailList = this.lawsTechnologyEvaluationFlowDetail.list(detailQueryWrapper);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//获取后一天的时间 //获取后一天的时间
//Calendar calendar=new GregorianCalendar(); //Calendar calendar=new GregorianCalendar();
//calendar.setTime(new Date()); //calendar.setTime(new Date());
//calendar.add(Calendar.DATE,1); //calendar.add(Calendar.DATE,1);
//Date nextDay = calendar.getTime(); //Date nextDay = calendar.getTime();
//String nextDayStr = sdf.format(nextDay); //String nextDayStr = sdf.format(nextDay);
String now = sdf.format(new Date()); String now = sdf.format(new Date());
LawsTechnologyEvaluationEOList.forEach(lawsTechnologyEvaluationEO -> { LawsTechnologyEvaluationEOList.forEach(lawsTechnologyEvaluationEO -> {
/*if(StringUtils.equals(nextDayStr,sdf.format(lawsTechnologyEvaluationEO.getEndTime()))){ /*if(StringUtils.equals(nextDayStr,sdf.format(lawsTechnologyEvaluationEO.getEndTime()))){
String actiProcInstIds = flowDetailList.stream().filter(flowDetail -> { String actiProcInstIds = flowDetailList.stream().filter(flowDetail -> {
boolean flag = false; boolean flag = false;
if (StringUtils.equals(lawsTechnologyEvaluationEO.getId(), flowDetail.getLawsTechnologyEvaluationId())) { if (StringUtils.equals(lawsTechnologyEvaluationEO.getId(), flowDetail.getLawsTechnologyEvaluationId())) {
flag = true; flag = true;
} }
return flag; return flag;
}).map(LawsTechnologyEvaluationFlowDetailEO::getActiProcInstId).distinct().collect(Collectors.joining(",")); }).map(LawsTechnologyEvaluationFlowDetailEO::getActiProcInstId).distinct().collect(Collectors.joining(","));
if(StringUtils.isNotEmpty(actiProcInstIds)){ if(StringUtils.isNotEmpty(actiProcInstIds)){
List<String> userIdList = this.workFlowFeignClient.getTaskAssigneeListByPrcIds(actiProcInstIds); List<String> userIdList = this.workFlowFeignClient.getTaskAssigneeListByPrcIds(actiProcInstIds);
if(CollectionUtils.isNotEmpty(userIdList)){ if(CollectionUtils.isNotEmpty(userIdList)){
JSONObject sendJsonObject = new JSONObject(); JSONObject sendJsonObject = new JSONObject();
sendJsonObject.put("msgType", MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_MSG.getValue()); sendJsonObject.put("msgType", MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_MSG.getValue());
sendJsonObject.put("lawsTechnologyEvaluationId",lawsTechnologyEvaluationEO.getId()); sendJsonObject.put("lawsTechnologyEvaluationId",lawsTechnologyEvaluationEO.getId());
sendJsonObject.put("serialNumber",lawsTechnologyEvaluationEO.getSerialNumber()); sendJsonObject.put("serialNumber",lawsTechnologyEvaluationEO.getSerialNumber());
sendJsonObject.put("userIdList",userIdList); sendJsonObject.put("userIdList",userIdList);
this.lawsTechnologyEvaluationEOService.workFlowSendMsg(sendJsonObject); this.lawsTechnologyEvaluationEOService.workFlowSendMsg(sendJsonObject);
} }
} }
}*/ }*/
String endTime = sdf.format(lawsTechnologyEvaluationEO.getEndTime()); String endTime = sdf.format(lawsTechnologyEvaluationEO.getEndTime());
int days = 0; long days = 0;
try { try {
days = (int) (sdf.parse(endTime).getTime() - sdf.parse(now).getTime()) / (24 * 60 * 60 * 1000); days = (sdf.parse(endTime).getTime() - sdf.parse(now).getTime()) / (24 * 60 * 60 * 1000L);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new JeroBootException("日期转换错误"); throw new JeroBootException("日期转换错误");
} }
if (days == 3) { if (days == 3) {
//到期前3天 //到期前3天
String actiProcInstIds = flowDetailList.stream().filter(flowDetail -> { String actiProcInstIds = flowDetailList.stream().filter(flowDetail -> {
boolean flag = false; boolean flag = false;
if (StringUtils.equals(lawsTechnologyEvaluationEO.getId(), flowDetail.getLawsTechnologyEvaluationId())) { if (StringUtils.equals(lawsTechnologyEvaluationEO.getId(), flowDetail.getLawsTechnologyEvaluationId())) {
flag = true; flag = true;
} }
return flag; return flag;
}).map(LawsTechnologyEvaluationFlowDetailEO::getActiProcInstId).distinct().collect(Collectors.joining(",")); }).map(LawsTechnologyEvaluationFlowDetailEO::getActiProcInstId).distinct().collect(Collectors.joining(","));
if(StringUtils.isNotEmpty(actiProcInstIds)){ if(StringUtils.isNotEmpty(actiProcInstIds)){
//List<String> userIdList = this.workFlowFeignClient.getTaskAssigneeListByPrcIds(actiProcInstIds); //List<String> userIdList = this.workFlowFeignClient.getTaskAssigneeListByPrcIds(actiProcInstIds);
for (String actiProcInstId : actiProcInstIds.split(",")) { for (String actiProcInstId : actiProcInstIds.split(",")) {
Map<String, String> map = this.workFlowFeignClient.getTaskInfo(actiProcInstId); Map<String, String> map = this.workFlowFeignClient.getTaskInfo(actiProcInstId);
if (!map.isEmpty()) { if (!map.isEmpty()) {
JSONObject sendJsonObject = new JSONObject(); JSONObject sendJsonObject = new JSONObject();
sendJsonObject.put("msgType", MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG.getValue()); sendJsonObject.put("msgType", MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG.getValue());
sendJsonObject.put("lawsTechnologyEvaluationId",lawsTechnologyEvaluationEO.getId()); sendJsonObject.put("lawsTechnologyEvaluationId",lawsTechnologyEvaluationEO.getId());
sendJsonObject.put("userId",map.get("userId")); sendJsonObject.put("userId",map.get("userId"));
sendJsonObject.put("taskId",map.get("taskId")); sendJsonObject.put("taskId",map.get("taskId"));
sendJsonObject.put("taskDefKey",map.get("taskDefKey")); sendJsonObject.put("taskDefKey",map.get("taskDefKey"));
this.lawsTechnologyEvaluationEOService.workFlowSendMsg(sendJsonObject); this.lawsTechnologyEvaluationEOService.workFlowSendMsg(sendJsonObject);
} }
} }
} }
} else if (endTime.equals(now)){ } else if (endTime.equals(now)){
//当天 //当天
String actiProcInstIds = flowDetailList.stream().filter(flowDetail -> { String actiProcInstIds = flowDetailList.stream().filter(flowDetail -> {
boolean flag = false; boolean flag = false;
if (StringUtils.equals(lawsTechnologyEvaluationEO.getId(), flowDetail.getLawsTechnologyEvaluationId())) { if (StringUtils.equals(lawsTechnologyEvaluationEO.getId(), flowDetail.getLawsTechnologyEvaluationId())) {
flag = true; flag = true;
} }
return flag; return flag;
}).map(LawsTechnologyEvaluationFlowDetailEO::getActiProcInstId).distinct().collect(Collectors.joining(",")); }).map(LawsTechnologyEvaluationFlowDetailEO::getActiProcInstId).distinct().collect(Collectors.joining(","));
if(StringUtils.isNotEmpty(actiProcInstIds)){ if(StringUtils.isNotEmpty(actiProcInstIds)){
//List<String> userIdList = this.workFlowFeignClient.getTaskAssigneeListByPrcIds(actiProcInstIds); //List<String> userIdList = this.workFlowFeignClient.getTaskAssigneeListByPrcIds(actiProcInstIds);
for (String actiProcInstId : actiProcInstIds.split(",")) { for (String actiProcInstId : actiProcInstIds.split(",")) {
Map<String, String> map = this.workFlowFeignClient.getTaskInfo(actiProcInstId); Map<String, String> map = this.workFlowFeignClient.getTaskInfo(actiProcInstId);
if (!map.isEmpty()) { if (!map.isEmpty()) {
JSONObject sendJsonObject = new JSONObject(); JSONObject sendJsonObject = new JSONObject();
sendJsonObject.put("msgType", MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_TODAY_MSG.getValue()); sendJsonObject.put("msgType", MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_TODAY_MSG.getValue());
sendJsonObject.put("lawsTechnologyEvaluationId",lawsTechnologyEvaluationEO.getId()); sendJsonObject.put("lawsTechnologyEvaluationId",lawsTechnologyEvaluationEO.getId());
sendJsonObject.put("userId",map.get("userId")); sendJsonObject.put("userId",map.get("userId"));
sendJsonObject.put("taskId",map.get("taskId")); sendJsonObject.put("taskId",map.get("taskId"));
sendJsonObject.put("taskDefKey",map.get("taskDefKey")); sendJsonObject.put("taskDefKey",map.get("taskDefKey"));
this.lawsTechnologyEvaluationEOService.workFlowSendMsg(sendJsonObject); this.lawsTechnologyEvaluationEOService.workFlowSendMsg(sendJsonObject);
} }
} }
} }
} }
}); });
} }
} }
} }
@@ -16,6 +16,7 @@ import com.jero.modules.document.enums.FieldTypeEnum;
import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper; import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper;
import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl; import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl;
import com.jero.modules.enums.DictCodeEnum; import com.jero.modules.enums.DictCodeEnum;
import com.jero.modules.feishu.enums.TemplateInfoEnum2;
import com.jero.modules.feishu.service.IFeishuService; import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo; import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum; import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum;
@@ -652,6 +653,7 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
//String msgContentEN = ""; //String msgContentEN = "";
//String msgTitle = ""; //String msgTitle = "";
String initiator = ""; String initiator = "";
String initiatorEn = "";
String lawsTechnologyEvaluationId = jsonObject.getString("lawsTechnologyEvaluationId"); String lawsTechnologyEvaluationId = jsonObject.getString("lawsTechnologyEvaluationId");
LawsTechnologyEvaluationEO lawsTechnologyEvaluationEO = queryById(lawsTechnologyEvaluationId); LawsTechnologyEvaluationEO lawsTechnologyEvaluationEO = queryById(lawsTechnologyEvaluationId);
@@ -678,15 +680,15 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
initiator = currentUser.getUsername(); initiator = currentUser.getUsername();
cnContentUpper = "您好,请及时查看处理此项任务,谢谢!"; cnContentUpper = "您好,请及时查看处理此项任务,谢谢!";
cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() + // cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\n标题: " + lawsTechnologyEvaluationEO.getTitle() + // "\n标题: " + lawsTechnologyEvaluationEO.getTitle() +
"\n发起人: " + initiator + // "\n发起人: " + initiator +
"\n截止时间: " + endTime; // "\n截止时间: " + endTime;
enContentUpper = "Hello! Please check and address the task in a timely manner. Thank you!"; enContentUpper = "Hello! Please check and address the task in a timely manner. Thank you!";
enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() + // enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() + // "\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + initiator + // "\nInitiator: " + initiator +
"\nDue Date: " + endTime; // "\nDue Date: " + endTime;
LawsTechnologyEvaluationFlowDetailEO flowDetailEO = flowDetailEOMapper.queryByEvaluationId(lawsTechnologyEvaluationId,jsonObject.getString("evaluators")); LawsTechnologyEvaluationFlowDetailEO flowDetailEO = flowDetailEOMapper.queryByEvaluationId(lawsTechnologyEvaluationId,jsonObject.getString("evaluators"));
if (ObjectUtils.isNotEmpty(flowDetailEO)) { if (ObjectUtils.isNotEmpty(flowDetailEO)) {
@@ -696,18 +698,24 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
SysUser sysUser = sysUserService.getById(jsonObject.getString("evaluators")); SysUser sysUser = sysUserService.getById(jsonObject.getString("evaluators"));
if (ObjectUtils.isNotEmpty(sysUser)) { if (ObjectUtils.isNotEmpty(sysUser)) {
thirdId[0] = sysUser.getThirdId(); thirdId[0] = sysUser.getThirdId();
userIdList.add(sysUser.getId());
} }
try { try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); // FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(title); // feishuMsgVo.setTitle(title);
feishuMsgVo.setCnContentUpper(cnContentUpper); // feishuMsgVo.setCnContentUpper(cnContentUpper);
feishuMsgVo.setCnContentLower(cnContentLower); // feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper(enContentUpper); // feishuMsgVo.setEnContentUpper(enContentUpper);
feishuMsgVo.setEnContentLower(enContentLower); // feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu); // feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色 // feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdId, feishuMsgVo); // feishuService.sendCard(thirdId, feishuMsgVo);
} catch (IOException e) {
//飞书消息(模板-20230410
sendMsgFeiShu(msgType, userIdList, hrefFeishu, initiator,
initiatorEn, lawsTechnologyEvaluationEO, endTime,
bussDocumentLibraryEO, cnContentUpper, enContentUpper);
} catch (Exception e) {
log.error("飞书消息推送失败"); log.error("飞书消息推送失败");
} }
} }
@@ -724,16 +732,16 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
//msgTitle = "You have a Regulatory and technical assessment task to complete"; //msgTitle = "You have a Regulatory and technical assessment task to complete";
initiator = currentUser.getUsername(); initiator = currentUser.getUsername();
cnContentUpper = "您好,"+ initiator +"已提交评估结果,请审核"; cnContentUpper = "您好,"+ initiator +"已提交评估结果,请审核";
cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() + cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\n标题: " + lawsTechnologyEvaluationEO.getTitle() + "\n标题: " + lawsTechnologyEvaluationEO.getTitle() +
"\n发起人: " + initiator + "\n发起人: " + initiator +
"\n截止时间: " + endTime; "\n截止时间: " + endTime;
enContentUpper = "Hello! "+ initiator +" has submitted the assessment result. Please review it"; enContentUpper = "Hello! "+ initiator +" has submitted the assessment result. Please review it.";
enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() + // enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() + // "\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + initiator + // "\nInitiator: " + initiator +
"\nDue Date: " + endTime; // "\nDue Date: " + endTime;
LawsTechnologyEvaluationFlowDetailEO flowDetailEO = flowDetailEOMapper.queryByEvaluationId(lawsTechnologyEvaluationId,jsonObject.getString("evaluators")); LawsTechnologyEvaluationFlowDetailEO flowDetailEO = flowDetailEOMapper.queryByEvaluationId(lawsTechnologyEvaluationId,jsonObject.getString("evaluators"));
if (ObjectUtils.isNotEmpty(flowDetailEO)) { if (ObjectUtils.isNotEmpty(flowDetailEO)) {
@@ -743,18 +751,23 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
SysUser sysUser = sysUserService.getById(jsonObject.getString("evaluators")); SysUser sysUser = sysUserService.getById(jsonObject.getString("evaluators"));
if (ObjectUtils.isNotEmpty(sysUser)) { if (ObjectUtils.isNotEmpty(sysUser)) {
thirdId[0] = sysUser.getThirdId(); thirdId[0] = sysUser.getThirdId();
userIdList.add(sysUser.getId());
} }
try { try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); // FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(title); // feishuMsgVo.setTitle(title);
feishuMsgVo.setCnContentUpper(cnContentUpper); // feishuMsgVo.setCnContentUpper(cnContentUpper);
feishuMsgVo.setCnContentLower(cnContentLower); // feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper(enContentUpper); // feishuMsgVo.setEnContentUpper(enContentUpper);
feishuMsgVo.setEnContentLower(enContentLower); // feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu); // feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色 // feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdId, feishuMsgVo); // feishuService.sendCard(thirdId, feishuMsgVo);
} catch (IOException e) { //飞书消息(模板-20230410
sendMsgFeiShu(msgType, userIdList, hrefFeishu, initiator,
initiatorEn, lawsTechnologyEvaluationEO, endTime,
bussDocumentLibraryEO, cnContentUpper, enContentUpper);
} catch (Exception e) {
log.error("飞书消息推送失败"); log.error("飞书消息推送失败");
} }
} }
@@ -770,16 +783,16 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
String currentUserId = jsonObject.getString("currentUserId"); //当前操作用户id String currentUserId = jsonObject.getString("currentUserId"); //当前操作用户id
SysUser currentUser = this.sysUserService.getBaseMapper().selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, currentUserId)); SysUser currentUser = this.sysUserService.getBaseMapper().selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, currentUserId));
initiator = currentUser.getUsername(); initiator = currentUser.getUsername();
cnContentUpper = "您好,您提交的评估结果已通过"; cnContentUpper = "您好,您提交的评估结果已通过";
cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() + cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\n标题: " + lawsTechnologyEvaluationEO.getTitle() + "\n标题: " + lawsTechnologyEvaluationEO.getTitle() +
"\n发起人: " + initiator + "\n发起人: " + initiator +
"\n截止时间: " + endTime; "\n截止时间: " + endTime;
enContentUpper = "Hello! The assessment result you submitted has passed"; enContentUpper = "Hello! The assessment result you submitted has passed.";
enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() + // enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() + // "\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + initiator + // "\nInitiator: " + initiator +
"\nDue Date: " + endTime; // "\nDue Date: " + endTime;
LawsTechnologyEvaluationFlowDetailEO flowDetailEO = flowDetailEOMapper.queryByEvaluationId(lawsTechnologyEvaluationId,jsonObject.getString("evaluationId")); LawsTechnologyEvaluationFlowDetailEO flowDetailEO = flowDetailEOMapper.queryByEvaluationId(lawsTechnologyEvaluationId,jsonObject.getString("evaluationId"));
if (ObjectUtils.isNotEmpty(flowDetailEO)) { if (ObjectUtils.isNotEmpty(flowDetailEO)) {
hrefFeishu = backUrl + "/evaluationProcess?taskDefinitionKey=fqrsc&taskIds="+ taskId +"&prcType=6&prcNum="+ flowDetailEO.getPrcNum() +"&prcId="+ flowDetailEO.getActiProcInstId() +"&router=%2FregulatoryAssessmentTasks&isDisabled=true"; hrefFeishu = backUrl + "/evaluationProcess?taskDefinitionKey=fqrsc&taskIds="+ taskId +"&prcType=6&prcNum="+ flowDetailEO.getPrcNum() +"&prcId="+ flowDetailEO.getActiProcInstId() +"&router=%2FregulatoryAssessmentTasks&isDisabled=true";
@@ -788,18 +801,23 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
SysUser sysUser = sysUserService.getById(jsonObject.getString("evaluationId")); SysUser sysUser = sysUserService.getById(jsonObject.getString("evaluationId"));
if (ObjectUtils.isNotEmpty(sysUser)) { if (ObjectUtils.isNotEmpty(sysUser)) {
thirdId[0] = sysUser.getThirdId(); thirdId[0] = sysUser.getThirdId();
userIdList.add(sysUser.getId());
} }
try { try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); // FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(title); // feishuMsgVo.setTitle(title);
feishuMsgVo.setCnContentUpper(cnContentUpper); // feishuMsgVo.setCnContentUpper(cnContentUpper);
feishuMsgVo.setCnContentLower(cnContentLower); // feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper(enContentUpper); // feishuMsgVo.setEnContentUpper(enContentUpper);
feishuMsgVo.setEnContentLower(enContentLower); // feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu); // feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色 // feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdId, feishuMsgVo); // feishuService.sendCard(thirdId, feishuMsgVo);
} catch (IOException e) { //飞书消息(模板-20230410
sendMsgFeiShu(msgType, userIdList, hrefFeishu, initiator,
initiatorEn, lawsTechnologyEvaluationEO, endTime,
bussDocumentLibraryEO, cnContentUpper, enContentUpper);
} catch (Exception e) {
log.error("飞书消息推送失败"); log.error("飞书消息推送失败");
} }
} }
@@ -813,16 +831,16 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
String currentUserId = jsonObject.getString("currentUserId"); //当前操作用户id String currentUserId = jsonObject.getString("currentUserId"); //当前操作用户id
SysUser currentUser = this.sysUserService.getBaseMapper().selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, currentUserId)); SysUser currentUser = this.sysUserService.getBaseMapper().selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, currentUserId));
initiator = currentUser.getUsername(); initiator = currentUser.getUsername();
cnContentUpper = "您好,您提交的评估结果被退回,请及时查看处理"; cnContentUpper = "您好,您提交的评估结果被退回,请及时查看处理";
cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() + cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\n标题: " + lawsTechnologyEvaluationEO.getTitle() + "\n标题: " + lawsTechnologyEvaluationEO.getTitle() +
"\n发起人: " + initiator + "\n发起人: " + initiator +
"\n截止时间: " + endTime; "\n截止时间: " + endTime;
enContentUpper = "Hello! The assessment result you submitted has been rejected. Please check and address it in a timely manner"; enContentUpper = "Hello! The assessment result you submitted has been rejected. Please check and address it in a timely manner.";
enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() + // enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() + // "\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + initiator + // "\nInitiator: " + initiator +
"\nDue Date: " + endTime; // "\nDue Date: " + endTime;
LawsTechnologyEvaluationFlowDetailEO flowDetailEO = flowDetailEOMapper.queryByEvaluationId(lawsTechnologyEvaluationId,jsonObject.getString("evaluators")); LawsTechnologyEvaluationFlowDetailEO flowDetailEO = flowDetailEOMapper.queryByEvaluationId(lawsTechnologyEvaluationId,jsonObject.getString("evaluators"));
if (ObjectUtils.isNotEmpty(flowDetailEO)) { if (ObjectUtils.isNotEmpty(flowDetailEO)) {
@@ -831,31 +849,38 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
SysUser sysUser = sysUserService.getById(jsonObject.getString("evaluators")); SysUser sysUser = sysUserService.getById(jsonObject.getString("evaluators"));
if (ObjectUtils.isNotEmpty(sysUser)) { if (ObjectUtils.isNotEmpty(sysUser)) {
thirdId[0] = sysUser.getThirdId(); thirdId[0] = sysUser.getThirdId();
userIdList.add(sysUser.getId());
} }
try { try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); // FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(title); // feishuMsgVo.setTitle(title);
feishuMsgVo.setCnContentUpper(cnContentUpper); // feishuMsgVo.setCnContentUpper(cnContentUpper);
feishuMsgVo.setCnContentLower(cnContentLower); // feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper(enContentUpper); // feishuMsgVo.setEnContentUpper(enContentUpper);
feishuMsgVo.setEnContentLower(enContentLower); // feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu); // feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色 // feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdId, feishuMsgVo); // feishuService.sendCard(thirdId, feishuMsgVo);
} catch (IOException e) { //飞书消息(模板-20230410
sendMsgFeiShu(msgType, userIdList, hrefFeishu, initiator,
initiatorEn, lawsTechnologyEvaluationEO, endTime,
bussDocumentLibraryEO, cnContentUpper, enContentUpper);
} catch (Exception e) {
log.error("飞书消息推送失败"); log.error("飞书消息推送失败");
} }
} }
} else if (StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG.getValue())) { } else if (StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG.getValue())) {
initiator = "系统通知";
initiatorEn = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
cnContentUpper = "您好,该任务将于3天后到期,请及时查看处理,谢谢!"; cnContentUpper = "您好,该任务将于3天后到期,请及时查看处理,谢谢!";
cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() + cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\n标题: " + lawsTechnologyEvaluationEO.getTitle() + "\n标题: " + lawsTechnologyEvaluationEO.getTitle() +
"\n发起人: 系统通知"; "\n发起人: 系统通知";
enContentUpper = "Hello! This task will expire in 3 days. Please check and address the task in a timely manner. Thank you!"; enContentUpper = "Hello! This task will expire in 3 days. Please check and address the task in a timely manner. Thank you!";
enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() + // enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() + // "\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(); // "\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
LawsTechnologyEvaluationFlowDetailEO flowDetailEO = flowDetailEOMapper.queryByEvaluationId(lawsTechnologyEvaluationId,jsonObject.getString("userId")); LawsTechnologyEvaluationFlowDetailEO flowDetailEO = flowDetailEOMapper.queryByEvaluationId(lawsTechnologyEvaluationId,jsonObject.getString("userId"));
if (ObjectUtils.isNotEmpty(flowDetailEO)) { if (ObjectUtils.isNotEmpty(flowDetailEO)) {
@@ -864,31 +889,38 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
SysUser sysUser = sysUserService.getById(jsonObject.getString("userId")); SysUser sysUser = sysUserService.getById(jsonObject.getString("userId"));
if (ObjectUtils.isNotEmpty(sysUser)) { if (ObjectUtils.isNotEmpty(sysUser)) {
thirdId[0] = sysUser.getThirdId(); thirdId[0] = sysUser.getThirdId();
userIdList.add(sysUser.getId());
} }
try { try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); // FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(title); // feishuMsgVo.setTitle(title);
feishuMsgVo.setCnContentUpper(cnContentUpper); // feishuMsgVo.setCnContentUpper(cnContentUpper);
feishuMsgVo.setCnContentLower(cnContentLower); // feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper(enContentUpper); // feishuMsgVo.setEnContentUpper(enContentUpper);
feishuMsgVo.setEnContentLower(enContentLower); // feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu); // feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色 // feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdId, feishuMsgVo); // feishuService.sendCard(thirdId, feishuMsgVo);
} catch (IOException e) { //飞书消息(模板-20230410
sendMsgFeiShu(msgType, userIdList, hrefFeishu, initiator,
initiatorEn, lawsTechnologyEvaluationEO, endTime,
bussDocumentLibraryEO, cnContentUpper, enContentUpper);
} catch (Exception e) {
log.error("飞书消息推送失败"); log.error("飞书消息推送失败");
} }
} }
} else if (StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_TODAY_MSG.getValue())) { } else if (StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_TODAY_MSG.getValue())) {
initiator = "系统通知";
initiatorEn = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
cnContentUpper = "您好,该任务将于今天到期,请尽快查看处理,谢谢!"; cnContentUpper = "您好,该任务将于今天到期,请尽快查看处理,谢谢!";
cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() + cnContentLower = "编号:" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\n标题: " + lawsTechnologyEvaluationEO.getTitle() + "\n标题: " + lawsTechnologyEvaluationEO.getTitle() +
"\n发起人: 系统通知"; "\n发起人: 系统通知";
enContentUpper = "Hello! This task will expire today. Please check and address the task ASAP. Thank you!"; enContentUpper = "Hello! This task will expire today. Please check and address the task ASAP. Thank you!";
enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() + // enContentLower = "Regulation No :" + lawsTechnologyEvaluationEO.getSerialNumber() +
"\nTitle: " + bussDocumentLibraryEO.getTitleEn() + // "\nTitle: " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(); // "\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
LawsTechnologyEvaluationFlowDetailEO flowDetailEO = flowDetailEOMapper.queryByEvaluationId(lawsTechnologyEvaluationId,jsonObject.getString("userId")); LawsTechnologyEvaluationFlowDetailEO flowDetailEO = flowDetailEOMapper.queryByEvaluationId(lawsTechnologyEvaluationId,jsonObject.getString("userId"));
if (ObjectUtils.isNotEmpty(flowDetailEO)) { if (ObjectUtils.isNotEmpty(flowDetailEO)) {
@@ -897,18 +929,23 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
SysUser sysUser = sysUserService.getById(jsonObject.getString("userId")); SysUser sysUser = sysUserService.getById(jsonObject.getString("userId"));
if (ObjectUtils.isNotEmpty(sysUser)) { if (ObjectUtils.isNotEmpty(sysUser)) {
thirdId[0] = sysUser.getThirdId(); thirdId[0] = sysUser.getThirdId();
userIdList.add(sysUser.getId());
} }
try { try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); // FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(title); // feishuMsgVo.setTitle(title);
feishuMsgVo.setCnContentUpper(cnContentUpper); // feishuMsgVo.setCnContentUpper(cnContentUpper);
feishuMsgVo.setCnContentLower(cnContentLower); // feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper(enContentUpper); // feishuMsgVo.setEnContentUpper(enContentUpper);
feishuMsgVo.setEnContentLower(enContentLower); // feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu); // feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色 // feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdId, feishuMsgVo); // feishuService.sendCard(thirdId, feishuMsgVo);
} catch (IOException e) { //飞书消息(模板-20230410
sendMsgFeiShu(msgType, userIdList, hrefFeishu, initiator,
initiatorEn, lawsTechnologyEvaluationEO, endTime,
bussDocumentLibraryEO, cnContentUpper, enContentUpper);
} catch (Exception e) {
log.error("飞书消息推送失败"); log.error("飞书消息推送失败");
} }
} }
@@ -933,6 +970,33 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
//SendMessageUtils.sendMessage(msgTitle,msgContentEN,userIdList,lawsTechnologyEvaluationId,sendMessageMap,null, MessageTypeEnum.REGULATORY_AND_TECHNICAL_ASSESSMENT,initiator); //SendMessageUtils.sendMessage(msgTitle,msgContentEN,userIdList,lawsTechnologyEvaluationId,sendMessageMap,null, MessageTypeEnum.REGULATORY_AND_TECHNICAL_ASSESSMENT,initiator);
} }
private void sendMsgFeiShu(String msgType, List<String> userIdList, String hrefFeishu, String initiator, String initiatorEn, LawsTechnologyEvaluationEO lawsTechnologyEvaluationEO, String endTime, BussDocumentLibraryEO bussDocumentLibraryEO, String cnContentUpper, String enContentUpper) {
//飞书消息(模板-20230410
Map<String,Object> params = new HashMap<>();
params.put("contentInfoFeiCn",cnContentUpper);
params.put("contentInfoFeiEn",enContentUpper);
params.put("userIdList",userIdList);
params.put("back_url",hrefFeishu);
params.put("titleCn"," "+lawsTechnologyEvaluationEO.getTitle());
if(ObjectUtils.isNotEmpty(bussDocumentLibraryEO)){
params.put("titleEn"," "+bussDocumentLibraryEO.getTitleEn());
}else{
params.put("titleEn","");
}
params.put("regulationNo"," "+lawsTechnologyEvaluationEO.getSerialNumber());
params.put("initiator"," "+initiator);
params.put("carTitleCn", TemplateInfoEnum2.REGULATION_TECHNICAL_ASSESSMENT.getNameCn());
params.put("carTitleEn",TemplateInfoEnum2.REGULATION_TECHNICAL_ASSESSMENT.getNameEn());
if(StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_TODAY_MSG.getValue())
|| StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_THREE_DAYS_BEFORE_MSG.getValue())){
params.put("initiatorEn"," "+initiatorEn);
}else{
params.put("initiatorEn"," "+initiator);
}
params.put("dueDate"," "+endTime);
feishuService.sendMessageRegulationOpinionCollection(TemplateInfoEnum2.REGULATION_TECHNICAL_ASSESSMENT.getValue(),params);
}
@Override @Override
public Result<?> batchCompleteTask(JSONObject jsonObject) { public Result<?> batchCompleteTask(JSONObject jsonObject) {
String ids = jsonObject.getString("ids"); String ids = jsonObject.getString("ids");