法规技术评估、法规意见收集流程发消息接口开发。

This commit is contained in:
wangzhijiang
2022-09-01 16:34:14 +08:00
parent 97b1f3cab1
commit aa020e481b
7 changed files with 164 additions and 2 deletions
@@ -25,6 +25,8 @@ public enum MessageTypeEnum {
LIST_CONFIRMATION("List Confirmation", "17"), // 清单确认
TASK_CONFIRMATION("Task Confirmation", "18"), // 任务确认
COMPLIANCE_CONFIRMATION("Compliance Confirmation", "19"), // 符合性确认
COLLECTION_OF_LEGISLATIVE_COMMENTS("Collection of Legislative Comments", "20"), // 法规意见收集
REGULATORY_AND_TECHNICAL_ASSESSMENT("Regulatory and technical assessment", "21"), // 法规技术评估
;
String name;
@@ -73,4 +73,6 @@ public interface ILawsOpinionGatherEOService extends IService<LawsOpinionGatherE
* @param lawsOpinionGatherEOList
*/
void disposeData(List<LawsOpinionGatherEO> lawsOpinionGatherEOList,String cut);
void workFlowSendMsg(JSONObject jsonObject);
}
@@ -1,25 +1,39 @@
package com.jero.modules.lawsOpinionGather.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.exception.JeroBootException;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.lawsOpinionGather.entity.LawsOpinionGatherEO;
import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum;
import com.jero.modules.lawsOpinionGather.mapper.LawsOpinionGatherEOMapper;
import com.jero.modules.lawsOpinionGather.service.ILawsOpinionGatherEOService;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.project.entity.ProjectLibraryBase;
import com.jero.modules.project.entity.ProjectNameInfoEO;
import com.jero.modules.project.entity.ProjectYearNameInfoEO;
import com.jero.modules.project.enums.JumpLinkEnum;
import com.jero.modules.project.enums.MsgTypeEnum;
import com.jero.modules.project.enums.OperatorTypeEnum;
import com.jero.modules.project.enums.RequestSourceEnum;
import com.jero.modules.project.util.SendMessageUtils;
import com.jero.modules.system.entity.SysCategory;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -40,6 +54,11 @@ public class LawsOpinionGatherEOServiceImpl extends ServiceImpl<LawsOpinionGathe
private SysCategoryServiceImpl sysCategoryService;
@Autowired
private IOSSFileService iOSSFileService;
@Autowired
private ISysUserService sysUserService;
@Value(value = "${jero.backUrl}")
private String backUrl;
/**
* 保存
@@ -140,6 +159,11 @@ public class LawsOpinionGatherEOServiceImpl extends ServiceImpl<LawsOpinionGathe
lawsOpinionGatherEO.setGatherResult(jsonObject.getString("gatherResult"));
this.baseMapper.updateById(lawsOpinionGatherEO);
}
// 发送消息
if(StringUtils.equals(operatorType, OperatorTypeEnum.SEND_MSG.getValue())){
workFlowSendMsg(jsonObject);
}
return new Result<>().success("调用成功!");
}
@@ -192,4 +216,53 @@ public class LawsOpinionGatherEOServiceImpl extends ServiceImpl<LawsOpinionGathe
}
return result;
}
/**
* 工作流发送消息
* @param jsonObject
*/
@Override
public void workFlowSendMsg(JSONObject jsonObject){
String msgType = jsonObject.getString("msgType"); //发送消息类型
if(StringUtils.isEmpty(msgType)){
throw new JeroBootException("发送消息类型不能为空,请检查!");
}
String lawsOpinionGatherId = jsonObject.getString("lawsOpinionGatherId");
String serialNumber = jsonObject.getString("serialNumber"); //文档库编号
List<String> userIdList = new ArrayList<>();
String msgContentEN = "";
String msgTitle = "";
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";
}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";
}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 completed";
}
//飞书跳转链接
String hrefFeishu = backUrl + JumpLinkEnum.TASK_AFFIRM_LINK.getLink();
//系统内部跳转链接
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);
SendMessageUtils.sendMessage(msgTitle,msgContentEN,userIdList,lawsOpinionGatherId,sendMessageMap,null,MessageTypeEnum.COLLECTION_OF_LEGISLATIVE_COMMENTS,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
}
}
@@ -88,4 +88,6 @@ public interface ILawsTechnologyEvaluationEOService extends IService<LawsTechnol
Result<?> importItemExcel(MultipartFile file, String cut, HttpServletRequest request)throws Exception;
List<Map<String, Object>> queryPageDummyById(Map<String, Object> parameter);
void workFlowSendMsg(JSONObject jsonObject);
}
@@ -6,6 +6,7 @@ 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.exception.JeroBootException;
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
@@ -17,12 +18,17 @@ import com.jero.modules.lawsOpinionGather.enums.GatherResultEnum;
import com.jero.modules.lawsTechnologyEvaluation.entity.LawsTechnologyEvaluationEO;
import com.jero.modules.lawsTechnologyEvaluation.mapper.LawsTechnologyEvaluationEOMapper;
import com.jero.modules.lawsTechnologyEvaluation.service.ILawsTechnologyEvaluationEOService;
import com.jero.modules.project.enums.JumpLinkEnum;
import com.jero.modules.project.enums.MsgTypeEnum;
import com.jero.modules.project.enums.OperatorTypeEnum;
import com.jero.modules.project.enums.RequestSourceEnum;
import com.jero.modules.project.util.SendMessageUtils;
import com.jero.modules.split.entity.SarFileSplitInfoEO;
import com.jero.modules.split.service.ISarFileSplitInfoService;
import com.jero.modules.system.entity.SysCategory;
import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
@@ -72,6 +78,10 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
private ISarFileSplitInfoService sarFileSplitInfoService;
@Value(value = "${jero.path.upload}")
private String uploadpath;
@Autowired
private ISysUserService sysUserService;
@Value(value = "${jero.backUrl}")
private String backUrl;
/**
* 保存
@@ -163,6 +173,8 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
}else if(StringUtils.equals(operatorType,OperatorTypeEnum.UPDATE_STATUS.getValue())){
LawsTechnologyEvaluationEO lawsTechnologyEvaluationEO = JSONObject.parseObject(JSONObject.toJSONString(jsonObject.get("lawsTechnologyEvaluationEO")),LawsTechnologyEvaluationEO.class);
this.updateById(lawsTechnologyEvaluationEO);
}else if(StringUtils.equals(operatorType,OperatorTypeEnum.SEND_MSG.getValue())){
this.workFlowSendMsg(jsonObject);
}
return new Result<>().success("调用成功!");
@@ -524,6 +536,64 @@ public class LawsTechnologyEvaluationEOServiceImpl extends ServiceImpl<LawsTechn
return result;
}
@Override
public void workFlowSendMsg(JSONObject jsonObject) {
String msgType = jsonObject.getString("msgType"); //发送消息类型
if(StringUtils.isEmpty(msgType)){
throw new JeroBootException("发送消息类型不能为空,请检查!");
}
String lawsTechnologyEvaluationId = jsonObject.getString("lawsTechnologyEvaluationId");
String serialNumber = jsonObject.getString("serialNumber"); //文档库编号
List<String> userIdList = new ArrayList<>();
String msgContentEN = "";
String msgTitle = "";
if(StringUtils.equals(msgType, MsgTypeEnum.LAWS_TECHNOLOGY_EVALUATION_START_MSG.getValue())){
userIdList.add(jsonObject.getString("evaluationId"));
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";
}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";
}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";
}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";
}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";
}
//飞书跳转链接
String hrefFeishu = backUrl + JumpLinkEnum.TASK_AFFIRM_LINK.getLink();
//系统内部跳转链接
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);
SendMessageUtils.sendMessage(msgTitle,msgContentEN,userIdList,lawsTechnologyEvaluationId,sendMessageMap,null, MessageTypeEnum.COLLECTION_OF_LEGISLATIVE_COMMENTS,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
}
private String getTreeName(String cut, List<SysCategory> categoryList, List<String> technologyTerritoryList) {
StringBuilder sb = new StringBuilder();
for (String technologyTerritory : technologyTerritoryList) {
@@ -30,6 +30,16 @@ public enum MsgTypeEnum {
DESIGN_INITIATOR_ACCEPTED_MSG("设计符合性发起人通过发送消息","designInitiatorAcceptedMsg"),
PREHOMO_INITIATOR_ACCEPTED_MSG("prehomo发起人通过发送消息","prehomoInitiatorAcceptedMsg"),
VERIFY_INITIATOR_ACCEPTED_MSG("验证符合性发起人通过发送消息","verifyInitiatorAcceptedMsg"),
LAWS_OPOMOPM_GATHER_START_MSG("法规意见收集发起消息","lawsOpomopmGatherStartMsg"),
LAWS_OPOMOPM_GATHER_ENALUATOR_SUBMIT_MSG("法规意见收集评估人提交任务消息","lawsOpomopmGatherEnaluatorSubmitMsg"),
LAWS_OPOMOPM_GATHER_ENALUATOR_EXPIRE_REMIND_MSG("法规意见收集到期前一天消息","lawsOpomopmGatherExpireRemindMsg"),
LAWS_TECHNOLOGY_EVALUATION_START_MSG("法规技术评估发起消息","lawsTechnologyEvaluationStartMsg"),
LAWS_TECHNOLOGY_EVALUATION_ENALUATOR_SUBMIT_MSG("法规技术评估,评估人提交任务消息","lawsTechnologyEvaluationEnaluatorSubmitMsg"),
LAWS_TECHNOLOGY_EVALUATION_AUDIT_ACCEPTED_MSG("法规技术评估,发起人审核通过消息","lawsTechnologyEvaluationAuditAcceptedMsg"),
LAWS_TECHNOLOGY_EVALUATION_AUDIT_REJECTED_MSG("法规技术评估,发起人审核拒绝消息","lawsTechnologyEvaluationAuditRejectedMsg"),
LAWS_TECHNOLOGY_EVALUATION_EXPIRE_REMIND_MSG("法规技术评估到期前一天消息","lawsTechnologyEvaluationExpireRemindMsg"),
;
String name;
@@ -164,4 +164,7 @@ public interface WorkFlowFeignClient {
*/
@RequestMapping(value = "/bat-wkflow/deleteProcessInstanceByTaskId",method = RequestMethod.GET)
Result<String> deleteProcessInstanceByTaskId(@RequestParam("taskId") String taskId);
@RequestMapping(value = "/bat-wkflow/task/getLawsOpinionGatherFlowAssigneeList",method = RequestMethod.GET)
List<String> getLawsOpinionGatherFlowAssigneeList(@RequestParam("lawsOpinionGatherId") String lawsOpinionGatherId);
}