| 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) ; | 
|     } | 
| } |