Commit e8090bc84c04d929c750338df26aa2bf86e1efc8
1 parent
9be861ab
修复bug与目录订阅添加最小值60
Showing
7 changed files
with
38 additions
and
29 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java
| @@ -62,6 +62,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { | @@ -62,6 +62,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { | ||
| 62 | if (!parentPlatform.isStatus())return; | 62 | if (!parentPlatform.isStatus())return; |
| 63 | String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + event.getPlatformId(); | 63 | String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + event.getPlatformId(); |
| 64 | subscribe = redisCatchStorage.getSubscribe(key); | 64 | subscribe = redisCatchStorage.getSubscribe(key); |
| 65 | + if (subscribe == null) return; | ||
| 65 | }else { | 66 | }else { |
| 66 | // 获取所用订阅 | 67 | // 获取所用订阅 |
| 67 | List<String> platforms = redisCatchStorage.getAllSubscribePlatform(); | 68 | List<String> platforms = redisCatchStorage.getAllSubscribePlatform(); |
| @@ -107,9 +108,10 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { | @@ -107,9 +108,10 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { | ||
| 107 | List<ParentPlatform> parentPlatforms = parentPlatformMap.get(gbId); | 108 | List<ParentPlatform> parentPlatforms = parentPlatformMap.get(gbId); |
| 108 | if (parentPlatforms != null && parentPlatforms.size() > 0) { | 109 | if (parentPlatforms != null && parentPlatforms.size() > 0) { |
| 109 | for (ParentPlatform platform : parentPlatforms) { | 110 | for (ParentPlatform platform : parentPlatforms) { |
| 110 | - logger.info("[Catalog事件: {}]平台:{},影响通道{}", event.getType(), platform.getServerGBId(), gbId); | ||
| 111 | String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + platform.getServerGBId(); | 111 | String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + platform.getServerGBId(); |
| 112 | SubscribeInfo subscribeInfo = redisCatchStorage.getSubscribe(key); | 112 | SubscribeInfo subscribeInfo = redisCatchStorage.getSubscribe(key); |
| 113 | + if (subscribeInfo == null) continue; | ||
| 114 | + logger.info("[Catalog事件: {}]平台:{},影响通道{}", event.getType(), platform.getServerGBId(), gbId); | ||
| 113 | List<DeviceChannel> deviceChannelList = new ArrayList<>(); | 115 | List<DeviceChannel> deviceChannelList = new ArrayList<>(); |
| 114 | DeviceChannel deviceChannel = new DeviceChannel(); | 116 | DeviceChannel deviceChannel = new DeviceChannel(); |
| 115 | deviceChannel.setChannelId(gbId); | 117 | deviceChannel.setChannelId(gbId); |
| @@ -146,9 +148,10 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { | @@ -146,9 +148,10 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { | ||
| 146 | List<ParentPlatform> parentPlatforms = parentPlatformMap.get(gbId); | 148 | List<ParentPlatform> parentPlatforms = parentPlatformMap.get(gbId); |
| 147 | if (parentPlatforms != null && parentPlatforms.size() > 0) { | 149 | if (parentPlatforms != null && parentPlatforms.size() > 0) { |
| 148 | for (ParentPlatform platform : parentPlatforms) { | 150 | for (ParentPlatform platform : parentPlatforms) { |
| 149 | - logger.info("[Catalog事件: {}]平台:{},影响通道{}", event.getType(), platform.getServerGBId(), gbId); | ||
| 150 | String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + platform.getServerGBId(); | 151 | String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + platform.getServerGBId(); |
| 151 | SubscribeInfo subscribeInfo = redisCatchStorage.getSubscribe(key); | 152 | SubscribeInfo subscribeInfo = redisCatchStorage.getSubscribe(key); |
| 153 | + if (subscribeInfo == null) continue; | ||
| 154 | + logger.info("[Catalog事件: {}]平台:{},影响通道{}", event.getType(), platform.getServerGBId(), gbId); | ||
| 152 | List<DeviceChannel> deviceChannelList = new ArrayList<>(); | 155 | List<DeviceChannel> deviceChannelList = new ArrayList<>(); |
| 153 | DeviceChannel deviceChannel = storager.queryChannelInParentPlatform(platform.getServerGBId(), gbId); | 156 | DeviceChannel deviceChannel = storager.queryChannelInParentPlatform(platform.getServerGBId(), gbId); |
| 154 | deviceChannelList.add(deviceChannel); | 157 | deviceChannelList.add(deviceChannel); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -1498,7 +1498,10 @@ public class SIPCommander implements ISIPCommander { | @@ -1498,7 +1498,10 @@ public class SIPCommander implements ISIPCommander { | ||
| 1498 | CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() | 1498 | CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() |
| 1499 | : udpSipProvider.getNewCallId(); | 1499 | : udpSipProvider.getNewCallId(); |
| 1500 | 1500 | ||
| 1501 | - Request request = headerProvider.createSubscribeRequest(device, cmdXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null, device.getSubscribeCycleForCatalog(), "Catalog" , callIdHeader); | 1501 | + // 有效时间默认为60秒以上 |
| 1502 | + Request request = headerProvider.createSubscribeRequest(device, cmdXml.toString(), "z9hG4bK-viaPos-" + tm, | ||
| 1503 | + "fromTagPos" + tm, null, device.getSubscribeCycleForCatalog() + 60, "Catalog" , | ||
| 1504 | + callIdHeader); | ||
| 1502 | transmitRequest(device, request, errorEvent, okEvent); | 1505 | transmitRequest(device, request, errorEvent, okEvent); |
| 1503 | 1506 | ||
| 1504 | return true; | 1507 | return true; |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
| @@ -370,10 +370,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -370,10 +370,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 370 | 370 | ||
| 371 | @Override | 371 | @Override |
| 372 | public boolean sendNotifyForCatalogAddOrUpdate(String type, ParentPlatform parentPlatform, List<DeviceChannel> deviceChannels, SubscribeInfo subscribeInfo) { | 372 | public boolean sendNotifyForCatalogAddOrUpdate(String type, ParentPlatform parentPlatform, List<DeviceChannel> deviceChannels, SubscribeInfo subscribeInfo) { |
| 373 | - if (parentPlatform == null) { | ||
| 374 | - return false; | ||
| 375 | - } | ||
| 376 | - if (deviceChannels == null || deviceChannels.size() == 0) { | 373 | + if (parentPlatform == null || deviceChannels == null || deviceChannels.size() == 0 || subscribeInfo == null) { |
| 377 | return false; | 374 | return false; |
| 378 | } | 375 | } |
| 379 | for (DeviceChannel channel : deviceChannels) { | 376 | for (DeviceChannel channel : deviceChannels) { |
| @@ -431,10 +428,10 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -431,10 +428,10 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 431 | 428 | ||
| 432 | @Override | 429 | @Override |
| 433 | public boolean sendNotifyForCatalogOther(String type, ParentPlatform parentPlatform, List<DeviceChannel> deviceChannels, SubscribeInfo subscribeInfo) { | 430 | public boolean sendNotifyForCatalogOther(String type, ParentPlatform parentPlatform, List<DeviceChannel> deviceChannels, SubscribeInfo subscribeInfo) { |
| 434 | - if (parentPlatform == null) { | ||
| 435 | - return false; | ||
| 436 | - } | ||
| 437 | - if (deviceChannels == null || deviceChannels.size() == 0) { | 431 | + if (parentPlatform == null |
| 432 | + || deviceChannels == null | ||
| 433 | + || deviceChannels.size() == 0 | ||
| 434 | + || subscribeInfo == null) { | ||
| 438 | return false; | 435 | return false; |
| 439 | } | 436 | } |
| 440 | 437 |
src/main/java/com/genersoft/iot/vmp/service/bean/CatalogSubscribeTask.java
| @@ -26,20 +26,8 @@ public class CatalogSubscribeTask implements Runnable{ | @@ -26,20 +26,8 @@ public class CatalogSubscribeTask implements Runnable{ | ||
| 26 | ResponseEvent event = (ResponseEvent) eventResult.event; | 26 | ResponseEvent event = (ResponseEvent) eventResult.event; |
| 27 | Element rootElement = null; | 27 | Element rootElement = null; |
| 28 | if (event.getResponse().getRawContent() != null) { | 28 | if (event.getResponse().getRawContent() != null) { |
| 29 | - try { | ||
| 30 | - rootElement = XmlUtil.getRootElement(event.getResponse().getRawContent(), "gb2312"); | ||
| 31 | - } catch (DocumentException e) { | ||
| 32 | - e.printStackTrace(); | ||
| 33 | - } | ||
| 34 | - Element resultElement = rootElement.element("Result"); | ||
| 35 | - String result = resultElement.getText(); | ||
| 36 | - if (result.toUpperCase().equals("OK")){ | ||
| 37 | - // 成功 | ||
| 38 | - logger.info("[目录订阅]成功: {}", device.getDeviceId()); | ||
| 39 | - }else { | ||
| 40 | - // 失败 | ||
| 41 | - logger.info("[目录订阅]失败: {}-{}", device.getDeviceId(), result); | ||
| 42 | - } | 29 | + // 成功 |
| 30 | + logger.info("[目录订阅]成功: {}", device.getDeviceId()); | ||
| 43 | }else { | 31 | }else { |
| 44 | // 成功 | 32 | // 成功 |
| 45 | logger.info("[目录订阅]成功: {}", device.getDeviceId()); | 33 | logger.info("[目录订阅]成功: {}", device.getDeviceId()); |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java
| @@ -5,15 +5,20 @@ import com.alibaba.excel.event.AnalysisEventListener; | @@ -5,15 +5,20 @@ import com.alibaba.excel.event.AnalysisEventListener; | ||
| 5 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | 5 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| 6 | import com.genersoft.iot.vmp.service.IStreamPushService; | 6 | import com.genersoft.iot.vmp.service.IStreamPushService; |
| 7 | import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto; | 7 | import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto; |
| 8 | +import org.springframework.util.StringUtils; | ||
| 8 | 9 | ||
| 9 | import java.util.ArrayList; | 10 | import java.util.ArrayList; |
| 11 | +import java.util.HashSet; | ||
| 10 | import java.util.List; | 12 | import java.util.List; |
| 13 | +import java.util.Set; | ||
| 11 | 14 | ||
| 12 | public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPushExcelDto> { | 15 | public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPushExcelDto> { |
| 13 | 16 | ||
| 14 | private IStreamPushService pushService; | 17 | private IStreamPushService pushService; |
| 15 | private String defaultMediaServerId; | 18 | private String defaultMediaServerId; |
| 16 | private List<StreamPushItem> streamPushItems = new ArrayList<>(); | 19 | private List<StreamPushItem> streamPushItems = new ArrayList<>(); |
| 20 | + private Set<String> streamPushStreamSet = new HashSet<>(); | ||
| 21 | + private Set<String> streamPushGBSet = new HashSet<>(); | ||
| 17 | 22 | ||
| 18 | public StreamPushUploadFileHandler(IStreamPushService pushService, String defaultMediaServerId) { | 23 | public StreamPushUploadFileHandler(IStreamPushService pushService, String defaultMediaServerId) { |
| 19 | this.pushService = pushService; | 24 | this.pushService = pushService; |
| @@ -22,6 +27,14 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus | @@ -22,6 +27,14 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus | ||
| 22 | 27 | ||
| 23 | @Override | 28 | @Override |
| 24 | public void invoke(StreamPushExcelDto streamPushExcelDto, AnalysisContext analysisContext) { | 29 | public void invoke(StreamPushExcelDto streamPushExcelDto, AnalysisContext analysisContext) { |
| 30 | + if (StringUtils.isEmpty(streamPushExcelDto.getApp()) | ||
| 31 | + || StringUtils.isEmpty(streamPushExcelDto.getStream()) | ||
| 32 | + || StringUtils.isEmpty(streamPushExcelDto.getGbId())) { | ||
| 33 | + return; | ||
| 34 | + } | ||
| 35 | + if (streamPushGBSet.contains(streamPushExcelDto.getGbId()) || streamPushStreamSet.contains(streamPushExcelDto.getApp() + streamPushExcelDto.getStream())) { | ||
| 36 | + return; | ||
| 37 | + } | ||
| 25 | StreamPushItem streamPushItem = new StreamPushItem(); | 38 | StreamPushItem streamPushItem = new StreamPushItem(); |
| 26 | streamPushItem.setApp(streamPushExcelDto.getApp()); | 39 | streamPushItem.setApp(streamPushExcelDto.getApp()); |
| 27 | streamPushItem.setStream(streamPushExcelDto.getStream()); | 40 | streamPushItem.setStream(streamPushExcelDto.getStream()); |
| @@ -35,6 +48,8 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus | @@ -35,6 +48,8 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus | ||
| 35 | streamPushItem.setOriginTypeStr("rtsp_push"); | 48 | streamPushItem.setOriginTypeStr("rtsp_push"); |
| 36 | streamPushItem.setTotalReaderCount("0"); | 49 | streamPushItem.setTotalReaderCount("0"); |
| 37 | streamPushItems.add(streamPushItem); | 50 | streamPushItems.add(streamPushItem); |
| 51 | + streamPushGBSet.add(streamPushExcelDto.getGbId()); | ||
| 52 | + streamPushStreamSet.add(streamPushExcelDto.getApp()+streamPushExcelDto.getStream()); | ||
| 38 | if (streamPushItems.size() > 300) { | 53 | if (streamPushItems.size() > 300) { |
| 39 | pushService.batchAdd(streamPushItems); | 54 | pushService.batchAdd(streamPushItems); |
| 40 | // 存储完成清理 list | 55 | // 存储完成清理 list |
| @@ -46,5 +61,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus | @@ -46,5 +61,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus | ||
| 46 | public void doAfterAllAnalysed(AnalysisContext analysisContext) { | 61 | public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
| 47 | // 这里也要保存数据,确保最后遗留的数据也存储到数据库 | 62 | // 这里也要保存数据,确保最后遗留的数据也存储到数据库 |
| 48 | pushService.batchAdd(streamPushItems); | 63 | pushService.batchAdd(streamPushItems); |
| 64 | + streamPushGBSet.clear(); | ||
| 65 | + streamPushStreamSet.clear(); | ||
| 49 | } | 66 | } |
| 50 | } | 67 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
| @@ -316,7 +316,8 @@ public class DeviceQuery { | @@ -316,7 +316,8 @@ public class DeviceQuery { | ||
| 316 | if (!StringUtils.isEmpty(device.getCharset())) deviceInStore.setCharset(device.getCharset()); | 316 | if (!StringUtils.isEmpty(device.getCharset())) deviceInStore.setCharset(device.getCharset()); |
| 317 | if (!StringUtils.isEmpty(device.getMediaServerId())) deviceInStore.setMediaServerId(device.getMediaServerId()); | 317 | if (!StringUtils.isEmpty(device.getMediaServerId())) deviceInStore.setMediaServerId(device.getMediaServerId()); |
| 318 | 318 | ||
| 319 | - if (deviceInStore.getSubscribeCycleForCatalog() <=0 && device.getSubscribeCycleForCatalog() > 0) { | 319 | + if ((deviceInStore.getSubscribeCycleForCatalog() <=0 && device.getSubscribeCycleForCatalog() > 0) |
| 320 | + || deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) { | ||
| 320 | deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog()); | 321 | deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog()); |
| 321 | // 开启订阅 | 322 | // 开启订阅 |
| 322 | deviceService.addCatalogSubscribe(deviceInStore); | 323 | deviceService.addCatalogSubscribe(deviceInStore); |
web_src/src/components/dialog/deviceEdit.vue
| @@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
| 10 | @close="close()" | 10 | @close="close()" |
| 11 | > | 11 | > |
| 12 | <div id="shared" style="margin-top: 1rem;margin-right: 100px;"> | 12 | <div id="shared" style="margin-top: 1rem;margin-right: 100px;"> |
| 13 | - <el-form ref="form" :rules="rules" :model="form" label-width="140px" > | 13 | + <el-form ref="form" :rules="rules" :model="form" label-width="240px" > |
| 14 | <el-form-item label="设备编号" > | 14 | <el-form-item label="设备编号" > |
| 15 | <el-input v-model="form.deviceId" disabled></el-input> | 15 | <el-input v-model="form.deviceId" disabled></el-input> |
| 16 | </el-form-item> | 16 | </el-form-item> |
| @@ -36,8 +36,8 @@ | @@ -36,8 +36,8 @@ | ||
| 36 | <el-option key="UTF-8" label="UTF-8" value="utf-8"></el-option> | 36 | <el-option key="UTF-8" label="UTF-8" value="utf-8"></el-option> |
| 37 | </el-select> | 37 | </el-select> |
| 38 | </el-form-item> | 38 | </el-form-item> |
| 39 | - <el-form-item label="目录订阅周期" prop="subscribeCycleForCatalog" > | ||
| 40 | - <el-input v-model="form.subscribeCycleForCatalog" clearable></el-input> | 39 | + <el-form-item label="目录订阅周期(0为停用订阅)" prop="subscribeCycleForCatalog" > |
| 40 | + <el-input v-model="form.subscribeCycleForCatalog" clearable ></el-input> | ||
| 41 | </el-form-item> | 41 | </el-form-item> |
| 42 | <el-form-item> | 42 | <el-form-item> |
| 43 | <div style="float: right;"> | 43 | <div style="float: right;"> |