preHomo、验证符合性定时任务

This commit is contained in:
CD
2022-11-02 15:18:00 +08:00
parent 02a8dcca28
commit 6500ed6a4e
4 changed files with 484 additions and 183 deletions
@@ -1,7 +1,13 @@
package com.jero.modules.project.job; package com.jero.modules.project.job;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.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.feishu.vo.FeishuMsgVo;
import com.jero.modules.project.entity.*; import com.jero.modules.project.entity.*;
import com.jero.modules.project.enums.DesignComplianceStatusEnum; import com.jero.modules.project.enums.DesignComplianceStatusEnum;
@@ -14,8 +20,11 @@ import com.jero.modules.project.mapper.ProjectNameInfoEOMapper;
import com.jero.modules.project.mapper.ProjectYearNameInfoEOMapper; import com.jero.modules.project.mapper.ProjectYearNameInfoEOMapper;
import com.jero.modules.project.service.IProjectLawsInventoryEOService; import com.jero.modules.project.service.IProjectLawsInventoryEOService;
import com.jero.modules.project.service.IProjectTaskInventoryEOService; import com.jero.modules.project.service.IProjectTaskInventoryEOService;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
@@ -23,6 +32,7 @@ import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -53,6 +63,13 @@ public class PrehomoJob implements Job {
@Value(value = "${jero.backUrl}") @Value(value = "${jero.backUrl}")
private String backUrl; private String backUrl;
@Autowired
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
@Autowired
private ISysUserService sysUserService;
@Autowired
private IFeishuService feishuService;
@Override @Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
log.info("prehomo流程,定时任务开启 ====================================================="); log.info("prehomo流程,定时任务开启 =====================================================");
@@ -60,7 +77,10 @@ public class PrehomoJob implements Job {
//查询出已经启动了prehomo流程的数据。 并且流程没有结束。 //查询出已经启动了prehomo流程的数据。 并且流程没有结束。
QueryWrapper<ProjectTaskInventoryEO> queryProjectTaskInventoryWrapper = new QueryWrapper<>(); QueryWrapper<ProjectTaskInventoryEO> queryProjectTaskInventoryWrapper = new QueryWrapper<>();
queryProjectTaskInventoryWrapper.isNotNull("prehomo_p_id"); queryProjectTaskInventoryWrapper.isNotNull("prehomo_p_id");
queryProjectTaskInventoryWrapper.lambda().ne(ProjectTaskInventoryEO::getPrehomoStatus, DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue()); List<String> status = new ArrayList<>();
status.add(DesignComplianceStatusEnum.TO_SUBMIT.getValue());
status.add(DesignComplianceStatusEnum.REVIEW_THE_RETURN.getValue());
queryProjectTaskInventoryWrapper.lambda().in(ProjectTaskInventoryEO::getPrehomoStatus, status);
List<ProjectTaskInventoryEO> projectTaskInventoryEOList = projectTaskInventoryEOService.getBaseMapper().selectList(queryProjectTaskInventoryWrapper); List<ProjectTaskInventoryEO> projectTaskInventoryEOList = projectTaskInventoryEOService.getBaseMapper().selectList(queryProjectTaskInventoryWrapper);
if(CollectionUtils.isNotEmpty(projectTaskInventoryEOList)){ if(CollectionUtils.isNotEmpty(projectTaskInventoryEOList)){
@@ -81,15 +101,24 @@ public class PrehomoJob implements Job {
Date currentDate = new Date(); Date currentDate = new Date();
//获取后三天前的时间 //两周
Calendar calendar=new GregorianCalendar(); Calendar twoWeeksLaterCalendar=new GregorianCalendar();
calendar.setTime(new Date()); twoWeeksLaterCalendar.setTime(new Date());
calendar.add(Calendar.DATE,3); twoWeeksLaterCalendar.add(Calendar.DATE,14);
Date threeDays = calendar.getTime(); Date twoWeeksLaterDays = twoWeeksLaterCalendar.getTime();
String twoWeeksLaterDaysStr = sdf.format(twoWeeksLaterDays);
String threeDaysStr = sdf.format(threeDays); //一周
Calendar oneWeekLaterCalendar=new GregorianCalendar();
oneWeekLaterCalendar.setTime(new Date());
oneWeekLaterCalendar.add(Calendar.DATE,7);
Date oneWeekLaterDays = oneWeekLaterCalendar.getTime();
String oneWeekLaterDaysStr = sdf.format(oneWeekLaterDays);
//当天
String currentDateStr = sdf.format(currentDate); String currentDateStr = sdf.format(currentDate);
String msgTitle = MessageType2Enum.PRE_HOMO_CONFIRMATION.getCn() + "/" + MessageType2Enum.PRE_HOMO_CONFIRMATION.getEn();
for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseList) { for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseList) {
QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>(); QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>();
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId()); projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId());
@@ -99,115 +128,234 @@ public class PrehomoJob implements Job {
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId()); projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId());
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper); ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
//项目名称
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;
for (ProjectLawsInventoryEO projectLawsInventoryEO: projectLawsInventoryEOList) { for (ProjectLawsInventoryEO projectLawsInventoryEO: projectLawsInventoryEOList) {
List<String> threeDaysUserIdList = new ArrayList<>();
List<String> currentDaysUserIdList = new ArrayList<>();
for (ProjectTaskInventoryEO projectTaskInventoryEO : projectTaskInventoryEOList) { //法规中英文
if(StringUtils.equals(projectTaskInventoryEO.getProjectLawsInventoryId(),projectLawsInventoryEO.getId())){ String LAW_CN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle();//法规
if(projectLawsInventoryEO.getPrehomoDueDate() != null){ BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
//如果prehomo - 结束日期是当前日期 String LAW_EN = "";
if(StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getPrehomoDueDate()))){ if (ObjectUtils.isEmpty(bussDocumentLibraryEO)) {
if(StringUtils.isEmpty(projectTaskInventoryEO.getPrehomoSendMsgFlag())){ LAW_EN = LAW_CN;
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())){ } else {
currentDaysUserIdList.add(projectLawsInventoryEO.getPrehomoDutyId()); LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规
}if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoInitiatorId())){ }
currentDaysUserIdList.add(projectLawsInventoryEO.getPrehomoInitiatorId());
} List<String> twoWeeksLaterUserIdList = new ArrayList<>();
projectTaskInventoryEO.setPrehomoSendMsgFlag(SendMsgFlagEnum.FALSE.getValue()); List<String> oneWeeksLaterUserIdList = new ArrayList<>();
projectTaskInventoryEOService.updateById(projectTaskInventoryEO); List<String> currentDaysUserIdList = new ArrayList<>();
} List<String> dueUserIdList = new ArrayList<>();
if(StringUtils.equals(projectLawsInventoryEO.getProjectLibraryId(),projectLibraryBase.getId())){
if(projectLawsInventoryEO.getPrehomoDueDate() != null){
//如果prehomo - 结束日期是当前日期
if(StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getPrehomoDueDate()))){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())){
currentDaysUserIdList.add(projectLawsInventoryEO.getPrehomoDutyId());
} }
//如果prehomo - 结束日期是三天后的日期 }
if(StringUtils.equals(threeDaysStr,sdf.format(projectLawsInventoryEO.getPrehomoDueDate()))){ //如果prehomo - 结束日期是两周后的日期
if(StringUtils.isEmpty(projectTaskInventoryEO.getPrehomoSendMsgCurrentFlag())){ if(StringUtils.equals(twoWeeksLaterDaysStr,sdf.format(projectLawsInventoryEO.getPrehomoDueDate()))){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())){ if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())){
threeDaysUserIdList.add(projectLawsInventoryEO.getPrehomoDutyId()); twoWeeksLaterUserIdList.add(projectLawsInventoryEO.getPrehomoDutyId());
}if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoInitiatorId())){ }
threeDaysUserIdList.add(projectLawsInventoryEO.getPrehomoInitiatorId()); }
} //如果prehomo - 结束日期是一周后的日期
projectTaskInventoryEO.setPrehomoSendMsgCurrentFlag(SendMsgFlagEnum.FALSE.getValue()); if(StringUtils.equals(oneWeekLaterDaysStr,sdf.format(projectLawsInventoryEO.getDesignDueDate()))){
projectTaskInventoryEOService.updateById(projectTaskInventoryEO); if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())){
} oneWeeksLaterUserIdList.add(projectLawsInventoryEO.getDesignDutyId());
}
}
//如果prehomo - 逾期后每天通知
if (projectLawsInventoryEO.getDesignDueDate().before(currentDate)) {
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getDesignDutyId())){
dueUserIdList.add(projectLawsInventoryEO.getDesignDutyId());
} }
} }
} }
} }
if(CollectionUtils.isNotEmpty(threeDaysUserIdList)){
threeDaysUserIdList = threeDaysUserIdList.stream().distinct().collect(Collectors.toList()); String hrefFeishu = backUrl
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName();
if (ObjectUtils.isNotEmpty(dueUserIdList)) {
dueUserIdList = dueUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(dueUserIdList);
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("您好,您的任务已逾期,请尽快查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知"+
"\n截止时间: "+ sdf.format(projectLawsInventoryEO.getDesignDueDate()));
feishuMsgVo.setEnContentUpper("Hello! Your task is overdue. Please check and address it ASAP");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName()+
"\nDue Date: "+ sdf.format(projectLawsInventoryEO.getDesignDueDate()));
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.YELLOW.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
if (ObjectUtils.isNotEmpty(oneWeeksLaterUserIdList)) {
oneWeeksLaterUserIdList = oneWeeksLaterUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(oneWeeksLaterUserIdList);
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("您好,您的任务将于7天后结束,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! Your task will end in 7 days. Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\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(CollectionUtils.isNotEmpty(twoWeeksLaterUserIdList)){
twoWeeksLaterUserIdList = twoWeeksLaterUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(twoWeeksLaterUserIdList);
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("您好,您的任务将于14天后结束,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! Your task will end in 14 days. Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\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("飞书消息推送失败");
}
//您XXX(项目名称)中GB 7258的Pre-Homo确认剩余处理时间还有3天,请及时查看处理 //您XXX(项目名称)中GB 7258的Pre-Homo确认剩余处理时间还有3天,请及时查看处理
//The remaining processing time for the Pre-Homo confirmation of GB 7258 in XXX (project name) is 3 days. Please check and handle it in time. //The remaining processing time for the Pre-Homo confirmation of GB 7258 in XXX (project name) is 3 days. Please check and handle it in time.
String msgContentEN = "The remaining processing time for the Pre-Homo confirmation of " //String msgContentEN = "The remaining processing time for the Pre-Homo confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-" // + projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()+ " " // + projectYearNameInfoEO.getYearName()+ " "
+ projectLibraryBase.getTargetMarket() // + projectLibraryBase.getTargetMarket()
+ " are 3 days. Please check and handle it in time."; // + " are 3 days. Please check and handle it in time.";
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket() //String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
+ ": You have a Pre-Homo task to complete"; // + ": You have a Pre-Homo task to complete";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo(); //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.setContent("Hello! The remaining processing time for the task are 3 days. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Pre-Homo Confirmation"); //feishuMsgVo.setTaskType("Pre-Homo Confirmation");
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber()); //feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()); //feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//飞书跳转链接 //飞书跳转链接
String hrefFeishu = backUrl //String hrefFeishu = backUrl
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink() // + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId() // + projectLibraryBase.getId()
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType() // + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName(); // + "&projectName=" + projectNameInfoEO.getProjectName();
//系统内部跳转链接 //系统内部跳转链接
String href = "<a href='" //String href = "<a href='"
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType() // + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() // + "&projectName=" + projectNameInfoEO.getProjectName()
+ "'>" + " View details" + "</a>"; // + "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href; //String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>(); // Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu); //sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo); //sendMessageMap.put("contentInfo",contentInfo);
//发送消息 //发送消息
projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,threeDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName()); //projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,threeDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
} }
if(CollectionUtils.isNotEmpty(currentDaysUserIdList)){ if(CollectionUtils.isNotEmpty(currentDaysUserIdList)){
currentDaysUserIdList = currentDaysUserIdList.stream().distinct().collect(Collectors.toList()); currentDaysUserIdList = currentDaysUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(currentDaysUserIdList);
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("您好,您的任务将于今天到期,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! Your task will expire today. Please check and address it ASAP");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\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("飞书消息推送失败");
}
//您XXX(项目名称)中GB 7258的Pre-Homo确认任务今天即将结束,请及时查看处理 //您XXX(项目名称)中GB 7258的Pre-Homo确认任务今天即将结束,请及时查看处理
//The the Pre-Homo confirmation of GB 7258 in XXX (project name) is coming to an end today. Please check and deal with it in time //The the Pre-Homo confirmation of GB 7258 in XXX (project name) is coming to an end today. Please check and deal with it in time
String msgContentEN = "The the Pre-Homo confirmation of " //String msgContentEN = "The the Pre-Homo confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() // + projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ " will expire today. Please check and address it in time."; // + " will expire today. Please check and address it in time.";
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket() //String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
+ ": You have a Pre-Homo task to complete"; // + ": You have a Pre-Homo task to complete";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo(); //FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner."); //feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Pre-Homo Confirmation"); //feishuMsgVo.setTaskType("Pre-Homo Confirmation");
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber()); //feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()); //feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//飞书跳转链接 //飞书跳转链接
String hrefFeishu = backUrl // String hrefFeishu = backUrl
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink() // + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId() // + projectLibraryBase.getId()
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType() // + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName(); // + "&projectName=" + projectNameInfoEO.getProjectName();
//系统内部跳转链接 //系统内部跳转链接
String href = "<a href='" //String href = "<a href='"
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType() // + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() // + "&projectName=" + projectNameInfoEO.getProjectName()
+ "'>" + " View details" + "</a>"; // + "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href; //String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>(); //Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu); //sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo); //sendMessageMap.put("contentInfo",contentInfo);
//发送消息 //发送消息
projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,currentDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName()); //projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,currentDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
} }
} }
} }
@@ -1,7 +1,13 @@
package com.jero.modules.project.job; package com.jero.modules.project.job;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.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.feishu.vo.FeishuMsgVo;
import com.jero.modules.project.entity.*; import com.jero.modules.project.entity.*;
import com.jero.modules.project.enums.DesignComplianceStatusEnum; import com.jero.modules.project.enums.DesignComplianceStatusEnum;
@@ -13,8 +19,11 @@ import com.jero.modules.project.mapper.ProjectNameInfoEOMapper;
import com.jero.modules.project.mapper.ProjectYearNameInfoEOMapper; import com.jero.modules.project.mapper.ProjectYearNameInfoEOMapper;
import com.jero.modules.project.service.IProjectLawsInventoryEOService; import com.jero.modules.project.service.IProjectLawsInventoryEOService;
import com.jero.modules.project.service.IProjectTaskInventoryEOService; import com.jero.modules.project.service.IProjectTaskInventoryEOService;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
@@ -22,6 +31,7 @@ import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -52,13 +62,23 @@ public class VerifyComplianceJob implements Job {
@Value(value = "${jero.backUrl}") @Value(value = "${jero.backUrl}")
private String backUrl; private String backUrl;
@Autowired
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
@Autowired
private ISysUserService sysUserService;
@Autowired
private IFeishuService feishuService;
@Override @Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
log.info("验证符合性流程,定时任务开启 ====================================================="); log.info("验证符合性流程,定时任务开启 =====================================================");
//查询出已经启动了验证符合性流程的数据。 并且流程没有结束。 //查询出已经启动了验证符合性流程的数据。 并且流程没有结束。
QueryWrapper<ProjectTaskInventoryEO> queryProjectTaskInventoryWrapper = new QueryWrapper<>(); QueryWrapper<ProjectTaskInventoryEO> queryProjectTaskInventoryWrapper = new QueryWrapper<>();
queryProjectTaskInventoryWrapper.isNotNull("verify_p_id"); queryProjectTaskInventoryWrapper.isNotNull("verify_p_id");
queryProjectTaskInventoryWrapper.lambda().ne(ProjectTaskInventoryEO::getVerifyStatus, DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue()); List<String> status = new ArrayList<>();
status.add(DesignComplianceStatusEnum.TO_SUBMIT.getValue());
status.add(DesignComplianceStatusEnum.REVIEW_THE_RETURN.getValue());
queryProjectTaskInventoryWrapper.lambda().in(ProjectTaskInventoryEO::getVerifyStatus, status);
List<ProjectTaskInventoryEO> projectTaskInventoryEOList = projectTaskInventoryEOService.getBaseMapper().selectList(queryProjectTaskInventoryWrapper); List<ProjectTaskInventoryEO> projectTaskInventoryEOList = projectTaskInventoryEOService.getBaseMapper().selectList(queryProjectTaskInventoryWrapper);
if(CollectionUtils.isNotEmpty(projectTaskInventoryEOList)){ if(CollectionUtils.isNotEmpty(projectTaskInventoryEOList)){
@@ -79,15 +99,24 @@ public class VerifyComplianceJob implements Job {
Date currentDate = new Date(); Date currentDate = new Date();
//获取后三天前的时间 //两周
Calendar calendar=new GregorianCalendar(); Calendar twoWeeksLaterCalendar=new GregorianCalendar();
calendar.setTime(new Date()); twoWeeksLaterCalendar.setTime(new Date());
calendar.add(Calendar.DATE,3); twoWeeksLaterCalendar.add(Calendar.DATE,14);
Date threeDays = calendar.getTime(); Date twoWeeksLaterDays = twoWeeksLaterCalendar.getTime();
String twoWeeksLaterDaysStr = sdf.format(twoWeeksLaterDays);
String threeDaysStr = sdf.format(threeDays); //一周
Calendar oneWeekLaterCalendar=new GregorianCalendar();
oneWeekLaterCalendar.setTime(new Date());
oneWeekLaterCalendar.add(Calendar.DATE,7);
Date oneWeekLaterDays = oneWeekLaterCalendar.getTime();
String oneWeekLaterDaysStr = sdf.format(oneWeekLaterDays);
//当天
String currentDateStr = sdf.format(currentDate); String currentDateStr = sdf.format(currentDate);
String msgTitle = MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getEn();
for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseList) { for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseList) {
QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>(); QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>();
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId()); projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId());
@@ -97,114 +126,235 @@ public class VerifyComplianceJob implements Job {
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId()); projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId());
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper); ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
for (ProjectLawsInventoryEO projectLawsInventoryEO: projectLawsInventoryEOList) { //项目名称
List<String> threeDaysUserIdList = new ArrayList<>(); String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getProjectVersion())) ? "00" : projectLibraryBase.getProjectVersion();
List<String> currentDaysUserIdList = new ArrayList<>(); String projectName = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectVersion;
for (ProjectTaskInventoryEO projectTaskInventoryEO : projectTaskInventoryEOList) {
if(StringUtils.equals(projectTaskInventoryEO.getProjectLawsInventoryId(),projectLawsInventoryEO.getId())){ for (ProjectLawsInventoryEO projectLawsInventoryEO: projectLawsInventoryEOList) {
if(projectLawsInventoryEO.getVerifyDueDate() != null){
//如果验证符合性 - 结束日期是当前日期 //法规中英文
if(StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getVerifyDueDate()))){ String LAW_CN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle();//法规
if(StringUtils.isEmpty(projectTaskInventoryEO.getVerifySendMsgFlag())){ BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){ String LAW_EN = "";
currentDaysUserIdList.add(projectLawsInventoryEO.getVerifyDutyId()); if (ObjectUtils.isEmpty(bussDocumentLibraryEO)) {
}if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyInitiatorId())){ LAW_EN = LAW_CN;
currentDaysUserIdList.add(projectLawsInventoryEO.getVerifyInitiatorId()); } else {
} LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规
projectTaskInventoryEO.setVerifySendMsgFlag(SendMsgFlagEnum.FALSE.getValue()); }
projectTaskInventoryEOService.updateById(projectTaskInventoryEO);
} List<String> twoWeeksLaterUserIdList = new ArrayList<>();
List<String> oneWeeksLaterUserIdList = new ArrayList<>();
List<String> currentDaysUserIdList = new ArrayList<>();
List<String> dueUserIdList = new ArrayList<>();
if(StringUtils.equals(projectLawsInventoryEO.getProjectLibraryId(),projectLibraryBase.getId())){
if(projectLawsInventoryEO.getVerifyDueDate() != null){
//如果验证符合性 - 结束日期是当前日期
if(StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getVerifyDueDate()))){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){
currentDaysUserIdList.add(projectLawsInventoryEO.getVerifyDutyId());
} }
//如果验证符合性 - 结束日期是三天后的日期 }
if(StringUtils.equals(threeDaysStr,sdf.format(projectLawsInventoryEO.getVerifyDueDate()))){ //如果验证符合性 - 结束日期是两周后的日期
if(StringUtils.isEmpty(projectTaskInventoryEO.getVerifySendMsgCurrentFlag())){ if(StringUtils.equals(twoWeeksLaterDaysStr,sdf.format(projectLawsInventoryEO.getVerifyDueDate()))){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){ if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){
threeDaysUserIdList.add(projectLawsInventoryEO.getVerifyDutyId()); currentDaysUserIdList.add(projectLawsInventoryEO.getVerifyDutyId());
}if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyInitiatorId())){ }
threeDaysUserIdList.add(projectLawsInventoryEO.getVerifyInitiatorId()); }
} //如果验证符合性 - 结束日期是一周后的日期
projectTaskInventoryEO.setVerifySendMsgCurrentFlag(SendMsgFlagEnum.FALSE.getValue()); if(StringUtils.equals(oneWeekLaterDaysStr,sdf.format(projectLawsInventoryEO.getVerifyDueDate()))){
projectTaskInventoryEOService.updateById(projectTaskInventoryEO); if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){
} oneWeeksLaterUserIdList.add(projectLawsInventoryEO.getVerifyDutyId());
}
}
//如果验证符合性 - 逾期后每天通知
if (projectLawsInventoryEO.getVerifyDueDate().before(currentDate)) {
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){
dueUserIdList.add(projectLawsInventoryEO.getVerifyDutyId());
} }
} }
} }
} }
if(CollectionUtils.isNotEmpty(threeDaysUserIdList)){
threeDaysUserIdList = threeDaysUserIdList.stream().distinct().collect(Collectors.toList()); String hrefFeishu = backUrl
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName();
if (ObjectUtils.isNotEmpty(dueUserIdList)) {
dueUserIdList = dueUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(dueUserIdList);
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("您好,您的任务已逾期,请尽快查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知"+
"\n截止时间: "+ sdf.format(projectLawsInventoryEO.getDesignDueDate()));
feishuMsgVo.setEnContentUpper("Hello! Your task is overdue. Please check and address it ASAP");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName()+
"\nDue Date: "+ sdf.format(projectLawsInventoryEO.getDesignDueDate()));
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.YELLOW.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
if (ObjectUtils.isNotEmpty(oneWeeksLaterUserIdList)) {
oneWeeksLaterUserIdList = oneWeeksLaterUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(oneWeeksLaterUserIdList);
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("您好,您的任务将于7天后结束,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! Your task will end in 7 days. Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\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(CollectionUtils.isNotEmpty(twoWeeksLaterUserIdList)){
twoWeeksLaterUserIdList = twoWeeksLaterUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(twoWeeksLaterUserIdList);
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("您好,您的任务将于14天后结束,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! Your task will end in 14 days. Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\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("飞书消息推送失败");
}
//您XXX(项目名称)中GB 7258的验证符合性确认剩余处理时间还有3天,请及时查看处理 //您XXX(项目名称)中GB 7258的验证符合性确认剩余处理时间还有3天,请及时查看处理
//The remaining processing time for the Verify compliance confirmation of GB 7258 in XXX (project name) is 3 days. Please check and handle it in time. //The remaining processing time for the Verify compliance confirmation of GB 7258 in XXX (project name) is 3 days. Please check and handle it in time.
String msgContentEN = "The remaining processing time for the validation compliance confirmation of " //String msgContentEN = "The remaining processing time for the validation compliance confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-" // + projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()+ " " // + projectYearNameInfoEO.getYearName()+ " "
+ projectLibraryBase.getTargetMarket() // + projectLibraryBase.getTargetMarket()
+ " are 3 days. Please check and handle it in time."; // + " are 3 days. Please check and handle it in time.";
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket() //String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
+ ": You have a validation compliance task to complete"; // + ": You have a validation compliance task to complete";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo(); // 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.setContent("Hello! The remaining processing time for the task are 3 days. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Validation Compliance Confirmation"); //feishuMsgVo.setTaskType("Validation Compliance Confirmation");
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()); //feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber()); //feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
//飞书跳转链接 //飞书跳转链接
String hrefFeishu = backUrl //String hrefFeishu = backUrl
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink() // + JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId() // + projectLibraryBase.getId()
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getType() // + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName(); // + "&projectName=" + projectNameInfoEO.getProjectName();
//系统内部跳转链接 //系统内部跳转链接
String href = "<a href='" //String href = "<a href='"
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType() // + JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() // + "&projectName=" + projectNameInfoEO.getProjectName()
+ "'>" + " View details" + "</a>"; // + "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href; //String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>(); //Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu); //sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo); //sendMessageMap.put("contentInfo",contentInfo);
//发送消息 //发送消息
projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,threeDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName()); //projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,threeDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
} }
if(CollectionUtils.isNotEmpty(currentDaysUserIdList)){ if(CollectionUtils.isNotEmpty(currentDaysUserIdList)){
currentDaysUserIdList = currentDaysUserIdList.stream().distinct().collect(Collectors.toList()); currentDaysUserIdList = currentDaysUserIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(currentDaysUserIdList);
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("您好,您的任务将于今天到期,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! Your task will expire today. Please check and address it ASAP");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + LAW_EN +
"\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("飞书消息推送失败");
}
//您XXX(项目名称)中GB 7258的验证符合性确认任务今天即将结束,请及时查看处理 //您XXX(项目名称)中GB 7258的验证符合性确认任务今天即将结束,请及时查看处理
//The the Verify compliance confirmation of GB 7258 in XXX (project name) is coming to an end today. Please check and deal with it in time //The the Verify compliance confirmation of GB 7258 in XXX (project name) is coming to an end today. Please check and deal with it in time
String msgContentEN = "The the validation compliance confirmation of " //String msgContentEN = "The the validation compliance confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() // + projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ " will expire today. Please check and address it in time."; // + " will expire today. Please check and address it in time.";
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket() //String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
+ ": You have a validation compliance task to complete"; // + ": You have a validation compliance task to complete";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo(); //FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner."); //feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Validation Compliance Confirmation"); //feishuMsgVo.setTaskType("Validation Compliance Confirmation");
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber()); // feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()); //feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//飞书跳转链接 //飞书跳转链接
String hrefFeishu = backUrl // String hrefFeishu = backUrl
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink() // + JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId() // + projectLibraryBase.getId()
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getType() // + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName(); // + "&projectName=" + projectNameInfoEO.getProjectName();
//系统内部跳转链接 //系统内部跳转链接
String href = "<a href='" //String href = "<a href='"
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType() // + JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() // + "&projectName=" + projectNameInfoEO.getProjectName()
+ "'>" + " View details" + "</a>"; // + "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href; // String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>(); // Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu); // sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo); // sendMessageMap.put("contentInfo",contentInfo);
//发送消息 //发送消息
projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,currentDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName()); // projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN,currentDaysUserIdList,projectLawsInventoryEO.getId(),sendMessageMap, feishuMsgVo, MessageTypeEnum.COMPLIANCE_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
} }
} }
} }
@@ -75,7 +75,10 @@ public class designComplianceJob implements Job {
//查询出已经启动了设计符合性流程的数据。 并且流程没有结束。 //查询出已经启动了设计符合性流程的数据。 并且流程没有结束。
QueryWrapper<ProjectTaskInventoryEO> queryProjectTaskInventoryWrapper = new QueryWrapper<>(); QueryWrapper<ProjectTaskInventoryEO> queryProjectTaskInventoryWrapper = new QueryWrapper<>();
queryProjectTaskInventoryWrapper.isNotNull("design_p_id"); queryProjectTaskInventoryWrapper.isNotNull("design_p_id");
queryProjectTaskInventoryWrapper.lambda().eq(ProjectTaskInventoryEO::getDesignStatus, DesignComplianceStatusEnum.TO_SUBMIT.getValue()); List<String> status = new ArrayList<>();
status.add(DesignComplianceStatusEnum.TO_SUBMIT.getValue());
status.add(DesignComplianceStatusEnum.REVIEW_THE_RETURN.getValue());
queryProjectTaskInventoryWrapper.lambda().in(ProjectTaskInventoryEO::getDesignStatus, status);
List<ProjectTaskInventoryEO> projectTaskInventoryEOList = projectTaskInventoryEOService.getBaseMapper().selectList(queryProjectTaskInventoryWrapper); List<ProjectTaskInventoryEO> projectTaskInventoryEOList = projectTaskInventoryEOService.getBaseMapper().selectList(queryProjectTaskInventoryWrapper);
if(CollectionUtils.isNotEmpty(projectTaskInventoryEOList)){ if(CollectionUtils.isNotEmpty(projectTaskInventoryEOList)){
@@ -211,7 +214,7 @@ public class designComplianceJob implements Job {
try { try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo(); FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle); feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper("您好,您的任务已逾期,请尽快处理"); feishuMsgVo.setCnContentUpper("您好,您的任务已逾期,请尽快查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName + feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + LAW_CN + "\n法规: " + LAW_CN +
"\n发起人: 系统通知"+ "\n发起人: 系统通知"+
@@ -9129,9 +9129,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if (DesignComplianceStatusEnum.TO_REVIEW.getValue().equals(list.get(0).getDesignStatus()) if (DesignComplianceStatusEnum.TO_REVIEW.getValue().equals(list.get(0).getDesignStatus())
||DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue().equals(list.get(0).getDesignStatus())) { ||DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue().equals(list.get(0).getDesignStatus())) {
if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) { if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) {
throw new JeroBootException(LAW_CN + "提交,无法催办"); throw new JeroBootException(LAW_CN + "经被确认,无法催办");
} else { } else {
throw new JeroBootException(LAW_EN + "is committedcan't be urged"); throw new JeroBootException(LAW_EN + "has been confirmedcan't be urged");
} }
} }
if (ObjectUtils.isNotEmpty(lawsInventoryEO.getDesignDutyId())) { if (ObjectUtils.isNotEmpty(lawsInventoryEO.getDesignDutyId())) {
@@ -9142,9 +9142,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if (DesignComplianceStatusEnum.TO_REVIEW.getValue().equals(list.get(0).getDesignStatus()) if (DesignComplianceStatusEnum.TO_REVIEW.getValue().equals(list.get(0).getDesignStatus())
||DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue().equals(list.get(0).getDesignStatus())) { ||DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue().equals(list.get(0).getDesignStatus())) {
if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) { if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) {
throw new JeroBootException(LAW_CN + "提交,无法催办"); throw new JeroBootException(LAW_CN + "经被确认,无法催办");
} else { } else {
throw new JeroBootException(LAW_EN + "is committedcan't be urged"); throw new JeroBootException(LAW_EN + "has been confirmedcan't be urged");
} }
} }
if (ObjectUtils.isNotEmpty(lawsInventoryEO.getPrehomoDutyId())) { if (ObjectUtils.isNotEmpty(lawsInventoryEO.getPrehomoDutyId())) {
@@ -9155,9 +9155,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if (DesignComplianceStatusEnum.TO_REVIEW.getValue().equals(list.get(0).getDesignStatus()) if (DesignComplianceStatusEnum.TO_REVIEW.getValue().equals(list.get(0).getDesignStatus())
||DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue().equals(list.get(0).getDesignStatus())) { ||DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue().equals(list.get(0).getDesignStatus())) {
if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) { if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) {
throw new JeroBootException(LAW_CN + "提交,无法催办"); throw new JeroBootException(LAW_CN + "经被确认,无法催办");
} else { } else {
throw new JeroBootException(LAW_EN + "is committedcan't be urged"); throw new JeroBootException(LAW_EN + "has been confirmedcan't be urged");
} }
} }
if (ObjectUtils.isNotEmpty(lawsInventoryEO.getVerifyDutyId())) { if (ObjectUtils.isNotEmpty(lawsInventoryEO.getVerifyDutyId())) {