From a0224894fcc89500a701f39ccaf4322a03231ff6 Mon Sep 17 00:00:00 2001 From: kaiyu <404897439@qq.com> Date: Fri, 25 Feb 2022 16:48:28 +0800 Subject: [PATCH] screen-api 增加达标天数分析接口 --- screen-common/src/main/java/com/moral/util/AQIUtils.java | 63 ++++++++++++++++++++++++++++++- 1 files changed, 61 insertions(+), 2 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 62abf74..982af88 100644 --- a/screen-common/src/main/java/com/moral/util/AQIUtils.java +++ b/screen-common/src/main/java/com/moral/util/AQIUtils.java @@ -24,8 +24,45 @@ /*���������������������*/ private static Double[] IAQI_Array = new Double[]{0d,50d,100d,150d,200d,300d,400d,500d}; + //������aqi������������ + public static boolean aqiIsStandard(int aqi){ + if(aqi<=100) + return true; + return false; + } + public static boolean PM2_5IsStandard(Double pm2_5){ + if(pm2_5<=75) + return true; + return false; + } + public static boolean PM10IsStandard(Double pm10){ + if(pm10<=150) + return true; + return false; + } + public static boolean SO2IsStandard(Double so2){ + if(so2<=500) + return true; + return false; + } + public static boolean NO2IsStandard(Double no2){ + if(no2<=80) + return true; + return false; + } + public static boolean COIsStandard(Double co){ + if(co<=4) + return true; + return false; + } + public static boolean O3IsStandard(Double o3){ + if(o3<=200) + return true; + return false; + } + /** - * @Description: ������AQI������������ + * @Description: ������AQI��������������������������������������� * @Param: * @return: * @Author: ��������� @@ -43,6 +80,27 @@ if(aqi>50) return Constants.GOOD_WEATHER; return Constants.EXCELLENT_WEATHER; + } + + /** + * @Description: ������AQI���������������������������������������Code + * @Param: [aqi] + * @return: java.lang.String + * @Author: ��������� + * @Date: 2021/11/11 + */ + public static String classCodeOfPollutionByAqi(Integer aqi){ + if(aqi>300) + return Constants.SERVER_WEATHER_CODE; + if(aqi>200) + return Constants.SERIOUS_WEATHER_CODE; + if(aqi>150) + return Constants.MIDDLE_WEATHER_CODE; + if(aqi>100) + return Constants.MILD_WEATHER_CODE; + if(aqi>50) + return Constants.GOOD_WEATHER_CODE; + return Constants.EXCELLENT_WEATHER_CODE; } /** @@ -338,4 +396,5 @@ return 0; } -} \ No newline at end of file +} + -- Gitblit v1.8.0