jinpengyong
2021-12-22 9d91dc402f279630eaa100024fd3b1542fbeb41c
screen-job/src/main/java/com/moral/api/service/impl/CityWeatherServiceImpl.java
@@ -51,7 +51,7 @@
        wrapper.select("city_code", "location_id").eq("is_delete", Constants.NOT_DELETE);
        List<CityConfig> list = cityConfigService.list(wrapper);
        for (CityConfig cityConfig : list) {
            String cityCode = cityConfig.getCityCode();
            Integer cityCode = cityConfig.getCityCode();
            Integer locationId = cityConfig.getLocationId();
            Map<String, Object> data = restTemplate.getForObject("https://api.qweather.com/v7/weather/now?key=da05c6c4852d4f7aa3364a9236ee9e26&gzip=n&location={1}", Map.class, locationId);
            Map<String, Object> now = (Map<String, Object>) data.get("now");
@@ -68,7 +68,7 @@
            //存入数据库
            cityWeatherMapper.insert(cityWeather);
            //存入redis
            redisTemplate.opsForHash().put(RedisConstants.CITY_WEATHER, cityCode, now);
            redisTemplate.opsForHash().put(RedisConstants.CITY_WEATHER, String.valueOf(cityCode), now);
        }
    }