From 113a18ea7368ebc5fbadc211ad3ee1feb743929d Mon Sep 17 00:00:00 2001 From: kaiyu <404897439@qq.com> Date: Fri, 29 Oct 2021 15:55:04 +0800 Subject: [PATCH] screen-api 根据AQI计算污染等级 --- screen-common/src/main/java/com/moral/util/AQIUtils.java | 39 +++++++++++++++++++++++++++++++++------ 1 files changed, 33 insertions(+), 6 deletions(-) diff --git a/screen-common/src/main/java/com/moral/util/AQIUtils.java b/screen-common/src/main/java/com/moral/util/AQIUtils.java index b7adb3a..592eadc 100644 --- a/screen-common/src/main/java/com/moral/util/AQIUtils.java +++ b/screen-common/src/main/java/com/moral/util/AQIUtils.java @@ -58,6 +58,13 @@ return AQIMAX; } + /** + * @Description: ������AQI��������������� + * @Param: [map] + * @return: java.util.Map<java.lang.String,java.lang.Object> + * @Author: ��������� + * @Date: 2021/10/29 + */ public static Map<String,Object> hourlyAqi_pollutant(Map<String, Object> map) { List<Integer> AQIList = new ArrayList<>(); Map<String,Integer> AQIMap = new HashMap<>(); @@ -123,8 +130,28 @@ return resultMap; } + /** + * @Description: ������AQI������������ + * @Param: + * @return: + * @Author: ��������� + * @Date: 2021/10/29 + */ + public static String classOfPollutionByAqi(Integer aqi){ + if(aqi>300) + return Constants.SERVER; + if(aqi>200) + return Constants.SERIOUS; + if(aqi>150) + return Constants.MIDDLE; + if(aqi>100) + return Constants.MILD; + if(aqi>50) + return Constants.GOOD; + return Constants.EXCELLENT; + } //PM2.5 IAQI - public static int PM2_5AQI(Double value) { + private static int PM2_5AQI(Double value) { double result; if (value <= 0) { result = 0; @@ -147,7 +174,7 @@ } //PM10 IAQI - public static int PM10AQI(Double value) { + private static int PM10AQI(Double value) { double result; if (value <= 0) { result = 0; @@ -170,7 +197,7 @@ } //SO2 IAQI - public static int SO2AQI(Double value) { + private static int SO2AQI(Double value) { double result; if (value <= 0) { result = 0; @@ -187,7 +214,7 @@ } //NO2 IAQI - public static int NO2AQI(Double value) { + private static int NO2AQI(Double value) { double result; if (value <= 0) { result = 0; @@ -210,7 +237,7 @@ } //CO IAQI - public static int COAQI(Double value) { + private static int COAQI(Double value) { double result; if (value <= 0) { result = 0; @@ -233,7 +260,7 @@ } //O3 IAQI - public static int O3AQI(Double value) { + private static int O3AQI(Double value) { double result; if (value <= 0) { result = 0; -- Gitblit v1.8.0