|
@@ -14,7 +14,6 @@ import com.jiayue.biz.mapper.WindTowerDataParentTableMapper;
|
|
|
import com.jiayue.biz.service.*;
|
|
|
import com.jiayue.biz.util.CalculationUtil;
|
|
|
import com.jiayue.biz.util.DateTimeUtil;
|
|
|
-import com.jiayue.common.core.text.Convert;
|
|
|
import com.jiayue.common.utils.DateUtil;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -97,14 +96,6 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
ArrayList<String> heightList = new ArrayList<>();
|
|
|
//循环层高
|
|
|
for (String height : heights) {
|
|
|
- //毛武平 在2024年5月7日提出修改需求,项目2 相关的声雷达数据,首页满发小时数据显示100米层高计算结果
|
|
|
- String xiangmu2WindTower = "202101034,202101047,202101055,202301008,202301016,202101029,202101009";
|
|
|
- if(xiangmu2WindTower.contains(equipmentId)){
|
|
|
- int heightTemp = Convert.toInt(height);
|
|
|
- if(heightTemp>130){
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
//获取风速风功率的统计id
|
|
|
List<EquipmentAttribute> equipmentAttributeWpd = equipmentAttributeList.stream().filter(e -> e.getFieldName().equals(height + "wpdMonth")).collect(Collectors.toList());
|
|
|
List<EquipmentAttribute> equipmentAttributeWs = equipmentAttributeList.stream().filter(e -> e.getFieldName().equals(height + "awsMonth")).collect(Collectors.toList());
|
|
@@ -157,7 +148,7 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
Map<String, Long> startAndEnd = prophaseWeatherDataService.getDataTimeStartAndEnd(equipmentId);
|
|
|
|
|
|
if (beginTime.getTime() < startAndEnd.get("startTime")) {
|
|
|
- beginTime = DateUtil.parse(DateUtil.format(new Date(startAndEnd.get("startTime")),"yyyy-MM-dd 00:00:00"));
|
|
|
+ beginTime = new Date(startAndEnd.get("startTime"));
|
|
|
}
|
|
|
Date endTime = lastDataCalculation.getTime();
|
|
|
|
|
@@ -169,14 +160,6 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
ArrayList<String> timeList = new ArrayList();
|
|
|
boolean type = true;
|
|
|
for (String height : heights) {
|
|
|
- //毛武平 在2024年5月7日提出修改需求,项目2 相关的声雷达数据,首页满发小时数据显示100米层高计算结果
|
|
|
- String xiangmu2WindTower = "202101034,202101047,202101055,202301008,202301016,202101029,202101009";
|
|
|
- if(xiangmu2WindTower.contains(equipmentId)){
|
|
|
- int heightTemp = Convert.toInt(height);
|
|
|
- if(heightTemp>130){
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
List<EquipmentAttribute> equipmentAttributes = equipmentAttributeList.stream().filter(e -> e.getFieldName().equals(height + "awsDay")).collect(Collectors.toList());
|
|
|
|
|
|
ArrayList<Object> hList = new ArrayList();
|
|
@@ -200,6 +183,50 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
everyMap.put("chart", everyData);
|
|
|
everyMap.put("time", timeList);
|
|
|
|
|
|
+// List<ProphaseAnemometryData> mapList = new ArrayList<>();
|
|
|
+// if (!month.equals("")) {
|
|
|
+// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
+// try {
|
|
|
+// Date startDate = sdf.parse(month);
|
|
|
+// Date endDate = DateTimeUtil.endOfMonth(startDate);
|
|
|
+// mapList = prophaseAnemometryDataService.selectWsAve(equipmentId, new Timestamp(startDate.getTime()), new Timestamp(endDate.getTime()));
|
|
|
+// } catch (ParseException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// // 最新一天数据
|
|
|
+// List<Entity> lastData = prophaseWeatherDataService.getLastData(equipmentId);
|
|
|
+// Timestamp timeEnd = (Timestamp) lastData.get(0).get("last (ts)");
|
|
|
+// DateTime startTime = DateUtil.beginOfDay(new Date(timeEnd.getTime()));
|
|
|
+// mapList = prophaseAnemometryDataService.selectWsAve(equipmentId, new Timestamp(startTime.getTime()), timeEnd);
|
|
|
+//
|
|
|
+// }
|
|
|
+//// HashMap<String, Object> everyMap = new HashMap();
|
|
|
+// //获取风速层高
|
|
|
+// List<WindTowerInfo> windTowerInfos = windTowerInfoService.getByEquipmentNo(equipmentId);
|
|
|
+// String height = windTowerInfos.get(0).getHeights();
|
|
|
+// String[] heightAll = height.split(",");
|
|
|
+//
|
|
|
+// // 时间list
|
|
|
+//// ArrayList<String> timeList = new ArrayList();
|
|
|
+//// ArrayList<Object> everyData = new ArrayList<>();
|
|
|
+//
|
|
|
+// for (String h : heightAll) {
|
|
|
+// timeList = new ArrayList();
|
|
|
+// ArrayList<Object> hList = new ArrayList();
|
|
|
+// HashMap<String, Object> hMap = new HashMap();
|
|
|
+// //根据层高过滤时间和风速
|
|
|
+// TreeMap<Long, Float> heightForTimeAndWs = new TreeMap<>(mapList.stream().filter(p -> p.getLayerHeight().equals(h))
|
|
|
+// .collect(Collectors.toMap(prophaseAnemometryData -> prophaseAnemometryData != null ? prophaseAnemometryData.getTs().getTime() : null, prophaseAnemometryData1 -> prophaseAnemometryData1 != null ? prophaseAnemometryData1.getWsAve() : null)));
|
|
|
+// for (Map.Entry<Long, Float> entry : heightForTimeAndWs.entrySet()) {
|
|
|
+// String time = DateUtil.format(new Date(entry.getKey()), "yyyy-MM-dd HH:mm:ss");
|
|
|
+// timeList.add(time);
|
|
|
+// hList.add(entry.getValue());
|
|
|
+// }
|
|
|
+// hMap.put("height", h);
|
|
|
+// hMap.put("value", hList);
|
|
|
+// everyData.add(hMap);
|
|
|
+// }
|
|
|
|
|
|
|
|
|
return everyMap;
|
|
@@ -248,6 +275,22 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
StatisticsSituation statisticsSituation = statisticsSituations.get(0);
|
|
|
String[] split = statisticsSituation.getStartTimeAndEndTime().split(",");
|
|
|
info = info + "数据起止时间:" + sdf.format(new Date(Long.parseLong(split[0]))) + " - " + sdf.format(new Date(Long.parseLong(split[1])));
|
|
|
+// if (statisticsSituation.getWsAve140() != null)
|
|
|
+// info = info + ";140米风速:" + statisticsSituation.getWsAve140().setScale(2, RoundingMode.HALF_UP);
|
|
|
+// if (statisticsSituation.getWsAve120() != null)
|
|
|
+// info = info + ";120米风速:" + statisticsSituation.getWsAve120().setScale(2, RoundingMode.HALF_UP);
|
|
|
+// if (statisticsSituation.getWsAve100() != null)
|
|
|
+// info = info + ";100米风速:" + statisticsSituation.getWsAve100().setScale(2, RoundingMode.HALF_UP);
|
|
|
+// if (statisticsSituation.getWsAve80() != null)
|
|
|
+// info = info + ";80米风速:" + statisticsSituation.getWsAve80().setScale(2, RoundingMode.HALF_UP);
|
|
|
+// if (statisticsSituation.getWsAve70() != null)
|
|
|
+// info = info + ";70米风速:" + statisticsSituation.getWsAve70().setScale(2, RoundingMode.HALF_UP);
|
|
|
+// if (statisticsSituation.getWsAve50() != null)
|
|
|
+// info = info + ";50米风速:" + statisticsSituation.getWsAve50().setScale(2, RoundingMode.HALF_UP);
|
|
|
+// if (statisticsSituation.getWsAve30() != null)
|
|
|
+// info = info + ";30米风速:" + statisticsSituation.getWsAve30().setScale(2, RoundingMode.HALF_UP);
|
|
|
+// if (statisticsSituation.getWsAve10() != null)
|
|
|
+// info = info + ";10米风速:" + statisticsSituation.getWsAve10().setScale(2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
if (!maps.isEmpty()) {
|
|
|
defectCount = new BigDecimal(maps.get(0).get("num").toString()).subtract(new BigDecimal(144));
|
|
@@ -405,8 +448,20 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
DateTime startTime = DateUtil.beginOfDay(DateTimeUtil.getYearDay(timeEnd.getTime()));
|
|
|
anemometryData = prophaseAnemometryDataService.selectWdAveAndWdAveAndWsStaForHeight(equipmentId, new Timestamp(startTime.getTime()), timeEnd, height);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
anemometryData = anemometryData.stream().filter(p -> null != p.getWsAve() && p.getWsAve() > 0 && p.getWsAve() < 30).collect(Collectors.toList());
|
|
|
HashMap<String, Integer> hashMap = new HashMap<>();
|
|
|
+ if(null == anemometryData || anemometryData.isEmpty()){
|
|
|
+ HashMap<String, Object> everyMap = new HashMap<>();
|
|
|
+ everyMap.put("echars", null);
|
|
|
+ everyMap.put("windPowerEchars", null);
|
|
|
+ everyMap.put("proportion", null);
|
|
|
+ return everyMap;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
Map<String, BigDecimal> map = new HashMap<>();
|
|
|
Map<String, BigDecimal> windPowerMap = new HashMap<>();
|
|
@@ -518,9 +573,13 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
BigDecimal reduce = k.getValue().stream().map(WindDirectionStatisticsData::getValue).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
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());
|
|
|
+ if(null != hashMap && !hashMap.isEmpty()) {
|
|
|
+ Map.Entry<String, BigDecimal> stringBigDecimalEntry = hashMap.entrySet().stream().max(Comparator.comparing(Map.Entry::getValue)).get();
|
|
|
+ //主风向
|
|
|
+ dataMap.put("wdSum", stringBigDecimalEntry.getKey());
|
|
|
+ }else{
|
|
|
+ dataMap.put("wdSum", new BigDecimal(1));
|
|
|
+ }
|
|
|
//起止时间
|
|
|
Map<String, Long> dataTimeStartAndEnd = prophaseWeatherDataService.getDataTimeStartAndEnd(equipmentId);
|
|
|
String startTime = DateUtil.format(new Date(dataTimeStartAndEnd.get("startTime")), "yyyy-MM-dd");
|
|
@@ -535,7 +594,7 @@ public class HomePageServiceImpl extends ServiceImpl<WindTowerDataParentTableMap
|
|
|
public BigDecimal getDataForCalculationByEb(List<EquipmentAttribute> equipmentAttributeList, List<WindTowerCalculationData> windTowerCalculationDataList, String fieldName) {
|
|
|
List<String> ebId = equipmentAttributeList.stream().filter(e -> e.getFieldName().equals(fieldName)).map(EquipmentAttribute::getId).collect(Collectors.toList());
|
|
|
|
|
|
- List<BigDecimal> dataList = windTowerCalculationDataList.stream().filter(w -> w.getEbId().equals(ebId.get(0))).map(WindTowerCalculationData::getValue).collect(Collectors.toList());
|
|
|
+ List<BigDecimal> dataList = windTowerCalculationDataList.stream().filter(w -> w.getEbId().equals(ebId.get(0)) && w.getValue().doubleValue()>=0).map(WindTowerCalculationData::getValue).collect(Collectors.toList());
|
|
|
|
|
|
return dataList.size() > 0 ? CalculationUtil.getAvgWind(dataList) : BigDecimal.ZERO;
|
|
|
|