Commit 6e8cc24e64e1ac116dd4f2f49ed68339d9c8f058

Authored by 648540858
1 parent 9361943e

修复查询设备信息接口返回设备通道数错误的问题

src/main/java/com/genersoft/iot/vmp/storager/redis/VideoManagerRedisStoragerImpl.java
... ... @@ -101,7 +101,7 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
101 101  
102 102 // 如果有父设备,更新父设备内子节点数
103 103 String parentId = channel.getParentId();
104   - if (!StringUtils.isEmpty(parentId)) {
  104 + if (!StringUtils.isEmpty(parentId) && !parentId.equals(deviceId)) {
105 105  
106 106 if (channelMap.get(parentId) == null) {
107 107 channelMap.put(parentId, new HashSet<String>());
... ... @@ -111,8 +111,6 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
111 111 DeviceChannel deviceChannel = queryChannel(deviceId, parentId);
112 112 if (deviceChannel != null) {
113 113 deviceChannel.setSubCount(channelMap.get(parentId).size());
114   -// redis.set(VideoManagerConstants.CACHEKEY_PREFIX+deviceId + "_" + deviceChannel.getChannelId(),
115   -// deviceChannel);
116 114 redis.set(VideoManagerConstants.CACHEKEY_PREFIX + deviceId +
117 115 "_" + deviceChannel.getChannelId() +
118 116 "_" + (deviceChannel.getStatus() == 1 ? "on":"off") +
... ... @@ -456,7 +454,6 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
456 454 for (Device device : devices) {
457 455 // 更新设备下的通道
458 456 HashMap<String, HashSet<String>> channelMap = new HashMap<String, HashSet<String>>();
459   -// List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX +
460 457 List<Object> deviceChannelList = redis.scan(VideoManagerConstants.CACHEKEY_PREFIX +
461 458 device.getDeviceId() + "_" + "*");
462 459 if (deviceChannelList != null && deviceChannelList.size() > 0 ) {
... ... @@ -477,6 +474,7 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
477 474 }
478 475 deviceMap.put(device.getDeviceId(),channelMap);
479 476 }
  477 + System.out.println();
480 478 }
481 479  
482 480 @Override
... ...