TestLeaveController.java 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. package com.ruoyi.system.controller;
  2. import com.ruoyi.common.annotation.Log;
  3. import com.ruoyi.common.core.controller.BaseController;
  4. import com.ruoyi.common.core.domain.AjaxResult;
  5. import com.ruoyi.common.core.page.TableDataInfo;
  6. import com.ruoyi.common.enums.BusinessType;
  7. import com.ruoyi.common.utils.poi.ExcelUtil;
  8. import com.ruoyi.system.domain.TestLeave;
  9. import com.ruoyi.system.service.ITestLeaveService;
  10. import org.dromara.warm.flow.core.service.TaskService;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.security.access.prepost.PreAuthorize;
  13. import org.springframework.transaction.annotation.Transactional;
  14. import org.springframework.web.bind.annotation.*;
  15. import javax.annotation.Resource;
  16. import javax.servlet.http.HttpServletResponse;
  17. import java.util.List;
  18. /**
  19. * OA 请假申请Controller
  20. *
  21. * @author ruoyi
  22. * @date 2024-03-07
  23. */
  24. @RestController
  25. @RequestMapping("/system/leave")
  26. public class TestLeaveController extends BaseController
  27. {
  28. @Autowired
  29. private ITestLeaveService testLeaveService;
  30. @Resource
  31. private TaskService taskService;
  32. /**
  33. * 查询OA 请假申请列表
  34. */
  35. @PreAuthorize("@ss.hasPermi('system:leave:list')")
  36. @GetMapping("/list")
  37. public TableDataInfo list(TestLeave testLeave)
  38. {
  39. startPage();
  40. List<TestLeave> list = testLeaveService.selectTestLeaveList(testLeave);
  41. return getDataTable(list);
  42. }
  43. /**
  44. * 导出OA 请假申请列表
  45. */
  46. @PreAuthorize("@ss.hasPermi('system:leave:export')")
  47. @Log(title = "OA 请假申请", businessType = BusinessType.EXPORT)
  48. @PostMapping("/export")
  49. public void export(HttpServletResponse response, TestLeave testLeave)
  50. {
  51. List<TestLeave> list = testLeaveService.selectTestLeaveList(testLeave);
  52. ExcelUtil<TestLeave> util = new ExcelUtil<TestLeave>(TestLeave.class);
  53. util.exportExcel(response, list, "OA 请假申请数据");
  54. }
  55. /**
  56. * 获取OA 请假申请详细信息
  57. */
  58. @GetMapping(value = "/{id}")
  59. public AjaxResult getInfo(@PathVariable("id") String id)
  60. {
  61. return success(testLeaveService.selectTestLeaveById(id));
  62. }
  63. /**
  64. * 新增OA 请假申请
  65. */
  66. @PreAuthorize("@ss.hasPermi('system:leave:add')")
  67. @Log(title = "OA 请假申请", businessType = BusinessType.INSERT)
  68. @PostMapping
  69. @Transactional(rollbackFor = Exception.class)
  70. public AjaxResult add(@RequestBody TestLeave testLeave, String flowStatus)
  71. {
  72. return toAjax(testLeaveService.insertTestLeave(testLeave, flowStatus));
  73. }
  74. /**
  75. * 修改OA 请假申请
  76. */
  77. @PreAuthorize("@ss.hasPermi('system:leave:edit')")
  78. @Log(title = "OA 请假申请", businessType = BusinessType.UPDATE)
  79. @PutMapping
  80. @Transactional(rollbackFor = Exception.class)
  81. public AjaxResult edit(@RequestBody TestLeave testLeave)
  82. {
  83. return toAjax(testLeaveService.updateTestLeave(testLeave));
  84. }
  85. /**
  86. * 删除OA 请假申请
  87. */
  88. @PreAuthorize("@ss.hasPermi('system:leave:remove')")
  89. @Log(title = "OA 请假申请", businessType = BusinessType.DELETE)
  90. @DeleteMapping("/{ids}")
  91. @Transactional(rollbackFor = Exception.class)
  92. public AjaxResult remove(@PathVariable String[] ids)
  93. {
  94. return toAjax(testLeaveService.deleteTestLeaveByIds(ids));
  95. }
  96. /**
  97. * 提交审批
  98. */
  99. @PreAuthorize("@ss.hasPermi('system:leave:submit')")
  100. @Log(title = "OA 请假申请", businessType = BusinessType.OTHER)
  101. @GetMapping(value = "/submit")
  102. @Transactional(rollbackFor = Exception.class)
  103. public AjaxResult submit(String id, String flowStatus) {
  104. return toAjax(testLeaveService.submit(id, flowStatus));
  105. }
  106. /**
  107. * 办理
  108. */
  109. @Log(title = "流程实例", businessType = BusinessType.OTHER)
  110. @PostMapping("/handle")
  111. @Transactional(rollbackFor = Exception.class)
  112. public AjaxResult handle(@RequestBody TestLeave testLeave, Long taskId, String skipType, String message
  113. , String nodeCode, String flowStatus) {
  114. return toAjax(testLeaveService.handle(testLeave, taskId, skipType, message, nodeCode, flowStatus));
  115. }
  116. /**
  117. * 终止流程,提前结束
  118. *
  119. * @param testLeave
  120. * @return
  121. */
  122. @PostMapping("/termination")
  123. @Transactional(rollbackFor = Exception.class)
  124. public AjaxResult termination(@RequestBody TestLeave testLeave) {
  125. return toAjax(testLeaveService.termination(testLeave));
  126. }
  127. }