cjl
2024-01-31 3f667355c7013b459f3ab5ec0c1bc035d7e2d5aa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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;
    }
}