FlowFollowController.java 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are met:
  6. *
  7. * Redistributions of source code must retain the above copyright notice,
  8. * this list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * Neither the name of the dreamlu.net developer nor the names of its
  13. * contributors may be used to endorse or promote products derived from
  14. * this software without specific prior written permission.
  15. * Author: Chill 庄骞 (smallchill@163.com)
  16. */
  17. package org.springblade.flow.engine.controller;
  18. import com.baomidou.mybatisplus.core.metadata.IPage;
  19. import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
  20. import io.swagger.annotations.ApiOperation;
  21. import io.swagger.annotations.ApiParam;
  22. import lombok.AllArgsConstructor;
  23. import org.springblade.core.launch.constant.AppConstant;
  24. import org.springblade.core.mp.support.Condition;
  25. import org.springblade.core.mp.support.Query;
  26. import org.springblade.core.secure.annotation.PreAuth;
  27. import org.springblade.core.tenant.annotation.NonDS;
  28. import org.springblade.core.tool.api.R;
  29. import org.springblade.core.tool.constant.RoleConstant;
  30. import org.springblade.flow.engine.entity.FlowExecution;
  31. import org.springblade.flow.engine.service.FlowEngineService;
  32. import org.springframework.web.bind.annotation.*;
  33. import springfox.documentation.annotations.ApiIgnore;
  34. /**
  35. * 流程状态控制器
  36. *
  37. * @author Chill
  38. */
  39. @NonDS
  40. @RestController
  41. @RequestMapping(AppConstant.APPLICATION_FLOW_NAME + "/follow")
  42. @AllArgsConstructor
  43. @PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
  44. @ApiIgnore
  45. public class FlowFollowController {
  46. private final FlowEngineService flowEngineService;
  47. /**
  48. * 流程状态列表
  49. */
  50. @GetMapping("list")
  51. @ApiOperationSupport(order = 1)
  52. @ApiOperation(value = "分页", notes = "传入notice")
  53. public R<IPage<FlowExecution>> list(Query query, @ApiParam(value = "流程实例id") String processInstanceId, @ApiParam(value = "流程key") String processDefinitionKey) {
  54. IPage<FlowExecution> pages = flowEngineService.selectFollowPage(Condition.getPage(query), processInstanceId, processDefinitionKey);
  55. return R.data(pages);
  56. }
  57. /**
  58. * 删除流程实例
  59. */
  60. @PostMapping("delete-process-instance")
  61. @ApiOperationSupport(order = 2)
  62. @ApiOperation(value = "删除", notes = "传入主键集合")
  63. public R deleteProcessInstance(@ApiParam(value = "流程实例id") @RequestParam String processInstanceId, @ApiParam(value = "删除原因") @RequestParam String deleteReason) {
  64. boolean temp = flowEngineService.deleteProcessInstance(processInstanceId, deleteReason);
  65. return R.status(temp);
  66. }
  67. }