FlowController.java 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 com.fjhx.flow.controller;
  18. import com.fjhx.flow.service.IFlowEngineService;
  19. import com.fjhx.flow.service.IFlowService;
  20. import com.fjhx.myapp.application.entity.Flow;
  21. import com.fjhx.myapp.application.entity.FlowParam;
  22. import io.swagger.annotations.ApiParam;
  23. import lombok.AllArgsConstructor;
  24. import org.springblade.common.constant.ApiConstant;
  25. import org.springblade.core.boot.ctrl.BladeController;
  26. import org.springblade.core.mp.support.Condition;
  27. import org.springblade.core.tool.api.R;
  28. import org.springblade.core.tool.utils.Func;
  29. import org.springframework.web.bind.annotation.*;
  30. import javax.validation.Valid;
  31. import java.util.Date;
  32. /**
  33. * 模型表 控制器
  34. *
  35. * @author BladeX
  36. * @since 2022-07-20
  37. */
  38. @RestController
  39. @AllArgsConstructor
  40. @RequestMapping(ApiConstant.Project.SAAS_FLOW_REQUEST_PREFIX + "/flow")
  41. public class FlowController extends BladeController {
  42. private final IFlowService flowService;
  43. private final IFlowEngineService iFlowEngineService;
  44. /**
  45. * 详情
  46. */
  47. @GetMapping("/detail")
  48. public R<Flow> detail(Flow flow) {
  49. Flow detail = flowService.getOne(Condition.getQueryWrapper(flow));
  50. return R.data(detail);
  51. }
  52. /**
  53. * 新增 模型表
  54. */
  55. @PostMapping("/save")
  56. public R save(@Valid @RequestBody Flow flow) {
  57. flow.setCreatedTime(new Date());
  58. return R.status(flowService.save(flow));
  59. }
  60. /**
  61. * 修改 模型表
  62. */
  63. @PostMapping("/update")
  64. public R update(@Valid @RequestBody Flow flow) {
  65. flow.setUpdatedTime(new Date());
  66. return R.status(flowService.updateById(flow));
  67. }
  68. /**
  69. * 删除 模型表
  70. */
  71. @PostMapping("/remove")
  72. public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
  73. return R.status(flowService.removeByIds(Func.toLongList(ids)));
  74. }
  75. /**
  76. * 删除 模型表
  77. */
  78. @PostMapping("/start")
  79. public R start(@RequestBody FlowParam param) {
  80. return R.status(iFlowEngineService.startFlow(param));
  81. }
  82. /**
  83. * 删除 模型表
  84. */
  85. @PostMapping("/examineFlow")
  86. public R examineFlow(@RequestBody FlowParam param) {
  87. return R.status(iFlowEngineService.examineFlow(param));
  88. }
  89. /**
  90. * 删除 模型表
  91. */
  92. @PostMapping("/rejectFlow")
  93. public R rejectFlow(@RequestBody FlowParam param) {
  94. return R.status(iFlowEngineService.rejectFlow(param));
  95. }
  96. }