diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActProcessInstanceServiceImpl.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActProcessInstanceServiceImpl.java index ed9c70083..39b44000c 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActProcessInstanceServiceImpl.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActProcessInstanceServiceImpl.java @@ -471,9 +471,9 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService } HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .processInstanceId(processInvalidBo.getProcessInstanceId()).processInstanceTenantId(TenantHelper.getTenantId()).singleResult(); -// if (ObjectUtil.isNotEmpty(historicProcessInstance)) { -// BusinessStatusEnum.checkStatus(historicProcessInstance.getBusinessStatus()); -// } + if (ObjectUtil.isNotEmpty(historicProcessInstance) && BusinessStatusEnum.FINISH.getStatus().equals(historicProcessInstance.getBusinessStatus())) { + throw new ServiceException("该单据已完成申请!"); + } runtimeService.updateBusinessStatus(processInvalidBo.getProcessInstanceId(), BusinessStatusEnum.INVALID.getStatus()); runtimeService.deleteProcessInstance(processInvalidBo.getProcessInstanceId(), deleteReason); FlowProcessEventHandler processHandler = flowEventStrategy.getProcessHandler(historicProcessInstance.getProcessDefinitionKey()); @@ -587,7 +587,9 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService if (processInstance.isSuspended()) { throw new ServiceException(FlowConstant.MESSAGE_SUSPENDED); } - BusinessStatusEnum.checkStatus(processInstance.getBusinessStatus()); + if (BusinessStatusEnum.CANCEL.getStatus().equals(processInstance.getBusinessStatus())) { + throw new ServiceException("该单据已撤销!"); + } List taskList = taskService.createTaskQuery().taskTenantId(TenantHelper.getTenantId()).processInstanceId(processInstanceId).list(); for (Task task : taskList) { taskService.setAssignee(task.getId(), String.valueOf(LoginHelper.getUserId())); diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActTaskServiceImpl.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActTaskServiceImpl.java index 1782cd24b..3a27c30b1 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActTaskServiceImpl.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActTaskServiceImpl.java @@ -434,8 +434,8 @@ public class ActTaskServiceImpl implements IActTaskService { throw new ServiceException(FlowConstant.MESSAGE_SUSPENDED); } HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(task.getProcessInstanceId()).processInstanceTenantId(TenantHelper.getTenantId()).singleResult(); - if (ObjectUtil.isNotEmpty(historicProcessInstance)) { - BusinessStatusEnum.checkStatus(historicProcessInstance.getBusinessStatus()); + if (ObjectUtil.isNotEmpty(historicProcessInstance) && BusinessStatusEnum.TERMINATION.getStatus().equals(historicProcessInstance.getBusinessStatus())) { + throw new ServiceException("该单据已终止!"); } try { if (StringUtils.isBlank(terminationBo.getComment())) { @@ -612,6 +612,9 @@ public class ActTaskServiceImpl implements IActTaskService { List executionEntities = managementService.executeCommand(childByExecutionIdCmd); //校验单据 BusinessStatusEnum.checkStatus(processInstance.getBusinessStatus()); + if (BusinessStatusEnum.BACK.getStatus().equals(processInstance.getBusinessStatus())) { + throw new ServiceException("该单据已退回!"); + } //判断是否有多个任务 List taskList = taskService.createTaskQuery().processInstanceId(processInstanceId).taskTenantId(TenantHelper.getTenantId()).list(); //申请人节点