| | |
| | | import com.ycl.domain.entity.ProcessLog; |
| | | import com.ycl.domain.entity.ProjectProcess; |
| | | import com.ycl.domain.entity.SysForm; |
| | | import com.ycl.domain.form.EditFinishedTaskForm; |
| | | import com.ycl.domain.json.RejectData; |
| | | import com.ycl.domain.query.ProcessLogQuery; |
| | | import com.ycl.domain.vo.*; |
| | |
| | | } |
| | | return AjaxResult.success("提交成功"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 容缺补交 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 查询当前任务的表单数据 |
| | | * |
| | | * @param taskId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public AjaxResult currentFlowTaskForm(String taskId) { |
| | | // 流程变量 |
| | | List<HistoricTaskInstance> hisTaskList = historyService.createHistoricTaskInstanceQuery() |
| | | .includeProcessVariables() |
| | | .finished() |
| | | .taskId(taskId) |
| | | .orderByHistoricTaskInstanceStartTime() |
| | | .desc() |
| | | .list(); |
| | | if (CollectionUtils.isEmpty(hisTaskList) || Objects.isNull(hisTaskList.get(0))) { |
| | | return AjaxResult.error("未找到该任务信息"); |
| | | } |
| | | HistoricTaskInstance historicTaskInstance = hisTaskList.get(0); |
| | | Map<String, Object> parameters = historicTaskInstance.getProcessVariables(); |
| | | String processInsId = historicTaskInstance.getProcessInstanceId(); |
| | | List<FormDetailVO> beforeNodes = this.getBeforeNodeForm(parameters, historicTaskInstance.getFormKey(), historicTaskInstance.getName(), historicTaskInstance.getProcessDefinitionId(), historicTaskInstance.getTaskDefinitionKey(), Boolean.FALSE); |
| | | // 判断前置任务是不是和当前任务为同一个executeId |
| | | // 判断当前任务是否被挂起中 |
| | | String finalProcessInsId = processInsId; |
| | | |
| | | List<DoFormDetailVO> vos = beforeNodes.stream() |
| | | .filter(FormDetailVO::getCurrent) |
| | | .map(node -> { |
| | | if (node.getCurrent()) { |
| | | if (processLogService.taskIsHangup(taskId, finalProcessInsId)) { |
| | | node.setTaskStatus(TaskStatusEnum.HANGUP); |
| | | } |
| | | } |
| | | // 判断任务是否存在特殊操作(如跳过、转办等),需要在前端展示出来 |
| | | ProcessLogQuery query = new ProcessLogQuery(); |
| | | query.setTaskId(node.getTaskId()); |
| | | query.setProcessInsId(finalProcessInsId); |
| | | Result result = processLogService.projectProcessLogList(query); |
| | | List<ProcessLogVO> logList = (List<ProcessLogVO>) result.get("data"); |
| | | DoFormDetailVO vo = new DoFormDetailVO(); |
| | | BeanUtils.copyProperties(node, vo); |
| | | if (CollectionUtils.isNotEmpty(logList)) { |
| | | vo.setEvents(logList); |
| | | } |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | return AjaxResult.success(vos.get(0)); |
| | | } |
| | | |
| | | /** |
| | | * 流程节点表单 |
| | | * |
| | | * @param taskId 流程任务编号 |
| | |
| | | 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); |
| | | List<HistoricTaskInstance> hisTaskList = historyService.createHistoricTaskInstanceQuery() |
| | | .includeProcessVariables() |
| | | .finished() |
| | | .taskId(taskId) |
| | | .orderByHistoricTaskInstanceStartTime() |
| | | .desc() |
| | | .list(); |
| | | if (CollectionUtils.isNotEmpty(hisTaskList) && Objects.nonNull(hisTaskList.get(0))) { |
| | | parameters = hisTaskList.get(0).getProcessVariables(); |
| | | processInsId = hisTaskList.get(0).getProcessInstanceId(); |
| | | beforeNodes = this.getBeforeNodeForm(parameters, hisTaskList.get(0).getFormKey(), hisTaskList.get(0).getName(), hisTaskList.get(0).getProcessDefinitionId(), hisTaskList.get(0).getTaskDefinitionKey(), Boolean.FALSE); |
| | | } else { |
| | | parameters = taskService.getVariables(taskId); |
| | | processInsId = task.getProcessInstanceId(); |
| | |
| | | return beforeNodes; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 流程节点信息 |
| | | * |