zy 1 рік тому
батько
коміт
44fb16957a

+ 2 - 106
wrdep-biz/src/main/java/com/jiayue/biz/controller/PdfController.java

@@ -30,8 +30,8 @@ public class PdfController extends BaseController {
 
 
     @GetMapping("/generatePDF")
-    public AjaxResult getWindTowerInfo(String equipmentId, String height, Long startDay, Long endDay) {
-        return AjaxResult.success(pdfService.generatePDF(equipmentId, height,new Date(startDay),new Date(endDay)));
+    public AjaxResult getWindTowerInfo(String equipmentId, Long startDay, Long endDay) {
+        return AjaxResult.success(pdfService.generatePDF(equipmentId,new Date(startDay),new Date(endDay)));
     }
 
     @GetMapping("/getDataTime")
@@ -42,108 +42,4 @@ public class PdfController extends BaseController {
     public AjaxResult getDataTimeForEveryTower(){
         return AjaxResult.success(pdfService.getDataTimeForEveryTower());
     }
-
-
-    /*测风塔信息概要*/
-	/*@GetMapping("/getWindTowerInfo")
-	public AjaxResult getWindTowerInfo(String equipmentId,Integer height) {
-		return AjaxResult.success(pdfService.getWindTowerInfo(equipmentId,height));
-	}
-
-    *//*测风塔统计概要概要*//*
-    @GetMapping("/statisticsWindTowerStatusData")
-    public AjaxResult statisticsWindTowerStatusData(String equipmentId) {
-        return AjaxResult.success(pdfService.statisticsWindTowerStatusData(equipmentId));
-    }
-
-    *//*风速和风功率密度时间曲线图*//*
-	@GetMapping("/getWsAndWpd")
-	public AjaxResult getWsAndWpd(String equipmentId,Integer height) {
-		return AjaxResult.success(pdfService.getWsAndWpd(equipmentId,height));
-	}
-
-	*//*风速和风速标准差时间曲线图*//*
-	@GetMapping("/getWsAndWsSta")
-	public AjaxResult getWsAndwsSta(String equipmentId,Integer height) {
-		return AjaxResult.success(pdfService.wsAndWsSta(equipmentId,height));
-	}*/
-
-    /* *//*风速和风速密度日变化*//*
-    @GetMapping("/get24WsAndWpd")
-    public AjaxResult getWindPowerDensityAndAverageWindSpeed(String equipmentId, Integer height) {
-        return AjaxResult.success(pdfService.getWindPowerDensityAndAverageWindSpeed(equipmentId, height));
-    }
-
-    *//*风速和风速密度各月日变化*//*
-    @GetMapping("/getMonthWsAndWpd")
-    public AjaxResult getMonthWsAndWpd(String equipmentId, Integer height) {
-        return AjaxResult.success(pdfService.getMonthWsAndWpd(equipmentId, height));
-    }
-
-    *//*风速和风速密度各月日变化表格*//*
-    @GetMapping("/getMonthWpdTable")
-    public AjaxResult getMonthWpdTable(String equipmentId) {
-        return AjaxResult.success(pdfService.getMonthWpdTable(equipmentId));
-    }
-
-    *//*风速和风速密度年变化*//*
-    @GetMapping("/getYearWsAndWpd")
-    public AjaxResult getYearWsAndWpd(String equipmentId, Integer height) {
-        return AjaxResult.success(pdfService.getYearWsAndWpd(equipmentId, height));
-    }
-
-    *//* pdf威布尔*//*
-    @GetMapping("/pdfWeibull")
-    public AjaxResult getPdfWeibull(String equipmentId, Integer height) {
-        return AjaxResult.success(pdfService.pdfWeibull(equipmentId, height));
-    }
-
-    *//*一年玫瑰图*//*
-    @GetMapping("/getRoseCharts")
-    public AjaxResult getRoseCharts(String equipmentId, Integer height) {
-        return AjaxResult.success(pdfService.roseCharts(equipmentId, height));
-    }
-
-    *//*各月玫瑰图*//*
-    @GetMapping("/getMonthRoseCharts")
-    public AjaxResult getMonthRoseCharts(String equipmentId, Integer height) {
-        return AjaxResult.success(pdfService.getMonthRoseCharts(equipmentId, height));
-    }
-
-    *//*空气密度*//*
-    @GetMapping("/getAirDensity")
-    public AjaxResult getAirDensity(String equipmentId) {
-        return AjaxResult.success(pdfService.getAirDensity(equipmentId));
-    }
-
-    *//*风切变幂指数玫瑰图*//*
-    @GetMapping("/getWindShearRose")
-    public AjaxResult getWindShearRose(String equipmentId, Integer height) {
-        return AjaxResult.success(pdfService.getWindShearRose(equipmentId, height));
-    }
-
-    *//*风切变幂指数日/年变化*//*
-    @GetMapping("/getWindShear")
-    public AjaxResult getWindShear(String equipmentId, Integer height) {
-        return AjaxResult.success(pdfService.getWindShear(equipmentId, height));
-    }
-
-    *//*湍流曲线*//*
-    @GetMapping("/getTurIntensityCharts")
-    public AjaxResult getTurIntensityCharts(String equipmentId, Integer height) {
-        return AjaxResult.success(pdfService.getTurIntensityCharts(equipmentId, height));
-    }
-
-    *//*湍流日/年变化*//*
-    @GetMapping("/getTurIntensity")
-    public AjaxResult getTurIntensity(String equipmentId, Integer height) {
-        return AjaxResult.success(pdfService.getTurIntensity(equipmentId, height));
-    }
-
-    *//*湍流玫瑰图*//*
-    @GetMapping("/getTurIntensityRose")
-    public AjaxResult getTurIntensityRose(String equipmentId, Integer height) {
-        return AjaxResult.success(pdfService.getTurIntensityRose(equipmentId, height));
-    }*/
-
 }

+ 1 - 1
wrdep-biz/src/main/java/com/jiayue/biz/service/PdfService.java

@@ -15,7 +15,7 @@ import java.util.Map;
  * @date 2022-05-11
  */
 public interface PdfService extends IService<WindTowerDataParentTable> {
-    Map<String, Object> generatePDF(String equipmentId, String height, Date startDay, Date endDay);
+    Map<String, Object> generatePDF(String equipmentId, Date startDay, Date endDay);
 
     //数据时间范围
     List<Map<String, Object>> getDataTime();

+ 22 - 19
wrdep-biz/src/main/java/com/jiayue/biz/service/impl/PdfServiceImpl.java

@@ -51,7 +51,7 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
 
 
     @Override
-    public Map<String, Object> generatePDF(String equipmentId, String height, Date startDay, Date endDay) {
+    public Map<String, Object> generatePDF(String equipmentId, Date startDay, Date endDay) {
         //如果结束时间大于现在时间
         if (DateUtil.date().getTime() < endDay.getTime()) {
             //将结束时间设置为昨天结束时间
@@ -81,7 +81,7 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
         ArrayList<Map<String, Object>> statisticsDataFen = statisticsWindTowerStatusDataFeng(windTowerCalculationDatas, equipmentAttributeList, windTowerInfos);
         map.put("statisticsDataFen", statisticsDataFen);
         //风速每月平均
-        ArrayList<Map<String, Object>> statisticsWindTowerStatusDataFenMonth = statisticsWindTowerStatusDataFenMonth(windTowerCalculationDatas, equipmentAttributeList, windTowerInfos, startDay, endDay);
+        Map<String, Object> statisticsWindTowerStatusDataFenMonth = statisticsWindTowerStatusDataFenMonth(windTowerCalculationDatas, equipmentAttributeList, windTowerInfos, startDay, endDay);
         map.put("statisticsWindTowerStatusDataFenMonth", statisticsWindTowerStatusDataFenMonth);
         //风功率密度每月平均
         ArrayList<Map<String, Object>> statisticsWindTowerStatusDataFenWpd = statisticsWindTowerStatusDataWpd(windTowerCalculationDatas, equipmentAttributeList, windTowerInfos);
@@ -164,7 +164,7 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
             map.put("endTime", DateUtil.format(new Date(dataTimeStartAndEnd.get("endTime")), "yyyy-MM-dd"));
             map.put("count", count.get(0).get("count(*)"));
             map.put("allCount", allCount);
-            map.put("percentage", percentage);
+            map.put("percentage", percentage.multiply(new BigDecimal(100)));
         }
         return map;
     }
@@ -180,7 +180,7 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
     public Map<String, Object> statisticsWindTowerStatusData(List<WindTowerCalculationData> windTowerCalculationDatas, List<EquipmentAttribute> equipmentAttributeList) {
         Map<String, Object> map = new HashMap<>();
         try {
-            List<Map<String, Object>> dataList = new ArrayList<>();
+//            List<Map<String, Object>> dataList = new ArrayList<>();
             /*环境数据*/
             //从数据库属性表里查出环境数据的属性
             List<EquipmentAttribute> paMax = equipmentAttributeList.stream().filter(w -> w.getFieldName().equals("paMAX")).collect(Collectors.toList());
@@ -241,7 +241,7 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
             environmentData.add(rhMap);
             environmentData.add(tMap);
             environmentData.add(airDensityMap);
-            map.put("dataList", dataList);
+//            map.put("dataList", dataList);
             map.put("environment", environmentData);
         } catch (Exception e) {
             e.printStackTrace();
@@ -292,10 +292,10 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
      * @param equipmentAttributeList    属性数据
      * @return
      */
-    public ArrayList<Map<String, Object>> statisticsWindTowerStatusDataFenMonth(List<WindTowerCalculationData> windTowerCalculationDatas, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerInfo> windTowerInfos, Date startDay, Date endDay) {
+    public Map<String, Object> statisticsWindTowerStatusDataFenMonth(List<WindTowerCalculationData> windTowerCalculationDatas, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerInfo> windTowerInfos, Date startDay, Date endDay) {
+       Map<String, Object> objectMap = new HashMap<>();
         ArrayList<Map<String, Object>> heightAndWsList = new ArrayList<>();
-        HashMap<String, Object> timeMap = new HashMap<>();
-        ArrayList<String> timeList = new ArrayList<>();
+        ArrayList<Map<String, Object>> timeList = new ArrayList<>();
         String[] heights = windTowerInfos.get(0).getHeights().split(",");
         int i = 0;
         for (String height : heights) {
@@ -313,18 +313,21 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
                 if (wsDayList.size() > 0) {
                     wsAve = wsDayList.stream().map(WindTowerCalculationData::getValue).reduce(BigDecimal::add).get().divide(BigDecimal.valueOf(wsDayList.size()), 2, RoundingMode.HALF_UP);
                 }
-                heightMap.put(DateUtil.format(startTime, "yyyy.M"), wsAve);
+                heightMap.put(DateUtil.format(startTime, "yyyyMM"), wsAve);
                 if (i == 0) {
-                    timeList.add(DateUtil.format(startTime, "yyyy.M"));
+                    HashMap<String, Object> timeMap = new HashMap<>();
+                    timeMap.put("value",DateUtil.format(startTime, "yyyyMM"));
+                    timeMap.put("label",DateUtil.format(startTime, "yyyy.M"));
+                    timeList.add(timeMap);
                 }
             }
             heightMap.put("height", height);
             heightAndWsList.add(heightMap);
             i++;
         }
-        timeMap.put("timeTable", timeList);
-        heightAndWsList.add(timeMap);
-        return heightAndWsList;
+        objectMap.put("timeTable", timeList);
+        objectMap.put("mainData",heightAndWsList);
+        return objectMap;
     }
 
 
@@ -350,13 +353,13 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
             List<WindTowerCalculationData> dayList = windTowerCalculationDatas.stream().filter(w -> w.getEbId().equals(equipmentAttributes.get(0).getId())).collect(Collectors.toList());
             if (dayList.size() > 0) {
                 wpdAve = dayList.stream().map(WindTowerCalculationData::getValue).reduce(BigDecimal::add).get().divide(BigDecimal.valueOf(dayList.size()), 2, RoundingMode.HALF_UP);
-                wpdMax = dayList.stream().map(WindTowerCalculationData::getValue).min(BigDecimal::compareTo).get();
-                wpdMin = dayList.stream().map(WindTowerCalculationData::getValue).max((x1, x2) -> x1.compareTo(x2)).get();
+//                wpdMax = dayList.stream().map(WindTowerCalculationData::getValue).min(BigDecimal::compareTo).get();
+//                wpdMin = dayList.stream().map(WindTowerCalculationData::getValue).max((x1, x2) -> x1.compareTo(x2)).get();
             }
 
             map.put("wpdAve", wpdAve);
-            map.put("wpdMin", wpdMax);
-            map.put("wpdMax", wpdMin);
+//            map.put("wpdMin", wpdMax);
+//            map.put("wpdMax", wpdMin);
             map.put("height", height);
             heightAndWpdList.add(map);
 
@@ -1148,7 +1151,7 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
                 proportionWd = BigDecimal.valueOf(filterWdList.size()).divide(BigDecimal.valueOf(wdList.size()), 2, RoundingMode.HALF_UP);
             }
 
-            wdMap.put(value.name(), proportionWd);
+            wdMap.put(value.name(), proportionWd.multiply(new BigDecimal(100)));
             list.add(wdMap);
         }
         return list;
@@ -1177,7 +1180,7 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
             if (sumPower.compareTo(BigDecimal.ZERO) > 0) {
                 proportionPower = sumPowerForWd.divide(sumPower, 2, RoundingMode.HALF_UP);
             }
-            powerMap.put(value.name(), proportionPower);
+            powerMap.put(value.name(), proportionPower.multiply(new BigDecimal(100)));
             list.add(powerMap);
         }
         return list;