Browse Source

pdf整合综合风切变

hxf 2 years ago
parent
commit
b1d45623d4

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

@@ -43,13 +43,6 @@ public interface HomePageService extends IService<WindTowerDataParentTable> {
     List<Map<String,Object>> homePageAllWindMap();
 
 
-    /**
-     * 首页空气密度和温度
-     *
-     * @param equipmentId 场站编号
-     * @return List<WindTowerDataAirAndT>
-     */
-    Map<String, List<Object>> selectTForAir(String equipmentId);
     //首页空气密度、温度、压强平均值
     Map<String, Object> getAirAndPaAndT(String equipmentId, String month);
 

+ 0 - 97
neim-biz/src/main/java/com/jiayue/biz/service/impl/HomePageServiceImpl.java

@@ -406,46 +406,6 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
 
     }
 
-    /**
-     * @param equipmentId 设备编号
-     * @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;
-//    }
 
     /**
      * 首页查询最新一天的平均风速
@@ -503,44 +463,6 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
     }
 
 
-    /**
-     * 首页空气密度和温度 折线图
-     *
-     * @param equipmentId 场站编号
-     * @return List<WindTowerDataAirAndT>
-     */
-    public Map<String, List<Object>> selectTForAir(String equipmentId) {
-        //获取最新一天的数据
-        List<Map<String, Object>> mapList = windTowerDataParentTableService.getStartTimeAndEndTimeForData(equipmentId);
-        ArrayList<Object> tList = new ArrayList<>();
-        ArrayList<Object> airList = new ArrayList<>();
-        ArrayList<Object> timeList = new ArrayList<>();
-        HashMap<String, List<Object>> hashMap1 = new HashMap<>();
-        for (Map<String, Object> map : mapList) {
-            BigDecimal tAve = BigDecimal.ZERO;
-            BigDecimal airDensity = BigDecimal.ZERO;
-            String abnormal_type = "";
-            //过滤异常值
-            if (map.get("abnormal_type") != null) {
-                abnormal_type = map.get("abnormal_type").toString();
-            }
-            if (map.get("t_ave") != null && !map.get("t_ave").equals("") && (!abnormal_type.contains("t_ave"))) {
-                tAve = CalculationUtil.getBigDecimal(map.get("t_ave"));
-            }
-            if (map.get("air_density") != null && !map.get("air_density").equals("") && (!abnormal_type.contains("air_density"))) {
-                airDensity = CalculationUtil.getBigDecimal(map.get("air_density"));
-            }
-            tList.add(tAve);
-            airList.add(airDensity);
-            String time = DateUtil.format(new Date(Long.parseLong(map.get("time").toString())), "yyyy-MM-dd HH:mm:ss");
-            timeList.add(time);
-        }
-
-        hashMap1.put("t", tList);
-        hashMap1.put("air", airList);
-        hashMap1.put("time", timeList);
-        return hashMap1;
-    }
 
     /**
      * 首页空气密度、温度、压强平均值 湍流 风切变 满发小时数 日发电量 经纬度 数据起止时间
@@ -663,25 +585,6 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
         return dataMap;
     }
 
-    /**
-     * 根据时间范围和设备id查询数据
-     *
-     * @param startTime   开始时间
-     * @param endTime     结束时间
-     * @param equipmentId 设备id
-     * @return List<Map < String, Object>>
-     */
-    public List<Map<String, Object>> selectDataByBetweenTimeAndEquipmetId(Date startTime, Date endTime, String equipmentId) {
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
-        String key = "homepageWindDataSelect" + sdf.format(startTime) + equipmentId;
-        Object cacheObj = SpringUtils.getBean(RedisCache.class).getCacheObject(key);
-        if (ObjectUtil.isNotNull(cacheObj)) {
-            return (List<Map<String, Object>>) cacheObj;
-        }
-        List<Map<String, Object>> mapList = windTowerDataParentTableService.selectDataByBetweenTimeAndEquipmetId(startTime, endTime, equipmentId);
-        SpringUtils.getBean(RedisCache.class).setCacheObject(key, mapList);
-        return mapList;
-    }
 
     //首页全省资源概述
     public HashMap<String, String> getResourcesOverview() {

+ 4 - 2
neim-biz/src/main/java/com/jiayue/biz/service/impl/PdfServiceImpl.java

@@ -1238,7 +1238,7 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
             SimpleDateFormat sdf = new SimpleDateFormat("M");
 
-            String shearFieldName = height + "shear";
+            String shearFieldName = "windShear";
             List<EquipmentAttribute> shearFieldNameList = equipmentAttributeList.stream().filter(e -> shearFieldName.equals(e.getFieldName())).collect(Collectors.toList());
             if (!shearFieldNameList.isEmpty()) {
                 String ebId = shearFieldNameList.get(0).getId(); //属性id
@@ -1416,7 +1416,9 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
             BigDecimal aveYearTurInsity = new BigDecimal(0);
             //过滤为0的数据
             List<BigDecimal> collect = yearResults.stream().filter(w -> w.compareTo(new BigDecimal(0)) != 0).collect(Collectors.toList());
-            aveYearTurInsity = collect.stream().reduce(BigDecimal.ZERO, BigDecimal::add).divide(BigDecimal.valueOf(collect.size()), 2, RoundingMode.HALF_UP);
+            if(collect.size() > 0){
+                aveYearTurInsity = collect.stream().reduce(BigDecimal.ZERO, BigDecimal::add).divide(BigDecimal.valueOf(collect.size()), 2, RoundingMode.HALF_UP);
+            }
             map.put("yearTurInsity", yearResults);
             map.put("aveYearTurInsity", aveYearTurInsity);
             map.put("monthTime", monthTimeList);