fix: 完善、流程一票否决
This commit is contained in:
+66
-2
@@ -1,24 +1,34 @@
|
||||
package com.jero.modules.activiti.process.aspect;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.MessageUtils;
|
||||
import com.jero.modules.activiti.entity.ProcessAll;
|
||||
import com.jero.modules.activiti.entity.ProcessApprovalRecord;
|
||||
import com.jero.modules.activiti.service.ProcessApprovalRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.bpmn.model.Process;
|
||||
import org.activiti.bpmn.model.UserTask;
|
||||
import org.activiti.engine.HistoryService;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @ClassName: 流程aop
|
||||
@@ -33,6 +43,12 @@ import java.util.Objects;
|
||||
public class ProcessAspect {
|
||||
@Resource
|
||||
private TaskService taskService;
|
||||
@Resource
|
||||
private HistoryService historyService;
|
||||
@Resource
|
||||
private RepositoryService repositoryService;
|
||||
@Resource
|
||||
private ProcessApprovalRecordService processApprovalRecordService;
|
||||
|
||||
// 流程审批
|
||||
@Pointcut("execution(public * com.jero.modules.activiti.process..*Controller.flowApproval(..))")
|
||||
@@ -50,8 +66,9 @@ public class ProcessAspect {
|
||||
}
|
||||
|
||||
@Before("processServiceFlowApproval() || processServiceFlowTransfer() || processServiceFlowReject()")
|
||||
@Order(1)
|
||||
public void doBefore(JoinPoint jp) {
|
||||
log.info("==========流程前置方法开始==========");
|
||||
log.info("==========流程合法性校验前置方法开始==========");
|
||||
if (!Objects.isNull(jp.getArgs())) {
|
||||
Map<String, Objects> map = JSON.parseObject(JSON.toJSONString(jp.getArgs()[0]), Map.class);
|
||||
Object object = map.get("processAll");
|
||||
@@ -73,7 +90,54 @@ public class ProcessAspect {
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("==========流程前置方法结束==========");
|
||||
log.info("==========流程合法性校验前置方法结束==========");
|
||||
}
|
||||
|
||||
@Before("processServiceFlowReject()")
|
||||
@Order(2)
|
||||
public void doBeforeCountersignReject(JoinPoint jp){
|
||||
log.info("==========流程会签节点驳回一票否决前置方法开始==========");
|
||||
if (!Objects.isNull(jp.getArgs())) {
|
||||
Map<String, Objects> map = JSON.parseObject(JSON.toJSONString(jp.getArgs()[0]), Map.class);
|
||||
Object object = map.get("processAll");
|
||||
ProcessAll processAll = JSON.parseObject(JSON.toJSONString(object), ProcessAll.class);
|
||||
|
||||
Object objectMap = map.get("map");
|
||||
Map<String, Object> stringObjectMap = JSON.parseObject(JSON.toJSONString(objectMap), Map.class);
|
||||
|
||||
if ((stringObjectMap.containsKey("pass") && !(boolean) stringObjectMap.get("pass")) && isMultiTask(processAll.getTaskId())){
|
||||
// 所有会签人数
|
||||
Integer all = (Integer) taskService.getVariable(processAll.getTaskId(), "nrOfInstances");
|
||||
taskService.setVariable(processAll.getTaskId(), "nrOfCompletedInstances", all);
|
||||
// 删除其他会签人员待办
|
||||
processApprovalRecordService.remove(
|
||||
new LambdaQueryWrapper<ProcessApprovalRecord>()
|
||||
.eq(ProcessApprovalRecord::getProcessInstanceId, processAll.getProcessInstanceId())
|
||||
.eq(ProcessApprovalRecord::getNodeId, processAll.getNodeId())
|
||||
.ne(ProcessApprovalRecord::getTaskId, processAll.getTaskId()));
|
||||
}
|
||||
}
|
||||
log.info("==========流程会签节点驳回一票否决前置方法结束==========");
|
||||
}
|
||||
|
||||
public boolean isMultiTask(String taskId){
|
||||
// 根据流程实例id查询
|
||||
Task task = taskService.createTaskQuery()
|
||||
.taskId(taskId)
|
||||
.singleResult();
|
||||
// 获取流程实例对象
|
||||
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(task.getProcessInstanceId())
|
||||
.singleResult();
|
||||
// 获取流程定义对象,主要用于判断流程任务结点是否为会签结点
|
||||
Process process = repositoryService.getBpmnModel(historicProcessInstance.getProcessDefinitionId())
|
||||
.getProcessById(historicProcessInstance.getProcessDefinitionKey());
|
||||
// 获取当前任务结点
|
||||
Optional<UserTask> userTask = process.getFlowElements().stream()
|
||||
.filter(flowElement -> task.getTaskDefinitionKey().equals(flowElement.getId()))
|
||||
.map(UserTask.class::cast)
|
||||
.findAny();
|
||||
return userTask.isPresent() && !Objects.isNull(userTask.get().getLoopCharacteristics());
|
||||
}
|
||||
|
||||
public boolean checkTaskExistence(String taskId) {
|
||||
|
||||
+2
-2
@@ -362,7 +362,7 @@ public class EsInspectFlowServiceImpl implements IEsInspectFlowService {
|
||||
if (!enterpriseStandardInspectRectifyPlanList.isEmpty()){
|
||||
enterpriseStandardInspectRectifyPlanList.forEach(enterpriseStandardInspectRectifyPlan ->
|
||||
// 自动生成企标稽查整改
|
||||
autoEsInspectReportFlow(esInspectVO, enterpriseStandardInspectRectifyPlan)
|
||||
autoEsInspectRectifyPlanFlow(esInspectVO, enterpriseStandardInspectRectifyPlan)
|
||||
);
|
||||
|
||||
// 企标整改计划
|
||||
@@ -375,7 +375,7 @@ public class EsInspectFlowServiceImpl implements IEsInspectFlowService {
|
||||
}
|
||||
}
|
||||
|
||||
private void autoEsInspectReportFlow(ProcessEsInspectVO esInspectVO, EnterpriseStandardInspectRectifyPlan enterpriseStandardInspectRectifyPlan) {
|
||||
private void autoEsInspectRectifyPlanFlow(ProcessEsInspectVO esInspectVO, EnterpriseStandardInspectRectifyPlan enterpriseStandardInspectRectifyPlan) {
|
||||
if (!EsInspectRectifyCommon.INSPECT_RECTIFY_STATUS_1.equals(enterpriseStandardInspectRectifyPlan.getRectifyStatus())){
|
||||
return;
|
||||
}
|
||||
|
||||
+2
-2
@@ -307,7 +307,7 @@ public class EsInspectPlanFlowServiceImpl implements IEsInspectPlanFlowService {
|
||||
.set(ProcessApprovalRecord::getFinishFlag, FinishFlagEnum.COMPLETE.getValue()));
|
||||
|
||||
Task task = taskService.createTaskQuery().taskId(processAll.getTaskId()).singleResult();
|
||||
if (task!= null) {
|
||||
if (task != null) {
|
||||
// 完成任务
|
||||
taskService.complete(task.getId(), map);
|
||||
// 判断是否是最后一个节点
|
||||
@@ -325,7 +325,7 @@ public class EsInspectPlanFlowServiceImpl implements IEsInspectPlanFlowService {
|
||||
sendMessageDTO.setToUserId(v.getLinkUserIds());
|
||||
Map<String, String> sendMap = new HashMap<>();
|
||||
ProcessAll process = processAllService.getByProcessInstanceId(processAll.getProcessInstanceId());
|
||||
sendMap.put("prcNum", StringUtils.isNotBlank(process.getPrcNum()) ? process.getPrcNum() : "");
|
||||
sendMap.put("prcNum", process.getId());
|
||||
sendMap.put("prcName", process.getPrcName());
|
||||
sendMessageDTO.setMap(sendMap);
|
||||
sendMessageAPI.sendMessage(sendMessageDTO);
|
||||
|
||||
+2
-1
@@ -260,7 +260,8 @@ public class EsInspectRectifyFlowServiceImpl implements IEsInspectRectifyFlowSer
|
||||
enterpriseStandardInspectRectifyPlanService.update(
|
||||
new LambdaUpdateWrapper<EnterpriseStandardInspectRectifyPlan>()
|
||||
.eq(EnterpriseStandardInspectRectifyPlan::getId, processEsInspectReportVO.getInspectRectifyPlanId())
|
||||
.set(EnterpriseStandardInspectRectifyPlan::getRectifyStatus, EsInspectRectifyCommon.INSPECT_RECTIFY_STATUS_3));
|
||||
.set(EnterpriseStandardInspectRectifyPlan::getRectifyStatus, EsInspectRectifyCommon.INSPECT_RECTIFY_STATUS_3)
|
||||
.set(EnterpriseStandardInspectRectifyPlan::getActualCompleteDate, new Date()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -138,4 +138,11 @@ public class EnterpriseStandardInspectVo {
|
||||
@ApiModelProperty(value = "ids 查询用")
|
||||
@TableField(exist = false)
|
||||
private String ids;
|
||||
|
||||
/**
|
||||
* 创建日期 查询用
|
||||
*/
|
||||
@ApiModelProperty(value = "创建日期 查询用")
|
||||
@TableField(exist = false)
|
||||
private String createDate;
|
||||
}
|
||||
|
||||
+7
@@ -228,6 +228,13 @@ public class EnterpriseStandardInspectServiceImpl extends ServiceImpl<Enterprise
|
||||
List<String> list = Arrays.asList(inspectStatus.split(","));
|
||||
queryWrapper.and(qw -> list.forEach(v -> qw.or(iqw -> iqw.eq("inspect_status", v))));
|
||||
}
|
||||
if (StringUtils.isNotBlank(enterpriseStandardInspectVo.getCreateDate())){
|
||||
String[] date = enterpriseStandardInspectVo.getCreateDate().split(",");
|
||||
queryWrapper.between("create_time", date[0], date[1]);
|
||||
}
|
||||
queryWrapper.eq(StringUtils.isNotBlank(enterpriseStandardInspectVo.getBelongDept()), "belong_dept", enterpriseStandardInspectVo.getBelongDept());
|
||||
queryWrapper.eq(StringUtils.isNotBlank(enterpriseStandardInspectVo.getInspectNo()), "inspect_no", enterpriseStandardInspectVo.getInspectNo());
|
||||
queryWrapper.eq(StringUtils.isNotBlank(enterpriseStandardInspectVo.getInspectName()), "inspect_name", enterpriseStandardInspectVo.getInspectName());
|
||||
queryWrapper.eq(StringUtils.isNotBlank(enterpriseStandardInspectVo.getInspectUser()), "inspect_user", enterpriseStandardInspectVo.getInspectUser());
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
return queryWrapper;
|
||||
|
||||
Reference in New Issue
Block a user