|
@@ -84,10 +84,10 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
*/
|
|
|
public ArrayList<WindTowerCalculationData> calculateWindPowerDensity(Long startTime, Long endTime, String eqNo, List<ProphaseAnemometryData> prophaseAnemometryDataList, List<ProphaseWeatherData> prophaseWeatherDataList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerCalculationData> windTowerCalculationDataList) {
|
|
|
//获取对应测风塔数据
|
|
|
- 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());
|
|
|
+ List<ProphaseAnemometryData> anemometryDataList = prophaseAnemometryDataList.stream().filter(p -> p.getTs().getTime() >= startTime && p.getTs().getTime() <= endTime && p.getWsAve() != null && p.getWsAve() != -99).collect(Collectors.toList());
|
|
|
+ List<ProphaseWeatherData> weatherDataList = prophaseWeatherDataList.stream().filter(p -> p.getTs().getTime() >= startTime && p.getTs().getTime() <= endTime && p.getAirDensity() != null && p.getAirDensity() >= 0).collect(Collectors.toList());
|
|
|
long hour = 3600000L;
|
|
|
- List<WindTowerInfo> windTowerInfos = windTowerInfoService.getByEquipmentNo(eqNo);
|
|
|
+ List<WindTowerInfo> windTowerInfos = windTowerInfoService.lambdaQuery().eq(WindTowerInfo::getEquipmentNo, eqNo).list();
|
|
|
String[] height = windTowerInfos.get(0).getHeights().split(",");
|
|
|
//定义数据空集合用来装载 结果数据
|
|
|
ArrayList<WindTowerCalculationData> list = new ArrayList<>();
|
|
@@ -131,13 +131,16 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
windTowerCalculationDataList.add(windTowerCalculationData);
|
|
|
list.add(windTowerCalculationData);
|
|
|
//保存风功率密度
|
|
|
- WindTowerCalculationData windTowerCalculationDataWpd = new WindTowerCalculationData();
|
|
|
- windTowerCalculationDataWpd.setTime(new Date(time));
|
|
|
- windTowerCalculationDataWpd.setEbId(equipmentAttributeWpd.getId());
|
|
|
- windTowerCalculationDataWpd.setEquipmentId(eqNo);
|
|
|
- windTowerCalculationDataWpd.setValue(speedAndDensityDto.getWindPowerDensity());
|
|
|
- windTowerCalculationDataList.add(windTowerCalculationDataWpd);
|
|
|
- list.add(windTowerCalculationDataWpd);
|
|
|
+ if (speedAndDensityDto.getWindPowerDensity().compareTo(BigDecimal.ZERO) != 0) {
|
|
|
+ WindTowerCalculationData windTowerCalculationDataWpd = new WindTowerCalculationData();
|
|
|
+ windTowerCalculationDataWpd.setTime(new Date(time));
|
|
|
+ windTowerCalculationDataWpd.setEbId(equipmentAttributeWpd.getId());
|
|
|
+ windTowerCalculationDataWpd.setEquipmentId(eqNo);
|
|
|
+ windTowerCalculationDataWpd.setValue(speedAndDensityDto.getWindPowerDensity());
|
|
|
+ windTowerCalculationDataList.add(windTowerCalculationDataWpd);
|
|
|
+ list.add(windTowerCalculationDataWpd);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -194,7 +197,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
.map(p -> CalculationUtil.getBattery(BigDecimal.valueOf(p.getWsAve()))).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
//日发电量
|
|
|
- if(batterySum.compareTo(BigDecimal.ZERO) != 0){
|
|
|
+ if (batterySum.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
batterySum = batterySum.divide(BigDecimal.valueOf(6 * 1000), 2, RoundingMode.HALF_UP);
|
|
|
|
|
|
WindTowerCalculationData windTowerCalculationData = new WindTowerCalculationData();
|
|
@@ -423,7 +426,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
ArrayList<Object> arrList = new ArrayList<>();
|
|
|
//装平均值
|
|
|
ArrayList<Object> list1 = new ArrayList<>();
|
|
|
- List<WindTowerInfo> windTowerInfos = windTowerInfoService.getByEquipmentNo(eqId);
|
|
|
+ List<WindTowerInfo> windTowerInfos = windTowerInfoService.lambdaQuery().eq(WindTowerInfo::getEquipmentNo, eqId).list();
|
|
|
if (height == null || height.equals("")) {
|
|
|
for (WindTowerInfo windTowerInfo : windTowerInfos) {
|
|
|
height = windTowerInfo.getHeights();
|
|
@@ -501,29 +504,19 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
String fieldName = "airDensityMonth";
|
|
|
List<EquipmentAttribute> densityTypeList = equipmentAttributeService.lambdaQuery().eq(EquipmentAttribute::getFieldName, fieldName).list();
|
|
|
String densityId = densityTypeList.get(0).getId();
|
|
|
- //设置年份用的
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
|
|
|
- //获取查询的年份
|
|
|
- int toYearStart = Integer.parseInt(sdf.format(startTime));
|
|
|
- int toYearEnd = Integer.parseInt(sdf.format(endTime));
|
|
|
+
|
|
|
+ DateTime startTimeYear = DateUtil.beginOfYear(new Date(startTime));
|
|
|
+ DateTime endTimeYear = DateUtil.endOfYear(new Date(endTime));
|
|
|
+ List<WindTowerCalculationData> byBetweenTimeAndEquipmentId = getByStartTimeBetweenAndEquipmentIdAndEbId(startTimeYear, endTimeYear, eqId,densityTypeList.get(0).getId());
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy");
|
|
|
ArrayList<Object> PDataList = new ArrayList<>();
|
|
|
- for (int i = toYearStart; i <= toYearEnd; i++) {
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.clear();
|
|
|
- calendar.set(Calendar.YEAR, i);
|
|
|
- //当前年的开始时间
|
|
|
- long startHour = calendar.getTimeInMillis();
|
|
|
- calendar.clear();
|
|
|
- calendar.set(Calendar.YEAR, i);
|
|
|
- calendar.roll(Calendar.DAY_OF_YEAR, -1);
|
|
|
- //当前年的结束时间
|
|
|
- long endHour = calendar.getTimeInMillis() - 1l;
|
|
|
+ for (long i = startTimeYear.getTime(); i <= endTimeYear.getTime(); i = DateUtil.offsetMonth(new Date(i), 12).getTime()) {
|
|
|
//开始时间
|
|
|
- Date startTimeOfCurrentMonth = SEDateUtil.getStartTimeOfCurrentDay(new Date(startHour));
|
|
|
+ Date startTimeOfCurrentMonth = DateUtil.beginOfYear(new Date(i));
|
|
|
//结束时间
|
|
|
- Date endTimeOfCurrentMonth = SEDateUtil.getEndTimeOfCurrentDay(new Date(endHour));
|
|
|
- List<WindTowerCalculationData> byBetweenTimeAndEquipmentId = getByBetweenTimeAndEquipmentId(startTimeOfCurrentMonth, endTimeOfCurrentMonth, eqId);
|
|
|
- List<WindTowerCalculationData> densityDataList = byBetweenTimeAndEquipmentId.stream().filter(w -> w.getEbId().equals(densityId)).sorted(Comparator.comparing(WindTowerCalculationData::getTime)).collect(Collectors.toList());
|
|
|
+ Date endTimeOfCurrentMonth = DateUtil.offsetMonth(new Date(i), 12);
|
|
|
+ List<WindTowerCalculationData> densityDataList = byBetweenTimeAndEquipmentId.stream().filter(w -> w.getTime().getTime() >= startTimeOfCurrentMonth.getTime() && w.getTime().getTime() <=endTimeOfCurrentMonth.getTime()&&
|
|
|
+ w.getEbId().equals(densityId)).sorted(Comparator.comparing(WindTowerCalculationData::getTime)).collect(Collectors.toList());
|
|
|
|
|
|
BigDecimal pSum = BigDecimal.ZERO;
|
|
|
|
|
@@ -532,7 +525,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
}
|
|
|
HashMap<Object, Object> PTMap = new HashMap<>();
|
|
|
if (!densityDataList.isEmpty()) {
|
|
|
- PTMap.put(i, pSum.divide(BigDecimal.valueOf(densityDataList.size()), 2, RoundingMode.HALF_UP));
|
|
|
+ PTMap.put(simpleDateFormat.format(new Date(i)), pSum.divide(BigDecimal.valueOf(densityDataList.size()), 2, RoundingMode.HALF_UP));
|
|
|
|
|
|
}
|
|
|
for (Map.Entry<Object, Object> pt : PTMap.entrySet()) {
|
|
@@ -723,7 +716,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
|
|
|
String[] heights = null;
|
|
|
if (height == null || height.equals("")) {
|
|
|
- List<WindTowerInfo> windTowerInfos = windTowerInfoService.getByEquipmentNo(eqId);
|
|
|
+ List<WindTowerInfo> windTowerInfos = windTowerInfoService.lambdaQuery().eq(WindTowerInfo::getEquipmentNo, eqId).list();
|
|
|
heights = windTowerInfos.get(0).getHeights().split(",");
|
|
|
} else {
|
|
|
heights = height.split(",");
|
|
@@ -913,7 +906,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
ArrayList<Object> arrList = new ArrayList<>();
|
|
|
//装平均值
|
|
|
ArrayList<Object> list1 = new ArrayList<>();
|
|
|
- List<WindTowerInfo> windTowerInfos = windTowerInfoService.getByEquipmentNo(eqId);
|
|
|
+ List<WindTowerInfo> windTowerInfos = windTowerInfoService.lambdaQuery().eq(WindTowerInfo::getEquipmentNo, eqId).list();
|
|
|
if (height == null || height.equals("")) {
|
|
|
height = windTowerInfos.get(0).getHeights();
|
|
|
}
|
|
@@ -1074,7 +1067,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
//装平均值
|
|
|
ArrayList<Object> list1 = new ArrayList<>();
|
|
|
List<String> heightSort = new ArrayList<>();
|
|
|
- List<WindTowerInfo> windTowerInfos = windTowerInfoService.getByEquipmentNo(eqId);
|
|
|
+ List<WindTowerInfo> windTowerInfos = windTowerInfoService.lambdaQuery().eq(WindTowerInfo::getEquipmentNo, eqId).list();
|
|
|
//给前端用的日期格式
|
|
|
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM");
|
|
|
|
|
@@ -1155,12 +1148,13 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
long start2 = start1 + dayTime - 1L;
|
|
|
BigDecimal airDensityDay = new BigDecimal(0);
|
|
|
long start = start1;
|
|
|
- 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()));
|
|
|
- }
|
|
|
+ List<ProphaseWeatherData> collect = prophaseWeatherDataList.stream().filter(p -> p.getTs().getTime() >= start && p.getTs().getTime() <= start2 && p.getAirDensity() != null && p.getAirDensity() > 0).collect(Collectors.toList());
|
|
|
+
|
|
|
//存平均值
|
|
|
if (!collect.isEmpty()) {
|
|
|
+ for (ProphaseWeatherData map : collect) {
|
|
|
+ airDensityDay = airDensityDay.add(CalculationUtil.getBigDecimal(map.getAirDensity()));
|
|
|
+ }
|
|
|
WindTowerCalculationData windTowerCalculationData = new WindTowerCalculationData();
|
|
|
windTowerCalculationData.setEbId(equipmentAttribute.getId());
|
|
|
windTowerCalculationData.setTime(new Date(start1));
|
|
@@ -1195,7 +1189,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
// 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());
|
|
|
+ List<ProphaseAnemometryData> collect = prophaseAnemometryDataList.stream().filter(p -> p.getTs().getTime() >= startTime.getTime() && p.getTs().getTime() <= endTime.getTime() && p.getWsMax() != null && p.getWsMax() != -99).collect(Collectors.toList());
|
|
|
|
|
|
//获取所有层高
|
|
|
String[] height = windTowerInfoList.stream().filter(w -> w.getEquipmentNo().equals(equipmentId)).collect(Collectors.toList()).get(0).getHeights().split(",");
|
|
@@ -1214,8 +1208,6 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
windTowerCalculationData.setEquipmentId(equipmentId);
|
|
|
windTowerCalculationData.setValue(max.divide(BigDecimal.valueOf(collect.size()), 2, RoundingMode.HALF_UP));
|
|
|
list.add(windTowerCalculationData);
|
|
|
- } else {
|
|
|
- log.info("设备编号{},{}月,{}米层高月最大风速计算失败,缺少数据^ ^", equipmentId, startTime.getMonth() + 1, h);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -1266,14 +1258,12 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
windTowerCalculationData.setEquipmentId(equipmentId);
|
|
|
list.add(windTowerCalculationData);
|
|
|
// saveByEquipmentId(windTowerCalculationData, equipmentId);
|
|
|
- log.info("计算月平均空气密度完成");
|
|
|
- } else {
|
|
|
- log.info("月平均空气密度缺少数据,无法计算");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("计算月平均空气密度失败");
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+ log.info("计算月平均空气密度完成");
|
|
|
return list;
|
|
|
}
|
|
|
|
|
@@ -1329,8 +1319,6 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
windTowerCalculationDataList.add(windTowerCalculationData);
|
|
|
list.add(windTowerCalculationData);
|
|
|
|
|
|
- } else {
|
|
|
- log.info("设备编号{},{},{}米层高日平均风速计算失败,缺少数据^ ^", equipmentId, DateTimeUtil.dateToStrLong(new Date(start1)), h);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1387,8 +1375,6 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
windTowerCalculationData.setEquipmentId(equipmentId);
|
|
|
windTowerCalculationData.setValue(wsSum.divide(new BigDecimal(windTowerCalculationDatas.size()), 2, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
|
|
|
list.add(windTowerCalculationData);
|
|
|
- } else {
|
|
|
- log.info("设备编号{},{}月,{}米层高月平均风速计算失败,缺少数据^ ^", equipmentId, startTime.getMonth() + 1, h);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -1448,8 +1434,6 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
windTowerCalculationDataList.add(windTowerCalculationData);
|
|
|
list.add(windTowerCalculationData);
|
|
|
|
|
|
- } else {
|
|
|
- log.info("设备编号{},{},{}米层高日平均风功率计算失败,缺少数据^ ^", equipmentId, DateTimeUtil.dateToStrLong(new Date(start1)), h);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1504,8 +1488,6 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
windTowerCalculationData.setEquipmentId(equipmentId);
|
|
|
windTowerCalculationData.setValue(sum.divide(new BigDecimal(windTowerCalculationDatas.size()), 2, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
|
|
|
list.add(windTowerCalculationData);
|
|
|
- } else {
|
|
|
- log.info("设备编号{},{}月,{}米层高月平均风功率密度计算失败,缺少数据^ ^", equipmentId, startTime.getMonth() + 1, h);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1536,6 +1518,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
long endHour = endTime.getTime();
|
|
|
long Hour = 86400000;
|
|
|
String[] heights = windTowerInfoList.stream().filter(w -> w.getEquipmentNo().equals(equipmentId)).collect(Collectors.toList()).get(0).getHeights().split(",");
|
|
|
+ prophaseAnemometryDataList = prophaseAnemometryDataList.stream().filter(p -> p.getWsSta() != null && p.getWsSta() != -99).collect(Collectors.toList());
|
|
|
try {
|
|
|
for (String h : heights) {
|
|
|
//获取对应层高的属性
|
|
@@ -1610,8 +1593,6 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
windTowerCalculationData.setValue(CalculationUtil.caTurbulenceIntensity(staDay.get(0).getValue(), wsDay.get(0).getValue()));
|
|
|
windTowerCalculationDataList.add(windTowerCalculationData);
|
|
|
list.add(windTowerCalculationData);
|
|
|
- } else {
|
|
|
- log.info("设备编号{},{},{}米层高日平均湍流计算失败,缺少数据^ ^", equipmentId, DateTimeUtil.dateToStrLong(new Date(start1)), h);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1626,6 +1607,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 月平均湍流
|
|
|
*
|
|
@@ -1666,8 +1648,6 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
windTowerCalculationData.setEquipmentId(equipmentId);
|
|
|
windTowerCalculationData.setValue(sum.divide(new BigDecimal(windTowerCalculationDatas.size()), 2, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
|
|
|
list.add(windTowerCalculationData);
|
|
|
- } else {
|
|
|
- log.info("设备编号{},{}月,{}米层高月平均湍流计算失败,缺少数据^ ^", equipmentId, startTime.getMonth() + 1, h);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1681,7 +1661,6 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 计算日风切变入库
|
|
|
*
|
|
@@ -1690,9 +1669,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
* @param equipmentId 设备id
|
|
|
* @return
|
|
|
*/
|
|
|
- public ArrayList<WindTowerCalculationData> shearDay(Date startTime, Date endTime, String equipmentId
|
|
|
- , List<WindTowerCalculationData> windTowerCalculationDataList, List<EquipmentAttribute> equipmentAttributeList
|
|
|
- , List<WindTowerInfo> windTowerInfoList, List<ProphaseAnemometryData> prophaseAnemometryDataList) {
|
|
|
+ public ArrayList<WindTowerCalculationData> shearDay(Date startTime, Date endTime, String equipmentId, List<WindTowerCalculationData> windTowerCalculationDataList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerInfo> windTowerInfoList, List<ProphaseAnemometryData> prophaseAnemometryDataList) {
|
|
|
long startHour = startTime.getTime();
|
|
|
long endHour = endTime.getTime();
|
|
|
long dayTime = 86400000L;
|
|
@@ -1720,8 +1697,6 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
windTowerCalculationData.setTime(new Date(start1));
|
|
|
windTowerCalculationDataList.add(windTowerCalculationData);
|
|
|
list.add(windTowerCalculationData);
|
|
|
- } else {
|
|
|
- log.info("设备编号{},{},{}米层高日平均风切变计算失败,缺少数据^ ^", equipmentId, DateTimeUtil.dateToStrLong(new Date(start1)));
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1743,9 +1718,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
* @param equipmentId 设备id
|
|
|
* @return
|
|
|
*/
|
|
|
- public ArrayList<WindTowerCalculationData> shearMonth(Date startTime, Date endTime, String equipmentId
|
|
|
- , List<WindTowerCalculationData> windTowerCalculationDataList, List<EquipmentAttribute> equipmentAttributeList
|
|
|
- , List<WindTowerInfo> windTowerInfoList,List<ProphaseAnemometryData> prophaseAnemometryDataList) {
|
|
|
+ public ArrayList<WindTowerCalculationData> shearMonth(Date startTime, Date endTime, String equipmentId, List<WindTowerCalculationData> windTowerCalculationDataList, List<EquipmentAttribute> equipmentAttributeList, List<WindTowerInfo> windTowerInfoList, List<ProphaseAnemometryData> prophaseAnemometryDataList) {
|
|
|
//时间-1防止0点数据查不到
|
|
|
Date startHour = new Date(startTime.getTime() - 1);
|
|
|
//获取时间段所有统计数据
|
|
@@ -1757,7 +1730,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
removeByStartTimeBetweenAndEquipmentIdAndEbId(startHour, endTime, equipmentId, ebIdMonth);
|
|
|
|
|
|
String heights = windTowerInfoList.get(0).getHeights();
|
|
|
- List<ProphaseAnemometryData> collect = prophaseAnemometryDataList.stream().filter(p -> p.getTs().getTime() >= startTime.getTime() && p.getTs().getTime() < endTime.getTime()).collect(Collectors.toList());
|
|
|
+ List<ProphaseAnemometryData> collect = prophaseAnemometryDataList.stream().filter(p -> p.getTs().getTime() >= startTime.getTime() && p.getTs().getTime() < endTime.getTime() && p.getWsAve() != null && p.getWsAve() > 0).collect(Collectors.toList());
|
|
|
BigDecimal windShear = CalculationUtil.getWindShear(collect, heights.split(","));
|
|
|
|
|
|
if (collect.size() > 0) {
|
|
@@ -1767,11 +1740,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
windTowerCalculationData.setEquipmentId(equipmentId);
|
|
|
windTowerCalculationData.setValue(windShear);
|
|
|
list.add(windTowerCalculationData);
|
|
|
- } else {
|
|
|
- log.info("设备编号{},{}月平均风切变指数计算失败,缺少数据^ ^", equipmentId, startTime.getMonth() + 1);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
} catch (Exception e) {
|
|
|
log.error("设备编号{}月平均风月切变计算失败^ ^", equipmentId);
|
|
|
e.printStackTrace();
|
|
@@ -1863,10 +1832,10 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
for (long time = startTime.getTime(); time < endTime.getTime(); time += day) {
|
|
|
long dayTime = time;
|
|
|
//过滤一天数据
|
|
|
- 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());
|
|
|
+ List<ProphaseWeatherData> collect = prophaseWeatherDataList.stream().filter(p -> p.getTs().getTime() >= dayTime && p.getTs().getTime() < dayTime + day && p.getTAve() != null && p.getTAve() != -99).collect(Collectors.toList());
|
|
|
if (!collect.isEmpty()) {
|
|
|
+ //计算时间段内所有温度
|
|
|
+ BigDecimal tSum = CalculationUtil.getBigDecimal(collect.stream().mapToDouble(ProphaseWeatherData::getTAve).sum());
|
|
|
WindTowerCalculationData windTowerCalculationData = new WindTowerCalculationData();
|
|
|
windTowerCalculationData.setEbId(ebId);
|
|
|
windTowerCalculationData.setTime(new Date(dayTime));
|
|
@@ -1901,10 +1870,9 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
for (long time = startTime.getTime(); time < endTime.getTime(); time += day) {
|
|
|
long dayTime = time;
|
|
|
//过滤一天数据
|
|
|
- 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::getPaAve).sum());
|
|
|
-
|
|
|
+ List<ProphaseWeatherData> collect = prophaseWeatherDataList.stream().filter(p -> p.getTs().getTime() >= dayTime && p.getTs().getTime() < dayTime + day && p.getPaAve() != null && p.getPaAve() > 0).collect(Collectors.toList());
|
|
|
if (!collect.isEmpty()) {
|
|
|
+ BigDecimal paSum = CalculationUtil.getBigDecimal(collect.stream().mapToDouble(ProphaseWeatherData::getPaAve).sum());
|
|
|
WindTowerCalculationData windTowerCalculationData = new WindTowerCalculationData();
|
|
|
windTowerCalculationData.setEbId(ebId);
|
|
|
windTowerCalculationData.setTime(new Date(dayTime));
|
|
@@ -1969,14 +1937,14 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
/**
|
|
|
* 根据 时间,层高,设备id 查询风切变数据
|
|
|
*
|
|
|
- * @param startTime 开始时间
|
|
|
+ * @param startTime 开始时间
|
|
|
* @param endTime 结束时间
|
|
|
- * @param height 层高
|
|
|
- * @param eqId 设备id
|
|
|
+ * @param height 层高
|
|
|
+ * @param eqId 设备id
|
|
|
* @return map: 一天一条
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<Map<String, Object>> getWindShearByEqidAndAverageAndTime(Long startTime,Long endTime, String height, String eqId) {
|
|
|
+ public List<Map<String, Object>> getWindShearByEqidAndAverageAndTime(Long startTime, Long endTime, String height, String eqId) {
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
|
List<Map<String, Object>> tableList = new ArrayList<>();
|
|
|
Map<String, Object> map = new TreeMap<>();
|
|
@@ -2263,7 +2231,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
public ArrayList<WindTowerCalculationData> 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<ProphaseAnemometryData> collect = prophaseAnemometryDataList.stream().filter(p -> p.getTs().getTime() >= startTime.getTime() && p.getTs().getTime() <= endTime.getTime()).collect(Collectors.toList());
|
|
|
+ List<ProphaseAnemometryData> collect = prophaseAnemometryDataList.stream().filter(p -> p.getTs().getTime() >= startTime.getTime() && p.getTs().getTime() <= endTime.getTime() && p.getWsSta() != null && p.getWsSta() > 0).collect(Collectors.toList());
|
|
|
|
|
|
ArrayList<WindTowerCalculationData> windTowerCalculationDataList = new ArrayList<>();
|
|
|
String h = windTowerInfoList.stream().filter(w -> w.getEquipmentNo().equals(equipmentId)).collect(Collectors.toList()).get(0).getHeights();
|
|
@@ -2308,7 +2276,7 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
// 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());
|
|
|
+ List<EquipmentAttribute> equipmentAttributes = equipmentAttributeList.stream().filter(w -> "environment".equals(w.getAttributeFunction())).collect(Collectors.toList());
|
|
|
BigDecimal sumPa = new BigDecimal(0);
|
|
|
BigDecimal avePa = new BigDecimal(0);
|
|
|
BigDecimal sumRh = new BigDecimal(0);
|
|
@@ -2322,13 +2290,13 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
List<BigDecimal> tList = new ArrayList<>();
|
|
|
/*计算平均值数值为null 不计算*/
|
|
|
for (ProphaseWeatherData map : prophaseWeatherData) {
|
|
|
- if (map.getPaAve() != null && map.getPaAve() != 0) {
|
|
|
+ if (map.getPaAve() != null && map.getPaAve() > 0) {
|
|
|
paList.add(CalculationUtil.getBigDecimal(map.getPaAve()));
|
|
|
}
|
|
|
- if (map.getRhAve() != null && map.getRhAve() != 0) {
|
|
|
+ if (map.getRhAve() != null && map.getRhAve() > 0) {
|
|
|
rhList.add(CalculationUtil.getBigDecimal(map.getRhAve()));
|
|
|
}
|
|
|
- if (map.getTAve() != null && map.getTAve() != 0) {
|
|
|
+ if (map.getTAve() != null && map.getTAve() != -99) {
|
|
|
tList.add(CalculationUtil.getBigDecimal(map.getTAve()));
|
|
|
}
|
|
|
}
|
|
@@ -2369,15 +2337,15 @@ public class WindTowerCalculationDataServiceImpl extends ServiceImpl<WindTowerCa
|
|
|
aveRh = sumRh.divide(new BigDecimal(rhList.size()), 2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
|
|
|
- List<EquipmentAttribute> paMax = equipmentAttributeList.stream().filter(w -> w.getFieldName().equals("paMAX")).collect(Collectors.toList());
|
|
|
- List<EquipmentAttribute> paMin = equipmentAttributeList.stream().filter(w -> w.getFieldName().equals("paMIN")).collect(Collectors.toList());
|
|
|
- List<EquipmentAttribute> paAve = equipmentAttributeList.stream().filter(w -> w.getFieldName().equals("paAVE")).collect(Collectors.toList());
|
|
|
- List<EquipmentAttribute> rhMax = equipmentAttributeList.stream().filter(w -> w.getFieldName().equals("rhMAX")).collect(Collectors.toList());
|
|
|
- List<EquipmentAttribute> rhMin = equipmentAttributeList.stream().filter(w -> w.getFieldName().equals("rhMIN")).collect(Collectors.toList());
|
|
|
- List<EquipmentAttribute> rhAve = equipmentAttributeList.stream().filter(w -> w.getFieldName().equals("rhAVE")).collect(Collectors.toList());
|
|
|
- List<EquipmentAttribute> tMax = equipmentAttributeList.stream().filter(w -> w.getFieldName().equals("tMAX")).collect(Collectors.toList());
|
|
|
- List<EquipmentAttribute> tMin = equipmentAttributeList.stream().filter(w -> w.getFieldName().equals("tMIN")).collect(Collectors.toList());
|
|
|
- List<EquipmentAttribute> tAve = equipmentAttributeList.stream().filter(w -> w.getFieldName().equals("tAVE")).collect(Collectors.toList());
|
|
|
+ List<EquipmentAttribute> paMax = equipmentAttributes.stream().filter(w -> w.getFieldName().equals("paMAX")).collect(Collectors.toList());
|
|
|
+ List<EquipmentAttribute> paMin = equipmentAttributes.stream().filter(w -> w.getFieldName().equals("paMIN")).collect(Collectors.toList());
|
|
|
+ List<EquipmentAttribute> paAve = equipmentAttributes.stream().filter(w -> w.getFieldName().equals("paAVE")).collect(Collectors.toList());
|
|
|
+ List<EquipmentAttribute> rhMax = equipmentAttributes.stream().filter(w -> w.getFieldName().equals("rhMAX")).collect(Collectors.toList());
|
|
|
+ List<EquipmentAttribute> rhMin = equipmentAttributes.stream().filter(w -> w.getFieldName().equals("rhMIN")).collect(Collectors.toList());
|
|
|
+ List<EquipmentAttribute> rhAve = equipmentAttributes.stream().filter(w -> w.getFieldName().equals("rhAVE")).collect(Collectors.toList());
|
|
|
+ List<EquipmentAttribute> tMax = equipmentAttributes.stream().filter(w -> w.getFieldName().equals("tMAX")).collect(Collectors.toList());
|
|
|
+ List<EquipmentAttribute> tMin = equipmentAttributes.stream().filter(w -> w.getFieldName().equals("tMIN")).collect(Collectors.toList());
|
|
|
+ List<EquipmentAttribute> tAve = equipmentAttributes.stream().filter(w -> w.getFieldName().equals("tAVE")).collect(Collectors.toList());
|
|
|
removeByStartTimeBetweenAndEquipmentIdAndEbId(startTime, endTime, equipmentId, paMax.get(0).getId());
|
|
|
removeByStartTimeBetweenAndEquipmentIdAndEbId(startTime, endTime, equipmentId, paMin.get(0).getId());
|
|
|
removeByStartTimeBetweenAndEquipmentIdAndEbId(startTime, endTime, equipmentId, paAve.get(0).getId());
|
|
@@ -2564,7 +2532,7 @@ 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<ProphaseWeatherData> weatherDataList = prophaseWeatherDataList.stream().filter(p -> p.getTs().getTime() >= startHour && p.getTs().getTime() <= endHour).collect(Collectors.toList());
|
|
|
+ List<ProphaseWeatherData> weatherDataList = prophaseWeatherDataList.stream().filter(p -> p.getTs().getTime() >= startHour && p.getTs().getTime() <= endHour && p.getAirDensity() != null && p.getAirDensity() > 0).collect(Collectors.toList());
|
|
|
for (ProphaseWeatherData map : weatherDataList) {
|
|
|
//过滤异常数据
|
|
|
|