流程发消息。

This commit is contained in:
wangzhijiang
2023-03-22 18:13:36 +08:00
parent b6de2507c8
commit da7c10e4b3
2 changed files with 143 additions and 1 deletions
@@ -41,6 +41,17 @@ public enum TemplateInfoEnum2 {
REGULATION_LIST_RELEASE2("法规清单发布-公用消息-绿色","ctp_AAuPKJ9Cj9w5"),
REGULATION_LIST_RELEASE3("法规清单发布-公用消息-红色","ctp_AAu2lBIgaB79"),
REGULATION_LIST_RELEASE4("法规清单发布-公用消息-黄色","ctp_AAuPh3LJWg1x"),
/**
* 法规任务确认消息
*/
REGULATION_TASK_CONFIRMATION1("法规任务确认-公用消息-绿色-无流程类型","ctp_AAuLRr2QIbMb"),
REGULATION_TASK_CONFIRMATION2("法规任务确认-公用消息-红色-无流程类型","ctp_AAuL6mDxffmu"),
REGULATION_TASK_CONFIRMATION3("法规任务确认-公用消息-黄色-无流程类型","ctp_AAuLRr2Qzyj0"),
REGULATION_TASK_CONFIRMATION4("法规任务确认-公用消息-绿色-有流程类型","ctp_AAuL6mDxf8l1"),
REGULATION_TASK_CONFIRMATION5("法规任务确认-公用消息-红色-有流程类型","ctp_AAuPWTSU2Fg2"),
REGULATION_TASK_CONFIRMATION6("法规任务确认-公用消息-黄色-有流程类型","ctp_AAuLRr2Qzkbo"),
;
String name;
@@ -477,6 +477,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
boolean checkResult = checkData(projectLawsInventoryEO.getProjectLibraryId(), currentUser.getId(), projectLawsInventoryEO.getId());
if(checkResult){
this.updateProjectLawsInventorySendMessage(projectLawsInventoryEO);
projectLawsInventoryEO.setUpdateTime(now);
ProjectLawsInventoryEO projectLawsInventoryEOCopy = SerializationUtils.clone(projectLawsInventoryEO);//复制
@@ -564,6 +567,127 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
}
}
/**
* 编辑法规清单发送消息
* @param projectLawsInventoryEO
*/
private void updateProjectLawsInventorySendMessage(ProjectLawsInventoryEO projectLawsInventoryEO) {
ProjectLawsInventoryEO projectLawsInventoryOld = this.queryById(projectLawsInventoryEO.getId());
boolean toBeCheckedFlag = (
StringUtils.equals(projectLawsInventoryOld.getDesignFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue())
|| StringUtils.equals(projectLawsInventoryOld.getVerifyFlowStatus(),ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue())
);
if((StringUtils.isNotEmpty(projectLawsInventoryOld.getRegulationOwnerId()) && StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId())) && toBeCheckedFlag){
// 如果编辑了法规工程师给之前的法规工程师发消息
if (!StringUtils.equals(projectLawsInventoryOld.getRegulationOwnerId(), projectLawsInventoryEO.getRegulationOwnerId())) {
String endTime = "";
if(projectLawsInventoryOld.getInventoryAffirmDueDate() != null){
endTime = DateUtils.formatDate(projectLawsInventoryOld.getInventoryAffirmDueDate());
}
String regulationOwnerId = projectLawsInventoryOld.getRegulationOwnerId();
// 给法规工程师发消息
Map<String,Object> params = new HashMap<>();
params.put("contentCn","您好,您以下任务已被发起人撤回。");
params.put("contentEn","Hello! Your task has been withdrawn by the initiator.");
params.put("projectLibraryId", projectLawsInventoryEO.getProjectLibraryId());
params.put("endTime",endTime);
params.put("userIdList",Arrays.asList(regulationOwnerId.split(",")));
params.put("serialNumbers",projectLawsInventoryOld.getSerialNumber());
this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_TASK_CONFIRMATION1.getValue(),params);
}
}
if((projectLawsInventoryOld.getDesignDueDate() != null && projectLawsInventoryEO.getDesignDueDate() != null) && toBeCheckedFlag){
if(!projectLawsInventoryOld.getDesignDueDate().equals(projectLawsInventoryEO.getDesignDueDate())){
String endTime = "";
if(projectLawsInventoryOld.getInventoryAffirmDueDate() != null){
endTime = DateUtils.formatDate(projectLawsInventoryOld.getInventoryAffirmDueDate());
}
String regulationOwnerId = projectLawsInventoryOld.getRegulationOwnerId();
// 给法规工程师发消息
Map<String,Object> params = new HashMap<>();
params.put("contentCn","您好,以下符合性任务的截止时间已被发起人修改。");
params.put("contentEn","Hello! The due date of the compliance task has been modified by the initiator.");
params.put("projectLibraryId", projectLawsInventoryEO.getProjectLibraryId());
params.put("endTime",endTime);
params.put("userIdList",Arrays.asList(regulationOwnerId.split(",")));
params.put("serialNumbers",projectLawsInventoryOld.getSerialNumber());
this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_TASK_CONFIRMATION1.getValue(),params);
}
}
if((projectLawsInventoryOld.getVerifyDueDate() != null && projectLawsInventoryEO.getVerifyDueDate() != null) && toBeCheckedFlag){
if(!projectLawsInventoryOld.getVerifyDueDate().equals(projectLawsInventoryEO.getVerifyDueDate())){
String endTime = "";
if(projectLawsInventoryOld.getInventoryAffirmDueDate() != null){
endTime = DateUtils.formatDate(projectLawsInventoryOld.getInventoryAffirmDueDate());
}
String regulationOwnerId = projectLawsInventoryOld.getRegulationOwnerId();
// 给法规工程师发消息
Map<String,Object> params = new HashMap<>();
params.put("contentCn","您好,以下符合性任务的截止时间已被发起人修改。");
params.put("contentEn","Hello! The due date of the compliance task has been modified by the initiator.");
params.put("projectLibraryId", projectLawsInventoryEO.getProjectLibraryId());
params.put("endTime",endTime);
params.put("userIdList",Arrays.asList(regulationOwnerId.split(",")));
params.put("serialNumbers",projectLawsInventoryOld.getSerialNumber());
this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_TASK_CONFIRMATION1.getValue(),params);
}
}
// 设计符合性 任务待确认消息 标识
boolean toBeConfirmedDesignFlag = (
StringUtils.equals(projectLawsInventoryOld.getDesignFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())
|| StringUtils.equals(projectLawsInventoryOld.getDesignFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())
);
if((projectLawsInventoryOld.getDesignDutyId() != null && projectLawsInventoryEO.getDesignDutyId() != null) && toBeConfirmedDesignFlag){
if(!projectLawsInventoryOld.getDesignDutyId().equals(projectLawsInventoryEO.getDesignDutyId())){
String endTime = "";
if(projectLawsInventoryOld.getDesignDueDate() != null){
endTime = DateUtils.formatDate(projectLawsInventoryOld.getDesignDueDate());
}
String regulationOwnerId = projectLawsInventoryOld.getRegulationOwnerId();
// 给法规工程师发消息
Map<String,Object> params = new HashMap<>();
params.put("contentCn","您好,您以下任务已被发起人撤回。");
params.put("contentEn","Hello! Your task has been withdrawn by the initiator.");
params.put("projectLibraryId", projectLawsInventoryEO.getProjectLibraryId());
params.put("endTime",endTime);
params.put("userIdList",Arrays.asList(projectLawsInventoryOld.getDesignDutyId().split(",")));
params.put("serialNumbers",projectLawsInventoryOld.getSerialNumber());
this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_TASK_CONFIRMATION1.getValue(),params);
}
}
// 验证符合性 任务待确认消息 标识
boolean toBeConfirmedVerifyFlag = (
StringUtils.equals(projectLawsInventoryOld.getVerifyFlowStatus(),ComplianceFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue())
|| StringUtils.equals(projectLawsInventoryOld.getVerifyFlowStatus(),ComplianceFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())
);
if((projectLawsInventoryOld.getVerifyDutyId() != null && projectLawsInventoryEO.getVerifyDutyId() != null) && toBeConfirmedVerifyFlag){
if(!projectLawsInventoryOld.getVerifyDutyId().equals(projectLawsInventoryEO.getVerifyDutyId())){
String endTime = "";
if(projectLawsInventoryOld.getVerifyDueDate() != null){
endTime = DateUtils.formatDate(projectLawsInventoryOld.getVerifyDueDate());
}
String regulationOwnerId = projectLawsInventoryOld.getRegulationOwnerId();
// 给法规工程师发消息
Map<String,Object> params = new HashMap<>();
params.put("contentCn","您好,您以下任务已被发起人撤回。");
params.put("contentEn","Hello! Your task has been withdrawn by the initiator.");
params.put("projectLibraryId", projectLawsInventoryEO.getProjectLibraryId());
params.put("endTime",endTime);
params.put("userIdList",Arrays.asList(projectLawsInventoryOld.getDesignDutyId().split(",")));
params.put("serialNumbers",projectLawsInventoryOld.getSerialNumber());
this.sendMessageByTemplateId(TemplateInfoEnum2.REGULATION_TASK_CONFIRMATION1.getValue(),params);
}
}
}
private void setProjectLawsInventoryPermission(String userId, String projectId,String lawsInventoryId,Date now, List<ProjectUserPermission> adds, String belong) {
QueryWrapper<ProjectUserPermission> del = new QueryWrapper<>();
del.eq("project_id", projectId)
@@ -2812,7 +2936,10 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
return objectResult;
}
if(StringUtils.equals(operatorType,OperatorTypeEnum.SEND_MSG.getValue())){
workFlowSendMsg(jsonObject);
// workFlowSendMsg(jsonObject);
Map<String,Object> prarams = (Map<String, Object>) jsonObject.get("params");
String templateId = jsonObject.getString("templateId");
this.sendMessageByTemplateId(templateId,prarams);
}
return new Result<>().success("调用成功!");
@@ -10249,6 +10376,8 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
String serialNumbers = (String) params.get("serialNumbers");
String contentCn = (String) params.get("contentCn");
String contentEn = (String) params.get("contentEn");
String flowTypeCn = (String) params.get("flowTypeCn");
String flowTypeEn = (String) params.get("flowTypeEn");
ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(projectLibraryId);
@@ -10281,6 +10410,8 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN);
templateVariableMap.put("operateUserName",ObjectUtils.isNotEmpty(currentUser) ? currentUser.getUsername() : projectLibraryBase.getStudioEngineerName());
templateVariableMap.put("standName",serialNumbers);
templateVariableMap.put("flowTypeCn",flowTypeCn);
templateVariableMap.put("flowTypeEn",flowTypeEn);
larkMesJson.put("templateVariableMap",templateVariableMap);
this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson);