jinpengyong
2022-01-20 f052b63c0428d4f3f723e9c729f19a62bfe3172e
screen-job/src/main/java/com/moral/api/service/impl/CityWeatherForecastServiceImpl.java
@@ -15,6 +15,7 @@
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;
@@ -47,6 +48,8 @@
        QueryWrapper<CityConfigWeatherForecast> wrapper = new QueryWrapper<>();
        wrapper.select("city_code", "location_id").eq("is_delete", Constants.NOT_DELETE);
        List<CityConfigWeatherForecast> list = cityConfigWeatherForecastService.list(wrapper);
        List<CityWeatherForecast> cityWeatherForecasts = new ArrayList<>();
        CityWeatherForecast cityWeatherForecast = new CityWeatherForecast();
        for (CityConfigWeatherForecast cityConfigWeatherForecast : list) {
            Integer cityCode = cityConfigWeatherForecast.getCityCode();
@@ -61,9 +64,10 @@
                    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);
    }
}