SysJobLogController.java 3.1 KB

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