fix(企标稽查整改): 79475

This commit is contained in:
yjz
2023-12-26 16:30:41 +08:00
parent 737282a71e
commit eee96044c3
7 changed files with 204 additions and 22 deletions
@@ -73,7 +73,7 @@ public class EsInspectFlowServiceImpl implements IEsInspectFlowService {
private final EnterpriseStandardInspectRectifyPlanService enterpriseStandardInspectRectifyPlanService;
private final EnterpriseStandardInspectReportService enterpriseStandardInspectReportService;
private final IEsInspectRectifyFlowService esInspectReportFlowService;
private final IProcessEsInspectRectifyService processEsInspectReportService;
private final IProcessEsInspectRectifyService processEsInspectRectifyService;
public EsInspectFlowServiceImpl(ProcessAllService processAllService,
ProcessApprovalRecordService processApprovalRecordService,
ProcessDraftService processDraftService,
@@ -97,7 +97,7 @@ public class EsInspectFlowServiceImpl implements IEsInspectFlowService {
this.enterpriseStandardInspectRectifyPlanService = enterpriseStandardInspectRectifyPlanService;
this.enterpriseStandardInspectReportService = enterpriseStandardInspectReportService;
this.esInspectReportFlowService = esInspectReportFlowService;
this.processEsInspectReportService = processEsInspectReportService;
this.processEsInspectRectifyService = processEsInspectReportService;
}
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
@@ -403,7 +403,7 @@ public class EsInspectFlowServiceImpl implements IEsInspectFlowService {
processEsInspectRectify.setProjectId(processAll.getProjectId());
processEsInspectRectify.setInspectRectifyPlanId(enterpriseStandardInspectRectifyPlan.getId());
esInspectReportFlowVO.setProcessEsInspectRectify(processEsInspectRectify);
processEsInspectReportService.save(processEsInspectRectify);
processEsInspectRectifyService.save(processEsInspectRectify);
// 处理人员信息
Map<String, Object> map = new HashMap<>();
@@ -51,4 +51,13 @@ public class EsInspectRectifyCommon {
* 整改状态 1:整改中 2:审核中 3:整改已完成 4:无需整改
*/
public static final String INSPECT_RECTIFY_STATUS_4 = "4";
/**
* 操作类型 1:提交整改结果 2:申请延期
*/
public static final String OPERATION_TYPE_1 = "1";
/**
* 操作类型 1:提交整改结果 2:申请延期
*/
public static final String OPERATION_TYPE_2 = "2";
}
@@ -14,6 +14,8 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
/**
* @ClassName: 企标稽查整改
* @Description:
@@ -68,7 +70,7 @@ public class EsInspectRectifyFlowController {
@AutoLog(value = "企标稽查整改-流程审批")
@ApiOperation(value="企标稽查整改-流程审批", notes="企标稽查整改-流程审批")
@PostMapping(value = "/flowApproval")
public Result<T> flowApproval(@RequestBody EsInspectRectifyFlowVO esInspectReportFlowVO) {
public Result<T> flowApproval(@RequestBody EsInspectRectifyFlowVO esInspectReportFlowVO) throws ParseException {
esInspectReportFlowService.flowApproval(esInspectReportFlowVO);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
@@ -81,7 +83,7 @@ public class EsInspectRectifyFlowController {
@AutoLog(value = "企标稽查整改-驳回")
@ApiOperation(value="企标稽查整改-驳回", notes="企标稽查整改-驳回")
@PostMapping(value = "/flowReject")
public Result<T> flowReject(@RequestBody EsInspectRectifyFlowVO esInspectReportFlowVO) {
public Result<T> flowReject(@RequestBody EsInspectRectifyFlowVO esInspectReportFlowVO) throws ParseException {
log.info("");
esInspectReportFlowService.flowApproval(esInspectReportFlowVO);
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
@@ -58,4 +58,8 @@ public class ProcessEsInspectRectify extends BaseEntity {
@Excel(name = "延期说明", width = 15)
@ApiModelProperty(value = "延期说明")
private String delayDetail;
/**是否生成过新的流程(1:是 0:否)*/
@Excel(name = "是否生成过新的流程(1:是 0:否)", width = 15)
@ApiModelProperty(value = "是否生成过新的流程(1:是 0:否)")
private String isDelayCreate;
}
@@ -0,0 +1,117 @@
package com.jero.modules.activiti.process.esinspectrectify.job;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.jero.common.constant.enums.YesOrNoEnum;
import com.jero.common.exception.JeroBootException;
import com.jero.common.util.SnowflakeUtils;
import com.jero.modules.activiti.entity.ProcessAll;
import com.jero.modules.activiti.entity.ProcessApprovalRecord;
import com.jero.modules.activiti.process.esinspectrectify.entity.ProcessEsInspectRectify;
import com.jero.modules.activiti.process.esinspectrectify.service.IEsInspectRectifyFlowService;
import com.jero.modules.activiti.process.esinspectrectify.service.IProcessEsInspectRectifyService;
import com.jero.modules.activiti.process.esinspectrectify.vo.EsInspectRectifyFlowVO;
import com.jero.modules.activiti.service.ProcessAllService;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandardInspectRectifyPlan;
import com.jero.modules.laws.enterprise.service.EnterpriseStandardInspectRectifyPlanService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @ClassName: DelayApplyJob
* @Description: 企标稽查整改-申请延期生成稽查整改定时任务
* @Author: yjz
* @Date: 2023-12-26 09:59
* @Version: 1.0
**/
@Slf4j
@Transactional(rollbackFor = RuntimeException.class)
public class DelayApplyJob implements Job {
@Resource
private IEsInspectRectifyFlowService esInspectRectifyFlowService;
@Resource
private IProcessEsInspectRectifyService processEsInspectRectifyService;
@Resource
private ProcessAllService processAllService;
@Resource
private EnterpriseStandardInspectRectifyPlanService enterpriseStandardInspectRectifyPlanService;
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JeroBootException {
log.info("企标稽查整改-申请延期生成稽查整改定时任务开始");
long num = 0L;
// 需要生成的企标稽查整改
Date date = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date parse;
try {
parse = dateFormat.parse(dateFormat.format(date));
} catch (ParseException e) {
throw new JeroBootException(e);
}
List<ProcessEsInspectRectify> list = processEsInspectRectifyService.list(
new LambdaQueryWrapper<ProcessEsInspectRectify>()
.eq(ProcessEsInspectRectify::getIsDelayCreate, YesOrNoEnum.NO.getValue())
.eq(ProcessEsInspectRectify::getApplyDelayDate, parse));
List<String> idList = new ArrayList<>();
// 生成新整改流程
for (ProcessEsInspectRectify processEsInspectRectify : list) {
idList.add(processEsInspectRectify.getId());
EsInspectRectifyFlowVO esInspectReportFlowVO = new EsInspectRectifyFlowVO();
// 处理流程信息
ProcessAll oldProcessAll = processAllService.getOne(
new LambdaQueryWrapper<ProcessAll>()
.eq(ProcessAll::getProjectId, processEsInspectRectify.getProjectId()));
ProcessAll processAll = new ProcessAll();
processAll.setProjectId(String.valueOf(SnowflakeUtils.snowflake()));
processAll.setPrcName(oldProcessAll.getPrcName());
esInspectReportFlowVO.setProcessAll(processAll);
// 整改计划
EnterpriseStandardInspectRectifyPlan enterpriseStandardInspectRectifyPlan = enterpriseStandardInspectRectifyPlanService.getById(processEsInspectRectify.getInspectRectifyPlanId());
// 处理流程审批信息
ProcessApprovalRecord processApprovalRecord = new ProcessApprovalRecord();
processApprovalRecord.setProjectId(processAll.getProjectId());
processApprovalRecord.setUserId(enterpriseStandardInspectRectifyPlan.getResponseUser());
esInspectReportFlowVO.setProcessApprovalRecord(processApprovalRecord);
// 处理业务表数据
ProcessEsInspectRectify newProcessEsInspectRectify = new ProcessEsInspectRectify();
newProcessEsInspectRectify.setId(String.valueOf(SnowflakeUtils.snowflake()));
newProcessEsInspectRectify.setProjectId(processAll.getProjectId());
newProcessEsInspectRectify.setIsDelayCreate(YesOrNoEnum.NO.getValue());
newProcessEsInspectRectify.setInspectRectifyPlanId(processEsInspectRectify.getInspectRectifyPlanId());
esInspectReportFlowVO.setProcessEsInspectRectify(newProcessEsInspectRectify);
processEsInspectRectifyService.save(newProcessEsInspectRectify);
// 处理人员信息
Map<String, Object> map = new HashMap<>();
map.put("responsible", enterpriseStandardInspectRectifyPlan.getResponseUser());
map.put("leader", "请选择");
map.put("responsibleApproval", "请选择");
esInspectReportFlowVO.setMap(map);
esInspectRectifyFlowService.createReportFlow(esInspectReportFlowVO);
num += 1;
}
if (!idList.isEmpty()){
// 修改状态
processEsInspectRectifyService.update(
new LambdaUpdateWrapper<ProcessEsInspectRectify>()
.in(ProcessEsInspectRectify::getId, idList)
.set(ProcessEsInspectRectify::getIsDelayCreate, YesOrNoEnum.YES.getValue()));
}
log.info("企标稽查整改-申请延期生成稽查整改定时任务结束");
log.info("企标稽查整改-申请延期生成稽查整改{}条", num);
}
}
@@ -2,6 +2,8 @@ package com.jero.modules.activiti.process.esinspectrectify.service;
import com.jero.modules.activiti.process.esinspectrectify.vo.EsInspectRectifyFlowVO;
import java.text.ParseException;
/**
* @ClassName: IEsInspectReportFlowService
* @Description:
@@ -34,7 +36,7 @@ public interface IEsInspectRectifyFlowService {
* 企标稽查流程-流程审批
* @param esInspectReportFlowVO
*/
void flowApproval(EsInspectRectifyFlowVO esInspectReportFlowVO);
void flowApproval(EsInspectRectifyFlowVO esInspectReportFlowVO) throws ParseException;
/**
* 企标稽查流程-流程转办
@@ -3,6 +3,7 @@ package com.jero.modules.activiti.process.esinspectrectify.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.jero.common.constant.enums.YesOrNoEnum;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.SnowflakeUtils;
@@ -37,10 +38,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -57,7 +57,7 @@ public class EsInspectRectifyFlowServiceImpl implements IEsInspectRectifyFlowSer
private final ProcessApprovalRecordService processApprovalRecordService;
private final ProcessDraftService processDraftService;
private final ProcessNodeLinkService processNodeLinkService;
private final IProcessEsInspectRectifyService processEsInspectReportService;
private final IProcessEsInspectRectifyService processEsInspectRectifyService;
private final EnterpriseStandardInspectRectifyPlanService enterpriseStandardInspectRectifyPlanService;
public EsInspectRectifyFlowServiceImpl(ProcessAllService processAllService,
@@ -70,7 +70,7 @@ public class EsInspectRectifyFlowServiceImpl implements IEsInspectRectifyFlowSer
this.processApprovalRecordService = processApprovalRecordService;
this.processDraftService = processDraftService;
this.processNodeLinkService = processNodeLinkService;
this.processEsInspectReportService = processEsInspectReportService;
this.processEsInspectRectifyService = processEsInspectReportService;
this.enterpriseStandardInspectRectifyPlanService = enterpriseStandardInspectRectifyPlanService;
}
@@ -162,7 +162,7 @@ public class EsInspectRectifyFlowServiceImpl implements IEsInspectRectifyFlowSer
// 保存业务表信息
ProcessEsInspectRectify processEsInspectReport = esInspectReportFlowVO.getProcessEsInspectRectify();
processEsInspectReportService.updateById(processEsInspectReport);
processEsInspectRectifyService.updateById(processEsInspectReport);
}
@Override
@@ -216,7 +216,7 @@ public class EsInspectRectifyFlowServiceImpl implements IEsInspectRectifyFlowSer
}
@Override
public void flowApproval(EsInspectRectifyFlowVO esInspectReportFlowVO) {
public void flowApproval(EsInspectRectifyFlowVO esInspectReportFlowVO) throws ParseException {
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// 流程信息
ProcessAll processAll = esInspectReportFlowVO.getProcessAll();
@@ -238,7 +238,7 @@ public class EsInspectRectifyFlowServiceImpl implements IEsInspectRectifyFlowSer
// 保存业务表信息
ProcessEsInspectRectify processEsInspectReport = esInspectReportFlowVO.getProcessEsInspectRectify();
processEsInspectReportService.updateById(processEsInspectReport);
processEsInspectRectifyService.updateById(processEsInspectReport);
// 更新流程审批信息
processApprovalRecordService.update(
@@ -258,13 +258,61 @@ public class EsInspectRectifyFlowServiceImpl implements IEsInspectRectifyFlowSer
taskService.complete(task.getId(), map);
// 判断是否是最后一个节点
if (isLastNode(processAll.getProcessInstanceId())){
ProcessEsInspectRectifyVO processEsInspectReportVO = processEsInspectReportService.queryByProjectId(processAll.getProjectId());
// 更新整改状态
enterpriseStandardInspectRectifyPlanService.update(
new LambdaUpdateWrapper<EnterpriseStandardInspectRectifyPlan>()
.eq(EnterpriseStandardInspectRectifyPlan::getId, processEsInspectReportVO.getInspectRectifyPlanId())
.set(EnterpriseStandardInspectRectifyPlan::getRectifyStatus, EsInspectRectifyCommon.INSPECT_RECTIFY_STATUS_3)
.set(EnterpriseStandardInspectRectifyPlan::getActualCompleteDate, new Date()));
ProcessEsInspectRectifyVO processEsInspectReportVO = processEsInspectRectifyService.queryByProjectId(processAll.getProjectId());
Date date = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date parse = dateFormat.parse(dateFormat.format(date));
// 是否申请延期
if (EsInspectRectifyCommon.OPERATION_TYPE_2.equals(processEsInspectReportVO.getOperationType())
&& (processEsInspectReportVO.getApplyDelayDate().before(parse)
|| processEsInspectReportVO.getApplyDelayDate().equals(parse))){
// 生成新整改流程
EsInspectRectifyFlowVO newEsInspectReportFlowVO = new EsInspectRectifyFlowVO();
// 处理流程信息
ProcessAll newProcessAll = new ProcessAll();
newProcessAll.setProjectId(String.valueOf(SnowflakeUtils.snowflake()));
newProcessAll.setPrcName(processAll.getPrcName());
newEsInspectReportFlowVO.setProcessAll(newProcessAll);
// 整改计划
EnterpriseStandardInspectRectifyPlan enterpriseStandardInspectRectifyPlan = enterpriseStandardInspectRectifyPlanService.getById(processEsInspectReportVO.getInspectRectifyPlanId());
// 处理流程审批信息
ProcessApprovalRecord newProcessApprovalRecord = new ProcessApprovalRecord();
newProcessApprovalRecord.setId(String.valueOf(SnowflakeUtils.snowflake()));
newProcessApprovalRecord.setProjectId(newProcessAll.getProjectId());
newProcessApprovalRecord.setUserId(enterpriseStandardInspectRectifyPlan.getResponseUser());
newEsInspectReportFlowVO.setProcessApprovalRecord(newProcessApprovalRecord);
// 处理业务表数据
ProcessEsInspectRectify processEsInspectRectify = new ProcessEsInspectRectify();
processEsInspectRectify.setId(String.valueOf(SnowflakeUtils.snowflake()));
processEsInspectRectify.setProjectId(newProcessAll.getProjectId());
processEsInspectRectify.setIsDelayCreate(YesOrNoEnum.NO.getValue());
processEsInspectRectify.setInspectRectifyPlanId(processEsInspectReportVO.getInspectRectifyPlanId());
newEsInspectReportFlowVO.setProcessEsInspectRectify(processEsInspectRectify);
processEsInspectRectifyService.save(processEsInspectRectify);
// 处理人员信息
Map<String, Object> newMap = new HashMap<>();
newMap.put("responsible", enterpriseStandardInspectRectifyPlan.getResponseUser());
newMap.put("leader", "请选择");
newMap.put("responsibleApproval", "请选择");
newEsInspectReportFlowVO.setMap(newMap);
createReportFlow(newEsInspectReportFlowVO);
// 修改状态
processEsInspectRectifyService.update(
new LambdaUpdateWrapper<ProcessEsInspectRectify>()
.in(ProcessEsInspectRectify::getId, processEsInspectReportVO.getId())
.set(ProcessEsInspectRectify::getIsDelayCreate, YesOrNoEnum.YES.getValue()));
}else {
// 更新整改状态
enterpriseStandardInspectRectifyPlanService.update(new LambdaUpdateWrapper<EnterpriseStandardInspectRectifyPlan>()
.eq(EnterpriseStandardInspectRectifyPlan::getId, processEsInspectReportVO.getInspectRectifyPlanId())
.set(EnterpriseStandardInspectRectifyPlan::getRectifyStatus, EsInspectRectifyCommon.INSPECT_RECTIFY_STATUS_3)
.set(EnterpriseStandardInspectRectifyPlan::getActualCompleteDate, parse));
}
}
}
}