|  |  |  | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.web.client.RestTemplate; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | 
|---|
|  |  |  | QueryWrapper<CityConfigWeatherForecast> wrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | wrapper.select("city_code", "location_id").eq("is_delete", Constants.NOT_DELETE); | 
|---|
|  |  |  | List<CityConfigWeatherForecast> list = cityConfigWeatherForecastService.list(wrapper); | 
|---|
|  |  |  | CityWeatherForecast cityWeatherForecast = new CityWeatherForecast(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<CityWeatherForecast> cityWeatherForecasts = new ArrayList<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (CityConfigWeatherForecast cityConfigWeatherForecast : list) { | 
|---|
|  |  |  | Integer cityCode = cityConfigWeatherForecast.getCityCode(); | 
|---|
|  |  |  | Integer locationId = cityConfigWeatherForecast.getLocationId(); | 
|---|
|  |  |  | 
|---|
|  |  |  | String dayTime = fxTime.split("T")[0]; | 
|---|
|  |  |  | if (dayTime.equals(nextTime)) { | 
|---|
|  |  |  | String hourTime = fxTime.substring(0, 17).replaceAll("T", " "); | 
|---|
|  |  |  | CityWeatherForecast cityWeatherForecast = new CityWeatherForecast(); | 
|---|
|  |  |  | cityWeatherForecast.setCityCode(cityCode); | 
|---|
|  |  |  | cityWeatherForecast.setTime(DateUtils.getDate(hourTime, DateUtils.yyyy_MM_dd_HH_EN)); | 
|---|
|  |  |  | cityWeatherForecast.setValue(JSONObject.toJSONString(hourlyMap)); | 
|---|
|  |  |  | cityWeatherForecastMapper.insert(cityWeatherForecast); | 
|---|
|  |  |  | cityWeatherForecasts.add(cityWeatherForecast); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | cityWeatherForecastMapper.insertCityWeatherForecast(cityWeatherForecasts); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|