| | |
| | | /** |
| | | * 查询定时任务列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:list')") |
| | | //@PreAuthorize("@ss.hasPermi('monitor:job:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysJob sysJob) { |
| | | startPage(); |
| | |
| | | /** |
| | | * 导出定时任务列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:export')") |
| | | //@PreAuthorize("@ss.hasPermi('monitor:job:export')") |
| | | @Log(title = "定时任务", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysJob sysJob) { |
| | |
| | | /** |
| | | * 获取定时任务详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:query')") |
| | | //@PreAuthorize("@ss.hasPermi('monitor:job:query')") |
| | | @GetMapping(value = "/{jobId}") |
| | | public AjaxResult getInfo(@PathVariable("jobId") Long jobId) { |
| | | return success(jobService.selectJobById(jobId)); |
| | |
| | | /** |
| | | * 新增定时任务 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:add')") |
| | | //@PreAuthorize("@ss.hasPermi('monitor:job:add')") |
| | | @Log(title = "定时任务", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody SysJob job) throws SchedulerException, TaskException { |
| | |
| | | /** |
| | | * 修改定时任务 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:edit')") |
| | | //@PreAuthorize("@ss.hasPermi('monitor:job:edit')") |
| | | @Log(title = "定时任务", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | public AjaxResult edit(@RequestBody SysJob job) throws SchedulerException, TaskException { |
| | |
| | | /** |
| | | * 定时任务状态修改 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") |
| | | //@PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") |
| | | @Log(title = "定时任务", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | @PostMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException { |
| | | SysJob newJob = jobService.selectJobById(job.getJobId()); |
| | | newJob.setStatus(job.getStatus()); |
| | |
| | | /** |
| | | * 定时任务立即执行一次 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") |
| | | //@PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") |
| | | @Log(title = "定时任务", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/run") |
| | | @PostMapping("/run") |
| | | public AjaxResult run(@RequestBody SysJob job) throws SchedulerException { |
| | | boolean result = jobService.run(job); |
| | | return result ? success() : error("任务不存在或已过期!"); |
| | |
| | | /** |
| | | * 删除定时任务 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')") |
| | | //@PreAuthorize("@ss.hasPermi('monitor:job:remove')") |
| | | @Log(title = "定时任务", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{jobIds}") |
| | | @GetMapping("/remove/{jobIds}") |
| | | public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException { |
| | | jobService.deleteJobByIds(jobIds); |
| | | return success(); |