|
@@ -62,6 +62,8 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
private final ProphaseAnemometryDataMapper prophaseAnemometryDataMapper;
|
|
|
private final ProphaseWeatherDataMapper prophaseWeatherDataMapper;
|
|
|
|
|
|
+ private final ProphaseWeatherDataService prophaseWeatherDataService;
|
|
|
+
|
|
|
private final OtherStationInfoService otherStationInfoService;
|
|
|
|
|
|
|
|
@@ -549,14 +551,22 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
public Map<String, Object> getAirAndPaAndT(String equipmentId, String month) {
|
|
|
List<ProphaseWeatherData> weatherDataList = new ArrayList<>();
|
|
|
List<ProphaseAnemometryData> anemometryDataList = new ArrayList<>();
|
|
|
-
|
|
|
+ Map<String, Long> dataTimeStartAndEnd = prophaseWeatherDataService.getDataTimeStartAndEnd(equipmentId);
|
|
|
+ WindTowerInfo windTowerInfo = windTowerInfoService.getByEquipmentNo(equipmentId).get(0);
|
|
|
+ String height;
|
|
|
+ String[] strings = windTowerInfo.getHeights().split(",");
|
|
|
+ height = CalculationUtil.getNumberFromString(strings[0]);
|
|
|
+ String minHeight = CalculationUtil.getNumberFromString(strings[strings.length - 1]); //最底层
|
|
|
+ if (windTowerInfo.getDisplayHeight() != null && !windTowerInfo.getDisplayHeight().equals("")) {
|
|
|
+ height = windTowerInfo.getDisplayHeight();
|
|
|
+ }
|
|
|
if (!month.equals("")) {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
try {
|
|
|
Date startDate = sdf.parse(month);
|
|
|
Date endDate = DateTimeUtil.endOfMonth(startDate);
|
|
|
weatherDataList = prophaseWeatherDataMapper.selectTAveAndPaAveAndAir(equipmentId, new Timestamp(startDate.getTime()), new Timestamp(endDate.getTime()));
|
|
|
- anemometryDataList = prophaseAnemometryDataMapper.selectAveAndSta(equipmentId, new Timestamp(startDate.getTime()), new Timestamp(endDate.getTime()));
|
|
|
+ anemometryDataList = prophaseAnemometryDataMapper.selectWdAveAndWdAveAndWsStaForHeight(equipmentId, new Timestamp(startDate.getTime()), new Timestamp(endDate.getTime()), height);
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -566,17 +576,7 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
DateTime startTime = DateUtil.beginOfDay(new Date(timeEnd.getTime()));
|
|
|
// 最新一天数据
|
|
|
weatherDataList = prophaseWeatherDataMapper.selectTAveAndPaAveAndAir(equipmentId, new Timestamp(startTime.getTime()), timeEnd);
|
|
|
- anemometryDataList = prophaseAnemometryDataMapper.selectAveAndSta(equipmentId, new Timestamp(startTime.getTime()), timeEnd);
|
|
|
- }
|
|
|
- WindTowerInfo windTowerInfo = windTowerInfoService.getByEquipmentNo(equipmentId).get(0);
|
|
|
-
|
|
|
-
|
|
|
- String height;
|
|
|
- String[] strings = windTowerInfo.getHeights().split(",");
|
|
|
- height = CalculationUtil.getNumberFromString(strings[0]);
|
|
|
- String minHeight = CalculationUtil.getNumberFromString(strings[strings.length - 1]); //最底层
|
|
|
- if (windTowerInfo.getDisplayHeight() != null && !windTowerInfo.getDisplayHeight().equals("")) {
|
|
|
- height = windTowerInfo.getDisplayHeight();
|
|
|
+ anemometryDataList = prophaseAnemometryDataMapper.selectWdAveAndWdAveAndWsStaForHeight(equipmentId, new Timestamp(startTime.getTime()), timeEnd, height);
|
|
|
}
|
|
|
|
|
|
HashMap<String, Object> dataMap = new HashMap<>();
|
|
@@ -585,16 +585,15 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
BigDecimal pa = BigDecimal.ZERO;
|
|
|
|
|
|
// 风速集合
|
|
|
- String finalHeight = height;
|
|
|
- List<BigDecimal> wsForHeight = anemometryDataList.stream().filter(a -> a.getLayerHeight().equals(finalHeight)).map(h -> {
|
|
|
+ List<BigDecimal> wsForHeight = anemometryDataList.stream().map(h -> {
|
|
|
return BigDecimal.valueOf(h.getWsAve());
|
|
|
}).collect(Collectors.toList());
|
|
|
-
|
|
|
- List<BigDecimal> minWsForHeight = anemometryDataList.stream().filter(a -> a.getLayerHeight().equals(minHeight)).map(h -> {
|
|
|
+ //最小风速集合
|
|
|
+ List<BigDecimal> minWsForHeight = anemometryDataList.stream().map(h -> {
|
|
|
return BigDecimal.valueOf(h.getWsAve());
|
|
|
}).collect(Collectors.toList());
|
|
|
// 风速标准差集合
|
|
|
- List<BigDecimal> wsStaForHeight = anemometryDataList.stream().filter(a -> a.getLayerHeight().equals(minHeight)).map(h -> {
|
|
|
+ List<BigDecimal> wsStaForHeight = anemometryDataList.stream().map(h -> {
|
|
|
return BigDecimal.valueOf(h.getWsSta());
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
@@ -606,21 +605,32 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
if (avgWs.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
windShear = CalculationUtil.caWindShear(avgWs, avgMinWs, new BigDecimal(height), new BigDecimal(minHeight));// 风切变
|
|
|
}
|
|
|
- if(!weatherDataList.isEmpty()){
|
|
|
+ if (!weatherDataList.isEmpty()) {
|
|
|
|
|
|
- airDensity = BigDecimal.valueOf(weatherDataList.stream().map(w -> {
|
|
|
+ airDensity = BigDecimal.valueOf(weatherDataList.stream().map(w -> {
|
|
|
return BigDecimal.valueOf(w.getAirDensity());
|
|
|
- }).collect(Collectors.averagingDouble(BigDecimal::doubleValue))).setScale(2,RoundingMode.HALF_UP);
|
|
|
+ }).collect(Collectors.averagingDouble(BigDecimal::doubleValue))).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
|
- tAve = BigDecimal.valueOf(weatherDataList.stream().map(w -> {
|
|
|
+ tAve = BigDecimal.valueOf(weatherDataList.stream().map(w -> {
|
|
|
return BigDecimal.valueOf(w.getTAve());
|
|
|
- }).collect(Collectors.averagingDouble(BigDecimal::doubleValue))).setScale(2,RoundingMode.HALF_UP);
|
|
|
+ }).collect(Collectors.averagingDouble(BigDecimal::doubleValue))).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
|
- pa = BigDecimal.valueOf(weatherDataList.stream().map(w -> {
|
|
|
+ pa = BigDecimal.valueOf(weatherDataList.stream().map(w -> {
|
|
|
return BigDecimal.valueOf(w.getPaAve());
|
|
|
- }).collect(Collectors.averagingDouble(BigDecimal::doubleValue))).setScale(2,RoundingMode.HALF_UP);
|
|
|
+ }).collect(Collectors.averagingDouble(BigDecimal::doubleValue))).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
+ HashMap<String, Integer> wdMap = new HashMap<>();
|
|
|
+ for (WindDirectionEnum value : WindDirectionEnum.values()) {
|
|
|
+ List<ProphaseAnemometryData> forHeightAndWindDirectionEnum = CalculationUtil.getForHeightAndWindDirectionEnum(anemometryDataList, value);
|
|
|
+ wdMap.put(value.name(), forHeightAndWindDirectionEnum.size());
|
|
|
+ }
|
|
|
+ Integer total = 0;
|
|
|
+ for (Map.Entry<String, Integer> entry : wdMap.entrySet()) {
|
|
|
+ if(entry.getValue() >= total){
|
|
|
+ dataMap.put("wdSum", entry.getKey());
|
|
|
+ total = entry.getValue();
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
BigDecimal batterySum = BigDecimal.ZERO;
|
|
|
for (BigDecimal ws : wsForHeight) {
|
|
|
// 日发电量 = 风速*功率*塔个数*频率 累加至24小时
|
|
@@ -633,6 +643,12 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
BigDecimal hourMax = batterySum.divide(BigDecimal.valueOf(6.25), 2, RoundingMode.HALF_UP);
|
|
|
dataMap.put("battery", batterySum);
|
|
|
dataMap.put("hour", hourMax);
|
|
|
+ String startTime = DateUtil.format(new Date(dataTimeStartAndEnd.get("startTime")), "yyyy-MM-dd");
|
|
|
+ String endTime = DateUtil.format(new Date(dataTimeStartAndEnd.get("endTime")), "yyyy-MM-dd");
|
|
|
+
|
|
|
+ dataMap.put("dataTime", startTime + "-" + endTime);
|
|
|
+ dataMap.put("longitude", windTowerInfo.getLongitude());
|
|
|
+ dataMap.put("latitude", windTowerInfo.getLatitude());
|
|
|
|
|
|
dataMap.put("t", tAve);
|
|
|
dataMap.put("air", airDensity);
|
|
@@ -882,8 +898,8 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
otherStationList.add(hashMap);
|
|
|
|
|
|
}
|
|
|
- dataMap.put("HDStation",stationList);
|
|
|
- dataMap.put("otherStation",otherStationList);
|
|
|
+ dataMap.put("HDStation", stationList);
|
|
|
+ dataMap.put("otherStation", otherStationList);
|
|
|
|
|
|
return dataMap;
|
|
|
}
|