|  | @ -97,39 +97,7 @@ public class OnenetService {
 | 
												
													
														
															|  |             Integer type = msg.getInteger("type");
 |  |             Integer type = msg.getInteger("type");
 | 
												
													
														
															|  |             String value = msg.getString("value");
 |  |             String value = msg.getString("value");
 | 
												
													
														
															|  |             if("1".equals(onenetDevice.getDeviceType())){
 |  |             if("1".equals(onenetDevice.getDeviceType())){
 | 
												
													
														
															|  |                 String order = value.substring(10,14);
 |  | 
 | 
												
													
														
															|  |                 if("1401".equals(order)){
 |  | 
 | 
												
													
														
															|  |                     //自定义命令数据更新(心跳/设备状态上报)
 |  | 
 | 
												
													
														
															|  |                     String gas_Level = value.substring(22,24);
 |  | 
 | 
												
													
														
															|  |                     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);
 |  | 
 | 
												
													
														
															|  |                         if(count==0){
 |  | 
 | 
												
													
														
															|  |                             logger.info("气体浓度大于0触发报警,deviceSn:{}",deviceSn);
 |  | 
 | 
												
													
														
															|  |                             //1小时内不重复发起
 |  | 
 | 
												
													
														
															|  |                             JSONObject tmp = new JSONObject();
 |  | 
 | 
												
													
														
															|  |                             tmp.put("gas",gas);
 |  | 
 | 
												
													
														
															|  |                             orderUtil.createSecurityOrder(deviceSn,null,new JSONObject(),null,6,"11","preventGasLeakage",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
 |  | 
 | 
												
													
														
															|  |                         }
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  |                     DeviceHealthIndex index = new DeviceHealthIndex();
 |  | 
 | 
												
													
														
															|  |                     index.setDeviceSn(deviceSn);
 |  | 
 | 
												
													
														
															|  |                     if("14".equals(categoryCode)){
 |  | 
 | 
												
													
														
															|  |                         index.setUnit("%LEL");
 |  | 
 | 
												
													
														
															|  |                         index.setDeviceType("1");
 |  | 
 | 
												
													
														
															|  |                     }else if("15".equals(categoryCode)){
 |  | 
 | 
												
													
														
															|  |                         index.setUnit("%");
 |  | 
 | 
												
													
														
															|  |                         index.setDeviceType("2");
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                     index.setValue(gas+"");
 |  | 
 | 
												
													
														
															|  |                     index.setRecordTime(DateUtil.getStringDate());
 |  | 
 | 
												
													
														
															|  |                     deviceHealthIndexDao.save(index);
 |  | 
 | 
												
													
														
															|  |                 }
 |  | 
 | 
												
													
														
															|  | 
 |  |                 wlyDateDel(categoryCode,msg);
 | 
												
													
														
															|  |             }else if("2".equals(onenetDevice.getDeviceType())){
 |  |             }else if("2".equals(onenetDevice.getDeviceType())){
 | 
												
													
														
															|  |                 //海康设备
 |  |                 //海康设备
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -237,4 +205,38 @@ public class OnenetService {
 | 
												
													
														
															|  |         logger.info("apikeyPost="+result);
 |  |         logger.info("apikeyPost="+result);
 | 
												
													
														
															|  |         return result;
 |  |         return result;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     /**
 | 
												
													
														
															|  | 
 |  |      * 未来鹰设备数据处理
 | 
												
													
														
															|  | 
 |  |      * @param categoryCode
 | 
												
													
														
															|  | 
 |  |      * @param msg
 | 
												
													
														
															|  | 
 |  |      */
 | 
												
													
														
															|  | 
 |  |     public void wlyDateDel(String categoryCode,JSONObject msg){
 | 
												
													
														
															|  | 
 |  |         String dsId = msg.getString("ds_id");
 | 
												
													
														
															|  | 
 |  |         String msgId = dsId.split("_")[2];
 | 
												
													
														
															|  | 
 |  |         String value = msg.getString("value");
 | 
												
													
														
															|  | 
 |  |         String deviceSn = msg.getString("imei");
 | 
												
													
														
															|  | 
 |  |         if ("14".equals(categoryCode)){//燃气设备
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         }else if ("15".equals(categoryCode)){//烟雾设备
 | 
												
													
														
															|  | 
 |  |             if ("5504".equals(msgId)){//烟雾浓度消息 大于0 触发报警
 | 
												
													
														
															|  | 
 |  |                 Integer gasValue = Integer.parseInt(value);
 | 
												
													
														
															|  | 
 |  |                 if (gasValue>0){
 | 
												
													
														
															|  | 
 |  |                     JSONObject tmp = new JSONObject();
 | 
												
													
														
															|  | 
 |  |                     tmp.put("smoke",value);
 | 
												
													
														
															|  | 
 |  |                     orderUtil.createSecurityOrder(deviceSn,null,new JSONObject(),null,7,"10","preventFire",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |                 DeviceHealthIndex index = new DeviceHealthIndex();
 | 
												
													
														
															|  | 
 |  |                 index.setDeviceSn(deviceSn);
 | 
												
													
														
															|  | 
 |  |                 index.setUnit("%");
 | 
												
													
														
															|  | 
 |  |                 index.setDeviceType("2");
 | 
												
													
														
															|  | 
 |  |                 index.setValue(value);
 | 
												
													
														
															|  | 
 |  |                 index.setRecordTime(DateUtil.getStringDate());
 | 
												
													
														
															|  | 
 |  |                 deviceHealthIndexDao.save(index);
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             if ("5503".equals(msgId)){//各消息类型
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | }
 |  | }
 |