fix 80334 未符合项流程发起,页面状态没有发生变化

This commit is contained in:
lijiarao
2024-01-08 16:02:22 +08:00
parent 20d58adf06
commit 94a2db2a42
4 changed files with 62 additions and 7 deletions
@@ -33,6 +33,12 @@ public class ProcessProjectNotMetLink {
@ApiModelProperty(value = "主键ID")
private String id;
/**
* 流程主表id
*/
@ApiModelProperty(value = "未符合项id")
private String projectNotMetId;
/**
* 流程主表id
*/
@@ -2,6 +2,7 @@ package com.jero.modules.activiti.process.projectnotmet.service;
import cn.hutool.core.collection.CollStreamUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.vo.DictModel;
@@ -25,15 +26,20 @@ import com.jero.modules.activiti.process.projectnotmet.vo.ProcessProjectNotMetVO
import com.jero.modules.activiti.service.ProcessAllService;
import com.jero.modules.activiti.service.ProcessApprovalRecordService;
import com.jero.modules.laws.common.util.CurrentUserUtil;
import com.jero.modules.projectLibrary.entity.LawsEvaluationNotMet;
import com.jero.modules.projectLibrary.service.ILawsEvaluationNotMetService;
import org.activiti.engine.TaskService;
import org.activiti.engine.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import static com.jero.modules.projectLibrary.common.AssessCommon.*;
/**
* @author liJiaRao
* @date 2023-12-23 19:58
@@ -53,6 +59,8 @@ public class ProcessProjectNotMetService extends ServiceImpl<ProcessProjectNotMe
private TaskService taskService;
@Resource
private ProcessProjectNotMetLinkService processProjectNotMetLinkService;
@Resource
private ILawsEvaluationNotMetService lawsEvaluationNotMetService;
public ProcessInfoVO<ProcessProjectNotMetVO> queryProcessInfoVO(String draftId, String processInstanceId, String taskId) {
if (StringUtils.isNotBlank(draftId) && StringUtils.isBlank(taskId)) {
@@ -124,9 +132,12 @@ public class ProcessProjectNotMetService extends ServiceImpl<ProcessProjectNotMe
this.save(processProjectNotMet);
String processProjectNotMetId = processProjectNotMet.getId();
processInfoVO.setBusinessId(processProjectNotMetId);
//保存关联标准
//保存关联未符合项
List<ProcessProjectNotMetLink> processProjectNotMetLinks = businessInfoDTO.getProcessProjectNotMetLinks();
//获取关联的未符合项id
List<String> projectNotMetIdList = CollStreamUtil.toList(processProjectNotMetLinks, ProcessProjectNotMetLink::getId);
processProjectNotMetLinks.forEach(item -> {
item.setProjectNotMetId(item.getId());
item.setProcessId(processProjectNotMetId);
item.setId(null);
}
@@ -148,6 +159,11 @@ public class ProcessProjectNotMetService extends ServiceImpl<ProcessProjectNotMe
//userInfoMap.put(ProcessProjectNotMetCommon.MANAGER_LEADER, distinctAllResponsibleUnitLeaderListJoin);
//processInfoVO.setUserInfoMap(userInfoMap);
processHandleService.startProcess(processInfoVO);
//更新未符合项列表状态
LambdaUpdateWrapper<LawsEvaluationNotMet> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(LawsEvaluationNotMet::getState, RECTIFICATION);
wrapper.in(LawsEvaluationNotMet::getId,projectNotMetIdList);
lawsEvaluationNotMetService.update(wrapper);
}
public void approveTask(ProcessInfoVO<ProcessProjectNotMetVO> processInfoVO, boolean pass) {
@@ -189,6 +205,16 @@ public class ProcessProjectNotMetService extends ServiceImpl<ProcessProjectNotMe
}
variables.put(ProcessProjectNotMetCommon.PASS, pass);
taskService.complete(processDTO.getTaskId(), variables);
if (!pass){
ProcessProjectNotMetVO businessInfoDTO = processInfoVO.getBusinessInfoDTO();
List<ProcessProjectNotMetLink> processProjectNotMetLinks = businessInfoDTO.getProcessProjectNotMetLinks();
List<String> projectNotMetIdList = CollStreamUtil.toList(processProjectNotMetLinks, ProcessProjectNotMetLink::getProjectNotMetId);
//更新未符合项列表状态
LambdaUpdateWrapper<LawsEvaluationNotMet> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(LawsEvaluationNotMet::getState, RECTIFICATION);
wrapper.in(LawsEvaluationNotMet::getId,projectNotMetIdList);
lawsEvaluationNotMetService.update(wrapper);
}
}
private void fggcsspApprove(ProcessInfoVO<ProcessProjectNotMetVO> processInfoVO, ProcessDTO processDTO, boolean pass) {
@@ -205,6 +231,14 @@ public class ProcessProjectNotMetService extends ServiceImpl<ProcessProjectNotMe
}
variables.put(ProcessProjectNotMetCommon.PASS, pass);
taskService.complete(processDTO.getTaskId(), variables);
//更新未符合项列表状态
ProcessProjectNotMetVO businessInfoDTO = processInfoVO.getBusinessInfoDTO();
List<ProcessProjectNotMetLink> processProjectNotMetLinks = businessInfoDTO.getProcessProjectNotMetLinks();
List<String> projectNotMetIdList = CollStreamUtil.toList(processProjectNotMetLinks, ProcessProjectNotMetLink::getProjectNotMetId);
LambdaUpdateWrapper<LawsEvaluationNotMet> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(LawsEvaluationNotMet::getState, pass ? DONE : RECTIFICATION);
wrapper.in(LawsEvaluationNotMet::getId,projectNotMetIdList);
lawsEvaluationNotMetService.update(wrapper);
}
public void submit(ProcessInfoVO<ProcessProjectNotMetVO> processInfoVO) {
@@ -232,6 +266,12 @@ public class ProcessProjectNotMetService extends ServiceImpl<ProcessProjectNotMe
}
processProjectNotMetLinkService.updateBatchById(processProjectNotMetLinks);
taskService.complete(taskId);
List<String> projectNotMetIdList = CollStreamUtil.toList(processProjectNotMetLinks, ProcessProjectNotMetLink::getProjectNotMetId);
//更新未符合项列表状态
LambdaUpdateWrapper<LawsEvaluationNotMet> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(LawsEvaluationNotMet::getState, UNDER_APPROVAL);
wrapper.in(LawsEvaluationNotMet::getId,projectNotMetIdList);
lawsEvaluationNotMetService.update(wrapper);
}
public void saveToDraft(ProcessInfoVO<ProcessProjectNotMetVO> processInfoVO) {
@@ -31,11 +31,15 @@ public class UpdateStatusJob implements Job {
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
DateTime date = DateUtil.parseDateTime(DateUtil.formatDateTime(new Date()));
date = date.setField(DateField.SECOND,0);
date = date
.setField(DateField.HOUR_OF_DAY,0)
.setField(DateField.MINUTE,0)
.setField(DateField.SECOND,0);
//预计整改完成日期前一天
DateTime theDayBefore = DateUtil.offsetDay(date, 1);
LambdaQueryWrapper<LawsEvaluationNotMet> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(LawsEvaluationNotMet::getExpectedTime,theDayBefore);
wrapper.eq(LawsEvaluationNotMet::getState, AssessCommon.TO_BE_RECTIFIED);
List<LawsEvaluationNotMet> list = lawsEvaluationNotMetService.list(wrapper);
for (LawsEvaluationNotMet lawsEvaluationNotMet : list) {
LambdaUpdateWrapper<LawsEvaluationNotMet> updateWrapper = new LambdaUpdateWrapper<>();
@@ -46,7 +50,12 @@ public class UpdateStatusJob implements Job {
//预计整改完成日期后一天
DateTime theDayAfter = DateUtil.offsetDay(date, -1);
LambdaQueryWrapper<LawsEvaluationNotMet> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(LawsEvaluationNotMet::getExpectedTime,theDayAfter);
wrapper1.le(LawsEvaluationNotMet::getExpectedTime,theDayAfter);
wrapper1.and(a -> {
a.eq(LawsEvaluationNotMet::getState, AssessCommon.TO_BE_RECTIFIED)
.or()
.eq(LawsEvaluationNotMet::getState, AssessCommon.WARNING);
});
List<LawsEvaluationNotMet> list1 = lawsEvaluationNotMetService.list(wrapper1);
for (LawsEvaluationNotMet lawsEvaluationNotMet : list1) {
LambdaUpdateWrapper<LawsEvaluationNotMet> updateWrapper = new LambdaUpdateWrapper<>();
@@ -75,12 +75,12 @@ public class LawsEvaluationNotMetServiceImpl extends ServiceImpl<LawsEvaluationN
parameterMap.remove("standardNumber");
parameterMap.remove("standardName");
QueryWrapper<LawsEvaluationNotMet> queryWrapper = QueryGenerator.initQueryWrapper(lawsEvaluationNotMet, parameterMap);
String standardNumber = lawsEvaluationNotMet.getStandardNumber();
if (StringUtils.isNotBlank(standardNumber)){
String standardNumberOrName = lawsEvaluationNotMet.getStandardNumberOrName();
if (StringUtils.isNotBlank(standardNumberOrName)){
queryWrapper.lambda().and(
a-> a.like(LawsEvaluationNotMet::getStandardNumber,standardNumber)
a-> a.like(LawsEvaluationNotMet::getStandardNumber,standardNumberOrName)
.or()
.like(LawsEvaluationNotMet::getStandardName,standardNumber)
.like(LawsEvaluationNotMet::getStandardName,standardNumberOrName)
);
}
Page<LawsEvaluationNotMet> page = new Page<>(pageNo, pageSize);