| | |
| | | jsonData.setAfterHandlerIds(afterHandlerIds); |
| | | jsonData.setAfterHandlerType(form.getPeopleType()); |
| | | // 发布转办事件 |
| | | publisher.publishEvent(new TaskLogEvent(this, null, SecurityUtils.getUserId(), form.getProjectId(), form.getProcessInsId(), task.getId(), task.getName(), ProcessLogEventTypeEnum.DELEGATE, jsonData)); |
| | | publisher.publishEvent(new TaskLogEvent(this, null, SecurityUtils.getUserId(), form.getProjectId(), form.getProcessInsId(), task.getId(), task.getTaskDefinitionKey(), task.getName(), ProcessLogEventTypeEnum.DELEGATE, jsonData)); |
| | | |
| | | return Result.ok("转办成功"); |
| | | } |
| | |
| | | Task task = taskService.createTaskQuery().taskId(form.getTaskId()).processInstanceId(form.getProcessInsId()).singleResult(); |
| | | if (Objects.nonNull(task)) { |
| | | // 添加跳过日志 |
| | | publisher.publishEvent(new TaskLogEvent(this, null, SecurityUtils.getUserId(), form.getProjectId(), form.getProcessInsId(), form.getTaskId(), task.getName(), ProcessLogEventTypeEnum.JUMP, new JumpData(form.getDesc()))); |
| | | publisher.publishEvent(new TaskLogEvent(this, null, SecurityUtils.getUserId(), form.getProjectId(), form.getProcessInsId(), task.getId(), task.getTaskDefinitionKey(), task.getName(), ProcessLogEventTypeEnum.JUMP, new JumpData(form.getDesc()))); |
| | | // 查出该任务绑定的表单 |
| | | |
| | | Map<String, Object> data = new HashMap<>(1); |
| | |
| | | @Override |
| | | public Result taskSupervise(TaskSuperviseForm form) { |
| | | Task task = taskService.createTaskQuery().taskId(form.getTaskId()).singleResult(); |
| | | if (Objects.isNull(task)) { |
| | | throw new RuntimeException("任务不存在"); |
| | | } |
| | | SuperviseData jsonData = new SuperviseData(); |
| | | jsonData.setCreateTime(new Date()); |
| | | jsonData.setContent(form.getContent()); |
| | |
| | | jsonData.setReceiverIds(form.getReceiverIds()); |
| | | jsonData.setReceiverType(form.getReceiverType()); |
| | | jsonData.setSuperviseType(form.getSuperviseType()); |
| | | QueryWrapper<ProcessLog> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("task_id", form.getTaskId()); |
| | | queryWrapper.eq("event_type", ProcessLogEventTypeEnum.SUPERVISE); |
| | | queryWrapper.eq("process_ins_id", form.getProcessInsId()); |
| | | //查询督办日志 |
| | | ProcessLog processLog = processLogService.getOne(queryWrapper); |
| | | |
| | | ProcessLog processLog = new LambdaQueryChainWrapper<>(processLogService.getBaseMapper()) |
| | | .eq(ProcessLog::getTaskId, form.getTaskId()) |
| | | .eq(ProcessLog::getEventType, ProcessLogEventTypeEnum.SUPERVISE) |
| | | .eq(ProcessLog::getProcessInsId, form.getProcessInsId()) |
| | | .one(); |
| | | List<SuperviseData> dataList; |
| | | if (processLog != null) { |
| | | String eventDataJson = processLog.getEventDataJson(); |
| | |
| | | } |
| | | dataList.add(jsonData); |
| | | //添加督办日志 |
| | | publisher.publishEvent(new TaskLogEvent(this, processLog.getId(), processLog.getUserId(), form.getProjectId(), form.getProcessInsId(), form.getTaskId(), task.getName(), ProcessLogEventTypeEnum.SUPERVISE, dataList)); |
| | | publisher.publishEvent(new TaskLogEvent(this, |
| | | processLog.getId(), |
| | | processLog.getUserId(), |
| | | form.getProjectId(), |
| | | form.getProcessInsId(), |
| | | form.getTaskId(), |
| | | task.getTaskDefinitionKey(), |
| | | task.getName(), |
| | | ProcessLogEventTypeEnum.SUPERVISE, |
| | | dataList)); |
| | | return Result.ok("操作成功"); |
| | | } |
| | | |
| | |
| | | form.getProjectId(), |
| | | form.getProcessInsId(), |
| | | form.getTaskId(), |
| | | task.getTaskDefinitionKey(), |
| | | task.getName(), |
| | | ProcessLogEventTypeEnum.HANGUP, |
| | | new HangupData(form.getReason()) |
| | |
| | | form.getProjectId(), |
| | | form.getProcessInsId(), |
| | | form.getTaskId(), |
| | | task.getTaskDefinitionKey(), |
| | | task.getName(), |
| | | ProcessLogEventTypeEnum.CANCEL_HANGUP, |
| | | new HangupData(form.getReason()) |
| | |
| | | form.getProjectId(), |
| | | form.getProcessInsId(), |
| | | form.getTaskId(), |
| | | task.getTaskDefinitionKey(), |
| | | task.getName(), |
| | | ProcessLogEventTypeEnum.TEAM_WORK, |
| | | new TeamWorkData(form.getHandlerType(), form.getHandlerIds(), TeamWorkStatusEnum.NOT_FINISHED) |
| | |
| | | ProcessInstance process = runtimeService.createProcessInstanceQuery().processInstanceId(processInsId).singleResult(); |
| | | if (Objects.isNull(process)) { |
| | | // 如果运行时找不到说明是已完成的流程,直接查历史任务 |
| | | List<CustomerTaskVO> vos = this.getFinishedProcessTaskInfo(userTasks, processInsId, processDefinitionId); |
| | | List<CustomerTaskVO> vos = this.getFinishedProcessTaskInfo(userTasks, projectId, processInsId, processDefinitionId); |
| | | result.data(vos); |
| | | return vos; |
| | | } |
| | |
| | | vo.setPromoterUnitName(promoterUnitNames); |
| | | |
| | | this.setCandidateInfo(userTask, vo, projectId, processInsId); |
| | | |
| | | if (Objects.isNull(task)) { |
| | | // 如果任务在运行时没找到,那么可能为未开始或者已完成,需要从历史任务中再找一下 |
| | | List<HistoricTaskInstance> historicTasks = historyService.createHistoricTaskInstanceQuery() |
| | |
| | | * @param processDefId 流程定义id |
| | | * @return |
| | | */ |
| | | private List<CustomerTaskVO> getFinishedProcessTaskInfo(List<UserTask> userTasks, String processInsId, String processDefId) { |
| | | private List<CustomerTaskVO> getFinishedProcessTaskInfo(List<UserTask> userTasks, Long projectId, String processInsId, String processDefId) { |
| | | HistoricProcessInstance hisProcess = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInsId).singleResult(); |
| | | if (Objects.isNull(hisProcess)) { |
| | | return new ArrayList<>(); |
| | |
| | | vo.setTaskName(userTask.getName()); |
| | | vo.setProcessName(hisProcess.getProcessDefinitionName()); |
| | | |
| | | // 一个任务可能有多个候选人/组,所以需要使用list |
| | | List<Long> handlerIds = new ArrayList<>(2); |
| | | List<String> handlerNames = new ArrayList<>(2); |
| | | List<Long> handlerUnitIds = new ArrayList<>(2); |
| | | List<String> handlerUnitNames = new ArrayList<>(2); |
| | | List<String> promoterNames = new ArrayList<>(2); |
| | | List<String> promoterUnitNames = new ArrayList<>(2); |
| | | vo.setHandlerId(handlerIds); |
| | | vo.setHandlerName(handlerNames); |
| | | vo.setHandlerUnitId(handlerUnitIds); |
| | | vo.setHandlerUnitName(handlerUnitNames); |
| | | vo.setPromoterName(promoterNames); |
| | | vo.setPromoterUnitName(promoterUnitNames); |
| | | |
| | | |
| | | this.setCandidateInfo(userTask, vo, projectId, processInsId); |
| | | |
| | | // 查多个是因为驳回后会查出两条及以上,取最新一条 |
| | | List<HistoricTaskInstance> hisTaskList = historyService.createHistoricTaskInstanceQuery() |
| | | .processInstanceId(hisProcess.getId()) |