| | |
| | | import org.dromara.workflow.common.constant.FlowConstant; |
| | | import org.dromara.workflow.common.enums.BusinessStatusEnum; |
| | | import org.dromara.workflow.common.enums.TaskStatusEnum; |
| | | import org.dromara.workflow.domain.ActHiTaskinst; |
| | | import org.dromara.workflow.domain.WfTaskBackNode; |
| | | import org.dromara.workflow.domain.bo.*; |
| | | import org.dromara.workflow.domain.vo.MultiInstanceVo; |
| | | import org.dromara.workflow.domain.vo.TaskVo; |
| | | import org.dromara.workflow.domain.vo.VariableVo; |
| | | import org.dromara.workflow.domain.vo.WfCopy; |
| | | import org.dromara.workflow.domain.vo.*; |
| | | import org.dromara.workflow.flowable.cmd.*; |
| | | import org.dromara.workflow.flowable.strategy.FlowEventStrategy; |
| | | import org.dromara.workflow.flowable.strategy.FlowProcessEventHandler; |
| | | import org.dromara.workflow.flowable.strategy.FlowTaskEventHandler; |
| | | import org.dromara.workflow.mapper.ActHiTaskinstMapper; |
| | | import org.dromara.workflow.mapper.ActTaskMapper; |
| | | import org.dromara.workflow.service.IActTaskService; |
| | | import org.dromara.workflow.service.IWfNodeConfigService; |
| | | import org.dromara.workflow.service.IWfTaskBackNodeService; |
| | | import org.dromara.workflow.utils.ModelUtils; |
| | | import org.dromara.workflow.utils.QueryUtils; |
| | | import org.dromara.workflow.utils.WorkflowUtils; |
| | | import org.flowable.common.engine.api.FlowableObjectNotFoundException; |
| | |
| | | import org.flowable.engine.impl.bpmn.behavior.SequentialMultiInstanceBehavior; |
| | | import org.flowable.engine.impl.persistence.entity.ExecutionEntity; |
| | | import org.flowable.engine.runtime.ProcessInstance; |
| | | import org.flowable.identitylink.api.history.HistoricIdentityLink; |
| | | import org.flowable.task.api.Task; |
| | | import org.flowable.task.api.TaskQuery; |
| | | import org.flowable.task.api.history.HistoricTaskInstance; |
| | |
| | | private final ManagementService managementService; |
| | | private final FlowEventStrategy flowEventStrategy; |
| | | private final ActTaskMapper actTaskMapper; |
| | | private final IWfTaskBackNodeService iWfTaskBackNodeService; |
| | | private final ActHiTaskinstMapper actHiTaskinstMapper; |
| | | private final IWfNodeConfigService iWfNodeConfigService; |
| | | |
| | | /** |
| | | * 启动任务 |
| | |
| | | if (ObjectUtil.isNotEmpty(task.getDelegationState()) && FlowConstant.PENDING.equals(task.getDelegationState().name())) { |
| | | taskService.resolveTask(completeTaskBo.getTaskId()); |
| | | TaskEntity newTask = WorkflowUtils.createNewTask(task); |
| | | taskService.addComment(newTask.getId(), task.getProcessInstanceId(), completeTaskBo.getMessage()); |
| | | taskService.addComment(newTask.getId(), task.getProcessInstanceId(), TaskStatusEnum.PASS.getStatus(), StringUtils.isNotBlank(completeTaskBo.getMessage()) ? completeTaskBo.getMessage() : StrUtil.EMPTY); |
| | | taskService.complete(newTask.getId()); |
| | | return true; |
| | | } |
| | |
| | | String key = processInstance.getProcessDefinitionKey() + "_" + task.getTaskDefinitionKey(); |
| | | FlowTaskEventHandler taskHandler = flowEventStrategy.getTaskHandler(key); |
| | | if (taskHandler != null) { |
| | | taskHandler.handleTask(task, processInstance.getBusinessKey()); |
| | | taskHandler.handleTask(task.getId(), processInstance.getBusinessKey()); |
| | | } |
| | | //办理意见 |
| | | taskService.addComment(completeTaskBo.getTaskId(), task.getProcessInstanceId(), TaskStatusEnum.PASS.getStatus(), StringUtils.isBlank(completeTaskBo.getMessage()) ? "同意" : completeTaskBo.getMessage()); |
| | | //办理任务 |
| | | taskService.setAssignee(task.getId(), userId); |
| | | if (CollUtil.isNotEmpty(completeTaskBo.getVariables())) { |
| | | taskService.complete(completeTaskBo.getTaskId(), completeTaskBo.getVariables()); |
| | | } else { |
| | | taskService.complete(completeTaskBo.getTaskId()); |
| | | } |
| | | //记录执行过的流程任务节点 |
| | | iWfTaskBackNodeService.recordExecuteNode(task); |
| | | ProcessInstance pi = QueryUtils.instanceQuery(task.getProcessInstanceId()).singleResult(); |
| | | if (pi == null) { |
| | | UpdateBusinessStatusCmd updateBusinessStatusCmd = new UpdateBusinessStatusCmd(task.getProcessInstanceId(), BusinessStatusEnum.FINISH.getStatus()); |
| | |
| | | } |
| | | } else { |
| | | List<Task> list = QueryUtils.taskQuery(task.getProcessInstanceId()).list(); |
| | | for (Task t : list) { |
| | | if (ModelUtils.isUserTask(t.getProcessDefinitionId(), t.getTaskDefinitionKey())) { |
| | | List<HistoricIdentityLink> links = historyService.getHistoricIdentityLinksForTask(t.getId()); |
| | | if (CollUtil.isEmpty(links) && StringUtils.isBlank(t.getAssignee())) { |
| | | throw new ServiceException("下一节点【" + t.getName() + "】没有办理人!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (CollUtil.isNotEmpty(list) && CollUtil.isNotEmpty(completeTaskBo.getWfCopyList())) { |
| | | TaskEntity newTask = WorkflowUtils.createNewTask(task); |
| | | taskService.addComment(newTask.getId(), task.getProcessInstanceId(), TaskStatusEnum.COPY.getStatus(), |
| | | LoginHelper.getLoginUser().getNickname() + "【抄送】给" + String.join(",", StreamUtils.toList(completeTaskBo.getWfCopyList(), WfCopy::getUserName))); |
| | | taskService.addComment(newTask.getId(), task.getProcessInstanceId(), TaskStatusEnum.COPY.getStatus(), LoginHelper.getLoginUser().getNickname() + "【抄送】给" + String.join(",", StreamUtils.toList(completeTaskBo.getWfCopyList(), WfCopy::getUserName))); |
| | | taskService.complete(newTask.getId()); |
| | | List<Task> taskList = QueryUtils.taskQuery(task.getProcessInstanceId()).list(); |
| | | WorkflowUtils.createCopyTask(taskList, StreamUtils.toList(completeTaskBo.getWfCopyList(), WfCopy::getUserId)); |
| | |
| | | String userId = String.valueOf(LoginHelper.getUserId()); |
| | | queryWrapper.eq("t.business_status_", BusinessStatusEnum.WAITING.getStatus()); |
| | | queryWrapper.eq(TenantHelper.isEnable(), "t.tenant_id_", TenantHelper.getTenantId()); |
| | | queryWrapper.and(w1 -> |
| | | w1.eq("t.assignee_", userId) |
| | | .or(w2 -> w2.isNull("t.assignee_") |
| | | .apply("exists ( select LINK.ID_ from ACT_RU_IDENTITYLINK LINK where LINK.TASK_ID_ = t.ID_ and LINK.TYPE_ = 'candidate' " + |
| | | "and (LINK.USER_ID_ = {0} or ( LINK.GROUP_ID_ IN " + getInParam(roleIds) + " ) ))", userId)) |
| | | ); |
| | | queryWrapper.and(w1 -> w1.eq("t.assignee_", userId).or(w2 -> w2.isNull("t.assignee_").apply("exists ( select LINK.ID_ from ACT_RU_IDENTITYLINK LINK where LINK.TASK_ID_ = t.ID_ and LINK.TYPE_ = 'candidate' " + "and (LINK.USER_ID_ = {0} or ( LINK.GROUP_ID_ IN " + getInParam(roleIds) + " ) ))", userId))); |
| | | if (StringUtils.isNotBlank(taskBo.getName())) { |
| | | queryWrapper.like("t.name_", taskBo.getName()); |
| | | } |
| | |
| | | Page<TaskVo> page = actTaskMapper.getTaskWaitByPage(pageQuery.build(), queryWrapper); |
| | | |
| | | List<TaskVo> taskList = page.getRecords(); |
| | | for (TaskVo task : taskList) { |
| | | task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus())); |
| | | task.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId())); |
| | | task.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null); |
| | | if (CollUtil.isNotEmpty(taskList)) { |
| | | List<String> processDefinitionIds = StreamUtils.toList(taskList, TaskVo::getProcessDefinitionId); |
| | | List<WfNodeConfigVo> wfNodeConfigVoList = iWfNodeConfigService.selectByDefIds(processDefinitionIds); |
| | | for (TaskVo task : taskList) { |
| | | task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus())); |
| | | task.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId())); |
| | | task.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null); |
| | | if (CollUtil.isNotEmpty(wfNodeConfigVoList)) { |
| | | wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo); |
| | | wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo); |
| | | } |
| | | } |
| | | } |
| | | return new TableDataInfo<>(taskList, page.getTotal()); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | private String getInParam(List<String> param) { |
| | |
| | | processInstanceList = QueryUtils.instanceQuery(processInstanceIds).list(); |
| | | } |
| | | List<TaskVo> list = new ArrayList<>(); |
| | | for (Task task : taskList) { |
| | | TaskVo taskVo = BeanUtil.toBean(task, TaskVo.class); |
| | | if (CollUtil.isNotEmpty(processInstanceList)) { |
| | | processInstanceList.stream().filter(e -> e.getId().equals(task.getProcessInstanceId())).findFirst().ifPresent(e -> { |
| | | taskVo.setBusinessStatus(e.getBusinessStatus()); |
| | | taskVo.setBusinessStatusName(BusinessStatusEnum.findByStatus(taskVo.getBusinessStatus())); |
| | | taskVo.setProcessDefinitionKey(e.getProcessDefinitionKey()); |
| | | taskVo.setProcessDefinitionName(e.getProcessDefinitionName()); |
| | | }); |
| | | if (CollUtil.isNotEmpty(taskList)) { |
| | | List<String> processDefinitionIds = StreamUtils.toList(taskList, Task::getProcessDefinitionId); |
| | | List<WfNodeConfigVo> wfNodeConfigVoList = iWfNodeConfigService.selectByDefIds(processDefinitionIds); |
| | | for (Task task : taskList) { |
| | | TaskVo taskVo = BeanUtil.toBean(task, TaskVo.class); |
| | | if (CollUtil.isNotEmpty(processInstanceList)) { |
| | | processInstanceList.stream().filter(e -> e.getId().equals(task.getProcessInstanceId())).findFirst().ifPresent(e -> { |
| | | taskVo.setBusinessStatus(e.getBusinessStatus()); |
| | | taskVo.setBusinessStatusName(BusinessStatusEnum.findByStatus(taskVo.getBusinessStatus())); |
| | | taskVo.setProcessDefinitionKey(e.getProcessDefinitionKey()); |
| | | taskVo.setProcessDefinitionName(e.getProcessDefinitionName()); |
| | | taskVo.setProcessDefinitionVersion(e.getProcessDefinitionVersion()); |
| | | taskVo.setBusinessKey(e.getBusinessKey()); |
| | | }); |
| | | } |
| | | taskVo.setAssignee(StringUtils.isNotBlank(task.getAssignee()) ? Long.valueOf(task.getAssignee()) : null); |
| | | taskVo.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId())); |
| | | taskVo.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null); |
| | | if (CollUtil.isNotEmpty(wfNodeConfigVoList)) { |
| | | wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(taskVo::setWfNodeConfigVo); |
| | | wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask())).findFirst().ifPresent(taskVo::setWfNodeConfigVo); |
| | | } |
| | | list.add(taskVo); |
| | | } |
| | | taskVo.setAssignee(StringUtils.isNotBlank(task.getAssignee()) ? Long.valueOf(task.getAssignee()) : null); |
| | | taskVo.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId())); |
| | | taskVo.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null); |
| | | list.add(taskVo); |
| | | } |
| | | long count = query.count(); |
| | | return new TableDataInfo<>(list, count); |
| | | TableDataInfo<TaskVo> build = TableDataInfo.build(); |
| | | build.setRows(list); |
| | | build.setTotal(count); |
| | | return build; |
| | | } |
| | | |
| | | /** |
| | |
| | | Page<TaskVo> page = actTaskMapper.getTaskFinishByPage(pageQuery.build(), queryWrapper); |
| | | |
| | | List<TaskVo> taskList = page.getRecords(); |
| | | for (TaskVo task : taskList) { |
| | | task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus())); |
| | | if (CollUtil.isNotEmpty(taskList)) { |
| | | List<String> processDefinitionIds = StreamUtils.toList(taskList, TaskVo::getProcessDefinitionId); |
| | | List<WfNodeConfigVo> wfNodeConfigVoList = iWfNodeConfigService.selectByDefIds(processDefinitionIds); |
| | | for (TaskVo task : taskList) { |
| | | task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus())); |
| | | if (CollUtil.isNotEmpty(wfNodeConfigVoList)) { |
| | | wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo); |
| | | wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo); |
| | | } |
| | | } |
| | | } |
| | | return new TableDataInfo<>(taskList, page.getTotal()); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | /** |
| | |
| | | Page<TaskVo> page = actTaskMapper.getTaskCopyByPage(pageQuery.build(), queryWrapper); |
| | | |
| | | List<TaskVo> taskList = page.getRecords(); |
| | | for (TaskVo task : taskList) { |
| | | task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus())); |
| | | if (CollUtil.isNotEmpty(taskList)) { |
| | | List<String> processDefinitionIds = StreamUtils.toList(taskList, TaskVo::getProcessDefinitionId); |
| | | List<WfNodeConfigVo> wfNodeConfigVoList = iWfNodeConfigService.selectByDefIds(processDefinitionIds); |
| | | for (TaskVo task : taskList) { |
| | | task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus())); |
| | | if (CollUtil.isNotEmpty(wfNodeConfigVoList)) { |
| | | wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo); |
| | | wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo); |
| | | } |
| | | } |
| | | } |
| | | return new TableDataInfo<>(taskList, page.getTotal()); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | /** |
| | |
| | | Page<TaskVo> page = actTaskMapper.getTaskFinishByPage(pageQuery.build(), queryWrapper); |
| | | |
| | | List<TaskVo> taskList = page.getRecords(); |
| | | for (TaskVo task : taskList) { |
| | | task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus())); |
| | | if (CollUtil.isNotEmpty(taskList)) { |
| | | List<String> processDefinitionIds = StreamUtils.toList(taskList, TaskVo::getProcessDefinitionId); |
| | | List<WfNodeConfigVo> wfNodeConfigVoList = iWfNodeConfigService.selectByDefIds(processDefinitionIds); |
| | | for (TaskVo task : taskList) { |
| | | task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus())); |
| | | if (CollUtil.isNotEmpty(wfNodeConfigVoList)) { |
| | | wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo); |
| | | wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo); |
| | | } |
| | | } |
| | | } |
| | | return new TableDataInfo<>(taskList, page.getTotal()); |
| | | return TableDataInfo.build(page); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (task.isSuspended()) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_SUSPENDED); |
| | | } |
| | | HistoricProcessInstance historicProcessInstance = QueryUtils.hisInstanceQuery() |
| | | .processInstanceId(task.getProcessInstanceId()).singleResult(); |
| | | HistoricProcessInstance historicProcessInstance = QueryUtils.hisInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult(); |
| | | BusinessStatusEnum.checkInvalidStatus(historicProcessInstance.getBusinessStatus()); |
| | | try { |
| | | if (StringUtils.isBlank(terminationBo.getComment())) { |
| | |
| | | */ |
| | | @Override |
| | | public boolean transferTask(TransmitBo transmitBo) { |
| | | Task task = QueryUtils.taskQuery().taskId(transmitBo.getTaskId()) |
| | | .taskCandidateOrAssigned(String.valueOf(LoginHelper.getUserId())).singleResult(); |
| | | Task task = QueryUtils.taskQuery().taskId(transmitBo.getTaskId()).taskCandidateOrAssigned(String.valueOf(LoginHelper.getUserId())).singleResult(); |
| | | if (ObjectUtil.isEmpty(task)) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_CURRENT_TASK_IS_NULL); |
| | | } |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String backProcess(BackProcessBo backProcessBo) { |
| | | TaskQuery query = QueryUtils.taskQuery(); |
| | | Task task = query.taskId(backProcessBo.getTaskId()).taskAssignee(String.valueOf(LoginHelper.getUserId())).singleResult(); |
| | | String userId = String.valueOf(LoginHelper.getUserId()); |
| | | Task task = query.taskId(backProcessBo.getTaskId()).taskCandidateOrAssigned(userId).singleResult(); |
| | | if (ObjectUtil.isEmpty(task)) { |
| | | throw new ServiceException(FlowConstant.MESSAGE_CURRENT_TASK_IS_NULL); |
| | | } |
| | |
| | | BusinessStatusEnum.checkBackStatus(processInstance.getBusinessStatus()); |
| | | //判断是否有多个任务 |
| | | List<Task> taskList = QueryUtils.taskQuery(processInstanceId).list(); |
| | | //申请人节点 |
| | | HistoricTaskInstance historicTaskInstance = QueryUtils.hisTaskInstanceQuery(processInstanceId).finished().orderByHistoricTaskInstanceEndTime().asc().list().get(0); |
| | | String backTaskDefinitionKey = historicTaskInstance.getTaskDefinitionKey(); |
| | | String backTaskDefinitionKey = backProcessBo.getTargetActivityId(); |
| | | taskService.addComment(task.getId(), processInstanceId, TaskStatusEnum.BACK.getStatus(), StringUtils.isNotBlank(backProcessBo.getMessage()) ? backProcessBo.getMessage() : "退回"); |
| | | if (taskList.size() > 1) { |
| | | //当前多个任务驳回到单个节点 |
| | | runtimeService.createChangeActivityStateBuilder().processInstanceId(processInstanceId).moveActivityIdsToSingleActivityId(taskList.stream().map(Task::getTaskDefinitionKey).distinct().collect(Collectors.toList()), backTaskDefinitionKey).changeState(); |
| | | ActHiTaskinst actHiTaskinst = new ActHiTaskinst(); |
| | | actHiTaskinst.setAssignee(userId); |
| | | actHiTaskinst.setId(task.getId()); |
| | | actHiTaskinstMapper.updateById(actHiTaskinst); |
| | | } else { |
| | | //当前单个节点驳回单个节点 |
| | | runtimeService.createChangeActivityStateBuilder().processInstanceId(processInstanceId).moveActivityIdTo(task.getTaskDefinitionKey(), backTaskDefinitionKey).changeState(); |
| | | } |
| | | //删除并行环节未办理记录 |
| | | MultiInstanceVo multiInstance = WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()); |
| | | if (multiInstance == null && taskList.size() > 1) { |
| | | List<Task> tasks = StreamUtils.filter(taskList, e -> !e.getTaskDefinitionKey().equals(task.getTaskDefinitionKey())); |
| | | actHiTaskinstMapper.deleteBatchIds(StreamUtils.toList(tasks, Task::getId)); |
| | | } |
| | | |
| | | |
| | | List<HistoricTaskInstance> instanceList = QueryUtils.hisTaskInstanceQuery(processInstanceId).finished().orderByHistoricTaskInstanceEndTime().desc().list(); |
| | | List<Task> list = QueryUtils.taskQuery(processInstanceId).list(); |
| | | for (Task t : list) { |
| | | taskService.setAssignee(t.getId(), historicTaskInstance.getAssignee()); |
| | | instanceList.stream().filter(e -> e.getTaskDefinitionKey().equals(t.getTaskDefinitionKey())).findFirst().ifPresent(e -> { |
| | | taskService.setAssignee(t.getId(), e.getAssignee()); |
| | | }); |
| | | } |
| | | //发送消息 |
| | | String message = "您的【" + processInstance.getName() + "】单据已经被驳回,请您注意查收。"; |
| | |
| | | DeleteExecutionCmd deleteExecutionCmd = new DeleteExecutionCmd(executionEntity.getId()); |
| | | managementService.executeCommand(deleteExecutionCmd); |
| | | } |
| | | runtimeService.updateBusinessStatus(processInstanceId, BusinessStatusEnum.BACK.getStatus()); |
| | | FlowProcessEventHandler processHandler = flowEventStrategy.getProcessHandler(processInstance.getProcessDefinitionKey()); |
| | | if (processHandler != null) { |
| | | processHandler.handleProcess(processInstance.getBusinessKey(), BusinessStatusEnum.BACK.getStatus(), false); |
| | | |
| | | WfTaskBackNode wfTaskBackNode = iWfTaskBackNodeService.getListByInstanceIdAndNodeId(task.getProcessInstanceId(), backProcessBo.getTargetActivityId()); |
| | | if (ObjectUtil.isNotNull(wfTaskBackNode) && wfTaskBackNode.getOrderNo() == 0) { |
| | | runtimeService.updateBusinessStatus(processInstanceId, BusinessStatusEnum.BACK.getStatus()); |
| | | FlowProcessEventHandler processHandler = flowEventStrategy.getProcessHandler(processInstance.getProcessDefinitionKey()); |
| | | if (processHandler != null) { |
| | | processHandler.handleProcess(processInstance.getBusinessKey(), BusinessStatusEnum.BACK.getStatus(), false); |
| | | } |
| | | } |
| | | //删除驳回后的流程节点 |
| | | iWfTaskBackNodeService.deleteBackTaskNode(processInstanceId, backProcessBo.getTargetActivityId()); |
| | | } catch (Exception e) { |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | |
| | | } |
| | | } |
| | | return variableVoList; |
| | | } |
| | | |
| | | /** |
| | | * 获取可驳回得任务节点 |
| | | * |
| | | * @param processInstanceId 流程实例id |
| | | */ |
| | | @Override |
| | | public Set<TaskVo> getTaskNodeList(String processInstanceId) { |
| | | Set<TaskVo> list = new HashSet<>(); |
| | | List<HistoricTaskInstance> historicTaskInstances = QueryUtils.hisTaskInstanceQuery(processInstanceId).orderByHistoricTaskInstanceEndTime().desc().list(); |
| | | for (HistoricTaskInstance historicTaskInstance : historicTaskInstances) { |
| | | if (historicTaskInstance.getEndTime() != null) { |
| | | TaskVo taskVo = new TaskVo(); |
| | | taskVo.setName(historicTaskInstance.getName()); |
| | | taskVo.setTaskDefinitionKey(historicTaskInstance.getTaskDefinitionKey()); |
| | | list.add(taskVo); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | } |