Merge remote-tracking branch 'origin/master'

This commit is contained in:
zhaomeijing
2022-05-13 18:06:14 +08:00
5 changed files with 332 additions and 4 deletions
@@ -11,6 +11,10 @@ public enum MsgTypeEnum {
DESIGN_ISSUE_DRE_MSG("设计符合性确认分配dre消息","designIssueDreMsg"),
DESIGN_REMIND_MSG("设计符合性提醒办理","designRemindMsg"),
PREHOMO_ISSUE_DRE_MSG("prehomo分配dre消息","prehomoIssueDreMsg"),
PREHOMO_REMIND_MSG("prehomo提醒办理","prehomoRemindMsg"),
VERIFY_ISSUE_DRE_MSG("验证符合性确认分配dre消息","verifyIssueDreMsg"),
VERIFY_REMIND_MSG("验证符合性确认提醒办理","verifyRemindMsg"),
;
String name;
@@ -0,0 +1,150 @@
package com.jero.modules.project.job;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.project.entity.ProjectLibraryBase;
import com.jero.modules.project.entity.ProjectNameInfoEO;
import com.jero.modules.project.entity.ProjectTaskInventoryEO;
import com.jero.modules.project.enums.DesignComplianceStatusEnum;
import com.jero.modules.project.enums.SendMsgFlagEnum;
import com.jero.modules.project.mapper.ProjectLawsInventoryEOMapper;
import com.jero.modules.project.mapper.ProjectLibraryBaseMapper;
import com.jero.modules.project.mapper.ProjectNameInfoEOMapper;
import com.jero.modules.project.service.IProjectLawsInventoryEOService;
import com.jero.modules.project.service.IProjectTaskInventoryEOService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* prehomo流程 - 定时器
*/
@Slf4j
public class PrehomoJob implements Job {
@Autowired
private ProjectLawsInventoryEOMapper projectLawsInventoryEOMapper;
@Autowired
private ProjectLibraryBaseMapper projectLibraryBaseMapper;
@Autowired
private IProjectLawsInventoryEOService projectLawsInventoryEOService;
@Autowired
private ProjectNameInfoEOMapper projectNameInfoEOMapper;
@Autowired
private IProjectTaskInventoryEOService projectTaskInventoryEOService;
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
//查询出已经启动了prehomo流程的数据。 并且流程没有结束。
QueryWrapper<ProjectTaskInventoryEO> queryProjectTaskInventoryWrapper = new QueryWrapper<>();
queryProjectTaskInventoryWrapper.isNotNull("prehomo_p_id");
queryProjectTaskInventoryWrapper.lambda().ne(ProjectTaskInventoryEO::getPrehomoStatus, DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue());
List<ProjectTaskInventoryEO> projectTaskInventoryEOList = projectTaskInventoryEOService.getBaseMapper().selectList(queryProjectTaskInventoryWrapper);
if(CollectionUtils.isNotEmpty(projectTaskInventoryEOList)){
List<String> projectLawsInventoryIdList = projectTaskInventoryEOList.stream().distinct().map(ProjectTaskInventoryEO::getProjectLawsInventoryId).collect(Collectors.toList());
//根据已经启动了prehomo流程的 法规清单id。查询法规清单
QueryWrapper<ProjectLawsInventoryEO> queryWrapperInventory = new QueryWrapper<>();
queryWrapperInventory.lambda().in(ProjectLawsInventoryEO::getId, projectLawsInventoryIdList);
List<ProjectLawsInventoryEO> projectLawsInventoryEOList = projectLawsInventoryEOMapper.selectList(queryWrapperInventory);
if(CollectionUtils.isNotEmpty(projectLawsInventoryEOList)){
List<String> projectLibraryIdList = projectLawsInventoryEOList.stream().distinct().map(ProjectLawsInventoryEO::getProjectLibraryId).collect(Collectors.toList());
QueryWrapper<ProjectLibraryBase> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(ProjectLibraryBase::getId,projectLibraryIdList);
List<ProjectLibraryBase> projectLibraryBaseList = projectLibraryBaseMapper.selectList(queryWrapper);
if(CollectionUtils.isNotEmpty(projectLibraryBaseList)){
SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd");
Date currentDate = new Date();
//获取后三天前的时间
Calendar calendar=new GregorianCalendar();
calendar.setTime(new Date());
calendar.add(Calendar.DATE,3);
Date threeDays = calendar.getTime();
String threeDaysStr = sdf.format(threeDays);
String currentDateStr = sdf.format(currentDate);
for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseList) {
QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>();
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId());
ProjectNameInfoEO projectNameInfoEO = projectNameInfoEOMapper.selectOne(projectNameInfoEOQueryWrapper);
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())){
//如果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);
}
}
//如果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);
}
}
}
}
if(CollectionUtils.isNotEmpty(threeDaysUserIdList)){
threeDaysUserIdList = threeDaysUserIdList.stream().distinct().collect(Collectors.toList());
//您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()
+ " (project name) is 3 days. Please check and handle it in time.";
//发送消息
projectLawsInventoryEOService.sendMessage(msgContentEN,threeDaysUserIdList,projectLawsInventoryEO.getId());
}
if(CollectionUtils.isNotEmpty(currentDaysUserIdList)){
currentDaysUserIdList = currentDaysUserIdList.stream().distinct().collect(Collectors.toList());
//您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()
+ " (project name) is coming to an end today. Please check and deal with it in time.";
//发送消息
projectLawsInventoryEOService.sendMessage(msgContentEN,currentDaysUserIdList,projectLawsInventoryEO.getId());
}
}
}
}
}
}
}
}
@@ -0,0 +1,150 @@
package com.jero.modules.project.job;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.project.entity.ProjectLibraryBase;
import com.jero.modules.project.entity.ProjectNameInfoEO;
import com.jero.modules.project.entity.ProjectTaskInventoryEO;
import com.jero.modules.project.enums.DesignComplianceStatusEnum;
import com.jero.modules.project.enums.SendMsgFlagEnum;
import com.jero.modules.project.mapper.ProjectLawsInventoryEOMapper;
import com.jero.modules.project.mapper.ProjectLibraryBaseMapper;
import com.jero.modules.project.mapper.ProjectNameInfoEOMapper;
import com.jero.modules.project.service.IProjectLawsInventoryEOService;
import com.jero.modules.project.service.IProjectTaskInventoryEOService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* 验证符合性 - 定时器
*/
@Slf4j
public class VerifyComplianceJob implements Job {
@Autowired
private ProjectLawsInventoryEOMapper projectLawsInventoryEOMapper;
@Autowired
private ProjectLibraryBaseMapper projectLibraryBaseMapper;
@Autowired
private IProjectLawsInventoryEOService projectLawsInventoryEOService;
@Autowired
private ProjectNameInfoEOMapper projectNameInfoEOMapper;
@Autowired
private IProjectTaskInventoryEOService projectTaskInventoryEOService;
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
//查询出已经启动了验证符合性流程的数据。 并且流程没有结束。
QueryWrapper<ProjectTaskInventoryEO> queryProjectTaskInventoryWrapper = new QueryWrapper<>();
queryProjectTaskInventoryWrapper.isNotNull("verify_p_id");
queryProjectTaskInventoryWrapper.lambda().ne(ProjectTaskInventoryEO::getVerifyStatus, DesignComplianceStatusEnum.REVIEW_COMPLETED.getValue());
List<ProjectTaskInventoryEO> projectTaskInventoryEOList = projectTaskInventoryEOService.getBaseMapper().selectList(queryProjectTaskInventoryWrapper);
if(CollectionUtils.isNotEmpty(projectTaskInventoryEOList)){
List<String> projectLawsInventoryIdList = projectTaskInventoryEOList.stream().distinct().map(ProjectTaskInventoryEO::getProjectLawsInventoryId).collect(Collectors.toList());
//根据已经启动了验证符合性流程的 法规清单id。查询法规清单
QueryWrapper<ProjectLawsInventoryEO> queryWrapperInventory = new QueryWrapper<>();
queryWrapperInventory.lambda().in(ProjectLawsInventoryEO::getId, projectLawsInventoryIdList);
List<ProjectLawsInventoryEO> projectLawsInventoryEOList = projectLawsInventoryEOMapper.selectList(queryWrapperInventory);
if(CollectionUtils.isNotEmpty(projectLawsInventoryEOList)){
List<String> projectLibraryIdList = projectLawsInventoryEOList.stream().distinct().map(ProjectLawsInventoryEO::getProjectLibraryId).collect(Collectors.toList());
QueryWrapper<ProjectLibraryBase> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(ProjectLibraryBase::getId,projectLibraryIdList);
List<ProjectLibraryBase> projectLibraryBaseList = projectLibraryBaseMapper.selectList(queryWrapper);
if(CollectionUtils.isNotEmpty(projectLibraryBaseList)){
SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd");
Date currentDate = new Date();
//获取后三天前的时间
Calendar calendar=new GregorianCalendar();
calendar.setTime(new Date());
calendar.add(Calendar.DATE,3);
Date threeDays = calendar.getTime();
String threeDaysStr = sdf.format(threeDays);
String currentDateStr = sdf.format(currentDate);
for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseList) {
QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>();
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId());
ProjectNameInfoEO projectNameInfoEO = projectNameInfoEOMapper.selectOne(projectNameInfoEOQueryWrapper);
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(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);
}
}
//如果验证符合性 - 结束日期是三天后的日期
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(CollectionUtils.isNotEmpty(threeDaysUserIdList)){
threeDaysUserIdList = threeDaysUserIdList.stream().distinct().collect(Collectors.toList());
//您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 Verify compliance confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName()
+ " (project name) is 3 days. Please check and handle it in time.";
//发送消息
projectLawsInventoryEOService.sendMessage(msgContentEN,threeDaysUserIdList,projectLawsInventoryEO.getId());
}
if(CollectionUtils.isNotEmpty(currentDaysUserIdList)){
currentDaysUserIdList = currentDaysUserIdList.stream().distinct().collect(Collectors.toList());
//您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 Verify compliance confirmation of "
+ projectLawsInventoryEO.getSerialNumber() + " in " + projectNameInfoEO.getProjectName()
+ " (project name) is coming to an end today. Please check and deal with it in time.";
//发送消息
projectLawsInventoryEOService.sendMessage(msgContentEN,currentDaysUserIdList,projectLawsInventoryEO.getId());
}
}
}
}
}
}
}
}
@@ -195,8 +195,20 @@ public class ProjectTaskInventoryDetailEOServiceImpl extends ServiceImpl<Project
String id = UUID.randomUUID().toString().replace("-", "");
//给工程师下发消息
if(org.apache.commons.lang3.StringUtils.equals(projectTaskInventoryDetailEO.getMsgType(), MsgTypeEnum.DESIGN_ISSUE_DRE_MSG.getValue())){
//XXX has distributed the design compliance confirmation process of GB 7258 in XXX (project name) to you. Please check and handle it in time.
msgContentEN = currentUser.getUsername() + " has distributed the design compliance confirmation process of "
+ projectLawsInventoryEO.getSerialNumber() + " in "+ projectNameInfoEO.getProjectName() + " (project name) in time.";
+ projectLawsInventoryEO.getSerialNumber() + " in "+ projectNameInfoEO.getProjectName()
+ " (project name) to you. Please check and handle it in time.";
}else if(org.apache.commons.lang3.StringUtils.equals(projectTaskInventoryDetailEO.getMsgType(), MsgTypeEnum.PREHOMO_ISSUE_DRE_MSG.getValue())){
//XXX has distributed the Pre-Homo confirmation process of GB 7258 in XXX (project name) to you. Please check and handle it in time.
msgContentEN = currentUser.getUsername() + " has distributed the Pre-Homo confirmation process of "
+ projectLawsInventoryEO.getSerialNumber() + " in "+ projectNameInfoEO.getProjectName()
+ " (project name) to you. Please check and handle it in time.";
}else if(org.apache.commons.lang3.StringUtils.equals(projectTaskInventoryDetailEO.getMsgType(), MsgTypeEnum.VERIFY_ISSUE_DRE_MSG.getValue())){
//XXX has distributed the Verify compliance confirmation process of GB 7258 in XXX (project name) to you. Please check and handle it in time.
msgContentEN = currentUser.getUsername() + " has distributed the Verify compliance confirmation process of "
+ projectLawsInventoryEO.getSerialNumber() + " in "+ projectNameInfoEO.getProjectName()
+ " (project name) to you. Please check and handle it in time.";
}
if(CollectionUtils.isNotEmpty(userIdList) && org.apache.commons.lang3.StringUtils.isNotEmpty(msgContentEN)){
//发送消息
@@ -279,11 +279,23 @@ public class ProjectTaskInventoryEOServiceImpl extends ServiceImpl<ProjectTaskIn
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId());
ProjectNameInfoEO projectNameInfoEO = projectNameInfoEOMapper.selectOne(projectNameInfoEOQueryWrapper);
String dreUserIds = jsonObject.getString("dreUserIds"); //dre用户id
userIdList.addAll(Arrays.asList(dreUserIds.split(",")));
if(StringUtils.equals(msgType,MsgTypeEnum.DESIGN_REMIND_MSG.getValue())){
String dreUserIds = jsonObject.getString("dreUserIds"); //dre用户id
userIdList.addAll(Arrays.asList(dreUserIds.split(",")));
//Please check and deal with the design compliance confirmation process of GB 7258 in XXX (project name) in time.
msgContentEN = "Please check and deal with the design compliance confirmation process of "
+ serialNumber + " in "+ projectNameInfoEO.getProjectName() + " (project name) in time.";
+ serialNumber + " in "+ projectNameInfoEO.getProjectName()
+ " (project name) in time.";
}else if(StringUtils.equals(msgType,MsgTypeEnum.PREHOMO_REMIND_MSG.getValue())){
//Please check and deal with the Pre-Homo confirmation process of GB 7258 in XXX (project name) in time.
msgContentEN = "Please check and deal with the Pre-Homo confirmation process of "
+ serialNumber + " in "+ projectNameInfoEO.getProjectName()
+ " (project name) in time.";
}else if(StringUtils.equals(msgType,MsgTypeEnum.VERIFY_REMIND_MSG.getValue())){
//Please check and deal with the Verify compliance confirmation process of GB 7258 in XXX (project name) in time.
msgContentEN = "Please check and deal with the Verify compliance confirmation process of "
+ serialNumber + " in "+ projectNameInfoEO.getProjectName()
+ " (project name) in time.";
}
if(CollectionUtils.isNotEmpty(userIdList) && StringUtils.isNotEmpty(msgContentEN)){