|
@@ -504,10 +504,10 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
* @param equipmentId 场站编号
|
|
|
* @return Map<String, BigDecimal>
|
|
|
*/
|
|
|
- public Map<String, Object> getAirAndPaAndT(String equipmentId, String month) {
|
|
|
+ public Map<String, Object> getAirAndPaAndT(String projectId,String equipmentId, String month) {
|
|
|
List<WindTowerInfo> windTowerInfoList = windTowerInfoService.lambdaQuery().eq(WindTowerInfo::getEquipmentNo, equipmentId).list();
|
|
|
String[] wdHeight = windTowerInfoList.get(0).getWdHeights().split(",");
|
|
|
-
|
|
|
+ ProjectInfo oneProjectInfoById = projectInfoService.getOneProjectInfoById(projectId);
|
|
|
ArrayList<String> arrayList = new ArrayList(Arrays.asList(windTowerInfoList.get(0).getHeights().split(",")));
|
|
|
//层高排序
|
|
|
List<Integer> heightList = arrayList.stream().map(s -> Integer.parseInt(CalculationUtil.getNumberFromString(s))).sorted().collect(Collectors.toList());
|
|
@@ -526,7 +526,7 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
.or().eq(EquipmentAttribute::getFieldName, wdHeight[0] + "monthWdRose").list();
|
|
|
|
|
|
List<WindTowerCalculationData> windTowerCalculationDataList = windTowerCalculationDataService.getByBetweenTimeAndEquipmentIdAndEbId(yearDay, endTime, equipmentId, equipmentAttributeList);
|
|
|
- windTowerCalculationDataList = windTowerCalculationDataList.stream().filter(w -> w.getTime().getTime() >= yearDay.getTime() && w.getTime().getTime() <= endTime.getTime()).collect(Collectors.toList());
|
|
|
+ windTowerCalculationDataList = windTowerCalculationDataList.stream().filter(w -> w.getTime().getTime() >= yearDay.getTime() && w.getTime().getTime() <= endTime.getTime()).collect(Collectors.toList());
|
|
|
HashMap<String, Object> dataMap = new HashMap<>();
|
|
|
//温度
|
|
|
dataMap.put("t", this.getDataForCalculationByEb(equipmentAttributeList, windTowerCalculationDataList, "tAVE"));
|
|
@@ -540,14 +540,18 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
dataMap.put("windShear", this.getDataForCalculationByEb(equipmentAttributeList, windTowerCalculationDataList, "windShearMonth"));
|
|
|
//层高
|
|
|
dataMap.put("height", maxHeight);
|
|
|
- List<EquipmentAttribute> batteryDay1 = equipmentAttributeList.stream().filter(e -> e.getFieldName().equals("batteryDay")).collect(Collectors.toList());
|
|
|
- List<WindTowerCalculationData> calculationDataList = windTowerCalculationDataList.stream().filter(w -> w.getEbId().equals(batteryDay1.get(0).getId())).collect(Collectors.toList());
|
|
|
- BigDecimal batteryDay = calculationDataList.stream().map(WindTowerCalculationData::getValue).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- BigDecimal hourMax = batteryDay.divide(BigDecimal.valueOf(6.25), 2, RoundingMode.HALF_UP);
|
|
|
//发电量
|
|
|
- dataMap.put("battery", batteryDay);
|
|
|
+ if(StrUtil.isNotBlank(oneProjectInfoById.getProjectBasicInfo().getTPowerGeneration())){
|
|
|
+ dataMap.put("battery", oneProjectInfoById.getProjectBasicInfo().getTPowerGeneration());
|
|
|
+ }
|
|
|
//满发小时数
|
|
|
- dataMap.put("hour", hourMax);
|
|
|
+ if (StrUtil.isNotBlank(oneProjectInfoById.getProjectBasicInfo().getTAvailableHours())){
|
|
|
+ dataMap.put("hour", oneProjectInfoById.getProjectBasicInfo().getTAvailableHours());
|
|
|
+ }
|
|
|
+ if(StrUtil.isNotBlank(oneProjectInfoById.getProjectBasicInfo().getWd())){
|
|
|
+ //主风向
|
|
|
+ dataMap.put("wdSum", oneProjectInfoById.getProjectBasicInfo().getWd());
|
|
|
+ }
|
|
|
|
|
|
List<EquipmentAttribute> equipmentAttributes = equipmentAttributeList.stream().filter(e -> e.getFieldName().equals(wdHeight[0] + "monthWdRose")).collect(Collectors.toList());
|
|
|
List<WindDirectionStatisticsData> windDirectionStatisticsDataList = windDirectionStatisticsDataService.lambdaQuery().eq(WindDirectionStatisticsData::getEbId, equipmentAttributes.get(0).getId()).between(WindDirectionStatisticsData::getTime, yearDay, endTime)
|
|
@@ -560,8 +564,91 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
hashMap.put(k.getKey(), reduce);
|
|
|
}
|
|
|
Map.Entry<String, BigDecimal> stringBigDecimalEntry = hashMap.entrySet().stream().max(Comparator.comparing(Map.Entry::getValue)).get();
|
|
|
- //主风向
|
|
|
- dataMap.put("wdSum", stringBigDecimalEntry.getKey());
|
|
|
+ //起止时间
|
|
|
+ Map<String, Long> dataTimeStartAndEnd = prophaseWeatherDataService.getDataTimeStartAndEnd(equipmentId);
|
|
|
+ String startTime = DateUtil.format(new Date(dataTimeStartAndEnd.get("startTime")), "yyyy-MM-dd");
|
|
|
+ String endTimeStr = DateUtil.format(endTime, "yyyy-MM-dd");
|
|
|
+ dataMap.put("dataTime", startTime + "-" + endTimeStr);
|
|
|
+ dataMap.put("longitude", windTowerInfoList.get(0).getLongitude());
|
|
|
+ dataMap.put("latitude", windTowerInfoList.get(0).getLatitude());
|
|
|
+
|
|
|
+ return dataMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 首页空气密度、温度、压强平均值 湍流 风切变 满发小时数 日发电量 经纬度 数据起止时间
|
|
|
+ *
|
|
|
+ * @param equipmentId 场站编号
|
|
|
+ * @return Map<String, BigDecimal>
|
|
|
+ */
|
|
|
+ public Map<String, Object> selectStationTForAir(String stationId, String equipmentId, String month) {
|
|
|
+ List<WindTowerInfo> windTowerInfoList = windTowerInfoService.lambdaQuery().eq(WindTowerInfo::getEquipmentNo, equipmentId).list();
|
|
|
+ List<FanModelData> fanModelDataList = fanModelDataService.getFanModelDataList().stream().filter(f -> f.getStationId().equals(stationId)).collect(Collectors.toList());
|
|
|
+
|
|
|
+ StationInfo stationInfo = stationInfoService.getOneStationInfo(stationId);
|
|
|
+
|
|
|
+
|
|
|
+ String[] wdHeight = windTowerInfoList.get(0).getWdHeights().split(",");
|
|
|
+
|
|
|
+ ArrayList<String> arrayList = new ArrayList(Arrays.asList(windTowerInfoList.get(0).getHeights().split(",")));
|
|
|
+ //层高排序
|
|
|
+ List<Integer> heightList = arrayList.stream().map(s -> Integer.parseInt(CalculationUtil.getNumberFromString(s))).sorted().collect(Collectors.toList());
|
|
|
+ Integer maxHeight = heightList.get(heightList.size() - 1);
|
|
|
+ //获取最后一条记录
|
|
|
+ WindTowerCalculationData lastDataCalculation = windTowerCalculationDataService.getLastDataCalculation(equipmentId);
|
|
|
+
|
|
|
+ Date yearDay = DateTimeUtil.getYearDay(lastDataCalculation.getTime().getTime());
|
|
|
+ //获取去年月份开始时间
|
|
|
+// Date beginTime = DateUtil.offsetMonth(DateUtil.beginOfMonth(yearDay), 1);
|
|
|
+ Date endTime = lastDataCalculation.getTime();
|
|
|
+
|
|
|
+ List<EquipmentAttribute> equipmentAttributeList = equipmentAttributeService.lambdaQuery().eq(EquipmentAttribute::getFieldName, "airDensityMonth").or().eq(EquipmentAttribute::getFieldName, "tAVE").or().
|
|
|
+ eq(EquipmentAttribute::getFieldName, "paAVE").or().eq(EquipmentAttribute::getFieldName, maxHeight + "turbulenceMonth").or().
|
|
|
+ eq(EquipmentAttribute::getFieldName, "windShearMonth").or().eq(EquipmentAttribute::getFieldName, "batteryDay")
|
|
|
+ .or().eq(EquipmentAttribute::getFieldName, wdHeight[0] + "monthWdRose").list();
|
|
|
+
|
|
|
+ List<WindTowerCalculationData> windTowerCalculationDataList = windTowerCalculationDataService.getByBetweenTimeAndEquipmentIdAndEbId(yearDay, endTime, equipmentId, equipmentAttributeList);
|
|
|
+ windTowerCalculationDataList = windTowerCalculationDataList.stream().filter(w -> w.getTime().getTime() >= yearDay.getTime() && w.getTime().getTime() <= endTime.getTime()).collect(Collectors.toList());
|
|
|
+ HashMap<String, Object> dataMap = new HashMap<>();
|
|
|
+ //温度
|
|
|
+ dataMap.put("t", this.getDataForCalculationByEb(equipmentAttributeList, windTowerCalculationDataList, "tAVE"));
|
|
|
+ //空气密度
|
|
|
+ dataMap.put("air", this.getDataForCalculationByEb(equipmentAttributeList, windTowerCalculationDataList, "airDensityMonth"));
|
|
|
+ //压强
|
|
|
+ dataMap.put("pa", this.getDataForCalculationByEb(equipmentAttributeList, windTowerCalculationDataList, "paAVE"));
|
|
|
+ //湍流
|
|
|
+ dataMap.put("turbulence", this.getDataForCalculationByEb(equipmentAttributeList, windTowerCalculationDataList, maxHeight + "turbulenceMonth"));
|
|
|
+ //风切变
|
|
|
+ dataMap.put("windShear", this.getDataForCalculationByEb(equipmentAttributeList, windTowerCalculationDataList, "windShearMonth"));
|
|
|
+ //层高
|
|
|
+ dataMap.put("height", maxHeight);
|
|
|
+
|
|
|
+
|
|
|
+ if (fanModelDataList.size() > 0) {
|
|
|
+ BigDecimal hourMax = BigDecimal.ZERO;
|
|
|
+ //年发电量
|
|
|
+ String generatingCapacity = fanModelDataList.get(0).getGeneratingCapacity();
|
|
|
+ if (StrUtil.isNotBlank(stationInfo.getStationBasicInfo().getCapacity())) {
|
|
|
+ hourMax = new BigDecimal(generatingCapacity).divide(new BigDecimal(stationInfo.getStationBasicInfo().getCapacity()), 2, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
+ //发电量
|
|
|
+ dataMap.put("battery", generatingCapacity);
|
|
|
+ //满发小时数
|
|
|
+ dataMap.put("hour", hourMax);
|
|
|
+ //主风向
|
|
|
+ dataMap.put("wdSum", fanModelDataList.get(0).getWdSum());
|
|
|
+ }
|
|
|
+ List<EquipmentAttribute> equipmentAttributes = equipmentAttributeList.stream().filter(e -> e.getFieldName().equals(wdHeight[0] + "monthWdRose")).collect(Collectors.toList());
|
|
|
+ List<WindDirectionStatisticsData> windDirectionStatisticsDataList = windDirectionStatisticsDataService.lambdaQuery().eq(WindDirectionStatisticsData::getEbId, equipmentAttributes.get(0).getId()).between(WindDirectionStatisticsData::getTime, yearDay, endTime)
|
|
|
+ .eq(WindDirectionStatisticsData::getEquipmentId, equipmentId).list();
|
|
|
+
|
|
|
+ Map<String, List<WindDirectionStatisticsData>> collect = windDirectionStatisticsDataList.stream().collect(Collectors.groupingBy(w -> w.getDirection()));
|
|
|
+ HashMap<String, BigDecimal> hashMap = new HashMap<>();
|
|
|
+ for (Map.Entry<String, List<WindDirectionStatisticsData>> k : collect.entrySet()) {
|
|
|
+ BigDecimal reduce = k.getValue().stream().map(WindDirectionStatisticsData::getValue).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ hashMap.put(k.getKey(), reduce);
|
|
|
+ }
|
|
|
+
|
|
|
//起止时间
|
|
|
Map<String, Long> dataTimeStartAndEnd = prophaseWeatherDataService.getDataTimeStartAndEnd(equipmentId);
|
|
|
String startTime = DateUtil.format(new Date(dataTimeStartAndEnd.get("startTime")), "yyyy-MM-dd");
|
|
@@ -962,14 +1049,14 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
map.put("modelType", key);
|
|
|
//风机数量
|
|
|
map.put("modelTotal", size);
|
|
|
- //满发小时数
|
|
|
+ //平均风速
|
|
|
map.put("wsAve", fanModelData.getWsAve());
|
|
|
//主风向
|
|
|
map.put("wdSum", fanModelData.getWdSum());
|
|
|
//发电量
|
|
|
map.put("generatingCapacity", fanModelData.getGeneratingCapacity());
|
|
|
- //满发小时数
|
|
|
- map.put("realTimeTotal", fanModelData.getRealTimeTotal());
|
|
|
+ //等效小时数
|
|
|
+ map.put("realTimeTotal", size == 0 ? 0 : new BigDecimal(fanModelData.getGeneratingCapacity()).divide(BigDecimal.valueOf(size), 2, RoundingMode.HALF_UP));
|
|
|
arrayList.add(map);
|
|
|
|
|
|
}
|