Merge remote-tracking branch 'origin/main'

This commit is contained in:
yu 2024-11-21 10:15:29 +08:00
commit 6b3a77009d
2 changed files with 7 additions and 1 deletions

View File

@ -63,6 +63,8 @@ public class DataServiceImpl implements DataService {
//key:modelCode value:FiledCode,dataType
public ConcurrentHashMap<String, Map<String, String>> calculateIotFieldMap = new ConcurrentHashMap<>(10000);
public ConcurrentHashMap<String, Map<String, Integer>> eventLevelMap = new ConcurrentHashMap<>(10000);
/**
* 读取实时数据快照
* @param paramList 设备id及设备属性列表
@ -216,6 +218,7 @@ public class DataServiceImpl implements DataService {
Map<String, String> HighModelFieldList = allIotModelField.stream().filter(field -> field.getHighSpeed() == 1 && field.getAttributeType() != 199).collect(Collectors.toMap(SysIotModelField::getAttributeCode, SysIotModelField::getDataType, (value1, value2) -> value1));
Map<String, String> calculateFieldList = allIotModelField.stream().filter(field -> field.getAttributeType() == 199).collect(Collectors.toMap(SysIotModelField::getAttributeCode, SysIotModelField::getDataType, (value1, value2) -> value1));
Map<String, String> fieldCodeNameList = allIotModelField.stream().collect(Collectors.toMap(SysIotModelField::getAttributeCode, SysIotModelField::getAttributeName, (value1, value2) -> value1));
Map<String, Integer> eventLevelList = allIotModelField.stream().filter(field -> field.getAttributeType() == 140 && field.getLevel() != null).collect(Collectors.toMap(SysIotModelField::getAttributeCode, SysIotModelField::getLevel, (value1, value2) -> value1));
Map<String, Object> map = new HashMap<>();
for (String field : HighModelFieldList.keySet()) {
map.put(field, HighModelFieldList.get(field));
@ -226,6 +229,7 @@ public class DataServiceImpl implements DataService {
lowMap.put(field, LowModelFieldList.get(field));
}
lowIotFieldMap.put(item.getIotModelCode(), lowMap);
eventLevelMap.put(item.getIotModelCode(),eventLevelList);
fieldCodeNameMap.put(item.getIotModelCode(),fieldCodeNameList);
calculateIotFieldMap.put(item.getIotModelCode(), calculateFieldList);
}

View File

@ -359,16 +359,18 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
log.debug("未查询到物模型属性code设备id{}", item.getDeviceId());
}
deviceEventInfo.setEventType(item.getEventType());
deviceEventInfo.setEventLevel(0);
deviceEventInfo.setConfirmed(0);
if (!StringUtils.isEmpty(eventType) && eventType.equals("遥信变位")) {
if (item.getAttrValue().equals(0)) {
deviceEventInfo.setEventText(fieldName + " 复归");
deviceEventInfo.setEventLevel(0);
} else {
deviceEventInfo.setEventText(fieldName + " 动作");
deviceEventInfo.setEventLevel(dataService.eventLevelMap.get(model).get(fieldName));
}
} else {
deviceEventInfo.setEventText(fieldName + eventType + ",属性值为:" + item.getAttrValue() + ",越限值为:" + item.getLimitValue());
deviceEventInfo.setEventLevel(1);
}
valueList.add(deviceEventInfo);
}