| | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | //城市气象数据来源于,和风天气,实时天气商业版 |
| | | @Override |
| | | public void insertCityWeather() { |
| | | //获取城市配置 |
| | |
| | | List<CityConfigWeather> list = cityConfigWeatherService.list(wrapper); |
| | | |
| | | List<CityWeather> cityWeathers = new ArrayList<>(); |
| | | CityWeather cityWeather = new CityWeather(); |
| | | |
| | | for (CityConfigWeather cityConfigWeather : list) { |
| | | CityWeather cityWeather = new CityWeather(); |
| | | Integer cityCode = cityConfigWeather.getCityCode(); |
| | | Integer locationId = cityConfigWeather.getLocationId(); |
| | | Map<String, Object> data = restTemplate.getForObject("https://api.qweather.com/v7/weather/now?key=da05c6c4852d4f7aa3364a9236ee9e26&gzip=n&location={1}", Map.class, locationId); |