| | |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.flowable.engine.HistoryService; |
| | | import org.flowable.engine.TaskService; |
| | | import org.flowable.task.api.history.HistoricTaskInstance; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | |
| | | public class MyFlowController { |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private HistoryService historyService; |
| | | @Autowired |
| | | private FlowBusinessService businessService; |
| | | @Autowired |
| | |
| | | return userSearchClient.listByDept(deptId); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 上一步审批人查询 |
| | | */ |
| | | @GetMapping("previus-approve-user") |
| | | @ApiOperationSupport(order = 3) |
| | | @Operation(summary = "上一步审批人查询", description = "上一步审批人查询,返回审批人id") |
| | | public R<String> previusApproveUserId(@Parameter(description = "部门ID") String processInstanceId) { |
| | | // 获取历史任务实例 |
| | | List<HistoricTaskInstance> historicTasks = historyService.createHistoricTaskInstanceQuery() |
| | | .processInstanceId(processInstanceId) |
| | | .orderByHistoricTaskInstanceEndTime().asc() |
| | | .list(); |
| | | |
| | | // 获取上一个已完成的任务 |
| | | String assignee = ""; |
| | | if(!historicTasks.isEmpty()) { |
| | | assignee = historicTasks.get(historicTasks.size() - 1).getAssignee(); |
| | | } |
| | | return R.data(assignee); |
| | | |
| | | } |
| | | } |