催办消息 -- 法规任务确认模块消息处理完毕

This commit is contained in:
CD
2022-11-01 11:00:35 +08:00
parent b34f623586
commit 13bf640867
2 changed files with 57 additions and 20 deletions
@@ -164,7 +164,8 @@ public class TaskAffirmJob implements Job {
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
//项目名称
String PRN = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectLibraryBase.getProjectVersion();
String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getProjectVersion())) ? "00" : projectLibraryBase.getProjectVersion();
String PRN = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectVersion;
if (!threeDaysMap.isEmpty()) {
for (String key : threeDaysMap.keySet()) {
String[] ids = threeDaysMap.get(key).split(",");
@@ -1407,7 +1407,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
//项目名称
String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getProjectVersion())) ? "00" : projectLibraryBase.getProjectVersion();
String projectName = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + "-" + projectVersion;
String projectName = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectVersion;
//TODO 切换成枚举不要在代码里出现魔数
if(StringUtils.equals(operatorType, OperatorTypeEnum.INVENTORY_AFFIRM.getValue())){
String ids = json.getString("ids");
@@ -1635,6 +1635,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
ProjectLawsInventoryEO projectLawsInventoryEO = getById(id);
//法规中英文
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
if(isProjectRole == Integer.parseInt(ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getValue())){
projectLawsInventoryEO.setRegulationOwnerSubmitStatus(operatorResult);
projectLawsInventoryEO.setHomologationEngineerSubmitStatus(operatorResult);
@@ -1726,7 +1729,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
"\n截止时间: " + dueDate);
feishuMsgVo.setEnContentUpper("Hello! This task is rejected by "+ currentUser.getUsername() +". Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: "+ dueDate);
feishuMsgVo.setUrl(hrefFeishu);
@@ -1791,9 +1794,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
"\n截止时间: " + dueDate);
feishuMsgVo.setEnContentUpper("Hello! This task is rejected by "+ currentUser.getUsername() +". Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: "+ dueDate);
"\nDue Date: " + dueDate);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.RED.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
@@ -8565,7 +8568,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
projectLawsInventoryEOList.forEach(projectLawsInventoryEO -> {
//如果清单确认状态为待确认的进行催办
if(StringUtils.equals(projectLawsInventoryEO.getInventoryAffirmStatus(),InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue())){
/*if(StringUtils.equals(projectLawsInventoryEO.getInventoryAffirmStatus(),InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue())){
List<String> inventoryAffirmUserIdList = new ArrayList<>();
if(StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){
@@ -8625,7 +8628,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
//发送消息
sendMessage(msgTitle, msgContentEN,inventoryAffirmUserIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,studioUserInfo.getUsername());
}
}
}*/
//如果任务确认状态为待确认的进行催办
if(StringUtils.equals(projectLawsInventoryEO.getTaskAffirmStatus(),TaskAffirmStatusEnum.LIST_TO_CONFIRM.getValue())){
@@ -8659,27 +8662,60 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
//消息内容
String msgContentEN = "Please address the regulation task confirmation process for "+ projectNameInfoEO.getProjectName() +" ASAP. ";
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a regulation task confirmation to complete";
//String msgContentEN = "Please address the regulation task confirmation process for "+ projectNameInfoEO.getProjectName() +" ASAP. ";
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a regulation task confirmation to complete";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! Please address the task ASAP. ");
feishuMsgVo.setTaskType("Regulation List Confirmation");
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//feishuMsgVo.setContent("Hello! Please address the task ASAP. ");
//feishuMsgVo.setTaskType("Regulation List Confirmation");
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//飞书跳转链接
String hrefFeishu = backUrl + JumpLinkEnum.TASK_AFFIRM_LINK.getLink();
//系统内部跳转链接
String href = "<a href='" + JumpLinkEnum.TASK_AFFIRM_LINK.getLink() + "'>" + " View details" + "</a>";
//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);
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
sendMessage(msgTitle, msgContentEN,taskAffirmUserIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.TASK_CONFIRMATION,studioUserInfo.getUsername());
//sendMessage(msgTitle, msgContentEN,taskAffirmUserIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.TASK_CONFIRMATION,studioUserInfo.getUsername());
String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getProjectVersion())) ? "00" : projectLibraryBase.getProjectVersion();
String PRN = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectVersion;
String dueDate = new SimpleDateFormat("yyyy-MM-dd").format(projectLawsInventoryEO.getTaskAffirmDueDate());
//法规中英文
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(taskAffirmUserIdList);
if (ObjectUtils.isNotEmpty(sysUsers)) {
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn());
feishuMsgVo.setCnContentUpper("您好,请尽快查看处理此项任务,谢谢!");
feishuMsgVo.setCnContentLower("项目: " + PRN +
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\n发起人: 系统通知" +
"\n截止时间: " + dueDate);
feishuMsgVo.setEnContentUpper("Hello! Please check and address the task ASAP. Thank you!");
feishuMsgVo.setEnContentLower("Project: " + PRN +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName() +
"\nDue Date: "+ dueDate);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
}
});