SysJobLogController.java 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. package com.ruoyi.quartz.controller;
  2. import java.util.List;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.security.access.prepost.PreAuthorize;
  5. import org.springframework.web.bind.annotation.DeleteMapping;
  6. import org.springframework.web.bind.annotation.GetMapping;
  7. import org.springframework.web.bind.annotation.PathVariable;
  8. import org.springframework.web.bind.annotation.RequestMapping;
  9. import org.springframework.web.bind.annotation.RestController;
  10. import com.ruoyi.common.annotation.Log;
  11. import com.ruoyi.common.core.controller.BaseController;
  12. import com.ruoyi.common.core.domain.AjaxResult;
  13. import com.ruoyi.common.core.page.TableDataInfo;
  14. import com.ruoyi.common.enums.BusinessType;
  15. import com.ruoyi.common.utils.poi.ExcelUtil;
  16. import com.ruoyi.quartz.domain.SysJobLog;
  17. import com.ruoyi.quartz.service.ISysJobLogService;
  18. /**
  19. * 调度日志操作处理
  20. *
  21. * @author ruoyi
  22. */
  23. @RestController
  24. @RequestMapping("/monitor/jobLog")
  25. public class SysJobLogController extends BaseController {
  26. @Autowired
  27. private ISysJobLogService jobLogService;
  28. /**
  29. * 查询定时任务调度日志列表
  30. */
  31. @PreAuthorize("@ss.hasPermi('monitor:job:list')")
  32. @GetMapping("/list")
  33. public TableDataInfo list(SysJobLog sysJobLog) {
  34. startPage();
  35. List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
  36. return getDataTable(list);
  37. }
  38. /**
  39. * 导出定时任务调度日志列表
  40. */
  41. @PreAuthorize("@ss.hasPermi('monitor:job:export')")
  42. @Log(title = "任务调度日志", businessType = BusinessType.EXPORT)
  43. @GetMapping("/export")
  44. public AjaxResult export(SysJobLog sysJobLog) {
  45. List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
  46. ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
  47. return util.exportExcel(list, "调度日志");
  48. }
  49. /**
  50. * 根据调度编号获取详细信息
  51. */
  52. @PreAuthorize("@ss.hasPermi('monitor:job:query')")
  53. @GetMapping(value = "/{configId}")
  54. public AjaxResult getInfo(@PathVariable Long jobLogId) {
  55. return AjaxResult.success(jobLogService.selectJobLogById(jobLogId));
  56. }
  57. /**
  58. * 删除定时任务调度日志
  59. */
  60. @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
  61. @Log(title = "定时任务调度日志", businessType = BusinessType.DELETE)
  62. @DeleteMapping("/{jobLogIds}")
  63. public AjaxResult remove(@PathVariable Long[] jobLogIds) {
  64. return toAjax(jobLogService.deleteJobLogByIds(jobLogIds));
  65. }
  66. /**
  67. * 清空定时任务调度日志
  68. */
  69. @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
  70. @Log(title = "调度日志", businessType = BusinessType.CLEAN)
  71. @DeleteMapping("/clean")
  72. public AjaxResult clean() {
  73. jobLogService.cleanJobLog();
  74. return AjaxResult.success();
  75. }
  76. }