| | |
| | | import com.ycl.flow.FindNextNodeUtil; |
| | | import com.ycl.flow.FlowableUtils; |
| | | import com.ycl.mapper.ProcessCodingMapper; |
| | | import com.ycl.service.FlowLogService; |
| | | import com.ycl.service.IFlowTaskService; |
| | | import com.ycl.service.ISysDeployFormService; |
| | | import com.ycl.service.ISysFormService; |
| | |
| | | private final ISysFormService sysFormService; |
| | | private final TaskCommonService taskCommonService; |
| | | private final ProcessCodingMapper processCodingMapper; |
| | | private final FlowLogService flowLogService; |
| | | |
| | | /** |
| | | * 完成审核任务 |
| | |
| | | if (!org.springframework.util.CollectionUtils.isEmpty(variables)) { |
| | | for (String key : variables.keySet()) { |
| | | newV.put(task.getTaskDefinitionKey() + "&" + key, variables.get(key)); |
| | | // if (ProcessConstants.TASK_FORM_KEY.equals(key)) { |
| | | // newV.put(task.getTaskDefinitionKey() + "_" + ProcessConstants.TASK_FORM_KEY, variables.get(key)); |
| | | // } else if (ProcessConstants.WIDGET_LIST.equals(key)){ |
| | | // newV.put(task.getTaskDefinitionKey() + "_" + ProcessConstants.WIDGET_LIST, variables.get(key)); |
| | | // } |
| | | } |
| | | } |
| | | taskService.addComment(taskId, task.getProcessInstanceId(), FlowComment.SUBMIT.getType(), "完成提交"); |
| | | // 判断当前任务是不是转办过的 |
| | | Boolean delegation = flowLogService.taskDelegation(task.getProcessInstanceId(), task.getId()); |
| | | if (delegation) { |
| | | taskService.resolveTask(taskId, newV); |
| | | } |
| | | // 先让当前用户认领这个任务 |
| | | taskService.claim(taskId, SecurityUtils.getUserId() + ""); |
| | | taskService.addComment(taskId, task.getProcessInstanceId(), FlowComment.SUBMIT.getType(), "完成提交"); |
| | | taskService.complete(taskId, newV); |
| | | |
| | | return AjaxResult.success("提交成功"); |
| | | } |
| | | |
| | |
| | | .processInstanceId(procInsId) |
| | | .orderByHistoricActivityInstanceStartTime() |
| | | .desc().list(); |
| | | Date now = new Date(); |
| | | //扩展 获取这个流程实例的监控信息 key:TaskId value:实体类 |
| | | Map<String, ProcessCoding> processCodingMap = processCodingMapper.selectList(new QueryWrapper<ProcessCoding>().eq("process_ins_id", procInsId)) |
| | | .stream() |
| | |
| | | //扩展 判断是否超时 |
| | | ProcessCoding processCoding = processCodingMap.get(histIns.getTaskId()); |
| | | if(processCoding!=null){ |
| | | //通过耗时判断是否是代办节点 |
| | | //如果任务是代办节点 |
| | | if (flowTask.getDuration() == null) { |
| | | if(RED.equals(processCoding.getStatus()) || YELLOW.equals(processCoding.getStatus())){ |
| | |
| | | .finished() |
| | | .list(); |
| | | |
| | | //获取这个流程实例的监控信息 key:TaskId value:实体类 |
| | | Map<String, ProcessCoding> processCodingMap = processCodingMapper.selectList(new QueryWrapper<ProcessCoding>().eq("process_ins_id", procInsId)) |
| | | //扩展 获取这个流程实例的监控信息 key:TaskId value:实体类 |
| | | Map<String, ProcessCoding> processCodingMap = processCodingMapper |
| | | .selectList(new QueryWrapper<ProcessCoding>().eq("process_ins_id", procInsId)) |
| | | .stream() |
| | | .collect(Collectors.toMap(ProcessCoding::getTaskId, Function.identity())); |
| | | // 保存已经完成的流程节点编号 |
| | |
| | | */ |
| | | private List<FormDetailVO> getBeforeNodeForm(Map<String, Object> parameters, String formKey, String taskName, String processDefId, String processDefKey, Boolean currentNeedData) { |
| | | if (!parameters.keySet().stream().anyMatch(key -> key.contains(ProcessConstants.TASK_FORM_KEY))) { |
| | | FormDetailVO formDetailVO = new FormDetailVO(); |
| | | formDetailVO.setBeforeNodeName(taskName); |
| | | formDetailVO.setCurrent(Boolean.TRUE); |
| | | // 如果是空的,使用formId去查 |
| | | if (StringUtils.isNotBlank(formKey)) { |
| | | SysForm sysForm = sysFormService.selectSysFormById(Long.parseLong(formKey)); |
| | | if (Objects.isNull(sysForm)) { |
| | | throw new RuntimeException("该流程绑定的表单不存在或已被删除"); |
| | | } |
| | | FormDetailVO formDetailVO = new FormDetailVO(); |
| | | |
| | | Map<String, Object> data = new HashMap<>(1); |
| | | data.put(ProcessConstants.TASK_FORM_KEY, JSONObject.parseObject(sysForm.getFormContent())); |
| | | formDetailVO.setFormJsonObj(data); |
| | | formDetailVO.setBeforeNodeName(taskName); |
| | | formDetailVO.setCurrent(Boolean.TRUE); |
| | | return Arrays.asList(formDetailVO); |
| | | } else { |
| | | return new ArrayList<>(1); |
| | | return Arrays.asList(formDetailVO); |
| | | } |
| | | } |
| | | // 这里只需要查自身以及上一个节点(如果并行的有多个)的表单数据 |