Commit e867924f5cbc704db00a0ddac383d043fead3632

Authored by 邱一成
1 parent c3235b53
Exists in master

优化设备sn乱码

cloud/dahua/src/main/java/com/example/dahua/MyTask.java
@@ -244,16 +244,27 @@ public class MyTask implements ApplicationRunner { @@ -244,16 +244,27 @@ public class MyTask implements ApplicationRunner {
244 public synchronized void reloadPic() { 244 public synchronized void reloadPic() {
245 isHasNewDevice = false; 245 isHasNewDevice = false;
246 if (null != deviceInfoBeans && deviceInfoBeans.size() > 0) { 246 if (null != deviceInfoBeans && deviceInfoBeans.size() > 0) {
247 - for (DeviceInfoBean dev :  
248 - deviceInfoBeans) {  
249 - if (lLongMap.get(dev.getDevcieId()).intValue() > 0) { NetSDKLib.LLong lLong = GateModule.realLoadPic2(0, analyzerCallback, lLongMap.get(dev.getDevcieId()),dev.getDevcieId());  
250 -// System.out.println("监听成功:"+dev.getDevcieId());  
251 -// if (lLong.intValue() != -1) {  
252 -// //deviceInfoBeans.remove(dev);  
253 -// } 247 + Iterator<DeviceInfoBean> it = deviceInfoBeans.iterator();
  248 + while (((Iterator) it).hasNext()) {
  249 + DeviceInfoBean dev = it.next();
  250 + if (lLongMap.get(dev.getDevcieId()).intValue() > 0) {
  251 + NetSDKLib.LLong lLong = GateModule.realLoadPic2(0, analyzerCallback, lLongMap.get(dev.getDevcieId()),dev.getDevcieId());
  252 + System.out.println("监听成功:"+dev.getDevcieId());
  253 + if (lLong.intValue() != -1) {
  254 + it.remove();
  255 + }
254 } 256 }
255 -  
256 } 257 }
  258 +// for (DeviceInfoBean dev :
  259 +// deviceInfoBeans) {
  260 +// if (lLongMap.get(dev.getDevcieId()).intValue() > 0) { NetSDKLib.LLong lLong = GateModule.realLoadPic2(0, analyzerCallback, lLongMap.get(dev.getDevcieId()),dev.getDevcieId());
  261 +//// System.out.println("监听成功:"+dev.getDevcieId());
  262 +//// if (lLong.intValue() != -1) {
  263 +//// //deviceInfoBeans.remove(dev);
  264 +//// }
  265 +// }
  266 +//
  267 +// }
257 } 268 }
258 } 269 }
259 270
cloud/dahua/src/main/java/com/example/dahua/module/GateModule.java
1 package com.example.dahua.module; 1 package com.example.dahua.module;
2 2
  3 +import com.example.dahua.MyTask;
3 import com.example.dahua.bean.PermissionBean; 4 import com.example.dahua.bean.PermissionBean;
4 import com.example.dahua.bean.WeekDay; 5 import com.example.dahua.bean.WeekDay;
5 import com.example.dahua.bean.WeekTime; 6 import com.example.dahua.bean.WeekTime;
@@ -30,6 +31,8 @@ public class GateModule { @@ -30,6 +31,8 @@ public class GateModule {
30 // 查询句柄 31 // 查询句柄
31 private static LLong m_lFindHandle = new LLong(0); 32 private static LLong m_lFindHandle = new LLong(0);
32 33
  34 + private final static NetSDKLib.NET_DEVICEINFO_Ex deviceInfo = new NetSDKLib.NET_DEVICEINFO_Ex();
  35 +
33 /** 36 /**
34 * 订阅实时上传智能分析数据 37 * 订阅实时上传智能分析数据
35 * 38 *
@@ -56,7 +59,17 @@ public class GateModule { @@ -56,7 +59,17 @@ public class GateModule {
56 59
57 public static LLong realLoadPic2(int ChannelId, NetSDKLib.fAnalyzerDataCallBack m_AnalyzerDataCB, LLong lLong,String devcieId) { 60 public static LLong realLoadPic2(int ChannelId, NetSDKLib.fAnalyzerDataCallBack m_AnalyzerDataCB, LLong lLong,String devcieId) {
58 61
59 - final NetSDKLib.NET_DEVICEINFO_Ex deviceInfo = new NetSDKLib.NET_DEVICEINFO_Ex(); 62 +// final NetSDKLib.NET_DEVICEINFO_Ex deviceInfo = new NetSDKLib.NET_DEVICEINFO_Ex();
  63 +//
  64 +// Map<String, NetSDKLib.LLong> lLongMap = new MyTask().lLongMap;
  65 +// if(lLongMap.isEmpty()){
  66 +// for (String key :lLongMap.keySet()){
  67 +// if(key.equals(devcieId)){
  68 +// lLongMap.
  69 +// }
  70 +// }
  71 +//
  72 +// };
60 73
61 // 设备ID 74 // 设备ID
62 System.arraycopy(devcieId.getBytes(), 0, deviceInfo.sSerialNumber, 0, devcieId.getBytes().length); 75 System.arraycopy(devcieId.getBytes(), 0, deviceInfo.sSerialNumber, 0, devcieId.getBytes().length);