feat: 计划状态最终调整
This commit is contained in:
+5
@@ -18,6 +18,7 @@ import com.jero.modules.activiti.process.esRevision.entity.vo.ESRevisionDataVO;
|
||||
import com.jero.modules.activiti.process.esRevision.service.EsRevisionService;
|
||||
import com.jero.modules.activiti.service.ProcessAllService;
|
||||
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardPlan;
|
||||
import com.jero.modules.laws.enterprise.job.ESPlanProjectStatusJob;
|
||||
import com.jero.modules.laws.enterprise.service.EnterpriseStandardPlanService;
|
||||
import com.jero.modules.laws.enterprise.util.BeanCopyUtils;
|
||||
import com.jero.modules.laws.enterprise.util.EnterpriseStandardUtil;
|
||||
@@ -58,6 +59,9 @@ public class ProcessESInitChangeEndListener implements ExecutionListener {
|
||||
@Resource
|
||||
private EsRevisionService revisionService;
|
||||
|
||||
@Resource
|
||||
private ESPlanProjectStatusJob esPlanProjectStatusJob;
|
||||
|
||||
/**
|
||||
* 企标立项变更流程结束之后需要把数据存入企标计划数据库 然后自动发起企标制修订流程
|
||||
* @param delegateExecution
|
||||
@@ -116,6 +120,7 @@ public class ProcessESInitChangeEndListener implements ExecutionListener {
|
||||
enterpriseStandardPlans = BeanCopyUtils.copyBeanList(processEsInitChanges, EnterpriseStandardPlan.class);
|
||||
enterpriseStandardPlans.forEach(esp -> esp.setOriginEnStandardNo(null));
|
||||
espService.updateBatchById(enterpriseStandardPlans);
|
||||
esPlanProjectStatusJob.updatePlanProjectStatus(enterpriseStandardPlans);
|
||||
}
|
||||
|
||||
// 工作中止
|
||||
|
||||
+1
@@ -2281,6 +2281,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
LambdaQueryWrapper<EnterpriseStandardAuthDept> authDeptWrapper = new LambdaQueryWrapper<>();
|
||||
List<String> authDeptIdList = Arrays.asList(authDept.split(","));
|
||||
authDeptWrapper.in(EnterpriseStandardAuthDept::getAuthDept, authDeptIdList);
|
||||
authDeptWrapper.isNull(EnterpriseStandardAuthDept::getAuthExpireDate);
|
||||
List<EnterpriseStandardAuthDept> authList = enterpriseAuthDeptService.list(authDeptWrapper);
|
||||
idSet.addAll(authList.stream().map(EnterpriseStandardAuthDept::getStandardId).collect(Collectors.toSet()));
|
||||
parameterMap.remove(FieldCommon.AUTH_DEPT);
|
||||
|
||||
+41
-7
@@ -1,8 +1,14 @@
|
||||
package com.jero.modules.laws.enterprise.job;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.modules.activiti.entity.ProcessAll;
|
||||
import com.jero.modules.activiti.enums.ProcessStatusEnum;
|
||||
import com.jero.modules.activiti.enums.ProcessTypeEnum;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.enums.ESPChangeType;
|
||||
import com.jero.modules.activiti.process.esInitChange.entity.enums.ESPProjectStatus;
|
||||
import com.jero.modules.activiti.process.esRevision.service.impl.EsRevisionServiceImpl;
|
||||
import com.jero.modules.activiti.service.ProcessAllService;
|
||||
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardPlan;
|
||||
import com.jero.modules.laws.enterprise.service.EnterpriseStandardPlanService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -12,7 +18,6 @@ import org.quartz.JobExecutionException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -31,20 +36,27 @@ public class ESPlanProjectStatusJob implements Job {
|
||||
@Resource
|
||||
private EsRevisionServiceImpl esRevisionService;
|
||||
|
||||
@Resource
|
||||
private ProcessAllService processAllService;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
log.info("计划状态更新开始");
|
||||
List<EnterpriseStandardPlan> list = espService.list();
|
||||
this.updatePlanProjectStatus(list);
|
||||
// 更新所有流程状态
|
||||
esRevisionService.updateAllPlanDate();
|
||||
// 每天执行定时任务 判断所有进行中的计划是否逾期 逾期则修改项目状态为逾期
|
||||
List<EnterpriseStandardPlan> list = espService.list();
|
||||
log.info("计划状态更新完成");
|
||||
}
|
||||
|
||||
public void updatePlanProjectStatus(List<EnterpriseStandardPlan> list) {
|
||||
// 将list中的时间的时分秒都去掉
|
||||
list.forEach(esp -> {
|
||||
if (null != esp.getApprovalDate()) {
|
||||
esp.setApprovalDate(Date.from(esp.getApprovalDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
esp.setApprovalDate(DateUtil.beginOfDay(esp.getApprovalDate()));
|
||||
}
|
||||
if (null != esp.getReviewDate()) {
|
||||
esp.setReviewDate(Date.from(esp.getReviewDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
esp.setReviewDate(DateUtil.beginOfDay(esp.getReviewDate()));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -55,22 +67,44 @@ public class ESPlanProjectStatusJob implements Job {
|
||||
List<EnterpriseStandardPlan> inprogressList = list.stream()
|
||||
.filter(esp -> ESPProjectStatus.IN_PROGRESS.getValue().equals(esp.getProjectStatus()))
|
||||
.collect(Collectors.toList());
|
||||
List<EnterpriseStandardPlan> overdureList = list.stream()
|
||||
.filter(esp -> ESPProjectStatus.OVERDUE.getValue().equals(esp.getProjectStatus()))
|
||||
.collect(Collectors.toList());
|
||||
// 将工作中止和取消的设置为未开始
|
||||
cancelList.forEach(esp -> {
|
||||
esp.setProjectStatus(ESPProjectStatus.NOT_STARTED.getValue());
|
||||
});
|
||||
espService.updateBatchById(cancelList);
|
||||
Date curDate = new Date();
|
||||
// 获取0点时间
|
||||
Date finalCurDate = DateUtil.beginOfDay(curDate);
|
||||
// 判断所有进行中的是否逾期
|
||||
inprogressList.parallelStream().forEach(p -> {
|
||||
Date planApprovalDate = p.getPlanApprovalDate();
|
||||
if (curDate.after(planApprovalDate)) {
|
||||
if (finalCurDate.after(planApprovalDate)) {
|
||||
log.info("计划【" + p.getNewEnStandardName() + "】逾期,计划完成日期:" + p.getPlanApprovalDate());
|
||||
p.setProjectStatus(ESPProjectStatus.OVERDUE.getValue());
|
||||
}
|
||||
});
|
||||
// 判断所有逾期的是否还逾期
|
||||
overdureList.parallelStream().forEach(p -> {
|
||||
Date planApprovalDate = p.getPlanApprovalDate();
|
||||
if (planApprovalDate.after(finalCurDate)) {
|
||||
// 判断是否有进行中的企标制修订流程
|
||||
// 从流程主表找到所有企标制修订流程
|
||||
List<ProcessAll> processAlls = processAllService.list(new LambdaQueryWrapper<ProcessAll>()
|
||||
.eq(ProcessAll::getPrcType, ProcessTypeEnum.ES_REVISION.getValue())
|
||||
.like(ProcessAll::getPrcName, p.getNewEnStandardNo())
|
||||
.ne(ProcessAll::getPrcStatus, ProcessStatusEnum.WITHDRAWN.getValue()));
|
||||
if (processAlls.isEmpty()) {
|
||||
p.setProjectStatus(ESPProjectStatus.NOT_STARTED.getValue());
|
||||
} else {
|
||||
p.setProjectStatus(ESPProjectStatus.IN_PROGRESS.getValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
espService.updateBatchById(inprogressList);
|
||||
log.info("计划状态更新完成");
|
||||
espService.updateBatchById(overdureList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user