SysJobLogController.java 3.0 KB

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