|
@@ -10,6 +10,7 @@ import com.jiayue.biz.util.CalculationUtil;
|
|
|
import com.jiayue.biz.util.DateMomentUtil;
|
|
|
import com.jiayue.biz.util.DateTimeUtil;
|
|
|
import com.jiayue.common.core.redis.RedisCache;
|
|
|
+import com.jiayue.common.core.text.Convert;
|
|
|
import com.jiayue.common.utils.DateUtil;
|
|
|
import flanagan.analysis.ProbabilityPlot;
|
|
|
import lombok.AllArgsConstructor;
|
|
@@ -145,15 +146,15 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
|
|
|
Map<String, Object> airDensity = getAirDensity(weatherCollectMonthMap, equipmentAttributeMap, startDay, endDay);
|
|
|
map.put("airDensity", airDensity);
|
|
|
log.info("设备:{} 生成报告,空气密度 完成时间:{}", equipmentId, cn.hutool.core.date.DateUtil.now());
|
|
|
- //获取风切变指数(风向玫瑰图)
|
|
|
+ //6.获取风切变指数(风向玫瑰图)
|
|
|
List<Map<String, Object>> windShearRose = getWindShearRose(windDirectionStatisticsDataList, equipmentAttributeMap, height);
|
|
|
map.put("windShearRose", windShearRose);
|
|
|
log.info("设备:{} 生成报告,获取风切变指数(风向玫瑰图) 完成时间:{}", equipmentId, cn.hutool.core.date.DateUtil.now());
|
|
|
- //风切变日/年变化
|
|
|
+ //6.风切变日/年变化
|
|
|
Map<String, Object> windShear = getWindShear(weatherCollectMonthMap, equipmentAttributeMap, height);
|
|
|
map.put("windShear", windShear);
|
|
|
log.info("设备:{} 生成报告,风切变日/年变化 完成时间:{}", equipmentId, cn.hutool.core.date.DateUtil.now());
|
|
|
- //湍流曲线
|
|
|
+ //7.湍流曲线
|
|
|
List<List<BigDecimal>> turIntensityCharts = getTurIntensityCharts(weatherCollectMonthMap, equipmentAttributeMap, height);
|
|
|
map.put("turIntensityCharts", turIntensityCharts);
|
|
|
log.info("设备:{} 生成报告,湍流曲线 完成时间:{}", equipmentId, cn.hutool.core.date.DateUtil.now());
|
|
@@ -1389,7 +1390,7 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
|
|
|
}
|
|
|
// 获取风向统计数据
|
|
|
List<WindDirectionStatisticsData> shearList = windDirectionStatisticsData.stream()
|
|
|
- .filter(e -> e.getEbId().equals(shearEquipmentAttribute.getId()) && null != e.getValue() && e.getValue().doubleValue() > 0).collect(Collectors.toList());
|
|
|
+ .filter(e -> e.getEbId().equals(shearEquipmentAttribute.getId()) && null != e.getValue() && e.getValue().doubleValue() >= 0).collect(Collectors.toList());
|
|
|
|
|
|
for (WindDirectionEnum value : WindDirectionEnum.values()) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -1401,8 +1402,11 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
|
|
|
BigDecimal sumShear = null;
|
|
|
if (!filterShearValueList.isEmpty()) {
|
|
|
sumShear = filterShearValueList.stream().reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ map.put(value.name(), sumShear);
|
|
|
+ } else {
|
|
|
+ map.put(value.name(), BigDecimal.ZERO);
|
|
|
}
|
|
|
- map.put(value.name(), sumShear.divide(BigDecimal.valueOf(filterShearValueList.size()), 2, RoundingMode.HALF_UP));
|
|
|
+
|
|
|
list.add(map);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -1425,8 +1429,6 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
|
|
|
List<BigDecimal> dayResults = new ArrayList<>();//日变化
|
|
|
List<BigDecimal> yearResults = new ArrayList<>();//年变化
|
|
|
List<String> monthTimeList = new ArrayList<>();
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("M");
|
|
|
|
|
|
String shearFieldName = "windShear";
|
|
|
EquipmentAttribute shearEquipmentAttribute = equipmentAttributeMap.get(shearFieldName);
|
|
@@ -1444,20 +1446,20 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
|
|
|
log.error("空气密度 查询 tAVEData 为空");
|
|
|
return map;
|
|
|
}
|
|
|
+ windTowerCalculationDataList = windTowerCalculationDataList.stream().filter(s -> null != s.getValue() && s.getValue().doubleValue() > 0).collect(Collectors.toList());
|
|
|
/*日变化*/
|
|
|
- long startTime1 = DateMomentUtil.getDayStartTime(DateUtils.addDays(new Date(), -1).getTime());
|
|
|
- long endTime1 = startTime1 + 86399000L;
|
|
|
- for (long time = startTime1; time <= endTime1; time += 3600000L) {
|
|
|
- Long finalTime = time;
|
|
|
- String format = simpleDateFormat.format(finalTime);
|
|
|
- List<BigDecimal> collect = windTowerCalculationDataList.stream().filter(s -> simpleDateFormat.format(s.getTime())
|
|
|
- .equals(format) && s.getValue() != null && s.getValue().compareTo(new BigDecimal(-99)) != 0)
|
|
|
- .map(WindTowerCalculationData::getValue).collect(Collectors.toList());
|
|
|
- BigDecimal ave = new BigDecimal(0);
|
|
|
- if (!collect.isEmpty()) {
|
|
|
- ave = collect.stream().reduce(BigDecimal.ZERO, BigDecimal::add).divide(BigDecimal.valueOf(collect.size()), 3, RoundingMode.HALF_UP);
|
|
|
- }
|
|
|
+ Map<String, List<WindTowerCalculationData>> collectDayHour = windTowerCalculationDataList.stream().collect(Collectors.groupingBy(x -> DateTimeUtil.getFormatDateStrForHour(x.getTime().getTime())));
|
|
|
|
|
|
+ String dayHour = "";
|
|
|
+ for (int i = 0; i < 24; i++) {
|
|
|
+ if (i < 10) {
|
|
|
+ dayHour = "0" + i;
|
|
|
+ } else {
|
|
|
+ dayHour = Convert.toStr(i, "25");
|
|
|
+ }
|
|
|
+ List<WindTowerCalculationData> windTowerCalculationDataHour = collectDayHour.get(dayHour);
|
|
|
+ List<BigDecimal> collect = windTowerCalculationDataHour.stream().map(WindTowerCalculationData::getValue).collect(Collectors.toList());
|
|
|
+ BigDecimal ave = collect.stream().reduce(BigDecimal.ZERO, BigDecimal::add).divide(BigDecimal.valueOf(collect.size()), 3, RoundingMode.HALF_UP);
|
|
|
dayResults.add(ave);
|
|
|
}
|
|
|
BigDecimal dayAve = new BigDecimal(0);
|
|
@@ -1467,18 +1469,36 @@ public class PdfServiceImpl extends ServiceImpl<WindTowerDataParentTableMapper,
|
|
|
map.put("dayShear", dayResults);
|
|
|
map.put("aveDayShear", dayAve);
|
|
|
/*年变化*/
|
|
|
- for (int i = 1; i <= 12; i++) {
|
|
|
- //过滤时间区间集合
|
|
|
- List<WindTowerCalculationData> filterList = new ArrayList<>();
|
|
|
- BigDecimal yearShear = new BigDecimal(0);
|
|
|
- int finalI = i;
|
|
|
- filterList = windTowerCalculationDataList.stream().filter(w -> sdf.format(w.getTime()).equals(String.valueOf(finalI))).collect(Collectors.toList());
|
|
|
- if (!filterList.isEmpty()) {
|
|
|
- List<BigDecimal> collect = filterList.stream().map(WindTowerCalculationData::getValue).collect(Collectors.toList());
|
|
|
- yearShear = collect.stream().reduce(BigDecimal.ZERO, BigDecimal::add).divide(BigDecimal.valueOf(collect.size()), 3, RoundingMode.HALF_UP);
|
|
|
+ String shearDayFieldName = "windShearDay";
|
|
|
+ EquipmentAttribute shearDayEquipmentAttribute = equipmentAttributeMap.get(shearDayFieldName);
|
|
|
+ if (null == shearEquipmentAttribute) {
|
|
|
+ log.error("获取风切变指数(风向玫瑰图) 属性:{} 不存在数据", shearDayFieldName);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ String dayEbId = shearDayEquipmentAttribute.getId(); //属性id
|
|
|
+ List<WindTowerCalculationData> windTowerDayCalculationDataList = weatherCollectMonthMap.get(dayEbId);
|
|
|
+ if (null != windTowerDayCalculationDataList && windTowerDayCalculationDataList.size() > 0) {
|
|
|
+ Map<String, List<WindTowerCalculationData>> collectMonth = windTowerDayCalculationDataList.stream().collect(Collectors.groupingBy(x -> DateTimeUtil.getFormatDateStrForMonthStr(x.getTime().getTime())));
|
|
|
+ String month = "";
|
|
|
+ for (int i = 1; i <= 12; i++) {
|
|
|
+ if (i < 10) {
|
|
|
+ month = "0" + i;
|
|
|
+ } else {
|
|
|
+ month = Convert.toStr(i, "00");
|
|
|
+ }
|
|
|
+ List<WindTowerCalculationData> windTowerCalculationDataMonth = collectMonth.get(month);
|
|
|
+ if (null == windTowerCalculationDataMonth || windTowerCalculationDataMonth.size() == 0) {
|
|
|
+ //yearResults.add(BigDecimal.ZERO);
|
|
|
+ monthTimeList.add(i + "月");
|
|
|
+ } else {
|
|
|
+ List<BigDecimal> collect = windTowerCalculationDataMonth.stream().map(WindTowerCalculationData::getValue).collect(Collectors.toList());
|
|
|
+ BigDecimal yearShear = collect.stream().reduce(BigDecimal.ZERO, BigDecimal::add).divide(BigDecimal.valueOf(collect.size()), 3, RoundingMode.HALF_UP);
|
|
|
+ yearResults.add(yearShear);
|
|
|
+ monthTimeList.add(i + "月");
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- yearResults.add(yearShear);
|
|
|
- monthTimeList.add(i + "月");
|
|
|
}
|
|
|
BigDecimal aveYearShear = new BigDecimal(0);
|
|
|
List<BigDecimal> collect = yearResults.stream().filter(w -> w.compareTo(new BigDecimal(0)) != 0).collect(Collectors.toList());
|