From f8bfd26b5ca75f439c74ecc1a830ccfbdcc11b63 Mon Sep 17 00:00:00 2001
From: cjl <276999030@qq.com>
Date: Mon, 24 Jul 2023 09:42:19 +0800
Subject: [PATCH] fix: 导出数据添加百分位

---
 screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java
index 4d247ff..c7379dc 100644
--- a/screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java
+++ b/screen-api/src/main/java/com/moral/api/service/impl/HistoryFiveMinutelyServiceImpl.java
@@ -2,10 +2,7 @@
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.ISqlSegment;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
-import com.baomidou.mybatisplus.core.conditions.segments.NormalSegmentList;
 import com.moral.api.config.mybatis.MybatisPlusConfig;
 import com.moral.api.entity.*;
 import com.moral.api.mapper.HistoryFiveMinutelyMapper;
@@ -161,7 +158,6 @@
             //������������
             windData = historyFiveMinutelyMapper.getAreaWindData(params);
         }
-        log.info("���������������{}", windData);
         return getWindData(windData);
     }
 
@@ -185,6 +181,9 @@
             datas.put("dataTime", time);
         } else {
             datas = queryLastDataByMac(mac);
+            if (ObjectUtils.isEmpty(datas)){
+                return null;
+            }
         }
         //������������������
         Map<String, Object> result = new HashMap<>();
@@ -350,25 +349,23 @@
         laLaMap.put("minLo", lomi);
         laLaMap.put("maxLa", lama);
         laLaMap.put("minLa", lami);
-
         Double lo1 = lomi - length * 0.00001141;
-//        Double lo1 = lomi - length * 0.000001141 * 2;
+       //Double lo1 = lomi - length * 0.000001141 * 2;
         Double lo2 = loma + length * 0.00001141;
-//        Double lo2 = loma + length * 0.000001141 * 2;
-//        Double la2 = lami - length * 0.000000899 * 2;
+       //Double lo2 = loma + length * 0.000001141 * 2;
+       //Double la2 = lami - length * 0.000000899 * 2;
         Double la2 = lami - length * 0.00000899;
-//        Double la1 = lama + length * 0.000000899 * 2;
+        //Double la1 = lama + length * 0.000000899 * 2;
         Double la1 = lama + length * 0.00000899;
 
         double dx = 0.00001141 * perdlen;
         double dy = 0.00000899 * perdlen;
 
-//        double dx = 0.000001141 * perdlen * 2;
-//        double dy = 0.000000899 * perdlen * 2;
+       //double dx = 0.000001141 * perdlen * 2;
+       //double dy = 0.000000899 * perdlen * 2;
 
         int nx = (int) Math.floor((lo2 - lo1) / dx);
         int ny = (int) Math.floor((la1 - la2) / dy);
-
 
         List<Double> uList = new ArrayList<>();
         List<Double> vList = new ArrayList<>();
@@ -376,6 +373,7 @@
         int y;
 
         for (int i = 0; i < mapList.size(); i++) {
+
             Double lo = (Double) mapList.get(i).get("lo");
             Double la = (Double) mapList.get(i).get("la");
             x = (int) Math.floor((lo - lo1) / dx);
@@ -425,6 +423,8 @@
                 }
             }
         }
+
+
         String uData = "\"" + "data" + "\"" + ": " + uList;
         String vData = "\"" + "data" + "\"" + ": " + vList;
 
@@ -442,6 +442,7 @@
 
 
         String s1 = "[" + "{" + header1 + ", " + uData + "}" + ", " + "{" + header2 + ", " + vData + "}" + "]";
+        //System.out.println(s1);
         JSONArray jsonArray = JSONArray.parseArray(s1);
 
         list.add(jsonArray);
@@ -485,6 +486,4 @@
         MybatisPlusConfig.tableName.remove();
         return result;
     }
-
-
 }

--
Gitblit v1.8.0