From b68490b0aa57d405d81bff6e99379031022cac3e Mon Sep 17 00:00:00 2001
From: kaiyu <404897439@qq.com>
Date: Fri, 29 Oct 2021 16:13:18 +0800
Subject: [PATCH] screen-api 增加获取城市天气接口
---
screen-common/src/main/java/com/moral/util/AQIUtils.java | 43 ++++++++++++++++++++++++++++++++++++-------
1 files changed, 36 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 b4b9cff..592eadc 100644
--- a/screen-common/src/main/java/com/moral/util/AQIUtils.java
+++ b/screen-common/src/main/java/com/moral/util/AQIUtils.java
@@ -51,11 +51,20 @@
}
int AQIMAX = 0;
if (!ObjectUtils.isEmpty(AQIList)) {
- AQIMAX = Collections.max(AQIList);
+ if (AQIList.size() == 6) {
+ AQIMAX = Collections.max(AQIList);
+ }
}
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<>();
@@ -121,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;
@@ -145,7 +174,7 @@
}
//PM10 IAQI
- public static int PM10AQI(Double value) {
+ private static int PM10AQI(Double value) {
double result;
if (value <= 0) {
result = 0;
@@ -168,7 +197,7 @@
}
//SO2 IAQI
- public static int SO2AQI(Double value) {
+ private static int SO2AQI(Double value) {
double result;
if (value <= 0) {
result = 0;
@@ -185,7 +214,7 @@
}
//NO2 IAQI
- public static int NO2AQI(Double value) {
+ private static int NO2AQI(Double value) {
double result;
if (value <= 0) {
result = 0;
@@ -208,7 +237,7 @@
}
//CO IAQI
- public static int COAQI(Double value) {
+ private static int COAQI(Double value) {
double result;
if (value <= 0) {
result = 0;
@@ -231,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