SchedulerTask.java 963 Bytes
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();
    }


}