| | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | | * 流程实例 服务层实现 |
| | | * |
| | |
| | | for (HistoricTaskInstance historicTaskInstance : list) { |
| | | ActHistoryInfoVo actHistoryInfoVo = new ActHistoryInfoVo(); |
| | | BeanUtils.copyProperties(historicTaskInstance, actHistoryInfoVo); |
| | | actHistoryInfoVo.setAssignee(StringUtils.isNotBlank(historicTaskInstance.getAssignee()) ? Long.valueOf(historicTaskInstance.getAssignee()) : null); |
| | | actHistoryInfoVo.setStatus(actHistoryInfoVo.getEndTime() == null ? "待处理" : "已处理"); |
| | | if (ObjectUtil.isNotEmpty(historicTaskInstance.getDurationInMillis())) { |
| | | actHistoryInfoVo.setRunDuration(getDuration(historicTaskInstance.getDurationInMillis())); |
| | |
| | | for (Task task : StreamUtils.filter(list, e -> StringUtils.isBlank(e.getParentTaskId()))) { |
| | | taskService.addComment(task.getId(), task.getProcessInstanceId(), TaskStatusEnum.INVALID.getStatus(), deleteReason); |
| | | } |
| | | HistoricProcessInstance historicProcessInstance = QueryUtils.hisInstanceQuery(processInvalidBo.getProcessInstanceId()).singleResult(); |
| | | if (ObjectUtil.isNotEmpty(historicProcessInstance) && BusinessStatusEnum.FINISH.getStatus().equals(historicProcessInstance.getBusinessStatus())) { |
| | | throw new ServiceException("该单据已完成申请!"); |
| | | } |
| | | HistoricProcessInstance historicProcessInstance = QueryUtils.hisInstanceQuery(processInvalidBo.getProcessInstanceId()).singleResult(); |
| | | BusinessStatusEnum.checkInvalidStatus(historicProcessInstance.getBusinessStatus()); |
| | | runtimeService.updateBusinessStatus(processInvalidBo.getProcessInstanceId(), BusinessStatusEnum.INVALID.getStatus()); |
| | | runtimeService.deleteProcessInstance(processInvalidBo.getProcessInstanceId(), deleteReason); |
| | | FlowProcessEventHandler processHandler = flowEventStrategy.getProcessHandler(historicProcessInstance.getProcessDefinitionKey()); |
| | |
| | | if (processInstance.isSuspended()) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_SUSPENDED); |
| | | } |
| | | if (BusinessStatusEnum.CANCEL.getStatus().equals(processInstance.getBusinessStatus())) { |
| | | throw new ServiceException("该单据已撤销!"); |
| | | } |
| | | BusinessStatusEnum.checkCancelStatus(processInstance.getBusinessStatus()); |
| | | List<Task> taskList = QueryUtils.taskQuery(processInstanceId).list(); |
| | | for (Task task : taskList) { |
| | | taskService.setAssignee(task.getId(), String.valueOf(LoginHelper.getUserId())); |