SysJobLogController.java 2.5 KB

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