| | |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| | | import com.genersoft.iot.vmp.storager.dao.*; |
| | | import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; |
| | | import com.genersoft.iot.vmp.utils.node.ForestNodeMerger; |
| | | import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree; |
| | | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| | |
| | | @Override |
| | | public int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId) { |
| | | |
| | | Map<String, ChannelReduce> deviceAndChannels = new HashMap<>(); |
| | | Map<Integer, ChannelReduce> deviceAndChannels = new HashMap<>(); |
| | | for (ChannelReduce channelReduce : channelReduces) { |
| | | channelReduce.setCatalogId(catalogId); |
| | | deviceAndChannels.put(channelReduce.getDeviceId() + "_" + channelReduce.getChannelId(), channelReduce); |
| | | deviceAndChannels.put(channelReduce.getId(), channelReduce); |
| | | } |
| | | List<String> deviceAndChannelList = new ArrayList<>(deviceAndChannels.keySet()); |
| | | List<Integer> deviceAndChannelList = new ArrayList<>(deviceAndChannels.keySet()); |
| | | // 查询当前已经存在的 |
| | | List<String> relatedPlatformchannels = platformChannelMapper.findChannelRelatedPlatform(platformId, deviceAndChannelList); |
| | | if (relatedPlatformchannels != null) { |
| | | deviceAndChannelList.removeAll(relatedPlatformchannels); |
| | | List<Integer> channelIds = platformChannelMapper.findChannelRelatedPlatform(platformId, channelReduces); |
| | | if (deviceAndChannelList != null) { |
| | | deviceAndChannelList.removeAll(channelIds); |
| | | } |
| | | for (String relatedPlatformchannel : relatedPlatformchannels) { |
| | | deviceAndChannels.remove(relatedPlatformchannel); |
| | | for (Integer channelId : channelIds) { |
| | | deviceAndChannels.remove(channelId); |
| | | } |
| | | List<ChannelReduce> channelReducesToAdd = new ArrayList<>(deviceAndChannels.values()); |
| | | // 对剩下的数据进行存储 |
| | |
| | | public PlatformCatalog queryDefaultCatalogInPlatform(String platformId) { |
| | | return catalogMapper.selectDefaultByPlatFormId(platformId); |
| | | } |
| | | |
| | | @Override |
| | | public List<ChannelSourceInfo> getChannelSource(String platformId, String gbId) { |
| | | return platformMapper.getChannelSource(platformId, gbId); |
| | | } |
| | | } |