瀏覽代碼

修改统计入库bug 以及实时查询风切变数据

hxf 2 年之前
父節點
當前提交
69e1afae17

+ 7 - 7
neim-biz/src/main/java/com/jiayue/biz/controller/HomePageController.java

@@ -56,13 +56,13 @@ public class HomePageController extends BaseController {
     }
 
 
-    /**
-     * 首页风速占比以及平均风速
-     */
-    @GetMapping("/getHeightForAveWs")
-    public AjaxResult getHeightForAveWs(String equipmentId, String height) {
-        return AjaxResult.success(homePageService.getHeightForAveWs(equipmentId, height));
-    }
+//    /**
+//     * 首页风速占比以及平均风速
+//     */
+//    @GetMapping("/getHeightForAveWs")
+//    public AjaxResult getHeightForAveWs(String equipmentId, String height) {
+//        return AjaxResult.success(homePageService.getHeightForAveWs(equipmentId, height));
+//    }
 
 
     /**

+ 7 - 7
neim-biz/src/main/java/com/jiayue/biz/service/HomePageService.java

@@ -28,13 +28,13 @@ public interface HomePageService extends IService<WindTowerDataParentTable> {
     /*首页风速曲线*/
     Map<String, Object> homePageCharts(String equipmentId, String month);
 
-    /**
-     *
-     * @param equipmentId 设备编号
-     * @param height 层高
-     * @return Map<String, Object>
-     */
-    Map<String, Object> getHeightForAveWs(String equipmentId, String height);
+//    /**
+//     *
+//     * @param equipmentId 设备编号
+//     * @param height 层高
+//     * @return Map<String, Object>
+//     */
+//    Map<String, Object> getHeightForAveWs(String equipmentId, String height);
 
 
     /*首页地图*/

+ 37 - 50
neim-biz/src/main/java/com/jiayue/biz/service/impl/HomePageServiceImpl.java

@@ -412,41 +412,41 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
      * @param height      层高
      * @return Map<String, Object>
      */
-    public Map<String, Object> getHeightForAveWs(String equipmentId, String height) {
-        // 最新一天数据
-        List<Map<String, Object>> mapList = windTowerDataParentTableService.getStartTimeAndEndTimeForData(equipmentId);
-        List<BigDecimal> wsForHeight = CalculationUtil.getWsForHeight(mapList, height);
-        //本层高风速总和
-        BigDecimal aveWs = wsForHeight.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
-        HashMap<String, Long> hashMap = new HashMap<>();
-        //层高所有条数
-        long total = 0;
-        for (int i = 0; i < 11; i = i + 2) {
-            long count;
-            int finalI = i;
-            String iStr = "";
-            if (i >= 10) {
-                count = wsForHeight.stream().filter(w -> w.compareTo(BigDecimal.valueOf(finalI)) > 0).count();
-                iStr = ">" + finalI + "m/s";
-            } else {
-                count = wsForHeight.stream().filter(w -> w.compareTo(BigDecimal.valueOf(finalI)) > 0 && w.compareTo(BigDecimal.valueOf(finalI + 2)) < 0).count();
-                iStr = finalI + "~" + (finalI + 2) + "m/s";
-            }
-            total += count;
-            if (count > 0) {
-                hashMap.put(iStr, count);
-            }
-        }
-        HashMap<String, Object> dataMap = new HashMap<>();
-        if (total > 0) {
-            dataMap.put("wsAve", aveWs.divide(BigDecimal.valueOf(total), 2, RoundingMode.HALF_UP));
-        } else {
-            dataMap.put("wsAve", BigDecimal.ZERO);
-        }
-
-        dataMap.put("proportion", hashMap);
-        return dataMap;
-    }
+//    public Map<String, Object> getHeightForAveWs(String equipmentId, String height) {
+//        // 最新一天数据
+//        List<Map<String, Object>> mapList = windTowerDataParentTableService.getStartTimeAndEndTimeForData(equipmentId);
+//        List<BigDecimal> wsForHeight = CalculationUtil.getWsForHeight(mapList, height);
+//        //本层高风速总和
+//        BigDecimal aveWs = wsForHeight.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
+//        HashMap<String, Long> hashMap = new HashMap<>();
+//        //层高所有条数
+//        long total = 0;
+//        for (int i = 0; i < 11; i = i + 2) {
+//            long count;
+//            int finalI = i;
+//            String iStr = "";
+//            if (i >= 10) {
+//                count = wsForHeight.stream().filter(w -> w.compareTo(BigDecimal.valueOf(finalI)) > 0).count();
+//                iStr = ">" + finalI + "m/s";
+//            } else {
+//                count = wsForHeight.stream().filter(w -> w.compareTo(BigDecimal.valueOf(finalI)) > 0 && w.compareTo(BigDecimal.valueOf(finalI + 2)) < 0).count();
+//                iStr = finalI + "~" + (finalI + 2) + "m/s";
+//            }
+//            total += count;
+//            if (count > 0) {
+//                hashMap.put(iStr, count);
+//            }
+//        }
+//        HashMap<String, Object> dataMap = new HashMap<>();
+//        if (total > 0) {
+//            dataMap.put("wsAve", aveWs.divide(BigDecimal.valueOf(total), 2, RoundingMode.HALF_UP));
+//        } else {
+//            dataMap.put("wsAve", BigDecimal.ZERO);
+//        }
+//
+//        dataMap.put("proportion", hashMap);
+//        return dataMap;
+//    }
 
     /**
      * 首页查询最新一天的平均风速
@@ -605,21 +605,8 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
         BigDecimal avgWs = CalculationUtil.getAvgWind(wsForHeight); // 风速平均值
         BigDecimal avgWsSta = CalculationUtil.getAvgWind(wsStaForHeight);// 风速标准差平均值
         BigDecimal turbulence = CalculationUtil.caTurbulenceIntensity(avgWsSta, avgWs); // 湍流
-        BigDecimal windShear = BigDecimal.ZERO;
-        BigDecimal totalShear = BigDecimal.ZERO;
-        //计算综合风切变
-        if (!anemometryDataList.isEmpty()) {
-            for (long i = DateUtil.beginOfDay(new Date(dataTimeStartAndEnd.get("endTime"))).getTime(); i < dataTimeStartAndEnd.get("endTime"); i = i + 600000) {
-                long finalI = i;
-                List<ProphaseAnemometryData> collect = anemometryDataList.stream().filter(a -> a.getTs().getTime() >= finalI && a.getTs().getTime() < finalI + 600000).collect(Collectors.toList());
-                BigDecimal windShear1 = CalculationUtil.getWindShear(collect, heights);
-                windShear = windShear.add(windShear1);
-                totalShear = totalShear.add(BigDecimal.ONE);
-            }
-            if (totalShear.compareTo(BigDecimal.ZERO) > 0) {
-                windShear = windShear.divide(totalShear, 2, RoundingMode.HALF_UP);
-            }
-        }
+        BigDecimal  windShear = CalculationUtil.getWindShear(anemometryDataList, heights);//计算综合风切变
+
         if (!weatherDataList.isEmpty()) {
 
             airDensity = BigDecimal.valueOf(weatherDataList.stream().map(w -> {

+ 12 - 19
neim-biz/src/main/java/com/jiayue/biz/service/impl/RealTimeDisplayServiceImpl.java

@@ -696,37 +696,30 @@ public class RealTimeDisplayServiceImpl implements RealTimeDisplayService {
      * @param height
      */
     public List<Map<String, Object>> getWindShear(Long startTime, Long endTime, String eqId, String height) {
-        List<Map<String, Object>> maps = windTowerDataParentTableService.selectDataByBetweenTimeAndEquipmetId(new Date(startTime), new Date(endTime), eqId);
-
+        List<ProphaseAnemometryData> anemometryData = prophaseAnemometryDataMapper.selectWdAveAndWdAveAndWsSta(eqId, new Timestamp(startTime), new Timestamp(endTime));
         String[] heights = windTowerInfoService.getByEquipmentNo(eqId).get(0).getHeights().split(",");
-        Integer heightMin = 100;
+        ArrayList<String> heightAll = new ArrayList<>(Arrays.asList(heights));
+        //获取最小层高
+        List<Integer> collect = heightAll.stream().map(h -> {
+            return Integer.parseInt(CalculationUtil.getNumberFromString(h));
+        }).sorted().collect(Collectors.toList());
+        Integer heightMin = collect.get(0);
         String finalHeight = height;
         if (height.contains("A")) {
             finalHeight = height.substring(0, height.length() - 1);
         }
-        // 找出最小层高
-        for (String h : heights) {
-            Integer tempHeight = null;
-            // 若是此层高是第二同层高
-            if (!h.contains("A")) {
-                tempHeight = Integer.parseInt(h);
-            } else {
-                tempHeight = Integer.parseInt(h.substring(0, h.length() - 1));
-            }
-            if (tempHeight < heightMin) {
-                heightMin = Integer.parseInt(h);
-            }
-        }
+
+
         BigDecimal zero = new BigDecimal(0);
         List<Map<String, Object>> list = new ArrayList<>();
         for (WindDirectionEnum value : WindDirectionEnum.values()) {
             Map<String, Object> map = new HashMap<>();
+            List<ProphaseAnemometryData> heightAndWindDirectionEnum = CalculationUtil.getForHeightAndWindDirectionEnum(anemometryData, value);
 
-            List<Map<String, Object>> mapList = CalculationUtil.getForHeightAndWindDirectionEnum(maps, height, value);
             //获取平均风速
-            BigDecimal avgWindSpeed = CalculationUtil.getAvgWind(CalculationUtil.getWsForHeight(mapList, height));
+            BigDecimal avgWindSpeed = CalculationUtil.getAvgWind(CalculationUtil.getWsForHeight(heightAndWindDirectionEnum, height));
 
-            BigDecimal avgWindSpeed10 = CalculationUtil.getAvgWind(CalculationUtil.getWsForHeight(mapList, heightMin.toString()));
+            BigDecimal avgWindSpeed10 = CalculationUtil.getAvgWind(CalculationUtil.getWsForHeight(heightAndWindDirectionEnum, heightMin.toString()));
             BigDecimal bigDecimal = new BigDecimal(-99);
             if (avgWindSpeed10.compareTo(BigDecimal.ZERO) != 0) {
                 bigDecimal = CalculationUtil.caWindShear(avgWindSpeed, avgWindSpeed10, new BigDecimal(finalHeight), new BigDecimal(heightMin));

+ 14 - 13
neim-biz/src/main/java/com/jiayue/biz/service/impl/WindTowerCalculationDataServiceImpl.java

@@ -1068,7 +1068,8 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
         //获取统计属性表
         List<EquipmentAttribute> shearDayFieldNameList = equipmentAttributeService.lambdaQuery().eq(EquipmentAttribute::getFieldName, "windShearMonth").list();
         //获取统计数据表
-        List<WindTowerCalculationData> windTowerCalculationDataList = getByBetweenTimeAndEquipmentId(new Date(startTime), new Date(endTime), eqId).stream().sorted(Comparator.comparing(WindTowerCalculationData::getTime)).collect(Collectors.toList());;
+        List<WindTowerCalculationData> windTowerCalculationDataList = getByBetweenTimeAndEquipmentId(new Date(startTime), new Date(endTime), eqId).stream().sorted(Comparator.comparing(WindTowerCalculationData::getTime)).collect(Collectors.toList());
+        ;
         // 根据开始时间、结束时间分割的月份
         List<Long> timeList = DateTimeUtil.getIntervalTimeByMonth(new Date(startTime), new Date(endTime));
 
@@ -1428,7 +1429,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
                     if (!wpdCalDataList.isEmpty()) {
                         WindTowerCalculationData windTowerCalculationData = new WindTowerCalculationData();
                         windTowerCalculationData.setEquipmentId(equipmentId);
-                        windTowerCalculationData.setValue(wpdSum.divide(new BigDecimal(wpdCalDataList.size()), 2, RoundingMode.HALF_UP));
+                        windTowerCalculationData.setValue(wpdSum.divide(BigDecimal.valueOf(wpdCalDataList.size()), 2, RoundingMode.HALF_UP));
                         windTowerCalculationData.setEbId(wpdDayList.get(0).getId());
                         windTowerCalculationData.setTime(new Date(start1));
                         windTowerCalculationDataList.add(windTowerCalculationData);
@@ -1898,7 +1899,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
                 long dayTime = time;
                 //过滤一天数据
                 List<ProphaseWeatherData> collect = prophaseWeatherDataList.stream().filter(p -> p.getTs().getTime() >= dayTime && p.getTs().getTime() < dayTime + day).collect(Collectors.toList());
-                BigDecimal paSum = CalculationUtil.getBigDecimal(collect.stream().filter(c -> c.getPaAve() != null && c.getPaAve() != 0).mapToDouble(ProphaseWeatherData::getTAve).sum());
+                BigDecimal paSum = CalculationUtil.getBigDecimal(collect.stream().filter(c -> c.getPaAve() != null && c.getPaAve() != 0).mapToDouble(ProphaseWeatherData::getPaAve).sum());
 
                 if (!collect.isEmpty()) {
                     WindTowerCalculationData windTowerCalculationData = new WindTowerCalculationData();
@@ -1940,16 +1941,16 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
                 long start2 = start1 + 3600000L;
                 BigDecimal oneHourWindShear = BigDecimal.ZERO;
                 BigDecimal total = BigDecimal.ZERO;
-                for (long i = start1; i < start2; i = i + 600000) {
-                    long finalI = i;
-                    List<ProphaseAnemometryData> collect = prophaseAnemometryData.stream().filter(p -> p.getTs().getTime() >= finalI && p.getTs().getTime() <= finalI + 600000 - 1).collect(Collectors.toList());
-                    //计算十分钟综合风切变
-                    BigDecimal windShear = CalculationUtil.getWindShear(collect, heights);
-                    if (windShear.compareTo(BigDecimal.ZERO) != 0) {
-                        oneHourWindShear = oneHourWindShear.add(windShear);
-                        total = total.add(BigDecimal.ONE);
-                    }
+
+                long finalStart = start1;
+                List<ProphaseAnemometryData> collect = prophaseAnemometryData.stream().filter(p -> p.getTs().getTime() >= finalStart && p.getTs().getTime() < start2).collect(Collectors.toList());
+                //计算综合风切变
+                BigDecimal windShear = CalculationUtil.getWindShear(collect, heights);
+                if (windShear.compareTo(BigDecimal.ZERO) != 0) {
+                    oneHourWindShear = oneHourWindShear.add(windShear);
+                    total = total.add(BigDecimal.ONE);
                 }
+
                 if (total.compareTo(BigDecimal.ZERO) > 0) {
                     WindTowerCalculationData windTowerCalculationData = new WindTowerCalculationData();
                     windTowerCalculationData.setEquipmentId(equipmentId);
@@ -1984,7 +1985,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
         List<Map<String, Object>> list = new ArrayList<>();
         List<Map<String, Object>> tableList = new ArrayList<>();
         Map<String, Object> map = new TreeMap<>();
-        String shearFieldName = height + "shearDay";
+        String shearFieldName = "windShearDay";
         List<EquipmentAttribute> shearFieldNameList = equipmentAttributeService.lambdaQuery().eq(EquipmentAttribute::getFieldName, shearFieldName).list();
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         Date currentDate = new Date(time);

+ 35 - 121
neim-biz/src/main/java/com/jiayue/biz/util/CalculationUtil.java

@@ -62,94 +62,10 @@ public class CalculationUtil {
      * @param fieldName  属性名(层高)
      * @return
      */
-    public static List<BigDecimal> getWsForHeight(List<Map<String, Object>> filterList, String fieldName) {
-
-        List<BigDecimal> wsList = new ArrayList<>();
-        for (Map<String, Object> map : filterList) {
-            String abnormal_type = "";
-            //过滤异常值
-            if (map.get("abnormal_type") != null) {
-                abnormal_type = map.get("abnormal_type").toString();
-            }
-            if (map.get("ws_ave" + fieldName) != null && !map.get("ws_ave" + fieldName).equals("") && (!abnormal_type.contains("wsAve" + fieldName) || !abnormal_type.contains("ws_ave" + fieldName))) {
-                if (Double.parseDouble(map.get("ws_ave" + fieldName).toString()) < 50) {
-                    wsList.add(getBigDecimal(map.get("ws_ave" + fieldName)));
-                }
-            }
-        }
-        return wsList;
-    }
-
-
-    /**
-     * 根据层高获取空气密度
-     *
-     * @param filterList 过滤出的风数据
-     * @return
-     */
-    public static List<BigDecimal> getAir(List<Map<String, Object>> filterList) {
-        List<BigDecimal> wsList = new ArrayList<>();
-        for (Map<String, Object> map : filterList) {
-            String abnormal_type = "";
-            //过滤异常值
-            if (map.get("abnormal_type") != null) {
-                abnormal_type = map.get("abnormal_type").toString();
-            }
-            if (map.get("air_density") != null && !map.get("air_density").equals("") && (!abnormal_type.contains("air_density"))) {
-                if (Double.parseDouble(map.get("air_density").toString()) < 50) {
-                    wsList.add(getBigDecimal(map.get("air_density")));
-                }
-            }
-        }
-        return wsList;
-    }
-
-
-    /**
-     * 根据层高获取最大风速数据
-     *
-     * @param filterList 过滤出的风数据
-     * @param fieldName  属性名(层高)
-     * @return
-     */
-    public static List<BigDecimal> getWsMaxForHeight(List<Map<String, Object>> filterList, String fieldName) {
-        List<BigDecimal> wsMaxList = new ArrayList<>();
-        for (Map<String, Object> map : filterList) {
-            String abnormal_type = "";
-            //过滤异常值
-            if (map.get("abnormal_type") != null) {
-                abnormal_type = map.get("abnormal_type").toString();
-            }
-            if (map.get("ws_max" + fieldName) != null && (!abnormal_type.contains("wsMax" + fieldName) || !abnormal_type.contains("ws_max" + fieldName))) {
-                wsMaxList.add(getBigDecimal((map.get("ws_max" + fieldName))));
-            }
-        }
-        return wsMaxList;
-    }
-
-
-    /**
-     * 根据层高获取标准差数据
-     *
-     * @param filterList 过滤出的风数据
-     * @param fieldName  属性名(层高)
-     * @return
-     */
-    public static List<BigDecimal> getWsStaForHeight(List<Map<String, Object>> filterList, String fieldName) {
-        List<BigDecimal> wsStaList = new ArrayList<>();
-        for (Map<String, Object> map : filterList) {
-            String abnormal_type = "";
-            //过滤异常值
-            if (map.get("abnormal_type") != null) {
-                abnormal_type = map.get("abnormal_type").toString();
-            }
-            if (map.get("ws_sta" + fieldName) != null && (!abnormal_type.contains("wsSta" + fieldName) || !abnormal_type.contains("ws_sta" + fieldName))) {
-                if (Double.parseDouble(map.get("ws_sta" + fieldName).toString()) < 50) {
-                    wsStaList.add(getBigDecimal((map.get("ws_sta" + fieldName))));
-                }
-            }
-        }
-        return wsStaList;
+    public static List<BigDecimal> getWsForHeight(List<ProphaseAnemometryData> filterList, String fieldName) {
+        return filterList.stream().filter(f -> f.getLayerHeight().equals(fieldName)).map(p -> {
+            return new BigDecimal(p.getWsAve());
+        }).collect(Collectors.toList());
     }
 
 
@@ -160,7 +76,7 @@ public class CalculationUtil {
      * @return
      */
     public static BigDecimal getAvgWind(List<BigDecimal> bigDecimalList) {
-        return new BigDecimal(bigDecimalList.stream().collect(Collectors.averagingDouble(BigDecimal::doubleValue))).setScale(2,RoundingMode.HALF_UP);
+        return new BigDecimal(bigDecimalList.stream().collect(Collectors.averagingDouble(BigDecimal::doubleValue))).setScale(2, RoundingMode.HALF_UP);
     }
 
 
@@ -174,22 +90,14 @@ public class CalculationUtil {
         BigDecimal density = new BigDecimal(-99);
         try {
             if (anemometryData.size() == weatherData.size() && anemometryData.size() != 0) {
-                BigDecimal count = new BigDecimal(0);
-                for (int i = 0; i < anemometryData.size(); i++) {
-                    if (weatherData.get(i).getAirDensity() != null && anemometryData.get(i).getWsAve() != null) {
-                        if (weatherData.get(i).getTs().getTime() == anemometryData.get(i).getTs().getTime()) {
-                            //计算风功率密度 空气密度*第i点的风速值的立方 求和/2 各个层高都有
-                            count = count.add(getWpdCalculate(getBigDecimal(weatherData.get(i).getAirDensity()), getBigDecimal(anemometryData.get(i).getWsAve())));
-                        } else {
-                            int finalI = i;
-                            List<ProphaseWeatherData> collect = weatherData.stream().filter(w -> w.getTs().getTime() == anemometryData.get(finalI).getTs().getTime()).collect(Collectors.toList());
-                            if (collect.size() > 0) {
-                                count = count.add(getWpdCalculate(getBigDecimal(collect.get(0).getAirDensity()), getBigDecimal(anemometryData.get(i).getWsAve())));
-                            }
-                        }
+                BigDecimal wpdSum = new BigDecimal(0);
+                for (ProphaseAnemometryData anemometryDatum : anemometryData) {
+                    List<ProphaseWeatherData> collect = weatherData.stream().filter(w -> w.getTs().getTime() == anemometryDatum.getTs().getTime()).collect(Collectors.toList());
+                    if (collect.size() > 0) {
+                        wpdSum = wpdSum.add(getWpdCalculate(getBigDecimal(collect.get(0).getAirDensity()), getBigDecimal(anemometryDatum.getWsAve())));
                     }
                 }
-                density = count.divide((new BigDecimal(weatherData.size())), 2, RoundingMode.HALF_UP);
+                density = wpdSum.divide(BigDecimal.valueOf(weatherData.size()), 2, RoundingMode.HALF_UP);
             }
         } catch (Exception e) {
             log.error("计算风风能密度时发生错误");
@@ -429,28 +337,34 @@ public class CalculationUtil {
         return value;
     }
 
-    //计算十分钟综合风切变
+    //计算综合风切变
     public static BigDecimal getWindShear(List<ProphaseAnemometryData> prophaseAnemometryData, String[] heights) {
         BigDecimal sumWShear = BigDecimal.ZERO;
-        if(prophaseAnemometryData.size() > 0){
-            String maxHeight = heights[0];
-            List<ProphaseAnemometryData> heightCollect = prophaseAnemometryData.stream().filter(p -> p.getLayerHeight().equals(maxHeight)).collect(Collectors.toList());
-            BigDecimal wsAveForMax = BigDecimal.valueOf(heightCollect.get(0).getWsAve());
-            BigDecimal total = BigDecimal.ZERO;
-            for (String minHeight : heights) {
-                if (!getNumberFromString(minHeight).equals(getNumberFromString(maxHeight))) {
-                    List<ProphaseAnemometryData> sCollect = prophaseAnemometryData.stream().filter(p -> p.getLayerHeight().equals(minHeight)).collect(Collectors.toList());
-                    BigDecimal wsAveMin = BigDecimal.valueOf(sCollect.get(0).getWsAve());
-                    double z = new BigDecimal(getNumberFromString(maxHeight)).divide(new BigDecimal(getNumberFromString(minHeight)), 4, RoundingMode.HALF_UP).doubleValue();
-                    double z1 = Math.log10(z);
-                    BigDecimal shear = Convert.toBigDecimal(Math.log10(Convert.toDouble(wsAveForMax.divide(wsAveMin, 8, RoundingMode.HALF_UP))))
-                            .divide(BigDecimal.valueOf(z1), 8, RoundingMode.HALF_UP);
-                    sumWShear = sumWShear.add(shear);
-                    total = total.add(BigDecimal.ONE);
+        BigDecimal total = BigDecimal.ZERO;
+        if (prophaseAnemometryData.size() > 0) {
+            //循环风速数据集合
+            for (ProphaseAnemometryData prophaseAnemometryDatum : prophaseAnemometryData) {
+                //筛选同一时间的数据集合
+                List<ProphaseAnemometryData> collect = prophaseAnemometryData.stream().filter(p -> p.getTs().getTime() == prophaseAnemometryDatum.getTs().getTime()).collect(Collectors.toList());
+                String maxHeight = heights[0];
+                List<ProphaseAnemometryData> heightCollect = collect.stream().filter(p -> p.getLayerHeight().equals(maxHeight)).collect(Collectors.toList());
+                BigDecimal wsAveForMax = BigDecimal.valueOf(heightCollect.get(0).getWsAve());
+                //循环层高 计算每个低于最高层高的 风切变数据
+                for (String minHeight : heights) {
+                    if (!getNumberFromString(minHeight).equals(getNumberFromString(maxHeight))) {
+                        List<ProphaseAnemometryData> sCollect = collect.stream().filter(p -> p.getLayerHeight().equals(minHeight)).collect(Collectors.toList());
+                        BigDecimal wsAveMin = BigDecimal.valueOf(sCollect.get(0).getWsAve());
+                        double z = new BigDecimal(getNumberFromString(maxHeight)).divide(new BigDecimal(getNumberFromString(minHeight)), 4, RoundingMode.HALF_UP).doubleValue();
+                        double z1 = Math.log10(z);
+                        BigDecimal shear = Convert.toBigDecimal(Math.log10(Convert.toDouble(wsAveForMax.divide(wsAveMin, 8, RoundingMode.HALF_UP))))
+                                .divide(BigDecimal.valueOf(z1), 8, RoundingMode.HALF_UP);
+                        sumWShear = sumWShear.add(shear);
+                        total = total.add(BigDecimal.ONE);
+                    }
                 }
             }
-            if(total.compareTo(BigDecimal.ZERO) > 0){
-                sumWShear = sumWShear.divide(total,2,RoundingMode.HALF_UP);
+            if (total.compareTo(BigDecimal.ZERO) > 0) {
+                sumWShear = sumWShear.divide(total, 2, RoundingMode.HALF_UP);
             }
         }
         return sumWShear;

+ 1 - 1
neim-ui/src/views/windResources/windShear/index.vue

@@ -41,7 +41,7 @@
       <div>
         <div id="shearChart"/>
       </div>
-      <span style="font-weight: bold;font-size: 18px;">风切变数据</span>
+      <span style="font-weight: bold;font-size: 18px;">综合风切变数据</span>
       <el-table v-loading="tableLoading"
                 :data="tableData.slice((page.currentPage-1)*page.pageSize,page.currentPage*page.pageSize)" border
                 height="330px">