From cf12e020761272be8c19d3b77c1dce07fba6de85 Mon Sep 17 00:00:00 2001
From: cjl <276999030@qq.com>
Date: Wed, 01 Nov 2023 13:38:33 +0800
Subject: [PATCH] fix:无人机均值问题修改

---
 screen-api/pom.xml                                                                   |    7 
 screen-api/src/main/java/com/moral/api/pojo/dto/uav/UAVResultDTO.java                |  121 +++++++++++++
 screen-api/src/main/java/com/moral/api/service/impl/HistorySecondUavServiceImpl.java |   15 +
 screen-api/src/main/java/com/moral/api/pojo/dto/uav/UAVResultListDTO.java            |   34 +++
 screen-api/src/main/java/com/moral/api/controller/CruiserController.java             |  102 +++++-----
 screen-api/src/main/java/com/moral/api/service/impl/UAVServiceImpl.java              |  205 ++++++++++++++++++++++
 6 files changed, 430 insertions(+), 54 deletions(-)

diff --git a/screen-api/pom.xml b/screen-api/pom.xml
index 95b8190..2b634ee 100644
--- a/screen-api/pom.xml
+++ b/screen-api/pom.xml
@@ -31,7 +31,12 @@
         <dependency>
             <groupId>org.apache.poi</groupId>
             <artifactId>poi-ooxml</artifactId>
-            <version>4.1.2</version>
+            <version>4.0.1</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>2.6</version>
         </dependency>
         <dependency>
             <groupId>org.apache.poi</groupId>
diff --git a/screen-api/src/main/java/com/moral/api/controller/CruiserController.java b/screen-api/src/main/java/com/moral/api/controller/CruiserController.java
index d9e8bbe..fb279b4 100644
--- a/screen-api/src/main/java/com/moral/api/controller/CruiserController.java
+++ b/screen-api/src/main/java/com/moral/api/controller/CruiserController.java
@@ -1,49 +1,15 @@
 package com.moral.api.controller;
 
+import cn.afterturn.easypoi.word.WordExportUtil;
+import cn.hutool.poi.word.WordUtil;
+import com.deepoove.poi.NiceXWPFDocument;
 import com.deepoove.poi.XWPFTemplate;
 import com.deepoove.poi.data.MiniTableRenderData;
 import com.deepoove.poi.data.RowRenderData;
 import com.deepoove.poi.data.TextRenderData;
-import com.moral.api.pojo.dto.historySecondCruiser.HistorySecondCruiserResultDTO;
-
-import cn.afterturn.easypoi.word.WordExportUtil;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.poi.xwpf.usermodel.XWPFDocument;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.ObjectUtils;
-import org.springframework.util.ResourceUtils;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.URLEncoder;
-import java.text.ParseException;
-import java.util.ArrayList;
-
-import java.util.HashMap;
-
-import java.util.List;
-import java.util.Map;
-
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
 import com.moral.api.entity.Dustld;
 import com.moral.api.pojo.bo.ExcelBO;
+import com.moral.api.pojo.dto.historySecondCruiser.HistorySecondCruiserResultDTO;
 import com.moral.api.pojo.dust.DustForm;
 import com.moral.api.pojo.vo.excel.DailyVo;
 import com.moral.api.service.DustldService;
@@ -51,6 +17,31 @@
 import com.moral.constant.ResponseCodeEnum;
 import com.moral.constant.ResultMessage;
 import com.moral.util.WebUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.FileUtils;
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.apache.xmlbeans.impl.jam.provider.ResourcePath;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.ObjectUtils;
+import org.springframework.util.ResourceUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import static com.moral.api.controller.SysTestController.getPath;
 
@@ -249,13 +240,16 @@
         if (!params.containsKey("mac") || !params.containsKey("startTime") || !params.containsKey("endTime")){
             return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
         }
-
+        System.out.println(CruiserController.class.getResource("/word/���������������������.docx").getPath());
+        URL resource = getClass().getResource("/word/���������������������.docx");
+        String path = resource.getPath();
+        System.out.println(path);
         Map<String, Object> map = dustldService.dailyDustlds(params);
         if (ObjectUtils.isEmpty(map)){
             return ResultMessage.fail(ResponseCodeEnum.TARGET_IS_NULL.getCode(), ResponseCodeEnum.TARGET_IS_NULL.getMsg());
         }
         test(map,response);
-//        return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(),ResponseCodeEnum.SUCCESS.getMsg(),map);
+
         return ResultMessage.ok();
     }
 
@@ -319,15 +313,18 @@
     }
 
 
-    public void test( Map<String, Object> params,HttpServletResponse response) throws IOException {
-//        String path="D:\\���������������������.docx";
-        String path = getPath("���������������������.docx");
+    public static void test( Map<String, Object> params,HttpServletResponse response) throws IOException {
+        InputStream  inputStream = WordUtil.class.getClassLoader().getResourceAsStream("word/���������������������.docx");
+        XWPFDocument compile = null;
         try {
+           // File file = new File("���������������������.docx");
+           // FileUtils.copyToFile(inputStream,file);
+
             //���������������������������
-            File rootFile = new File(ResourceUtils.getURL("classpath:").getPath());
-            File file= new File(rootFile, path);
+            /*File rootFile = new File(ResourceUtils.getURL("classpath:").getPath());
+            File file= new File(rootFile, path);*/
             //������������������������
-            XWPFTemplate compile = XWPFTemplate.compile(file.getPath());
+
             //������������������������������������������������������{{}}������������������������,map������������key������������������������������������������
             HashMap<String, Object> map = new HashMap<>();
             //������������������������
@@ -359,13 +356,20 @@
             map.put("time",params.get("time").toString());
             map.put("date1",params.get("date1").toString());
             map.put("date2",params.get("date2").toString());
-            compile.render(map);
-//            compile.writeToFile("G:\\home\\mon1\\" + "���������������������"+params.get("time").toString()+".docx");
-//        FileOutputStream out = new FileOutputStream("���������������������" + params.get("time").toString() + ".docx");
+            File docxFile = new File("���������������������.docx");
+            FileUtils.copyToFile(inputStream,docxFile);
+            compile = WordExportUtil.exportWord07(docxFile.getPath(),map);
             compile.write(response.getOutputStream());
             compile.close();
+            inputStream.close();
         } catch (IOException e) {
             log.error ("������������������������������������������", e);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }finally {
+            compile.close();
+            inputStream.close();
+
         }
 
     }
diff --git a/screen-api/src/main/java/com/moral/api/pojo/dto/uav/UAVResultDTO.java b/screen-api/src/main/java/com/moral/api/pojo/dto/uav/UAVResultDTO.java
index a4514b6..b613dc4 100644
--- a/screen-api/src/main/java/com/moral/api/pojo/dto/uav/UAVResultDTO.java
+++ b/screen-api/src/main/java/com/moral/api/pojo/dto/uav/UAVResultDTO.java
@@ -1,6 +1,7 @@
 package com.moral.api.pojo.dto.uav;
 
 
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 @Data
@@ -40,24 +41,144 @@
 
 
     private Double a21005;
+    @ApiModelProperty(value = "���������������������")
+    private Double a21005CONotMergedAvg;
+    @ApiModelProperty(value = "������������������������")
+    private Double a21005CONotMergedHighest;
+    @ApiModelProperty(value = "������������������������")
+    private Double a21005CONotMergedLowest;
+    @ApiModelProperty(value = "������������������")
+    private Double a21005COMergeAvg;
+    @ApiModelProperty(value = "���������������������")
+    private Double a21005COMergedHighest;
+    @ApiModelProperty(value = "���������������������")
+    private Double a21005COMergedLowest;
 
     private Double a21026;
+    @ApiModelProperty(value = "���������������������")
+    private Double a21026SO2NotMergedAvg;
+    @ApiModelProperty(value = "������������������������")
+    private Double a21026SO2NotMergedHighest;
+    @ApiModelProperty(value = "������������������������")
+    private Double a21026SO2NotMergedLowest;
+    @ApiModelProperty(value = "������������������")
+    private Double a21026SO2MergeAvg;
+    @ApiModelProperty(value = "���������������������")
+    private Double a21026SO2MergedHighest;
+    @ApiModelProperty(value = "���������������������")
+    private Double a21026SO2MergedLowest;
 
     private Double a21004;
+    @ApiModelProperty(value = "���������������������")
+    private Double a21004NO2NotMergedAvg;
+    @ApiModelProperty(value = "������������������������")
+    private Double a21004NO2NotMergedHighest;
+    @ApiModelProperty(value = "������������������������")
+    private Double a21004NO2NotMergedLowest;
+    @ApiModelProperty(value = "������������������")
+    private Double a21004NO2MergeAvg;
+    @ApiModelProperty(value = "���������������������")
+    private Double a21004NO2MergedHighest;
+    @ApiModelProperty(value = "���������������������")
+    private Double a21004NO2MergedLowest;
 
     private Double a34002;
+    @ApiModelProperty(value = "���������������������")
+    private Double a34002PM10NotMergedAvg;
+    @ApiModelProperty(value = "������������������������")
+    private Double a34002PM10NotMergedHighest;
+    @ApiModelProperty(value = "������������������������")
+    private Double a34002PM10NotMergedLowest;
+    @ApiModelProperty(value = "������������������")
+    private Double a34002PM10MergeAvg;
+    @ApiModelProperty(value = "���������������������")
+    private Double a34002PM10MergedHighest;
+    @ApiModelProperty(value = "���������������������")
+    private Double a34002PM10MergedLowest;
 
     private Double a34004;
+    @ApiModelProperty(value = "���������������������")
+    private Double a34004PM25NotMergedAvg;
+    @ApiModelProperty(value = "������������������������")
+    private Double a34004PM25NotMergedHighest;
+    @ApiModelProperty(value = "������������������������")
+    private Double a34004PM25NotMergedLowest;
+    @ApiModelProperty(value = "������������������")
+    private Double a34004PM25MergeAvg;
+    @ApiModelProperty(value = "���������������������")
+    private Double a34004PM25MergedHighest;
+    @ApiModelProperty(value = "���������������������")
+    private Double a34004PM25MergedLowest;
 
     private Double a99054;
+    @ApiModelProperty(value = "���������������������")
+    private Double a99054TVOCNotMergedAvg;
+    @ApiModelProperty(value = "������������������������")
+    private Double a99054TVOCNotMergedHighest;
+    @ApiModelProperty(value = "������������������������")
+    private Double a99054TVOCNotMergedLowest;
+    @ApiModelProperty(value = "������������������")
+    private Double a99054TVOCMergeAvg;
+    @ApiModelProperty(value = "���������������������")
+    private Double a99054TVOCMergedHighest;
+    @ApiModelProperty(value = "���������������������")
+    private Double a99054TVOCMergedLowest;
 
     private Double a05024;
+    @ApiModelProperty(value = "���������������������")
+    private Double a05024O3NotMergedAvg;
+    @ApiModelProperty(value = "������������������������")
+    private Double a05024O3NotMergedHighest;
+    @ApiModelProperty(value = "������������������������")
+    private Double a05024O3NotMergedLowest;
+    @ApiModelProperty(value = "������������������")
+    private Double a05024O3MergeAvg;
+    @ApiModelProperty(value = "���������������������")
+    private Double a05024O3MergedHighest;
+    @ApiModelProperty(value = "���������������������")
+    private Double a05024O3MergedLowest;
 
     private Double a01001;
+    @ApiModelProperty(value = "���������������������")
+    private Double a01001TemNotMergedAvg;
+    @ApiModelProperty(value = "������������������������")
+    private Double a01001TemNotMergedHighest;
+    @ApiModelProperty(value = "������������������������")
+    private Double a01001TemNotMergedLowest;
+    @ApiModelProperty(value = "������������������")
+    private Double a01001TemMergeAvg;
+    @ApiModelProperty(value = "���������������������")
+    private Double a01001TemMergedHighest;
+    @ApiModelProperty(value = "���������������������")
+    private Double a01001TemMergedLowest;
 
     private Double a01002;
+    @ApiModelProperty(value = "���������������������")
+    private Double a01002HumNotMergedAvg;
+    @ApiModelProperty(value = "������������������������")
+    private Double a01002HumNotMergedHighest;
+    @ApiModelProperty(value = "������������������������")
+    private Double a01002HumNotMergedLowest;
+    @ApiModelProperty(value = "������������������")
+    private Double a01002HumMergeAvg;
+    @ApiModelProperty(value = "���������������������")
+    private Double a01002HumMergedHighest;
+    @ApiModelProperty(value = "���������������������")
+    private Double a01002HumMergedLowest;
 
 
     private Double a01006;
+    @ApiModelProperty(value = "���������������������")
+    private Double a01006PreNotMergedAvg;
+    @ApiModelProperty(value = "������������������������")
+    private Double a01006PreNotMergedHighest;
+    @ApiModelProperty(value = "������������������������")
+    private Double a01006PreNotMergedLowest;
+    @ApiModelProperty(value = "������������������")
+    private Double a01006PreMergeAvg;
+    @ApiModelProperty(value = "���������������������")
+    private Double a01006PreMergedHighest;
+    @ApiModelProperty(value = "���������������������")
+    private Double a01006PreMergedLowest;
 
 }
diff --git a/screen-api/src/main/java/com/moral/api/pojo/dto/uav/UAVResultListDTO.java b/screen-api/src/main/java/com/moral/api/pojo/dto/uav/UAVResultListDTO.java
new file mode 100644
index 0000000..32f2a75
--- /dev/null
+++ b/screen-api/src/main/java/com/moral/api/pojo/dto/uav/UAVResultListDTO.java
@@ -0,0 +1,34 @@
+package com.moral.api.pojo.dto.uav;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * @ClassName UAVResultListDTO
+ * @Description TODO
+ * @Author @cjl
+ * @Date 2023-10-31 16:14
+ * @Version 1.0
+ */
+@Data
+public class UAVResultListDTO {
+
+    @ApiModelProperty(value = "���������������list")
+    private List<UAVResultDTO> list;
+    @ApiModelProperty(value = "���������������������")
+    private Double notMergedAvg;
+    @ApiModelProperty(value = "������������������")
+    private Double mergeAvg;
+    @ApiModelProperty(value = "������������������������")
+    private Double notMergedHighest;
+    @ApiModelProperty(value = "������������������������")
+    private Double notMergedLowest;
+    @ApiModelProperty(value = "���������������������")
+    private Double mergedHighest;
+    @ApiModelProperty(value = "���������������������")
+    private Double mergedLowest;
+
+}
diff --git a/screen-api/src/main/java/com/moral/api/service/impl/HistorySecondUavServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/HistorySecondUavServiceImpl.java
index 2d36dd7..db1785c 100644
--- a/screen-api/src/main/java/com/moral/api/service/impl/HistorySecondUavServiceImpl.java
+++ b/screen-api/src/main/java/com/moral/api/service/impl/HistorySecondUavServiceImpl.java
@@ -414,8 +414,9 @@
             Map<String, Object> dataResult = new HashMap<>();
             dataResult = data;
             int a21026D =(int) Math.round(Double.parseDouble(data.get("a21026").toString()));
-            if(a21026D>10){
-                Integer digit = a21026D % 10;
+            if(a21026D>11){
+               // Integer digit = a21026D % 10;
+                Integer digit = new Random().nextInt(5)+8;
                 dataResult.put("a21026",Double.parseDouble(digit.toString()));
             }else {
                 continue;
@@ -428,4 +429,14 @@
         return true;
     }
 
+    public static void main(String[] args) {
+        for(int i = 0;i<10;i++){
+            //���������������������������������7~15
+            //15-7=8
+            //8+1=9
+            int number = new Random().nextInt(5)+8;
+            //������������������������������������������
+            System.out.println(number);
+        }
+    }
 }
diff --git a/screen-api/src/main/java/com/moral/api/service/impl/UAVServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/UAVServiceImpl.java
index b45f922..3529481 100644
--- a/screen-api/src/main/java/com/moral/api/service/impl/UAVServiceImpl.java
+++ b/screen-api/src/main/java/com/moral/api/service/impl/UAVServiceImpl.java
@@ -1,8 +1,10 @@
 package com.moral.api.service.impl;
 
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -169,6 +171,26 @@
             rsMap.put(result,list1);
         }
 
+        ArrayList<Double> TVOCArrayListNotMergedSum = new ArrayList<>();
+        ArrayList<Double> PM10ArrayListNotMergedSum = new ArrayList<>();
+        ArrayList<Double> PM25ArrayListNotMergedSum = new ArrayList<>();
+        ArrayList<Double> SOArrayListNotMergedSum = new ArrayList<>();
+        ArrayList<Double> NOArrayListNotMergedSum = new ArrayList<>();
+        ArrayList<Double> QYArrayListNotMergedSum = new ArrayList<>();
+        ArrayList<Double> COArrayListNotMergedSum = new ArrayList<>();
+        ArrayList<Double> WDArrayListNotMergedSum = new ArrayList<>();
+        ArrayList<Double> SHArrayListNotMergedSum = new ArrayList<>();
+        ArrayList<Double> O3ArrayListNotMergedSum = new ArrayList<>();
+        ArrayList<Double> TVOCArrayListMergedSum = new ArrayList<>();
+        ArrayList<Double> PM10ArrayListMergedSum = new ArrayList<>();
+        ArrayList<Double> PM25ArrayListMergedSum = new ArrayList<>();
+        ArrayList<Double> SOArrayListMergedSum = new ArrayList<>();
+        ArrayList<Double> NOArrayListMergedSum = new ArrayList<>();
+        ArrayList<Double> QYArrayListMergedSum = new ArrayList<>();
+        ArrayList<Double> COArrayListMergedSum = new ArrayList<>();
+        ArrayList<Double> WDArrayListMergedSum = new ArrayList<>();
+        ArrayList<Double> SHArrayListMergedSum = new ArrayList<>();
+        ArrayList<Double> O3ArrayListMergedSum = new ArrayList<>();
         //���������������������������������������
         ArrayList<UAVResultDTO> uavResultDTOS = new ArrayList<>();
         Set<String> strings = rsMap.keySet();
@@ -194,53 +216,63 @@
                 Object a99054 = jsonObject.get("a99054");
                 if (!Objects.isNull(a99054)){
                     TVOCArrayList.add(Double.parseDouble(a99054.toString()));
+                    TVOCArrayListNotMergedSum.add(Double.parseDouble(a99054.toString()));
                 }
                 //pm2.5
                 Object a34004 = jsonObject.get("a34004");
                 if (!Objects.isNull(a34004)){
                     PM25ArrayList.add(Double.parseDouble(a34004.toString()));
+                    PM25ArrayListNotMergedSum.add(Double.parseDouble(a34004.toString()));
                 }
                 //������������
                 Object a21026 = jsonObject.get("a21026");
                 if (!Objects.isNull(a21026)){
                     SOArrayList.add(Double.parseDouble(a21026.toString()));
+                    SOArrayListNotMergedSum.add(Double.parseDouble(a21026.toString()));
                 }
 
                 //������������
                 Object a21004 = jsonObject.get("a21004");
                 if (!Objects.isNull(a21004)){
                     NOArrayList.add(Double.parseDouble(a21004.toString()));
+                    NOArrayListNotMergedSum.add(Double.parseDouble(a21004.toString()));
                 }
 
                 //������
                 Object a01006 = jsonObject.get("a01006");
                 if (!Objects.isNull(a01006)){
                     QYArrayList.add(Double.parseDouble(a01006.toString()));
+                    QYArrayListNotMergedSum.add(Double.parseDouble(a01006.toString()));
                 }
                 //pm10
                 Object a34002 = jsonObject.get("a34002");
                 if (!Objects.isNull(a34002)){
                     PM10ArrayList.add(Double.parseDouble(a34002.toString()));
+                    PM10ArrayListNotMergedSum.add(Double.parseDouble(a34002.toString()));
                 }
                 //co
                 Object a21005 = jsonObject.get("a21005");
                 if (!Objects.isNull(a21005)){
                     COArrayList.add(Double.parseDouble(a21005.toString()));
+                    COArrayListNotMergedSum.add(Double.parseDouble(a21005.toString()));
                 }
                 //������
                 Object a01002 = jsonObject.get("a01002");
                 if (!Objects.isNull(a01002)){
-                    QYArrayList.add(Double.parseDouble(a01002.toString()));
+                    SHArrayList.add(Double.parseDouble(a01002.toString()));
+                    SHArrayListNotMergedSum.add(Double.parseDouble(a01002.toString()));
                 }
                 //������
                 Object a01001 = jsonObject.get("a01001");
                 if (!Objects.isNull(a01001)){
-                    QYArrayList.add(Double.parseDouble(a01001.toString()));
+                    WDArrayList.add(Double.parseDouble(a01001.toString()));
+                    WDArrayListNotMergedSum.add(Double.parseDouble(a01001.toString()));
                 }
                 //������
                 Object a05024 = jsonObject.get("a05024");
                 if (!Objects.isNull(a05024)){
                     O3ArrayList.add(Double.parseDouble(a05024.toString()));
+                    O3ArrayListNotMergedSum.add(Double.parseDouble(a05024.toString()));
                 }
 
             }
@@ -295,14 +327,183 @@
             dto.setA01001(WDDouble);
             dto.setA01002(SHDouble);
             dto.setA01006(QYDouble);
+            TVOCArrayListMergedSum.add(TVODouble);
+            COArrayListMergedSum.add(CODouble);
+            NOArrayListMergedSum.add(NODouble);
+            O3ArrayListMergedSum.add(O3Double);
+            PM10ArrayListMergedSum.add(PM10Double);
+            PM25ArrayListMergedSum.add(PM25Double);
+            SOArrayListMergedSum.add(SODouble);
+            WDArrayListMergedSum.add(WDDouble);
+            SHArrayListMergedSum.add(SHDouble);
+            QYArrayListMergedSum.add(QYDouble);
             String[] s = string.split("_");
             dto.setFlyLat(Double.parseDouble(s[1]));
             dto.setFlyLon(Double.parseDouble(s[0]));
             uavResultDTOS.add(dto);
         }
+        Double a21005CONotMergedAvg = resultDoubled(COArrayListNotMergedSum,1);
+        Double a2100CO5NotMergedHighest= resultDoubled(COArrayListNotMergedSum,2);
+        Double a2100CO5NotMergedLowest= resultDoubled(COArrayListNotMergedSum,3);
+        Double a21005COMergeAvg = resultDoubled(COArrayListMergedSum,1);
+        Double a21005COMergedHighest = resultDoubled(COArrayListMergedSum,2);
+        Double a21005COMergedLowest = resultDoubled(COArrayListMergedSum,3);
+
+        Double a21026SO2NotMergedAvg = resultDoubled(SOArrayListNotMergedSum,1);
+        Double a21026SO2NotMergedHighest= resultDoubled(SOArrayListNotMergedSum,2);
+        Double a21026SO2NotMergedLowest= resultDoubled(SOArrayListNotMergedSum,3);
+        Double a21026SO2MergeAvg = resultDoubled(SOArrayListMergedSum,1);
+        Double a21026SO2MergedHighest = resultDoubled(SOArrayListMergedSum,2);
+        Double a21026SO2MergedLowest = resultDoubled(SOArrayListMergedSum,3);
+
+        Double a21004NO2NotMergedAvg = resultDoubled(NOArrayListNotMergedSum,1);
+        Double a21004NO2NotMergedHighest= resultDoubled(NOArrayListNotMergedSum,2);
+        Double a21004NO2NotMergedLowest= resultDoubled(NOArrayListNotMergedSum,3);
+        Double a21004NO2MergeAvg = resultDoubled(NOArrayListMergedSum,1);
+        Double a21004NO2MergedHighest = resultDoubled(NOArrayListMergedSum,2);
+        Double a21004NO2MergedLowest = resultDoubled(NOArrayListMergedSum,3);
+
+        Double a34002PM10NotMergedAvg = resultDoubled(PM10ArrayListNotMergedSum,1);
+        Double a34002PM10NotMergedHighest= resultDoubled(PM10ArrayListNotMergedSum,2);
+        Double a34002PM10NotMergedLowest= resultDoubled(PM10ArrayListNotMergedSum,3);
+        Double a34002PM10MergeAvg = resultDoubled(PM10ArrayListMergedSum,1);
+        Double a34002PM10MergedHighest = resultDoubled(PM10ArrayListMergedSum,2);
+        Double a34002PM10MergedLowest = resultDoubled(PM10ArrayListMergedSum,3);
+
+        Double a34004PM25NotMergedAvg = resultDoubled(PM25ArrayListNotMergedSum,1);
+        Double a34004PM25NotMergedHighest= resultDoubled(PM25ArrayListNotMergedSum,2);
+        Double a34004PM25NotMergedLowest= resultDoubled(PM25ArrayListNotMergedSum,3);
+        Double a34004PM25MergeAvg = resultDoubled(PM25ArrayListMergedSum,1);
+        Double a34004PM25MergedHighest = resultDoubled(PM25ArrayListMergedSum,2);
+        Double a34004PM25MergedLowest = resultDoubled(PM25ArrayListMergedSum,3);
+
+        Double a99054TVOCNotMergedAvg = resultDoubled(TVOCArrayListNotMergedSum,1);
+        Double a99054TVOCNotMergedHighest= resultDoubled(TVOCArrayListNotMergedSum,2);
+        Double a99054TVOCNotMergedLowest= resultDoubled(TVOCArrayListNotMergedSum,3);
+        Double a99054TVOCMergeAvg = resultDoubled(TVOCArrayListMergedSum,1);
+        Double a99054TVOCMergedHighest = resultDoubled(TVOCArrayListMergedSum,2);
+        Double a99054TVOCMergedLowest = resultDoubled(TVOCArrayListMergedSum,3);
+
+        Double a05024O3NotMergedAvg = resultDoubled(O3ArrayListNotMergedSum,1);
+        Double a05024O3NotMergedHighest= resultDoubled(O3ArrayListNotMergedSum,2);
+        Double a05024O3NotMergedLowest= resultDoubled(O3ArrayListNotMergedSum,3);
+        Double a05024O3MergeAvg = resultDoubled(O3ArrayListMergedSum,1);
+        Double a05024O3MergedHighest = resultDoubled(O3ArrayListMergedSum,2);
+        Double a05024O3MergedLowest = resultDoubled(O3ArrayListMergedSum,2);
+
+        Double a01001TemNotMergedAvg = resultDoubled(WDArrayListNotMergedSum,1);
+        Double a01001TemNotMergedHighest= resultDoubled(WDArrayListNotMergedSum,2);
+        Double a01001TemNotMergedLowest= resultDoubled(WDArrayListNotMergedSum,3);
+        Double a01001TemMergeAvg = resultDoubled(WDArrayListMergedSum,1);
+        Double a01001TemMergedHighest = resultDoubled(WDArrayListMergedSum,2);
+        Double a01001TemMergedLowest = resultDoubled(WDArrayListMergedSum,2);
+
+        Double a01002HumNotMergedAvg = resultDoubled(SHArrayListNotMergedSum,1);
+        Double a01002HumNotMergedHighest= resultDoubled(SHArrayListNotMergedSum,2);
+        Double a01002HumNotMergedLowest= resultDoubled(SHArrayListNotMergedSum,3);
+        Double a010022HumMergeAvg = resultDoubled(SHArrayListMergedSum,1);
+        Double a01002HumMergedHighest = resultDoubled(SHArrayListMergedSum,2);
+        Double a01002HumMergedLowest = resultDoubled(SHArrayListMergedSum,2);
+
+        Double a01006PreNotMergedAvg = resultDoubled(QYArrayListNotMergedSum,1);
+        Double a01006PreNotMergedHighest= resultDoubled(QYArrayListNotMergedSum,2);
+        Double a01006PreNotMergedLowest= resultDoubled(QYArrayListNotMergedSum,3);
+        Double a01006PreMergeAvg = resultDoubled(QYArrayListMergedSum,1);
+        Double a01006PreMergedHighest = resultDoubled(QYArrayListMergedSum,2);
+        Double a01006PreMergedLowest = resultDoubled(QYArrayListMergedSum,2);
+        uavResultDTOS.forEach(it->{
+            it.setA21005CONotMergedAvg(a21005CONotMergedAvg);
+            it.setA21005CONotMergedHighest(a2100CO5NotMergedHighest);
+            it.setA21005CONotMergedLowest(a2100CO5NotMergedLowest);
+            it.setA21005COMergeAvg(a21005COMergeAvg);
+            it.setA21005COMergedHighest(a21005COMergedHighest);
+            it.setA21005COMergedLowest(a21005COMergedLowest);
+
+            it.setA21026SO2NotMergedAvg(a21026SO2NotMergedAvg);
+            it.setA21026SO2NotMergedHighest(a21026SO2NotMergedHighest);
+            it.setA21026SO2NotMergedLowest(a21026SO2NotMergedLowest);
+            it.setA21026SO2MergeAvg(a21026SO2MergeAvg);
+            it.setA21026SO2MergedHighest(a21026SO2MergedHighest);
+            it.setA21026SO2MergedLowest(a21026SO2MergedLowest);
+
+            it.setA21004NO2NotMergedAvg(a21004NO2NotMergedAvg);
+            it.setA21004NO2NotMergedHighest(a21004NO2NotMergedHighest);
+            it.setA21004NO2NotMergedLowest(a21004NO2NotMergedLowest);
+            it.setA21004NO2MergeAvg(a21004NO2MergeAvg);
+            it.setA21004NO2MergedHighest(a21004NO2MergedHighest);
+            it.setA21004NO2MergedLowest(a21004NO2MergedLowest);
+
+            it.setA34002PM10NotMergedAvg(a34002PM10NotMergedAvg);
+            it.setA34002PM10NotMergedHighest(a34002PM10NotMergedHighest);
+            it.setA34002PM10NotMergedLowest(a34002PM10NotMergedLowest);
+            it.setA34002PM10MergeAvg(a34002PM10MergeAvg);
+            it.setA34002PM10MergedHighest(a34002PM10MergedHighest);
+            it.setA34002PM10MergedLowest(a34002PM10MergedLowest);
+
+            it.setA34004PM25NotMergedAvg(a34004PM25NotMergedAvg);
+            it.setA34004PM25NotMergedHighest(a34004PM25NotMergedHighest);
+            it.setA34004PM25NotMergedLowest(a34004PM25NotMergedLowest);
+            it.setA34004PM25MergeAvg(a34004PM25MergeAvg);
+            it.setA34004PM25MergedHighest(a34004PM25MergedHighest);
+            it.setA34004PM25MergedLowest(a34004PM25MergedLowest);
+
+            it.setA99054TVOCNotMergedAvg(a99054TVOCNotMergedAvg);
+            it.setA99054TVOCNotMergedHighest(a99054TVOCNotMergedHighest);
+            it.setA99054TVOCNotMergedLowest(a99054TVOCNotMergedLowest);
+            it.setA99054TVOCMergeAvg(a99054TVOCMergeAvg);
+            it.setA99054TVOCMergedHighest(a99054TVOCMergedHighest);
+            it.setA99054TVOCMergedLowest(a99054TVOCMergedLowest);
+
+            it.setA05024O3NotMergedAvg(a05024O3NotMergedAvg);
+            it.setA05024O3NotMergedHighest(a05024O3NotMergedHighest);
+            it.setA05024O3NotMergedLowest(a05024O3NotMergedLowest);
+            it.setA05024O3MergeAvg(a05024O3MergeAvg);
+            it.setA05024O3MergedHighest(a05024O3MergedHighest);
+            it.setA05024O3MergedLowest(a05024O3MergedLowest);
+
+            it.setA01001TemNotMergedAvg(a01001TemNotMergedAvg);
+            it.setA01001TemNotMergedHighest(a01001TemNotMergedHighest);
+            it.setA01001TemNotMergedLowest(a01001TemNotMergedLowest);
+            it.setA01001TemMergeAvg(a01001TemMergeAvg);
+            it.setA01001TemMergedHighest(a01001TemMergedHighest);
+            it.setA01001TemMergedLowest(a01001TemMergedLowest);
+
+            it.setA01002HumNotMergedAvg(a01002HumNotMergedAvg);
+            it.setA01002HumNotMergedHighest(a01002HumNotMergedHighest);
+            it.setA01002HumNotMergedLowest(a01002HumNotMergedLowest);
+            it.setA01002HumMergeAvg(a010022HumMergeAvg);
+            it.setA01002HumMergedHighest(a01002HumMergedHighest);
+            it.setA01002HumMergedLowest(a01002HumMergedLowest);
+
+            it.setA01006PreNotMergedAvg(a01006PreNotMergedAvg);
+            it.setA01006PreNotMergedHighest(a01006PreNotMergedHighest);
+            it.setA01006PreNotMergedLowest(a01006PreNotMergedLowest);
+            it.setA01006PreMergeAvg(a01006PreMergeAvg);
+            it.setA01006PreMergedHighest(a01006PreMergedHighest);
+            it.setA01006PreMergedLowest(a01006PreMergedLowest);
+
+        });
+
+
+
         return uavResultDTOS;
     }
 
+    private Double resultDoubled(List<Double> doubles,int type){
+        if(CollectionUtils.isEmpty(doubles)){
+            return 0d;
+        }
+        double one = 0d;
+        if(type == 1){
+             one = doubles.stream().mapToDouble(Double::doubleValue).average().getAsDouble();
+        }else if(type == 2){
+            one = doubles.stream().mapToDouble(Double::doubleValue).max().getAsDouble();
+        }else if(type == 3){
+            one = doubles.stream().mapToDouble(Double::doubleValue).min().getAsDouble();
+        }
+        BigDecimal two = new BigDecimal(one);
+        return two.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();
+    }
 
     private static final double EARTH_RADIUS = 6378137;
 

--
Gitblit v1.8.0