| | |
| | | package cn.flightfeather.supervision.lightshare.web |
| | | |
| | | import cn.flightfeather.supervision.common.executor.BgTaskConditionVo |
| | | import cn.flightfeather.supervision.common.executor.BgTaskStatus |
| | | import cn.flightfeather.supervision.lightshare.service.BgTaskService |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.* |
| | | |
| | | @Api(tags = ["BgTaskController"], description = "后台耗时任务API接口") |
| | | @Api(tags = ["后台任务管理"], description = "后台耗时任务API接口") |
| | | @RestController |
| | | @RequestMapping("/bgTask") |
| | | class BgTaskController(val bgTaskService: BgTaskService){ |
| | | class BgTaskController(val bgTaskService: BgTaskService) { |
| | | |
| | | @ApiOperation(value = "获取后台任务状态") |
| | | @PostMapping("/status") |
| | | fun getTaskStatus(@RequestBody condition: BgTaskConditionVo) = resPack { bgTaskService.getTaskStatus(condition) } |
| | | fun getTaskStatus( |
| | | @RequestBody condition: BgTaskConditionVo |
| | | ) = bgTaskService.getTaskStatus(condition) |
| | | |
| | | @ApiOperation(value = "运行一个任务") |
| | | @PutMapping("/start") |
| | | fun startTask(@RequestBody condition: BgTaskConditionVo) = resPack { bgTaskService.startTask(condition) } |
| | | fun startTask(@RequestBody condition: BgTaskConditionVo) = bgTaskService.startTask(condition) |
| | | |
| | | @ApiOperation(value = "强制关闭任务") |
| | | @PutMapping("/shutDown") |
| | | fun shutDownTask(@RequestBody condition: BgTaskConditionVo) = resPack { bgTaskService.shutDownTask(condition) } |
| | | fun shutDownTask(@RequestBody condition: BgTaskConditionVo) = bgTaskService.shutDownTask(condition) |
| | | |
| | | @ApiOperation(value = "移除一个任务") |
| | | @PutMapping("/remove") |
| | | fun removeTask(@RequestBody condition: BgTaskConditionVo) = resPack { bgTaskService.removeTask(condition) } |
| | | fun removeTask(@RequestBody condition: BgTaskConditionVo) = bgTaskService.removeTask(condition) |
| | | |
| | | @ApiOperation(value = "新建并运行一个测试任务") |
| | | @PutMapping("/newTask/test/start") |
| | | fun startNewTestTask(@RequestParam taskId: String) = resPack { bgTaskService.startNewTestTask(taskId) } |
| | | fun startNewTestTask(@RequestParam taskId: String) = bgTaskService.startNewTestTask(taskId) |
| | | |
| | | @ApiOperation(value = "新建一个测试任务") |
| | | @PutMapping("/newTask/test") |
| | | fun newTestTask(@RequestParam taskId: String) = resPack { bgTaskService.newTestTask(taskId) } |
| | | fun newTestTask(@ApiParam(value = "后台任务id") @RequestParam taskId: String) = |
| | | bgTaskService.newTestTask(taskId) |
| | | } |