update 调整作废,撤销等校验

This commit is contained in:
songgaoshuai 2024-02-29 19:07:25 +08:00
parent ac2e88dc0a
commit 40ab60b4fc
2 changed files with 11 additions and 6 deletions

View File

@ -471,9 +471,9 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
} }
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(processInvalidBo.getProcessInstanceId()).processInstanceTenantId(TenantHelper.getTenantId()).singleResult(); .processInstanceId(processInvalidBo.getProcessInstanceId()).processInstanceTenantId(TenantHelper.getTenantId()).singleResult();
// if (ObjectUtil.isNotEmpty(historicProcessInstance)) { if (ObjectUtil.isNotEmpty(historicProcessInstance) && BusinessStatusEnum.FINISH.getStatus().equals(historicProcessInstance.getBusinessStatus())) {
// BusinessStatusEnum.checkStatus(historicProcessInstance.getBusinessStatus()); throw new ServiceException("该单据已完成申请!");
// } }
runtimeService.updateBusinessStatus(processInvalidBo.getProcessInstanceId(), BusinessStatusEnum.INVALID.getStatus()); runtimeService.updateBusinessStatus(processInvalidBo.getProcessInstanceId(), BusinessStatusEnum.INVALID.getStatus());
runtimeService.deleteProcessInstance(processInvalidBo.getProcessInstanceId(), deleteReason); runtimeService.deleteProcessInstance(processInvalidBo.getProcessInstanceId(), deleteReason);
FlowProcessEventHandler processHandler = flowEventStrategy.getProcessHandler(historicProcessInstance.getProcessDefinitionKey()); FlowProcessEventHandler processHandler = flowEventStrategy.getProcessHandler(historicProcessInstance.getProcessDefinitionKey());
@ -587,7 +587,9 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
if (processInstance.isSuspended()) { if (processInstance.isSuspended()) {
throw new ServiceException(FlowConstant.MESSAGE_SUSPENDED); throw new ServiceException(FlowConstant.MESSAGE_SUSPENDED);
} }
BusinessStatusEnum.checkStatus(processInstance.getBusinessStatus()); if (BusinessStatusEnum.CANCEL.getStatus().equals(processInstance.getBusinessStatus())) {
throw new ServiceException("该单据已撤销!");
}
List<Task> taskList = taskService.createTaskQuery().taskTenantId(TenantHelper.getTenantId()).processInstanceId(processInstanceId).list(); List<Task> taskList = taskService.createTaskQuery().taskTenantId(TenantHelper.getTenantId()).processInstanceId(processInstanceId).list();
for (Task task : taskList) { for (Task task : taskList) {
taskService.setAssignee(task.getId(), String.valueOf(LoginHelper.getUserId())); taskService.setAssignee(task.getId(), String.valueOf(LoginHelper.getUserId()));

View File

@ -434,8 +434,8 @@ public class ActTaskServiceImpl implements IActTaskService {
throw new ServiceException(FlowConstant.MESSAGE_SUSPENDED); throw new ServiceException(FlowConstant.MESSAGE_SUSPENDED);
} }
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(task.getProcessInstanceId()).processInstanceTenantId(TenantHelper.getTenantId()).singleResult(); HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(task.getProcessInstanceId()).processInstanceTenantId(TenantHelper.getTenantId()).singleResult();
if (ObjectUtil.isNotEmpty(historicProcessInstance)) { if (ObjectUtil.isNotEmpty(historicProcessInstance) && BusinessStatusEnum.TERMINATION.getStatus().equals(historicProcessInstance.getBusinessStatus())) {
BusinessStatusEnum.checkStatus(historicProcessInstance.getBusinessStatus()); throw new ServiceException("该单据已终止!");
} }
try { try {
if (StringUtils.isBlank(terminationBo.getComment())) { if (StringUtils.isBlank(terminationBo.getComment())) {
@ -612,6 +612,9 @@ public class ActTaskServiceImpl implements IActTaskService {
List<ExecutionEntity> executionEntities = managementService.executeCommand(childByExecutionIdCmd); List<ExecutionEntity> executionEntities = managementService.executeCommand(childByExecutionIdCmd);
//校验单据 //校验单据
BusinessStatusEnum.checkStatus(processInstance.getBusinessStatus()); BusinessStatusEnum.checkStatus(processInstance.getBusinessStatus());
if (BusinessStatusEnum.BACK.getStatus().equals(processInstance.getBusinessStatus())) {
throw new ServiceException("该单据已退回!");
}
//判断是否有多个任务 //判断是否有多个任务
List<Task> taskList = taskService.createTaskQuery().processInstanceId(processInstanceId).taskTenantId(TenantHelper.getTenantId()).list(); List<Task> taskList = taskService.createTaskQuery().processInstanceId(processInstanceId).taskTenantId(TenantHelper.getTenantId()).list();
//申请人节点 //申请人节点