jinpengyong
2021-01-25 dcd1f53f7cde02a411d9767e6edbe612e4178d3d
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
package com.moral.task;
 
import java.text.ParseException;
 
import javax.annotation.Resource;
 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
 
import com.moral.service.WeatherService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
 
@Component
public class WeatherInsertTask {
    private static transient Logger logger = LoggerFactory.getLogger(WeatherInsertTask.class);
 
    @Resource
    private WeatherService weatherService;
 
    @XxlJob("realWeatherHour")
    public ReturnT insertRealWeather(String param) throws ParseException {
        int state = weatherService.insertRealWeather();
        if (state == 200) {
            return new ReturnT(200, "插入成功");
        } else {
            return new ReturnT(500, "和风天气接口异常,插入失败,请查看接口");
        }
    }
 
    @XxlJob("forecastWeatherHour")
    public ReturnT insertForecastWeather(String param) throws ParseException {
        int state = weatherService.insertForecastWeather();
        if (state == 200) {
            return new ReturnT(200, "插入成功");
        } else {
            return new ReturnT(500, "和风天气接口异常,插入失败,请查看接口");
        }
    }
 
    @XxlJob("forecastWeatherHourNew")
    public ReturnT insertForecastWeatherNew(String param) throws ParseException {
        int state = weatherService.insertForecastWeatherNew();
        if (state == 200) {
            return new ReturnT(200, "插入成功");
        } else {
            return new ReturnT(500, "和风天气接口异常,插入失败,请查看接口");
        }
    }
}