k94314517
2024-10-18 164a872e40aa1bb88427d37262a8697c2b8caa6a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.doumee.api.timer;
 
import com.doumee.core.utils.Constants;
import com.doumee.dao.timer.entity.QuartzJob;
import com.doumee.service.timer.QuartzJobService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
 
@RestController
@RequestMapping( "/business/quartz")
@Api(tags = "定时任务接口")
public class QuartzController {
 
    @Resource
    private QuartzJobService quartzJobService ;
 
    @ApiOperation( "任务查询")
    @GetMapping("/job/{id}")
    public QuartzJob getById(@PathVariable Integer id){
        return quartzJobService.getById(id) ;
    }
 
    @ApiOperation( "任务新增")
    @PostMapping("/job")
    public Integer insert(@RequestBody QuartzJob quartzJob){
        return quartzJobService.insert(quartzJob) ;
    }
 
   @ApiOperation( "更新任务")
    @PostMapping("/job/update")
    public Integer update(@RequestBody QuartzJob quartzJob){
        return quartzJobService.update(quartzJob) ;
    }
 
   @ApiOperation( "停止任务")
    @PostMapping("/job/pause/{id}")
    public void pause(@PathVariable("id") Integer id) {
        quartzJobService.pause(id);
    }
 
    @ApiOperation( "恢复任务")
    @PostMapping("/job/resume/{id}")
    public void resume(@PathVariable("id") Integer id) {
        quartzJobService.resume(id) ;
    }
 
   @ApiOperation( "执行一次")
    @GetMapping("/job/runOnce/{id}")
    public void runOnce(@PathVariable("id") Integer id) {
        quartzJobService.runOnce(id) ;
    }
}