preHomo、验证符合性定时任务
This commit is contained in:
+235
-87
@@ -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.*;
|
||||
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.service.IProjectLawsInventoryEOService;
|
||||
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 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;
|
||||
@@ -23,6 +32,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;
|
||||
@@ -53,6 +63,13 @@ public class PrehomoJob implements Job {
|
||||
@Value(value = "${jero.backUrl}")
|
||||
private String backUrl;
|
||||
|
||||
@Autowired
|
||||
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
@Autowired
|
||||
private IFeishuService feishuService;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
log.info("prehomo流程,定时任务开启 =====================================================");
|
||||
@@ -60,7 +77,10 @@ public class PrehomoJob implements Job {
|
||||
//查询出已经启动了prehomo流程的数据。 并且流程没有结束。
|
||||
QueryWrapper<ProjectTaskInventoryEO> queryProjectTaskInventoryWrapper = new QueryWrapper<>();
|
||||
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);
|
||||
|
||||
if(CollectionUtils.isNotEmpty(projectTaskInventoryEOList)){
|
||||
@@ -81,15 +101,24 @@ public class PrehomoJob implements Job {
|
||||
|
||||
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);
|
||||
//两周
|
||||
Calendar twoWeeksLaterCalendar=new GregorianCalendar();
|
||||
twoWeeksLaterCalendar.setTime(new Date());
|
||||
twoWeeksLaterCalendar.add(Calendar.DATE,14);
|
||||
Date twoWeeksLaterDays = twoWeeksLaterCalendar.getTime();
|
||||
String twoWeeksLaterDaysStr = sdf.format(twoWeeksLaterDays);
|
||||
//一周
|
||||
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 msgTitle = MessageType2Enum.PRE_HOMO_CONFIRMATION.getCn() + "/" + MessageType2Enum.PRE_HOMO_CONFIRMATION.getEn();
|
||||
|
||||
|
||||
for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseList) {
|
||||
QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>();
|
||||
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId());
|
||||
@@ -99,115 +128,234 @@ public class PrehomoJob implements Job {
|
||||
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId());
|
||||
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) {
|
||||
List<String> threeDaysUserIdList = new ArrayList<>();
|
||||
List<String> currentDaysUserIdList = new ArrayList<>();
|
||||
|
||||
for (ProjectTaskInventoryEO projectTaskInventoryEO : projectTaskInventoryEOList) {
|
||||
if(StringUtils.equals(projectTaskInventoryEO.getProjectLawsInventoryId(),projectLawsInventoryEO.getId())){
|
||||
if(projectLawsInventoryEO.getPrehomoDueDate() != null){
|
||||
//如果prehomo - 结束日期是当前日期
|
||||
if(StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getPrehomoDueDate()))){
|
||||
if(StringUtils.isEmpty(projectTaskInventoryEO.getPrehomoSendMsgFlag())){
|
||||
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())){
|
||||
currentDaysUserIdList.add(projectLawsInventoryEO.getPrehomoDutyId());
|
||||
}if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoInitiatorId())){
|
||||
currentDaysUserIdList.add(projectLawsInventoryEO.getPrehomoInitiatorId());
|
||||
}
|
||||
projectTaskInventoryEO.setPrehomoSendMsgFlag(SendMsgFlagEnum.FALSE.getValue());
|
||||
projectTaskInventoryEOService.updateById(projectTaskInventoryEO);
|
||||
}
|
||||
//法规中英文
|
||||
String LAW_CN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle();//法规
|
||||
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
|
||||
String LAW_EN = "";
|
||||
if (ObjectUtils.isEmpty(bussDocumentLibraryEO)) {
|
||||
LAW_EN = LAW_CN;
|
||||
} else {
|
||||
LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规
|
||||
}
|
||||
|
||||
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.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()))){
|
||||
if(StringUtils.isEmpty(projectTaskInventoryEO.getPrehomoSendMsgCurrentFlag())){
|
||||
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())){
|
||||
threeDaysUserIdList.add(projectLawsInventoryEO.getPrehomoDutyId());
|
||||
}if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoInitiatorId())){
|
||||
threeDaysUserIdList.add(projectLawsInventoryEO.getPrehomoInitiatorId());
|
||||
}
|
||||
projectTaskInventoryEO.setPrehomoSendMsgCurrentFlag(SendMsgFlagEnum.FALSE.getValue());
|
||||
projectTaskInventoryEOService.updateById(projectTaskInventoryEO);
|
||||
}
|
||||
}
|
||||
//如果prehomo - 结束日期是两周后的日期
|
||||
if(StringUtils.equals(twoWeeksLaterDaysStr,sdf.format(projectLawsInventoryEO.getPrehomoDueDate()))){
|
||||
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getPrehomoDutyId())){
|
||||
twoWeeksLaterUserIdList.add(projectLawsInventoryEO.getPrehomoDutyId());
|
||||
}
|
||||
}
|
||||
//如果prehomo - 结束日期是一周后的日期
|
||||
if(StringUtils.equals(oneWeekLaterDaysStr,sdf.format(projectLawsInventoryEO.getDesignDueDate()))){
|
||||
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天,请及时查看处理
|
||||
//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 "
|
||||
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-"
|
||||
+ projectYearNameInfoEO.getYearName()+ " "
|
||||
+ projectLibraryBase.getTargetMarket()
|
||||
+ " are 3 days. Please check and handle it in time.";
|
||||
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
|
||||
+ ": You have a Pre-Homo task to complete";
|
||||
//String msgContentEN = "The remaining processing time for the Pre-Homo confirmation of "
|
||||
// + projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-"
|
||||
// + projectYearNameInfoEO.getYearName()+ " "
|
||||
// + projectLibraryBase.getTargetMarket()
|
||||
// + " are 3 days. Please check and handle it in time.";
|
||||
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
|
||||
// + ": You have a Pre-Homo task 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("Pre-Homo Confirmation");
|
||||
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
|
||||
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("Pre-Homo Confirmation");
|
||||
//feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
|
||||
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
|
||||
|
||||
//飞书跳转链接
|
||||
String hrefFeishu = backUrl
|
||||
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink()
|
||||
+ projectLibraryBase.getId()
|
||||
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
|
||||
+ "&projectName=" + projectNameInfoEO.getProjectName();
|
||||
//String hrefFeishu = backUrl
|
||||
// + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink()
|
||||
// + projectLibraryBase.getId()
|
||||
// + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
|
||||
// + "&projectName=" + projectNameInfoEO.getProjectName();
|
||||
//系统内部跳转链接
|
||||
String href = "<a href='"
|
||||
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
|
||||
+ "&projectName=" + projectNameInfoEO.getProjectName()
|
||||
+ "'>" + " 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.PREHOMO_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
|
||||
// + "&projectName=" + projectNameInfoEO.getProjectName()
|
||||
// + "'>" + " 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,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)){
|
||||
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确认任务今天即将结束,请及时查看处理
|
||||
//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 "
|
||||
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
|
||||
+ " will expire today. Please check and address it in time.";
|
||||
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
|
||||
+ ": You have a Pre-Homo task to complete";
|
||||
//String msgContentEN = "The the Pre-Homo confirmation of "
|
||||
// + projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
|
||||
// + " will expire today. Please check and address it in time.";
|
||||
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
|
||||
// + ": You have a Pre-Homo task 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("Pre-Homo Confirmation");
|
||||
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
|
||||
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
|
||||
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
|
||||
//feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner.");
|
||||
//feishuMsgVo.setTaskType("Pre-Homo Confirmation");
|
||||
//feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
|
||||
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
|
||||
|
||||
//飞书跳转链接
|
||||
String hrefFeishu = backUrl
|
||||
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink()
|
||||
+ projectLibraryBase.getId()
|
||||
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
|
||||
+ "&projectName=" + projectNameInfoEO.getProjectName();
|
||||
// String hrefFeishu = backUrl
|
||||
// + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink()
|
||||
// + projectLibraryBase.getId()
|
||||
// + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
|
||||
// + "&projectName=" + projectNameInfoEO.getProjectName();
|
||||
//系统内部跳转链接
|
||||
String href = "<a href='"
|
||||
+ JumpLinkEnum.PREHOMO_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
|
||||
+ "&projectName=" + projectNameInfoEO.getProjectName()
|
||||
+ "'>" + " 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.PREHOMO_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.PREHOMO_AFFIRM_LINK.getType()
|
||||
// + "&projectName=" + projectNameInfoEO.getProjectName()
|
||||
// + "'>" + " 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,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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+238
-88
@@ -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.*;
|
||||
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.service.IProjectLawsInventoryEOService;
|
||||
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 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;
|
||||
@@ -22,6 +31,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;
|
||||
@@ -52,13 +62,23 @@ public class VerifyComplianceJob implements Job {
|
||||
@Value(value = "${jero.backUrl}")
|
||||
private String backUrl;
|
||||
|
||||
@Autowired
|
||||
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
@Autowired
|
||||
private IFeishuService feishuService;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
log.info("验证符合性流程,定时任务开启 =====================================================");
|
||||
//查询出已经启动了验证符合性流程的数据。 并且流程没有结束。
|
||||
QueryWrapper<ProjectTaskInventoryEO> queryProjectTaskInventoryWrapper = new QueryWrapper<>();
|
||||
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);
|
||||
|
||||
if(CollectionUtils.isNotEmpty(projectTaskInventoryEOList)){
|
||||
@@ -79,15 +99,24 @@ public class VerifyComplianceJob implements Job {
|
||||
|
||||
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);
|
||||
//两周
|
||||
Calendar twoWeeksLaterCalendar=new GregorianCalendar();
|
||||
twoWeeksLaterCalendar.setTime(new Date());
|
||||
twoWeeksLaterCalendar.add(Calendar.DATE,14);
|
||||
Date twoWeeksLaterDays = twoWeeksLaterCalendar.getTime();
|
||||
String twoWeeksLaterDaysStr = sdf.format(twoWeeksLaterDays);
|
||||
//一周
|
||||
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 msgTitle = MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getEn();
|
||||
|
||||
|
||||
for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseList) {
|
||||
QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>();
|
||||
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId());
|
||||
@@ -97,114 +126,235 @@ public class VerifyComplianceJob implements Job {
|
||||
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId());
|
||||
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
|
||||
|
||||
for (ProjectLawsInventoryEO projectLawsInventoryEO: projectLawsInventoryEOList) {
|
||||
List<String> threeDaysUserIdList = new ArrayList<>();
|
||||
List<String> currentDaysUserIdList = 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();
|
||||
String projectName = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectVersion;
|
||||
|
||||
for (ProjectTaskInventoryEO projectTaskInventoryEO : projectTaskInventoryEOList) {
|
||||
if(StringUtils.equals(projectTaskInventoryEO.getProjectLawsInventoryId(),projectLawsInventoryEO.getId())){
|
||||
if(projectLawsInventoryEO.getVerifyDueDate() != null){
|
||||
//如果验证符合性 - 结束日期是当前日期
|
||||
if(StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getVerifyDueDate()))){
|
||||
if(StringUtils.isEmpty(projectTaskInventoryEO.getVerifySendMsgFlag())){
|
||||
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){
|
||||
currentDaysUserIdList.add(projectLawsInventoryEO.getVerifyDutyId());
|
||||
}if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyInitiatorId())){
|
||||
currentDaysUserIdList.add(projectLawsInventoryEO.getVerifyInitiatorId());
|
||||
}
|
||||
projectTaskInventoryEO.setVerifySendMsgFlag(SendMsgFlagEnum.FALSE.getValue());
|
||||
projectTaskInventoryEOService.updateById(projectTaskInventoryEO);
|
||||
}
|
||||
|
||||
for (ProjectLawsInventoryEO projectLawsInventoryEO: projectLawsInventoryEOList) {
|
||||
|
||||
//法规中英文
|
||||
String LAW_CN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle();//法规
|
||||
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
|
||||
String LAW_EN = "";
|
||||
if (ObjectUtils.isEmpty(bussDocumentLibraryEO)) {
|
||||
LAW_EN = LAW_CN;
|
||||
} else {
|
||||
LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规
|
||||
}
|
||||
|
||||
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.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){
|
||||
threeDaysUserIdList.add(projectLawsInventoryEO.getVerifyDutyId());
|
||||
}if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyInitiatorId())){
|
||||
threeDaysUserIdList.add(projectLawsInventoryEO.getVerifyInitiatorId());
|
||||
}
|
||||
projectTaskInventoryEO.setVerifySendMsgCurrentFlag(SendMsgFlagEnum.FALSE.getValue());
|
||||
projectTaskInventoryEOService.updateById(projectTaskInventoryEO);
|
||||
}
|
||||
}
|
||||
//如果验证符合性 - 结束日期是两周后的日期
|
||||
if(StringUtils.equals(twoWeeksLaterDaysStr,sdf.format(projectLawsInventoryEO.getVerifyDueDate()))){
|
||||
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getVerifyDutyId())){
|
||||
currentDaysUserIdList.add(projectLawsInventoryEO.getVerifyDutyId());
|
||||
}
|
||||
}
|
||||
//如果验证符合性 - 结束日期是一周后的日期
|
||||
if(StringUtils.equals(oneWeekLaterDaysStr,sdf.format(projectLawsInventoryEO.getVerifyDueDate()))){
|
||||
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天,请及时查看处理
|
||||
//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 "
|
||||
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-"
|
||||
+ projectYearNameInfoEO.getYearName()+ " "
|
||||
+ projectLibraryBase.getTargetMarket()
|
||||
+ " are 3 days. Please check and handle it in time.";
|
||||
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
|
||||
+ ": You have a validation compliance task to complete";
|
||||
//String msgContentEN = "The remaining processing time for the validation compliance confirmation of "
|
||||
// + projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-"
|
||||
// + projectYearNameInfoEO.getYearName()+ " "
|
||||
// + projectLibraryBase.getTargetMarket()
|
||||
// + " are 3 days. Please check and handle it in time.";
|
||||
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
|
||||
// + ": You have a validation compliance task 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("Validation Compliance Confirmation");
|
||||
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
|
||||
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
|
||||
// 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("Validation Compliance Confirmation");
|
||||
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
|
||||
//feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
|
||||
|
||||
//飞书跳转链接
|
||||
String hrefFeishu = backUrl
|
||||
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink()
|
||||
+ projectLibraryBase.getId()
|
||||
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
|
||||
+ "&projectName=" + projectNameInfoEO.getProjectName();
|
||||
//String hrefFeishu = backUrl
|
||||
// + JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink()
|
||||
// + projectLibraryBase.getId()
|
||||
// + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
|
||||
// + "&projectName=" + projectNameInfoEO.getProjectName();
|
||||
//系统内部跳转链接
|
||||
String href = "<a href='"
|
||||
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
|
||||
+ "&projectName=" + projectNameInfoEO.getProjectName()
|
||||
+ "'>" + " 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.VERIFY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
|
||||
// + "&projectName=" + projectNameInfoEO.getProjectName()
|
||||
// + "'>" + " 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,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)){
|
||||
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的验证符合性确认任务今天即将结束,请及时查看处理
|
||||
//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 "
|
||||
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
|
||||
+ " will expire today. Please check and address it in time.";
|
||||
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
|
||||
+ ": You have a validation compliance task to complete";
|
||||
//String msgContentEN = "The the validation compliance confirmation of "
|
||||
// + projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
|
||||
// + " will expire today. Please check and address it in time.";
|
||||
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
|
||||
// + ": You have a validation compliance task 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("Validation Compliance Confirmation");
|
||||
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
|
||||
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
|
||||
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
|
||||
//feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner.");
|
||||
//feishuMsgVo.setTaskType("Validation Compliance Confirmation");
|
||||
// feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
|
||||
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
|
||||
|
||||
//飞书跳转链接
|
||||
String hrefFeishu = backUrl
|
||||
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink()
|
||||
+ projectLibraryBase.getId()
|
||||
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
|
||||
+ "&projectName=" + projectNameInfoEO.getProjectName();
|
||||
// String hrefFeishu = backUrl
|
||||
// + JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink()
|
||||
// + projectLibraryBase.getId()
|
||||
// + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
|
||||
// + "&projectName=" + projectNameInfoEO.getProjectName();
|
||||
//系统内部跳转链接
|
||||
String href = "<a href='"
|
||||
+ JumpLinkEnum.VERIFY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
|
||||
+ "&projectName=" + projectNameInfoEO.getProjectName()
|
||||
+ "'>" + " 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.VERIFY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.VERIFY_AFFIRM_LINK.getType()
|
||||
// + "&projectName=" + projectNameInfoEO.getProjectName()
|
||||
// + "'>" + " 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,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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -75,7 +75,10 @@ public class designComplianceJob implements Job {
|
||||
//查询出已经启动了设计符合性流程的数据。 并且流程没有结束。
|
||||
QueryWrapper<ProjectTaskInventoryEO> queryProjectTaskInventoryWrapper = new QueryWrapper<>();
|
||||
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);
|
||||
|
||||
if(CollectionUtils.isNotEmpty(projectTaskInventoryEOList)){
|
||||
@@ -211,7 +214,7 @@ public class designComplianceJob implements Job {
|
||||
try {
|
||||
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
|
||||
feishuMsgVo.setTitle(msgTitle);
|
||||
feishuMsgVo.setCnContentUpper("您好,您的任务已逾期,请尽快处理");
|
||||
feishuMsgVo.setCnContentUpper("您好,您的任务已逾期,请尽快查看处理");
|
||||
feishuMsgVo.setCnContentLower("项目: " + projectName +
|
||||
"\n法规: " + LAW_CN +
|
||||
"\n发起人: 系统通知"+
|
||||
|
||||
+6
-6
@@ -9129,9 +9129,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
|
||||
if (DesignComplianceStatusEnum.TO_REVIEW.getValue().equals(list.get(0).getDesignStatus())
|
||||
||DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue().equals(list.get(0).getDesignStatus())) {
|
||||
if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) {
|
||||
throw new JeroBootException(LAW_CN + "已提交,无法催办");
|
||||
throw new JeroBootException(LAW_CN + "已经被确认,无法催办");
|
||||
} else {
|
||||
throw new JeroBootException(LAW_EN + "is committed,can't be urged");
|
||||
throw new JeroBootException(LAW_EN + "has been confirmed,can't be urged");
|
||||
}
|
||||
}
|
||||
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())
|
||||
||DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue().equals(list.get(0).getDesignStatus())) {
|
||||
if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) {
|
||||
throw new JeroBootException(LAW_CN + "已提交,无法催办");
|
||||
throw new JeroBootException(LAW_CN + "已经被确认,无法催办");
|
||||
} else {
|
||||
throw new JeroBootException(LAW_EN + "is committed,can't be urged");
|
||||
throw new JeroBootException(LAW_EN + "has been confirmed,can't be urged");
|
||||
}
|
||||
}
|
||||
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())
|
||||
||DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue().equals(list.get(0).getDesignStatus())) {
|
||||
if (CutEnum.CN.getValue().equals(projectTaskUrgVo.getCut())) {
|
||||
throw new JeroBootException(LAW_CN + "已提交,无法催办");
|
||||
throw new JeroBootException(LAW_CN + "已经被确认,无法催办");
|
||||
} else {
|
||||
throw new JeroBootException(LAW_EN + "is committed,can't be urged");
|
||||
throw new JeroBootException(LAW_EN + "has been confirmed,can't be urged");
|
||||
}
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(lawsInventoryEO.getVerifyDutyId())) {
|
||||
|
||||
Reference in New Issue
Block a user