From 69925e8cec469b1483a24e165339b9611f026c87 Mon Sep 17 00:00:00 2001 From: zhaoxianglong Date: Wed, 17 Jul 2024 17:10:42 +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=20=E5=A4=A9=E6=B0=94=E6=83=85=E5=86=B5=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WeatherForecastController.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 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 3c296314..53794d82 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 @@ -267,15 +267,22 @@ public class WeatherForecastController extends BaseController { String visLevel = jsonObject.getString("visLevel"); - if (Objects.equals(visLevel, UniversalEnum.ONE.getValue())) { - jsonObject.put("weatherCondition", UniversalEnum.CLEAR_WEATHER.getValue()); - jsonObject.put("weatherConditionCode", UniversalEnum.CLEAR_WEATHER.getNumber()); - } else if (Objects.equals(visLevel, UniversalEnum.TWO.getValue()) || Objects.equals(visLevel, UniversalEnum.THREE.getValue())) { - jsonObject.put("weatherCondition", UniversalEnum.CLOUDY.getValue()); - jsonObject.put("weatherConditionCode", UniversalEnum.CLOUDY.getNumber()); - } else if (Objects.equals(visLevel, UniversalEnum.FOUR.getValue()) || Objects.equals(visLevel, UniversalEnum.FIVE.getValue()) || Objects.equals(visLevel, UniversalEnum.SIX.getValue())) { + Double rhu = jsonObject.getDouble("rhu"); + + if (rhu > UniversalEnum.SIXTY.getNumber()) { jsonObject.put("weatherCondition", UniversalEnum.OVERCAST_SKY.getValue()); jsonObject.put("weatherConditionCode", UniversalEnum.OVERCAST_SKY.getNumber()); + } else { + if (Objects.equals(visLevel, UniversalEnum.ONE.getValue())) { + jsonObject.put("weatherCondition", UniversalEnum.CLEAR_WEATHER.getValue()); + jsonObject.put("weatherConditionCode", UniversalEnum.CLEAR_WEATHER.getNumber()); + } else if (Objects.equals(visLevel, UniversalEnum.TWO.getValue()) || Objects.equals(visLevel, UniversalEnum.THREE.getValue())) { + jsonObject.put("weatherCondition", UniversalEnum.CLOUDY.getValue()); + jsonObject.put("weatherConditionCode", UniversalEnum.CLOUDY.getNumber()); + } else if (Objects.equals(visLevel, UniversalEnum.FOUR.getValue()) || Objects.equals(visLevel, UniversalEnum.FIVE.getValue()) || Objects.equals(visLevel, UniversalEnum.SIX.getValue())) { + jsonObject.put("weatherCondition", UniversalEnum.OVERCAST_SKY.getValue()); + jsonObject.put("weatherConditionCode", UniversalEnum.OVERCAST_SKY.getNumber()); + } } } else {