模拟数据上报修改
This commit is contained in:
parent
4bcd42fa26
commit
a6feb63e48
@ -161,7 +161,7 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
|
|||||||
|
|
||||||
List<SysTabMappingVo> tabMappingVoList = sysImptabmappingMapper.getMappingInfoListByLinkIdAndDeviceId(sysCommunicationLinkVo.getId(), dev.getId());
|
List<SysTabMappingVo> tabMappingVoList = sysImptabmappingMapper.getMappingInfoListByLinkIdAndDeviceId(sysCommunicationLinkVo.getId(), dev.getId());
|
||||||
|
|
||||||
if (sysCommunicationLinkVo.getProtocol() == 17 || sysCommunicationLinkVo.getProtocol() == 9){
|
if (sysCommunicationLinkVo.getProtocol() == 17 || sysCommunicationLinkVo.getProtocol() == 9) {
|
||||||
List<SysTabMappingVo> orderMappingVoList = tabMappingVoList.stream().filter(item -> ObjectUtil.isNotEmpty(JSONObject.parseObject(item.getParams()).get("order"))).collect(Collectors.toList());
|
List<SysTabMappingVo> orderMappingVoList = tabMappingVoList.stream().filter(item -> ObjectUtil.isNotEmpty(JSONObject.parseObject(item.getParams()).get("order"))).collect(Collectors.toList());
|
||||||
tabMappingVoList.clear();
|
tabMappingVoList.clear();
|
||||||
tabMappingVoList.addAll(orderMappingVoList);
|
tabMappingVoList.addAll(orderMappingVoList);
|
||||||
@ -240,6 +240,7 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
|
|||||||
JsonNode jsonNode = data.getData();
|
JsonNode jsonNode = data.getData();
|
||||||
String deviceId = jsonNode.get("deviceId").asText();
|
String deviceId = jsonNode.get("deviceId").asText();
|
||||||
JsonNode values = jsonNode.get("values");
|
JsonNode values = jsonNode.get("values");
|
||||||
|
JsonNode archiveValues = jsonNode.get("archiveValues");
|
||||||
Long dataTime = jsonNode.get("dataTime").asLong();
|
Long dataTime = jsonNode.get("dataTime").asLong();
|
||||||
Map<String, Object> keyValueMap = new HashMap<>();
|
Map<String, Object> keyValueMap = new HashMap<>();
|
||||||
String modelCode = dataService.deviceModelMap.get(deviceId);
|
String modelCode = dataService.deviceModelMap.get(deviceId);
|
||||||
@ -254,30 +255,34 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
|
|||||||
String fieldName = keysHigh.next();
|
String fieldName = keysHigh.next();
|
||||||
String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase());
|
String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase());
|
||||||
keyValueMap.put(key, values.get(fieldName));
|
keyValueMap.put(key, values.get(fieldName));
|
||||||
if (highKey.contains(fieldName)){
|
|
||||||
highSpeedValueMap.put(fieldName,values.get(fieldName));
|
|
||||||
}
|
}
|
||||||
if (lowKey.contains(fieldName)){
|
Iterator<String> archiveKeys = archiveValues.fieldNames();
|
||||||
lowSpeedValueMap.put(fieldName,values.get(fieldName));
|
while (archiveKeys.hasNext()) {
|
||||||
|
String fieldName = archiveKeys.next();
|
||||||
|
String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase());
|
||||||
|
keyValueMap.put(key, values.get(fieldName));
|
||||||
|
if (highKey.contains(fieldName)) {
|
||||||
|
highSpeedValueMap.put(fieldName, values.get(fieldName));
|
||||||
|
}
|
||||||
|
if (lowKey.contains(fieldName)) {
|
||||||
|
lowSpeedValueMap.put(fieldName, values.get(fieldName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
adminRedisTemplate.mSet(keyValueMap);
|
|
||||||
if (jsonNode.get("isStore") != null && jsonNode.get("isStore").asBoolean()) {
|
|
||||||
//更新td
|
//更新td
|
||||||
if (!highSpeedValueMap.isEmpty()){
|
if (!highSpeedValueMap.isEmpty()) {
|
||||||
List<RTData> highSpeedData = new ArrayList<>();
|
List<RTData> highSpeedData = new ArrayList<>();
|
||||||
RTData rtHighData = RTData.builder().dataTime(dataTime).deviceId(Long.valueOf(deviceId)).values(highSpeedValueMap).build();
|
RTData rtHighData = RTData.builder().dataTime(dataTime).deviceId(Long.valueOf(deviceId)).values(highSpeedValueMap).build();
|
||||||
highSpeedData.add(rtHighData);
|
highSpeedData.add(rtHighData);
|
||||||
tdEngineService.updateYCHighValues(highSpeedData,modelCode);
|
tdEngineService.updateYCHighValues(highSpeedData, modelCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lowSpeedValueMap.isEmpty()){
|
if (!lowSpeedValueMap.isEmpty()) {
|
||||||
List<RTData> lowSpeedData = new ArrayList<>();
|
List<RTData> lowSpeedData = new ArrayList<>();
|
||||||
RTData rtLowData = RTData.builder().dataTime(dataTime).deviceId(Long.valueOf(deviceId)).values(lowSpeedValueMap).build();
|
RTData rtLowData = RTData.builder().dataTime(dataTime).deviceId(Long.valueOf(deviceId)).values(lowSpeedValueMap).build();
|
||||||
lowSpeedData.add(rtLowData);
|
lowSpeedData.add(rtLowData);
|
||||||
tdEngineService.updateYCLowValues(lowSpeedData,modelCode);
|
tdEngineService.updateYCLowValues(lowSpeedData, modelCode);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
adminRedisTemplate.mSet(keyValueMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -368,25 +373,25 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
|
|||||||
if (!StringUtils.isEmpty(eventType) && eventType.equals("遥信变位")) {
|
if (!StringUtils.isEmpty(eventType) && eventType.equals("遥信变位")) {
|
||||||
String stateDesc = dataService.stateDescMap.get(model).get(item.getAttrCode());
|
String stateDesc = dataService.stateDescMap.get(model).get(item.getAttrCode());
|
||||||
if (item.getAttrValue().equals(0)) {
|
if (item.getAttrValue().equals(0)) {
|
||||||
deviceEventInfo.setEventText(item.getAttrCode()+fieldName + " 复归");
|
deviceEventInfo.setEventText(item.getAttrCode() + fieldName + " 复归");
|
||||||
if (StringUtils.isNotEmpty(stateDesc)){
|
if (StringUtils.isNotEmpty(stateDesc)) {
|
||||||
List<String> descList = Arrays.stream(stateDesc.split("\\|")).toList();
|
List<String> descList = Arrays.stream(stateDesc.split("\\|")).toList();
|
||||||
deviceEventInfo.setEventText(item.getAttrCode()+fieldName + descList.get(0));
|
deviceEventInfo.setEventText(item.getAttrCode() + fieldName + descList.get(0));
|
||||||
}
|
}
|
||||||
deviceEventInfo.setEventLevel(0);
|
deviceEventInfo.setEventLevel(0);
|
||||||
} else {
|
} else {
|
||||||
deviceEventInfo.setEventText(item.getAttrCode()+fieldName + " 动作");
|
deviceEventInfo.setEventText(item.getAttrCode() + fieldName + " 动作");
|
||||||
if (StringUtils.isNotEmpty(stateDesc)){
|
if (StringUtils.isNotEmpty(stateDesc)) {
|
||||||
List<String> descList = Arrays.stream(stateDesc.split("\\|")).toList();
|
List<String> descList = Arrays.stream(stateDesc.split("\\|")).toList();
|
||||||
deviceEventInfo.setEventText(item.getAttrCode()+fieldName + descList.get(1));
|
deviceEventInfo.setEventText(item.getAttrCode() + fieldName + descList.get(1));
|
||||||
}
|
}
|
||||||
Integer level = dataService.eventLevelMap.get(model).get(item.getAttrCode());
|
Integer level = dataService.eventLevelMap.get(model).get(item.getAttrCode());
|
||||||
log.info("level:{}",level);
|
log.info("level:{}", level);
|
||||||
log.info("fieldname{}",fieldName);
|
log.info("fieldname{}", fieldName);
|
||||||
deviceEventInfo.setEventLevel( level == null ? 0 : level);
|
deviceEventInfo.setEventLevel(level == null ? 0 : level);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
deviceEventInfo.setEventText(item.getAttrCode()+fieldName + eventType + ",属性值为:" + item.getAttrValue() + ",越限值为:" + item.getLimitValue());
|
deviceEventInfo.setEventText(item.getAttrCode() + fieldName + eventType + ",属性值为:" + item.getAttrValue() + ",越限值为:" + item.getLimitValue());
|
||||||
deviceEventInfo.setEventLevel(1);
|
deviceEventInfo.setEventLevel(1);
|
||||||
}
|
}
|
||||||
valueList.add(deviceEventInfo);
|
valueList.add(deviceEventInfo);
|
||||||
|
Loading…
Reference in New Issue
Block a user