SysJobLogController.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. {
  27. @Autowired
  28. private ISysJobLogService jobLogService;
  29. /**
  30. * 查询定时任务调度日志列表
  31. */
  32. @PreAuthorize("@ss.hasPermi('monitor:job:list')")
  33. @GetMapping("/list")
  34. public TableDataInfo list(SysJobLog sysJobLog)
  35. {
  36. startPage();
  37. List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
  38. return getDataTable(list);
  39. }
  40. /**
  41. * 导出定时任务调度日志列表
  42. */
  43. @PreAuthorize("@ss.hasPermi('monitor:job:export')")
  44. @Log(title = "任务调度日志", businessType = BusinessType.EXPORT)
  45. @GetMapping("/export")
  46. public AjaxResult export(SysJobLog sysJobLog)
  47. {
  48. List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
  49. ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
  50. return util.exportExcel(list, "调度日志");
  51. }
  52. /**
  53. * 根据调度编号获取详细信息
  54. */
  55. @PreAuthorize("@ss.hasPermi('monitor:job:query')")
  56. @GetMapping(value = "/{configId}")
  57. public AjaxResult getInfo(@PathVariable Long jobLogId)
  58. {
  59. return AjaxResult.success(jobLogService.selectJobLogById(jobLogId));
  60. }
  61. /**
  62. * 删除定时任务调度日志
  63. */
  64. @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
  65. @Log(title = "定时任务调度日志", businessType = BusinessType.DELETE)
  66. @DeleteMapping("/{jobLogIds}")
  67. public AjaxResult remove(@PathVariable Long[] jobLogIds)
  68. {
  69. return toAjax(jobLogService.deleteJobLogByIds(jobLogIds));
  70. }
  71. /**
  72. * 清空定时任务调度日志
  73. */
  74. @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
  75. @Log(title = "调度日志", businessType = BusinessType.CLEAN)
  76. @DeleteMapping("/clean")
  77. public AjaxResult clean()
  78. {
  79. jobLogService.cleanJobLog();
  80. return AjaxResult.success();
  81. }
  82. }