From 0a15ced309df3fb76f1af4ee656d79a46e66bc92 Mon Sep 17 00:00:00 2001
From: cjl <276999030@qq.com>
Date: Wed, 02 Aug 2023 13:39:24 +0800
Subject: [PATCH] feat:空气质量报告

---
 screen-api/src/main/java/com/moral/api/controller/SysTestController.java |  177 +++++++++++++++++++++++++++++------------------------------
 1 files changed, 87 insertions(+), 90 deletions(-)

diff --git a/screen-api/src/main/java/com/moral/api/controller/SysTestController.java b/screen-api/src/main/java/com/moral/api/controller/SysTestController.java
index 80d4663..36f131a 100644
--- a/screen-api/src/main/java/com/moral/api/controller/SysTestController.java
+++ b/screen-api/src/main/java/com/moral/api/controller/SysTestController.java
@@ -184,100 +184,97 @@
         int sizeLowResult = 0;
         String highName = "���������";
         String lowName = "���������";
-        StringBuffer highCode = new StringBuffer();
-        StringBuffer lowCode = new StringBuffer();
+        //1 ������ 2������
+        if(type == 1){
+            SysTest ResultAqi = listAll.stream().min(Comparator.comparing(SysTest::getAqi)).get();
+            if(ResultAqi.getName().contains("���������")){
+                lowName = "���������";
+                highName = "���������������������";
+            }else if(ResultAqi.getName().contains("���������")){
+                lowName = "���������";
+                highName = "���������������������";
+            } else if(ResultAqi.getName().contains("���������")){
+                lowName = "���������";
+                highName = "���������������������";
+            }
 
-            //1 ������ 2������
-            if(type == 1){
-                SysTest ResultAqi = listAll.stream().min(Comparator.comparing(SysTest::getAqi)).get();
-                if(ResultAqi.getName().contains("���������")){
-                    lowName = "���������";
-                    highName = "���������������������";
-                }else if(ResultAqi.getName().contains("���������")){
-                    lowName = "���������";
-                    highName = "���������������������";
-                } else if(ResultAqi.getName().contains("���������")){
-                    lowName = "���������";
-                    highName = "���������������������";
-                }
+        }else if(type == 2){
+            SysTest ResultAqi = listAll.stream().max(Comparator.comparing(SysTest::getAqi)).get();
+            if(ResultAqi.getName().contains("���������")){
+                highName = "���������";
+                lowName = "���������������������";
+            }else if(ResultAqi.getName().contains("���������")){
+                highName = "���������";
+                lowName = "���������������������";
+            } else if(ResultAqi.getName().contains("���������")){
+                highName = "���������";
+                lowName = "���������������������";
+            }
+        }else if(type == 3){
+            if(aqiHigh == aqiHighResult){
+                sizeHighResult = 0;
+            }
+            if(aqiMiddle == aqiHighResult){
+                sizeHighResult = 1;
+            }
+            if(aqiLow == aqiHighResult){
+                sizeHighResult = 2;
+            }
+            if(aqiHigh == aqiLowResult){
+                sizeLowResult = 0;
+            }
+            if(aqiMiddle == aqiLowResult){
+                sizeLowResult = 1;
+            }
+            if(aqiLow == aqiLowResult){
+                sizeLowResult = 2;
+            }
+            SysTest HighResult = listAll.get(sizeHighResult);
+            SysTest LowResult = listAll.get(sizeLowResult);
 
-            }else if(type == 2){
-                SysTest ResultAqi = listAll.stream().max(Comparator.comparing(SysTest::getAqi)).get();
-                if(ResultAqi.getName().contains("���������")){
-                    highName = "���������";
-                    lowName = "���������������������";
-                }else if(ResultAqi.getName().contains("���������")){
-                    highName = "���������";
-                    lowName = "���������������������";
-                } else if(ResultAqi.getName().contains("���������")){
-                    highName = "���������";
-                    lowName = "���������������������";
-                }
-            }else if(type == 3){
-                if(aqiHigh == aqiHighResult){
-                    sizeHighResult = 0;
-                }
-                if(aqiMiddle == aqiHighResult){
-                    sizeHighResult = 1;
-                }
-                if(aqiLow == aqiHighResult){
-                    sizeHighResult = 2;
-                }
-                if(aqiHigh == aqiLowResult){
-                    sizeLowResult = 0;
-                }
-                if(aqiMiddle == aqiLowResult){
-                    sizeLowResult = 1;
-                }
-                if(aqiLow == aqiLowResult){
-                    sizeLowResult = 2;
-                }
-                SysTest HighResult = listAll.get(sizeHighResult);
-                SysTest LowResult = listAll.get(sizeLowResult);
-
-                if(HighResult.getName().contains("���������")){
-                    highName = "���������";
-                }else if(HighResult.getName().contains("���������")){
-                    highName = "���������";
-                }
-                if(LowResult.getName().contains("���������")){
-                    lowName = "���������";
-                }else if(LowResult.getName().contains("���������")){
-                    lowName = "���������";
-                }
+            if(HighResult.getName().contains("���������")){
+                highName = "���������";
+            }else if(HighResult.getName().contains("���������")){
+                highName = "���������";
             }
-            SysTest result0 = listAll.get(0);
-            SysTest result1 = listAll.get(1);
-            SysTest result2 = listAll.get(2);
-            Map<String,String> pm10 = nameCode(result0.getName(),result1.getName(),result2.getName(),result0.getPm10(),result1.getPm10(),result2.getPm10());
-            Map<String,String> pm25 = nameCode(result0.getName(),result1.getName(),result2.getName(),result0.getPm25(),result1.getPm25(),result2.getPm25());
-            Map<String,String> so = nameCode(result0.getName(),result1.getName(),result2.getName(),result0.getSo2(),result1.getSo2(),result2.getSo2());
-            Map<String,String> no = nameCode(result0.getName(),result1.getName(),result2.getName(),result0.getNo2(),result1.getNo2(),result2.getNo2());
-            Map<String,String> co = nameCode(result0.getName(),result1.getName(),result2.getName(),result0.getCo(),result1.getCo(),result2.getCo());
-            Map<String,String> o3 = nameCode(result0.getName(),result1.getName(),result2.getName(),result0.getO3(),result1.getO3(),result2.getO3());
-            stringBuffer.append(highName+"���������������������AQI������������"+lowName+"���������������������AQI������������");
-            if(pm10.isEmpty()&& pm25.isEmpty()&&so.isEmpty()&& no.isEmpty()&& co.isEmpty()&& o3.isEmpty()){
-                return stringBuffer.toString();
+            if(LowResult.getName().contains("���������")){
+                lowName = "���������";
+            }else if(LowResult.getName().contains("���������")){
+                lowName = "���������";
             }
-            stringBuffer.append("���������");
-            if(!pm10.isEmpty()){
-                stringBuffer.append("PM10���������������"+pm10.get("high")+"������������������"+pm10.get("low")+"���");
-            }
-            if(!pm25.isEmpty()){
-                stringBuffer.append("PM2.5���������������"+pm25.get("high")+"������������������"+pm25.get("low")+"���");
-            }
-            if(!so.isEmpty()){
-                stringBuffer.append("SO2���������������"+so.get("high")+"������������������"+so.get("low")+"���");
-            }
-            if(!no.isEmpty()){
-                stringBuffer.append("NO2���������������"+no.get("high")+"������������������"+no.get("low")+"���");
-            }
-            if(!co.isEmpty()){
-                stringBuffer.append("CO���������������"+co.get("high")+"������������������"+co.get("low")+"���");
-            }
-            if(!o3.isEmpty()){
-                stringBuffer.append("O3���������������"+o3.get("high")+"������������������"+o3.get("low")+"���");
-            }
+        }
+        SysTest result0 = listAll.get(0);
+        SysTest result1 = listAll.get(1);
+        SysTest result2 = listAll.get(2);
+        Map<String,String> pm10 = nameCode(result0.getName(),result1.getName(),result2.getName(),result0.getPm10(),result1.getPm10(),result2.getPm10());
+        Map<String,String> pm25 = nameCode(result0.getName(),result1.getName(),result2.getName(),result0.getPm25(),result1.getPm25(),result2.getPm25());
+        Map<String,String> so = nameCode(result0.getName(),result1.getName(),result2.getName(),result0.getSo2(),result1.getSo2(),result2.getSo2());
+        Map<String,String> no = nameCode(result0.getName(),result1.getName(),result2.getName(),result0.getNo2(),result1.getNo2(),result2.getNo2());
+        Map<String,String> co = nameCode(result0.getName(),result1.getName(),result2.getName(),result0.getCo(),result1.getCo(),result2.getCo());
+        Map<String,String> o3 = nameCode(result0.getName(),result1.getName(),result2.getName(),result0.getO3(),result1.getO3(),result2.getO3());
+        stringBuffer.append(highName+"���������������������AQI������������"+lowName+"���������������������AQI������������");
+        if(pm10.isEmpty()&& pm25.isEmpty()&&so.isEmpty()&& no.isEmpty()&& co.isEmpty()&& o3.isEmpty()){
+            return stringBuffer.toString();
+        }
+        stringBuffer.append("���������");
+        if(!pm10.isEmpty()){
+            stringBuffer.append("PM10���������������"+pm10.get("high")+"������������������"+pm10.get("low")+"���");
+        }
+        if(!pm25.isEmpty()){
+            stringBuffer.append("PM2.5���������������"+pm25.get("high")+"������������������"+pm25.get("low")+"���");
+        }
+        if(!so.isEmpty()){
+            stringBuffer.append("SO2���������������"+so.get("high")+"������������������"+so.get("low")+"���");
+        }
+        if(!no.isEmpty()){
+            stringBuffer.append("NO2���������������"+no.get("high")+"������������������"+no.get("low")+"���");
+        }
+        if(!co.isEmpty()){
+            stringBuffer.append("CO���������������"+co.get("high")+"������������������"+co.get("low")+"���");
+        }
+        if(!o3.isEmpty()){
+            stringBuffer.append("O3���������������"+o3.get("high")+"������������������"+o3.get("low")+"���");
+        }
         return stringBuffer.toString();
 
     }

--
Gitblit v1.8.0