From 52c60fcaea97cece4b39987a3b8b248964dbe280 Mon Sep 17 00:00:00 2001
From: kaiyu <404897439@qq.com>
Date: Tue, 02 Nov 2021 11:28:23 +0800
Subject: [PATCH] screen-api 修改计算首要污染物BUG
---
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