From 26cd7dbaf9394ff26f5229b18cfdb72c203a6bc3 Mon Sep 17 00:00:00 2001 From: gaofw189 <gaofw189@chinatelecom.cn> Date: 星期二, 10 一月 2023 15:55:56 +0800 Subject: [PATCH] 修复WVP作为下级平台接收DeviceStatus指令固定响应的问题 --- src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java | 121 ++++++---------------------------------- 1 files changed, 18 insertions(+), 103 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java index 88cb8c0..c773036 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java @@ -1,12 +1,11 @@ package com.genersoft.iot.vmp.storager.impl; -import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.conf.SipConfig; +import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.event.EventPublisher; import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; -import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; import com.genersoft.iot.vmp.service.IGbStreamService; import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; @@ -27,7 +26,6 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; -import org.springframework.util.StringUtils; import java.util.*; import java.util.concurrent.ConcurrentHashMap; @@ -84,6 +82,9 @@ private GbStreamMapper gbStreamMapper; @Autowired + private UserSetting userSetting; + + @Autowired private PlatformCatalogMapper catalogMapper; @Autowired @@ -133,7 +134,6 @@ deviceChannel.setStreamId(allChannelMap.get(deviceChannel.getChannelId()).getStreamId()); deviceChannel.setHasAudio(allChannelMap.get(deviceChannel.getChannelId()).isHasAudio()); } - channels.add(deviceChannel); if (!ObjectUtils.isEmpty(deviceChannel.getParentId())) { if (subContMap.get(deviceChannel.getParentId()) == null) { @@ -231,31 +231,31 @@ PageHelper.startPage(page, count); List<DeviceChannel> all; if (catalogUnderDevice != null && catalogUnderDevice) { - all = deviceChannelMapper.queryChannels(deviceId, deviceId, query, hasSubChannel, online); + all = deviceChannelMapper.queryChannels(deviceId, deviceId, query, hasSubChannel, online,null); // 娴峰悍璁惧鐨刾arentId鏄疭IP id - List<DeviceChannel> deviceChannels = deviceChannelMapper.queryChannels(deviceId, sipConfig.getId(), query, hasSubChannel, online); + List<DeviceChannel> deviceChannels = deviceChannelMapper.queryChannels(deviceId, sipConfig.getId(), query, hasSubChannel, online,null); all.addAll(deviceChannels); }else { - all = deviceChannelMapper.queryChannels(deviceId, null, query, hasSubChannel, online); + all = deviceChannelMapper.queryChannels(deviceId, null, query, hasSubChannel, online,null); } return new PageInfo<>(all); } @Override - public List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String query, Boolean hasSubChannel, Boolean online, int start, int limit) { - return deviceChannelMapper.queryChannelsByDeviceIdWithStartAndLimit(deviceId, null, query, hasSubChannel, online, start, limit); + public List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String query, Boolean hasSubChannel, Boolean online, int start, int limit,List<String> channelIds) { + return deviceChannelMapper.queryChannelsByDeviceIdWithStartAndLimit(deviceId, null, query, hasSubChannel, online, start, limit,channelIds); } @Override - public List<DeviceChannel> queryChannelsByDeviceId(String deviceId) { - return deviceChannelMapper.queryChannels(deviceId, null,null, null, null); + public List<DeviceChannel> queryChannelsByDeviceId(String deviceId,Boolean online,List<String> channelIds) { + return deviceChannelMapper.queryChannels(deviceId, null,null, null, online,channelIds); } @Override public PageInfo<DeviceChannel> querySubChannels(String deviceId, String parentChannelId, String query, Boolean hasSubChannel, Boolean online, int page, int count) { PageHelper.startPage(page, count); - List<DeviceChannel> all = deviceChannelMapper.queryChannels(deviceId, parentChannelId, query, hasSubChannel, online); + List<DeviceChannel> all = deviceChannelMapper.queryChannels(deviceId, parentChannelId, query, hasSubChannel, online,null); return new PageInfo<>(all); } @@ -278,9 +278,9 @@ * @return PageInfo<Device> 鍒嗛〉璁惧瀵硅薄鏁扮粍 */ @Override - public PageInfo<Device> queryVideoDeviceList(int page, int count) { + public PageInfo<Device> queryVideoDeviceList(int page, int count,Boolean online) { PageHelper.startPage(page, count); - List<Device> all = deviceMapper.getDevices(); + List<Device> all = deviceMapper.getDevices(online); return new PageInfo<>(all); } @@ -290,83 +290,10 @@ * @return List<Device> 璁惧瀵硅薄鏁扮粍 */ @Override - public List<Device> queryVideoDeviceList() { + public List<Device> queryVideoDeviceList(Boolean online) { - List<Device> deviceList = deviceMapper.getDevices(); + List<Device> deviceList = deviceMapper.getDevices(online); return deviceList; - } - - /** - * 鍒犻櫎璁惧 - * - * @param deviceId 璁惧ID - * @return true锛氬垹闄ゆ垚鍔� false锛氬垹闄ゅけ璐� - */ - @Override - public boolean delete(String deviceId) { - TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); - boolean result = false; - try { - platformChannelMapper.delChannelForDeviceId(deviceId); - deviceChannelMapper.cleanChannelsByDeviceId(deviceId); - if ( deviceMapper.del(deviceId) < 0 ) { - //浜嬪姟鍥炴粴 - dataSourceTransactionManager.rollback(transactionStatus); - } - result = true; - dataSourceTransactionManager.commit(transactionStatus); //鎵嬪姩鎻愪氦 - }catch (Exception e) { - dataSourceTransactionManager.rollback(transactionStatus); - } - return result; - } - - /** - * 鏇存柊璁惧鍦ㄧ嚎 - * - * @param deviceId 璁惧ID - * @return true锛氭洿鏂版垚鍔� false锛氭洿鏂板け璐� - */ - @Override - public synchronized boolean online(String deviceId) { - Device device = deviceMapper.getDeviceByDeviceId(deviceId); - if (device == null) { - return false; - } - device.setOnline(1); - logger.info("鏇存柊璁惧鍦ㄧ嚎: " + deviceId); - redisCatchStorage.updateDevice(device); - return deviceMapper.update(device) > 0; - } - - /** - * 鏇存柊璁惧绂荤嚎 - * - * @param deviceId 璁惧ID - * @return true锛氭洿鏂版垚鍔� false锛氭洿鏂板け璐� - */ - @Override - public synchronized boolean outline(String deviceId) { - logger.info("鏇存柊璁惧绂荤嚎: " + deviceId); - Device device = deviceMapper.getDeviceByDeviceId(deviceId); - if (device == null) { - return false; - } - device.setOnline(0); - redisCatchStorage.updateDevice(device); - return deviceMapper.update(device) > 0; - } - - /** - * 鏇存柊鎵�鏈夎澶囩绾� - * - * @return true锛氭洿鏂版垚鍔� false锛氭洿鏂板け璐� - */ - @Override - public synchronized boolean outlineForAll() { - logger.info("鏇存柊鎵�鏈夎澶囩绾�"); - int result = deviceMapper.outlineForAll(); - return result > 0; } /** @@ -615,7 +542,7 @@ */ @Override public List<DeviceChannel> queryGbStreamListInPlatform(String platformId) { - return gbStreamMapper.queryGbStreamListInPlatform(platformId); + return gbStreamMapper.queryGbStreamListInPlatform(platformId, userSetting.isUsePushingAsStatus()); } /** @@ -696,7 +623,7 @@ return 0; } if (platform.getTreeType().equals(TreeType.BUSINESS_GROUP)) { - if (platformCatalog.getPlatformId().equals(platformCatalog.getParentId())) { + if (platform.getDeviceGBId().equals(platformCatalog.getParentId())) { // 绗竴灞傝妭鐐� platformCatalog.setBusinessGroupId(platformCatalog.getId()); platformCatalog.setParentId(platform.getDeviceGBId()); @@ -831,18 +758,6 @@ return gbStreamMapper.updateStreamGPS(gpsMsgInfos); } - private List<DeviceChannel> getDeviceChannelListByChannelReduceList(List<ChannelReduce> channelReduces, String catalogId) { - List<DeviceChannel> deviceChannelList = new ArrayList<>(); - if (channelReduces.size() > 0){ - for (ChannelReduce channelReduce : channelReduces) { - DeviceChannel deviceChannel = queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId()); - deviceChannel.setParental(1); - deviceChannel.setParentId(catalogId); - deviceChannelList.add(deviceChannel); - } - } - return deviceChannelList; - } private DeviceChannel getDeviceChannelByCatalog(PlatformCatalog catalog) { ParentPlatform platform = platformMapper.getParentPlatByServerGBId(catalog.getPlatformId()); -- Gitblit v1.8.0