From af8195534789485a6827b0f0868720b5bac9c159 Mon Sep 17 00:00:00 2001 From: mengff <1198151809@qq.com> Date: Mon, 4 Nov 2024 10:41:57 +0800 Subject: [PATCH] =?UTF-8?q?--=E6=B0=94=E8=B1=A1=E9=A2=84=E8=AD=A6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=A7=84=E8=8C=83=E6=96=87=E4=BB=B6=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zc/business/utils/WeatherTrafficProposeUtil.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/utils/WeatherTrafficProposeUtil.java b/zc-business/src/main/java/com/zc/business/utils/WeatherTrafficProposeUtil.java index 8ced4bcb..bb9f46b1 100644 --- a/zc-business/src/main/java/com/zc/business/utils/WeatherTrafficProposeUtil.java +++ b/zc-business/src/main/java/com/zc/business/utils/WeatherTrafficProposeUtil.java @@ -33,7 +33,8 @@ public class WeatherTrafficProposeUtil { return condition; } } - throw new IllegalArgumentException("No matching WeatherCondition found for level: " + level + " and description: " + description); + return null; +// throw new IllegalArgumentException("No matching WeatherCondition found for level: " + level + " and description: " + description); } } @@ -111,8 +112,12 @@ public class WeatherTrafficProposeUtil { public static String content(int warningLevelStringNumber, String earlyWarningTypeStringNumber){ WeatherCondition condition = WeatherCondition.fromLevelAndDescription(warningLevelStringNumber, earlyWarningTypeStringNumber); - System.out.println("Weather Condition: " + condition.name() + ", Level: " + condition.getLevel() + ", Description: " + condition.getDescription()); - return "建议速度为"+getSpeedLimit(condition) + " km/h ;\n" + getTrafficControlAdvice(condition) + "\n" + getVehicleControlAdvice(condition); + if(condition !=null) { + System.out.println("Weather Condition: " + condition.name() + ", Level: " + condition.getLevel() + ", Description: " + condition.getDescription()); + return "建议速度为" + getSpeedLimit(condition) + " km/h ;\n" + getTrafficControlAdvice(condition) + "\n" + getVehicleControlAdvice(condition); + }else{ + return ""; + } } public static void main(String[] args) {