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) {