From 936b7400e9fe74549d8d56030e5f3312656c2e6c Mon Sep 17 00:00:00 2001 From: zhaoxianglong Date: Thu, 18 Jul 2024 17:29:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=A9=E6=B0=94=E9=A2=84?= =?UTF-8?q?=E8=AD=A6=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WeatherForecastController.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 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 407c7249..54d91195 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 @@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Objects; @@ -270,7 +271,8 @@ public class WeatherForecastController extends BaseController { return AjaxResult.success(cacheObject); } } else { - return AjaxResult.error(jsonResult.getInteger("code"), UniversalEnum.REQUEST_FAILED.getValue()); + JSONArray cacheObject = redisCache.getCacheObject(UniversalEnum.CURRENT_WEATHER_AND_FORECAST_INFORMATION_SINGLE_WORD.getValue() + numStake); + return AjaxResult.success(cacheObject); } } } catch (Exception ignored) { @@ -278,7 +280,8 @@ public class WeatherForecastController extends BaseController { logger.error(String.valueOf(ignored)); } - return AjaxResult.error(UniversalEnum.REQUEST_FAILED.getValue()); + JSONArray cacheObject = redisCache.getCacheObject(UniversalEnum.CURRENT_WEATHER_AND_FORECAST_INFORMATION_SINGLE_WORD.getValue() + numStake); + return AjaxResult.success(cacheObject); } public JSONArray processingWeatherData(JSONArray data) { @@ -433,7 +436,7 @@ public class WeatherForecastController extends BaseController { JSONArray forecastList = jsonObject.getJSONArray("forecastList"); if (forecastList != null && forecastList.size() != UniversalEnum.ZERO.getNumber()) { - jsonObject.put("forecastList",processingWeatherData(forecastList)); + jsonObject.put("forecastList", processingWeatherData(forecastList)); } jsonArray.add(i, jsonObject); @@ -539,14 +542,14 @@ public class WeatherForecastController extends BaseController { // return AjaxResult.success(redisCache.getCacheList("currentWeatherWarningInformationQuery")); //} } else { - return AjaxResult.error(jsonResult.getInteger("code"), UniversalEnum.REQUEST_FAILED.getValue()); + return AjaxResult.success(new ArrayList<>()); } } } catch (Exception ignored) { } - return AjaxResult.error(UniversalEnum.REQUEST_FAILED.getValue()); + return AjaxResult.success(new ArrayList<>()); }