package com.moral.api.task; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.moral.api.service.ForecastService; import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.context.XxlJobHelper; import com.xxl.job.core.handler.annotation.XxlJob; @Component public class ForecastTask { @Autowired private ForecastService forecastService; @XxlJob("forecastO3") public ReturnT forecastO3() { try { forecastService.forecastO3(); } catch (Exception e) { XxlJobHelper.log(e.getMessage()); return new ReturnT(ReturnT.FAIL_CODE, e.getMessage()); } return ReturnT.SUCCESS; } }