From 6cc2a1d726e1019079b6d3fa74599426a359c001 Mon Sep 17 00:00:00 2001 From: jinpengyong <jpy123456> Date: Tue, 02 Nov 2021 14:55:24 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev_ --- screen-common/src/main/java/com/moral/util/AQIUtils.java | 53 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 46 insertions(+), 7 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..a55c8f5 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������������������map���key���sensorCode���value��������� + * @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<>(); @@ -119,12 +126,44 @@ } Map<String,Object> resultMap = new HashMap<>(); resultMap.put("aqi",AQIMAX); - resultMap.put("pollutant",nameList); + if(AQIMAX>50) + resultMap.put("pollutant",nameList); return resultMap; } + public static void main(String[] args) { + Map<String,Object> map = new HashMap<>(); + map.put("a34004",11.25); + map.put("a34002",18.25); + map.put("a21026",55); + map.put("a21004",200.01); + map.put("a21005",18.94); + map.put("a05024",55); + System.out.println(hourlyAqi_pollutant(map)); + } + + /** + * @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 +186,7 @@ } //PM10 IAQI - public static int PM10AQI(Double value) { + private static int PM10AQI(Double value) { double result; if (value <= 0) { result = 0; @@ -170,7 +209,7 @@ } //SO2 IAQI - public static int SO2AQI(Double value) { + private static int SO2AQI(Double value) { double result; if (value <= 0) { result = 0; @@ -187,7 +226,7 @@ } //NO2 IAQI - public static int NO2AQI(Double value) { + private static int NO2AQI(Double value) { double result; if (value <= 0) { result = 0; @@ -210,7 +249,7 @@ } //CO IAQI - public static int COAQI(Double value) { + private static int COAQI(Double value) { double result; if (value <= 0) { result = 0; @@ -233,7 +272,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