|
@ -180,21 +180,15 @@ public class OnenetService {
|
|
|
//烟雾浓度
|
|
|
String monitorValue = StringUtil.division(Integer.valueOf(wParamValue),10);
|
|
|
String resourceSerial = onenetDevice.getSn();
|
|
|
DeviceHealthIndex index = new DeviceHealthIndex();
|
|
|
index.setDeviceSn(resourceSerial);
|
|
|
index.setUnit("%");
|
|
|
index.setValue(monitorValue);
|
|
|
index.setRecordTime(time);
|
|
|
index.setDeviceType("2");
|
|
|
deviceHealthIndexDao.save(index);
|
|
|
addDeviceIndex(resourceSerial,monitorValue,time,"2","%");
|
|
|
dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"可燃气体探测器监测信息接收");
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
if("02".equals(byMessageId)){
|
|
|
//报警
|
|
|
// String byTime = value.substring(18,26);//时间 秒
|
|
|
// String time = DateUtil.dateToStrLong(DateUtil.secondTransfor(Integer.parseInt(byTime)));
|
|
|
String byTime = value.substring(18,26);//时间 秒
|
|
|
String time = DateUtil.dateToStrLong(DateUtil.secondTransfor(Integer.parseInt(byTime)));
|
|
|
String valueTmp = value.substring(236);
|
|
|
//0060 0001 0061 0001 0064 0000 0002 0001 0087 00
|
|
|
String wChanRscType = valueTmp.substring(0,4);
|
|
@ -209,11 +203,18 @@ public class OnenetService {
|
|
|
//烟雾浓度
|
|
|
String monitorValue = StringUtil.division(Integer.valueOf(wParamValue),10);
|
|
|
String resourceSerial = onenetDevice.getSn();
|
|
|
//独立式光电感烟探测器(NB)
|
|
|
JSONObject tmp = new JSONObject();
|
|
|
tmp.put("smoke",monitorValue);
|
|
|
orderUtil.createSecurityOrder(resourceSerial,null,new JSONObject(),null,7,"10","preventFire",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
|
|
|
dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"烟感探测器报警信息接收");
|
|
|
String sql = "select count(*) from base_device_health_index where device_sn = '"+resourceSerial+"'" +
|
|
|
" and value>0 and create_time>='"+DateUtil.getNextMinute(-60)+"' ";
|
|
|
Integer count = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
if(count==0){
|
|
|
logger.info("烟雾浓度大于0触发报警,deviceSn:{}",resourceSerial);
|
|
|
//1小时内不重复发起
|
|
|
JSONObject tmp = new JSONObject();
|
|
|
tmp.put("smoke",monitorValue);
|
|
|
orderUtil.createSecurityOrder(resourceSerial,null,new JSONObject(),null,7,"10","preventFire",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
|
|
|
dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"烟感探测器报警信息接收");
|
|
|
}
|
|
|
addDeviceIndex(resourceSerial,monitorValue,time,"2","%");
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -223,6 +224,24 @@ public class OnenetService {
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 保存记录
|
|
|
* @param resourceSerial
|
|
|
* @param monitorValue
|
|
|
* @param time
|
|
|
* @param deviceType
|
|
|
* @param unit
|
|
|
*/
|
|
|
public void addDeviceIndex(String resourceSerial,String monitorValue,String time,String deviceType,String unit){
|
|
|
DeviceHealthIndex index = new DeviceHealthIndex();
|
|
|
index.setDeviceSn(resourceSerial);
|
|
|
index.setUnit(unit);
|
|
|
index.setValue(monitorValue);
|
|
|
index.setRecordTime(time);
|
|
|
index.setDeviceType(deviceType);
|
|
|
deviceHealthIndexDao.save(index);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 海康设备解析-气感
|
|
|
*/
|
|
@ -245,22 +264,15 @@ public class OnenetService {
|
|
|
//气感浓度
|
|
|
String monitorValue = StringUtil.division(Integer.valueOf(wParamValue),10);
|
|
|
String resourceSerial = onenetDevice.getSn();
|
|
|
DeviceHealthIndex index = new DeviceHealthIndex();
|
|
|
index.setDeviceSn(resourceSerial);
|
|
|
index.setUnit("%LEL");
|
|
|
index.setValue(monitorValue);
|
|
|
index.setRecordTime(time);
|
|
|
//独立式可燃气体探测器(NB)
|
|
|
index.setDeviceType("1");
|
|
|
deviceHealthIndexDao.save(index);
|
|
|
addDeviceIndex(resourceSerial,monitorValue,time,"1","%LEL");
|
|
|
dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"可燃气体探测器监测信息接收");
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
if("02".equals(byMessageId)){
|
|
|
//报警
|
|
|
// String byTime = value.substring(18,26);//时间 秒
|
|
|
// String time = DateUtil.dateToStrLong(DateUtil.secondTransfor(Integer.parseInt(byTime)));
|
|
|
String byTime = value.substring(18,26);//时间 秒
|
|
|
String time = DateUtil.dateToStrLong(DateUtil.secondTransfor(Integer.parseInt(byTime)));
|
|
|
String valueTmp = value.substring(236);
|
|
|
//0060 0001 0061 0001 0064 0000 0002 0001 0087 00
|
|
|
String wChanRscType = valueTmp.substring(0,4);
|
|
@ -275,13 +287,20 @@ public class OnenetService {
|
|
|
//气感浓度
|
|
|
String monitorValue = StringUtil.division(Integer.valueOf(wParamValue),10);
|
|
|
String resourceSerial = onenetDevice.getSn();
|
|
|
JSONObject tmp = new JSONObject();
|
|
|
tmp.put("gas",monitorValue);
|
|
|
orderUtil.createSecurityOrder(resourceSerial,null,new JSONObject(),null,6,"11","preventGasLeakage",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
|
|
|
dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"可燃气体探测器报警信息接收");
|
|
|
String sql = "select count(*) from base_device_health_index where device_sn = '"+resourceSerial+"'" +
|
|
|
" and value>0 and create_time>='"+DateUtil.getNextMinute(-60)+"' ";
|
|
|
Integer count = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
if(count==0){
|
|
|
logger.info("气体浓度大于0触发报警,deviceSn:{}",resourceSerial);
|
|
|
//1小时内不重复发起
|
|
|
JSONObject tmp = new JSONObject();
|
|
|
tmp.put("gas",monitorValue);
|
|
|
orderUtil.createSecurityOrder(resourceSerial,null,new JSONObject(),null,6,"11","preventGasLeakage",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
|
|
|
dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"可燃气体探测器报警信息接收");
|
|
|
}
|
|
|
addDeviceIndex(resourceSerial,monitorValue,time,"1","%LEL");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
//其他信息暂时不处理
|
|
|
// 03消音 04自检 05故障 06信号查询 07注册 08注销 ...
|