|
...
|
...
|
@@ -71,30 +71,62 @@ public class AllPostTopic implements BusinessAgreement<AllPostDto> { |
|
|
|
{
|
|
|
|
if(deviceDataConfigMap.containsKey(key))
|
|
|
|
{
|
|
|
|
log.info("点位{}",key);
|
|
|
|
String dttribute_value = object.get(key).toString();
|
|
|
|
String newDataValue= ByteUtil.changerTwoStr(dttribute_value);
|
|
|
|
|
|
|
|
DeviceDataConfig deviceDataConfig = deviceDataConfigMap.get(key);
|
|
|
|
String newAlrmCode = "00";
|
|
|
|
String deviceInfoId = deviceDataConfig.getDeviceInfoId(topic.getClientid()); //根据点位协议解析到设备id
|
|
|
|
log.info("点位对应的设备id{}",deviceInfoId);
|
|
|
|
if(deviceInfoId.equals(topic.getClientid()))
|
|
|
|
{
|
|
|
|
if(null != list )
|
|
|
|
{
|
|
|
|
for (DeviceInfo deviceInfo:list)
|
|
|
|
{
|
|
|
|
updevice(deviceInfo,deviceDataConfig,topic,data,newDataValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
DeviceInfo deviceInfo = getDeviceInfo(deviceInfoList,deviceInfoId);
|
|
|
|
updevice(deviceInfo,deviceDataConfig,topic,data,newDataValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void updevice(DeviceInfo deviceInfo, DeviceDataConfig deviceDataConfig,Topic topic,AllPostDto data,String newDataValue)
|
|
|
|
{
|
|
|
|
if(null != deviceInfo)
|
|
|
|
{
|
|
|
|
String newAlrmCode = "00";
|
|
|
|
|
|
|
|
switch (PLCDataType.valueOf(deviceDataConfig.getPlc_data_type()))
|
|
|
|
{
|
|
|
|
case 故障代码:
|
|
|
|
log.info("故障代码{}",newDataValue);
|
|
|
|
if(newDataValue.equals(deviceDataConfig.getAlarmValue()))
|
|
|
|
{
|
|
|
|
newAlrmCode = deviceDataConfig.getAlarmCode();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 控制柜状态:
|
|
|
|
log.info("控制柜状态{}",newDataValue);
|
|
|
|
analysisData(data,deviceInfo,deviceDataConfig,newDataValue,topic);
|
|
|
|
break;
|
|
|
|
case 校准时间:
|
|
|
|
log.info("校准时间{}",newDataValue);
|
|
|
|
analysisData(data,deviceInfo,deviceDataConfig,newDataValue,topic);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
log.info("默认功能{}",newDataValue);
|
|
|
|
analysisData(data,deviceInfo,deviceDataConfig,newDataValue,topic);
|
|
|
|
break;
|
|
|
|
}
|
|
...
|
...
|
@@ -104,14 +136,6 @@ public class AllPostTopic implements BusinessAgreement<AllPostDto> { |
|
|
|
deviceInfo.setOnline("01");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void analysisTime( JSONObject jsonObject,Map<String, DeviceDataConfig> deviceDataConfigMap,Topic topic,List<DeviceInfo> deviceInfoList)
|
|
|
|
{
|
|
|
|
if(null != jsonObject && jsonObject.size() != 0)
|
|
...
|
...
|
@@ -227,6 +251,7 @@ public class AllPostTopic implements BusinessAgreement<AllPostDto> { |
|
|
|
jsonObject = GsonConstructor.get().fromJson(dataValue,JSONObject.class);
|
|
|
|
}
|
|
|
|
String odlDataValue = (String) jsonObject.get(PLCDataType.valueOf(deviceDataConfig.getPlc_data_type()).sensorDataType);
|
|
|
|
log.info("数据变化"+deviceDataConfig.getAttribute_name()+" "+odlDataValue+"-->"+newDataValue);
|
|
|
|
if(!newDataValue.equals(odlDataValue))
|
|
|
|
{
|
|
|
|
jsonObject.put(PLCDataType.valueOf(deviceDataConfig.getPlc_data_type()).sensorDataType,newDataValue); //更新数据
|
...
|
...
|
|