| | |
| | | if (!parentPlatform.isStatus())return; |
| | | String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + event.getPlatformId(); |
| | | subscribe = redisCatchStorage.getSubscribe(key); |
| | | if (subscribe == null) return; |
| | | }else { |
| | | // 获取所用订阅 |
| | | List<String> platforms = redisCatchStorage.getAllSubscribePlatform(); |
| | |
| | | List<ParentPlatform> parentPlatforms = parentPlatformMap.get(gbId); |
| | | if (parentPlatforms != null && parentPlatforms.size() > 0) { |
| | | for (ParentPlatform platform : parentPlatforms) { |
| | | logger.info("[Catalog事件: {}]平台:{},影响通道{}", event.getType(), platform.getServerGBId(), gbId); |
| | | String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + platform.getServerGBId(); |
| | | SubscribeInfo subscribeInfo = redisCatchStorage.getSubscribe(key); |
| | | if (subscribeInfo == null) continue; |
| | | logger.info("[Catalog事件: {}]平台:{},影响通道{}", event.getType(), platform.getServerGBId(), gbId); |
| | | List<DeviceChannel> deviceChannelList = new ArrayList<>(); |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setChannelId(gbId); |
| | |
| | | List<ParentPlatform> parentPlatforms = parentPlatformMap.get(gbId); |
| | | if (parentPlatforms != null && parentPlatforms.size() > 0) { |
| | | for (ParentPlatform platform : parentPlatforms) { |
| | | logger.info("[Catalog事件: {}]平台:{},影响通道{}", event.getType(), platform.getServerGBId(), gbId); |
| | | String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + platform.getServerGBId(); |
| | | SubscribeInfo subscribeInfo = redisCatchStorage.getSubscribe(key); |
| | | if (subscribeInfo == null) continue; |
| | | logger.info("[Catalog事件: {}]平台:{},影响通道{}", event.getType(), platform.getServerGBId(), gbId); |
| | | List<DeviceChannel> deviceChannelList = new ArrayList<>(); |
| | | DeviceChannel deviceChannel = storager.queryChannelInParentPlatform(platform.getServerGBId(), gbId); |
| | | deviceChannelList.add(deviceChannel); |
| | |
| | | CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
|
| | | : udpSipProvider.getNewCallId();
|
| | |
|
| | | Request request = headerProvider.createSubscribeRequest(device, cmdXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null, device.getSubscribeCycleForCatalog(), "Catalog" , callIdHeader);
|
| | | // 有效时间默认为60秒以上
|
| | | Request request = headerProvider.createSubscribeRequest(device, cmdXml.toString(), "z9hG4bK-viaPos-" + tm,
|
| | | "fromTagPos" + tm, null, device.getSubscribeCycleForCatalog() + 60, "Catalog" ,
|
| | | callIdHeader);
|
| | | transmitRequest(device, request, errorEvent, okEvent);
|
| | |
|
| | | return true;
|
| | |
| | | |
| | | @Override |
| | | public boolean sendNotifyForCatalogAddOrUpdate(String type, ParentPlatform parentPlatform, List<DeviceChannel> deviceChannels, SubscribeInfo subscribeInfo) { |
| | | if (parentPlatform == null) { |
| | | return false; |
| | | } |
| | | if (deviceChannels == null || deviceChannels.size() == 0) { |
| | | if (parentPlatform == null || deviceChannels == null || deviceChannels.size() == 0 || subscribeInfo == null) { |
| | | return false; |
| | | } |
| | | for (DeviceChannel channel : deviceChannels) { |
| | |
| | | |
| | | @Override |
| | | public boolean sendNotifyForCatalogOther(String type, ParentPlatform parentPlatform, List<DeviceChannel> deviceChannels, SubscribeInfo subscribeInfo) { |
| | | if (parentPlatform == null) { |
| | | return false; |
| | | } |
| | | if (deviceChannels == null || deviceChannels.size() == 0) { |
| | | if (parentPlatform == null |
| | | || deviceChannels == null |
| | | || deviceChannels.size() == 0 |
| | | || subscribeInfo == null) { |
| | | return false; |
| | | } |
| | | |
| | |
| | | ResponseEvent event = (ResponseEvent) eventResult.event; |
| | | Element rootElement = null; |
| | | if (event.getResponse().getRawContent() != null) { |
| | | try { |
| | | rootElement = XmlUtil.getRootElement(event.getResponse().getRawContent(), "gb2312"); |
| | | } catch (DocumentException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | Element resultElement = rootElement.element("Result"); |
| | | String result = resultElement.getText(); |
| | | if (result.toUpperCase().equals("OK")){ |
| | | // 成功 |
| | | logger.info("[目录订阅]成功: {}", device.getDeviceId()); |
| | | }else { |
| | | // 失败 |
| | | logger.info("[目录订阅]失败: {}-{}", device.getDeviceId(), result); |
| | | } |
| | | // 成功 |
| | | logger.info("[目录订阅]成功: {}", device.getDeviceId()); |
| | | }else { |
| | | // 成功 |
| | | logger.info("[目录订阅]成功: {}", device.getDeviceId()); |
| | |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| | | import com.genersoft.iot.vmp.service.IStreamPushService; |
| | | import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPushExcelDto> { |
| | | |
| | | private IStreamPushService pushService; |
| | | private String defaultMediaServerId; |
| | | private List<StreamPushItem> streamPushItems = new ArrayList<>(); |
| | | private Set<String> streamPushStreamSet = new HashSet<>(); |
| | | private Set<String> streamPushGBSet = new HashSet<>(); |
| | | |
| | | public StreamPushUploadFileHandler(IStreamPushService pushService, String defaultMediaServerId) { |
| | | this.pushService = pushService; |
| | |
| | | |
| | | @Override |
| | | public void invoke(StreamPushExcelDto streamPushExcelDto, AnalysisContext analysisContext) { |
| | | if (StringUtils.isEmpty(streamPushExcelDto.getApp()) |
| | | || StringUtils.isEmpty(streamPushExcelDto.getStream()) |
| | | || StringUtils.isEmpty(streamPushExcelDto.getGbId())) { |
| | | return; |
| | | } |
| | | if (streamPushGBSet.contains(streamPushExcelDto.getGbId()) || streamPushStreamSet.contains(streamPushExcelDto.getApp() + streamPushExcelDto.getStream())) { |
| | | return; |
| | | } |
| | | StreamPushItem streamPushItem = new StreamPushItem(); |
| | | streamPushItem.setApp(streamPushExcelDto.getApp()); |
| | | streamPushItem.setStream(streamPushExcelDto.getStream()); |
| | |
| | | streamPushItem.setOriginTypeStr("rtsp_push"); |
| | | streamPushItem.setTotalReaderCount("0"); |
| | | streamPushItems.add(streamPushItem); |
| | | streamPushGBSet.add(streamPushExcelDto.getGbId()); |
| | | streamPushStreamSet.add(streamPushExcelDto.getApp()+streamPushExcelDto.getStream()); |
| | | if (streamPushItems.size() > 300) { |
| | | pushService.batchAdd(streamPushItems); |
| | | // 存储完成清理 list |
| | |
| | | public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
| | | // 这里也要保存数据,确保最后遗留的数据也存储到数据库 |
| | | pushService.batchAdd(streamPushItems); |
| | | streamPushGBSet.clear(); |
| | | streamPushStreamSet.clear(); |
| | | } |
| | | } |
| | |
| | | if (!StringUtils.isEmpty(device.getCharset())) deviceInStore.setCharset(device.getCharset()); |
| | | if (!StringUtils.isEmpty(device.getMediaServerId())) deviceInStore.setMediaServerId(device.getMediaServerId()); |
| | | |
| | | if (deviceInStore.getSubscribeCycleForCatalog() <=0 && device.getSubscribeCycleForCatalog() > 0) { |
| | | if ((deviceInStore.getSubscribeCycleForCatalog() <=0 && device.getSubscribeCycleForCatalog() > 0) |
| | | || deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) { |
| | | deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog()); |
| | | // 开启订阅 |
| | | deviceService.addCatalogSubscribe(deviceInStore); |
| | |
| | | @close="close()" |
| | | > |
| | | <div id="shared" style="margin-top: 1rem;margin-right: 100px;"> |
| | | <el-form ref="form" :rules="rules" :model="form" label-width="140px" > |
| | | <el-form ref="form" :rules="rules" :model="form" label-width="240px" > |
| | | <el-form-item label="设备编号" > |
| | | <el-input v-model="form.deviceId" disabled></el-input> |
| | | </el-form-item> |
| | |
| | | <el-option key="UTF-8" label="UTF-8" value="utf-8"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="目录订阅周期" prop="subscribeCycleForCatalog" > |
| | | <el-input v-model="form.subscribeCycleForCatalog" clearable></el-input> |
| | | <el-form-item label="目录订阅周期(0为停用订阅)" prop="subscribeCycleForCatalog" > |
| | | <el-input v-model="form.subscribeCycleForCatalog" clearable ></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <div style="float: right;"> |