| | |
| | | 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; |
| | | import org.springblade.core.tool.support.Kv; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springblade.flow.core.pojo.entity.BladeFlow; |
| | | import org.springblade.mdm.flow.excution.StartDispatcher; |
| | | import org.springblade.mdm.basesetting.producedivision.entity.MdmUser; |
| | | import org.springblade.mdm.basesetting.producedivision.service.MdmUserService; |
| | | import org.springblade.mdm.flow.service.FlowBusinessService; |
| | | import org.springblade.mdm.flow.vo.TaskAssignVO; |
| | | import org.springblade.mdm.flow.service.FlowCommonService; |
| | | import org.springblade.mdm.flow.service.FlowTransferService; |
| | | import org.springblade.mdm.flow.vo.FlowVO; |
| | | import org.springblade.system.feign.IUserSearchClient; |
| | | import org.springblade.system.pojo.entity.User; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.Map; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private MdmUserService mdmUserService; |
| | | @Autowired |
| | | private FlowBusinessService businessService; |
| | | @Autowired |
| | | private IUserSearchClient userSearchClient; |
| | | |
| | | @Autowired |
| | | private FlowTransferService flowTransferService; |
| | | @Autowired |
| | | private FlowCommonService flowCommonService; |
| | | /** |
| | | * 待办任务列表页 |
| | | */ |
| | | @GetMapping("todo-list") |
| | | @ApiOperationSupport(order = 3) |
| | | @Operation(summary = "待办任务", description = "传入流程信息") |
| | | public R<IPage<BladeFlow>> todoList(@Parameter(description = "关键字") String keyword, @Parameter(description = "创建时间开始") LocalDate createTimeBegin, @Parameter(description = "创建时间截止") LocalDate createTimeEnd, Query query) { |
| | | IPage<BladeFlow> pages = businessService.selectTodoPage(Condition.getPage(query), createTimeBegin,createTimeEnd,keyword); |
| | | public R<IPage<FlowVO>> todoList(@Parameter(description = "关键字") String keyword, @Parameter(description = "创建时间开始") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createTimeBegin, @Parameter(description = "创建时间截止") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createTimeEnd, Query query) { |
| | | IPage<FlowVO> pages = businessService.selectTodoPage(Condition.getPage(query), createTimeBegin,createTimeEnd,keyword); |
| | | |
| | | //pages = businessService.selectFinishedPage(Condition.getPage(query), "",createTimeBegin, createTimeEnd, keyword); |
| | | |
| | | return R.data(pages); |
| | | } |
| | | @GetMapping("done-list") |
| | | @ApiOperationSupport(order = 3) |
| | | @Operation(summary = "当前用户已办任务分页", description = "传入流程信息") |
| | | public R<IPage<FlowVO>> doneList(@Parameter(description = "关键字") String keyword, @Parameter(description = "创建时间开始") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createTimeBegin, @Parameter(description = "创建时间截止") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createTimeEnd, Query query) { |
| | | IPage<FlowVO> pages = businessService.selectDonePage(Condition.getPage(query),"" ,createTimeBegin,createTimeEnd,keyword); |
| | | |
| | | return R.data(pages); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 待办任务列表页 |
| | |
| | | @GetMapping("alltask-list") |
| | | @ApiOperationSupport(order = 3) |
| | | @Operation(summary = "所有任务(fortest)", description = "传入流程信息") |
| | | public R<IPage<BladeFlow>> alltaskList(@Parameter(description = "关键字") String keyword,LocalDate createTimeBegin,LocalDate createTimeEnd, Query query) { |
| | | IPage<BladeFlow> pages = businessService.selectAllTaskPage(Condition.getPage(query), keyword); |
| | | public R<IPage<FlowVO>> alltaskList(@Parameter(description = "关键字") String keyword, LocalDate createTimeBegin, LocalDate createTimeEnd, Query query) { |
| | | IPage<FlowVO> pages = businessService.selectAllTaskPage(Condition.getPage(query), keyword); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | @Operation(summary = "转派任务", description = "") |
| | | @PostMapping("transferTask") |
| | | public R<Void> transferTask(String taskId,String newAssigneeId, String processInstanceId, String comment, @RequestBody Map<String, Object> variables) { |
| | | public R<Void> transferTask(String taskId,String newAssigneeId, String processInstanceId, String comment) { |
| | | // 增加评论 |
| | | if (StringUtil.isNoneBlank(processInstanceId, comment)) { |
| | | taskService.addComment(taskId, processInstanceId, comment); |
| | | try { |
| | | this.flowTransferService.transferTask(taskId, newAssigneeId, comment); |
| | | return R.success("流程转派成功"); |
| | | }catch(Exception e) { |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | // 非空判断 |
| | | if (Func.isEmpty(variables)) { |
| | | variables = Kv.create(); |
| | | } |
| | | // 完成任务 |
| | | taskService.setAssignee(taskId, newAssigneeId); |
| | | return R.success("流程转派成功"); |
| | | } |
| | | |
| | | /** |
| | | * 待办任务列表页 |
| | | */ |
| | | @GetMapping("flow-user-list") |
| | | @ApiOperationSupport(order = 3) |
| | | @Operation(summary = "用户下拉数据", description = "用户下拉数据") |
| | | public R<List<MdmUser>> flowUserList(@Parameter(description = "部门ID") String deptId, String taskId) { |
| | | |
| | | return R.data(mdmUserService.listByDeptAndRoleAlias()); |
| | | } |
| | | |
| | | /** |
| | | * 上一步审批人查询 |
| | | */ |
| | | @GetMapping("previus-approve-user") |
| | | @ApiOperationSupport(order = 3) |
| | | @Operation(summary = "上一步审批人查询", description = "上一步审批人查询,返回审批人id") |
| | | public R<String> previusApproveUserId(@Parameter(description = "部门ID") String processInstanceId) { |
| | | return R.data(this.flowCommonService.previusAssignee(processInstanceId)); |
| | | } |
| | | } |