Commit e31e43f0 authored by wujiang's avatar wujiang

提交代码

parent adbe99e1
...@@ -2125,78 +2125,94 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -2125,78 +2125,94 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return deaviationRateDtoPage; return deaviationRateDtoPage;
} }
@Scheduled(cron = "0 */5 * * * ?") @Scheduled(cron = "0 */10 * * * ?")
public void addNbqAlarmEvent() { //@Scheduled(cron = "0/1 * * * * ?")
public void addNbqAlarmEvent() {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BaseEntity::getIsDelete, false); LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper); wrapper.eq(BaseEntity::getIsDelete, false);
for (StationBasic stationBasic : stationBasics) { wrapper.like(StationBasic::getStationType, "GFDZ");
Map<String, List<String>> queryCondtion = new HashMap<>(); List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
Map<String, String> shouldCondtion = new HashMap<>(); for (StationBasic stationBasic : stationBasics) {
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("待机", "停机", "告警运行", "限额运行", "降额运行", "故障停机", "通讯故障", "运行")); Map<String, String> shouldCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringValueKeyword, Arrays.asList("true")); 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); /**
/** * 逆变器
* 汇流箱 */
*/ List<ESEquipments> indicatorsDtoList = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
queryCondtion.remove(CommonConstans.QueryStringEquipmentIndexName); ESEquipments.class);
queryCondtion.remove(CommonConstans.QueryStringValueKeyword); Collections.sort(indicatorsDtoList, (a, b) -> (b.getCreatedTime())
queryCondtion.put(CommonConstans.QueryStringDataType, Arrays.asList("state")); .compareTo(a.getCreatedTime()));
shouldCondtion.put(CommonConstans.QueryStringFrontMoudle, "汇流箱");
List<ESEquipments> indicatorsDtoListHLX = commonServiceImpl.getListDataByCondtions(queryCondtion, shouldCondtion, ESEquipments.class); //过滤重复状态
/** List<ESEquipments> nindicatorsDtoList=indicatorsDtoList.stream().collect(Collectors.collectingAndThen(
* 箱变 Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(ESEquipments::getDisplayName))), ArrayList::new));
*/
shouldCondtion.put(CommonConstans.QueryStringFrontMoudle, "箱变");
List<ESEquipments> indicatorsDtoListXB = commonServiceImpl.getListDataByCondtions(queryCondtion, shouldCondtion, ESEquipments.class);
; /**
indicatorsDtoList.addAll(indicatorsDtoListHLX); * 汇流箱
indicatorsDtoList.addAll(indicatorsDtoListXB); */
queryCondtion.remove(CommonConstans.QueryStringEquipmentIndexName);
List<EquipAlarmEvent> newEquipAlarmEvents = new ArrayList<>(); queryCondtion.remove(CommonConstans.QueryStringValueKeyword);
List<EquipAlarmEvent> newEquipAlarmEvent = new ArrayList<>(); queryCondtion.put(CommonConstans.QueryStringDataType, Arrays.asList("state"));
long time = new Date().getTime(); shouldCondtion.put(CommonConstans.QueryStringFrontMoudle, "汇流箱");
if (CollectionUtils.isNotEmpty(indicatorsDtoList)){ List<ESEquipments> indicatorsDtoListHLX = commonServiceImpl.getListDataByCondtions(queryCondtion,
for (ESEquipments esEquipments : indicatorsDtoList) { shouldCondtion, ESEquipments.class);
EquipAlarmEvent equipAlarmEvent = new EquipAlarmEvent(); /**
equipAlarmEvent.setEquipIndex(esEquipments.getEquipmentNumber()); * 箱变
equipAlarmEvent.setEquipName(esEquipments.getEquipmentSpecificName()); */
equipAlarmEvent.setAlarmDesc(AlarmDesc.getCode(esEquipments.getEquipmentIndexName())); shouldCondtion.put(CommonConstans.QueryStringFrontMoudle, "箱变");
equipAlarmEvent.setAlarmDesc(StringUtils.isEmpty(equipAlarmEvent.getAlarmDesc()) ? esEquipments.getEquipmentIndexName() : equipAlarmEvent.getAlarmDesc()); List<ESEquipments> indicatorsDtoListXB = commonServiceImpl.getListDataByCondtions(queryCondtion,
equipAlarmEvent.setCreatedTime(esEquipments.getCreatedTime()); shouldCondtion, ESEquipments.class);
equipAlarmEvent.setGatewayId(stationBasic.getFanGatewayId()); nindicatorsDtoList.addAll(indicatorsDtoListHLX);
equipAlarmEvent.setSort(time); nindicatorsDtoList.addAll(indicatorsDtoListXB);
equipAlarmEvent.setFrontModule(esEquipments.getFrontModule());
equipAlarmEvent.setValue(esEquipments.getValue()); List<EquipAlarmEvent> newEquipAlarmEvents = new ArrayList<>();
newEquipAlarmEvents.add(equipAlarmEvent); List<EquipAlarmEvent> newEquipAlarmEvent = new ArrayList<>();
newEquipAlarmEvent.add(equipAlarmEvent); long time = new Date().getTime();
} if (CollectionUtils.isNotEmpty(nindicatorsDtoList)) {
} for (ESEquipments esEquipments : nindicatorsDtoList) {
EquipAlarmEvent equipAlarmEvent = new EquipAlarmEvent();
equipAlarmEvent.setEquipIndex(esEquipments.getEquipmentNumber());
String lastSort = equipAlarmEventMapper.getLastDataBySort(stationBasic.getFanGatewayId()); equipAlarmEvent.setEquipName(esEquipments.getEquipmentSpecificName());
if (null != lastSort) { equipAlarmEvent.setAlarmDesc(AlarmDesc.getCode(esEquipments.getEquipmentIndexName()));
List<EquipAlarmEvent> oldEquipAlarmEvents = equipAlarmEventMapper.getOldDataBySort(lastSort, stationBasic.getFanGatewayId()); equipAlarmEvent.setAlarmDesc(
for (EquipAlarmEvent oldEquipAlarmEvent : oldEquipAlarmEvents) { StringUtils.isEmpty(equipAlarmEvent.getAlarmDesc()) ? esEquipments.getEquipmentIndexName()
for (EquipAlarmEvent equipAlarmEvent : newEquipAlarmEvents) { : equipAlarmEvent.getAlarmDesc());
if (oldEquipAlarmEvent.getEquipIndex().equals(equipAlarmEvent.getEquipIndex()) && equipAlarmEvent.setCreatedTime(esEquipments.getCreatedTime());
oldEquipAlarmEvent.getAlarmDesc().equals(equipAlarmEvent.getAlarmDesc()) && equipAlarmEvent.setGatewayId(stationBasic.getFanGatewayId());
oldEquipAlarmEvent.getValue().equals(equipAlarmEvent.getValue())) { equipAlarmEvent.setSort(time);
newEquipAlarmEvent.remove(equipAlarmEvent); equipAlarmEvent.setFrontModule(esEquipments.getFrontModule());
} equipAlarmEvent.setValue(esEquipments.getValue());
} newEquipAlarmEvents.add(equipAlarmEvent);
} newEquipAlarmEvent.add(equipAlarmEvent);
} }
equipAlarmEventService.saveBatch(newEquipAlarmEvent); }
} 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) { public HashMap<String, String> getPvNBQStationBy(String gatewayId) {
HashMap<String, String> result = new HashMap<>(); HashMap<String, String> result = new HashMap<>();
......
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