Commit 936adf31fee0a9f66971982eae3a8002d58eb037

Authored by 648540858
Committed by GitHub
2 parents 9a0ea9e3 ed2680bf

Merge pull request #504 from TristingChen/fixed--reset-channel

修复--重设通道多个设备注册下发生的sql错误修复
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
@@ -25,6 +25,7 @@ import org.springframework.stereotype.Component; @@ -25,6 +25,7 @@ import org.springframework.stereotype.Component;
25 import org.springframework.transaction.TransactionDefinition; 25 import org.springframework.transaction.TransactionDefinition;
26 import org.springframework.transaction.TransactionStatus; 26 import org.springframework.transaction.TransactionStatus;
27 import org.springframework.transaction.annotation.Transactional; 27 import org.springframework.transaction.annotation.Transactional;
  28 +import org.springframework.util.CollectionUtils;
28 import org.springframework.util.StringUtils; 29 import org.springframework.util.StringUtils;
29 30
30 import java.util.*; 31 import java.util.*;
@@ -195,7 +196,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { @@ -195,7 +196,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
195 196
196 @Override 197 @Override
197 public boolean resetChannels(String deviceId, List<DeviceChannel> deviceChannelList) { 198 public boolean resetChannels(String deviceId, List<DeviceChannel> deviceChannelList) {
198 - if (deviceChannelList == null) { 199 + if (CollectionUtils.isEmpty(deviceChannelList)) {
199 return false; 200 return false;
200 } 201 }
201 List<DeviceChannel> allChannelInPlay = deviceChannelMapper.getAllChannelInPlay(); 202 List<DeviceChannel> allChannelInPlay = deviceChannelMapper.getAllChannelInPlay();
@@ -246,6 +247,10 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { @@ -246,6 +247,10 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
246 if (stringBuilder.length() > 0) { 247 if (stringBuilder.length() > 0) {
247 logger.info("[目录查询]收到的数据存在重复: {}" , stringBuilder); 248 logger.info("[目录查询]收到的数据存在重复: {}" , stringBuilder);
248 } 249 }
  250 + if(CollectionUtils.isEmpty(channels)){
  251 + logger.info("通道重设,数据为空={}" , deviceChannelList);
  252 + return false;
  253 + }
249 try { 254 try {
250 int cleanChannelsResult = deviceChannelMapper.cleanChannelsNotInList(deviceId, channels); 255 int cleanChannelsResult = deviceChannelMapper.cleanChannelsNotInList(deviceId, channels);
251 int limitCount = 300; 256 int limitCount = 300;