| | |
| | | entity.setProcessDefId(processDefId); |
| | | entity.setProcessInsId(processInsId); |
| | | baseMapper.insert(entity); |
| | | |
| | | return Result.ok("流程启动成功"); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | private String startPro(Long projectId, String processDefId) { |
| | | |
| | | ProjectInfo project = new LambdaQueryChainWrapper<>(projectInfoMapper) |
| | | .select(ProjectInfo::getCreateBy) |
| | | .eq(ProjectInfo::getId, projectId) |
| | | .one(); |
| | | if (Objects.isNull(project)) { |
| | | throw new RuntimeException("项目不存在"); |
| | | } |
| | | ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefId) |
| | | .latestVersion().singleResult(); |
| | | if (Objects.nonNull(processDefinition) && processDefinition.isSuspended()) { |
| | |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | identityService.setAuthenticatedUserId(sysUser.getUserId().toString()); |
| | | variables.put(ProcessConstants.PROCESS_INITIATOR, sysUser.getUserId()); |
| | | |
| | | // 将该项目的申请人(业主方)作为流程中某些环节的处理人 |
| | | variables.put(ProcessConstants.DATA_LAUNCH, project.getCreateBy()); |
| | | ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefId, projectId + "", variables); |
| | | return processInstance.getId(); |
| | | } |
| | |
| | | vo.setTaskId(historicTasks.get(0).getId()); |
| | | vo.setExecutionId(historicTasks.get(0).getExecutionId()); |
| | | vo.setCreateTime(historicTasks.get(0).getStartTime()); |
| | | |
| | | // 查询实际处理人 |
| | | long handlerUserId = Long.parseLong(historicTasks.get(0).getAssignee()); |
| | | SysUser handlerUser = sysUserService.selectUserById(handlerUserId); |
| | | if (Objects.nonNull(handlerUser)) { |
| | | handlerIds.add(handlerUserId); |
| | | handlerNames.add(handlerUser.getNickName()); |
| | | vo.setActualHandlerUserId(historicTasks.get(0).getAssignee()); |
| | | vo.setActualHandlerUserName(handlerUser.getNickName()); |
| | | } |
| | | vo.setTaskDefinitionKey(historicTasks.get(0).getTaskDefinitionKey()); |
| | | this.setPromoterAndHandler(vo, historicTasks.get(0).getIdentityLinks()); |