Commit f29da542 authored by caotao's avatar caotao

泰和光伏-场站总览功率曲线 丢失代码补全

parent a226e31d
......@@ -460,21 +460,58 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public Map<String, Object> getDetailsWindSpeedAll(String gatewayId) {
List<Map<String, Object>> list = temporaryDataMapper.timingTemporarysSorageData(gatewayId);
public void getDetailsWindSpeedAll(StationBasic stationBasic) {
Map<String, Object> map = new HashMap<>();
List<String> values = new ArrayList<>();
List<String> valueList = new ArrayList<>();
Set<String> time = new TreeSet<>();
for (Map<String, Object> stringStringMap : list) {
if (stringStringMap.get("equipmentIndexName").toString().equals("有功功率")) {
values.add(stringStringMap.get("value").toString());
Map<Date, Double> groupMap = new HashMap<>();
List<String> time = new ArrayList<>();
Map<String, Object> activePowerInfo = new HashMap<>();
Map<String, Object> otherInfo = new HashMap<>();
List<IndicatorData> activePowerList = new ArrayList<>();
List<IndicatorData> otherList = new ArrayList<>();
String startTime = DateUtil.today() + " 00:00:00";
String endTime = DateUtil.today() + " 23:59:59";
Double installedCapacity = commonServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber());
if ("FDZ".equals(stationBasic.getStationType())) {
activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(CommonConstans.xiazaoActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId());
otherList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(CommonConstans.xiazaoWindSpeedrPoint, startTime, endTime, stationBasic.getFanGatewayId());
groupMap = otherList.stream().collect(Collectors.groupingBy(IndicatorData::getCreatedTime, Collectors.averagingDouble(IndicatorData::getValueF)));
} else {
valueList.add(stringStringMap.get("value").toString());
time.add(stringStringMap.get("createdTime").toString());
}
}
activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(CommonConstans.taiheActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId());
otherList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(CommonConstans.taiheIrradiationPonit, startTime, endTime, stationBasic.getBoosterGatewayId());
}
for (int i = 0; i < activePowerList.size(); i++) {
IndicatorData indicatorData = activePowerList.get(i);
time.add(DateUtil.format(indicatorData.getCreatedTime(), "HH:mm"));
if ("FDZ".equals(stationBasic.getStationType())) {
values.add(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF()));
valueList.add(String.format(CommonConstans.Twodecimalplaces, groupMap.get(indicatorData.getCreatedTime())));
} else {
values.add(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF() * CommonConstans.kwToMv));
valueList.add(String.format(CommonConstans.Twodecimalplaces, otherList.get(i).getValueF()));
}
}
String max = String.format(CommonConstans.Twodecimalplaces, values.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String min = String.format(CommonConstans.Twodecimalplaces, values.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String mean = String.format(CommonConstans.Twodecimalplaces, values.stream().mapToDouble(Double::parseDouble).average().getAsDouble());
activePowerInfo.put("mean", mean);
activePowerInfo.put("max", max);
activePowerInfo.put("min", min);
activePowerInfo.put("maxTime", time.get(values.lastIndexOf(max)));
activePowerInfo.put("minTime", time.get(values.lastIndexOf(min)));
activePowerInfo.put("load", String.format(CommonConstans.Twodecimalplaces, Double.valueOf(values.get(values.size() - 1)) / installedCapacity));
max = String.format(CommonConstans.Twodecimalplaces, valueList.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
min = String.format(CommonConstans.Twodecimalplaces, valueList.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
mean = String.format(CommonConstans.Twodecimalplaces, valueList.stream().mapToDouble(Double::parseDouble).average().getAsDouble());
otherInfo.put("mean", mean);
otherInfo.put("max", max);
otherInfo.put("min", min);
otherInfo.put("maxTime", time.get(valueList.lastIndexOf(max)));
otherInfo.put("minTime", time.get(valueList.lastIndexOf(min)));
otherInfo.put("load", "");
List<Map<String, Object>> seriesData = new ArrayList<>();
Map<String, Object> map3 = new HashMap<>();
......@@ -486,8 +523,16 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
seriesData.add(map1);
map.put("seriesData", seriesData);
map.put("axisData", time);
try {
log.info("---------------------推送全站图表信息开始------------------------------");
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr()+"_activePower_table", JSON.toJSON(map).toString().getBytes("UTF-8"),1,true);
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr()+"_activePower_info", JSON.toJSON(activePowerInfo).toString().getBytes("UTF-8"),1,true);
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr()+"_other_info", JSON.toJSON(otherInfo).toString().getBytes("UTF-8"),1,true);
log.info("---------------------推送全站图表信息结束------------------------------");
}catch (Exception exception){
log.info("---------------------推送全站图表信息失败------------------------------");
}
return map;
}
public Map<String, Object> getDetailsWindSpeed(String gatewayId, String name) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment