| package com.moral.api.task; | 
|   | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.stereotype.Component; | 
|   | 
| import com.moral.api.service.CityAqiDailyService; | 
| import com.moral.api.service.CityAqiMonthlyService; | 
| import com.moral.api.service.CityAqiService; | 
| import com.moral.api.service.CityAqiYearlyService; | 
| import com.moral.api.service.HistoryAqiService; | 
| 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 AqiInsertTask { | 
|   | 
|     @Autowired | 
|     private HistoryAqiService historyAqiService; | 
|   | 
|     @Autowired | 
|     private CityAqiDailyService cityAqiDailyService; | 
|   | 
|     @Autowired | 
|     private CityAqiService cityAqiService; | 
|   | 
|     @Autowired | 
|     private CityAqiMonthlyService cityAqiMonthlyService; | 
|   | 
|     @Autowired | 
|     private CityAqiYearlyService cityAqiYearlyService; | 
|   | 
|     @XxlJob("insertHistoryAqisss") | 
|     public ReturnT insertHistoryAqisss() { | 
|        System.out.println("已执行job"); | 
|         return ReturnT.SUCCESS; | 
|     } | 
|     //国控站aqi小时数据接入 | 
|     @XxlJob("insertHistoryAqi") | 
|     public ReturnT insertHistoryAqi() { | 
|         try { | 
|             historyAqiService.insertHistoryAqi(null); | 
|         } catch (Exception e) { | 
|             XxlJobHelper.log(e.getMessage()); | 
|             return new ReturnT(ReturnT.FAIL_CODE, e.getMessage()); | 
|         } | 
|         return ReturnT.SUCCESS; | 
|     } | 
|   | 
|     @XxlJob("insertHCHistoryAqi") | 
|     public ReturnT insertHCHistoryAqi() { | 
|         try { | 
|             historyAqiService.insertHCHistoryAqi(); | 
|         } catch (Exception e) { | 
|             XxlJobHelper.log(e.getMessage()); | 
|             return new ReturnT(ReturnT.FAIL_CODE, e.getMessage()); | 
|         } | 
|         return ReturnT.SUCCESS; | 
|     } | 
|   | 
|     //城市aqi小时数据接入 | 
|     @XxlJob("insertCityAqi") | 
|     public ReturnT insertCityAqi() { | 
|         try { | 
|             cityAqiService.insertCityAqi(); | 
|         } catch (Exception e) { | 
|             XxlJobHelper.log(e.getMessage()); | 
|             return new ReturnT(ReturnT.FAIL_CODE, e.getMessage()); | 
|         } | 
|         return ReturnT.SUCCESS; | 
|     } | 
|   | 
|     //城市aqi日数据统计 | 
|     @XxlJob("insertCityAqiDaily") | 
|     public ReturnT insertCityAqiDaily() { | 
|         try { | 
|             cityAqiDailyService.insertCityAqiDaily(); | 
|         } catch (Exception e) { | 
|             XxlJobHelper.log(e.getMessage()); | 
|             return new ReturnT(ReturnT.FAIL_CODE, e.getMessage()); | 
|         } | 
|         return ReturnT.SUCCESS; | 
|     } | 
|   | 
|     //城市aqi月数据统计 | 
|     @XxlJob("insertCityAqiMonthly") | 
|     public ReturnT insertCityAqiMonthly() { | 
|         try { | 
|             cityAqiMonthlyService.insertCityAqiMonthly(); | 
|         } catch (Exception e) { | 
|             XxlJobHelper.log(e.getMessage()); | 
|             return new ReturnT(ReturnT.FAIL_CODE, e.getMessage()); | 
|         } | 
|         return ReturnT.SUCCESS; | 
|     } | 
|   | 
|     //城市aqi年数据统计 | 
|     @XxlJob("insertCityAqiYearly") | 
|     public ReturnT insertCityAqiYearly() { | 
|         try { | 
|             cityAqiYearlyService.insertCityAqiYearly(); | 
|         } catch (Exception e) { | 
|             XxlJobHelper.log(e.getMessage()); | 
|             return new ReturnT(ReturnT.FAIL_CODE, e.getMessage()); | 
|         } | 
|         return ReturnT.SUCCESS; | 
|     } | 
| } |