| | |
| | | import com.ycl.common.core.domain.entity.SysUser; |
| | | import com.ycl.common.enums.FlowComment; |
| | | import com.ycl.common.enums.business.ProcessLogEventTypeEnum; |
| | | import com.ycl.common.enums.business.TaskStatusEnum; |
| | | import com.ycl.common.exception.CustomException; |
| | | import com.ycl.common.utils.SecurityUtils; |
| | | import com.ycl.domain.dto.FlowCommentDto; |
| | |
| | | if (Objects.isNull(projectProcess)) { |
| | | return AjaxResult.error("项目流程未绑定"); |
| | | } |
| | | |
| | | Map<String, Object> processVariables = new HashMap<>(); |
| | | //查出字典中需要注入的字段信息 |
| | | List<String> dictList = sysDictDService.selectDictDataByType("flow_variables").stream().map(SysDictData::getDictValue).collect(Collectors.toList()); |
| | |
| | | projectProcess.getProjectId(), |
| | | projectProcess.getProcessInsId(), |
| | | taskId, |
| | | task.getName(), |
| | | ProcessLogEventTypeEnum.FINISHED, |
| | | null)); |
| | | return AjaxResult.success("提交成功"); |
| | |
| | | projectProcess.getProjectId(), |
| | | projectProcess.getProcessInsId(), |
| | | flowTaskVo.getTaskId(), |
| | | task.getName(), |
| | | ProcessLogEventTypeEnum.REJECT, |
| | | new RejectData(flowTaskVo.getComment()))); |
| | | } |
| | |
| | | Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); |
| | | // 流程变量 |
| | | Map<String, Object> parameters = new HashMap<>(); |
| | | List<FormDetailVO> beforeNodes = new ArrayList<>(); |
| | | String processInsId = ""; |
| | | HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().finished().taskId(taskId).singleResult(); |
| | | if (Objects.nonNull(historicTaskInstance)) { |
| | | parameters = historicTaskInstance.getProcessVariables(); |
| | | processInsId = historicTaskInstance.getProcessInstanceId(); |
| | | beforeNodes = this.getBeforeNodeForm(parameters, historicTaskInstance.getFormKey(), historicTaskInstance.getName(), historicTaskInstance.getProcessDefinitionId(), historicTaskInstance.getTaskDefinitionKey(), Boolean.FALSE); |
| | | } else { |
| | | parameters = taskService.getVariables(taskId); |
| | | processInsId = task.getProcessInstanceId(); |
| | | beforeNodes = this.getBeforeNodeForm(parameters, task.getFormKey(), task.getName(), task.getProcessDefinitionId(), task.getTaskDefinitionKey(), Boolean.FALSE); |
| | | } |
| | | List<FormDetailVO> beforeNodes = this.getBeforeNodeForm(parameters, task.getFormKey(), task.getName(), task.getProcessDefinitionId(), task.getTaskDefinitionKey(), Boolean.FALSE); |
| | | // 判断前置任务是不是和当前任务为同一个executeId |
| | | // 判断当前任务是否被挂起中 |
| | | String finalProcessInsId = processInsId; |
| | | beforeNodes.stream().filter(node -> { |
| | | if (node.getCurrent()) { |
| | | return Boolean.TRUE; |
| | | } |
| | | HistoricTaskInstance beforeTask = historyService.createHistoricTaskInstanceQuery().processInstanceId(finalProcessInsId).finished().taskDefinitionKey(node.getBeforeNodeDefId()).singleResult(); |
| | | return Objects.nonNull(beforeTask); |
| | | }).forEach(node -> { |
| | | if (node.getCurrent()) { |
| | | if (processLogService.taskIsHangup(taskId, finalProcessInsId)) { |
| | | node.setTaskStatus(TaskStatusEnum.HANGUP); |
| | | } |
| | | } |
| | | }); |
| | | return AjaxResult.success(beforeNodes); |
| | | } |
| | | |
| | |
| | | } |
| | | parameters = hisTask.getProcessVariables(); |
| | | List<FormDetailVO> beforeNodes = this.getBeforeNodeForm(parameters, hisTask.getFormKey(), hisTask.getName(), hisTask.getProcessDefinitionId(), hisTask.getTaskDefinitionKey(), Boolean.TRUE); |
| | | return AjaxResult.success(beforeNodes); |
| | | List<FormDetailVO> dataList = beforeNodes.stream().filter(node -> { |
| | | if (node.getCurrent()) { |
| | | return Boolean.TRUE; |
| | | } |
| | | HistoricTaskInstance beforeTask = historyService.createHistoricTaskInstanceQuery().processInstanceId(hisTask.getProcessInstanceId()).finished().taskDefinitionKey(node.getBeforeNodeDefId()).singleResult(); |
| | | return Objects.nonNull(beforeTask); |
| | | }).collect(Collectors.toList()); |
| | | return AjaxResult.success(dataList); |
| | | } else { |
| | | parameters = taskService.getVariables(taskId); |
| | | List<FormDetailVO> beforeNodes = this.getBeforeNodeForm(parameters, task.getFormKey(), task.getName(), task.getProcessDefinitionId(), task.getTaskDefinitionKey(), Boolean.TRUE); |
| | | return AjaxResult.success(beforeNodes); |
| | | List<FormDetailVO> dataList = beforeNodes.stream().filter(node -> { |
| | | if (node.getCurrent()) { |
| | | return Boolean.TRUE; |
| | | } |
| | | HistoricTaskInstance beforeTask = historyService.createHistoricTaskInstanceQuery().processInstanceId(task.getProcessInstanceId()).finished().taskDefinitionKey(node.getBeforeNodeDefId()).singleResult(); |
| | | return Objects.nonNull(beforeTask); |
| | | }).collect(Collectors.toList()); |
| | | return AjaxResult.success(dataList); |
| | | } |
| | | } |
| | | |