|
@@ -1,6 +1,7 @@
|
|
|
package com.jiayue.biz.service.impl;
|
|
|
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.jiayue.biz.conf.RequestDataHelper;
|
|
@@ -29,6 +30,7 @@ import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import java.util.stream.DoubleStream;
|
|
|
|
|
|
/**
|
|
|
* 统计数据实现类
|
|
@@ -76,14 +78,13 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
/**
|
|
|
* 风功率密度和平均风速计算方法
|
|
|
*/
|
|
|
- public void calculateWindPowerDensity(Long startTime, Long endTime, String eqNo, List<Map<String, Object>> windTowerDataParentTableList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerCalculationData> windTowerCalculationDataList) {
|
|
|
+ public void calculateWindPowerDensity(Long startTime, Long endTime, String eqNo, List<ProphaseAnemometryData> prophaseAnemometryDataList, List<ProphaseWeatherData> prophaseWeatherDataList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerCalculationData> windTowerCalculationDataList) {
|
|
|
//获取对应测风塔数据
|
|
|
- List<Map<String, Object>> collect = windTowerDataParentTableList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= startTime && Long.parseLong(w.get("time").toString()) <= endTime && w.get("equipment_id").equals(eqNo)).collect(Collectors.toList());
|
|
|
+ List<ProphaseAnemometryData> anemometryDataList = prophaseAnemometryDataList.stream().filter(p -> p.getTs().getTime() >= startTime && p.getTs().getTime() <= endTime).collect(Collectors.toList());
|
|
|
+ List<ProphaseWeatherData> weatherDataList = prophaseWeatherDataList.stream().filter(p -> p.getTs().getTime() >= startTime && p.getTs().getTime() <= endTime).collect(Collectors.toList());
|
|
|
long hour = 3600000L;
|
|
|
List<WindTowerInfo> windTowerInfos = windTowerInfoService.lambdaQuery().eq(WindTowerInfo::getEquipmentNo, eqNo).list();
|
|
|
-
|
|
|
String[] height = windTowerInfos.get(0).getHeights().split(",");
|
|
|
-
|
|
|
//定义数据空集合用来装载 结果数据
|
|
|
List<WindTowerCalculationData> list = new ArrayList<>();
|
|
|
try {
|
|
@@ -98,9 +99,17 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
for (long time = startTime; time <= endTime; time += hour) {
|
|
|
//过滤出对应测风塔数据
|
|
|
long finalTime = time;
|
|
|
- List<Map<String, Object>> filterList = collect.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= finalTime && Long.parseLong(w.get("time").toString()) <= finalTime + hour - 1000 && w.get("equipment_id").equals(eqNo)).collect(Collectors.toList());
|
|
|
+ //风数据过滤
|
|
|
+ List<ProphaseAnemometryData> anemometryData = anemometryDataList.stream().filter(w -> w.getTs().getTime() >= finalTime && w.getTs().getTime() <= finalTime + hour - 1000 && w.getLayerHeight().equals(h)).collect(Collectors.toList());
|
|
|
+ //环境数据过滤
|
|
|
+ List<ProphaseWeatherData> weatherData = weatherDataList.stream().filter(w -> w.getTs().getTime() >= finalTime && w.getTs().getTime() <= finalTime + hour - 1000).collect(Collectors.toList());
|
|
|
//根据层高获取所有风速数据
|
|
|
- List<BigDecimal> bigDecimals = CalculationUtil.getWsForHeight(filterList, h);
|
|
|
+ List<BigDecimal> bigDecimals = anemometryData.stream().map((ProphaseAnemometryData p) -> {
|
|
|
+ if (p.getWsAve() != null) {
|
|
|
+ return BigDecimal.valueOf(p.getWsAve());
|
|
|
+ }
|
|
|
+ return BigDecimal.ZERO;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
|
|
//风速数据时所有计算的根本,无数据不计算
|
|
|
if (!bigDecimals.isEmpty()) {
|
|
@@ -108,7 +117,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
if (bigDecimals.get(0) == null) {
|
|
|
continue;
|
|
|
}
|
|
|
- SpeedAndDensityDto speedAndDensityDto = getSpeedAndDensityDto(bigDecimals, filterList, h);
|
|
|
+ SpeedAndDensityDto speedAndDensityDto = getSpeedAndDensityDto(bigDecimals, anemometryData, weatherData);
|
|
|
//保存风速
|
|
|
WindTowerCalculationData windTowerCalculationData = new WindTowerCalculationData();
|
|
|
windTowerCalculationData.setTime(new Date(time));
|
|
@@ -143,14 +152,13 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
* 获取风况数据(平均风速,风功率密度)
|
|
|
*
|
|
|
* @param bigDecimalList 风速数据
|
|
|
- * @param mapList 风数据
|
|
|
* @return
|
|
|
*/
|
|
|
- public SpeedAndDensityDto getSpeedAndDensityDto(List<BigDecimal> bigDecimalList, List<Map<String, Object>> mapList, String height) {
|
|
|
+ public SpeedAndDensityDto getSpeedAndDensityDto(List<BigDecimal> bigDecimalList, List<ProphaseAnemometryData> anemometryData, List<ProphaseWeatherData> weatherData) {
|
|
|
|
|
|
SpeedAndDensityDto speedAndDensityDto = new SpeedAndDensityDto();
|
|
|
speedAndDensityDto.setWindSpeed(windSpeed(bigDecimalList));
|
|
|
- speedAndDensityDto.setWindPowerDensity(CalculationUtil.windEnergyDensity(mapList, bigDecimalList, height));
|
|
|
+ speedAndDensityDto.setWindPowerDensity(CalculationUtil.windEnergyDensity(anemometryData, weatherData));
|
|
|
|
|
|
return speedAndDensityDto;
|
|
|
}
|
|
@@ -1117,7 +1125,6 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 计算日平均空气密度
|
|
|
*
|
|
@@ -1125,13 +1132,11 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
* @param endTime 结束时间
|
|
|
* @param equipmentId 设备ID
|
|
|
*/
|
|
|
- public void airDensityDay(Date startTime, Date endTime, String equipmentId, List<Map<String, Object>> mapList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerCalculationData> windTowerCalculationDataList) {
|
|
|
+ public void airDensityDay(Date startTime, Date endTime, String equipmentId, List<ProphaseWeatherData> prophaseWeatherDataList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerCalculationData> windTowerCalculationDataList) {
|
|
|
|
|
|
long startHour = startTime.getTime();
|
|
|
long endHour = endTime.getTime();
|
|
|
Long dayTime = 86400000L;
|
|
|
- //所有数据
|
|
|
- List<Map<String, Object>> collect = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= startHour && Long.parseLong(w.get("time").toString()) <= endHour && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
//空气密度属性
|
|
|
EquipmentAttribute equipmentAttribute = equipmentAttributeList.stream().filter(e -> e.getFieldName().equals("airDensity")).collect(Collectors.toList()).get(0);
|
|
|
//删除时间段所有数据
|
|
@@ -1139,24 +1144,20 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
ArrayList<WindTowerCalculationData> list = new ArrayList<>();
|
|
|
try {
|
|
|
for (long start1 = startHour; start1 < endHour; start1 = start1 + dayTime) {
|
|
|
-
|
|
|
//每天的结束时间
|
|
|
long start2 = start1 + dayTime - 1L;
|
|
|
-
|
|
|
BigDecimal airDensityDay = new BigDecimal(0);
|
|
|
long start = start1;
|
|
|
- List<Map<String, Object>> collect1 = collect.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= start && Long.parseLong(w.get("time").toString()) <= start2 && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
- for (Map<String, Object> map : collect1) {
|
|
|
- if (map.get("air_density") != null && !map.get("air_density").equals("")) {
|
|
|
- airDensityDay = airDensityDay.add(CalculationUtil.getBigDecimal(map.get("air_density")));
|
|
|
- }
|
|
|
+ List<ProphaseWeatherData> collect = prophaseWeatherDataList.stream().filter(p -> p.getTs().getTime() >= start && p.getTs().getTime() <= start2).collect(Collectors.toList());
|
|
|
+ for (ProphaseWeatherData map : collect) {
|
|
|
+ airDensityDay = airDensityDay.add(CalculationUtil.getBigDecimal(map.getAirDensity()));
|
|
|
}
|
|
|
//存平均值
|
|
|
- if (!collect1.isEmpty()) {
|
|
|
+ if (!collect.isEmpty()) {
|
|
|
WindTowerCalculationData windTowerCalculationData = new WindTowerCalculationData();
|
|
|
windTowerCalculationData.setEbId(equipmentAttribute.getId());
|
|
|
windTowerCalculationData.setTime(new Date(start1));
|
|
|
- windTowerCalculationData.setValue(airDensityDay.divide(new BigDecimal(collect1.size()), 2, RoundingMode.HALF_UP));
|
|
|
+ windTowerCalculationData.setValue(airDensityDay.divide(new BigDecimal(collect.size()), 2, RoundingMode.HALF_UP));
|
|
|
windTowerCalculationData.setEquipmentId(equipmentId);
|
|
|
windTowerCalculationDataList.add(windTowerCalculationData);
|
|
|
list.add(windTowerCalculationData);
|
|
@@ -1182,11 +1183,14 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
* @param endTime 结束时间
|
|
|
* @param equipmentId 设备id
|
|
|
*/
|
|
|
- public void wsMaxMonth(Date startTime, Date endTime, String equipmentId, List<Map<String, Object>> mapList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerInfo> windTowerInfoList) {
|
|
|
+ public void wsMaxMonth(Date startTime, Date endTime, String equipmentId, List<ProphaseAnemometryData> prophaseAnemometryDataList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerInfo> windTowerInfoList) {
|
|
|
|
|
|
//获取时间段所有统计数据
|
|
|
- List<Map<String, Object>> collects = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= startTime.getTime()
|
|
|
- && Long.parseLong(w.get("time").toString()) <= endTime.getTime() && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
+// List<Map<String, Object>> collects = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= startTime.getTime()
|
|
|
+// && Long.parseLong(w.get("time").toString()) <= endTime.getTime() && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProphaseAnemometryData> collect = prophaseAnemometryDataList.stream().filter(p -> p.getTs().getTime() >= startTime.getTime() && p.getTs().getTime() <= endTime.getTime()).collect(Collectors.toList());
|
|
|
+
|
|
|
//获取所有层高
|
|
|
String[] height = windTowerInfoList.stream().filter(w -> w.getEquipmentNo().equals(equipmentId)).collect(Collectors.toList()).get(0).getHeights().split(",");
|
|
|
ArrayList<WindTowerCalculationData> list = new ArrayList<>();
|
|
@@ -1196,16 +1200,13 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
String ebIdMonth = equipmentAttributeList.stream().filter(w -> w.getFieldName().equals(h + "maxwsMonth")).collect(Collectors.toList()).get(0).getId();
|
|
|
//删除时间段所有数据
|
|
|
removeByStartTimeBetweenAndEquipmentIdAndEbId(startTime, endTime, equipmentId, ebIdMonth);
|
|
|
- //获取时间段所有风速数据
|
|
|
- List<BigDecimal> maxList = CalculationUtil.getWsMaxForHeight(collects, h);
|
|
|
- if (!collects.isEmpty()) {
|
|
|
- List<BigDecimal> collect = maxList.stream().sorted().collect(Collectors.toList());
|
|
|
- BigDecimal max = collect.get(collect.size() - 1);
|
|
|
+ if (!collect.isEmpty()) {
|
|
|
+ BigDecimal max = CalculationUtil.getBigDecimal(collect.stream().filter(c -> c.getLayerHeight().equals(h)).mapToDouble(ProphaseAnemometryData::getWsMax).sum());
|
|
|
WindTowerCalculationData windTowerCalculationData = new WindTowerCalculationData();
|
|
|
windTowerCalculationData.setEbId(ebIdMonth);
|
|
|
windTowerCalculationData.setTime(startTime);
|
|
|
windTowerCalculationData.setEquipmentId(equipmentId);
|
|
|
- windTowerCalculationData.setValue(max);
|
|
|
+ windTowerCalculationData.setValue(max.divide(BigDecimal.valueOf(collect.size()), 2, RoundingMode.HALF_UP));
|
|
|
list.add(windTowerCalculationData);
|
|
|
} else {
|
|
|
log.info("设备编号{},{}月,{}米层高月最大风速计算失败,缺少数据^ ^", equipmentId, startTime.getMonth() + 1, h);
|
|
@@ -1511,11 +1512,10 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
* @param startTime 开始时间
|
|
|
* @param endTime 结束时间
|
|
|
* @param equipmentId 测风塔编号
|
|
|
- * @param mapList 实时数据
|
|
|
* @param equipmentAttributeList 属性表
|
|
|
* @param windTowerInfoList 测风塔数据
|
|
|
*/
|
|
|
- public void calculateStaDay(Date startTime, Date endTime, String equipmentId, List<Map<String, Object>> mapList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerInfo> windTowerInfoList) {
|
|
|
+ public void calculateStaDay(Date startTime, Date endTime, String equipmentId, List<ProphaseAnemometryData> prophaseAnemometryDataList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerInfo> windTowerInfoList) {
|
|
|
ArrayList<WindTowerCalculationData> dataList = new ArrayList<>();
|
|
|
long startHour = startTime.getTime();
|
|
|
long endHour = endTime.getTime();
|
|
@@ -1529,29 +1529,15 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
removeByStartTimeBetweenAndEquipmentIdAndEbId(startTime, endTime, equipmentId, equipmentAttributes.get(0).getId());
|
|
|
//每天循环
|
|
|
for (long time = startHour; time < endHour; time = time + Hour) {
|
|
|
- BigDecimal staSum = BigDecimal.ZERO;
|
|
|
- BigDecimal total = BigDecimal.ZERO;
|
|
|
long startDate = time;
|
|
|
//过滤一天的数据
|
|
|
- List<Map<String, Object>> mapList1 = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= startDate
|
|
|
- && Long.parseLong(w.get("time").toString()) < startDate + Hour && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
- for (Map<String, Object> map : mapList1) {
|
|
|
- String abnormal_type = "";
|
|
|
- //过滤异常值
|
|
|
- if (map.get("abnormal_type") != null) {
|
|
|
- abnormal_type = map.get("abnormal_type").toString();
|
|
|
- }
|
|
|
- if (map.get("ws_sta" + h) != null && (!abnormal_type.contains("wsSta" + h) || !abnormal_type.contains("ws_sta" + h))) {
|
|
|
- BigDecimal sta = CalculationUtil.getBigDecimal(map.get("ws_sta" + h));
|
|
|
- staSum = staSum.add(sta);
|
|
|
- total = total.add(BigDecimal.ONE);
|
|
|
- }
|
|
|
- }
|
|
|
- if (staSum.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
+ List<ProphaseAnemometryData> collect = prophaseAnemometryDataList.stream().filter(p -> p.getTs().getTime() >= startDate && p.getTs().getTime() <= startDate + Hour && p.getLayerHeight().equals(h)).collect(Collectors.toList());
|
|
|
+ BigDecimal staSum = CalculationUtil.getBigDecimal(collect.stream().filter(c -> c.getWsSta() != null && c.getWsSta() != 0).mapToDouble(ProphaseAnemometryData::getWsSta).sum());
|
|
|
+ if (collect.size() > 0) {
|
|
|
WindTowerCalculationData windTowerCalculationData = new WindTowerCalculationData();
|
|
|
windTowerCalculationData.setEquipmentId(equipmentId);
|
|
|
windTowerCalculationData.setTime(new Date(startDate));
|
|
|
- windTowerCalculationData.setValue(staSum.divide(total, 2, RoundingMode.HALF_UP));
|
|
|
+ windTowerCalculationData.setValue(staSum.divide(CalculationUtil.getBigDecimal(collect.size()), 2, RoundingMode.HALF_UP));
|
|
|
windTowerCalculationData.setEbId(equipmentAttributes.get(0).getId());
|
|
|
dataList.add(windTowerCalculationData);
|
|
|
} else {
|
|
@@ -1575,14 +1561,13 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
* @param endTime 结束时间
|
|
|
* @param equipmentId 设备id
|
|
|
*/
|
|
|
- public void turbulenceDay(Date startTime, Date endTime, String equipmentId, List<Map<String, Object>> mapList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerInfo> windTowerInfoList, List<WindTowerCalculationData> windTowerCalculationDataList) {
|
|
|
+ public void turbulenceDay(Date startTime, Date endTime, String equipmentId, List<ProphaseAnemometryData> prophaseAnemometryDataList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerInfo> windTowerInfoList, List<WindTowerCalculationData> windTowerCalculationDataList) {
|
|
|
long startHour = startTime.getTime();
|
|
|
long endHour = endTime.getTime();
|
|
|
long dayTime = 86400000L;
|
|
|
String heights = windTowerInfoList.stream().filter(w -> w.getEquipmentNo().equals(equipmentId)).collect(Collectors.toList()).get(0).getHeights();
|
|
|
String[] heightAll = heights.split(",");
|
|
|
//获取对应测风塔数据
|
|
|
- List<Map<String, Object>> collect = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= startHour && Long.parseLong(w.get("time").toString()) <= endHour && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
ArrayList<WindTowerCalculationData> list = new ArrayList<>();
|
|
|
try {
|
|
|
for (String h : heightAll) {
|
|
@@ -1595,12 +1580,14 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
long start2 = start1 + dayTime - 1L;
|
|
|
long start = start1 - 1;
|
|
|
|
|
|
- List<Map<String, Object>> maps = collect.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= start && Long.parseLong(w.get("time").toString()) <= start2 && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
-
|
|
|
+ List<ProphaseAnemometryData> collect = prophaseAnemometryDataList.stream().filter(p -> p.getTs().getTime() >= start && p.getTs().getTime() <= start2 && p.getLayerHeight().equals(h)).collect(Collectors.toList());
|
|
|
+ List<BigDecimal> wsList = new ArrayList<>();
|
|
|
+ List<BigDecimal> staList = new ArrayList<>();
|
|
|
//过滤风速平均值
|
|
|
- List<BigDecimal> wsList = CalculationUtil.getWsForHeight(maps, h);
|
|
|
- //过滤风速标差值
|
|
|
- List<BigDecimal> staList = CalculationUtil.getWsStaForHeight(maps, h);
|
|
|
+ for (ProphaseAnemometryData pro : collect) {
|
|
|
+ wsList.add(CalculationUtil.getBigDecimal(pro.getWsAve()));
|
|
|
+ staList.add(CalculationUtil.getBigDecimal(pro.getWsSta()));
|
|
|
+ }
|
|
|
BigDecimal wsSum = BigDecimal.ZERO;
|
|
|
BigDecimal staSum = BigDecimal.ZERO;
|
|
|
for (BigDecimal ws : wsList) {
|
|
@@ -1900,36 +1887,25 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
* @param startTime 开始时间
|
|
|
* @param endTime 结束时间
|
|
|
* @param equipmentId 设备Id
|
|
|
- * @param mapList 实时数据
|
|
|
* @param equipmentAttributeList 属性集合
|
|
|
*/
|
|
|
- public void tDay(Date startTime, Date endTime, String equipmentId, List<Map<String, Object>> mapList, List<EquipmentAttribute> equipmentAttributeList) {
|
|
|
+ public void tDay(Date startTime, Date endTime, String equipmentId, List<ProphaseWeatherData> prophaseWeatherDataList, List<EquipmentAttribute> equipmentAttributeList) {
|
|
|
String ebId = equipmentAttributeList.stream().filter(w -> w.getFieldName().equals("tDay")).collect(Collectors.toList()).get(0).getId();
|
|
|
long day = 86400000L;
|
|
|
ArrayList<WindTowerCalculationData> list = new ArrayList<>();
|
|
|
removeByStartTimeBetweenAndEquipmentIdAndEbId(startTime, endTime, equipmentId, ebId);
|
|
|
try {
|
|
|
for (long time = startTime.getTime(); time < endTime.getTime(); time += day) {
|
|
|
- BigDecimal tsum = BigDecimal.ZERO;
|
|
|
long dayTime = time;
|
|
|
//过滤一天数据
|
|
|
- List<Map<String, Object>> collect = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= dayTime &&
|
|
|
- Long.parseLong(w.get("time").toString()) < dayTime + day).collect(Collectors.toList());
|
|
|
- for (Map<String, Object> map : collect) {
|
|
|
- String abnormal_type = "";
|
|
|
- //过滤异常值
|
|
|
- if (map.get("abnormal_type") != null) {
|
|
|
- abnormal_type = map.get("abnormal_type").toString();
|
|
|
- }
|
|
|
- if (!abnormal_type.contains("tAve") || !abnormal_type.contains("t_ave")) {
|
|
|
- tsum = tsum.add(CalculationUtil.getBigDecimal(map.get("t_ave")));
|
|
|
- }
|
|
|
- }
|
|
|
+ List<ProphaseWeatherData> collect = prophaseWeatherDataList.stream().filter(p -> p.getTs().getTime() >= dayTime && p.getTs().getTime() < dayTime + day).collect(Collectors.toList());
|
|
|
+ //计算时间段内所有温度
|
|
|
+ BigDecimal tSum = CalculationUtil.getBigDecimal(collect.stream().filter(c -> c.getTAve() != null && c.getTAve() != 0).mapToDouble(ProphaseWeatherData::getTAve).sum());
|
|
|
if (!collect.isEmpty()) {
|
|
|
WindTowerCalculationData windTowerCalculationData = new WindTowerCalculationData();
|
|
|
windTowerCalculationData.setEbId(ebId);
|
|
|
windTowerCalculationData.setTime(new Date(dayTime));
|
|
|
- windTowerCalculationData.setValue(tsum.divide(BigDecimal.valueOf(collect.size()), 2, RoundingMode.HALF_UP));
|
|
|
+ windTowerCalculationData.setValue(tSum.divide(BigDecimal.valueOf(collect.size()), 2, RoundingMode.HALF_UP));
|
|
|
windTowerCalculationData.setEquipmentId(equipmentId);
|
|
|
list.add(windTowerCalculationData);
|
|
|
}
|
|
@@ -1949,32 +1925,20 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
* @param startTime 开始时间
|
|
|
* @param endTime 结束时间
|
|
|
* @param equipmentId 设备Id
|
|
|
- * @param mapList 实时数据
|
|
|
* @param equipmentAttributeList 属性集合
|
|
|
*/
|
|
|
- public void paDay(Date startTime, Date endTime, String equipmentId, List<Map<String, Object>> mapList, List<EquipmentAttribute> equipmentAttributeList) {
|
|
|
+ public void paDay(Date startTime, Date endTime, String equipmentId, List<ProphaseWeatherData> prophaseWeatherDataList, List<EquipmentAttribute> equipmentAttributeList) {
|
|
|
String ebId = equipmentAttributeList.stream().filter(w -> w.getFieldName().equals("paDay")).collect(Collectors.toList()).get(0).getId();
|
|
|
long day = 86400000L;
|
|
|
ArrayList<WindTowerCalculationData> list = new ArrayList<>();
|
|
|
removeByStartTimeBetweenAndEquipmentIdAndEbId(startTime, endTime, equipmentId, ebId);
|
|
|
try {
|
|
|
for (long time = startTime.getTime(); time < endTime.getTime(); time += day) {
|
|
|
- BigDecimal paSum = BigDecimal.ZERO;
|
|
|
long dayTime = time;
|
|
|
//过滤一天数据
|
|
|
- List<Map<String, Object>> collect = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= dayTime &&
|
|
|
- Long.parseLong(w.get("time").toString()) < dayTime + day).collect(Collectors.toList());
|
|
|
- for (Map<String, Object> map : collect) {
|
|
|
- String abnormal_type = "";
|
|
|
- //过滤异常值
|
|
|
- if (map.get("abnormal_type") != null) {
|
|
|
- abnormal_type = map.get("abnormal_type").toString();
|
|
|
- }
|
|
|
- if ((!abnormal_type.contains("tAve") || !abnormal_type.contains("t_ave")) && CalculationUtil.getBigDecimal(map.get("pa_ave")) != null) {
|
|
|
- paSum = paSum.add(CalculationUtil.getBigDecimal(map.get("pa_ave")));
|
|
|
- }
|
|
|
+ List<ProphaseWeatherData> collect = prophaseWeatherDataList.stream().filter(p -> p.getTs().getTime() >= dayTime && p.getTs().getTime() < dayTime + day).collect(Collectors.toList());
|
|
|
+ BigDecimal paSum = CalculationUtil.getBigDecimal(collect.stream().filter(c -> c.getPaAve() != null && c.getPaAve() != 0).mapToDouble(ProphaseWeatherData::getTAve).sum());
|
|
|
|
|
|
- }
|
|
|
if (!collect.isEmpty()) {
|
|
|
WindTowerCalculationData windTowerCalculationData = new WindTowerCalculationData();
|
|
|
windTowerCalculationData.setEbId(ebId);
|
|
@@ -1998,7 +1962,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
* 计算上一个小时 每10分钟的风切变指数
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public void calculateWindPowerShear(Date startTime, Date endTime, String equipmentId, List<Map<String, Object>> mapList, List<WindTowerCalculationData> windTowerCalculationDataList) {
|
|
|
+ public void calculateWindPowerShear(Date startTime, Date endTime, String equipmentId, List<ProphaseAnemometryData> prophaseAnemometryDataList, List<WindTowerCalculationData> windTowerCalculationDataList) {
|
|
|
log.info("开始计算小时风切变指数");
|
|
|
long startHour = startTime.getTime();
|
|
|
long endHour = endTime.getTime();
|
|
@@ -2013,7 +1977,11 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
heightMin = Integer.parseInt(getNumberFromString(h));
|
|
|
}
|
|
|
}
|
|
|
- List<Map<String, Object>> collect = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= startTime.getTime() && Long.parseLong(w.get("time").toString()) <= endTime.getTime() && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //时间段内所有风数据
|
|
|
+// List<Map<String, Object>> collect = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= startTime.getTime() && Long.parseLong(w.get("time").toString()) <= endTime.getTime() && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
+ List<ProphaseAnemometryData> prophaseAnemometryData = prophaseAnemometryDataList.stream().filter(p -> p.getTs().getTime() >= startTime.getTime() && p.getTs().getTime() <= endTime.getTime()).collect(Collectors.toList());
|
|
|
+
|
|
|
List<WindTowerCalculationData> windTowerCalculationDataList1 = windTowerCalculationDataList.stream().filter(w -> w.getTime().after(startTime) &&
|
|
|
w.getTime().before(endTime) && w.getEquipmentId().equals(equipmentId)).collect(Collectors.toList());
|
|
|
for (String h : heights) {
|
|
@@ -2030,7 +1998,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
long start2 = start1 + 3600000L;
|
|
|
|
|
|
//查询指定时间的风速数据,如果是1号0点-1点执行则查询上一个月的数据 windTowerStatusDataList key=层高 + 毫秒数 + 设备编号 + 当前日的时间 value= 每个层高的平均风速
|
|
|
- Map<String, BigDecimal> windTowerStatusDataList = queryWindForShear(new Date(start1), new Date(start2), equipmentId, collect);
|
|
|
+ Map<String, BigDecimal> windTowerStatusDataList = queryWindForShear(new Date(start1), new Date(start2), equipmentId, prophaseAnemometryData,heights);
|
|
|
//计算每10分钟的风切变指数 windTowerShearMap---> key=层高 + 设备编号 value = shear
|
|
|
Map<String, List<BigDecimal>> windTowerShearMap = traverseWindDataListCalcuShear(windTowerStatusDataList, heightMin);
|
|
|
//查询历史记录,以作更新操作 windTowerCalculationDataMap--->key= 时间 设备编号 EbId value=windTowerCalculationData(所有数据)
|
|
@@ -2195,6 +2163,35 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
return shearFieldNameList.stream().collect(Collectors.toMap(EquipmentAttribute::getFieldName, EquipmentAttribute::getId));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询当前月份的风速数据,如果是1号0点-1点执行则查询上一个月的数据
|
|
|
+ *
|
|
|
+ * @return Map<String, BigDecimal>
|
|
|
+ */
|
|
|
+ private Map<String, BigDecimal> queryWindForShear(Date startTimeOfCurrentDay, Date endTimeOfCurrentDay, String equipmentId, List<ProphaseAnemometryData> prophaseAnemometryData, String[] heights) {
|
|
|
+
|
|
|
+ Map<String, BigDecimal> windTowerStatusDataResult = new HashMap<>();
|
|
|
+// List<Map<String, Object>> collect = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= startTimeOfCurrentDay.getTime() && Long.parseLong(w.get("time").toString()) <= endTimeOfCurrentDay.getTime() && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
+ List<ProphaseAnemometryData> collect = prophaseAnemometryData.stream().filter(p -> p.getTs().getTime() >= startTimeOfCurrentDay.getTime() && p.getTs().getTime() <= endTimeOfCurrentDay.getTime()).collect(Collectors.toList());
|
|
|
+ //只取上一个小时的数据
|
|
|
+ int curentHour = startTimeOfCurrentDay.getHours();
|
|
|
+ //构造当前小时的风速map 以层高和分钟,日为key,风速为value
|
|
|
+ for (ProphaseAnemometryData map : collect) {
|
|
|
+ for (String height : heights) {
|
|
|
+ Date time = new Date(map.getTs().getTime());
|
|
|
+ if (curentHour == time.getHours()) {
|
|
|
+ //获取 毫秒数
|
|
|
+ Integer minutes = time.getMinutes();
|
|
|
+ String keyEndStr = minutes + "-" + equipmentId + "-" + DateTimeUtil.getDay(time.getTime());
|
|
|
+ windTowerStatusDataResult.put(height + "-" + keyEndStr, CalculationUtil.getBigDecimal(map.getWsAve()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return windTowerStatusDataResult;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 查询当前月份的风速数据,如果是1号0点-1点执行则查询上一个月的数据
|
|
@@ -2337,28 +2334,23 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
* @param endTime 结束时间
|
|
|
* @param equipmentId 设备id
|
|
|
*/
|
|
|
- public void staMonth(Date startTime, Date endTime, String equipmentId, List<Map<String, Object>> mapList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerInfo> windTowerInfoList) {
|
|
|
+ public void staMonth(Date startTime, Date endTime, String equipmentId, List<ProphaseAnemometryData> prophaseAnemometryDataList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerInfo> windTowerInfoList) {
|
|
|
//时间-1防止0点数据查不到
|
|
|
Date startHour = new Date(startTime.getTime() - 1);
|
|
|
- List<Map<String, Object>> collect = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= startHour.getTime() && Long.parseLong(w.get("time").toString()) <= endTime.getTime() && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
+ List<ProphaseAnemometryData> collect = prophaseAnemometryDataList.stream().filter(p -> p.getTs().getTime() >= startTime.getTime() && p.getTs().getTime() <= endTime.getTime()).collect(Collectors.toList());
|
|
|
+
|
|
|
List<WindTowerCalculationData> windTowerCalculationDataList = new ArrayList<>();
|
|
|
String h = windTowerInfoList.stream().filter(w -> w.getEquipmentNo().equals(equipmentId)).collect(Collectors.toList()).get(0).getHeights();
|
|
|
String[] heights = h.split(",");
|
|
|
//计算标差
|
|
|
for (String height : heights) {
|
|
|
List<EquipmentAttribute> equipmentAttributeList1 = equipmentAttributeList.stream().filter(e -> e.getFieldName().equals(height + "staMonth")).collect(Collectors.toList());
|
|
|
- List<BigDecimal> wsStaList = CalculationUtil.getWsStaForHeight(collect, height);
|
|
|
- BigDecimal sumSta = new BigDecimal(0);
|
|
|
- BigDecimal aveSta;
|
|
|
- if (!wsStaList.isEmpty()) {
|
|
|
- for (BigDecimal sta : wsStaList) {
|
|
|
- sumSta = sumSta.add(sta);
|
|
|
- }
|
|
|
- aveSta = sumSta.divide(new BigDecimal(wsStaList.size()), 2, RoundingMode.HALF_UP);
|
|
|
+ if (!collect.isEmpty()) {
|
|
|
+ BigDecimal sumSta = CalculationUtil.getBigDecimal(collect.stream().filter(c -> c.getLayerHeight().equals(height)).mapToDouble(ProphaseAnemometryData::getWsSta).sum());
|
|
|
WindTowerCalculationData windTowerCalculationData = new WindTowerCalculationData();
|
|
|
windTowerCalculationData.setEbId(equipmentAttributeList1.get(0).getId());
|
|
|
windTowerCalculationData.setTime(startHour);
|
|
|
- windTowerCalculationData.setValue(aveSta);
|
|
|
+ windTowerCalculationData.setValue(sumSta.divide(new BigDecimal(collect.size()), 2, RoundingMode.HALF_UP));
|
|
|
windTowerCalculationData.setEquipmentId(equipmentId);
|
|
|
windTowerCalculationDataList.add(windTowerCalculationData);
|
|
|
}
|
|
@@ -2378,14 +2370,14 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
* @param startTime 开始时间
|
|
|
* @param endTime 结束时间
|
|
|
* @param equipmentId 设备id
|
|
|
- * @param mapList 数据集合
|
|
|
* @param equipmentAttributeList 属性集合
|
|
|
*/
|
|
|
- public void environmentData(Date startTime, Date endTime, String equipmentId, List<Map<String, Object>> mapList, List<EquipmentAttribute> equipmentAttributeList) {
|
|
|
+ public void environmentData(Date startTime, Date endTime, String equipmentId, List<ProphaseWeatherData> prophaseWeatherDataList, List<EquipmentAttribute> equipmentAttributeList) {
|
|
|
try {
|
|
|
//时间-1防止0点数据查不到
|
|
|
Date startHour = new Date(startTime.getTime() - 1);
|
|
|
- List<Map<String, Object>> collect = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= startHour.getTime() && Long.parseLong(w.get("time").toString()) <= endTime.getTime() && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
+// List<Map<String, Object>> collect = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= startHour.getTime() && Long.parseLong(w.get("time").toString()) <= endTime.getTime() && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
+ List<ProphaseWeatherData> prophaseWeatherData = prophaseWeatherDataList.stream().filter(p -> p.getTs().getTime() >= startHour.getTime() && p.getTs().getTime() <= endTime.getTime()).collect(Collectors.toList());
|
|
|
|
|
|
equipmentAttributeList = equipmentAttributeList.stream().filter(w -> "environment".equals(w.getAttributeFunction())).collect(Collectors.toList());
|
|
|
BigDecimal sumPa = new BigDecimal(0);
|
|
@@ -2394,25 +2386,21 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
BigDecimal aveRh = new BigDecimal(0);
|
|
|
BigDecimal sumT = new BigDecimal(0);
|
|
|
BigDecimal aveT = new BigDecimal(0);
|
|
|
- if (!collect.isEmpty()) {
|
|
|
+ if (!prophaseWeatherData.isEmpty()) {
|
|
|
List<BigDecimal> paList = new ArrayList<>();
|
|
|
List<BigDecimal> rhList = new ArrayList<>();
|
|
|
List<BigDecimal> tList = new ArrayList<>();
|
|
|
/*计算平均值数值为null 不计算*/
|
|
|
- for (Map<String, Object> map : collect) {
|
|
|
+ for (ProphaseWeatherData map : prophaseWeatherData) {
|
|
|
String abnormal_type = "";
|
|
|
- //过滤异常值
|
|
|
- if (map.get("abnormal_type") != null) {
|
|
|
- abnormal_type = map.get("abnormal_type").toString();
|
|
|
+ if (map.getPaAve() != null && map.getPaAve() != 0) {
|
|
|
+ paList.add(CalculationUtil.getBigDecimal(map.getPaAve()));
|
|
|
}
|
|
|
- if (map.get("pa_ave") != null && !map.get("pa_ave").equals("")) {
|
|
|
- paList.add(CalculationUtil.getBigDecimal(map.get("pa_ave")));
|
|
|
+ if (map.getRhAve() != null && map.getRhAve() != 0) {
|
|
|
+ rhList.add(CalculationUtil.getBigDecimal(map.getRhAve()));
|
|
|
}
|
|
|
- if (map.get("rh_ave") != null && !map.get("rh_ave").equals("")) {
|
|
|
- rhList.add(CalculationUtil.getBigDecimal(map.get("rh_ave")));
|
|
|
- }
|
|
|
- if (map.get("t_ave") != null && !map.get("t_ave").equals("") && (!abnormal_type.contains("tAve") || !abnormal_type.contains("t_ave"))) {
|
|
|
- tList.add(CalculationUtil.getBigDecimal(map.get("t_ave")));
|
|
|
+ if (map.getTAve() != null && map.getTAve() != 0) {
|
|
|
+ tList.add(CalculationUtil.getBigDecimal(map.getTAve()));
|
|
|
}
|
|
|
}
|
|
|
/*气压*/
|
|
@@ -2538,11 +2526,10 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
* @param equipmentId 设备Id
|
|
|
* @param startTime 开始时间
|
|
|
* @param endTime 结束时间
|
|
|
- * @param mapList 实时数据
|
|
|
* @param equipmentAttributeList 属性集合
|
|
|
* @param windTowerInfoList 测风塔信息
|
|
|
*/
|
|
|
- public void turbulenceHourForMonth(String equipmentId, Date startTime, Date endTime, List<Map<String, Object>> mapList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerInfo> windTowerInfoList) {
|
|
|
+ public void turbulenceHourForMonth(String equipmentId, Date startTime, Date endTime, List<ProphaseAnemometryData> prophaseAnemometryDataList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerInfo> windTowerInfoList) {
|
|
|
String height = windTowerInfoList.stream().filter(w -> w.getEquipmentNo().equals(equipmentId)).collect(Collectors.toList()).get(0).getHeights();
|
|
|
String[] heights = height.split(",");
|
|
|
long hour = 3600000L;
|
|
@@ -2562,18 +2549,18 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
long startHour = time;
|
|
|
long endHour = time + hour;
|
|
|
//筛选小时数据
|
|
|
- List<Map<String, Object>> collect = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= startHour && Long.parseLong(w.get("time").toString()) <= endHour && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
- //循环实时数据计算总风速和标差
|
|
|
- List<BigDecimal> wsForHeight = CalculationUtil.getWsForHeight(collect, h);
|
|
|
- List<BigDecimal> wsStaForHeight = CalculationUtil.getWsStaForHeight(collect, h);
|
|
|
+// List<Map<String, Object>> collect = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= startHour && Long.parseLong(w.get("time").toString()) <= endHour && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
+ List<ProphaseAnemometryData> anemometryDataList = prophaseAnemometryDataList.stream().filter(p -> p.getTs().getTime() >= startHour && p.getTs().getTime() <= endHour && p.getLayerHeight().equals(h)).collect(Collectors.toList());
|
|
|
|
|
|
- BigDecimal wsSun = wsForHeight.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- BigDecimal staSun = wsStaForHeight.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- if (collect.size() > 0) {
|
|
|
+
|
|
|
+ if (anemometryDataList.size() > 0) {
|
|
|
BigDecimal turAve = BigDecimal.ZERO;
|
|
|
+ //循环实时数据计算总风速和标差
|
|
|
+ BigDecimal wsSun = CalculationUtil.getBigDecimal(anemometryDataList.stream().mapToDouble(ProphaseAnemometryData::getWsAve).sum());
|
|
|
+ BigDecimal staSun = CalculationUtil.getBigDecimal(anemometryDataList.stream().mapToDouble(ProphaseAnemometryData::getWsSta).sum());
|
|
|
//除以一小时的个数 求小时的平均值
|
|
|
- BigDecimal wsAve = wsSun.divide(BigDecimal.valueOf(collect.size()), 2, RoundingMode.HALF_UP);
|
|
|
- BigDecimal staAve = staSun.divide(BigDecimal.valueOf(collect.size()), 2, RoundingMode.HALF_UP);
|
|
|
+ BigDecimal wsAve = wsSun.divide(BigDecimal.valueOf(anemometryDataList.size()), 2, RoundingMode.HALF_UP);
|
|
|
+ BigDecimal staAve = staSun.divide(BigDecimal.valueOf(anemometryDataList.size()), 2, RoundingMode.HALF_UP);
|
|
|
//如果除数等于0就跳过本次循环
|
|
|
if (wsAve.compareTo(BigDecimal.ZERO) == 0 || staAve.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
continue;
|
|
@@ -2629,7 +2616,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
* @param startTime 开始时间
|
|
|
* @param endTime 结束时间
|
|
|
*/
|
|
|
- public void airDensityMonth(String equipmentId, Date startTime, Date endTime, List<Map<String, Object>> mapList) {
|
|
|
+ public void airDensityMonth(String equipmentId, Date startTime, Date endTime, List<ProphaseWeatherData> prophaseWeatherDataList) {
|
|
|
//获取ebId
|
|
|
String ebId = equipmentAttributeService.lambdaQuery().eq(EquipmentAttribute::getFieldName, "airDensityDayForYear").list().get(0).getId();
|
|
|
removeByStartTimeBetweenAndEquipmentIdAndEbId(startTime, new Date(endTime.getTime() + 86400000L), equipmentId, ebId);
|
|
@@ -2643,16 +2630,16 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
BigDecimal airSun = BigDecimal.ZERO;
|
|
|
long startHour = time;
|
|
|
long endHour = time + hour;
|
|
|
- List<Map<String, Object>> collect = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= startHour && Long.parseLong(w.get("time").toString()) <= endHour && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
-
|
|
|
- for (Map<String, Object> map : collect) {
|
|
|
+// List<Map<String, Object>> collect = mapList.stream().filter(w -> Long.parseLong(w.get("time").toString()) >= startHour && Long.parseLong(w.get("time").toString()) <= endHour && w.get("equipment_id").equals(equipmentId)).collect(Collectors.toList());
|
|
|
+ List<ProphaseWeatherData> weatherDataList = prophaseWeatherDataList.stream().filter(p -> p.getTs().getTime() >= startHour && p.getTs().getTime() <= endHour).collect(Collectors.toList());
|
|
|
+ for (ProphaseWeatherData map : weatherDataList) {
|
|
|
//过滤异常数据
|
|
|
- if (map.get("air_density") != null && !map.get("air_density").equals("")) {
|
|
|
- airSun = airSun.add(CalculationUtil.getBigDecimal(map.get("air_density")));
|
|
|
- }
|
|
|
+
|
|
|
+ airSun = airSun.add(CalculationUtil.getBigDecimal(map.getAirDensity()));
|
|
|
+
|
|
|
}
|
|
|
- if (collect.size() > 0) {
|
|
|
- BigDecimal airAve = airSun.divide(BigDecimal.valueOf(collect.size()), 2, RoundingMode.HALF_UP);
|
|
|
+ if (weatherDataList.size() > 0) {
|
|
|
+ BigDecimal airAve = airSun.divide(BigDecimal.valueOf(weatherDataList.size()), 2, RoundingMode.HALF_UP);
|
|
|
//判断map的key是否包含此小时 不包含直接加入value中 包含则相加
|
|
|
if (timeAndAirMap.get(new Date(startHour).getHours()) != null) {
|
|
|
|