修复同步目录时批量提交的错误

This commit is contained in:
648540858 2023-10-12 17:01:25 +08:00
parent 7d6aaf3bb0
commit 78f628dd6f

View File

@ -169,7 +169,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
} }
} }
} }
if (channels.size() > 0) { if (!channels.isEmpty()) {
for (DeviceChannel channel : channels) { for (DeviceChannel channel : channels) {
if (subContMap.get(channel.getChannelId()) != null){ if (subContMap.get(channel.getChannelId()) != null){
Integer count = subContMap.get(channel.getChannelId()); Integer count = subContMap.get(channel.getChannelId());
@ -190,19 +190,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
} }
try { try {
int limitCount = 50; int limitCount = 50;
int cleanChannelsResult = 0; boolean result = false;
if (channels.size() > limitCount) {
for (int i = 0; i < channels.size(); i += limitCount) {
int toIndex = i + limitCount;
if (i + limitCount > channels.size()) {
toIndex = channels.size();
}
cleanChannelsResult += this.deviceChannelMapper.cleanChannelsNotInList(deviceId, channels.subList(i, toIndex));
}
} else {
cleanChannelsResult = this.deviceChannelMapper.cleanChannelsNotInList(deviceId, channels);
}
boolean result = cleanChannelsResult < 0;
if (!result && addChannels.size() > 0) { if (!result && addChannels.size() > 0) {
if (addChannels.size() > limitCount) { if (addChannels.size() > limitCount) {
for (int i = 0; i < addChannels.size(); i += limitCount) { for (int i = 0; i < addChannels.size(); i += limitCount) {