| | |
| | | List<CityWeatherForecast> cityWeatherForecasts = new ArrayList<>(); |
| | | |
| | | for (CityConfigWeatherForecast cityConfigWeatherForecast : list) { |
| | | CityWeatherForecast cityWeatherForecast = new CityWeatherForecast(); |
| | | Integer cityCode = cityConfigWeatherForecast.getCityCode(); |
| | | Integer locationId = cityConfigWeatherForecast.getLocationId(); |
| | | Map<String, Object> data = restTemplate.getForObject("https://api.qweather.com/v7/weather/72h?key=da05c6c4852d4f7aa3364a9236ee9e26&gzip=n&location={1}", Map.class, locationId); |
| | |
| | | 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)); |