Authored by mali

手动执行定时任务

package com.yoho.ufo.restapi;
import com.yoho.quartz.job.YhJob;
import com.yoho.ufo.service.model.*;
import com.yoho.ufo.service.model.ApiResponse;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* Created by li.ma on 2019/2/1.
... ... @@ -22,11 +25,11 @@ public class ScheduledManualController implements ApplicationContextAware{
}
@RequestMapping(value = "/scheduledManual")
public String scheduledManual(@RequestParam(name = "scheduledName",required = true) String scheduledName) {
@ResponseBody
public ApiResponse scheduledManual(@RequestParam(name = "scheduledName",required = true) String scheduledName) {
YhJob jobObject = applicationContext.getBean(scheduledName, YhJob.class);
jobObject.process(null);
return "SUCCESS";
return new ApiResponse(200, "处理成功", null);
}
}
... ...