|  | @ -13,6 +13,7 @@ import com.yihu.jw.care.util.SecurityOrderUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.device.DeviceHealthIndex;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.device.OnenetDevice;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.device.OnenetReceiveRecord;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.common.StringUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.http.HttpClientUtil;
 | 
	
		
			
				|  |  | import org.slf4j.Logger;
 | 
	
	
		
			
				|  | @ -104,7 +105,7 @@ public class OnenetService {
 | 
	
		
			
				|  |  |                 if("14".equals(onenetDevice.getCategoryCode())){
 | 
	
		
			
				|  |  |                     hkDeviceQi(onenetDevice,jsonObject);
 | 
	
		
			
				|  |  |                 }else if("15".equals(onenetDevice.getCategoryCode())){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     hkDeviceYan(onenetDevice,jsonObject);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -157,6 +158,71 @@ public class OnenetService {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 海康设备解析-烟感
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void hkDeviceYan(OnenetDevice onenetDevice,JSONObject jsonObject){
 | 
	
		
			
				|  |  |         String value = jsonObject.getString("value");
 | 
	
		
			
				|  |  |         String byMessageId = value.substring(0,2);
 | 
	
		
			
				|  |  | //        String byDevType = value.substring(4,6);
 | 
	
		
			
				|  |  |         if("01".equals(byMessageId)){
 | 
	
		
			
				|  |  |             //信息上报
 | 
	
		
			
				|  |  |             String valueTmp = value.substring(236);
 | 
	
		
			
				|  |  |             //0060 0001 0061 0001 0062 0000 0000 0001 0000 79
 | 
	
		
			
				|  |  |             String wChanRscType = valueTmp.substring(0,4);
 | 
	
		
			
				|  |  |             String num = valueTmp.substring(4,8);
 | 
	
		
			
				|  |  |             String wEventType = valueTmp.substring(16,20);
 | 
	
		
			
				|  |  |             String wParamType = valueTmp.substring(32,36);
 | 
	
		
			
				|  |  |             String wParamValue = valueTmp.substring(36,40);
 | 
	
		
			
				|  |  |             if("0062".equals(wEventType)&&"0001".equals(wParamType)){
 | 
	
		
			
				|  |  |                 String byTime = value.substring(18,26);//时间 秒
 | 
	
		
			
				|  |  |                 String time = DateUtil.dateToStrLong(DateUtil.secondTransfor(Integer.parseInt(byTime)));
 | 
	
		
			
				|  |  |                 //烟雾浓度
 | 
	
		
			
				|  |  |                 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);
 | 
	
		
			
				|  |  |                 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 valueTmp = value.substring(236);
 | 
	
		
			
				|  |  |             //0060 0001 0061 0001 0064 0000 0002 0001 0087 00
 | 
	
		
			
				|  |  |             String wChanRscType = valueTmp.substring(0,4);
 | 
	
		
			
				|  |  |             String num = valueTmp.substring(4,8);
 | 
	
		
			
				|  |  |             String wEventType = valueTmp.substring(16,20);
 | 
	
		
			
				|  |  |             String wEventValue = valueTmp.substring(28,32);
 | 
	
		
			
				|  |  |             String wParamType = valueTmp.substring(32,36);
 | 
	
		
			
				|  |  |             String wParamValue = valueTmp.substring(36,40);
 | 
	
		
			
				|  |  |             if("0064".equals(wEventType)&&"0002".equals(wEventValue)){
 | 
	
		
			
				|  |  |                 //报警
 | 
	
		
			
				|  |  |                 if("0001".equals(wParamType)){
 | 
	
		
			
				|  |  |                     //烟雾浓度
 | 
	
		
			
				|  |  |                     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),"烟感探测器报警信息接收");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //其他信息暂时不处理
 | 
	
		
			
				|  |  |         // 03消音 04自检 05故障 06信号查询 07注册 08注销 ...
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 海康设备解析-气感
 | 
	
		
			
				|  |  |      */
 | 
	
	
		
			
				|  | @ -177,7 +243,7 @@ public class OnenetService {
 | 
	
		
			
				|  |  |                 String byTime = value.substring(18,26);//时间 秒
 | 
	
		
			
				|  |  |                 String time = DateUtil.dateToStrLong(DateUtil.secondTransfor(Integer.parseInt(byTime)));
 | 
	
		
			
				|  |  |                 //气感浓度
 | 
	
		
			
				|  |  |                 String monitorValue = division(Integer.valueOf(wParamValue),10);
 | 
	
		
			
				|  |  |                 String monitorValue = StringUtil.division(Integer.valueOf(wParamValue),10);
 | 
	
		
			
				|  |  |                 String resourceSerial = onenetDevice.getSn();
 | 
	
		
			
				|  |  |                 DeviceHealthIndex index = new DeviceHealthIndex();
 | 
	
		
			
				|  |  |                 index.setDeviceSn(resourceSerial);
 | 
	
	
		
			
				|  | @ -207,7 +273,7 @@ public class OnenetService {
 | 
	
		
			
				|  |  |                 //气感报警
 | 
	
		
			
				|  |  |                 if("0001".equals(wParamType)){
 | 
	
		
			
				|  |  |                     //气感浓度
 | 
	
		
			
				|  |  |                     String monitorValue = division(Integer.valueOf(wParamValue),10);
 | 
	
		
			
				|  |  |                     String monitorValue = StringUtil.division(Integer.valueOf(wParamValue),10);
 | 
	
		
			
				|  |  |                     String resourceSerial = onenetDevice.getSn();
 | 
	
		
			
				|  |  |                     JSONObject tmp = new JSONObject();
 | 
	
		
			
				|  |  |                     tmp.put("gas",monitorValue);
 | 
	
	
		
			
				|  | @ -222,14 +288,6 @@ public class OnenetService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String division(int a,int b){
 | 
	
		
			
				|  |  |         String result = "";
 | 
	
		
			
				|  |  |         float num =(float)a/b;
 | 
	
		
			
				|  |  |         DecimalFormat df = new DecimalFormat("0.0");
 | 
	
		
			
				|  |  |         result = df.format(num);
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 同步设备
 | 
	
		
			
				|  |  |      */
 |