法规任务确认消息(剩一个任务催办)
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ public enum MsgColorEnum {
|
||||
|
||||
GREEN("其他","green"),
|
||||
RED("任务被拒绝","red"),
|
||||
YELLOW("任务预期","yellow");
|
||||
YELLOW("任务逾期","yellow");
|
||||
|
||||
String label;
|
||||
String value;
|
||||
|
||||
+241
-79
@@ -1,7 +1,13 @@
|
||||
package com.jero.modules.project.job;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.jero.common.constant.enums.MessageType2Enum;
|
||||
import com.jero.common.constant.enums.MessageTypeEnum;
|
||||
import com.jero.common.constant.enums.MsgColorEnum;
|
||||
import com.jero.modules.document.entity.BussDocumentLibraryEO;
|
||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||
import com.jero.modules.feishu.service.IFeishuService;
|
||||
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
|
||||
import com.jero.modules.feishu.vo.FeishuMsgVo;
|
||||
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
|
||||
import com.jero.modules.project.entity.ProjectLibraryBase;
|
||||
@@ -15,8 +21,11 @@ import com.jero.modules.project.mapper.ProjectLibraryBaseMapper;
|
||||
import com.jero.modules.project.mapper.ProjectNameInfoEOMapper;
|
||||
import com.jero.modules.project.mapper.ProjectYearNameInfoEOMapper;
|
||||
import com.jero.modules.project.service.IProjectLawsInventoryEOService;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.service.ISysUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
@@ -24,6 +33,7 @@ import org.quartz.JobExecutionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -49,16 +59,24 @@ public class InventoryAffirmJob implements Job {
|
||||
@Autowired
|
||||
private ProjectYearNameInfoEOMapper projectYearNameInfoEOMapper;
|
||||
|
||||
@Autowired
|
||||
private IFeishuService feishuService;
|
||||
|
||||
@Value(value = "${jero.backUrl}")
|
||||
private String backUrl;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
@Autowired
|
||||
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
|
||||
|
||||
/**
|
||||
* 清单任务到达截止时间后,给用户发送消息
|
||||
*/
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
log.info("清单确认流程,定时任务开启 =====================================================");
|
||||
//获取状态为待确认的数据
|
||||
log.info("清单确认流程,定时任务开启 =====================================================");
|
||||
/* //获取状态为待确认的数据
|
||||
QueryWrapper<ProjectLawsInventoryEO> queryWrapperInventory = new QueryWrapper<>();
|
||||
queryWrapperInventory.lambda().eq(ProjectLawsInventoryEO::getInventoryAffirmStatus, InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue());
|
||||
List<ProjectLawsInventoryEO> projectLawsInventoryEOList = projectLawsInventoryEOMapper.selectList(queryWrapperInventory);
|
||||
@@ -96,125 +114,269 @@ public class InventoryAffirmJob implements Job {
|
||||
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId());
|
||||
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
|
||||
|
||||
List<String> threeDaysUserIdList = new ArrayList<>();
|
||||
List<String> currentDaysUserIdList = new ArrayList<>();
|
||||
|
||||
Map<String, List<String>> threeDaysMap = new HashMap<>();
|
||||
Map<String, List<String>> currentDaysMap = new HashMap<>();
|
||||
Map<String, List<String>> overdueMap = new HashMap<>();
|
||||
|
||||
for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOList) {
|
||||
if(StringUtils.equals(projectLibraryBase.getId(),projectLawsInventoryEO.getProjectLibraryId())){
|
||||
if(projectLawsInventoryEO.getInventoryAffirmDueDate() != null){
|
||||
//如果清单确认结束日期是当前日期
|
||||
if(StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()))){
|
||||
List<String> currentDaysUserIdList = new ArrayList<>();
|
||||
if(StringUtils.isEmpty(projectLawsInventoryEO.getSendMsgFlag())){
|
||||
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())){
|
||||
currentDaysUserIdList.add(projectLawsInventoryEO.getRegulationOwnerId());
|
||||
}
|
||||
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){
|
||||
currentDaysUserIdList.add(projectLawsInventoryEO.getHomologationEngineerId());
|
||||
//if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())){
|
||||
// currentDaysUserIdList.add(projectLawsInventoryEO.getRegulationOwnerId());
|
||||
//}
|
||||
//if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){
|
||||
// currentDaysUserIdList.add(projectLawsInventoryEO.getHomologationEngineerId());
|
||||
//}
|
||||
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())||StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())) {
|
||||
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
|
||||
currentDaysUserIdList.add(projectLawsInventoryEO.getEngineeringInterfacePerson());
|
||||
}
|
||||
}
|
||||
projectLawsInventoryEO.setSendMsgFlag(SendMsgFlagEnum.FALSE.getValue());
|
||||
projectLawsInventoryEOMapper.updateById(projectLawsInventoryEO);
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(currentDaysUserIdList)) {
|
||||
currentDaysMap.put(projectLawsInventoryEO.getId(), currentDaysUserIdList);
|
||||
}
|
||||
}
|
||||
|
||||
//如果清单确认结束时间是当前系统时间后三天
|
||||
if(StringUtils.equals(threeDaysStr,sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()))){
|
||||
List<String> threeDaysUserIdList = new ArrayList<>();
|
||||
if(StringUtils.isEmpty(projectLawsInventoryEO.getSendMsgCurrentFlag())){
|
||||
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())){
|
||||
threeDaysUserIdList.add(projectLawsInventoryEO.getRegulationOwnerId());
|
||||
}
|
||||
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){
|
||||
threeDaysUserIdList.add(projectLawsInventoryEO.getHomologationEngineerId());
|
||||
//if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())){
|
||||
// threeDaysUserIdList.add(projectLawsInventoryEO.getRegulationOwnerId());
|
||||
//}
|
||||
//if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){
|
||||
// threeDaysUserIdList.add(projectLawsInventoryEO.getHomologationEngineerId());
|
||||
//}
|
||||
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())||StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())) {
|
||||
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
|
||||
threeDaysUserIdList.add(projectLawsInventoryEO.getEngineeringInterfacePerson());
|
||||
}
|
||||
}
|
||||
projectLawsInventoryEO.setSendMsgCurrentFlag(SendMsgFlagEnum.FALSE.getValue());
|
||||
projectLawsInventoryEOMapper.updateById(projectLawsInventoryEO);
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(threeDaysUserIdList)) {
|
||||
threeDaysMap.put(projectLawsInventoryEO.getId(), threeDaysUserIdList);
|
||||
}
|
||||
}
|
||||
|
||||
//逾期3天、七天、14天
|
||||
Calendar day3Later=new GregorianCalendar();
|
||||
day3Later.setTime(projectLawsInventoryEO.getInventoryAffirmDueDate());
|
||||
day3Later.add(Calendar.DATE,3);
|
||||
Date overdue3Days = day3Later.getTime();
|
||||
|
||||
Calendar day7Later=new GregorianCalendar();
|
||||
day7Later.setTime(projectLawsInventoryEO.getInventoryAffirmDueDate());
|
||||
day7Later.add(Calendar.DATE,7);
|
||||
Date overdue7Days = day7Later.getTime();
|
||||
|
||||
Calendar day14Later=new GregorianCalendar();
|
||||
day14Later.setTime(projectLawsInventoryEO.getInventoryAffirmDueDate());
|
||||
day14Later.add(Calendar.DATE,14);
|
||||
Date overdue14Days = day14Later.getTime();
|
||||
|
||||
if(StringUtils.equals(sdf.format(overdue3Days),sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()))
|
||||
||StringUtils.equals(sdf.format(overdue7Days),sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()))
|
||||
||StringUtils.equals(sdf.format(overdue14Days),sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()))){
|
||||
List<String> overdueUserIdList = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())||StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())) {
|
||||
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
|
||||
overdueUserIdList.add(projectLawsInventoryEO.getEngineeringInterfacePerson());
|
||||
}
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(overdueUserIdList)) {
|
||||
overdueMap.put(projectLawsInventoryEO.getId(), overdueUserIdList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(CollectionUtils.isNotEmpty(threeDaysUserIdList)){
|
||||
threeDaysUserIdList = threeDaysUserIdList.stream().distinct().collect(Collectors.toList());
|
||||
//飞书跳转链接
|
||||
String hrefFeishu = backUrl
|
||||
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink()
|
||||
+ projectLibraryBase.getId()
|
||||
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
|
||||
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
|
||||
+ projectYearNameInfoEO.getYearName()
|
||||
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
|
||||
|
||||
/*String msgContentCN = "您" + projectLibraryBase.getProjectName() + "(项目名称)法规清单的任务确认剩余处理时间还有3天,请及时查看处理";*/
|
||||
//项目名称
|
||||
String PRN = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectLibraryBase.getProjectVersion();
|
||||
if(!threeDaysMap.isEmpty()){
|
||||
for (String key : threeDaysMap.keySet()) {
|
||||
List<String> threeDaysUserIdList = threeDaysMap.get(key);
|
||||
threeDaysUserIdList = threeDaysUserIdList.stream().distinct().collect(Collectors.toList());
|
||||
List<String> thirdIdList = new ArrayList<>();
|
||||
List<SysUser> sysUsers = sysUserService.listByIds(threeDaysUserIdList);
|
||||
if (ObjectUtils.isNotEmpty(sysUsers)) {
|
||||
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
|
||||
}
|
||||
//法规中英文
|
||||
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
|
||||
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
|
||||
try {
|
||||
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
|
||||
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn());
|
||||
feishuMsgVo.setCnContentUpper("您好,该任务将于3天后到期,请及时查看处理,谢谢!");
|
||||
feishuMsgVo.setCnContentLower("项目: " + PRN +
|
||||
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
|
||||
"\n发起人: 系统通知");
|
||||
feishuMsgVo.setEnContentUpper("Hello! This task will expire in 3 days. Please check and address it in a timely manner. Thank you!");
|
||||
feishuMsgVo.setEnContentLower("Project:" + PRN +
|
||||
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
|
||||
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
|
||||
feishuMsgVo.setUrl(hrefFeishu);
|
||||
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
|
||||
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
|
||||
} catch (IOException e) {
|
||||
log.error("飞书消息推送失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
*//*String msgContentCN = "您" + projectLibraryBase.getProjectName() + "(项目名称)法规清单的任务确认剩余处理时间还有3天,请及时查看处理";*//*
|
||||
// XXX .
|
||||
String msgContentEN = "The remaining processing time for the regulation task confirmation for "
|
||||
+ projectNameInfoEO.getProjectName() + "-"
|
||||
+ projectYearNameInfoEO.getYearName()+ " "
|
||||
+ projectLibraryBase.getTargetMarket()
|
||||
+ " are 3 days. Please check and address it in a timely manner.";
|
||||
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
|
||||
+ ": You have a regulation task confirmation to complete";
|
||||
//String msgContentEN = "The remaining processing time for the regulation task confirmation for "
|
||||
// + projectNameInfoEO.getProjectName() + "-"
|
||||
// + projectYearNameInfoEO.getYearName()+ " "
|
||||
// + projectLibraryBase.getTargetMarket()
|
||||
// + " are 3 days. Please check and address it in a timely manner.";
|
||||
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
|
||||
// + ": You have a regulation task confirmation to complete";
|
||||
|
||||
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
|
||||
//feishuMsgVo.setContent("Hello! The remaining processing time for the task are 3 days. Please check and address it in a timely manner.");
|
||||
//feishuMsgVo.setTaskType("Regulation Task Confirmation");
|
||||
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
|
||||
|
||||
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
|
||||
feishuMsgVo.setContent("Hello! The remaining processing time for the task are 3 days. Please check and address it in a timely manner.");
|
||||
feishuMsgVo.setTaskType("Regulation Task Confirmation");
|
||||
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
|
||||
|
||||
//飞书跳转链接
|
||||
String hrefFeishu = backUrl
|
||||
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink()
|
||||
+ projectLibraryBase.getId()
|
||||
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
|
||||
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
|
||||
+ projectYearNameInfoEO.getYearName()
|
||||
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
|
||||
//系统内部跳转链接
|
||||
String href = "<a href='"
|
||||
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
|
||||
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
|
||||
+ projectYearNameInfoEO.getYearName()
|
||||
+ "&targetMarket=" + projectLibraryBase.getTargetMarket()
|
||||
+ "'>" + " View details" + "</a>";
|
||||
String contentInfo = msgContentEN + " " + href;
|
||||
Map<String,Object> sendMessageMap = new HashMap<>();
|
||||
sendMessageMap.put("hrefFeishu",hrefFeishu);
|
||||
sendMessageMap.put("contentInfo",contentInfo);
|
||||
//String href = "<a href='"
|
||||
// + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
|
||||
// + "&projectName=" + projectNameInfoEO.getProjectName() + "-"
|
||||
// + projectYearNameInfoEO.getYearName()
|
||||
// + "&targetMarket=" + projectLibraryBase.getTargetMarket()
|
||||
// + "'>" + " View details" + "</a>";
|
||||
//String contentInfo = msgContentEN + " " + href;
|
||||
//Map<String,Object> sendMessageMap = new HashMap<>();
|
||||
// sendMessageMap.put("hrefFeishu",hrefFeishu);
|
||||
//sendMessageMap.put("contentInfo",contentInfo);
|
||||
|
||||
//发送消息
|
||||
projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN, threeDaysUserIdList, projectLibraryBase.getId(), sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
|
||||
//projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN, threeDaysUserIdList, projectLibraryBase.getId(), sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
|
||||
}
|
||||
|
||||
if(CollectionUtils.isNotEmpty(currentDaysUserIdList)){
|
||||
currentDaysUserIdList = currentDaysUserIdList.stream().distinct().collect(Collectors.toList());
|
||||
if(!currentDaysMap.isEmpty()){
|
||||
for (String key : currentDaysMap.keySet()) {
|
||||
List<String> currentDaysUserIdList = currentDaysMap.get(key);
|
||||
currentDaysUserIdList = currentDaysUserIdList.stream().distinct().collect(Collectors.toList());
|
||||
List<String> thirdIdList = new ArrayList<>();
|
||||
List<SysUser> sysUsers = sysUserService.listByIds(currentDaysUserIdList);
|
||||
if (ObjectUtils.isNotEmpty(sysUsers)) {
|
||||
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
|
||||
}
|
||||
//法规中英文
|
||||
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
|
||||
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
|
||||
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发起人: 系统通知");
|
||||
feishuMsgVo.setEnContentUpper("Hello! This task will expire today. Please check and address the task ASAP. Thank you!");
|
||||
feishuMsgVo.setEnContentLower("Project:" + PRN +
|
||||
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
|
||||
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
|
||||
feishuMsgVo.setUrl(hrefFeishu);
|
||||
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
|
||||
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
|
||||
} catch (IOException e) {
|
||||
log.error("飞书消息推送失败");
|
||||
}
|
||||
}
|
||||
|
||||
/*String msgContentCN = "您" + projectLibraryBase.getProjectName() + "(项目名称)法规清单的任务今天即将结束,请及时查看处理*/
|
||||
String msgContentEN = "The regulation task confirmation for "
|
||||
+ projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
|
||||
+ " will expire today. Please check and address it in a timely manner.";
|
||||
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
|
||||
+ ": You have a regulation task confirmation to complete";
|
||||
|
||||
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
|
||||
feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner.");
|
||||
feishuMsgVo.setTaskType("Regulation Task Confirmation");
|
||||
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
|
||||
*//*String msgContentCN = "您" + projectLibraryBase.getProjectName() + "(项目名称)法规清单的任务今天即将结束,请及时查看处理*//*
|
||||
//String msgContentEN = "The regulation task confirmation for "
|
||||
// + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
|
||||
// + " will expire today. Please check and address it in a timely manner.";
|
||||
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
|
||||
// + ": You have a regulation task confirmation to complete";
|
||||
|
||||
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
|
||||
//feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner.");
|
||||
//feishuMsgVo.setTaskType("Regulation Task Confirmation");
|
||||
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
|
||||
|
||||
|
||||
//飞书跳转链接
|
||||
String hrefFeishu = backUrl
|
||||
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink()
|
||||
+ projectLibraryBase.getId()
|
||||
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
|
||||
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
|
||||
+ projectYearNameInfoEO.getYearName()
|
||||
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
|
||||
//系统内部跳转链接
|
||||
String href = "<a href='"
|
||||
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
|
||||
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
|
||||
+ projectYearNameInfoEO.getYearName()
|
||||
+ "&targetMarket=" + projectLibraryBase.getTargetMarket()
|
||||
+ "'>" + " View details" + "</a>";
|
||||
String contentInfo = msgContentEN + " " + href;
|
||||
Map<String,Object> sendMessageMap = new HashMap<>();
|
||||
sendMessageMap.put("hrefFeishu",hrefFeishu);
|
||||
sendMessageMap.put("contentInfo",contentInfo);
|
||||
//String href = "<a href='"
|
||||
// + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
|
||||
// + "&projectName=" + projectNameInfoEO.getProjectName() + "-"
|
||||
// + projectYearNameInfoEO.getYearName()
|
||||
// + "&targetMarket=" + projectLibraryBase.getTargetMarket()
|
||||
// + "'>" + " View details" + "</a>";
|
||||
//String contentInfo = msgContentEN + " " + href;
|
||||
//Map<String,Object> sendMessageMap = new HashMap<>();
|
||||
//sendMessageMap.put("hrefFeishu",hrefFeishu);
|
||||
//sendMessageMap.put("contentInfo",contentInfo);
|
||||
//发送消息
|
||||
projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN, currentDaysUserIdList, projectLibraryBase.getId(), sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
|
||||
//projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN, currentDaysUserIdList, projectLibraryBase.getId(), sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
|
||||
}
|
||||
|
||||
if(!overdueMap.isEmpty()){
|
||||
for (String key : overdueMap.keySet()) {
|
||||
List<String> overdueUserIdList = overdueMap.get(key);
|
||||
overdueUserIdList = overdueUserIdList.stream().distinct().collect(Collectors.toList());
|
||||
List<String> thirdIdList = new ArrayList<>();
|
||||
List<SysUser> sysUsers = sysUserService.listByIds(overdueUserIdList);
|
||||
if (ObjectUtils.isNotEmpty(sysUsers)) {
|
||||
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
|
||||
}
|
||||
//法规中英文
|
||||
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
|
||||
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
|
||||
|
||||
String dueDate = sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate());
|
||||
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! This task is overdue. Please address it 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.YELLOW.getValue()); // 颜色
|
||||
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
|
||||
} catch (IOException e) {
|
||||
log.error("飞书消息推送失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
log.info("清单确认流程,定时任务结束 =====================================================");
|
||||
}
|
||||
}
|
||||
|
||||
+271
@@ -0,0 +1,271 @@
|
||||
package com.jero.modules.project.job;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.jero.common.constant.enums.MessageType2Enum;
|
||||
import com.jero.common.constant.enums.MessageTypeEnum;
|
||||
import com.jero.common.constant.enums.MsgColorEnum;
|
||||
import com.jero.modules.document.entity.BussDocumentLibraryEO;
|
||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||
import com.jero.modules.feishu.service.IFeishuService;
|
||||
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
|
||||
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.InventoryAffirmStatusEnum;
|
||||
import com.jero.modules.project.enums.JumpLinkEnum;
|
||||
import com.jero.modules.project.mapper.ProjectLawsInventoryEOMapper;
|
||||
import com.jero.modules.project.mapper.ProjectLibraryBaseMapper;
|
||||
import com.jero.modules.project.mapper.ProjectNameInfoEOMapper;
|
||||
import com.jero.modules.project.mapper.ProjectYearNameInfoEOMapper;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.service.ISysUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class TaskAffirmJob implements Job {
|
||||
|
||||
@Autowired
|
||||
private ProjectLawsInventoryEOMapper projectLawsInventoryEOMapper;
|
||||
|
||||
@Autowired
|
||||
private ProjectLibraryBaseMapper projectLibraryBaseMapper;
|
||||
|
||||
@Autowired
|
||||
private ProjectNameInfoEOMapper projectNameInfoEOMapper;
|
||||
|
||||
@Autowired
|
||||
private ProjectYearNameInfoEOMapper projectYearNameInfoEOMapper;
|
||||
|
||||
@Autowired
|
||||
private IFeishuService feishuService;
|
||||
|
||||
@Value(value = "${jero.backUrl}")
|
||||
private String backUrl;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
@Autowired
|
||||
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
|
||||
|
||||
|
||||
/**
|
||||
* 任务确认流程定时
|
||||
* @param context
|
||||
* @throws JobExecutionException
|
||||
*/
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
log.info("任务确认流程,定时任务开启 =====================================================");
|
||||
|
||||
QueryWrapper<ProjectLawsInventoryEO> queryWrapperInventory = new QueryWrapper<>();
|
||||
queryWrapperInventory.lambda().eq(ProjectLawsInventoryEO::getTaskAffirmStatus, InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue());
|
||||
List<ProjectLawsInventoryEO> projectLawsInventoryEOList = projectLawsInventoryEOMapper.selectList(queryWrapperInventory);
|
||||
if (ObjectUtils.isNotEmpty(projectLawsInventoryEOList)) {
|
||||
List<String> projectLibraryIdList = projectLawsInventoryEOList.stream().distinct()
|
||||
.map(ProjectLawsInventoryEO::getProjectLibraryId).collect(Collectors.toList());
|
||||
|
||||
QueryWrapper<ProjectLibraryBase> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(ProjectLibraryBase::getId,projectLibraryIdList);
|
||||
List<ProjectLibraryBase> projectLibraryBaseList = projectLibraryBaseMapper.selectList(queryWrapper);
|
||||
if (ObjectUtils.isNotEmpty(projectLibraryBaseList)) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
Date currentDate = new Date();
|
||||
|
||||
//获取后三天前的时间
|
||||
Calendar calendar=new GregorianCalendar();
|
||||
calendar.setTime(new Date());
|
||||
calendar.add(Calendar.DATE,3);
|
||||
Date threeDays = calendar.getTime();
|
||||
|
||||
String threeDaysStr = sdf.format(threeDays);
|
||||
String currentDateStr = sdf.format(currentDate);
|
||||
|
||||
for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseList) {
|
||||
|
||||
QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>();
|
||||
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId, projectLibraryBase.getProjectNameId());
|
||||
ProjectNameInfoEO projectNameInfoEO = projectNameInfoEOMapper.selectOne(projectNameInfoEOQueryWrapper);
|
||||
|
||||
QueryWrapper<ProjectYearNameInfoEO> projectYearInfoEOQueryWrapper = new QueryWrapper<>();
|
||||
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId, projectLibraryBase.getYearNameId());
|
||||
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
|
||||
|
||||
|
||||
Map<String, String> threeDaysMap = new HashMap<>();
|
||||
Map<String, String> currentDaysMap = new HashMap<>();
|
||||
Map<String, String> overdueMap = new HashMap<>();
|
||||
|
||||
for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOList) {
|
||||
if (StringUtils.equals(projectLibraryBase.getId(), projectLawsInventoryEO.getProjectLibraryId())) {
|
||||
if (projectLawsInventoryEO.getTaskAffirmDueDate() != null) {
|
||||
//结束日期是当前日期
|
||||
if (StringUtils.equals(currentDateStr, sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()))) {
|
||||
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
|
||||
currentDaysMap.put(projectLawsInventoryEO.getId(), projectLawsInventoryEO.getEngineeringInterfacePerson());
|
||||
}
|
||||
}
|
||||
|
||||
//如果清单确认结束时间是当前系统时间后三天
|
||||
if (StringUtils.equals(threeDaysStr, sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()))) {
|
||||
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
|
||||
threeDaysMap.put(projectLawsInventoryEO.getId(), projectLawsInventoryEO.getEngineeringInterfacePerson());
|
||||
}
|
||||
}
|
||||
|
||||
//逾期3天、七天、14天
|
||||
Calendar day3Later = new GregorianCalendar();
|
||||
day3Later.setTime(projectLawsInventoryEO.getTaskAffirmDueDate());
|
||||
day3Later.add(Calendar.DATE, 3);
|
||||
Date overdue3Days = day3Later.getTime();
|
||||
|
||||
Calendar day7Later = new GregorianCalendar();
|
||||
day7Later.setTime(projectLawsInventoryEO.getTaskAffirmDueDate());
|
||||
day7Later.add(Calendar.DATE, 7);
|
||||
Date overdue7Days = day7Later.getTime();
|
||||
|
||||
Calendar day14Later = new GregorianCalendar();
|
||||
day14Later.setTime(projectLawsInventoryEO.getTaskAffirmDueDate());
|
||||
day14Later.add(Calendar.DATE, 14);
|
||||
Date overdue14Days = day14Later.getTime();
|
||||
|
||||
if (StringUtils.equals(sdf.format(overdue3Days), sdf.format(currentDate))
|
||||
|| StringUtils.equals(sdf.format(overdue7Days), sdf.format(currentDate))
|
||||
|| StringUtils.equals(sdf.format(overdue14Days), sdf.format(currentDate))) {
|
||||
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
|
||||
overdueMap.put(projectLawsInventoryEO.getId(), projectLawsInventoryEO.getEngineeringInterfacePerson());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//飞书跳转链接
|
||||
String hrefFeishu = backUrl
|
||||
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink()
|
||||
+ projectLibraryBase.getId()
|
||||
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
|
||||
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
|
||||
+ projectYearNameInfoEO.getYearName()
|
||||
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
|
||||
|
||||
//项目名称
|
||||
String PRN = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectLibraryBase.getProjectVersion();
|
||||
if (!threeDaysMap.isEmpty()) {
|
||||
for (String key : threeDaysMap.keySet()) {
|
||||
String[] ids = threeDaysMap.get(key).split(",");
|
||||
List<String> thirdIdList = new ArrayList<>();
|
||||
List<SysUser> sysUsers = sysUserService.listByIds(Arrays.asList(ids));
|
||||
if (ObjectUtils.isNotEmpty(sysUsers)) {
|
||||
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
|
||||
}
|
||||
//法规中英文
|
||||
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
|
||||
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
|
||||
try {
|
||||
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
|
||||
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn());
|
||||
feishuMsgVo.setCnContentUpper("您好,该任务将于3天后到期,请及时查看处理,谢谢!");
|
||||
feishuMsgVo.setCnContentLower("项目: " + PRN +
|
||||
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
|
||||
"\n发起人: 系统通知");
|
||||
feishuMsgVo.setEnContentUpper("Hello! This task will expire in 3 days. Please check and address it in a timely manner. Thank you!");
|
||||
feishuMsgVo.setEnContentLower("Project:" + PRN +
|
||||
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
|
||||
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
|
||||
feishuMsgVo.setUrl(hrefFeishu);
|
||||
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
|
||||
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
|
||||
} catch (IOException e) {
|
||||
log.error("飞书消息推送失败");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!currentDaysMap.isEmpty()) {
|
||||
for (String key : currentDaysMap.keySet()) {
|
||||
String[] ids = currentDaysMap.get(key).split(",");
|
||||
List<String> thirdIdList = new ArrayList<>();
|
||||
List<SysUser> sysUsers = sysUserService.listByIds(Arrays.asList(ids));
|
||||
if (ObjectUtils.isNotEmpty(sysUsers)) {
|
||||
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
|
||||
}
|
||||
//法规中英文
|
||||
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
|
||||
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
|
||||
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发起人: 系统通知");
|
||||
feishuMsgVo.setEnContentUpper("Hello! This task will expire today. Please check and address the task ASAP. Thank you!");
|
||||
feishuMsgVo.setEnContentLower("Project:" + PRN +
|
||||
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
|
||||
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
|
||||
feishuMsgVo.setUrl(hrefFeishu);
|
||||
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
|
||||
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
|
||||
} catch (IOException e) {
|
||||
log.error("飞书消息推送失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!overdueMap.isEmpty()) {
|
||||
for (String key : overdueMap.keySet()) {
|
||||
String[] ids = overdueMap.get(key).split(",");
|
||||
List<String> thirdIdList = new ArrayList<>();
|
||||
List<SysUser> sysUsers = sysUserService.listByIds(Arrays.asList(ids));
|
||||
if (ObjectUtils.isNotEmpty(sysUsers)) {
|
||||
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
|
||||
}
|
||||
//法规中英文
|
||||
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
|
||||
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
|
||||
|
||||
String dueDate = sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate());
|
||||
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! This task is overdue. Please address it 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.YELLOW.getValue()); // 颜色
|
||||
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
|
||||
} catch (IOException e) {
|
||||
log.error("飞书消息推送失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.info("任务确认流程,定时任务结束 =====================================================");
|
||||
}
|
||||
}
|
||||
+112
-13
@@ -235,6 +235,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
@Autowired
|
||||
private IFeishuService feishuService;
|
||||
|
||||
@Autowired
|
||||
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
@@ -2459,7 +2462,10 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
|
||||
ProjectLibraryBase LibraryBase = projectLibraryBaseService.queryById(projectLibraryId, CutEnum.CN.getValue()).get(0);
|
||||
String PRN = LibraryBase.getProjectName();//项目名称
|
||||
String LAW = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle();//法规
|
||||
String LAW_CN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle();//法规
|
||||
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
|
||||
String LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_START_MSG.getValue())) {
|
||||
@@ -2476,6 +2482,21 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
|
||||
initiator = studioUserInfo.getUsername();
|
||||
initiatorLark = studioUserInfo.getUsername();
|
||||
|
||||
msgTitle = MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn();
|
||||
cnContentUpper = "您好,请及时查看处理此项任务,谢谢!";
|
||||
cnContentLower = "项目: " + PRN +
|
||||
"\n法规: " + LAW_CN +
|
||||
"\n发起人: " + initiatorLark +
|
||||
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
|
||||
enContentUpper = "Hello! Please check and address the task in a timely manner. Thank you!";
|
||||
enContentLower = "Project: " + PRN +
|
||||
"\nRegulation No: " + LAW_EN +
|
||||
"\nInitiator: " + initiatorLark +
|
||||
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
|
||||
color = MsgColorEnum.GREEN.getValue();
|
||||
|
||||
|
||||
} else if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_ISSUE_DRE_MSG.getValue())) {
|
||||
String dreUserId = jsonObject.getString("dreUserId"); //dre用户id
|
||||
userIdList.add(dreUserId);
|
||||
@@ -2491,6 +2512,21 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
|
||||
initiator = studioUserInfo.getUsername();
|
||||
initiatorLark = studioUserInfo.getUsername();
|
||||
|
||||
|
||||
msgTitle = MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn();
|
||||
cnContentUpper = "您好,"+ sysUser.getUsername() +"向您询问意见,请及时查看处理";
|
||||
cnContentLower = "项目: " + PRN +
|
||||
"\n法规: " + LAW_CN +
|
||||
"\n发起人: " + sysUser.getUsername() +
|
||||
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
|
||||
enContentUpper = "Hello! "+ sysUser.getUsername() +" asked you for opinion. Please check and address it in a timely manner";
|
||||
enContentLower = "Project: " + PRN +
|
||||
"\nRegulation No: " + LAW_EN +
|
||||
"\nInitiator: " + sysUser.getUsername() +
|
||||
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
|
||||
color = MsgColorEnum.GREEN.getValue();
|
||||
|
||||
} else if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_DRE_REJECTED.getValue())) {
|
||||
userIdList.add(engineeringInterfacePerson);
|
||||
//msgContentEN = sysUser.getUsername() + " has rejected the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
|
||||
@@ -2505,6 +2541,20 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
|
||||
initiator = studioUserInfo.getUsername();
|
||||
initiatorLark = studioUserInfo.getUsername();
|
||||
|
||||
msgTitle = MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn();
|
||||
cnContentUpper = "您好,该任务被"+ sysUser.getUsername() +"退回,请及时查看处理";
|
||||
cnContentLower = "项目: " + PRN +
|
||||
"\n法规: " + LAW_CN +
|
||||
"\n发起人: " + sysUser.getUsername() +
|
||||
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
|
||||
enContentUpper = "Hello! This task is rejected by "+ sysUser.getUsername() +". Please check and address it in a timely manner";
|
||||
enContentLower = "Project: " + PRN +
|
||||
"\nRegulation No: " + LAW_EN +
|
||||
"\nInitiator: " + sysUser.getUsername() +
|
||||
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
|
||||
color = MsgColorEnum.GREEN.getValue();
|
||||
|
||||
} else if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_DRE_ACCEPTED.getValue())) {
|
||||
userIdList.add(engineeringInterfacePerson);
|
||||
//msgContentEN = sysUser.getUsername() + " has submitted the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
|
||||
@@ -2519,6 +2569,21 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
|
||||
initiator = studioUserInfo.getUsername();
|
||||
initiatorLark = studioUserInfo.getUsername();
|
||||
|
||||
msgTitle = MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn();
|
||||
cnContentUpper = "您好,"+ sysUser.getUsername() +"已向您提交回复,请及时查看处理";
|
||||
cnContentLower = "项目: " + PRN +
|
||||
"\n法规: " + LAW_CN +
|
||||
"\n发起人: " + sysUser.getUsername() +
|
||||
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
|
||||
enContentUpper = "Hello! "+ sysUser.getUsername() +" has replied to you. Please check and address it in a timely manner";
|
||||
enContentLower = "Project: " + PRN +
|
||||
"\nRegulation No: " + LAW_EN +
|
||||
"\nInitiator: " + sysUser.getUsername() +
|
||||
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
|
||||
color = MsgColorEnum.GREEN.getValue();
|
||||
|
||||
|
||||
} else if(StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_REJECTED_MSG.getValue())){
|
||||
userIdList.add(projectLibraryBase.getStudioEngineer());
|
||||
//msgContentEN = sysUser.getUsername() + " has rejected the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
|
||||
@@ -2533,7 +2598,22 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
|
||||
initiator = studioUserInfo.getUsername();
|
||||
initiatorLark = studioUserInfo.getUsername();
|
||||
} else if(StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_ACCEPTED_MSG.getValue())){
|
||||
|
||||
msgTitle = MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn();
|
||||
cnContentUpper = "您好,该任务被"+ sysUser.getUsername() +"拒绝,请及时查看处理";
|
||||
cnContentLower = "项目: " + PRN +
|
||||
"\n法规: " + LAW_CN +
|
||||
"\n发起人: " + sysUser.getUsername() +
|
||||
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
|
||||
enContentUpper = "Hello! This task is rejected by "+ sysUser.getUsername() +". Please check and address it in a timely manner";
|
||||
enContentLower = "Project: " + PRN +
|
||||
"\nRegulation No: " + LAW_EN +
|
||||
"\nInitiator: " + sysUser.getUsername() +
|
||||
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
|
||||
color = MsgColorEnum.RED.getValue();
|
||||
|
||||
|
||||
} /*else if(StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_ACCEPTED_MSG.getValue())){
|
||||
userIdList.add(projectLibraryBase.getStudioEngineer());
|
||||
//msgContentEN = sysUser.getUsername() + " has accepted the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
|
||||
// + ". Please check and handle it in time.";
|
||||
@@ -2547,7 +2627,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
|
||||
initiator = studioUserInfo.getUsername();
|
||||
initiatorLark = studioUserInfo.getUsername();
|
||||
} else if(StringUtils.equals(msgType, MsgTypeEnum.DESIGN_START_MSG.getValue())){
|
||||
} */else if(StringUtils.equals(msgType, MsgTypeEnum.DESIGN_START_MSG.getValue())){
|
||||
String designDutyId = jsonObject.getString("designDutyId"); //设计符合性责任人id
|
||||
userIdList.add(designDutyId);
|
||||
//msgContentEN = "You recieved the design compliance task of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
|
||||
@@ -2606,12 +2686,12 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
msgTitle = MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getEn();
|
||||
cnContentUpper = "您好,请及时查看处理此项任务,谢谢!";
|
||||
cnContentLower = "项目: " + PRN +
|
||||
"\n法规: " + LAW +
|
||||
"\n法规: " + LAW_CN +
|
||||
"\n发起人: " + initiatorLark +
|
||||
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
|
||||
enContentUpper = "Hello! Please check and address the task in a timely manner. Thank you!";
|
||||
enContentLower = "Project: " + PRN +
|
||||
"\nRegulation No: " + LAW +
|
||||
"\nRegulation No: " + LAW_EN +
|
||||
"\nInitiator: " + initiatorLark +
|
||||
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
|
||||
color = MsgColorEnum.GREEN.getValue();
|
||||
@@ -2740,7 +2820,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
//飞书跳转链接
|
||||
String hrefFeishu = "";
|
||||
//系统内部跳转链接
|
||||
String href = "";
|
||||
//String href = "";
|
||||
if(StringUtils.equals(msgType,MsgTypeEnum.TASK_AFFIRM_START_MSG.getValue())
|
||||
||StringUtils.equals(msgType,MsgTypeEnum.TASK_AFFIRM_ISSUE_DRE_MSG.getValue())
|
||||
||StringUtils.equals(msgType,MsgTypeEnum.TASK_AFFIRM_DRE_REJECTED.getValue())
|
||||
@@ -2750,7 +2830,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
{
|
||||
hrefFeishu = backUrl
|
||||
+ JumpLinkEnum.TASK_AFFIRM_LINK.getLink();
|
||||
href = "<a href='" + JumpLinkEnum.TASK_AFFIRM_LINK.getLink() + "'>" + " View details" + "</a>";
|
||||
//href = "<a href='" + JumpLinkEnum.TASK_AFFIRM_LINK.getLink() + "'>" + " View details" + "</a>";
|
||||
}else if(StringUtils.equals(msgType,MsgTypeEnum.DESIGN_START_MSG.getValue())
|
||||
||StringUtils.equals(msgType,MsgTypeEnum.PREHOMO_START_MSG.getValue())
|
||||
||StringUtils.equals(msgType,MsgTypeEnum.VERIFY_START_MSG.getValue())
|
||||
@@ -2768,12 +2848,12 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
|
||||
+ projectYearNameInfoEO.getYearName()
|
||||
+ projectLibraryBase.getTargetMarket();
|
||||
href = "<a href='"
|
||||
+ JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
|
||||
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
|
||||
+ projectYearNameInfoEO.getYearName()
|
||||
+ projectLibraryBase.getTargetMarket()
|
||||
+ "'>" + " View details" + "</a>";
|
||||
//href = "<a href='"
|
||||
// + JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
|
||||
// + "&projectName=" + projectNameInfoEO.getProjectName() + "-"
|
||||
// + projectYearNameInfoEO.getYearName()
|
||||
// + projectLibraryBase.getTargetMarket()
|
||||
// + "'>" + " View details" + "</a>";
|
||||
}
|
||||
|
||||
//String contentInfo = msgContentEN + " " + href;
|
||||
@@ -2783,6 +2863,25 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
|
||||
//发送消息
|
||||
//sendMessage(msgTitle, msgContentEN,userIdList,id,sendMessageMap, feishuMsgVo, messageTypeEnum,initiator);
|
||||
|
||||
List<SysUser> sysUsers = sysUserService.listByIds(userIdList);
|
||||
List<String> thirdIdList = new ArrayList<>();
|
||||
if(CollectionUtils.isNotEmpty(sysUsers)){
|
||||
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
|
||||
}
|
||||
try {
|
||||
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
|
||||
feishuMsgVo.setTitle(msgTitle);
|
||||
feishuMsgVo.setCnContentUpper(cnContentUpper);
|
||||
feishuMsgVo.setCnContentLower(cnContentLower);
|
||||
feishuMsgVo.setEnContentUpper(enContentUpper);
|
||||
feishuMsgVo.setEnContentLower(enContentLower);
|
||||
feishuMsgVo.setUrl(hrefFeishu);
|
||||
feishuMsgVo.setColor(color); // 颜色
|
||||
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
|
||||
} catch (IOException e) {
|
||||
log.error("飞书消息推送失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user