SchedulerTask.java
963 Bytes
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
package com.viontech.job;
import java.io.IOException;
import java.sql.*;
import java.util.Date;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.List;
import com.viontech.model.Mall;
import com.viontech.service.impl.CityService;
import com.viontech.service.impl.WeatherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.viontech.model.City;
import com.viontech.model.SimpleWeather;
import com.viontech.service.impl.JsonService;
/**
* @author zhaibolin
*/
@Component
public class SchedulerTask {
@Autowired
private WeatherService weatherService;
@Scheduled(cron = "0 30 5 * * ? ")
private void process() throws IOException {
weatherService.getWeatherInfo();
}
}