From 23beb4fde063b4a648c2a273f17cf5c423fa0ae6 Mon Sep 17 00:00:00 2001 From: leesam <leesam@leesam.cn> Date: 星期一, 01 四月 2024 09:19:46 +0800 Subject: [PATCH] Merge branch 'master' into develop-add-api-key --- src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/MobilePositionResponseMessageHandler.java | 18 - web_src/src/components/dialog/rtcPlayer.vue | 4 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java | 22 - web_src/src/components/common/DeviceTree.vue | 6 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java | 16 src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java | 6 src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java | 77 +++++ src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java | 10 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java | 20 - src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusListMsgListener.java | 3 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java | 7 src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java | 8 src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java | 2 src/main/java/com/genersoft/iot/vmp/service/bean/WvpRedisMsgCmd.java | 10 src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java | 32 +- src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java | 2 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java | 120 +++++--- src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/control/cmd/DeviceControlQueryMessageHandler.java | 2 src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java | 2 src/main/resources/application-dev.yml | 2 src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java | 2 src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java | 4 src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java | 50 +++ src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/mobilePosition/MobilePositionEventLister.java | 61 ++++ src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java | 3 src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java | 4 src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java | 8 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java | 18 src/main/java/com/genersoft/iot/vmp/service/bean/RequestStopPushStreamMsg.java | 49 +++ web_src/src/components/map.vue | 2 README.md | 3 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java | 5 /dev/null | 0 src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java | 18 web_src/src/components/channelList.vue | 42 ++ src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java | 25 - web_src/src/components/dialog/channelMapInfobox.vue | 2 src/main/java/com/genersoft/iot/vmp/service/bean/GPSMsgInfo.java | 15 + src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java | 4 src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/mobilePosition/MobilePositionEvent.java | 20 + src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java | 44 --- src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java | 4 src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java | 12 43 files changed, 514 insertions(+), 250 deletions(-) diff --git a/README.md b/README.md index a64a1c1..a50c36d 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,7 @@ # 闈炲紑婧愮殑鍐呭 - [X] ONVIF璁惧鐨勬帴鍏ワ紝鏀寔鐐规挱锛屼簯鍙版帶鍒讹紝鍥芥爣绾ц仈鐐规挱锛岃嚜鍔ㄧ偣鎾�傚湪[鐭ヨ瘑鏄熺悆](https://t.zsxq.com/10WAnH2MP)鏀句簡璇曠敤瀹夎鍖呬互鍙婁娇鐢ㄦ暀绋嬶紝娌℃湁浣跨敤鏃堕棿闄愬埗锛岄渶瑕佹簮鐮佸彲浠ユ槦鐞冪淇℃垜鎴栬�呴偖绠辫仈绯汇�� +- [X] 鏀寔鍥芥爣28181-2022鍗忚锛屾敮鎸佸贰鑸建杩规煡璇紝PTZ绮惧噯鎺у埗锛屽瓨鍌ㄥ崱鏍煎紡鍖栵紝璁惧杞欢鍗囩骇锛孫SD閰嶇疆锛宧265+aac锛屾敮鎸佽緟鐮佹祦锛屽綍鍍忓�掓斁绛夈�傚叿浣撶殑鍔熻兘鍒楄〃鍙湪[鐭ヨ瘑鏄熺悆](https://t.zsxq.com/18GXkpkqs)鏌ョ湅锛岄渶瑕佹簮鐮佸拰娴嬭瘯鍙互鍦ㄦ槦鐞冪淇¤仈绯绘垨鑰呭彂閭欢缁欐垜 # 鎺堟潈鍗忚 @@ -119,7 +120,7 @@ # 鎶�鏈敮鎸� -[鐭ヨ瘑鏄熺悆](https://t.zsxq.com/0d8VAD3Dm)涓撴爮鍒楄〃锛� +[鐭ヨ瘑鏄熺悆](https://t.zsxq.com/0d8VAD3Dm)涓撴爮鍒楄〃锛氾紝 - [浣跨敤鍏ラ棬绯诲垪涓�锛歐VP-PRO鑳藉仛浠�涔圿(https://t.zsxq.com/0dLguVoSp) 鏈夊伩鎶�鏈敮鎸侊紝璇峰彂閫侀偖浠跺埌648540858@qq.com diff --git a/src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java b/src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java index 5a451e3..de0e2df 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java @@ -9,6 +9,7 @@ import javax.annotation.PostConstruct; import java.time.Instant; +import java.util.Date; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -59,7 +60,8 @@ } } // scheduleWithFixedDelay 蹇呴』绛夊緟涓婁竴涓换鍔$粨鏉熸墠寮�濮嬭鏃秔eriod锛� cycleForCatalog琛ㄧず鎵ц鐨勯棿闅� - future = threadPoolTaskScheduler.scheduleAtFixedRate(task, cycleForCatalog); + + future = threadPoolTaskScheduler.scheduleAtFixedRate(task, new Date(System.currentTimeMillis() + cycleForCatalog), cycleForCatalog); if (future != null){ futureMap.put(key, future); runnableMap.put(key, task); diff --git a/src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java deleted file mode 100644 index e69de29..0000000 --- a/src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java +++ /dev/null diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java index d58abcb..32b6fac 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java @@ -142,13 +142,13 @@ * 浜戝彴绫诲瀷 */ @Schema(description = "浜戝彴绫诲瀷") - private int PTZType; + private int ptzType; /** * 浜戝彴绫诲瀷鎻忚堪瀛楃涓� */ @Schema(description = "浜戝彴绫诲瀷鎻忚堪瀛楃涓�") - private String PTZTypeText; + private String ptzTypeText; /** * 鍒涘缓鏃堕棿 @@ -266,23 +266,23 @@ this.deviceId = deviceId; } - public void setPTZType(int PTZType) { - this.PTZType = PTZType; - switch (PTZType) { + public void setPtzType(int ptzType) { + this.ptzType = ptzType; + switch (ptzType) { case 0: - this.PTZTypeText = "鏈煡"; + this.ptzTypeText = "鏈煡"; break; case 1: - this.PTZTypeText = "鐞冩満"; + this.ptzTypeText = "鐞冩満"; break; case 2: - this.PTZTypeText = "鍗婄悆"; + this.ptzTypeText = "鍗婄悆"; break; case 3: - this.PTZTypeText = "鍥哄畾鏋満"; + this.ptzTypeText = "鍥哄畾鏋満"; break; case 4: - this.PTZTypeText = "閬ユ帶鏋満"; + this.ptzTypeText = "閬ユ帶鏋満"; break; } } @@ -447,16 +447,16 @@ this.password = password; } - public int getPTZType() { - return PTZType; + public int getPtzType() { + return ptzType; } - public String getPTZTypeText() { - return PTZTypeText; + public String getPtzTypeText() { + return ptzTypeText; } - public void setPTZTypeText(String PTZTypeText) { - this.PTZTypeText = PTZTypeText; + public void setPtzTypeText(String ptzTypeText) { + this.ptzTypeText = ptzTypeText; } public boolean isStatus() { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java index e7b7ab8..6557bba 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java @@ -103,6 +103,16 @@ return platforms; } + public List<String> getAllMobilePositionSubscribePlatform() { + List<String> platforms = new ArrayList<>(); + if(!mobilePositionMap.isEmpty()) { + for (String key : mobilePositionMap.keySet()) { + platforms.add(mobilePositionMap.get(key).getId()); + } + } + return platforms; + } + public void removeAllSubscribe(String platformId) { removeMobilePositionSubscribe(platformId); removeCatalogSubscribe(platformId); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java index d56e744..c0b66fe 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java @@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.gb28181.event.device.RequestTimeoutEvent; import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEvent; import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; +import com.genersoft.iot.vmp.gb28181.event.subscribe.mobilePosition.MobilePositionEvent; import com.genersoft.iot.vmp.media.zlm.event.ZLMOfflineEvent; import com.genersoft.iot.vmp.media.zlm.event.ZLMOnlineEvent; import org.springframework.beans.factory.annotation.Autowired; @@ -94,6 +95,13 @@ } + public void mobilePositionEventPublish(MobilePosition mobilePosition) { + MobilePositionEvent event = new MobilePositionEvent(this); + event.setMobilePosition(mobilePosition); + applicationEventPublisher.publishEvent(event); + } + + public void catalogEventPublishForStream(String platformId, List<GbStream> gbStreams, String type) { CatalogEvent outEvent = new CatalogEvent(this); outEvent.setGbStreams(gbStreams); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/mobilePosition/MobilePositionEvent.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/mobilePosition/MobilePositionEvent.java new file mode 100755 index 0000000..0686651 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/mobilePosition/MobilePositionEvent.java @@ -0,0 +1,20 @@ +package com.genersoft.iot.vmp.gb28181.event.subscribe.mobilePosition; + +import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; +import org.springframework.context.ApplicationEvent; + +public class MobilePositionEvent extends ApplicationEvent { + public MobilePositionEvent(Object source) { + super(source); + } + + private MobilePosition mobilePosition; + + public MobilePosition getMobilePosition() { + return mobilePosition; + } + + public void setMobilePosition(MobilePosition mobilePosition) { + this.mobilePosition = mobilePosition; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/mobilePosition/MobilePositionEventLister.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/mobilePosition/MobilePositionEventLister.java new file mode 100755 index 0000000..7a96116 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/mobilePosition/MobilePositionEventLister.java @@ -0,0 +1,61 @@ +package com.genersoft.iot.vmp.gb28181.event.subscribe.mobilePosition; + +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; +import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; +import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo; +import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; +import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +import javax.sip.InvalidArgumentException; +import javax.sip.SipException; +import java.text.ParseException; +import java.util.List; + +/** + * 绉诲姩浣嶇疆閫氱煡娑堟伅杞彂 + */ +@Component +public class MobilePositionEventLister implements ApplicationListener<MobilePositionEvent> { + + private final static Logger logger = LoggerFactory.getLogger(MobilePositionEventLister.class); + + @Autowired + private IVideoManagerStorage storager; + + @Autowired + private SIPCommanderFroPlatform sipCommanderFroPlatform; + + @Autowired + private SubscribeHolder subscribeHolder; + + @Override + public void onApplicationEvent(MobilePositionEvent event) { + // 鑾峰彇鎵�鐢ㄨ闃� + List<String> platforms = subscribeHolder.getAllMobilePositionSubscribePlatform(); + if (platforms.isEmpty()) { + return; + } + List<ParentPlatform> parentPlatformsForGB = storager.queryPlatFormListForGBWithGBId(event.getMobilePosition().getChannelId(), platforms); + + for (ParentPlatform platform : parentPlatformsForGB) { + logger.info("[鍚戜笂绾у彂閫丮obilePosition] 閫氶亾锛歿}锛屽钩鍙帮細{}锛� 浣嶇疆锛� {}:{}", event.getMobilePosition().getChannelId(), + platform.getServerGBId(), event.getMobilePosition().getLongitude(), event.getMobilePosition().getLatitude()); + SubscribeInfo subscribe = subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId()); + try { + sipCommanderFroPlatform.sendNotifyMobilePosition(platform, GPSMsgInfo.getInstance(event.getMobilePosition()), + subscribe); + } catch (InvalidArgumentException | ParseException | NoSuchFieldException | SipException | + IllegalAccessException e) { + logger.error("[鍛戒护鍙戦�佸け璐 鍥芥爣绾ц仈 Catalog閫氱煡: {}", e.getMessage()); + } + } + + } +} + \ No newline at end of file diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java b/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java index 24d4ef3..cb2caec 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java @@ -50,7 +50,7 @@ ssrcTransaction.setType(type); redisTemplate.opsForValue().set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() - + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); + + ":" + deviceId + ":" + channelId + ":" + callId + ":" + stream, ssrcTransaction); } public SsrcTransaction getSsrcTransaction(String deviceId, String channelId, String callId, String stream){ @@ -67,7 +67,7 @@ if (ObjectUtils.isEmpty(stream)) { stream ="*"; } - String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; + String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":" + deviceId + ":" + channelId + ":" + callId+ ":" + stream; List<Object> scanResult = RedisUtil.scan(redisTemplate, key); if (scanResult.size() == 0) { return null; @@ -80,12 +80,12 @@ if (ObjectUtils.isEmpty(callId)) { return null; } - String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_*_*_" + callId+ "_*"; + String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":*:*:" + callId+ ":*"; List<Object> scanResult = RedisUtil.scan(redisTemplate, key); if (!scanResult.isEmpty()) { return (SsrcTransaction)redisTemplate.opsForValue().get(scanResult.get(0)); }else { - key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_*_*_play_*"; + key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":*:*:play:*"; scanResult = RedisUtil.scan(redisTemplate, key); if (scanResult.isEmpty()) { return null; @@ -115,7 +115,7 @@ if (ObjectUtils.isEmpty(stream)) { stream ="*"; } - String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; + String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":" + deviceId + ":" + channelId + ":" + callId+ ":" + stream; List<Object> scanResult = RedisUtil.scan(redisTemplate, key); if (scanResult.size() == 0) { return null; @@ -149,8 +149,8 @@ return; } for (SsrcTransaction ssrcTransaction : ssrcTransactionList) { - redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" - + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream()); + redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":" + + deviceId + ":" + channelId + ":" + ssrcTransaction.getCallId() + ":" + ssrcTransaction.getStream()); } } @@ -159,8 +159,8 @@ if (ssrcTransaction == null ) { return; } - redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" - + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream()); + redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":" + + deviceId + ":" + channelId + ":" + ssrcTransaction.getCallId() + ":" + ssrcTransaction.getStream()); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java index d48e3a8..66589a8 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java @@ -220,13 +220,8 @@ /** * 鐪嬪畧浣嶆帶鍒跺懡浠� * - * @param device 瑙嗛璁惧 - * @param channelId 閫氶亾id锛岄潪閫氶亾鍒欐槸璁惧鏈韩 - * @param enabled 鐪嬪畧浣嶄娇鑳斤細1 = 寮�鍚紝0 = 鍏抽棴 - * @param resetTime 鑷姩褰掍綅鏃堕棿闂撮殧锛屽紑鍚湅瀹堜綅鏃朵娇鐢紝鍗曚綅:绉�(s) - * @param presetIndex 璋冪敤棰勭疆浣嶇紪鍙凤紝寮�鍚湅瀹堜綅鏃朵娇鐢紝鍙栧�艰寖鍥�0~255 */ - void homePositionCmd(Device device, String channelId, String enabled, String resetTime, String presetIndex, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException; + void homePositionCmd(Device device, String channelId, Boolean enabled, Integer resetTime, Integer presetIndex, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException; /** * 璁惧閰嶇疆鍛戒护 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java index 723c715..3a5f812 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java @@ -880,7 +880,7 @@ * @param presetIndex 璋冪敤棰勭疆浣嶇紪鍙凤紝寮�鍚湅瀹堜綅鏃朵娇鐢紝鍙栧�艰寖鍥�0~255 */ @Override - public void homePositionCmd(Device device, String channelId, String enabled, String resetTime, String presetIndex, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException { + public void homePositionCmd(Device device, String channelId, Boolean enabled, Integer resetTime, Integer presetIndex, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException { StringBuffer cmdXml = new StringBuffer(200); String charset = device.getCharset(); @@ -894,18 +894,10 @@ cmdXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); } cmdXml.append("<HomePosition>\r\n"); - if (NumericUtil.isInteger(enabled) && (!enabled.equals("0"))) { + if (enabled) { cmdXml.append("<Enabled>1</Enabled>\r\n"); - if (NumericUtil.isInteger(resetTime)) { - cmdXml.append("<ResetTime>" + resetTime + "</ResetTime>\r\n"); - } else { - cmdXml.append("<ResetTime>0</ResetTime>\r\n"); - } - if (NumericUtil.isInteger(presetIndex)) { - cmdXml.append("<PresetIndex>" + presetIndex + "</PresetIndex>\r\n"); - } else { - cmdXml.append("<PresetIndex>0</PresetIndex>\r\n"); - } + cmdXml.append("<ResetTime>" + resetTime + "</ResetTime>\r\n"); + cmdXml.append("<PresetIndex>" + presetIndex + "</PresetIndex>\r\n"); } else { cmdXml.append("<Enabled>0</Enabled>\r\n"); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java index abd32fb..2964654 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java @@ -358,8 +358,8 @@ }else { catalogXml.append("<Password></Password>\r\n"); } - if (!ObjectUtils.isEmpty(channel.getPTZType())) { - catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n"); + if (!ObjectUtils.isEmpty(channel.getPtzType())) { + catalogXml.append("<PTZType>" + channel.getPtzType() + "</PTZType>\r\n"); }else { catalogXml.append("<PTZType></PTZType>\r\n"); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java index f66e3c3..ff7427b 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java @@ -15,8 +15,11 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; +import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; import com.genersoft.iot.vmp.service.*; import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; +import com.genersoft.iot.vmp.service.bean.RequestStopPushStreamMsg; +import com.genersoft.iot.vmp.service.redisMsg.RedisGbPlayMsgListener; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import gov.nist.javax.sip.message.SIPRequest; @@ -92,6 +95,12 @@ @Autowired private UserSetting userSetting; + @Autowired + private IStreamPushService pushService; + + @Autowired + private RedisGbPlayMsgListener redisGbPlayMsgListener; + @Override public void afterPropertiesSet() throws Exception { // 娣诲姞娑堟伅澶勭悊鐨勮闃� @@ -115,7 +124,7 @@ // 鏀舵祦绔彂閫佺殑鍋滄 if (sendRtpItem != null){ - logger.info("[鏀跺埌bye] 鏉ヨ嚜{}锛屽仠姝㈤�氶亾锛歿}, 绫诲瀷锛� {}", sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), sendRtpItem.getPlayType()); + logger.info("[鏀跺埌bye] 鏉ヨ嚜{}锛屽仠姝㈤�氶亾锛歿}, 绫诲瀷锛� {}, callId: {}", sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), sendRtpItem.getPlayType(), callIdHeader.getCallId()); String streamId = sendRtpItem.getStream(); Map<String, Object> param = new HashMap<>(); @@ -123,59 +132,82 @@ param.put("app",sendRtpItem.getApp()); param.put("stream",streamId); param.put("ssrc",sendRtpItem.getSsrc()); - logger.info("[鏀跺埌bye] 鍋滄鎺ㄦ祦锛歿}", streamId); - MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); - redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), - callIdHeader.getCallId(), null); - zlmServerFactory.stopSendRtpStream(mediaInfo, param); - if (userSetting.getUseCustomSsrcForParentInvite()) { - mediaServerService.releaseSsrc(mediaInfo.getId(), sendRtpItem.getSsrc()); - } + logger.info("[鏀跺埌bye] 鍋滄鎺ㄦ祦锛歿}, 濯掍綋鑺傜偣锛� {}", streamId, sendRtpItem.getMediaServerId()); + if (sendRtpItem.getPlayType().equals(InviteStreamType.PUSH)) { - ParentPlatform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId()); - if (platform != null) { - MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, - sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getChannelId(), - sendRtpItem.getPlatformId(), platform.getName(), userSetting.getServerId(), sendRtpItem.getMediaServerId()); - messageForPushChannel.setPlatFormIndex(platform.getId()); - redisCatchStorage.sendPlatformStopPlayMsg(messageForPushChannel); + // 鏌ヨ杩欒矾娴佹槸鍚︽槸鏈钩鍙扮殑 + StreamPushItem push = pushService.getPush(sendRtpItem.getApp(), sendRtpItem.getStream()); + if (push!= null && !push.isSelf()) { + // 涓嶆槸鏈钩鍙扮殑灏卞彂閫乺edis娑堟伅璁╁叾浠杦vp鍋滄鍙戞祦 + ParentPlatform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId()); + if (platform != null) { + RequestStopPushStreamMsg streamMsg = RequestStopPushStreamMsg.getInstance(sendRtpItem, platform.getName(), platform.getId()); + redisGbPlayMsgListener.sendMsgForStopSendRtpStream(sendRtpItem.getServerId(), streamMsg); + } }else { - logger.info("[涓婄骇骞冲彴鍋滄瑙傜湅] 鏈壘鍒板钩鍙皗}鐨勪俊鎭紝鍙戦�乺edis娑堟伅澶辫触", sendRtpItem.getPlatformId()); + MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); + redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), + callIdHeader.getCallId(), null); + zlmServerFactory.stopSendRtpStream(mediaInfo, param); + if (userSetting.getUseCustomSsrcForParentInvite()) { + mediaServerService.releaseSsrc(mediaInfo.getId(), sendRtpItem.getSsrc()); + } + + ParentPlatform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId()); + if (platform != null) { + MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, + sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getChannelId(), + sendRtpItem.getPlatformId(), platform.getName(), userSetting.getServerId(), sendRtpItem.getMediaServerId()); + messageForPushChannel.setPlatFormIndex(platform.getId()); + redisCatchStorage.sendPlatformStopPlayMsg(messageForPushChannel); + }else { + logger.info("[涓婄骇骞冲彴鍋滄瑙傜湅] 鏈壘鍒板钩鍙皗}鐨勪俊鎭紝鍙戦�乺edis娑堟伅澶辫触", sendRtpItem.getPlatformId()); + } + } + }else { + MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); + redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), + callIdHeader.getCallId(), null); + zlmServerFactory.stopSendRtpStream(mediaInfo, param); + if (userSetting.getUseCustomSsrcForParentInvite()) { + mediaServerService.releaseSsrc(mediaInfo.getId(), sendRtpItem.getSsrc()); } } + MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); + if (mediaInfo != null) { + AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); + if (audioBroadcastCatch != null && audioBroadcastCatch.getSipTransactionInfo().getCallId().equals(callIdHeader.getCallId())) { + // 鏉ヨ嚜涓婄骇骞冲彴鐨勫仠姝㈠璁� + logger.info("[鍋滄瀵硅] 鏉ヨ嚜涓婄骇锛屽钩鍙帮細{}, 閫氶亾锛歿}", sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); + audioBroadcastManager.del(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); + } - AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); - if (audioBroadcastCatch != null && audioBroadcastCatch.getSipTransactionInfo().getCallId().equals(callIdHeader.getCallId())) { - // 鏉ヨ嚜涓婄骇骞冲彴鐨勫仠姝㈠璁� - logger.info("[鍋滄瀵硅] 鏉ヨ嚜涓婄骇锛屽钩鍙帮細{}, 閫氶亾锛歿}", sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); - audioBroadcastManager.del(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); - } - - int totalReaderCount = zlmServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId); - if (totalReaderCount <= 0) { - logger.info("[鏀跺埌bye] {} 鏃犲叾瀹冭鐪嬭�咃紝閫氱煡璁惧鍋滄鎺ㄦ祦", streamId); - if (sendRtpItem.getPlayType().equals(InviteStreamType.PLAY)) { - Device device = deviceService.getDevice(sendRtpItem.getDeviceId()); - if (device == null) { - logger.info("[鏀跺埌bye] {} 閫氱煡璁惧鍋滄鎺ㄦ祦鏃舵湭鎵惧埌璁惧淇℃伅", streamId); - } - try { - logger.info("[鍋滄鐐规挱] {}/{}", sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); - cmder.streamByeCmd(device, sendRtpItem.getChannelId(), streamId, null); - } catch (InvalidArgumentException | ParseException | SipException | - SsrcTransactionNotFoundException e) { - logger.error("[鏀跺埌bye] {} 鏃犲叾瀹冭鐪嬭�咃紝閫氱煡璁惧鍋滄鎺ㄦ祦锛� 鍙戦�丅YE澶辫触 {}",streamId, e.getMessage()); + int totalReaderCount = zlmServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId); + if (totalReaderCount <= 0) { + logger.info("[鏀跺埌bye] {} 鏃犲叾瀹冭鐪嬭�咃紝閫氱煡璁惧鍋滄鎺ㄦ祦", streamId); + if (sendRtpItem.getPlayType().equals(InviteStreamType.PLAY)) { + Device device = deviceService.getDevice(sendRtpItem.getDeviceId()); + if (device == null) { + logger.info("[鏀跺埌bye] {} 閫氱煡璁惧鍋滄鎺ㄦ祦鏃舵湭鎵惧埌璁惧淇℃伅", streamId); + } + try { + logger.info("[鍋滄鐐规挱] {}/{}", sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); + cmder.streamByeCmd(device, sendRtpItem.getChannelId(), streamId, null); + } catch (InvalidArgumentException | ParseException | SipException | + SsrcTransactionNotFoundException e) { + logger.error("[鏀跺埌bye] {} 鏃犲叾瀹冭鐪嬭�咃紝閫氱煡璁惧鍋滄鎺ㄦ祦锛� 鍙戦�丅YE澶辫触 {}",streamId, e.getMessage()); + } } } } } - // 鍙兘鏄澶囧彂閫佺殑鍋滄 - SsrcTransaction ssrcTransaction = streamSession.getSsrcTransactionByCallId(callIdHeader.getCallId()); - if (ssrcTransaction == null) { - return; - } - logger.info("[鏀跺埌bye] 鏉ヨ嚜璁惧锛歿}, 閫氶亾宸插仠姝㈡帹娴�: {}", ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId()); + // 鍙兘鏄澶囧彂閫佺殑鍋滄 + SsrcTransaction ssrcTransaction = streamSession.getSsrcTransactionByCallId(callIdHeader.getCallId()); + if (ssrcTransaction == null) { + return; + } + logger.info("[鏀跺埌bye] 鏉ヨ嚜璁惧锛歿}, 閫氶亾宸插仠姝㈡帹娴�: {}", ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId()); ParentPlatform platform = platformService.queryPlatformByServerGBId(ssrcTransaction.getDeviceId()); if (platform != null ) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java index 8084435..3205498 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java @@ -498,6 +498,7 @@ String endTimeStr = DateUtil.urlFormatter.format(end); String stream = device.getDeviceId() + "_" + channelId + "_" + startTimeStr + "_" + endTimeStr; SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, stream, null, device.isSsrcCheck(), true, 0,false, false, device.getStreamModeForParam()); + sendRtpItem.setStream(stream); // 鍐欏叆redis锛� 瓒呮椂鏃跺洖澶� redisCatchStorage.updateSendRTPSever(sendRtpItem); playService.playBack(mediaServerItem, ssrcInfo, device.getDeviceId(), channelId, DateUtil.formatter.format(start), @@ -1006,7 +1007,7 @@ Media media = mediaDescription.getMedia(); Vector mediaFormats = media.getMediaFormats(false); - if (mediaFormats.contains("8")) { +// if (mediaFormats.contains("8")) { port = media.getMediaPort(); String protocol = media.getProtocol(); // 鍖哄垎TCP鍙戞祦杩樻槸udp锛� 褰撳墠榛樿udp @@ -1022,7 +1023,7 @@ } } break; - } +// } } if (port == -1) { logger.info("涓嶆敮鎸佺殑濯掍綋鏍煎紡锛岃繑鍥�415"); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java index 435f35f..e54aa2d 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java @@ -1,7 +1,5 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; -import com.alibaba.fastjson2.JSONObject; -import com.genersoft.iot.vmp.conf.CivilCodeFileConf; import com.genersoft.iot.vmp.conf.SipConfig; import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.gb28181.bean.*; @@ -78,9 +76,6 @@ @Autowired private NotifyRequestForCatalogProcessor notifyRequestForCatalogProcessor; - @Autowired - private CivilCodeFileConf civilCodeFileConf; - private ConcurrentLinkedQueue<HandlerCatchData> taskQueue = new ConcurrentLinkedQueue<>(); @Qualifier("taskExecutor") @@ -98,7 +93,6 @@ @Override public void process(RequestEvent evt) { try { - if (taskQueue.size() >= userSetting.getMaxNotifyCountQueue()) { responseAck((SIPRequest) evt.getRequest(), Response.BUSY_HERE, null, null); logger.error("[notify] 寰呭鐞嗘秷鎭槦鍒楀凡婊� {}锛岃繑鍥�486 BUSY_HERE锛屾秷鎭笉鍋氬鐞�", userSetting.getMaxNotifyCountQueue()); @@ -234,25 +228,8 @@ mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02()); mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02()); - if (userSetting.getSavePositionHistory()) { - storager.insertMobilePosition(mobilePosition); - } + deviceChannelService.updateChannelGPS(device, deviceChannel, mobilePosition); - storager.updateChannelPosition(deviceChannel); - // 鍚戝叧鑱斾簡璇ラ�氶亾骞朵笖寮�鍚Щ鍔ㄤ綅缃闃呯殑涓婄骇骞冲彴鍙戦�佺Щ鍔ㄤ綅缃闃呮秷鎭� - - - // 鍙戦�乺edis娑堟伅銆� 閫氱煡浣嶇疆淇℃伅鐨勫彉鍖� - JSONObject jsonObject = new JSONObject(); - jsonObject.put("time", DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime())); - jsonObject.put("serial", deviceId); - jsonObject.put("code", channelId); - jsonObject.put("longitude", mobilePosition.getLongitude()); - jsonObject.put("latitude", mobilePosition.getLatitude()); - jsonObject.put("altitude", mobilePosition.getAltitude()); - jsonObject.put("direction", mobilePosition.getDirection()); - jsonObject.put("speed", mobilePosition.getSpeed()); - redisCatchStorage.sendMobilePositionMsg(jsonObject); } catch (DocumentException e) { logger.error("鏈鐞嗙殑寮傚父 ", e); } @@ -340,25 +317,8 @@ mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02()); mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02()); - if (userSetting.getSavePositionHistory()) { - storager.insertMobilePosition(mobilePosition); - } - - storager.updateChannelPosition(deviceChannel); - // 鍙戦�乺edis娑堟伅銆� 閫氱煡浣嶇疆淇℃伅鐨勫彉鍖� - JSONObject jsonObject = new JSONObject(); - jsonObject.put("time", DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime())); - jsonObject.put("serial", deviceChannel.getDeviceId()); - jsonObject.put("code", deviceChannel.getChannelId()); - jsonObject.put("longitude", mobilePosition.getLongitude()); - jsonObject.put("latitude", mobilePosition.getLatitude()); - jsonObject.put("altitude", mobilePosition.getAltitude()); - jsonObject.put("direction", mobilePosition.getDirection()); - jsonObject.put("speed", mobilePosition.getSpeed()); - redisCatchStorage.sendMobilePositionMsg(jsonObject); - + deviceChannelService.updateChannelGPS(device, deviceChannel, mobilePosition); } - // TODO: 闇�瑕佸疄鐜板瓨鍌ㄦ姤璀︿俊鎭�佹姤璀﹀垎绫� // 鍥炲200 OK if (redisCatchStorage.deviceIsOnline(deviceId)) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/control/cmd/DeviceControlQueryMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/control/cmd/DeviceControlQueryMessageHandler.java index b2dd76b..23adac1 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/control/cmd/DeviceControlQueryMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/control/cmd/DeviceControlQueryMessageHandler.java @@ -248,7 +248,7 @@ HomePositionRequest homePosition = loadElement(rootElement, HomePositionRequest.class); //鑾峰彇鏁翠釜娑堟伅涓讳綋锛屾垜浠彧闇�瑕佷慨鏀硅姹傚ご鍗冲彲 HomePositionRequest.HomePosition info = homePosition.getHomePosition(); - cmder.homePositionCmd(device, channelId, info.getEnabled(), info.getResetTime(), info.getPresetIndex(), + cmder.homePositionCmd(device, channelId, !"0".equals(info.getEnabled()), Integer.parseInt(info.getResetTime()), Integer.parseInt(info.getPresetIndex()), errorResult -> onError(request, errorResult), okResult -> onOk(request, okResult)); } catch (Exception e) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java index 2fc7ae0..ec4a399 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java @@ -75,6 +75,9 @@ @Autowired private ThreadPoolTaskExecutor taskExecutor; + @Autowired + private EventPublisher eventPublisher; + @Override public void afterPropertiesSet() throws Exception { @@ -158,22 +161,7 @@ mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02()); mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02()); - if (userSetting.getSavePositionHistory()) { - storager.insertMobilePosition(mobilePosition); - } - storager.updateChannelPosition(deviceChannel); - - // 鍙戦�乺edis娑堟伅銆� 閫氱煡浣嶇疆淇℃伅鐨勫彉鍖� - JSONObject jsonObject = new JSONObject(); - jsonObject.put("time", DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime())); - jsonObject.put("serial", deviceChannel.getDeviceId()); - jsonObject.put("code", deviceChannel.getChannelId()); - jsonObject.put("longitude", mobilePosition.getLongitude()); - jsonObject.put("latitude", mobilePosition.getLatitude()); - jsonObject.put("altitude", mobilePosition.getAltitude()); - jsonObject.put("direction", mobilePosition.getDirection()); - jsonObject.put("speed", mobilePosition.getSpeed()); - redisCatchStorage.sendMobilePositionMsg(jsonObject); + deviceChannelService.updateChannelGPS(device, deviceChannel, mobilePosition); } } if (!ObjectUtils.isEmpty(deviceAlarm.getDeviceId())) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java index 9a82b8a..bc588c9 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java @@ -1,8 +1,8 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; -import com.alibaba.fastjson2.JSONObject; 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.transmit.event.request.SIPRequestProcessorParent; import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; @@ -56,6 +56,9 @@ @Autowired private IDeviceChannelService deviceChannelService; + + @Autowired + private EventPublisher eventPublisher; private ConcurrentLinkedQueue<SipMsgInfo> taskQueue = new ConcurrentLinkedQueue<>(); @@ -137,22 +140,7 @@ mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02()); mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02()); - if (userSetting.getSavePositionHistory()) { - storager.insertMobilePosition(mobilePosition); - } - storager.updateChannelPosition(deviceChannel); - - // 鍙戦�乺edis娑堟伅銆� 閫氱煡浣嶇疆淇℃伅鐨勫彉鍖� - JSONObject jsonObject = new JSONObject(); - jsonObject.put("time", DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime())); - jsonObject.put("serial", deviceChannel.getDeviceId()); - jsonObject.put("code", deviceChannel.getChannelId()); - jsonObject.put("longitude", mobilePosition.getLongitude()); - jsonObject.put("latitude", mobilePosition.getLatitude()); - jsonObject.put("altitude", mobilePosition.getAltitude()); - jsonObject.put("direction", mobilePosition.getDirection()); - jsonObject.put("speed", mobilePosition.getSpeed()); - redisCatchStorage.sendMobilePositionMsg(jsonObject); + deviceChannelService.updateChannelGPS(device, deviceChannel, mobilePosition); } catch (DocumentException e) { logger.error("鏈鐞嗙殑寮傚父 ", e); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/MobilePositionResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/MobilePositionResponseMessageHandler.java index 36a72bc..5c3d6d6 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/MobilePositionResponseMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/MobilePositionResponseMessageHandler.java @@ -1,6 +1,5 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; -import com.alibaba.fastjson2.JSONObject; import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; @@ -131,11 +130,7 @@ mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02()); mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02()); - if (userSetting.getSavePositionHistory()) { - storager.insertMobilePosition(mobilePosition); - } - - storager.updateChannelPosition(deviceChannel); + deviceChannelService.updateChannelGPS(device, deviceChannel, mobilePosition); String key = DeferredResultHolder.CALLBACK_CMD_MOBILE_POSITION + device.getDeviceId(); RequestMessage msg = new RequestMessage(); @@ -143,17 +138,6 @@ msg.setData(mobilePosition); resultHolder.invokeAllResult(msg); - // 鍙戦�乺edis娑堟伅銆� 閫氱煡浣嶇疆淇℃伅鐨勫彉鍖� - JSONObject jsonObject = new JSONObject(); - jsonObject.put("time", DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime())); - jsonObject.put("serial", deviceChannel.getDeviceId()); - jsonObject.put("code", deviceChannel.getChannelId()); - jsonObject.put("longitude", mobilePosition.getLongitude()); - jsonObject.put("latitude", mobilePosition.getLatitude()); - jsonObject.put("altitude", mobilePosition.getAltitude()); - jsonObject.put("direction", mobilePosition.getDirection()); - jsonObject.put("speed", mobilePosition.getSpeed()); - redisCatchStorage.sendMobilePositionMsg(jsonObject); //鍥炲 200 OK try { responseAck(request, Response.OK); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java index 9de1ef2..70702bb 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java @@ -568,14 +568,14 @@ String ptzTypeFromInfo = XmlUtil.getText(info, "PTZType"); if(!ObjectUtils.isEmpty(ptzTypeFromInfo)){ try { - deviceChannel.setPTZType(Integer.parseInt(ptzTypeFromInfo)); + deviceChannel.setPtzType(Integer.parseInt(ptzTypeFromInfo)); }catch (NumberFormatException e){ logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁info涓幏鍙朠TZType澶辫触锛� {}", ptzTypeFromInfo); } } } else { try { - deviceChannel.setPTZType(Integer.parseInt(ptzType)); + deviceChannel.setPtzType(Integer.parseInt(ptzType)); }catch (NumberFormatException e){ logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁涓幏鍙朠TZType澶辫触锛� {}", ptzType); } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java index 72df8a0..5feb306 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java @@ -73,9 +73,6 @@ private AudioBroadcastManager audioBroadcastManager; @Autowired - private ZLMServerFactory zlmServerFactory; - - @Autowired private IPlayService playService; @Autowired @@ -124,9 +121,6 @@ private VideoStreamSessionManager sessionManager; @Autowired - private AssistRESTfulUtils assistRESTfulUtils; - - @Autowired private SSRCFactory ssrcFactory; @Qualifier("taskExecutor") @@ -147,7 +141,7 @@ taskExecutor.execute(() -> { List<ZlmHttpHookSubscribe.Event> subscribes = this.subscribe.getSubscribes(HookType.on_server_keepalive); - if (subscribes != null && subscribes.size() > 0) { + if (subscribes != null && !subscribes.isEmpty()) { for (ZlmHttpHookSubscribe.Event subscribe : subscribes) { subscribe.response(null, param); } @@ -166,7 +160,7 @@ @PostMapping(value = "/on_play", produces = "application/json;charset=UTF-8") public HookResult onPlay(@RequestBody OnPlayHookParam param) { if (logger.isDebugEnabled()) { - logger.debug("[ZLM HOOK] 鎾斁閴存潈锛歿}->{}" + param.getMediaServerId(), param); + logger.debug("[ZLM HOOK] 鎾斁閴存潈锛歿}->{}", param.getMediaServerId(), param); } String mediaServerId = param.getMediaServerId(); @@ -252,11 +246,7 @@ taskExecutor.execute(() -> { ZlmHttpHookSubscribe.Event subscribe = this.subscribe.sendNotify(HookType.on_publish, json); if (subscribe != null) { - if (mediaInfo != null) { - subscribe.response(mediaInfo, param); - } else { - new HookResultForOnPublish(1, "zlm not register"); - } + subscribe.response(mediaInfo, param); } }); @@ -579,9 +569,9 @@ } // 鏀跺埌鏃犱汉瑙傜湅璇存槑娴佷篃娌℃湁鍦ㄥ線涓婄骇鎺ㄩ�� if (redisCatchStorage.isChannelSendingRTP(inviteInfo.getChannelId())) { - List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByChnnelId( + List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByChannelId( inviteInfo.getChannelId()); - if (sendRtpItems.size() > 0) { + if (!sendRtpItems.isEmpty()) { for (SendRtpItem sendRtpItem : sendRtpItems) { ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(sendRtpItem.getPlatformId()); try { @@ -798,7 +788,7 @@ logger.info("[ZLM HOOK] zlm 鍚姩 " + zlmServerConfig.getGeneralMediaServerId()); taskExecutor.execute(() -> { List<ZlmHttpHookSubscribe.Event> subscribes = this.subscribe.getSubscribes(HookType.on_server_started); - if (subscribes != null && subscribes.size() > 0) { + if (subscribes != null && !subscribes.isEmpty()) { for (ZlmHttpHookSubscribe.Event subscribe : subscribes) { subscribe.response(null, zlmServerConfig); } @@ -847,12 +837,11 @@ */ @ResponseBody @PostMapping(value = "/on_rtp_server_timeout", produces = "application/json;charset=UTF-8") - public HookResult onRtpServerTimeout(HttpServletRequest request, @RequestBody OnRtpServerTimeoutHookParam + public HookResult onRtpServerTimeout(@RequestBody OnRtpServerTimeoutHookParam param) { logger.info("[ZLM HOOK] rtpServer鏀舵祦瓒呮椂锛歿}->{}({})", param.getMediaServerId(), param.getStream_id(), param.getSsrc()); taskExecutor.execute(() -> { - JSONObject json = (JSONObject) JSON.toJSON(param); List<ZlmHttpHookSubscribe.Event> subscribes = this.subscribe.getSubscribes(HookType.on_rtp_server_timeout); if (subscribes != null && !subscribes.isEmpty()) { for (ZlmHttpHookSubscribe.Event subscribe : subscribes) { diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java index 2422206..027e990 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java @@ -289,6 +289,10 @@ * 璋冪敤zlm RESTful API 鈥斺�� stopSendRtp */ public Boolean stopSendRtpStream(MediaServerItem mediaServerItem, Map<String, Object>param) { + if (mediaServerItem == null) { + logger.error("[鍋滄RTP鎺ㄦ祦] 澶辫触: 濯掍綋鑺傜偣涓篘ULL"); + return false; + } Boolean result = false; JSONObject jsonObject = zlmresTfulUtils.stopSendRtp(mediaServerItem, param); if (jsonObject == null) { diff --git a/src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java b/src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java index 5a20841..c690f11 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java +++ b/src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java @@ -2,6 +2,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; +import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo; import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; @@ -92,4 +93,9 @@ * 淇敼閫氶亾鐨勭爜娴佺被鍨� */ void updateChannelStreamIdentification(DeviceChannel channel); + + List<DeviceChannel> queryChaneListByDeviceId(String deviceId); + + void updateChannelGPS(Device device, DeviceChannel deviceChannel, MobilePosition mobilePosition); + } diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/GPSMsgInfo.java b/src/main/java/com/genersoft/iot/vmp/service/bean/GPSMsgInfo.java index b814c18..3b84420 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/bean/GPSMsgInfo.java +++ b/src/main/java/com/genersoft/iot/vmp/service/bean/GPSMsgInfo.java @@ -1,5 +1,8 @@ package com.genersoft.iot.vmp.service.bean; +import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; +import com.genersoft.iot.vmp.utils.DateUtil; + public class GPSMsgInfo { /** @@ -39,6 +42,18 @@ private boolean stored; + public static GPSMsgInfo getInstance(MobilePosition mobilePosition) { + GPSMsgInfo gpsMsgInfo = new GPSMsgInfo(); + gpsMsgInfo.setId(mobilePosition.getChannelId()); + gpsMsgInfo.setAltitude(mobilePosition.getAltitude() + ""); + gpsMsgInfo.setLng(mobilePosition.getLongitude()); + gpsMsgInfo.setLat(mobilePosition.getLatitude()); + gpsMsgInfo.setSpeed(mobilePosition.getSpeed()); + gpsMsgInfo.setDirection(mobilePosition.getDirection() + ""); + gpsMsgInfo.setTime(DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime())); + return gpsMsgInfo; + } + public String getId() { return id; diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/RequestStopPushStreamMsg.java b/src/main/java/com/genersoft/iot/vmp/service/bean/RequestStopPushStreamMsg.java new file mode 100755 index 0000000..fcba511 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/service/bean/RequestStopPushStreamMsg.java @@ -0,0 +1,49 @@ +package com.genersoft.iot.vmp.service.bean; + +import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; + + +public class RequestStopPushStreamMsg { + + + private SendRtpItem sendRtpItem; + + + private String platformName; + + + private int platFormIndex; + + public SendRtpItem getSendRtpItem() { + return sendRtpItem; + } + + public void setSendRtpItem(SendRtpItem sendRtpItem) { + this.sendRtpItem = sendRtpItem; + } + + public String getPlatformName() { + return platformName; + } + + public void setPlatformName(String platformName) { + this.platformName = platformName; + } + + + public int getPlatFormIndex() { + return platFormIndex; + } + + public void setPlatFormIndex(int platFormIndex) { + this.platFormIndex = platFormIndex; + } + + public static RequestStopPushStreamMsg getInstance(SendRtpItem sendRtpItem, String platformName, int platFormIndex) { + RequestStopPushStreamMsg streamMsg = new RequestStopPushStreamMsg(); + streamMsg.setSendRtpItem(sendRtpItem); + streamMsg.setPlatformName(platformName); + streamMsg.setPlatFormIndex(platFormIndex); + return streamMsg; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/WvpRedisMsgCmd.java b/src/main/java/com/genersoft/iot/vmp/service/bean/WvpRedisMsgCmd.java index cb11886..e9ee4cb 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/bean/WvpRedisMsgCmd.java +++ b/src/main/java/com/genersoft/iot/vmp/service/bean/WvpRedisMsgCmd.java @@ -6,7 +6,17 @@ public class WvpRedisMsgCmd { + /** + * 璇锋眰鑾峰彇鎺ㄦ祦淇℃伅 + */ public static final String GET_SEND_ITEM = "GetSendItem"; + /** + * 璇锋眰鎺ㄦ祦鐨勮姹� + */ public static final String REQUEST_PUSH_STREAM = "RequestPushStream"; + /** + * 鍋滄鎺ㄦ祦鐨勮姹� + */ + public static final String REQUEST_STOP_PUSH_STREAM = "RequestStopPushStream"; } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java index 55fa5e9..632be91 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java @@ -1,16 +1,21 @@ package com.genersoft.iot.vmp.service.impl; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.dynamic.datasource.annotation.DS; import com.genersoft.iot.vmp.common.InviteInfo; import com.genersoft.iot.vmp.common.InviteSessionType; +import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; +import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; +import com.genersoft.iot.vmp.gb28181.event.EventPublisher; import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; import com.genersoft.iot.vmp.service.IDeviceChannelService; import com.genersoft.iot.vmp.service.IInviteStreamService; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; import com.genersoft.iot.vmp.storager.dao.DeviceMapper; +import com.genersoft.iot.vmp.storager.dao.DeviceMobilePositionMapper; import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo; import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; @@ -35,7 +40,7 @@ private final static Logger logger = LoggerFactory.getLogger(DeviceChannelServiceImpl.class); @Autowired - private IRedisCatchStorage redisCatchStorage; + private EventPublisher eventPublisher; @Autowired private IInviteStreamService inviteStreamService; @@ -45,6 +50,15 @@ @Autowired private DeviceMapper deviceMapper; + + @Autowired + private DeviceMobilePositionMapper deviceMobilePositionMapper; + + @Autowired + private UserSetting userSetting; + + @Autowired + private IRedisCatchStorage redisCatchStorage; @Override public DeviceChannel updateGps(DeviceChannel deviceChannel, Device device) { @@ -84,7 +98,6 @@ public void updateChannel(String deviceId, DeviceChannel channel) { String channelId = channel.getChannelId(); channel.setDeviceId(deviceId); -// StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channelId); InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceId, channelId); if (inviteInfo != null && inviteInfo.getStreamInfo() != null) { channel.setStreamId(inviteInfo.getStreamInfo().getStream()); @@ -280,4 +293,64 @@ } channelMapper.updateChannelStreamIdentification(channel); } + + @Override + public List<DeviceChannel> queryChaneListByDeviceId(String deviceId) { + return channelMapper.queryAllChannels(deviceId); + } + + @Override + public void updateChannelGPS(Device device, DeviceChannel deviceChannel, MobilePosition mobilePosition) { + if (userSetting.getSavePositionHistory()) { + deviceMobilePositionMapper.insertNewPosition(mobilePosition); + } + + if (deviceChannel.getChannelId().equals(deviceChannel.getDeviceId())) { + deviceChannel.setChannelId(null); + } + if (deviceChannel.getGpsTime() == null) { + deviceChannel.setGpsTime(DateUtil.getNow()); + } + + int updated = channelMapper.updatePosition(deviceChannel); + if (updated == 0) { + return; + } + + List<DeviceChannel> deviceChannels = new ArrayList<>(); + if (deviceChannel.getChannelId() == null) { + // 鏈夌殑璁惧杩欓噷涓婃姤鐨刣eviceId涓庨�氶亾Id鏄竴鏍凤紝杩欑鎯呭喌鏇存柊璁惧涓嬬殑鍏ㄩ儴閫氶亾 + List<DeviceChannel> deviceChannelsInDb = queryChaneListByDeviceId(device.getDeviceId()); + deviceChannels.addAll(deviceChannelsInDb); + }else { + deviceChannels.add(deviceChannel); + } + if (deviceChannels.isEmpty()) { + return; + } + if (deviceChannels.size() > 100) { + logger.warn("[鏇存柊閫氶亾浣嶇疆淇℃伅鍚庡彂閫侀�氱煡] 璁惧鍙兘鏄钩鍙帮紝涓婃姤鐨勪綅缃俊鎭湭鏍囨槑閫氶亾缂栧彿锛�" + + "瀵艰嚧鎵�鏈夐�氶亾琚洿鏂颁綅缃紝 deviceId:{}", device.getDeviceId()); + } + for (DeviceChannel channel : deviceChannels) { + // 鍚戝叧鑱斾簡璇ラ�氶亾骞朵笖寮�鍚Щ鍔ㄤ綅缃闃呯殑涓婄骇骞冲彴鍙戦�佺Щ鍔ㄤ綅缃闃呮秷鎭� + mobilePosition.setChannelId(channel.getChannelId()); + try { + eventPublisher.mobilePositionEventPublish(mobilePosition); + }catch (Exception e) { + logger.error("[鍚戜笂绾ц浆鍙戠Щ鍔ㄤ綅缃け璐 ", e); + } + // 鍙戦�乺edis娑堟伅銆� 閫氱煡浣嶇疆淇℃伅鐨勫彉鍖� + JSONObject jsonObject = new JSONObject(); + jsonObject.put("time", DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime())); + jsonObject.put("serial", mobilePosition.getDeviceId()); + jsonObject.put("code", mobilePosition.getChannelId()); + jsonObject.put("longitude", mobilePosition.getLongitude()); + jsonObject.put("latitude", mobilePosition.getLatitude()); + jsonObject.put("altitude", mobilePosition.getAltitude()); + jsonObject.put("direction", mobilePosition.getDirection()); + jsonObject.put("speed", mobilePosition.getSpeed()); + redisCatchStorage.sendMobilePositionMsg(jsonObject); + } + } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java index 1dc7db4..2c2674f 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java @@ -269,6 +269,8 @@ int subscribeCycleForCatalog = Math.max(device.getSubscribeCycleForCatalog(),30); // 璁剧疆鏈�灏忓�间负30 dynamicTask.startCron(device.getDeviceId() + "catalog", catalogSubscribeTask, (subscribeCycleForCatalog -1) * 1000); + + catalogSubscribeTask.run(); return true; } @@ -302,6 +304,7 @@ int subscribeCycleForCatalog = Math.max(device.getSubscribeCycleForMobilePosition(),30); // 鍒锋柊璁㈤槄 dynamicTask.startCron(device.getDeviceId() + "mobile_position" , mobilePositionSubscribeTask, subscribeCycleForCatalog * 1000); + mobilePositionSubscribeTask.run(); return true; } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index 0df0d4d..c8d203f 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -1409,6 +1409,14 @@ logger.info("璋冪敤ZLM鎺ㄦ祦鎺ュ彛, 缁撴灉锛� {}", jsonObject); logger.info("RTP鎺ㄦ祦鎴愬姛[ {}/{} ]锛寋}->{}, ", param.get("app"), param.get("stream"), jsonObject.getString("local_port"), sendRtpItem.isTcpActive()?"琚姩鍙戞祦": param.get("dst_url") + ":" + param.get("dst_port")); + if (sendRtpItem.getPlayType() == InviteStreamType.PUSH && correlationInfo instanceof ParentPlatform) { + ParentPlatform platform = (ParentPlatform)correlationInfo; + MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, sendRtpItem.getApp(), sendRtpItem.getStream(), + sendRtpItem.getChannelId(), platform.getServerGBId(), platform.getName(), userSetting.getServerId(), + sendRtpItem.getMediaServerId()); + messageForPushChannel.setPlatFormIndex(platform.getId()); + redisCatchStorage.sendPlatformStartPlayMsg(messageForPushChannel); + } } else { logger.error("RTP鎺ㄦ祦澶辫触: {}, 鍙傛暟锛歿}", jsonObject.getString("msg"), JSONObject.toJSONString(param)); if (sendRtpItem.isOnlyAudio()) { diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java index eb261e3..3b990f0 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java +++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java @@ -133,7 +133,10 @@ case WvpRedisMsgCmd.REQUEST_PUSH_STREAM: RequestPushStreamMsg param = JSON.to(RequestPushStreamMsg.class, wvpRedisMsg.getContent()); requestPushStreamMsgHand(param, wvpRedisMsg.getFromId(), wvpRedisMsg.getSerial()); - + break; + case WvpRedisMsgCmd.REQUEST_STOP_PUSH_STREAM: + RequestStopPushStreamMsg streamMsg = JSON.to(RequestStopPushStreamMsg.class, wvpRedisMsg.getContent()); + requestStopPushStreamMsgHand(streamMsg, wvpRedisMsg.getFromId(), wvpRedisMsg.getSerial()); break; default: break; @@ -397,6 +400,19 @@ redisTemplate.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); } + /** + * 鍙戦�佽姹傛帹娴佺殑娑堟伅 + */ + public void sendMsgForStopSendRtpStream(String serverId, RequestStopPushStreamMsg streamMsg) { + String key = UUID.randomUUID().toString(); + WvpRedisMsg redisMsg = WvpRedisMsg.getRequestInstance(userSetting.getServerId(), serverId, + WvpRedisMsgCmd.REQUEST_STOP_PUSH_STREAM, key, JSON.toJSONString(streamMsg)); + + JSONObject jsonObject = (JSONObject)JSON.toJSON(redisMsg); + logger.info("[REDIS 璇锋眰鍏朵粬骞冲彴鍋滄鎺ㄦ祦] {}: {}", serverId, jsonObject); + redisTemplate.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); + } + private SendRtpItem querySendRTPServer(String platformGbId, String channelId, String streamId, String callId) { if (platformGbId == null) { platformGbId = "*"; @@ -423,4 +439,36 @@ return null; } } + + /** + * 澶勭悊鏀跺埌鐨勮姹傛帹娴佺殑璇锋眰 + */ + private void requestStopPushStreamMsgHand(RequestStopPushStreamMsg streamMsg, String fromId, String serial) { + SendRtpItem sendRtpItem = streamMsg.getSendRtpItem(); + if (sendRtpItem == null) { + logger.info("[REDIS 鎵ц鍏朵粬骞冲彴鐨勮姹傚仠姝㈡帹娴乚 澶辫触锛� sendRtpItem涓篘ULL"); + return; + } + MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); + if (mediaInfo == null) { + // TODO 鍥炲閿欒 + return; + } + Map<String, Object> param = new HashMap<>(); + param.put("vhost","__defaultVhost__"); + param.put("app",sendRtpItem.getApp()); + param.put("stream",sendRtpItem.getStream()); + param.put("ssrc", sendRtpItem.getSsrc()); + + if (zlmServerFactory.stopSendRtpStream(mediaInfo, param)) { + logger.info("[REDIS 鎵ц鍏朵粬骞冲彴鐨勮姹傚仠姝㈡帹娴乚 鎴愬姛锛� {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream()); + // 鍙戦�乺edis娑堟伅 + MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, + sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getChannelId(), + sendRtpItem.getPlatformId(), streamMsg.getPlatformName(), userSetting.getServerId(), sendRtpItem.getMediaServerId()); + messageForPushChannel.setPlatFormIndex(streamMsg.getPlatFormIndex()); + redisCatchStorage.sendPlatformStopPlayMsg(messageForPushChannel); + } + + } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java index 1d7c2fd..fe0ccd2 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java +++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java @@ -73,7 +73,7 @@ MessageForPushChannel pushChannel = JSON.parseObject(message.getBody(), MessageForPushChannel.class); StreamPushItem push = streamPushService.getPush(pushChannel.getApp(), pushChannel.getStream()); if (push != null) { - List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByChnnelId( + List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByChannelId( push.getGbId()); if (!sendRtpItems.isEmpty()) { for (SendRtpItem sendRtpItem : sendRtpItems) { diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusListMsgListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusListMsgListener.java index 65239c8..dc342b0 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusListMsgListener.java +++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusListMsgListener.java @@ -88,7 +88,8 @@ streamPushItemForSave.add(streamPushItem); allGBId.put(streamPushItem.getGbId(), streamPushItem); } else { - if (allGBId.containsKey(streamPushItem.getGbId())) { + if (allGBId.containsKey(streamPushItem.getGbId()) + && (!allGBId.get(streamPushItem.getGbId()).getApp().equals(streamPushItem.getApp()) || !allGBId.get(streamPushItem.getGbId()).getStream().equals(streamPushItem.getStream()))) { GbStream gbStream = allGBId.get(streamPushItem.getGbId()); logger.warn("[REDIS娑堟伅-鎺ㄦ祦璁惧鍒楄〃鏇存柊-UPDATE] 鍥芥爣缂栧彿閲嶅: {}, 宸插垎閰嶇粰{}/{}", streamPushItem.getGbId(), gbStream.getApp(), gbStream.getStream()); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java b/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java index b663c5c..78fd280 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java @@ -181,7 +181,7 @@ */ void sendStreamPushRequestedMsgForStatus(); - List<SendRtpItem> querySendRTPServerByChnnelId(String channelId); + List<SendRtpItem> querySendRTPServerByChannelId(String channelId); List<SendRtpItem> querySendRTPServerByStream(String stream); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java index e823c6e..c03d73a 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java @@ -23,7 +23,7 @@ "longitude_wgs84, latitude_wgs84, has_audio, create_time, update_time, business_group_id, gps_time, stream_identification) " + "VALUES (#{channelId}, #{deviceId}, #{name}, #{manufacture}, #{model}, #{owner}, #{civilCode}, #{block}," + "#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{secrecy}, " + - "#{ipAddress}, #{port}, #{password}, #{PTZType}, #{status}, #{streamId}, #{longitude}, #{latitude}, #{longitudeGcj02}, " + + "#{ipAddress}, #{port}, #{password}, #{ptzType}, #{status}, #{streamId}, #{longitude}, #{latitude}, #{longitudeGcj02}, " + "#{latitudeGcj02}, #{longitudeWgs84}, #{latitudeWgs84}, #{hasAudio}, #{createTime}, #{updateTime}, #{businessGroupId}, #{gpsTime}, #{streamIdentification})") int add(DeviceChannel channel); @@ -48,7 +48,7 @@ "<if test='ipAddress != null'>, ip_address=#{ipAddress}</if>" + "<if test='port != null'>, port=#{port}</if>" + "<if test='password != null'>, password=#{password}</if>" + - "<if test='PTZType != null'>, custom_ptz_type=#{PTZType}</if>" + + "<if test='ptzType != null'>, custom_ptz_type=#{ptzType}</if>" + "<if test='status != null'>, status=#{status}</if>" + "<if test='streamId != null'>, stream_id=#{streamId}</if>" + "<if test='hasAudio != null'>, has_audio=#{hasAudio}</if>" + @@ -250,7 +250,7 @@ "#{item.owner}, #{item.civilCode}, #{item.block},#{item.subCount}," + "#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, " + "#{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.secrecy}, " + - "#{item.ipAddress}, #{item.port}, #{item.password}, #{item.PTZType}, #{item.status}, " + + "#{item.ipAddress}, #{item.port}, #{item.password}, #{item.ptzType}, #{item.status}, " + "#{item.streamId}, #{item.longitude}, #{item.latitude},#{item.longitudeGcj02}, " + "#{item.latitudeGcj02},#{item.longitudeWgs84}, #{item.latitudeWgs84}, #{item.hasAudio}, now(), now(), " + "#{item.businessGroupId}, #{item.gpsTime}, #{item.streamIdentification}) " + @@ -271,7 +271,7 @@ "#{item.owner}, #{item.civilCode}, #{item.block},#{item.subCount}," + "#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, " + "#{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.secrecy}, " + - "#{item.ipAddress}, #{item.port}, #{item.password}, #{item.PTZType}, #{item.status}, " + + "#{item.ipAddress}, #{item.port}, #{item.password}, #{item.ptzType}, #{item.status}, " + "#{item.streamId}, #{item.longitude}, #{item.latitude},#{item.longitudeGcj02}, " + "#{item.latitudeGcj02},#{item.longitudeWgs84}, #{item.latitudeWgs84}, #{item.hasAudio}, now(), now(), " + "#{item.businessGroupId}, #{item.gpsTime}) " + @@ -339,7 +339,7 @@ "<if test='item.ipAddress != null'>, ip_address=#{item.ipAddress}</if>" + "<if test='item.port != null'>, port=#{item.port}</if>" + "<if test='item.password != null'>, password=#{item.password}</if>" + - "<if test='item.PTZType != null'>, ptz_type=#{item.PTZType}</if>" + + "<if test='item.ptzType != null'>, ptz_type=#{item.ptzType}</if>" + "<if test='item.status != null'>, status=#{item.status}</if>" + "<if test='item.streamId != null'>, stream_id=#{item.streamId}</if>" + "<if test='item.hasAudio != null'>, has_audio=#{item.hasAudio}</if>" + @@ -395,7 +395,7 @@ "WHERE device_id=#{deviceId} " + " <if test='channelId != null' > AND channel_id=#{channelId}</if>" + " </script>"}) - void updatePosition(DeviceChannel deviceChannel); + int updatePosition(DeviceChannel deviceChannel); @Select("SELECT * FROM wvp_device_channel WHERE length(trim(stream_id)) > 0") List<DeviceChannel> getAllChannelInPlay(); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java index 42d2b7a..f41bf72 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java @@ -269,7 +269,7 @@ "charset,"+ "ssrc_check,"+ "as_message_channel,"+ - "broadcastPushAfterAck,"+ + "broadcast_push_after_ack,"+ "geo_coord_sys,"+ "on_line,"+ "media_server_id"+ diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java index 27bbdba..18a037d 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java @@ -184,7 +184,7 @@ } @Override - public List<SendRtpItem> querySendRTPServerByChnnelId(String channelId) { + public List<SendRtpItem> querySendRTPServerByChannelId(String channelId) { if (channelId == null) { return null; } diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java index 85f516a..2f5a589 100755 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java @@ -13,7 +13,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; -import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; +import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import io.swagger.v3.oas.annotations.Operation; @@ -45,7 +45,7 @@ private IVideoManagerStorage storager; @Autowired - private SIPCommander cmder; + private ISIPCommander cmder; @Autowired private DeferredResultHolder resultHolder; @@ -254,15 +254,13 @@ @Operation(summary = "鐪嬪畧浣嶆帶鍒�", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true) @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true) - @Parameter(name = "enabled", description = "鏄惁寮�鍚湅瀹堜綅 1:寮�鍚�,0:鍏抽棴", required = true) + @Parameter(name = "enabled", description = "鏄惁寮�鍚湅瀹堜綅", required = true) @Parameter(name = "presetIndex", description = "璋冪敤棰勭疆浣嶇紪鍙�") - @Parameter(name = "resetTime", description = "鑷姩褰掍綅鏃堕棿闂撮殧") - @GetMapping("/home_position/{deviceId}/{enabled}") - public DeferredResult<String> homePositionApi(@PathVariable String deviceId, - @PathVariable String enabled, - @RequestParam(required = false) String resetTime, - @RequestParam(required = false) String presetIndex, - String channelId) { + @Parameter(name = "resetTime", description = "鑷姩褰掍綅鏃堕棿闂撮殧 鍗曚綅锛氱") + @GetMapping("/home_position") + public DeferredResult<String> homePositionApi(String deviceId, String channelId, Boolean enabled, + @RequestParam(required = false) Integer resetTime, + @RequestParam(required = false) Integer presetIndex) { if (logger.isDebugEnabled()) { logger.debug("鎶ヨ澶嶄綅API璋冪敤"); } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 558bd14..ddbf237 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -114,5 +114,5 @@ device-status-notify: true # [鍙�塢 鏃ュ織閰嶇疆, 涓�鑸笉闇�瑕佹敼 logging: - config: classpath:logback-spring-local.xml + config: classpath:logback-spring.xml diff --git a/web_src/src/components/channelList.vue b/web_src/src/components/channelList.vue index 24f4946..02e92e7 100755 --- a/web_src/src/components/channelList.vue +++ b/web_src/src/components/channelList.vue @@ -100,9 +100,9 @@ <span v-show="!scope.row.edit">{{ scope.row.location }}</span> </template> </el-table-column> - <el-table-column prop="ptztype" label="浜戝彴绫诲瀷" min-width="100"> + <el-table-column prop="ptzType" label="浜戝彴绫诲瀷" min-width="100"> <template v-slot:default="scope"> - <el-select v-show="scope.row.edit" v-model="scope.row.ptztype" + <el-select v-show="scope.row.edit" v-model="scope.row.ptzType" placeholder="浜戝彴绫诲瀷" filterable> <el-option v-for="(value, key) in ptzTypes" @@ -111,7 +111,7 @@ :value="key" /> </el-select> - <div v-show="!scope.row.edit">{{ scope.row.ptztypeText }}</div> + <div v-show="!scope.row.edit">{{ scope.row.ptzTypeText }}</div> </template> </el-table-column> <el-table-column label="寮�鍚煶棰�" min-width="100"> @@ -178,13 +178,24 @@ @click="changeSubchannel(scope.row)">鏌ョ湅 </el-button> <el-divider v-if="scope.row.subCount > 0 || scope.row.parental === 1" direction="vertical"></el-divider> - <el-button size="medium" v-bind:disabled="device == null || device.online === 0" - icon="el-icon-video-camera" - type="text" @click="queryRecords(scope.row)">璁惧褰曞儚 - </el-button> - <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-cloudy" - type="text" @click="queryCloudRecords(scope.row)">浜戠褰曞儚 - </el-button> +<!-- <el-button size="medium" v-bind:disabled="device == null || device.online === 0"--> +<!-- icon="el-icon-video-camera"--> +<!-- type="text" @click="queryRecords(scope.row)">璁惧褰曞儚--> +<!-- </el-button>--> +<!-- <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-cloudy"--> +<!-- type="text" @click="queryCloudRecords(scope.row)">浜戠褰曞儚--> +<!-- </el-button>--> + <el-dropdown @command="(command)=>{moreClick(command, scope.row)}"> + <el-button size="medium" type="text" > + 鏇村鍔熻兘<i class="el-icon-arrow-down el-icon--right"></i> + </el-button> + <el-dropdown-menu slot="dropdown"> + <el-dropdown-item command="records" v-bind:disabled="device == null || device.online === 0"> + 璁惧褰曞儚</el-dropdown-item> + <el-dropdown-item command="cloudRecords" v-bind:disabled="device == null || device.online === 0" > + 浜戠褰曞儚</el-dropdown-item> + </el-dropdown-menu> + </el-dropdown> </template> </el-table-column> </el-table> @@ -312,7 +323,7 @@ that.total = res.data.data.total; that.deviceChannelList = res.data.data.list; that.deviceChannelList.forEach(e => { - e.ptztype = e.ptztype + ""; + e.ptzType = e.ptzType + ""; that.$set(e, "edit", false); that.$set(e, "location", ""); if (e.longitude && e.latitude) { @@ -371,6 +382,13 @@ that.isLoging = false; // that.$message.error("璇锋眰瓒呮椂"); }); + }, + moreClick: function (command, itemData) { + if (command === "records") { + this.queryRecords(itemData) + }else if (command === "cloudRecords") { + this.queryCloudRecords(itemData) + } }, queryRecords: function (itemData) { let deviceId = this.deviceId; @@ -460,7 +478,7 @@ this.total = res.data.data.total; this.deviceChannelList = res.data.data.list; this.deviceChannelList.forEach(e => { - e.ptztype = e.ptztype + ""; + e.ptzType = e.ptzType + ""; this.$set(e, "edit", false); this.$set(e, "location", ""); if (e.longitude && e.latitude) { diff --git a/web_src/src/components/common/DeviceTree.vue b/web_src/src/components/common/DeviceTree.vue index c701bf0..6030dc8 100755 --- a/web_src/src/components/common/DeviceTree.vue +++ b/web_src/src/components/common/DeviceTree.vue @@ -131,11 +131,11 @@ type = 2; } console.log(type) - if (item.basicData.ptztype === 1 ) { // 1-鐞冩満;2-鍗婄悆;3-鍥哄畾鏋満;4-閬ユ帶鏋満 + if (item.basicData.ptzType === 1 ) { // 1-鐞冩満;2-鍗婄悆;3-鍥哄畾鏋満;4-閬ユ帶鏋満 type = 4; - }else if (item.basicData.ptztype === 2) { + }else if (item.basicData.ptzType === 2) { type = 5; - }else if (item.basicData.ptztype === 3 || item.basicData.ptztype === 4) { + }else if (item.basicData.ptzType === 3 || item.basicData.ptzType === 4) { type = 6; } }else { diff --git a/web_src/src/components/dialog/channelMapInfobox.vue b/web_src/src/components/dialog/channelMapInfobox.vue index 2ef0e52..fa7ae5c 100755 --- a/web_src/src/components/dialog/channelMapInfobox.vue +++ b/web_src/src/components/dialog/channelMapInfobox.vue @@ -7,7 +7,7 @@ <el-descriptions-item label="璁惧褰掑睘" >{{channel.owner}}</el-descriptions-item> <el-descriptions-item label="琛屾斂鍖哄煙" >{{channel.civilCode}}</el-descriptions-item> <el-descriptions-item label="瀹夎鍦板潃" >{{channel.address}}</el-descriptions-item> - <el-descriptions-item label="浜戝彴绫诲瀷" >{{channel.ptztypeText}}</el-descriptions-item> + <el-descriptions-item label="浜戝彴绫诲瀷" >{{channel.ptzTypeText}}</el-descriptions-item> <el-descriptions-item label="缁忕含搴�" >{{channel.longitude}},{{channel.latitude}}</el-descriptions-item> <el-descriptions-item label="鐘舵��"> <el-tag size="small" v-if="channel.status === 1">鍦ㄧ嚎</el-tag> diff --git a/web_src/src/components/dialog/rtcPlayer.vue b/web_src/src/components/dialog/rtcPlayer.vue index f957df7..34fa35a 100755 --- a/web_src/src/components/dialog/rtcPlayer.vue +++ b/web_src/src/components/dialog/rtcPlayer.vue @@ -41,8 +41,8 @@ zlmsdpUrl: url,//娴佸湴鍧� simulecast: false, useCamera: false, - audioEnable: false, - videoEnable: false, + audioEnable: true, + videoEnable: true, recvOnly: true, }) webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ICE_CANDIDATE_ERROR,(e)=>{// ICE 鍗忓晢鍑洪敊 diff --git a/web_src/src/components/map.vue b/web_src/src/components/map.vue index 248426c..64ae0e2 100755 --- a/web_src/src/components/map.vue +++ b/web_src/src/components/map.vue @@ -243,7 +243,7 @@ }, getImageByChannel: function (channel) { let src = "static/images/gis/camera.png" - switch (channel.ptztype) { + switch (channel.ptzType) { case 1: if (channel.status === 1) { src = "static/images/gis/camera1.png" -- Gitblit v1.8.0