| | |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | import static com.iailab.framework.common.util.collection.CollectionUtils.*; |
| | | import static com.iailab.framework.web.core.util.WebFrameworkUtils.getLoginUserId; |
| | | import static com.iailab.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| | | |
| | | |
| | | @Tag(name = "管理后台 - 流程任务实例") |
| | | @RestController |
| | |
| | | @PreAuthorize("@ss.hasPermission('bpm:task:query')") |
| | | public CommonResult<List<BpmTaskRespVO>> getTaskListByProcessInstanceId( |
| | | @RequestParam("processInstanceId") String processInstanceId) { |
| | | List<HistoricTaskInstance> taskList = taskService.getTaskListByProcessInstanceId(processInstanceId); |
| | | List<HistoricTaskInstance> taskList = taskService.getTaskListByProcessInstanceId(processInstanceId, true); |
| | | if (CollUtil.isEmpty(taskList)) { |
| | | return success(Collections.emptyList()); |
| | | } |
| | | |
| | | // 拼接数据 |
| | | HistoricProcessInstance processInstance = processInstanceService.getHistoricProcessInstance(processInstanceId); |
| | | // 获得 User 和 Dept Map |
| | | Set<Long> userIds = convertSetByFlatMap(taskList, task -> |
| | | Stream.of(NumberUtils.parseLong(task.getAssignee()), NumberUtils.parseLong(task.getOwner()))); |
| | | userIds.add(NumberUtils.parseLong(processInstance.getStartUserId())); |
| | | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds); |
| | | Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap( |
| | | convertSet(userMap.values(), AdminUserRespDTO::getDeptId)); |
| | | // 获得 Form Map |
| | | Map<Long, BpmFormDO> formMap = formService.getFormMap( |
| | | convertSet(taskList, task -> NumberUtils.parseLong(task.getFormKey()))); |
| | | return success(BpmTaskConvert.INSTANCE.buildTaskListByProcessInstanceId(taskList, processInstance, |
| | | return success(BpmTaskConvert.INSTANCE.buildTaskListByProcessInstanceId(taskList, |
| | | formMap, userMap, deptMap)); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @GetMapping("/list-by-return") |
| | | @Operation(summary = "获取所有可回退的节点", description = "用于【流程详情】的【回退】按钮") |
| | | @Operation(summary = "获取所有可退回的节点", description = "用于【流程详情】的【退回】按钮") |
| | | @Parameter(name = "taskId", description = "当前任务ID", required = true) |
| | | @PreAuthorize("@ss.hasPermission('bpm:task:update')") |
| | | public CommonResult<List<BpmTaskRespVO>> getTaskListByReturn(@RequestParam("id") String id) { |
| | |
| | | } |
| | | |
| | | @PutMapping("/return") |
| | | @Operation(summary = "回退任务", description = "用于【流程详情】的【回退】按钮") |
| | | @Operation(summary = "退回任务", description = "用于【流程详情】的【退回】按钮") |
| | | @PreAuthorize("@ss.hasPermission('bpm:task:update')") |
| | | public CommonResult<Boolean> returnTask(@Valid @RequestBody BpmTaskReturnReqVO reqVO) { |
| | | taskService.returnTask(getLoginUserId(), reqVO); |
| | |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/copy") |
| | | @Operation(summary = "抄送任务") |
| | | @PreAuthorize("@ss.hasPermission('bpm:task:update')") |
| | | public CommonResult<Boolean> copyTask(@Valid @RequestBody BpmTaskCopyReqVO reqVO) { |
| | | taskService.copyTask(getLoginUserId(), reqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/list-by-parent-task-id") |
| | | @Operation(summary = "获得指定父级任务的子任务列表") // 目前用于,减签的时候,获得子任务列表 |
| | | @Parameter(name = "parentTaskId", description = "父级任务编号", required = true) |