From 40ab60b4fc4feebeaf17c64915d4c25ded0e819a Mon Sep 17 00:00:00 2001 From: songgaoshuai <1742057357@qq.com> Date: Thu, 29 Feb 2024 19:07:25 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E8=B0=83=E6=95=B4=E4=BD=9C=E5=BA=9F?= =?UTF-8?q?=EF=BC=8C=E6=92=A4=E9=94=80=E7=AD=89=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ActProcessInstanceServiceImpl.java | 10 ++++++---- .../workflow/service/impl/ActTaskServiceImpl.java | 7 +++++-- 2 files changed, 11 insertions(+), 6 deletions(-) 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(); //申请人节点