法规技术评估消息(不包含定时任务)

This commit is contained in:
CD
2022-10-26 17:44:04 +08:00
parent 483aac1bce
commit 737305c626
2 changed files with 98 additions and 27 deletions
@@ -2939,9 +2939,9 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
String title = MessageType2Enum.HOMO_PARAMETER_COLLECTION.getCn() + "/" + MessageType2Enum.HOMO_PARAMETER_COLLECTION.getEn();
String cnContentLower = "项目: " + projectInfo.getProjectName() +
"\n发起人: 系统";
"\n发起人: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
String enContentLower = "Project: " + projectInfo.getProjectName() +
"\nInitiator: system";
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
if (!seven.isEmpty()) {
for (String key : seven.keySet()) {
String[] thirds = new String[1];
@@ -6,9 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.constant.enums.ModuleEnum;
import com.jero.common.constant.enums.*;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.LoginUser;
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
@@ -16,6 +14,8 @@ import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServi
import com.jero.modules.document.enums.FieldTypeEnum;
import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper;
import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationEO;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationFlowDetailEO;
@@ -41,6 +41,7 @@ import com.jero.modules.wkflow.enums.FlowTypeEnum;
import com.jero.modules.wkflow.feginClient.WorkFlowFeignClient;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@@ -52,6 +53,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.*;
import java.util.stream.Collectors;
@@ -105,6 +107,9 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
@Autowired
private IProcessInfoEOService processInfoEOService;
@Autowired
private IFeishuService feishuService;
/**
* 保存
*
@@ -609,69 +614,135 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
throw new JeroBootException("发送消息类型不能为空,请检查!");
}
String lawsTechnologyEvaluationId = jsonObject.getString("lawsTechnologyEvaluationId");
//String lawsTechnologyEvaluationId = jsonObject.getString("lawsTechnologyEvaluationId");
String serialNumber = jsonObject.getString("serialNumber"); //文档库编号
List<String> userIdList = new ArrayList<>();
String msgContentEN = "";
String msgTitle = "";
//String msgContentEN = "";
//String msgTitle = "";
String initiator = "";
String evaluationTitle= jsonObject.getString("title");
String endTime = jsonObject.getString("endTime"); //截止日期
String title = MessageType2Enum.REGULATION_TECHNICAL_ASSESSMENT.getCn() + "/" + MessageType2Enum.REGULATION_TECHNICAL_ASSESSMENT.getEn();
String cnContentUpper = "";
String cnContentLower = "";
String enContentUpper = "";
String enContentLower = "";
if(StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_START_MSG.getValue())){
userIdList.add(jsonObject.getString("evaluationId"));
String endTime = jsonObject.getString("endTime"); //截止日期
//String endTime = jsonObject.getString("endTime"); //截止日期
//您收到GB 7258 的法规技术评估流程任务,请及时查看处理。
msgContentEN = "You recieved the Regulatory and technical assessment of "+serialNumber+" . The due date is "+endTime+". Please check and address it in a timely manner.";
msgTitle = "You have a Regulatory and technical assessment task to complete";
//msgContentEN = "You recieved the Regulatory and technical assessment of "+serialNumber+" . The due date is "+endTime+". Please check and address it in a timely manner.";
//msgTitle = "You have a Regulatory and technical assessment 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 = "编号:" + serialNumber +
"\n标题: " + evaluationTitle +
"\n发起人: " + initiator +
"\n截止时间: " + endTime;
enContentUpper = "Hello! Please check and address the task in a timely manner. Thank you!";
enContentLower = "Regulation No :" + serialNumber +
"\nTitle: " + evaluationTitle +
"\nInitiator: " + initiator +
"\nDue Date: " + endTime;
}else if(StringUtils.equals(msgType,MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_ENALUATOR_SUBMIT_MSG.getValue())){
String currentUserId = jsonObject.getString("currentUserId"); //当前操作用户id
SysUser currentUser = this.sysUserService.getBaseMapper().selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, currentUserId));
userIdList.add(jsonObject.getString("initiatorUserId"));
//XXX(人员账号)已提交GB 7258 的法规意见收集流程,请及时查看审核。
msgContentEN = currentUser.getUsername() + " has submitted the collection process of Regulatory and technical assessment of "+serialNumber+", Please check and address it in time.";
msgTitle = "You have a Regulatory and technical assessment task to complete";
//msgContentEN = currentUser.getUsername() + " has submitted the collection process of Regulatory and technical assessment of "+serialNumber+", Please check and address it in time.";
//msgTitle = "You have a Regulatory and technical assessment task to complete";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
cnContentUpper = "您好,"+ currentUser.getUsername() +"已提交评估结果,请审核";
cnContentLower = "编号:" + serialNumber +
"\n标题: " + evaluationTitle +
"\n发起人: " + initiator +
"\n截止时间: " + endTime;
enContentUpper = "Hello! "+ currentUser.getUsername() +" has submitted the assessment result. Please review it";
enContentLower = "Regulation No :" + serialNumber +
"\nTitle: " + evaluationTitle +
"\nInitiator: " + initiator +
"\nDue Date: " + endTime;
}else if(StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_AUDIT_ACCEPTED_MSG.getValue())){
userIdList.add(jsonObject.getString("evaluationId"));
//您提交的GB 7258 的法规技术评估流程已通过。
msgContentEN = "The regulatory and technical assessment process for "+serialNumber+" you submitted has passed.";
msgTitle = "You have a Regulatory and technical assessment task completed";
//msgContentEN = "The regulatory and technical assessment process for "+serialNumber+" you submitted has passed.";
//msgTitle = "You have a Regulatory and technical assessment task completed";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
cnContentUpper = "您好,您提交的评估结果已通过";
cnContentLower = "编号:" + serialNumber +
"\n标题: " + evaluationTitle +
"\n发起人: " + initiator +
"\n截止时间: " + endTime;
enContentUpper = "Hello! The assessment result you submitted has passed";
enContentLower = "Regulation No :" + serialNumber +
"\nTitle: " + evaluationTitle +
"\nInitiator: " + initiator +
"\nDue Date: " + endTime;
}else if(StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_AUDIT_REJECTED_MSG.getValue())){
userIdList.add(jsonObject.getString("evaluationId"));
//您提交的GB 7258 的法规技术评估流程已被退回,请及时查看处理。
msgContentEN = "The regulatory and technical assessment process of "+serialNumber+" you submitted has been returned, Please check and address it in time.";
msgTitle = "You have a Regulatory and technical assessment task to complete";
//msgContentEN = "The regulatory and technical assessment process of "+serialNumber+" you submitted has been returned, Please check and address it in time.";
//msgTitle = "You have a Regulatory and technical assessment task to complete";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
}else if(StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_MSG.getValue())){
cnContentUpper = "您好,您提交的评估结果被退回,请及时查看处理";
cnContentLower = "编号:" + serialNumber +
"\n标题: " + evaluationTitle +
"\n发起人: " + initiator +
"\n截止时间: " + endTime;
enContentUpper = "\n" +
"Hello! The assessment result you submitted has been rejected. Please check and address it in a timely manner";
enContentLower = "Regulation No :" + serialNumber +
"\nTitle: " + evaluationTitle +
"\nInitiator: " + initiator +
"\nDue Date: " + endTime;
}/*else if(StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_MSG.getValue())){
userIdList = (List<String>) jsonObject.get("userIdList");
//您GB 7258的法规技术评估流程将于明天结束,请及时查看处理
msgContentEN = "The the Regulatory and technical assessment of "+serialNumber+" will expire tomorrow. Please check and address it in time.";
msgTitle = "You have a Regulatory and technical assessment task to complete";
//msgContentEN = "The the Regulatory and technical assessment of "+serialNumber+" will expire tomorrow. Please check and address it in time.";
//msgTitle = "You have a Regulatory and technical assessment 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,lawsTechnologyEvaluationId,sendMessageMap,null, MessageTypeEnum.REGULATORY_AND_TECHNICAL_ASSESSMENT,initiator);
//SendMessageUtils.sendMessage(msgTitle,msgContentEN,userIdList,lawsTechnologyEvaluationId,sendMessageMap,null, MessageTypeEnum.REGULATORY_AND_TECHNICAL_ASSESSMENT,initiator);
}
@Override