|  | @ -93,27 +93,29 @@ public class OnenetService {
 | 
	
		
			
				|  |  |             }else if("15".equals(categoryCode)){
 | 
	
		
			
				|  |  |                 title = "烟探测器监测信息接收";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             hvDeviceService.updContactStatus(deviceSn,1);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             dataPushLogUtil.savePushLog(deviceSn,msg.toJSONString(),title);
 | 
	
		
			
				|  |  |             //未来鹰设备 类型2是设备状态(不准)
 | 
	
		
			
				|  |  |             Integer type = msg.getInteger("type");
 | 
	
		
			
				|  |  |             String value = msg.getString("value");
 | 
	
		
			
				|  |  |             boolean flag = false;
 | 
	
		
			
				|  |  |             if("1".equals(onenetDevice.getDeviceType())){
 | 
	
		
			
				|  |  |                 if ("14".equals(categoryCode)){//燃气
 | 
	
		
			
				|  |  |                     wlyDateDelGas(categoryCode,msg);
 | 
	
		
			
				|  |  |                     flag = wlyDateDelGas(categoryCode,msg);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if ("15".equals(categoryCode)){//烟雾设备
 | 
	
		
			
				|  |  |                     wlyDateDelSmoke(msg);
 | 
	
		
			
				|  |  |                     flag = wlyDateDelSmoke(msg);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }else if("2".equals(onenetDevice.getDeviceType())){
 | 
	
		
			
				|  |  |                 //海康设备
 | 
	
		
			
				|  |  |                 if("14".equals(onenetDevice.getCategoryCode())){
 | 
	
		
			
				|  |  |                     hkDeviceQi(onenetDevice,msg);
 | 
	
		
			
				|  |  |                     flag = hkDeviceQi(onenetDevice,msg);
 | 
	
		
			
				|  |  |                 }else if("15".equals(onenetDevice.getCategoryCode())){
 | 
	
		
			
				|  |  |                     hkDeviceYan(onenetDevice,msg);
 | 
	
		
			
				|  |  |                     flag = hkDeviceYan(onenetDevice,msg);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             hvDeviceService.updContactStatus(deviceSn,1,flag);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             record.setContent(msg.toJSONString());
 | 
	
		
			
				|  |  |             record.setStatus(1);
 | 
	
	
		
			
				|  | @ -166,7 +168,8 @@ public class OnenetService {
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 海康设备解析-烟感
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void hkDeviceYan(OnenetDevice onenetDevice,JSONObject jsonObject){
 | 
	
		
			
				|  |  |     public boolean hkDeviceYan(OnenetDevice onenetDevice,JSONObject jsonObject){
 | 
	
		
			
				|  |  |         boolean flag = false;
 | 
	
		
			
				|  |  |         String value = jsonObject.getString("value");
 | 
	
		
			
				|  |  |         String byMessageId = value.substring(0,2);
 | 
	
		
			
				|  |  | //        String byDevType = value.substring(4,6);
 | 
	
	
		
			
				|  | @ -190,7 +193,7 @@ public class OnenetService {
 | 
	
		
			
				|  |  |                     addDeviceIndex(resourceSerial,monitorValue,time,"2","%");
 | 
	
		
			
				|  |  |                     dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"可燃气体探测器监测信息接收");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 return;
 | 
	
		
			
				|  |  |                 return flag;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -220,15 +223,16 @@ public class OnenetService {
 | 
	
		
			
				|  |  |                         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),"烟感探测器报警信息接收");
 | 
	
		
			
				|  |  |                         flag = true;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     addDeviceIndex(resourceSerial,monitorValue,time,"2","%");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 return;
 | 
	
		
			
				|  |  |                 return flag;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //其他信息暂时不处理
 | 
	
		
			
				|  |  |         // 03消音 04自检 05故障 06信号查询 07注册 08注销 ...
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return flag;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
	
		
			
				|  | @ -252,7 +256,8 @@ public class OnenetService {
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 海康设备解析-气感
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void hkDeviceQi(OnenetDevice onenetDevice,JSONObject jsonObject){
 | 
	
		
			
				|  |  |     public boolean hkDeviceQi(OnenetDevice onenetDevice,JSONObject jsonObject){
 | 
	
		
			
				|  |  |         boolean flag = false;
 | 
	
		
			
				|  |  |         String value = jsonObject.getString("value");
 | 
	
		
			
				|  |  |         String byMessageId = value.substring(0,2);
 | 
	
		
			
				|  |  | //        String byDevType = value.substring(4,6);
 | 
	
	
		
			
				|  | @ -274,7 +279,7 @@ public class OnenetService {
 | 
	
		
			
				|  |  |                 addDeviceIndex(resourceSerial,monitorValue,time,"1","%LEL");
 | 
	
		
			
				|  |  |                 dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"可燃气体探测器监测信息接收");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             return;
 | 
	
		
			
				|  |  |             return flag;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if("02".equals(byMessageId)){
 | 
	
		
			
				|  |  |             //报警
 | 
	
	
		
			
				|  | @ -304,6 +309,7 @@ public class OnenetService {
 | 
	
		
			
				|  |  |                         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),"可燃气体探测器报警信息接收");
 | 
	
		
			
				|  |  |                         flag = true;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     addDeviceIndex(resourceSerial,monitorValue,time,"1","%LEL");
 | 
	
		
			
				|  |  |                 }
 | 
	
	
		
			
				|  | @ -311,7 +317,7 @@ public class OnenetService {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //其他信息暂时不处理
 | 
	
		
			
				|  |  |         // 03消音 04自检 05故障 06信号查询 07注册 08注销 ...
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return flag;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
	
		
			
				|  | @ -372,7 +378,8 @@ public class OnenetService {
 | 
	
		
			
				|  |  |      * 未来鹰设备烟雾数据处理
 | 
	
		
			
				|  |  |      * @param msg
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void wlyDateDelSmoke(JSONObject msg){
 | 
	
		
			
				|  |  |     public boolean wlyDateDelSmoke(JSONObject msg){
 | 
	
		
			
				|  |  |         boolean flag = false;
 | 
	
		
			
				|  |  |         String dsId = msg.getString("ds_id");
 | 
	
		
			
				|  |  |         String msgId = dsId.split("_")[2];
 | 
	
		
			
				|  |  |         String value = msg.getString("value");
 | 
	
	
		
			
				|  | @ -387,6 +394,7 @@ public class OnenetService {
 | 
	
		
			
				|  |  |                     JSONObject tmp = new JSONObject();
 | 
	
		
			
				|  |  |                     tmp.put("smoke",value);
 | 
	
		
			
				|  |  |                     orderUtil.createSecurityOrder(deviceSn,null,new JSONObject(),null,7,"10","preventFire",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  |                     flag = true;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             DeviceHealthIndex index = new DeviceHealthIndex();
 | 
	
	
		
			
				|  | @ -406,12 +414,21 @@ public class OnenetService {
 | 
	
		
			
				|  |  |                     JSONObject tmp = new JSONObject();
 | 
	
		
			
				|  |  |                     tmp.put("smoke","100");
 | 
	
		
			
				|  |  |                     orderUtil.createSecurityOrder(deviceSn,null,new JSONObject(),null,7,"10","preventFire",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  |                     flag = true;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return flag;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public void wlyDateDelGas(String categoryCode,JSONObject msg){
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 返回数据是否异常 true异常
 | 
	
		
			
				|  |  |      * @param categoryCode
 | 
	
		
			
				|  |  |      * @param msg
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public boolean wlyDateDelGas(String categoryCode,JSONObject msg){
 | 
	
		
			
				|  |  |         boolean flag = false;
 | 
	
		
			
				|  |  |         String deviceSn = msg.getString("imei");
 | 
	
		
			
				|  |  |         Integer type = msg.getInteger("type");
 | 
	
		
			
				|  |  |         String value = msg.getString("value");
 | 
	
	
		
			
				|  | @ -422,7 +439,6 @@ public class OnenetService {
 | 
	
		
			
				|  |  |             Integer gas = Integer.parseInt(gas_Level, 16);
 | 
	
		
			
				|  |  |             if(gas>0){
 | 
	
		
			
				|  |  |                 //气体浓度大于0触发报警
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 String sql = "select count(*) from base_device_health_index where device_sn = '"+deviceSn+"'" +
 | 
	
		
			
				|  |  |                         " and value>0 and create_time>='"+DateUtil.getNextMinute(-60)+"' ";
 | 
	
		
			
				|  |  |                 Integer count = jdbcTemplate.queryForObject(sql,Integer.class);
 | 
	
	
		
			
				|  | @ -432,6 +448,7 @@ public class OnenetService {
 | 
	
		
			
				|  |  |                     JSONObject tmp = new JSONObject();
 | 
	
		
			
				|  |  |                     tmp.put("gas",gas);
 | 
	
		
			
				|  |  |                     orderUtil.createSecurityOrder(deviceSn,null,new JSONObject(),null,6,"11","preventGasLeakage",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
 | 
	
		
			
				|  |  |                     flag = true;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             DeviceHealthIndex index = new DeviceHealthIndex();
 | 
	
	
		
			
				|  | @ -448,5 +465,7 @@ public class OnenetService {
 | 
	
		
			
				|  |  |             index.setRecordTime(DateUtil.getStringDate());
 | 
	
		
			
				|  |  |             deviceHealthIndexDao.save(index);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return flag;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |