From 5065313971b6aff1776841f6c9c55a5e0dd77615 Mon Sep 17 00:00:00 2001 From: zhaoxianglong Date: Thu, 25 Apr 2024 18:48:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=A9=E6=B0=94=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zc/business/controller/WeatherForecastController.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java b/zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java index c73819e3..fc8ffaae 100644 --- a/zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java +++ b/zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java @@ -104,7 +104,8 @@ public class WeatherForecastController extends BaseController { JSONObject jsonResult = JSONObject.parseObject(response.body().string()); if (jsonResult.getInteger("code") == 200) { - jsonObject.put(weather.getString("METEOROLOGICALEARLYWARNING") + dcRegion.getId(), extracted(jsonResult, "warning")); + jsonObject.put("name",dcRegion.getRegionName()); + jsonObject.put(weather.getString("METEOROLOGICALEARLYWARNING") + dcRegion.getId(), extracted(jsonResult,"warning")); } else { return AjaxResult.error(jsonResult.getInteger("code"), "请求失败"); @@ -177,6 +178,7 @@ public class WeatherForecastController extends BaseController { JSONObject jsonResult = JSONObject.parseObject(response.body().string()); if (jsonResult.getInteger("code") == 200) { + jsonObject.put("name",dcRegion.getRegionName()); if (Objects.equals(redisKey, weather.getString("WEATHERFACTS"))) { jsonObject.put(redisKey + dcRegion.getId(), extracted(jsonResult, "now")); @@ -187,7 +189,7 @@ public class WeatherForecastController extends BaseController { } else if (Objects.equals(redisKey, weather.getString("HOURLYWEATHER"))) { - jsonObject.put(redisKey + dcRegion.getId(), extracted(jsonResult, "hourly")); + jsonObject.put(redisKey + dcRegion.getId(), extracted(jsonResult,"hourly")); } } else { return AjaxResult.error(jsonResult.getInteger("code"), "请求失败"); @@ -201,7 +203,7 @@ public class WeatherForecastController extends BaseController { } - if (Objects.equals(redisKey, weather.getString("WEATHERFACTS"))) { + if (Objects.equals(redisKey, weather.getString("WEATHERFACTS"))) { redisCache.setCacheObject(redisKey, jsonObject, 13, TimeUnit.MINUTES);