1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package com.yihu.figure.controller.job;
- import com.yihu.figure.controller.BaseController;
- import com.yihu.figure.service.JobService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.http.MediaType;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- /**
- * 任务启动
- *
- * @author chenweida
- */
- @RestController
- @RequestMapping(value = "/job", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
- @Api(description = "后台-任务控制")
- public class JobController extends BaseController {
- @Autowired
- private JobService jobService;
- @ApiOperation(value = "启动自动生成体征数据任务")
- @RequestMapping(value = "startHealthJob", method = RequestMethod.GET)
- public String startHealthJob() {
- try {
- jobService.startHealthJob();
- return success("启动成功!");
- } catch (Exception e) {
- error(e);
- return invalidUserException(e, -1, "启动失败:" + e.getMessage());
- }
- }
- @ApiOperation(value = "停止自动生成体征数据任务")
- @RequestMapping(value = "stopHealthJob", method = RequestMethod.GET)
- public String stopHealthJob() {
- try {
- jobService.stopHealthJob();
- return success("停止成功!");
- } catch (Exception e) {
- error(e);
- return invalidUserException(e, -1, "启动失败:" + e.getMessage());
- }
- }
- }
|