Commit adbe99e1 authored by wujiang's avatar wujiang

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

# Conflicts: # amos-boot-system-jxiop/amos-boot-module-jxiop-monitor-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/MonitorFanIndicatorImpl.java
parents 97a7b34b ba5d6b6b
......@@ -26,6 +26,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.MatchPhraseQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.aggregations.Aggregation;
......@@ -121,7 +122,7 @@ public class MonitorFanIdxController extends BaseController {
list.add(date1);
Map<String, Object> queryCondtion = new HashMap<>();
queryCondtion.put("color",stationBasic.getQrcodeColor());
queryCondtion.put("date",list);
queryCondtion.put("data",list);
return ResponseHelper.buildResponse(queryCondtion);
}
......@@ -1083,7 +1084,13 @@ public class MonitorFanIdxController extends BaseController {
List<String> list = Arrays.asList(keys);
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
if (!stationBasic.getStationType().equals("FDZ")) {
boolQueryBuilder.must((QueryBuilders.termsQuery("equipmentIndexName.keyword", CommonConstans.taiHeGenIndicator))).must(QueryBuilders.matchQuery("gatewayId.keyword", stationBasic.getBoosterGatewayId()));
MatchPhraseQueryBuilder queryBuilder1 = QueryBuilders.matchPhraseQuery(CommonConstans.QueryStringFrontMoudleNotKeyWord, "*逆变器*");
boolQueryBuilder.must((QueryBuilders.termsQuery("equipmentIndexName.keyword", list))
).must(QueryBuilders.matchQuery("gatewayId.keyword", stationBasic.getFanGatewayId()));
boolQueryBuilder.must(queryBuilder1);
} else {
boolQueryBuilder.must((QueryBuilders.termsQuery("equipmentIndexName.keyword", list))).must(QueryBuilders.matchQuery("gatewayId.keyword", gatewayId));
......@@ -1117,33 +1124,56 @@ public class MonitorFanIdxController extends BaseController {
map.put("num", key);
for (ESEquipments equip : resultMap.get(key)) {
String value = String.format("%.4f", equip.getValueF());
map.put("name", equip.getEquipmentSpecificName().substring(0, equip.getEquipmentSpecificName().indexOf("#"))+"/"+key);
switch (equip.getEquipmentIndexName()) {
case "日发电量":
map.put("dayNum", value);
break;
case "月发电量":
map.put("monthNum", value);
break;
case "年发电量":
map.put("yearNum", value);
case CommonConstans.taiHeGenIndicatorDay:
map.put("dayNum", value);
break;
case CommonConstans.taiHeGenIndicatorMonth:
map.put("monthNum", value);
break;
case CommonConstans.taiHeGenIndicatorYear:
map.put("yearNum", value);
break;
if (stationBasic.getStationType().equals("FDZ")) {
map.put("name", equip.getEquipmentSpecificName().substring(0, equip.getEquipmentSpecificName().indexOf("#"))+"/"+key);
}else{
map.put("name", key);
}
if (!stationBasic.getStationType().equals("FDZ")) {
switch (equip.getEquipmentIndexName()) {
case "日发电量":
map.put("dayNum", String.format(CommonConstans.Fourdecimalplaces, Double.valueOf(value) * CommonConstans.pvGenPoweActor * CommonConstans.pvGenPoweActorDay));
break;
case "月发电量":
map.put("monthNum", String.format(CommonConstans.Fourdecimalplaces, Double.valueOf(value) * CommonConstans.pvGenPoweActorCurrentData));
break;
case "年发电量":
map.put("yearNum", String.format(CommonConstans.Fourdecimalplaces, Double.valueOf(value) * CommonConstans.pvGenPoweActorCurrentData));
}
}else{
switch (equip.getEquipmentIndexName()) {
case "日发电量":
map.put("dayNum", value);
break;
case "月发电量":
map.put("monthNum", value);
break;
case "年发电量":
map.put("yearNum", value);
// case CommonConstans.taiHeGenIndicatorDay:
// map.put("dayNum", value);
// break;
// case CommonConstans.taiHeGenIndicatorMonth:
// map.put("monthNum", value);
// break;
// case CommonConstans.taiHeGenIndicatorYear:
// map.put("yearNum", value);
// break;
}
}
}
esEquipmentsMap.add(map);
}
if (stationBasic.getStationType().equals("FDZ")) {
this.sortByFeild(esEquipmentsMap, "num");
}else{
this.sortByFeildString(esEquipmentsMap, "num");
this.sortByFeild(esEquipmentsMap,"num");
}
IPage<Map<String, Object>> page = new Page<>();
page.setTotal(esEquipmentsMap.size());
page.setSize(999);
......@@ -1172,6 +1202,14 @@ public class MonitorFanIdxController extends BaseController {
return list;
}
public static List<Map<String, Object>> sortByFeildString(List<Map<String, Object>> list, String feild) {
if (CollectionUtils.isNotEmpty(list)) {
Collections.sort(list, (m1, m2)-> String.valueOf(m1.get(feild).toString()).compareTo(String.valueOf(m2.get(feild).toString())));
}
return list;
}
//@Scheduled(cron = "0/10 * * * * ? ")
......
......@@ -217,8 +217,15 @@ public class LargeScreenImpl {
mapdta.put("NJHWC", 0d);
//平均数
List<String> value = new ArrayList<>();
List<String> ids =new ArrayList<>();
for (StationCacheInfoDto stationCacheInfoDto : gatewayId) {
ids.add(stationCacheInfoDto.getFanGatewayId());
ids.add(stationCacheInfoDto.getBoosterGatewayId());
}
// List<String> ids = gatewayId.stream().map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
List<String> ids = gatewayId.stream().map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
value.add(SS);
value.add(ZFS);
value.add(ZFSLJ);
......
......@@ -123,4 +123,8 @@ public class CommonConstans {
public static final String taiHeGenIndicatorMonth = "泰和月发电量总和";
public static final String taiHeGenIndicatorYear = "泰和年发电量总和";
public static final String taiheActivePowerPoint = "南瑞光差保护_313P";
public static final String taiheIrradiationPonit = "WTX-801_25_WTX-801_总辐射";
public static final String xiazaoActivePowerPoint = "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值";
public static final String xiazaoWindSpeedrPoint = "瞬时风速";
}
......@@ -291,19 +291,9 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "概览-全站功率曲线")
@GetMapping("/overviewWindSpeed")
public ResponseModel<Map<String, Object>> getOverviewWindSpeed(@RequestParam(value = "stationId", required = false) String stationId, @RequestParam(value = "type", required = false) String type, @RequestParam(value = "areaCode", required = false) String areaCode) {
String gatewayId = "";
if (null != stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
gatewayId = stationBasic.getBoosterGatewayId();
if (null == type) {
gatewayId = stationBasic.getFanGatewayId();
}
}
Map<String, Object> detailsWindSpeed = monitorFanIndicator.getDetailsWindSpeedAll(gatewayId);
return ResponseHelper.buildResponse(detailsWindSpeed);
public void getOverviewWindSpeed(@RequestParam(value = "stationId", required = true) String stationId, @RequestParam(value = "type", required = false) String type, @RequestParam(value = "areaCode", required = false) String areaCode) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
monitorFanIndicator.getDetailsWindSpeedAll(stationBasic);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
......@@ -676,7 +666,7 @@ public class MonitorFanIdxController extends BaseController {
Double todayPower = Double.valueOf(columnMap.get(CommonConstans.taiHeGenIndicatorDay).toString());
Double total = commonService.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射累计");
if (todayPower > 0 && total > 0) {
Double overallEfficiency = todayPower*CommonConstans.wkwhToMv / ((total / 3.6) * capacityl);
Double overallEfficiency = todayPower * CommonConstans.wkwhToMv / ((total / 3.6) * capacityl);
data9.put("title", String.format("%.2f", overallEfficiency * 100) + "%");//综合效率
} else {
data9.put("title", "0.00%");//综合效率
......
......@@ -363,16 +363,16 @@ public class CommonServiceImpl {
氮氧化物减排量(t)=发电量(万kW·h)*1.69
*/
co2.setUnit("二氧化碳减排量(t)");
co2.setTitle(String.format("%.2f", totalSocialContribution * CommonConstans.carbonDioxide*CommonConstans.kgToT));
co2.setTitle(String.format("%.2f", totalSocialContribution * CommonConstans.carbonDioxide));
socialContributionDtoList.add(co2);
coal.setUnit("节约标准煤(t)");
coal.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.standardCoal*CommonConstans.kgToT)));
coal.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.standardCoal)));
socialContributionDtoList.add(coal);
toner.setUnit("碳粉尘减排量(t)");
toner.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.toner * CommonConstans.kgToT)));
toner.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.toner )));
socialContributionDtoList.add(toner);
so2.setUnit("二氧化硫减排量(t)");
so2.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.sulfurDioxide * CommonConstans.kgToT)));
so2.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.sulfurDioxide )));
socialContributionDtoList.add(so2);
socialContributionDtoPage.setRecords(socialContributionDtoList);
socialContributionDtoPage.setTotal(100);
......
......@@ -76,7 +76,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
TpriDmpDatabookServiceImpl tpriDmpDatabookServiceImpl;
@Autowired
TemporaryDataMapper temporaryDataMapper;
// @Autowired
// @Autowired
// InfluxDButils influxDButils;
@Autowired
AlarmEventMapper alarmEventMapper;
......@@ -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 {
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 {
valueList.add(stringStringMap.get("value").toString());
time.add(stringStringMap.get("createdTime").toString());
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) {
......@@ -2080,119 +2125,99 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return deaviationRateDtoPage;
}
@Scheduled(cron = "0 */10 * * * ?")
//@Scheduled(cron = "0/1 * * * * ?")
public void addNbqAlarmEvent() {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BaseEntity::getIsDelete, false);
wrapper.like(StationBasic::getStationType, "GFDZ");
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
for (StationBasic stationBasic : stationBasics) {
Map<String, List<String>> queryCondtion = new HashMap<>();
Map<String, String> shouldCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName,
Arrays.asList("待机", "停机", "告警运行", "限额运行", "降额运行", "故障停机", "通讯故障", "运行"));
queryCondtion.put(CommonConstans.QueryStringValueKeyword, Arrays.asList("true"));
/**
* 逆变器
*/
List<ESEquipments> indicatorsDtoList = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
Collections.sort(indicatorsDtoList, (a, b) -> (b.getCreatedTime())
.compareTo(a.getCreatedTime()));
//过滤重复状态
List<ESEquipments> nindicatorsDtoList=indicatorsDtoList.stream().collect(Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(ESEquipments::getDisplayName))), ArrayList::new));
/**
* 汇流箱
*/
queryCondtion.remove(CommonConstans.QueryStringEquipmentIndexName);
queryCondtion.remove(CommonConstans.QueryStringValueKeyword);
queryCondtion.put(CommonConstans.QueryStringDataType, Arrays.asList("state"));
shouldCondtion.put(CommonConstans.QueryStringFrontMoudle, "汇流箱");
List<ESEquipments> indicatorsDtoListHLX = commonServiceImpl.getListDataByCondtions(queryCondtion,
shouldCondtion, ESEquipments.class);
/**
* 箱变
*/
shouldCondtion.put(CommonConstans.QueryStringFrontMoudle, "箱变");
List<ESEquipments> indicatorsDtoListXB = commonServiceImpl.getListDataByCondtions(queryCondtion,
shouldCondtion, ESEquipments.class);
nindicatorsDtoList.addAll(indicatorsDtoListHLX);
nindicatorsDtoList.addAll(indicatorsDtoListXB);
List<EquipAlarmEvent> newEquipAlarmEvents = new ArrayList<>();
List<EquipAlarmEvent> newEquipAlarmEvent = new ArrayList<>();
long time = new Date().getTime();
if (CollectionUtils.isNotEmpty(nindicatorsDtoList)) {
for (ESEquipments esEquipments : nindicatorsDtoList) {
EquipAlarmEvent equipAlarmEvent = new EquipAlarmEvent();
equipAlarmEvent.setEquipIndex(esEquipments.getEquipmentNumber());
equipAlarmEvent.setEquipName(esEquipments.getEquipmentSpecificName());
equipAlarmEvent.setAlarmDesc(AlarmDesc.getCode(esEquipments.getEquipmentIndexName()));
equipAlarmEvent.setAlarmDesc(
StringUtils.isEmpty(equipAlarmEvent.getAlarmDesc()) ? esEquipments.getEquipmentIndexName()
: equipAlarmEvent.getAlarmDesc());
equipAlarmEvent.setCreatedTime(esEquipments.getCreatedTime());
equipAlarmEvent.setGatewayId(stationBasic.getFanGatewayId());
equipAlarmEvent.setSort(time);
equipAlarmEvent.setFrontModule(esEquipments.getFrontModule());
equipAlarmEvent.setValue(esEquipments.getValue());
newEquipAlarmEvents.add(equipAlarmEvent);
newEquipAlarmEvent.add(equipAlarmEvent);
}
}
String lastSort = equipAlarmEventMapper.getLastDataBySort(stationBasic.getFanGatewayId());
if (null != lastSort) {
List<EquipAlarmEvent> oldEquipAlarmEvents = equipAlarmEventMapper.getOldDataBySort(lastSort,
stationBasic.getFanGatewayId());
for (EquipAlarmEvent oldEquipAlarmEvent : oldEquipAlarmEvents) {
for (EquipAlarmEvent equipAlarmEvent : newEquipAlarmEvents) {
if (oldEquipAlarmEvent.getEquipIndex().equals(equipAlarmEvent.getEquipIndex())
&& oldEquipAlarmEvent.getAlarmDesc().equals(equipAlarmEvent.getAlarmDesc())
&& oldEquipAlarmEvent.getValue().equals(equipAlarmEvent.getValue())) {
newEquipAlarmEvent.remove(equipAlarmEvent);
}
}
}
}
equipAlarmEventService.saveBatch(newEquipAlarmEvent);
}
}
public HashMap<String, String> getPvNBQStationBy(String gatewayId) {
HashMap<String, String> result = new HashMap<>();
Map<String, List<String>> queryCondition = new HashMap<>();
queryCondition.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("运行"));
queryCondition.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
Map<String, String> shouldCondition = new HashMap<>();
shouldCondition.put(CommonConstans.QueryStringFrontMoudle, "逆变器");
List<ESEquipments> totalEquipmentList = commonServiceImpl.getListDataByCondtions(queryCondition,
shouldCondition, ESEquipments.class);
totalEquipmentList.forEach(indicatorsDto -> result.put(indicatorsDto.getEquipmentNumber(), "正常运行"));
Map<String, List<String>> queryCondition1 = new HashMap<>();
queryCondition1.put(CommonConstans.QueryStringEquipmentIndexName,
Arrays.asList("运行", "待机", "故障停机", "告警运行", "限额运行", "停机", "通讯故障", "'降额运行'"));
queryCondition1.put(CommonConstans.QueryStringValueKeyword, Arrays.asList("true"));
queryCondition1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
List<ESEquipments> indicatorsDtoList = commonServiceImpl.getListDataByCondtions(queryCondition1,
shouldCondition, ESEquipments.class);
indicatorsDtoList.forEach(esEquipments -> {
if (!"运行".equals(esEquipments.getEquipmentIndexName())) {
result.put(esEquipments.getEquipmentNumber(),
CommonConstans.pvStatus.get(esEquipments.getEquipmentIndexName()));
}
});
return result;
}
@Scheduled(cron = "0 */5 * * * ?")
public void addNbqAlarmEvent() {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BaseEntity::getIsDelete, false);
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
for (StationBasic stationBasic : stationBasics) {
Map<String, List<String>> queryCondtion = new HashMap<>();
Map<String, String> shouldCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("待机", "停机", "告警运行", "限额运行", "降额运行", "故障停机", "通讯故障", "运行"));
queryCondtion.put(CommonConstans.QueryStringValueKeyword, Arrays.asList("true"));
/**
* 逆变器
*/
List<ESEquipments> indicatorsDtoList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
/**
* 汇流箱
*/
queryCondtion.remove(CommonConstans.QueryStringEquipmentIndexName);
queryCondtion.remove(CommonConstans.QueryStringValueKeyword);
queryCondtion.put(CommonConstans.QueryStringDataType, Arrays.asList("state"));
shouldCondtion.put(CommonConstans.QueryStringFrontMoudle, "汇流箱");
List<ESEquipments> indicatorsDtoListHLX = commonServiceImpl.getListDataByCondtions(queryCondtion, shouldCondtion, ESEquipments.class);
/**
* 箱变
*/
shouldCondtion.put(CommonConstans.QueryStringFrontMoudle, "箱变");
List<ESEquipments> indicatorsDtoListXB = commonServiceImpl.getListDataByCondtions(queryCondtion, shouldCondtion, ESEquipments.class);
;
indicatorsDtoList.addAll(indicatorsDtoListHLX);
indicatorsDtoList.addAll(indicatorsDtoListXB);
List<EquipAlarmEvent> newEquipAlarmEvents = new ArrayList<>();
List<EquipAlarmEvent> newEquipAlarmEvent = new ArrayList<>();
long time = new Date().getTime();
if (CollectionUtils.isNotEmpty(indicatorsDtoList)){
for (ESEquipments esEquipments : indicatorsDtoList) {
EquipAlarmEvent equipAlarmEvent = new EquipAlarmEvent();
equipAlarmEvent.setEquipIndex(esEquipments.getEquipmentNumber());
equipAlarmEvent.setEquipName(esEquipments.getEquipmentSpecificName());
equipAlarmEvent.setAlarmDesc(AlarmDesc.getCode(esEquipments.getEquipmentIndexName()));
equipAlarmEvent.setAlarmDesc(StringUtils.isEmpty(equipAlarmEvent.getAlarmDesc()) ? esEquipments.getEquipmentIndexName() : equipAlarmEvent.getAlarmDesc());
equipAlarmEvent.setCreatedTime(esEquipments.getCreatedTime());
equipAlarmEvent.setGatewayId(stationBasic.getFanGatewayId());
equipAlarmEvent.setSort(time);
equipAlarmEvent.setFrontModule(esEquipments.getFrontModule());
equipAlarmEvent.setValue(esEquipments.getValue());
newEquipAlarmEvents.add(equipAlarmEvent);
newEquipAlarmEvent.add(equipAlarmEvent);
}
}
String lastSort = equipAlarmEventMapper.getLastDataBySort(stationBasic.getFanGatewayId());
if (null != lastSort) {
List<EquipAlarmEvent> oldEquipAlarmEvents = equipAlarmEventMapper.getOldDataBySort(lastSort, stationBasic.getFanGatewayId());
for (EquipAlarmEvent oldEquipAlarmEvent : oldEquipAlarmEvents) {
for (EquipAlarmEvent equipAlarmEvent : newEquipAlarmEvents) {
if (oldEquipAlarmEvent.getEquipIndex().equals(equipAlarmEvent.getEquipIndex()) &&
oldEquipAlarmEvent.getAlarmDesc().equals(equipAlarmEvent.getAlarmDesc()) &&
oldEquipAlarmEvent.getValue().equals(equipAlarmEvent.getValue())) {
newEquipAlarmEvent.remove(equipAlarmEvent);
}
}
}
}
equipAlarmEventService.saveBatch(newEquipAlarmEvent);
}
}
public HashMap<String, String> getPvNBQStationBy(String gatewayId) {
HashMap<String, String> result = new HashMap<>();
Map<String, List<String>> queryCondition = new HashMap<>();
queryCondition.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("运行"));
queryCondition.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
Map<String, String> shouldCondition = new HashMap<>();
shouldCondition.put(CommonConstans.QueryStringFrontMoudle, "逆变器");
List<ESEquipments> totalEquipmentList = commonServiceImpl.getListDataByCondtions(queryCondition, shouldCondition, ESEquipments.class);
totalEquipmentList.forEach(indicatorsDto -> result.put(indicatorsDto.getEquipmentNumber(), "正常运行"));
Map<String, List<String>> queryCondition1 = new HashMap<>();
queryCondition1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("运行", "待机", "故障停机", "告警运行", "限额运行", "停机", "通讯故障", "'降额运行'"));
queryCondition1.put(CommonConstans.QueryStringValueKeyword, Arrays.asList("true"));
queryCondition1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
List<ESEquipments> indicatorsDtoList = commonServiceImpl.getListDataByCondtions(queryCondition1, shouldCondition, ESEquipments.class);
indicatorsDtoList.forEach(esEquipments -> {
if (!"运行".equals(esEquipments.getEquipmentIndexName())) {
result.put(esEquipments.getEquipmentNumber(), CommonConstans.pvStatus.get(esEquipments.getEquipmentIndexName()));
}
});
return result;
}
}
......@@ -283,20 +283,20 @@ public class MonitoringServiceIMQTTmpl {
/**
* 实时推送-场站功率曲线总概览
*/
@Scheduled(cron = fanStationPowerBightCron)
public void getFanStationPowerBight() {
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("sequence_nbr").eq("station_type", "FDZ"));
stationBasicList.forEach(stationBasic -> {
String gatewayId = stationBasic.getFanGatewayId();
Map<String, Object> detailsWindSpeed = monitorFanIndicator.getDetailsWindSpeedAll(gatewayId);
try {
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_fanStationPowerBight_topic", JSON.toJSON(detailsWindSpeed).toString().getBytes("UTF-8"), 1, true);
logger.info("-----------------发送风电站功率曲线数据消息=================== 成功!" + JSON.toJSONString(detailsWindSpeed));
} catch (Exception exception) {
logger.error("-----------------发送风电站功率曲线数据消息=================== 失败!");
}
});
}
// @Scheduled(cron = fanStationPowerBightCron)
// public void getFanStationPowerBight() {
// List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("sequence_nbr").eq("station_type", "FDZ"));
// stationBasicList.forEach(stationBasic -> {
// String gatewayId = stationBasic.getFanGatewayId();
// Map<String, Object> detailsWindSpeed = monitorFanIndicator.getDetailsWindSpeedAll(gatewayId);
// try {
// emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_fanStationPowerBight_topic", JSON.toJSON(detailsWindSpeed).toString().getBytes("UTF-8"), 1, true);
// logger.info("-----------------发送风电站功率曲线数据消息=================== 成功!" + JSON.toJSONString(detailsWindSpeed));
// } catch (Exception exception) {
// logger.error("-----------------发送风电站功率曲线数据消息=================== 失败!");
// }
// });
// }
/**
* 实时同送-获取各场站的风机列表
......
......@@ -830,7 +830,7 @@ public class MonitoringServiceImpl {
sorted.forEach(stationBasic -> {
HashMap<String, String> hashMap1 = new HashMap<>();
hashMap1.put("stationName", stationBasic.getStationName());
hashMap1.put("value", stationBasic.getAddress());
hashMap1.put("value", stationBasic.getAddress()+"%");
hashMap1.put("value1", stationBasic.getAddress());
mapList.add(hashMap1);
});
......@@ -1051,19 +1051,19 @@ public class MonitoringServiceImpl {
page2.setRecords(list2);
Double totalAnnual = (powerOfAnnualFD + powerOfAnnualGF);
HashMap<String, String> stringHashMap13 = new HashMap<>();
stringHashMap13.put("title1", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.carbonDioxide * CommonConstans.kgToT)));
stringHashMap13.put("title1", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.carbonDioxide )));
stringHashMap13.put("title2", "二氧化碳减排量(t)");
list3.add(stringHashMap13);
HashMap<String, String> stringHashMap14 = new HashMap<>();
stringHashMap14.put("title1", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.standardCoal * CommonConstans.kgToT)));
stringHashMap14.put("title1", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.standardCoal )));
stringHashMap14.put("title2", "节约标准煤(t)");
list3.add(stringHashMap14);
HashMap<String, String> stringHashMap15 = new HashMap<>();
stringHashMap15.put("title1", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.toner * CommonConstans.kgToT)));
stringHashMap15.put("title1", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.toner )));
stringHashMap15.put("title2", "碳粉尘减排量(t)");
list3.add(stringHashMap15);
HashMap<String, String> stringHashMap16 = new HashMap<>();
stringHashMap16.put("title1", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.sulfurDioxide * CommonConstans.kgToT)));
stringHashMap16.put("title1", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.sulfurDioxide )));
stringHashMap16.put("title2", "二氧化硫减排量(t)");
list3.add(stringHashMap16);
page3.setRecords(list3);
......
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