From 5871fe403caa418b71fe67db7133c202f369afee Mon Sep 17 00:00:00 2001 From: jinpengyong <jpy123456> Date: Wed, 22 Dec 2021 13:34:03 +0800 Subject: [PATCH] 获取第三方接口数据城市配置 --- screen-job/src/main/java/com/moral/api/service/impl/CityWeatherServiceImpl.java | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/screen-job/src/main/java/com/moral/api/service/impl/CityWeatherServiceImpl.java b/screen-job/src/main/java/com/moral/api/service/impl/CityWeatherServiceImpl.java index a9e9121..ef84f87 100644 --- a/screen-job/src/main/java/com/moral/api/service/impl/CityWeatherServiceImpl.java +++ b/screen-job/src/main/java/com/moral/api/service/impl/CityWeatherServiceImpl.java @@ -2,10 +2,10 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.moral.api.entity.CityConfig; +import com.moral.api.entity.CityConfigWeather; import com.moral.api.entity.CityWeather; import com.moral.api.mapper.CityWeatherMapper; -import com.moral.api.service.CityConfigService; +import com.moral.api.service.CityConfigWeatherService; import com.moral.api.service.CityWeatherService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.moral.constant.Constants; @@ -36,7 +36,7 @@ private CityWeatherMapper cityWeatherMapper; @Autowired - private CityConfigService cityConfigService; + private CityConfigWeatherService cityConfigWeatherService; @Autowired private RestTemplate restTemplate; @@ -47,12 +47,12 @@ @Override public void insertCityWeather() { //������������������ - QueryWrapper<CityConfig> wrapper = new QueryWrapper<>(); + QueryWrapper<CityConfigWeather> wrapper = new QueryWrapper<>(); wrapper.select("city_code", "location_id").eq("is_delete", Constants.NOT_DELETE); - List<CityConfig> list = cityConfigService.list(wrapper); - for (CityConfig cityConfig : list) { - Integer cityCode = cityConfig.getCityCode(); - Integer locationId = cityConfig.getLocationId(); + List<CityConfigWeather> list = cityConfigWeatherService.list(wrapper); + for (CityConfigWeather cityConfigWeather : list) { + 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); Map<String, Object> now = (Map<String, Object>) data.get("now"); CityWeather cityWeather = new CityWeather(); -- Gitblit v1.8.0