¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.dromara.workflow.controller; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.core.validate.AddGroup; |
| | | import org.dromara.common.idempotent.annotation.RepeatSubmit; |
| | | import org.dromara.common.log.annotation.Log; |
| | | import org.dromara.common.log.enums.BusinessType; |
| | | import org.dromara.common.mybatis.core.page.PageQuery; |
| | | import org.dromara.common.mybatis.core.page.TableDataInfo; |
| | | import org.dromara.common.satoken.utils.LoginHelper; |
| | | import org.dromara.common.web.core.BaseController; |
| | | import org.dromara.workflow.domain.WfTaskBackNode; |
| | | import org.dromara.workflow.domain.bo.*; |
| | | import org.dromara.workflow.domain.vo.TaskVo; |
| | | import org.dromara.workflow.domain.vo.VariableVo; |
| | | import org.dromara.workflow.service.IActTaskService; |
| | | import org.dromara.workflow.service.IWfTaskBackNodeService; |
| | | import org.dromara.workflow.utils.QueryUtils; |
| | | import org.flowable.engine.TaskService; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ä»»å¡ç®¡ç æ§å¶å± |
| | | * |
| | | * @author may |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/workflow/task") |
| | | public class ActTaskController extends BaseController { |
| | | |
| | | private final IActTaskService actTaskService; |
| | | |
| | | private final TaskService taskService; |
| | | |
| | | private final IWfTaskBackNodeService wfTaskBackNodeService; |
| | | |
| | | |
| | | /** |
| | | * å¯å¨ä»»å¡ |
| | | * |
| | | * @param startProcessBo å¯å¨æµç¨åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/startWorkFlow") |
| | | public R<Map<String, Object>> startWorkFlow(@Validated(AddGroup.class) @RequestBody StartProcessBo startProcessBo) { |
| | | Map<String, Object> map = actTaskService.startWorkFlow(startProcessBo); |
| | | return R.ok("æäº¤æå", map); |
| | | } |
| | | |
| | | /** |
| | | * åçä»»å¡ |
| | | * |
| | | * @param completeTaskBo åçä»»å¡åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/completeTask") |
| | | public R<Void> completeTask(@Validated(AddGroup.class) @RequestBody CompleteTaskBo completeTaskBo) { |
| | | return toAjax(actTaskService.completeTask(completeTaskBo)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çå¾
åä»»å¡ |
| | | * |
| | | * @param taskBo åæ° |
| | | */ |
| | | @GetMapping("/getPageByTaskWait") |
| | | public TableDataInfo<TaskVo> getPageByTaskWait(TaskBo taskBo, PageQuery pageQuery) { |
| | | return actTaskService.getPageByTaskWait(taskBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç§æ·ææå¾
åä»»å¡ |
| | | * |
| | | * @param taskBo åæ° |
| | | */ |
| | | @GetMapping("/getPageByAllTaskWait") |
| | | public TableDataInfo<TaskVo> getPageByAllTaskWait(TaskBo taskBo, PageQuery pageQuery) { |
| | | return actTaskService.getPageByAllTaskWait(taskBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çå·²åä»»å¡ |
| | | * |
| | | * @param taskBo åæ° |
| | | */ |
| | | @GetMapping("/getPageByTaskFinish") |
| | | public TableDataInfo<TaskVo> getPageByTaskFinish(TaskBo taskBo, PageQuery pageQuery) { |
| | | return actTaskService.getPageByTaskFinish(taskBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç¨æ·çæé |
| | | * |
| | | * @param taskBo åæ° |
| | | */ |
| | | @GetMapping("/getPageByTaskCopy") |
| | | public TableDataInfo<TaskVo> getPageByTaskCopy(TaskBo taskBo, PageQuery pageQuery) { |
| | | return actTaskService.getPageByTaskCopy(taskBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç§æ·ææå·²åä»»å¡ |
| | | * |
| | | * @param taskBo åæ° |
| | | */ |
| | | @GetMapping("/getPageByAllTaskFinish") |
| | | public TableDataInfo<TaskVo> getPageByAllTaskFinish(TaskBo taskBo, PageQuery pageQuery) { |
| | | return actTaskService.getPageByAllTaskFinish(taskBo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * ç¾æ¶ï¼æ¾åï¼ä»»å¡ |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/claim/{taskId}") |
| | | public R<Void> claimTask(@NotBlank(message = "ä»»å¡idä¸è½ä¸ºç©º") @PathVariable String taskId) { |
| | | try { |
| | | taskService.claim(taskId, Convert.toStr(LoginHelper.getUserId())); |
| | | return R.ok(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return R.fail("ç¾æ¶ä»»å¡å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å½è¿ï¼æ¾åçï¼ä»»å¡ |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/returnTask/{taskId}") |
| | | public R<Void> returnTask(@NotBlank(message = "ä»»å¡idä¸è½ä¸ºç©º") @PathVariable String taskId) { |
| | | try { |
| | | taskService.setAssignee(taskId, null); |
| | | return R.ok(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return R.fail("å½è¿ä»»å¡å¤±è´¥ï¼" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å§æ´¾ä»»å¡ |
| | | * |
| | | * @param delegateBo åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/delegateTask") |
| | | public R<Void> delegateTask(@Validated({AddGroup.class}) @RequestBody DelegateBo delegateBo) { |
| | | return toAjax(actTaskService.delegateTask(delegateBo)); |
| | | } |
| | | |
| | | /** |
| | | * ç»æ¢ä»»å¡ |
| | | * |
| | | * @param terminationBo åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.DELETE) |
| | | @RepeatSubmit() |
| | | @PostMapping("/terminationTask") |
| | | public R<Void> terminationTask(@RequestBody TerminationBo terminationBo) { |
| | | return toAjax(actTaskService.terminationTask(terminationBo)); |
| | | } |
| | | |
| | | /** |
| | | * 转åä»»å¡ |
| | | * |
| | | * @param transmitBo åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/transferTask") |
| | | public R<Void> transferTask(@Validated({AddGroup.class}) @RequestBody TransmitBo transmitBo) { |
| | | return toAjax(actTaskService.transferTask(transmitBo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¼ç¾ä»»å¡å ç¾ |
| | | * |
| | | * @param addMultiBo åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/addMultiInstanceExecution") |
| | | public R<Void> addMultiInstanceExecution(@Validated({AddGroup.class}) @RequestBody AddMultiBo addMultiBo) { |
| | | return toAjax(actTaskService.addMultiInstanceExecution(addMultiBo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¼ç¾ä»»å¡åç¾ |
| | | * |
| | | * @param deleteMultiBo åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/deleteMultiInstanceExecution") |
| | | public R<Void> deleteMultiInstanceExecution(@Validated({AddGroup.class}) @RequestBody DeleteMultiBo deleteMultiBo) { |
| | | return toAjax(actTaskService.deleteMultiInstanceExecution(deleteMultiBo)); |
| | | } |
| | | |
| | | /** |
| | | * 驳åå®¡æ¹ |
| | | * |
| | | * @param backProcessBo åæ° |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping("/backProcess") |
| | | public R<String> backProcess(@Validated({AddGroup.class}) @RequestBody BackProcessBo backProcessBo) { |
| | | return R.ok(actTaskService.backProcess(backProcessBo)); |
| | | } |
| | | |
| | | /** |
| | | * è·åå½åä»»å¡ |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | @GetMapping("/getTaskById/{taskId}") |
| | | public R<TaskVo> getTaskById(@PathVariable String taskId) { |
| | | return R.ok(QueryUtils.getTask(taskId)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ä¿®æ¹ä»»å¡åç人 |
| | | * |
| | | * @param taskIds ä»»å¡id |
| | | * @param userId åç人id |
| | | */ |
| | | @Log(title = "ä»»å¡ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping("/updateAssignee/{taskIds}/{userId}") |
| | | public R<Void> updateAssignee(@PathVariable String[] taskIds, @PathVariable String userId) { |
| | | return toAjax(actTaskService.updateAssignee(taskIds, userId)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æµç¨åé |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | @GetMapping("/getInstanceVariable/{taskId}") |
| | | public R<List<VariableVo>> getProcessInstVariable(@PathVariable String taskId) { |
| | | return R.ok(actTaskService.getInstanceVariable(taskId)); |
| | | } |
| | | |
| | | /** |
| | | * è·åå¯é©³åå¾ä»»å¡èç¹ |
| | | * |
| | | * @param processInstanceId æµç¨å®ä¾id |
| | | */ |
| | | @GetMapping("/getTaskNodeList/{processInstanceId}") |
| | | public R<List<WfTaskBackNode>> getNodeList(@PathVariable String processInstanceId) { |
| | | return R.ok(CollUtil.reverse(wfTaskBackNodeService.getListByInstanceId(processInstanceId))); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å·¥ä½æµä»»å¡ç¨æ·éæ©å ç¾äººå |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | @GetMapping("/getTaskUserIdsByAddMultiInstance/{taskId}") |
| | | public R<String> getTaskUserIdsByAddMultiInstance(@PathVariable String taskId) { |
| | | return R.ok(actTaskService.getTaskUserIdsByAddMultiInstance(taskId)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å·¥ä½æµéæ©åç¾äººå |
| | | * |
| | | * @param taskId ä»»å¡id |
| | | */ |
| | | @GetMapping("/getListByDeleteMultiInstance/{taskId}") |
| | | public R<List<TaskVo>> getListByDeleteMultiInstance(@PathVariable String taskId) { |
| | | return R.ok(actTaskService.getListByDeleteMultiInstance(taskId)); |
| | | } |
| | | |
| | | } |