From 88350873ee7632924cb135a450fef9f4d05c5306 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期一, 11 九月 2023 11:21:50 +0800 Subject: [PATCH] Merge branch 'wvp-28181-2.0' into main-dev --- src/main/java/com/genersoft/iot/vmp/utils/GpsUtil.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceConfig.java | 0 web_src/src/components/service/MediaServer.js | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/conf/StackLoggerImpl.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/StreamContent.java | 0 src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java | 16 web_src/src/components/console/ConsoleDisk.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/timeout/ITimeoutProcessor.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/InviteResponseProcessor.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageRequestProcessor.java | 0 src/main/java/com/genersoft/iot/vmp/service/IPlatformService.java | 0 web_src/src/components/setting/Web.vue | 0 web_src/src/components/dialog/importChannelShowErrorData.vue | 0 web_src/src/layout/index.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeTask.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/SipTransactionInfo.java | 0 src/main/java/com/genersoft/iot/vmp/service/bean/MessageForPushChannelResponse.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeHandlerTask.java | 0 src/main/java/com/genersoft/iot/vmp/service/bean/PlayBackCallback.java | 0 src/main/resources/application-dev.yml | 24 src/main/java/com/genersoft/iot/vmp/gb28181/bean/SipMsgInfo.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/ErrorCode.java | 0 src/main/java/com/genersoft/iot/vmp/service/IPlayService.java | 0 src/main/java/com/genersoft/iot/vmp/utils/UJson.java | 0 src/main/java/com/genersoft/iot/vmp/service/bean/SSRCInfo.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/event/device/RequestTimeoutEventImpl.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForCatalogProcessor.java | 0 src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java | 4 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnRtpServerTimeoutHookParam.java | 0 src/main/java/com/genersoft/iot/vmp/service/bean/WvpRedisMsg.java | 0 src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/DeviceInfoQueryMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/service/bean/StreamPushItemFromRedis.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/timeout/impl/TimeoutProcessorImpl.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java | 0 web_src/src/components/dialog/chooseChannelForStream.vue | 0 src/main/java/com/genersoft/iot/vmp/service/IDeviceService.java | 0 src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java | 0 src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java | 25 web_src/src/components/dialog/queryTrace.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/AlarmResponseMessageHandler.java | 0 web_src/src/components/console/ConsoleMediaServer.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageHandlerAbstract.java | 12 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/NotifyMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/service/IDeviceAlarmService.java | 0 src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java | 0 web_src/src/components/dialog/changePasswordForAdmin.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/event/record/RecordEndEventListener.java | 0 web_src/src/components/console.vue | 0 web_src/src/components/service/DeviceService.js | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/SendRtpItem.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/BroadcastResponseMessageHandler.java | 0 web_src/src/components/console/ConsoleResource.vue | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java | 0 web_src/src/components/common/DeviceTreeForZtree.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java | 11 web_src/src/components/dialog/MediaServerEdit.vue | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/BatchGBStreamParam.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/SIPRequestProcessorParent.java | 0 src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamAuthorityInfo.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/ByeResponseProcessor.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookType.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/bean/GbStreamParam.java | 0 web_src/src/components/UserManager.vue | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/WVPResult.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java | 0 web_src/src/components/ParentPlatformList.vue | 0 src/main/java/com/genersoft/iot/vmp/service/bean/MediaServerLoad.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/user/RoleController.java | 0 web_src/src/assets/icons.png | 0 web_src/src/assets/zlm-log.png | 0 web_src/src/components/dialog/configInfo.vue | 0 src/main/java/com/genersoft/iot/vmp/utils/GitUtil.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java | 282 +- src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java | 10 src/main/java/com/genersoft/iot/vmp/service/bean/GPSMsgInfo.java | 0 web_src/src/components/dialog/recordDownload.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java | 0 src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil2.java | 0 src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java | 0 src/main/java/com/genersoft/iot/vmp/service/impl/RoleServerImpl.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/IMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/StreamPushExcelDto.java | 0 src/main/resources/application.yml | 2 web_src/src/components/dialog/changePushKey.vue | 0 web_src/src/components/dialog/rtcPlayer.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/CatalogSubscribeTask.java | 0 src/main/java/com/genersoft/iot/vmp/service/bean/InviteTimeOutCallback.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/SystemConfigInfo.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMStatusEventListener.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java | 12 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java | 1 src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGpsMsgListener.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java | 6 src/main/java/com/genersoft/iot/vmp/gb28181/bean/MobilePosition.java | 0 web_src/src/components/common/ h265web.vue | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/HookParam.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java | 0 web_src/src/components/Login.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/event/record/RecordEndEvent.java | 0 web_src/src/components/common/MapComponent.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/control/cmd/DeviceControlQueryMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/UpdateChannelParam.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/RecordFile.java | 53 src/main/java/com/genersoft/iot/vmp/service/bean/PushStreamStatusChangeFromRedisDto.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java | 0 src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java | 0 web_src/src/components/setting/Sip.vue | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnSendRtpStoppedHookParam.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/dto/User.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/SDPInfo.java | 0 web_src/src/components/live.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/info/InfoRequestProcessor.java | 298 +- src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java | 0 web_src/src/components/dialog/onvifEdit.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/CancelRequestProcessor.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceStatusResponseMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/OtherPsSendInfo.java | 137 + src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordInfo.java | 204 src/main/java/com/genersoft/iot/vmp/service/bean/RequestPushStreamMsg.java | 0 src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java | 352 +- src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnPublishHookParam.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java | 12 src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java | 278 +- src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java | 0 src/main/java/com/genersoft/iot/vmp/service/bean/RequestSendItemMsg.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMEventAbstract.java | 0 web_src/src/router/index.js | 11 src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/control/ControlMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeFactory.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/ZLMRunInfo.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/record/RecordController.java | 0 src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/OtherRtpSendInfo.java | 0 src/main/java/com/genersoft/iot/vmp/conf/CivilCodeFileConf.java | 5 src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeInfo.java | 0 web_src/src/App.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/conf/ServerLoggerImpl.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/PageInfo.java | 99 web_src/src/assets/loading.png | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/HomePositionRequest.java | 0 web_src/src/components/PushVideoList.vue | 6 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/RecordInfoResponseMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusListMsgListener.java | 0 web_src/src/components/console/ConsoleMEM.vue | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java | 22 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/HookResultForOnPublish.java | 0 src/main/java/com/genersoft/iot/vmp/service/IPlatformChannelService.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/ps/PsController.java | 322 ++ web_src/src/components/dialog/devicePlayer.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/SIPResponseProcessorAbstract.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/dto/ChannelSourceInfo.java | 0 web_src/src/components/MediaServerManger.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/InviteStreamInfo.java | 0 src/main/java/com/genersoft/iot/vmp/service/impl/DeviceAlarmServiceImpl.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OriginType.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/SendRtpPortManager.java | 42 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java | 288 +- src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java | 1292 +++++----- src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java | 0 web_src/src/components/dialog/changePassword.vue | 0 src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamResponseListener.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStringMsgParserFactory.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/ZlmHttpHookSubscribe.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/DeferredResultFilter.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java | 0 src/main/resources/all-application.yml | 2 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/DeviceStatusQueryMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java | 0 web_src/src/components/channelList.vue | 9 web_src/src/components/dialog/channelMapInfobox.vue | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMOnlineEvent.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/PlayTypeEnum.java | 0 src/main/java/com/genersoft/iot/vmp/utils/SpringBeanFactory.java | 100 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/IHookSubscribe.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java | 2 src/main/java/com/genersoft/iot/vmp/gb28181/event/device/RequestTimeoutEvent.java | 0 src/main/java/com/genersoft/iot/vmp/service/bean/ErrorCallback.java | 0 src/main/java/com/genersoft/iot/vmp/conf/security/JwtUtils.java | 87 src/main/java/com/genersoft/iot/vmp/gb28181/session/RecordDataCatch.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMOfflineEvent.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java | 2 web_src/src/components/dialog/chooseChannelForCatalog.vue | 0 web_src/src/components/dialog/pushStreamEdit.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java | 0 src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisAlarmMsgListener.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceBaseInfo.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java | 236 +- src/main/java/com/genersoft/iot/vmp/utils/redis/FastJsonRedisSerializer.java | 90 web_src/src/components/dialog/SyncChannelProgress.vue | 0 web_src/src/assets/login-cloud.png | 0 web_src/src/components/GBRecordDetail.vue | 0 src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java | 0 src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java | 10 src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java | 107 web_src/src/components/dialog/StreamProxyEdit.vue | 0 src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java | 5 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/ChannelOnlineEvent.java | 0 web_src/src/components/DeviceList.vue | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/SnapPath.java | 0 web_src/src/components/dialog/platformEdit.vue | 0 src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java | 0 web_src/src/components/setting/Media.vue | 0 src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusMsgListener.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEvent.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/InviteStreamCallback.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/PresetQuerySipReq.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java | 15 src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java | 93 src/main/java/com/genersoft/iot/vmp/vmanager/cloudRecord/CloudRecordController.java | 145 + web_src/src/assets/login-bg.jpg | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformRegister.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/dto/Role.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/dto/PlatformRegisterInfo.java | 0 src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/QueryMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/RecordInfoQueryMessageHandler.java | 0 web_src/src/assets/play.png | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/service/IRoleService.java | 0 web_src/src/components/common/DeviceTree.vue | 0 src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java | 0 src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceControlResponseMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeForStreamChange.java | 0 src/main/java/com/genersoft/iot/vmp/service/impl/UserServiceImpl.java | 0 src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisCloseStreamMsgListener.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceInfo.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/BaseTree.java | 0 src/main/java/com/genersoft/iot/vmp/service/bean/WvpRedisMsgCmd.java | 0 web_src/src/components/dialog/deviceEdit.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceConfigResponseMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/service/impl/LogServiceImpl.java | 0 web_src/src/components/GeoConvertTools.js | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnStreamNotFoundHookParam.java | 0 src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/InviteStreamType.java | 0 src/main/java/com/genersoft/iot/vmp/service/bean/MessageForPushChannel.java | 0 web_src/src/components/CloudRecordDetail.vue | 165 + web_src/src/components/console/ConsoleCPU.vue | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/HookResult.java | 0 src/main/java/com/genersoft/iot/vmp/service/bean/PlayBackResult.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnStreamNoneReaderHookParam.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/event/SipSubscribe.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/ISIPResponseProcessor.java | 0 src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java | 126 web_src/src/components/service/UserService.js | 0 web_src/src/assets/logo.png | 0 src/main/java/com/genersoft/iot/vmp/service/IInviteStreamService.java | 0 src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java | 11 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/DeferredResultHolder.java | 320 +- src/main/java/com/genersoft/iot/vmp/gb28181/task/ISubscribeTask.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java | 10 src/main/java/com/genersoft/iot/vmp/utils/SystemInfoUtils.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/bean/DeferredResultEx.java | 0 src/main/java/com/genersoft/iot/vmp/service/ILogService.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/SyncStatus.java | 0 src/main/java/com/genersoft/iot/vmp/service/bean/ResponseSendItemMsg.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/bean/PlayResult.java | 0 web_src/src/components/console/ConsoleNodeLoad.vue | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/dto/LogDto.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/record/GBRecordController.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java | 2 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/MobilePosition/MobilePositionController.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/MobilePositionResponseMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/session/SSRCFactory.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/ServerKeepaliveData.java | 0 web_src/src/components/dialog/getCatalog.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java | 728 +++--- src/main/java/com/genersoft/iot/vmp/gb28181/bean/GBStringMsgParser.java | 0 web_src/src/main.js | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommanderForPlatform.java | 2 src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java | 0 src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/RemoteAddressInfo.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/PresetQueryResponseMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformCatalog.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/ConfigDownloadResponseMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java | 0 web_src/src/components/StreamProxyList.vue | 6 src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java | 5 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeForRtpServerTimeout.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/ResponseMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/RequestMessage.java | 78 src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisStreamMsgListener.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MediaStatusNotifyMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/service/IUserService.java | 0 web_src/src/components/map.vue | 0 web_src/src/components/dialog/chooseChannel.vue | 0 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnPlayHookParam.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java | 0 web_src/src/components/console/ConsoleNet.vue | 0 web_src/src/layout/UiHeader.vue | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java | 3 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/AlarmQueryMessageHandler.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java | 2 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java | 0 src/main/java/com/genersoft/iot/vmp/utils/Coordtransform.java | 0 web_src/src/components/dialog/catalogEdit.vue | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxyItem.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/HandlerCatchData.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/event/alarm/AlarmEvent.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnStreamChangedHookParam.java | 0 src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java | 0 web_src/src/components/CloudRecord.vue | 6 src/main/java/com/genersoft/iot/vmp/gb28181/conf/DefaultProperties.java | 0 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/ChannelReduce.java | 0 web_src/src/components/dialog/chooseChannelForGb.vue | 0 src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java | 19 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/CancelResponseProcessor.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/Host.java | 0 web_src/src/components/dialog/easyPlayer.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/SsrcTransaction.java | 0 src/main/java/com/genersoft/iot/vmp/service/IMediaService.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnServerKeepaliveHookParam.java | 0 src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java | 25 src/main/java/com/genersoft/iot/vmp/gb28181/task/SipRunner.java | 14 src/main/java/com/genersoft/iot/vmp/service/bean/InviteErrorCode.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/ISIPRequestProcessor.java | 0 src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatformCatch.java | 0 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerConfig.java | 0 src/main/java/com/genersoft/iot/vmp/conf/ApiAccessFilter.java | 2 src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarm.java | 374 +- src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeForServerStarted.java | 0 src/main/java/com/genersoft/iot/vmp/service/bean/ThirdPartyGB.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/dto/RecordInfo.java | 0 src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java | 0 web_src/src/components/common/jessibuca.vue | 0 doc/_content/introduction/config.md | 2 src/main/java/com/genersoft/iot/vmp/utils/JsonUtil.java | 0 src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java | 0 web_src/src/components/dialog/importChannel.vue | 0 src/main/java/com/genersoft/iot/vmp/gb28181/event/alarm/AlarmEventListener.java | 0 365 files changed, 3,884 insertions(+), 2,745 deletions(-) diff --git a/doc/_content/introduction/config.md b/doc/_content/introduction/config.md index ad88140..29f00a4 100644 --- a/doc/_content/introduction/config.md +++ b/doc/_content/introduction/config.md @@ -153,7 +153,7 @@ # 鍥芥爣鏄惁褰曞埗 record-sip: true # 鏄惁灏嗘棩蹇楀瓨鍌ㄨ繘鏁版嵁搴� - logInDatebase: true + logInDatabase: true # 绗笁鏂瑰尮閰嶏紝鐢ㄤ簬浠巗tream閽熻幏鍙栨湁鏁堜俊鎭� thirdPartyGBIdReg: [\s\S]* ``` diff --git a/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java b/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java index 886d6fa..be57316 100644 --- a/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java +++ b/src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java @@ -1,63 +1,63 @@ -package com.genersoft.iot.vmp; - -import com.genersoft.iot.vmp.utils.GitUtil; -import com.genersoft.iot.vmp.utils.SpringBeanFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.servlet.ServletComponentScan; -import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.scheduling.annotation.EnableScheduling; - -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.SessionCookieConfig; -import javax.servlet.SessionTrackingMode; -import java.util.Collections; - -/** - * 鍚姩绫� - */ -@ServletComponentScan("com.genersoft.iot.vmp.conf") -@SpringBootApplication -@EnableScheduling -public class VManageBootstrap extends SpringBootServletInitializer { - - private final static Logger logger = LoggerFactory.getLogger(VManageBootstrap.class); - - private static String[] args; - private static ConfigurableApplicationContext context; - public static void main(String[] args) { - VManageBootstrap.args = args; - VManageBootstrap.context = SpringApplication.run(VManageBootstrap.class, args); - GitUtil gitUtil1 = SpringBeanFactory.getBean("gitUtil"); - logger.info("鏋勫缓鐗堟湰锛� {}", gitUtil1.getBuildVersion()); - logger.info("鏋勫缓鏃堕棿锛� {}", gitUtil1.getBuildDate()); - logger.info("GIT鏈�鍚庢彁浜ゆ椂闂达細 {}", gitUtil1.getCommitTime()); - } - // 椤圭洰閲嶅惎 - public static void restart() { - context.close(); - VManageBootstrap.context = SpringApplication.run(VManageBootstrap.class, args); - } - - @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { - return application.sources(VManageBootstrap.class); - } - - @Override - public void onStartup(ServletContext servletContext) throws ServletException { - super.onStartup(servletContext); - - servletContext.setSessionTrackingModes( - Collections.singleton(SessionTrackingMode.COOKIE) - ); - SessionCookieConfig sessionCookieConfig = servletContext.getSessionCookieConfig(); - sessionCookieConfig.setHttpOnly(true); - - } -} +package com.genersoft.iot.vmp; + +import com.genersoft.iot.vmp.utils.GitUtil; +import com.genersoft.iot.vmp.utils.SpringBeanFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.scheduling.annotation.EnableScheduling; + +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.SessionCookieConfig; +import javax.servlet.SessionTrackingMode; +import java.util.Collections; + +/** + * 鍚姩绫� + */ +@ServletComponentScan("com.genersoft.iot.vmp.conf") +@SpringBootApplication +@EnableScheduling +public class VManageBootstrap extends SpringBootServletInitializer { + + private final static Logger logger = LoggerFactory.getLogger(VManageBootstrap.class); + + private static String[] args; + private static ConfigurableApplicationContext context; + public static void main(String[] args) { + VManageBootstrap.args = args; + VManageBootstrap.context = SpringApplication.run(VManageBootstrap.class, args); + GitUtil gitUtil1 = SpringBeanFactory.getBean("gitUtil"); + logger.info("鏋勫缓鐗堟湰锛� {}", gitUtil1.getBuildVersion()); + logger.info("鏋勫缓鏃堕棿锛� {}", gitUtil1.getBuildDate()); + logger.info("GIT鏈�鍚庢彁浜ゆ椂闂达細 {}", gitUtil1.getCommitTime()); + } + // 椤圭洰閲嶅惎 + public static void restart() { + context.close(); + VManageBootstrap.context = SpringApplication.run(VManageBootstrap.class, args); + } + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(VManageBootstrap.class); + } + + @Override + public void onStartup(ServletContext servletContext) throws ServletException { + super.onStartup(servletContext); + + servletContext.setSessionTrackingModes( + Collections.singleton(SessionTrackingMode.COOKIE) + ); + SessionCookieConfig sessionCookieConfig = servletContext.getSessionCookieConfig(); + sessionCookieConfig.setHttpOnly(true); + + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java b/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java index 274f7a8..0b8100b 100644 --- a/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java +++ b/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java @@ -1,175 +1,177 @@ -package com.genersoft.iot.vmp.common; - -/** - * @description: 瀹氫箟甯搁噺 - * @author: swwheihei - * @date: 2019骞�5鏈�30鏃� 涓嬪崍3:04:04 - * - */ -public class VideoManagerConstants { - - public static final String WVP_SERVER_PREFIX = "VMP_SIGNALLING_SERVER_INFO_"; - - public static final String WVP_SERVER_STREAM_PREFIX = "VMP_SIGNALLING_STREAM_"; - - public static final String MEDIA_SERVER_PREFIX = "VMP_MEDIA_SERVER_"; - - public static final String MEDIA_SERVERS_ONLINE_PREFIX = "VMP_MEDIA_ONLINE_SERVERS_"; - - public static final String DEVICE_PREFIX = "VMP_DEVICE_"; - - // 璁惧鍚屾瀹屾垚 - public static final String DEVICE_SYNC_PREFIX = "VMP_DEVICE_SYNC_"; - - public static final String CACHEKEY_PREFIX = "VMP_CHANNEL_"; - - public static final String KEEPLIVEKEY_PREFIX = "VMP_KEEPALIVE_"; - - // TODO 姝ゅ澶氫簡涓�涓猒锛屾殏涓嶄慨鏀� - public static final String INVITE_PREFIX = "VMP_INVITE"; - public static final String PLAYER_PREFIX = "VMP_INVITE_PLAY_"; - public static final String PLAY_BLACK_PREFIX = "VMP_INVITE_PLAYBACK_"; - public static final String DOWNLOAD_PREFIX = "VMP_INVITE_DOWNLOAD_"; - - public static final String PLATFORM_KEEPALIVE_PREFIX = "VMP_PLATFORM_KEEPALIVE_"; - - public static final String PLATFORM_CATCH_PREFIX = "VMP_PLATFORM_CATCH_"; - - public static final String PLATFORM_REGISTER_PREFIX = "VMP_PLATFORM_REGISTER_"; - - public static final String PLATFORM_REGISTER_INFO_PREFIX = "VMP_PLATFORM_REGISTER_INFO_"; - - public static final String PLATFORM_SEND_RTP_INFO_PREFIX = "VMP_PLATFORM_SEND_RTP_INFO_"; - - public static final String EVENT_ONLINE_REGISTER = "1"; - - public static final String EVENT_ONLINE_MESSAGE = "3"; - - public static final String EVENT_OUTLINE_UNREGISTER = "1"; - - public static final String EVENT_OUTLINE_TIMEOUT = "2"; - - public static final String MEDIA_SSRC_USED_PREFIX = "VMP_MEDIA_USED_SSRC_"; - - public static final String MEDIA_TRANSACTION_USED_PREFIX = "VMP_MEDIA_TRANSACTION_"; - - public static final String MEDIA_STREAM_AUTHORITY = "MEDIA_STREAM_AUTHORITY_"; - - public static final String SIP_CSEQ_PREFIX = "VMP_SIP_CSEQ_"; - - public static final String SIP_SN_PREFIX = "VMP_SIP_SN_"; - - public static final String SIP_SUBSCRIBE_PREFIX = "VMP_SIP_SUBSCRIBE_"; - - public static final String SYSTEM_INFO_CPU_PREFIX = "VMP_SYSTEM_INFO_CPU_"; - - public static final String SYSTEM_INFO_MEM_PREFIX = "VMP_SYSTEM_INFO_MEM_"; - - public static final String SYSTEM_INFO_NET_PREFIX = "VMP_SYSTEM_INFO_NET_"; - - public static final String SYSTEM_INFO_DISK_PREFIX = "VMP_SYSTEM_INFO_DISK_"; - public static final String BROADCAST_WAITE_INVITE = "task_broadcast_waite_invite_"; - - public static final String REGISTER_EXPIRE_TASK_KEY_PREFIX = "VMP_device_register_expire_"; - - - - - //************************** redis 娑堟伅********************************* - - /** - * 娴佸彉鍖栫殑閫氱煡 - */ - public static final String WVP_MSG_STREAM_CHANGE_PREFIX = "WVP_MSG_STREAM_CHANGE_"; - - /** - * 鎺ユ敹鎺ㄦ祦璁惧鐨凣PS鍙樺寲閫氱煡 - */ - public static final String VM_MSG_GPS = "VM_MSG_GPS"; - - /** - * 鎺ユ敹鎺ㄦ祦璁惧鐨凣PS鍙樺寲閫氱煡 - */ - public static final String VM_MSG_PUSH_STREAM_STATUS_CHANGE = "VM_MSG_PUSH_STREAM_STATUS_CHANGE"; - /** - * 鎺ユ敹鎺ㄦ祦璁惧鍒楄〃鏇存柊鍙樺寲閫氱煡 - */ - public static final String VM_MSG_PUSH_STREAM_LIST_CHANGE = "VM_MSG_PUSH_STREAM_LIST_CHANGE"; - - /** - * redis 娑堟伅閫氱煡璁惧鎺ㄦ祦鍒板钩鍙� - */ - public static final String VM_MSG_STREAM_PUSH_REQUESTED = "VM_MSG_STREAM_PUSH_REQUESTED"; - - /** - * redis 娑堟伅閫氱煡涓婄骇骞冲彴寮�濮嬭鐪嬫祦 - */ - public static final String VM_MSG_STREAM_START_PLAY_NOTIFY = "VM_MSG_STREAM_START_PLAY_NOTIFY"; - - /** - * redis 娑堟伅閫氱煡涓婄骇骞冲彴鍋滄瑙傜湅娴� - */ - public static final String VM_MSG_STREAM_STOP_PLAY_NOTIFY = "VM_MSG_STREAM_STOP_PLAY_NOTIFY"; - - /** - * redis 娑堟伅鎺ユ敹鍏抽棴涓�涓帹娴� - */ - public static final String VM_MSG_STREAM_PUSH_CLOSE_REQUESTED = "VM_MSG_STREAM_PUSH_CLOSE_REQUESTED"; - - - /** - * redis 娑堟伅閫氱煡骞冲彴閫氱煡璁惧鎺ㄦ祦缁撴灉 - */ - public static final String VM_MSG_STREAM_PUSH_RESPONSE = "VM_MSG_STREAM_PUSH_RESPONSE"; - - /** - * redis 閫氱煡骞冲彴鍏抽棴鎺ㄦ祦 - */ - public static final String VM_MSG_STREAM_PUSH_CLOSE = "VM_MSG_STREAM_PUSH_CLOSE"; - - /** - * redis 娑堟伅璇锋眰鎵�鏈夌殑鍦ㄧ嚎閫氶亾 - */ - public static final String VM_MSG_GET_ALL_ONLINE_REQUESTED = "VM_MSG_GET_ALL_ONLINE_REQUESTED"; - - /** - * 绉诲姩浣嶇疆璁㈤槄閫氱煡 - */ - public static final String VM_MSG_SUBSCRIBE_MOBILE_POSITION = "mobileposition"; - - /** - * 鎶ヨ璁㈤槄鐨勯�氱煡锛堟敹鍒版姤璀﹀悜redis鍙戝嚭閫氱煡锛� - */ - public static final String VM_MSG_SUBSCRIBE_ALARM = "alarm"; - - - /** - * 鎶ヨ閫氱煡鐨勫彂閫� 锛堟敹鍒皉edis鍙戝嚭鐨勯�氱煡锛岃浆鍙戠粰鍏朵粬骞冲彴锛� - */ - public static final String VM_MSG_SUBSCRIBE_ALARM_RECEIVE= "alarm_receive"; - - /** - * 璁惧鐘舵�佽闃呯殑閫氱煡 - */ - public static final String VM_MSG_SUBSCRIBE_DEVICE_STATUS = "device"; - - - //************************** 绗笁鏂� **************************************** - - public static final String WVP_STREAM_GB_ID_PREFIX = "memberNo_"; - public static final String WVP_STREAM_GPS_MSG_PREFIX = "WVP_STREAM_GPS_MSG_"; - public static final String WVP_OTHER_SEND_RTP_INFO = "VMP_OTHER_SEND_RTP_INFO_"; - public static final String WVP_OTHER_RECEIVE_RTP_INFO = "VMP_OTHER_RECEIVE_RTP_INFO_"; - - /** - * Redis Const - * 璁惧褰曞儚淇℃伅缁撴灉鍓嶇紑 - */ - public static final String REDIS_RECORD_INFO_RES_PRE = "GB_RECORD_INFO_RES_"; - /** - * Redis Const - * 璁惧褰曞儚淇℃伅缁撴灉鍓嶇紑 - */ - public static final String REDIS_RECORD_INFO_RES_COUNT_PRE = "GB_RECORD_INFO_RES_COUNT:"; - -} +package com.genersoft.iot.vmp.common; + +/** + * @description: 瀹氫箟甯搁噺 + * @author: swwheihei + * @date: 2019骞�5鏈�30鏃� 涓嬪崍3:04:04 + * + */ +public class VideoManagerConstants { + + public static final String WVP_SERVER_PREFIX = "VMP_SIGNALLING_SERVER_INFO_"; + + public static final String WVP_SERVER_STREAM_PREFIX = "VMP_SIGNALLING_STREAM_"; + + public static final String MEDIA_SERVER_PREFIX = "VMP_MEDIA_SERVER_"; + + public static final String MEDIA_SERVERS_ONLINE_PREFIX = "VMP_MEDIA_ONLINE_SERVERS_"; + + public static final String DEVICE_PREFIX = "VMP_DEVICE_"; + + // 璁惧鍚屾瀹屾垚 + public static final String DEVICE_SYNC_PREFIX = "VMP_DEVICE_SYNC_"; + + public static final String CACHEKEY_PREFIX = "VMP_CHANNEL_"; + + public static final String KEEPLIVEKEY_PREFIX = "VMP_KEEPALIVE_"; + + // TODO 姝ゅ澶氫簡涓�涓猒锛屾殏涓嶄慨鏀� + public static final String INVITE_PREFIX = "VMP_INVITE"; + public static final String PLAYER_PREFIX = "VMP_INVITE_PLAY_"; + public static final String PLAY_BLACK_PREFIX = "VMP_INVITE_PLAYBACK_"; + public static final String DOWNLOAD_PREFIX = "VMP_INVITE_DOWNLOAD_"; + + public static final String PLATFORM_KEEPALIVE_PREFIX = "VMP_PLATFORM_KEEPALIVE_"; + + public static final String PLATFORM_CATCH_PREFIX = "VMP_PLATFORM_CATCH_"; + + public static final String PLATFORM_REGISTER_PREFIX = "VMP_PLATFORM_REGISTER_"; + + public static final String PLATFORM_REGISTER_INFO_PREFIX = "VMP_PLATFORM_REGISTER_INFO_"; + + public static final String PLATFORM_SEND_RTP_INFO_PREFIX = "VMP_PLATFORM_SEND_RTP_INFO_"; + + public static final String EVENT_ONLINE_REGISTER = "1"; + + public static final String EVENT_ONLINE_MESSAGE = "3"; + + public static final String EVENT_OUTLINE_UNREGISTER = "1"; + + public static final String EVENT_OUTLINE_TIMEOUT = "2"; + + public static final String MEDIA_SSRC_USED_PREFIX = "VMP_MEDIA_USED_SSRC_"; + + public static final String MEDIA_TRANSACTION_USED_PREFIX = "VMP_MEDIA_TRANSACTION_"; + + public static final String MEDIA_STREAM_AUTHORITY = "MEDIA_STREAM_AUTHORITY_"; + + public static final String SIP_CSEQ_PREFIX = "VMP_SIP_CSEQ_"; + + public static final String SIP_SN_PREFIX = "VMP_SIP_SN_"; + + public static final String SIP_SUBSCRIBE_PREFIX = "VMP_SIP_SUBSCRIBE_"; + + public static final String SYSTEM_INFO_CPU_PREFIX = "VMP_SYSTEM_INFO_CPU_"; + + public static final String SYSTEM_INFO_MEM_PREFIX = "VMP_SYSTEM_INFO_MEM_"; + + public static final String SYSTEM_INFO_NET_PREFIX = "VMP_SYSTEM_INFO_NET_"; + + public static final String SYSTEM_INFO_DISK_PREFIX = "VMP_SYSTEM_INFO_DISK_"; + public static final String BROADCAST_WAITE_INVITE = "task_broadcast_waite_invite_"; + + public static final String REGISTER_EXPIRE_TASK_KEY_PREFIX = "VMP_device_register_expire_"; + + + + + //************************** redis 娑堟伅********************************* + + /** + * 娴佸彉鍖栫殑閫氱煡 + */ + public static final String WVP_MSG_STREAM_CHANGE_PREFIX = "WVP_MSG_STREAM_CHANGE_"; + + /** + * 鎺ユ敹鎺ㄦ祦璁惧鐨凣PS鍙樺寲閫氱煡 + */ + public static final String VM_MSG_GPS = "VM_MSG_GPS"; + + /** + * 鎺ユ敹鎺ㄦ祦璁惧鐨凣PS鍙樺寲閫氱煡 + */ + public static final String VM_MSG_PUSH_STREAM_STATUS_CHANGE = "VM_MSG_PUSH_STREAM_STATUS_CHANGE"; + /** + * 鎺ユ敹鎺ㄦ祦璁惧鍒楄〃鏇存柊鍙樺寲閫氱煡 + */ + public static final String VM_MSG_PUSH_STREAM_LIST_CHANGE = "VM_MSG_PUSH_STREAM_LIST_CHANGE"; + + /** + * redis 娑堟伅閫氱煡璁惧鎺ㄦ祦鍒板钩鍙� + */ + public static final String VM_MSG_STREAM_PUSH_REQUESTED = "VM_MSG_STREAM_PUSH_REQUESTED"; + + /** + * redis 娑堟伅閫氱煡涓婄骇骞冲彴寮�濮嬭鐪嬫祦 + */ + public static final String VM_MSG_STREAM_START_PLAY_NOTIFY = "VM_MSG_STREAM_START_PLAY_NOTIFY"; + + /** + * redis 娑堟伅閫氱煡涓婄骇骞冲彴鍋滄瑙傜湅娴� + */ + public static final String VM_MSG_STREAM_STOP_PLAY_NOTIFY = "VM_MSG_STREAM_STOP_PLAY_NOTIFY"; + + /** + * redis 娑堟伅鎺ユ敹鍏抽棴涓�涓帹娴� + */ + public static final String VM_MSG_STREAM_PUSH_CLOSE_REQUESTED = "VM_MSG_STREAM_PUSH_CLOSE_REQUESTED"; + + + /** + * redis 娑堟伅閫氱煡骞冲彴閫氱煡璁惧鎺ㄦ祦缁撴灉 + */ + public static final String VM_MSG_STREAM_PUSH_RESPONSE = "VM_MSG_STREAM_PUSH_RESPONSE"; + + /** + * redis 閫氱煡骞冲彴鍏抽棴鎺ㄦ祦 + */ + public static final String VM_MSG_STREAM_PUSH_CLOSE = "VM_MSG_STREAM_PUSH_CLOSE"; + + /** + * redis 娑堟伅璇锋眰鎵�鏈夌殑鍦ㄧ嚎閫氶亾 + */ + public static final String VM_MSG_GET_ALL_ONLINE_REQUESTED = "VM_MSG_GET_ALL_ONLINE_REQUESTED"; + + /** + * 绉诲姩浣嶇疆璁㈤槄閫氱煡 + */ + public static final String VM_MSG_SUBSCRIBE_MOBILE_POSITION = "mobileposition"; + + /** + * 鎶ヨ璁㈤槄鐨勯�氱煡锛堟敹鍒版姤璀﹀悜redis鍙戝嚭閫氱煡锛� + */ + public static final String VM_MSG_SUBSCRIBE_ALARM = "alarm"; + + + /** + * 鎶ヨ閫氱煡鐨勫彂閫� 锛堟敹鍒皉edis鍙戝嚭鐨勯�氱煡锛岃浆鍙戠粰鍏朵粬骞冲彴锛� + */ + public static final String VM_MSG_SUBSCRIBE_ALARM_RECEIVE= "alarm_receive"; + + /** + * 璁惧鐘舵�佽闃呯殑閫氱煡 + */ + public static final String VM_MSG_SUBSCRIBE_DEVICE_STATUS = "device"; + + + //************************** 绗笁鏂� **************************************** + + public static final String WVP_STREAM_GB_ID_PREFIX = "memberNo_"; + public static final String WVP_STREAM_GPS_MSG_PREFIX = "WVP_STREAM_GPS_MSG_"; + public static final String WVP_OTHER_SEND_RTP_INFO = "VMP_OTHER_SEND_RTP_INFO_"; + public static final String WVP_OTHER_SEND_PS_INFO = "VMP_OTHER_SEND_PS_INFO_"; + public static final String WVP_OTHER_RECEIVE_RTP_INFO = "VMP_OTHER_RECEIVE_RTP_INFO_"; + public static final String WVP_OTHER_RECEIVE_PS_INFO = "VMP_OTHER_RECEIVE_PS_INFO_"; + + /** + * Redis Const + * 璁惧褰曞儚淇℃伅缁撴灉鍓嶇紑 + */ + public static final String REDIS_RECORD_INFO_RES_PRE = "GB_RECORD_INFO_RES_"; + /** + * Redis Const + * 璁惧褰曞儚淇℃伅缁撴灉鍓嶇紑 + */ + public static final String REDIS_RECORD_INFO_RES_COUNT_PRE = "GB_RECORD_INFO_RES_COUNT:"; + +} diff --git a/src/main/java/com/genersoft/iot/vmp/conf/ApiAccessFilter.java b/src/main/java/com/genersoft/iot/vmp/conf/ApiAccessFilter.java index 4d885e8..b449b1b 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/ApiAccessFilter.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/ApiAccessFilter.java @@ -51,7 +51,7 @@ filterChain.doFilter(servletRequest, servletResponse); - if (uriName != null && userSetting != null && userSetting.getLogInDatebase() != null && userSetting.getLogInDatebase()) { + if (uriName != null && userSetting != null && userSetting.getLogInDatabase() != null && userSetting.getLogInDatabase()) { LogDto logDto = new LogDto(); logDto.setName(uriName); diff --git a/src/main/java/com/genersoft/iot/vmp/conf/CivilCodeFileConf.java b/src/main/java/com/genersoft/iot/vmp/conf/CivilCodeFileConf.java index 39e0a70..20b6eef 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/CivilCodeFileConf.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/CivilCodeFileConf.java @@ -12,7 +12,10 @@ import org.springframework.core.io.ClassPathResource; import org.springframework.util.ObjectUtils; -import java.io.*; +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStream; +import java.io.InputStreamReader; import java.nio.file.Files; import java.util.Map; 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 873feab..5a451e3 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java @@ -111,7 +111,7 @@ } boolean result = false; if (!ObjectUtils.isEmpty(futureMap.get(key)) && !futureMap.get(key).isCancelled() && !futureMap.get(key).isDone()) { - result = futureMap.get(key).cancel(true); + result = futureMap.get(key).cancel(false); futureMap.remove(key); runnableMap.remove(key); } @@ -143,7 +143,8 @@ public void execute(){ if (futureMap.size() > 0) { for (String key : futureMap.keySet()) { - if (futureMap.get(key).isDone() || futureMap.get(key).isCancelled()) { + ScheduledFuture<?> future = futureMap.get(key); + if (future.isDone() || future.isCancelled()) { futureMap.remove(key); runnableMap.remove(key); } diff --git a/src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java index f3fd1d8..a7416a8 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java @@ -18,6 +18,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.ConnectException; @@ -62,6 +63,18 @@ } } return queryStr; + } + + + @Override + protected HttpResponse doExecute(HttpServletRequest servletRequest, HttpServletResponse servletResponse, + HttpRequest proxyRequest) throws IOException { + HttpResponse response = super.doExecute(servletRequest, servletResponse, proxyRequest); + response.removeHeaders("Access-Control-Allow-Origin"); + response.setHeader("Access-Control-Allow-Credentials","true"); + response.removeHeaders("Access-Control-Allow-Credentials"); + + return response; } /** @@ -181,6 +194,18 @@ return queryStr; } + + @Override + protected HttpResponse doExecute(HttpServletRequest servletRequest, HttpServletResponse servletResponse, + HttpRequest proxyRequest) throws IOException { + HttpResponse response = super.doExecute(servletRequest, servletResponse, proxyRequest); + String origin = servletRequest.getHeader("origin"); + response.setHeader("Access-Control-Allow-Origin",origin); + response.setHeader("Access-Control-Allow-Credentials","true"); + + return response; + } + /** * 寮傚父澶勭悊 */ diff --git a/src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java b/src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java index eb1b157..7760bdd 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java @@ -4,8 +4,11 @@ import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch; import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; import com.genersoft.iot.vmp.service.IPlatformService; +import com.genersoft.iot.vmp.service.impl.PlatformServiceImpl; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; 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.boot.CommandLineRunner; import org.springframework.core.annotation.Order; @@ -33,6 +36,7 @@ @Autowired private ISIPCommanderForPlatform sipCommanderForPlatform; + private final static Logger logger = LoggerFactory.getLogger(PlatformServiceImpl.class); @Override public void run(String... args) throws Exception { @@ -50,9 +54,15 @@ redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch); if (parentPlatformCatchOld != null) { // 鍙栨秷璁㈤槄 - sipCommanderForPlatform.unregister(parentPlatform, parentPlatformCatchOld.getSipTransactionInfo(), null, (eventResult)->{ - platformService.login(parentPlatform); - }); + try { + sipCommanderForPlatform.unregister(parentPlatform, parentPlatformCatchOld.getSipTransactionInfo(), null, (eventResult)->{ + platformService.login(parentPlatform); + }); + } catch (Exception e) { + logger.error("[鍛戒护鍙戦�佸け璐 鍥芥爣绾ц仈 娉ㄩ攢: {}", e.getMessage()); + platformService.offline(parentPlatform, true); + continue; + } } // 璁剧疆鎵�鏈夊钩鍙扮绾� diff --git a/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java b/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java index 0993d74..aadbf47 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java @@ -31,7 +31,7 @@ private Boolean recordSip = Boolean.TRUE; - private Boolean logInDatebase = Boolean.TRUE; + private Boolean logInDatabase = Boolean.TRUE; private Boolean usePushingAsStatus = Boolean.FALSE; @@ -134,12 +134,12 @@ this.interfaceAuthenticationExcludes = interfaceAuthenticationExcludes; } - public Boolean getLogInDatebase() { - return logInDatebase; + public Boolean getLogInDatabase() { + return logInDatabase; } - public void setLogInDatebase(Boolean logInDatebase) { - this.logInDatebase = logInDatebase; + public void setLogInDatabase(Boolean logInDatabase) { + this.logInDatabase = logInDatabase; } public String getServerId() { diff --git a/src/main/java/com/genersoft/iot/vmp/conf/security/JwtUtils.java b/src/main/java/com/genersoft/iot/vmp/conf/security/JwtUtils.java index c9c7b68..65e9de3 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/security/JwtUtils.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/security/JwtUtils.java @@ -1,8 +1,10 @@ package com.genersoft.iot.vmp.conf.security; import com.genersoft.iot.vmp.conf.security.dto.JwtUser; -import org.jose4j.json.JsonUtil; +import com.genersoft.iot.vmp.service.IUserService; +import com.genersoft.iot.vmp.storager.dao.dto.User; import org.jose4j.jwk.RsaJsonWebKey; +import org.jose4j.jwk.RsaJwkGenerator; import org.jose4j.jws.AlgorithmIdentifiers; import org.jose4j.jws.JsonWebSignature; import org.jose4j.jwt.JwtClaims; @@ -14,45 +16,69 @@ import org.jose4j.lang.JoseException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.stereotype.Component; -import java.security.PrivateKey; +import javax.annotation.Resource; import java.time.LocalDateTime; import java.time.ZoneOffset; -public class JwtUtils { +@Component +public class JwtUtils implements InitializingBean { private static final Logger logger = LoggerFactory.getLogger(JwtUtils.class); private static final String HEADER = "access-token"; + private static final String AUDIENCE = "Audience"; - private static final long EXPIRED_THRESHOLD = 10 * 60; - private static final String keyId = "3e79646c4dbc408383a9eed09f2b85ae"; - private static final String privateKeyStr = "{\"kty\":\"RSA\",\"kid\":\"3e79646c4dbc408383a9eed09f2b85ae\",\"alg\":\"RS256\",\"n\":\"gndmVdiOTSJ5et2HIeTM5f1m61x5ojLUi5HDfvr-jRrESQ5kbKuySGHVwR4QhwinpY1wQqBnwc80tx7cb_6SSqsTOoGln6T_l3k2Pb54ClVnGWiW_u1kmX78V2TZOsVmZmwtdZCMi-2zWIyAdIEXE-gncIehoAgEoq2VAhaCURbJWro_EwzzQwNmCTkDodLAx4npXRd_qSu0Ayp0txym9OFovBXBULRvk4DPiy3i_bPUmCDxzC46pTtFOe9p82uybTehZfULZtXXqRm85FL9n5zkrsTllPNAyEGhgb0RK9sE5nK1m_wNNysDyfLC4EFf1VXTrKm14XNVjc2vqLb7Mw\",\"e\":\"AQAB\",\"d\":\"ed7U_k3rJ4yTk70JtRSIfjKGiEb67BO1TabcymnljKO7RU8nage84zZYuSu_XpQsHk6P1f0Gzxkicghm_Er-FrfVn2pp70Xu52z3yRd6BJUgWLDFk97ngScIyw5OiULKU9SrZk2frDpftNCSUcIgb50F8m0QAnBa_CdPsQKbuuhLv8V8tBAV7F_lAwvSBgu56wRo3hPz5dWH8YeXM7XBfQ9viFMNEKd21sP_j5C7ueUnXT66nBxe3ZJEU3iuMYM6D6dB_KW2GfZC6WmTgvGhhxJD0h7aYmfjkD99MDleB7SkpbvoODOqiQ5Epb7Nyh6kv5u4KUv2CJYtATLZkUeMkQ\",\"p\":\"uBUjWPWtlGksmOqsqCNWksfqJvMcnP_8TDYN7e4-WnHL4N-9HjRuPDnp6kHvCIEi9SEfxm7gNxlRcWegvNQr3IZCz7TnCTexXc5NOklB9OavWFla6u-s3Thn6Tz45-EUjpJr0VJMxhO-KxGmuTwUXBBp4vN6K2qV6rQNFmgkWzk\",\"q\":\"tW_i7cCec56bHkhITL_79dXHz_PLC_f7xlynmlZJGU_d6mqOKmLBNBbTMLnYW8uAFiFzWxDeDHh1o5uF0mSQR-Z1Fg35OftnpbWpy0Cbc2la5WgXQjOwtG1eLYIY2BD3-wQ1VYDBCvowr4FDi-sngxwLqvwmrJ0xjhi99O-Gzcs\",\"dp\":\"q1d5jE85Hz_6M-eTh_lEluEf0NtPEc-vvhw-QO4V-cecNpbrCBdTWBmr4dE3NdpFeJc5ZVFEv-SACyei1MBEh0ItI_pFZi4BmMfy2ELh8ptaMMkTOESYyVy8U7veDq9RnBcr5i1Nqr0rsBkA77-9T6gzdvycBZdzLYAkAmwzEvk\",\"dq\":\"q29A2K08Crs-jmp2Bi8Q_8QzvIX6wSBbwZ4ir24AO-5_HNP56IrPS0yV2GCB0pqCOGb6_Hz_koDvhtuYoqdqvMVAtMoXR3YJBUaVXPt65p4RyNmFwIPe31zHs_BNUTsXVRMw4c16mci03-Af1sEm4HdLfxAp6sfM3xr5wcnhcek\",\"qi\":\"rHPgVTyHUHuYzcxfouyBfb1XAY8nshwn0ddo81o1BccD4Z7zo5It6SefDHjxCAbcmbiCcXBSooLcY-NF5FMv3fg19UE21VyLQltHcVjRRp2tRs4OHcM8yaXIU2x6N6Z6BP2tOksHb9MOBY1wAQzFOAKg_G4Sxev6-_6ud6RISuc\"}"; - private static final String publicKeyStr = "{\"kty\":\"RSA\",\"kid\":\"3e79646c4dbc408383a9eed09f2b85ae\",\"alg\":\"RS256\",\"n\":\"gndmVdiOTSJ5et2HIeTM5f1m61x5ojLUi5HDfvr-jRrESQ5kbKuySGHVwR4QhwinpY1wQqBnwc80tx7cb_6SSqsTOoGln6T_l3k2Pb54ClVnGWiW_u1kmX78V2TZOsVmZmwtdZCMi-2zWIyAdIEXE-gncIehoAgEoq2VAhaCURbJWro_EwzzQwNmCTkDodLAx4npXRd_qSu0Ayp0txym9OFovBXBULRvk4DPiy3i_bPUmCDxzC46pTtFOe9p82uybTehZfULZtXXqRm85FL9n5zkrsTllPNAyEGhgb0RK9sE5nK1m_wNNysDyfLC4EFf1VXTrKm14XNVjc2vqLb7Mw\",\"e\":\"AQAB\"}"; /** * token杩囨湡鏃堕棿(鍒嗛挓) */ - public static final long expirationTime = 30; + public static final long expirationTime = 30 * 24 * 60; - public static String createToken(String username, String password, Integer roleId) { + private static RsaJsonWebKey rsaJsonWebKey; + + private static IUserService userService; + + @Resource + public void setUserService(IUserService userService) { + JwtUtils.userService = userService; + } + + @Override + public void afterPropertiesSet() { try { - /** + rsaJsonWebKey = generateRsaJsonWebKey(); + } catch (JoseException e) { + logger.error("鐢熸垚RsaJsonWebKey鎶ラ敊銆�", e); + } + } + + /** + * 鍒涘缓瀵嗛挜瀵� + * @throws JoseException JoseException + */ + private RsaJsonWebKey generateRsaJsonWebKey() throws JoseException { + // 鐢熸垚涓�涓猂SA瀵嗛挜瀵癸紝璇ュ瘑閽ュ灏嗙敤浜嶫WT鐨勭鍚嶅拰楠岃瘉锛屽寘瑁呭湪JWK涓� + RsaJsonWebKey rsaJsonWebKey = RsaJwkGenerator.generateJwk(2048); + // 缁橨WK涓�涓瘑閽D + rsaJsonWebKey.setKeyId(keyId); + return rsaJsonWebKey; + } + + public static String createToken(String username) { + try { + /* * 鈥渋ss鈥� (issuer) 鍙戣浜� - * * 鈥渟ub鈥� (subject) 涓婚 - * * 鈥渁ud鈥� (audience) 鎺ユ敹鏂� 鐢ㄦ埛 - * * 鈥渆xp鈥� (expiration time) 鍒版湡鏃堕棿 - * * 鈥渘bf鈥� (not before) 鍦ㄦ涔嬪墠涓嶅彲鐢� - * * 鈥渋at鈥� (issued at) jwt鐨勭鍙戞椂闂� */ - //Payload JwtClaims claims = new JwtClaims(); claims.setGeneratedJwtId(); claims.setIssuedAtToNow(); @@ -62,9 +88,7 @@ claims.setSubject("login"); claims.setAudience(AUDIENCE); //娣诲姞鑷畾涔夊弬鏁�,蹇呴』鏄瓧绗︿覆绫诲瀷 - claims.setClaim("username", username); - claims.setClaim("password", password); - claims.setClaim("roleId", roleId); + claims.setClaim("userName", username); //jws JsonWebSignature jws = new JsonWebSignature(); @@ -73,12 +97,10 @@ jws.setKeyIdHeaderValue(keyId); jws.setPayload(claims.toJson()); - PrivateKey privateKey = new RsaJsonWebKey(JsonUtil.parseJson(privateKeyStr)).getPrivateKey(); - jws.setKey(privateKey); + jws.setKey(rsaJsonWebKey.getPrivateKey()); //get token - String idToken = jws.getCompactSerialization(); - return idToken; + return jws.getCompactSerialization(); } catch (JoseException e) { logger.error("[Token鐢熸垚澶辫触]锛� {}", e.getMessage()); } @@ -89,7 +111,6 @@ public static String getHeader() { return HEADER; } - public static JwtUser verifyToken(String token) { @@ -103,7 +124,7 @@ .setRequireSubject() //.setExpectedIssuer("") .setExpectedAudience(AUDIENCE) - .setVerificationKey(new RsaJsonWebKey(JsonUtil.parseJson(publicKeyStr)).getPublicKey()) + .setVerificationKey(rsaJsonWebKey.getPublicKey()) .build(); JwtClaims claims = consumer.processToClaims(token); @@ -113,26 +134,26 @@ long timeRemaining = LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8)) - expirationTime.getValue(); if (timeRemaining < 5 * 60) { jwtUser.setStatus(JwtUser.TokenStatus.EXPIRING_SOON); - }else { + } else { jwtUser.setStatus(JwtUser.TokenStatus.NORMAL); } - String username = (String) claims.getClaimValue("username"); - String password = (String) claims.getClaimValue("password"); - Long roleId = (Long) claims.getClaimValue("roleId"); + String username = (String) claims.getClaimValue("userName"); + User user = userService.getUserByUsername(username); + jwtUser.setUserName(username); - jwtUser.setPassword(password); - jwtUser.setRoleId(roleId.intValue()); + jwtUser.setPassword(user.getPassword()); + jwtUser.setRoleId(user.getRole().getId()); return jwtUser; } catch (InvalidJwtException e) { if (e.hasErrorCode(ErrorCodes.EXPIRED)) { jwtUser.setStatus(JwtUser.TokenStatus.EXPIRED); - }else { + } else { jwtUser.setStatus(JwtUser.TokenStatus.EXCEPTION); } return jwtUser; - }catch (Exception e) { + } catch (Exception e) { logger.error("[Token瑙f瀽澶辫触]锛� {}", e.getMessage()); jwtUser.setStatus(JwtUser.TokenStatus.EXPIRED); return jwtUser; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java index 0c77fc1..56663f1 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java @@ -1,141 +1,141 @@ -package com.genersoft.iot.vmp.gb28181; - -import com.genersoft.iot.vmp.conf.SipConfig; -import com.genersoft.iot.vmp.conf.UserSetting; -import com.genersoft.iot.vmp.gb28181.bean.GbStringMsgParserFactory; -import com.genersoft.iot.vmp.gb28181.conf.DefaultProperties; -import com.genersoft.iot.vmp.gb28181.transmit.ISIPProcessorObserver; -import gov.nist.javax.sip.SipProviderImpl; -import gov.nist.javax.sip.SipStackImpl; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.CommandLineRunner; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; -import org.springframework.util.ObjectUtils; - -import javax.sip.*; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; - -@Component -@Order(value=10) -public class SipLayer implements CommandLineRunner { - - private final static Logger logger = LoggerFactory.getLogger(SipLayer.class); - - @Autowired - private SipConfig sipConfig; - - @Autowired - private ISIPProcessorObserver sipProcessorObserver; - - @Autowired - private UserSetting userSetting; - - private final Map<String, SipProviderImpl> tcpSipProviderMap = new ConcurrentHashMap<>(); - private final Map<String, SipProviderImpl> udpSipProviderMap = new ConcurrentHashMap<>(); - - @Override - public void run(String... args) { - List<String> monitorIps = new ArrayList<>(); - // 浣跨敤閫楀彿鍒嗗壊澶氫釜ip - String separator = ","; - if (sipConfig.getIp().indexOf(separator) > 0) { - String[] split = sipConfig.getIp().split(separator); - monitorIps.addAll(Arrays.asList(split)); - }else { - monitorIps.add(sipConfig.getIp()); - } - - SipFactory.getInstance().setPathName("gov.nist"); - if (monitorIps.size() > 0) { - for (String monitorIp : monitorIps) { - addListeningPoint(monitorIp, sipConfig.getPort()); - } - if (udpSipProviderMap.size() + tcpSipProviderMap.size() == 0) { - System.exit(1); - } - } - } - - private void addListeningPoint(String monitorIp, int port){ - SipStackImpl sipStack; - try { - sipStack = (SipStackImpl)SipFactory.getInstance().createSipStack(DefaultProperties.getProperties("GB28181_SIP", userSetting.getSipLog())); - sipStack.setMessageParserFactory(new GbStringMsgParserFactory()); - } catch (PeerUnavailableException e) { - logger.error("[SIP SERVER] SIP鏈嶅姟鍚姩澶辫触锛� 鐩戝惉鍦板潃{}澶辫触,璇锋鏌p鏄惁姝g‘", monitorIp); - return; - } - - try { - ListeningPoint tcpListeningPoint = sipStack.createListeningPoint(monitorIp, port, "TCP"); - SipProviderImpl tcpSipProvider = (SipProviderImpl)sipStack.createSipProvider(tcpListeningPoint); - - tcpSipProvider.setDialogErrorsAutomaticallyHandled(); - tcpSipProvider.addSipListener(sipProcessorObserver); - tcpSipProviderMap.put(monitorIp, tcpSipProvider); - logger.info("[SIP SERVER] tcp://{}:{} 鍚姩鎴愬姛", monitorIp, port); - } catch (TransportNotSupportedException - | TooManyListenersException - | ObjectInUseException - | InvalidArgumentException e) { - logger.error("[SIP SERVER] tcp://{}:{} SIP鏈嶅姟鍚姩澶辫触,璇锋鏌ョ鍙f槸鍚﹁鍗犵敤鎴栬�卛p鏄惁姝g‘" - , monitorIp, port); - } - - try { - ListeningPoint udpListeningPoint = sipStack.createListeningPoint(monitorIp, port, "UDP"); - - SipProviderImpl udpSipProvider = (SipProviderImpl)sipStack.createSipProvider(udpListeningPoint); - udpSipProvider.addSipListener(sipProcessorObserver); - - udpSipProviderMap.put(monitorIp, udpSipProvider); - - logger.info("[SIP SERVER] udp://{}:{} 鍚姩鎴愬姛", monitorIp, port); - } catch (TransportNotSupportedException - | TooManyListenersException - | ObjectInUseException - | InvalidArgumentException e) { - logger.error("[SIP SERVER] udp://{}:{} SIP鏈嶅姟鍚姩澶辫触,璇锋鏌ョ鍙f槸鍚﹁鍗犵敤鎴栬�卛p鏄惁姝g‘" - , monitorIp, port); - } - } - - public SipProviderImpl getUdpSipProvider(String ip) { - if (ObjectUtils.isEmpty(ip)) { - return null; - } - return udpSipProviderMap.get(ip); - } - - public SipProviderImpl getUdpSipProvider() { - if (udpSipProviderMap.size() != 1) { - return null; - } - return udpSipProviderMap.values().stream().findFirst().get(); - } - - public SipProviderImpl getTcpSipProvider() { - if (tcpSipProviderMap.size() != 1) { - return null; - } - return tcpSipProviderMap.values().stream().findFirst().get(); - } - - public SipProviderImpl getTcpSipProvider(String ip) { - if (ObjectUtils.isEmpty(ip)) { - return null; - } - return tcpSipProviderMap.get(ip); - } - - public String getLocalIp(String deviceLocalIp) { - if (!ObjectUtils.isEmpty(deviceLocalIp)) { - return deviceLocalIp; - } - return getUdpSipProvider().getListeningPoint().getIPAddress(); - } -} +package com.genersoft.iot.vmp.gb28181; + +import com.genersoft.iot.vmp.conf.SipConfig; +import com.genersoft.iot.vmp.conf.UserSetting; +import com.genersoft.iot.vmp.gb28181.bean.GbStringMsgParserFactory; +import com.genersoft.iot.vmp.gb28181.conf.DefaultProperties; +import com.genersoft.iot.vmp.gb28181.transmit.ISIPProcessorObserver; +import gov.nist.javax.sip.SipProviderImpl; +import gov.nist.javax.sip.SipStackImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; + +import javax.sip.*; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; + +@Component +@Order(value=10) +public class SipLayer implements CommandLineRunner { + + private final static Logger logger = LoggerFactory.getLogger(SipLayer.class); + + @Autowired + private SipConfig sipConfig; + + @Autowired + private ISIPProcessorObserver sipProcessorObserver; + + @Autowired + private UserSetting userSetting; + + private final Map<String, SipProviderImpl> tcpSipProviderMap = new ConcurrentHashMap<>(); + private final Map<String, SipProviderImpl> udpSipProviderMap = new ConcurrentHashMap<>(); + + @Override + public void run(String... args) { + List<String> monitorIps = new ArrayList<>(); + // 浣跨敤閫楀彿鍒嗗壊澶氫釜ip + String separator = ","; + if (sipConfig.getIp().indexOf(separator) > 0) { + String[] split = sipConfig.getIp().split(separator); + monitorIps.addAll(Arrays.asList(split)); + }else { + monitorIps.add(sipConfig.getIp()); + } + + SipFactory.getInstance().setPathName("gov.nist"); + if (monitorIps.size() > 0) { + for (String monitorIp : monitorIps) { + addListeningPoint(monitorIp, sipConfig.getPort()); + } + if (udpSipProviderMap.size() + tcpSipProviderMap.size() == 0) { + System.exit(1); + } + } + } + + private void addListeningPoint(String monitorIp, int port){ + SipStackImpl sipStack; + try { + sipStack = (SipStackImpl)SipFactory.getInstance().createSipStack(DefaultProperties.getProperties("GB28181_SIP", userSetting.getSipLog())); + sipStack.setMessageParserFactory(new GbStringMsgParserFactory()); + } catch (PeerUnavailableException e) { + logger.error("[SIP SERVER] SIP鏈嶅姟鍚姩澶辫触锛� 鐩戝惉鍦板潃{}澶辫触,璇锋鏌p鏄惁姝g‘", monitorIp); + return; + } + + try { + ListeningPoint tcpListeningPoint = sipStack.createListeningPoint(monitorIp, port, "TCP"); + SipProviderImpl tcpSipProvider = (SipProviderImpl)sipStack.createSipProvider(tcpListeningPoint); + + tcpSipProvider.setDialogErrorsAutomaticallyHandled(); + tcpSipProvider.addSipListener(sipProcessorObserver); + tcpSipProviderMap.put(monitorIp, tcpSipProvider); + logger.info("[SIP SERVER] tcp://{}:{} 鍚姩鎴愬姛", monitorIp, port); + } catch (TransportNotSupportedException + | TooManyListenersException + | ObjectInUseException + | InvalidArgumentException e) { + logger.error("[SIP SERVER] tcp://{}:{} SIP鏈嶅姟鍚姩澶辫触,璇锋鏌ョ鍙f槸鍚﹁鍗犵敤鎴栬�卛p鏄惁姝g‘" + , monitorIp, port); + } + + try { + ListeningPoint udpListeningPoint = sipStack.createListeningPoint(monitorIp, port, "UDP"); + + SipProviderImpl udpSipProvider = (SipProviderImpl)sipStack.createSipProvider(udpListeningPoint); + udpSipProvider.addSipListener(sipProcessorObserver); + + udpSipProviderMap.put(monitorIp, udpSipProvider); + + logger.info("[SIP SERVER] udp://{}:{} 鍚姩鎴愬姛", monitorIp, port); + } catch (TransportNotSupportedException + | TooManyListenersException + | ObjectInUseException + | InvalidArgumentException e) { + logger.error("[SIP SERVER] udp://{}:{} SIP鏈嶅姟鍚姩澶辫触,璇锋鏌ョ鍙f槸鍚﹁鍗犵敤鎴栬�卛p鏄惁姝g‘" + , monitorIp, port); + } + } + + public SipProviderImpl getUdpSipProvider(String ip) { + if (ObjectUtils.isEmpty(ip)) { + return null; + } + return udpSipProviderMap.get(ip); + } + + public SipProviderImpl getUdpSipProvider() { + if (udpSipProviderMap.size() != 1) { + return null; + } + return udpSipProviderMap.values().stream().findFirst().get(); + } + + public SipProviderImpl getTcpSipProvider() { + if (tcpSipProviderMap.size() != 1) { + return null; + } + return tcpSipProviderMap.values().stream().findFirst().get(); + } + + public SipProviderImpl getTcpSipProvider(String ip) { + if (ObjectUtils.isEmpty(ip)) { + return null; + } + return tcpSipProviderMap.get(ip); + } + + public String getLocalIp(String deviceLocalIp) { + if (!ObjectUtils.isEmpty(deviceLocalIp)) { + return deviceLocalIp; + } + return getUdpSipProvider().getListeningPoint().getIPAddress(); + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarm.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarm.java index bfc97b5..3711341 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarm.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarm.java @@ -1,187 +1,187 @@ -package com.genersoft.iot.vmp.gb28181.bean; - -import io.swagger.v3.oas.annotations.media.Schema; - -/** - * @author lin - */ -@Schema(description = "鎶ヨ淇℃伅") -public class DeviceAlarm { - - /** - * 鏁版嵁搴搃d - */ - @Schema(description = "鏁版嵁搴搃d") - private String id; - - /** - * 璁惧Id - */ - @Schema(description = "璁惧鐨勫浗鏍囩紪鍙�") - private String deviceId; - - /** - * 閫氶亾Id - */ - @Schema(description = "閫氶亾鐨勫浗鏍囩紪鍙�") - private String channelId; - - /** - * 鎶ヨ绾у埆, 1涓轰竴绾ц鎯�, 2涓轰簩绾ц鎯�, 3涓轰笁绾ц鎯�, 4涓哄洓绾ц鎯� - */ - @Schema(description = "鎶ヨ绾у埆, 1涓轰竴绾ц鎯�, 2涓轰簩绾ц鎯�, 3涓轰笁绾ц鎯�, 4涓哄洓绾ц鎯�") - private String alarmPriority; - - /** - * 鎶ヨ鏂瑰紡 , 1涓虹數璇濇姤璀�, 2涓鸿澶囨姤璀�, 3涓虹煭淇℃姤璀�, 4涓� GPS鎶ヨ, 5涓鸿棰戞姤璀�, 6涓鸿澶囨晠闅滄姤璀�, - * 7鍏朵粬鎶ヨ;鍙互涓虹洿鎺ョ粍鍚堝12涓虹數璇濇姤璀︽垨 璁惧鎶ヨ- - */ - @Schema(description = "鎶ヨ鏂瑰紡 , 1涓虹數璇濇姤璀�, 2涓鸿澶囨姤璀�, 3涓虹煭淇℃姤璀�, 4涓� GPS鎶ヨ, 5涓鸿棰戞姤璀�, 6涓鸿澶囨晠闅滄姤璀�,\n" + - "\t * 7鍏朵粬鎶ヨ;鍙互涓虹洿鎺ョ粍鍚堝12涓虹數璇濇姤璀︽垨璁惧鎶ヨ") - private String alarmMethod; - - /** - * 鎶ヨ鏃堕棿 - */ - @Schema(description = "鎶ヨ鏃堕棿") - private String alarmTime; - - /** - * 鎶ヨ鍐呭鎻忚堪 - */ - @Schema(description = "鎶ヨ鍐呭鎻忚堪") - private String alarmDescription; - - /** - * 缁忓害 - */ - @Schema(description = "缁忓害") - private double longitude; - - /** - * 绾害 - */ - @Schema(description = "绾害") - private double latitude; - - /** - * 鎶ヨ绫诲瀷, - * 鎶ヨ鏂瑰紡涓�2鏃�,涓嶆惡甯� AlarmType涓洪粯璁ょ殑鎶ヨ璁惧鎶ヨ, - * 鎼哄甫 AlarmType鍙栧�煎強瀵瑰簲鎶ヨ绫诲瀷濡備笅: - * 1-瑙嗛涓㈠け鎶ヨ; - * 2-璁惧闃叉媶鎶ヨ; - * 3-瀛樺偍璁惧纾佺洏婊℃姤璀�; - * 4-璁惧楂樻俯鎶ヨ; - * 5-璁惧浣庢俯鎶ヨ銆� - * 鎶ヨ鏂瑰紡涓�5鏃�,鍙栧�煎涓�: - * 1-浜哄伐瑙嗛鎶ヨ; - * 2-杩愬姩鐩爣妫�娴嬫姤璀�; - * 3-閬楃暀鐗╂娴嬫姤璀�; - * 4-鐗╀綋绉婚櫎妫�娴嬫姤璀�; - * 5-缁婄嚎妫�娴嬫姤璀�; - * 6-鍏ヤ镜妫�娴嬫姤璀�; - * 7-閫嗚妫�娴嬫姤璀�; - * 8-寰樺緤妫�娴嬫姤璀�; - * 9-娴侀噺缁熻鎶ヨ; - * 10-瀵嗗害妫�娴嬫姤璀�; - * 11-瑙嗛寮傚父妫�娴嬫姤璀�; - * 12-蹇�熺Щ鍔ㄦ姤璀︺�� - * 鎶ヨ鏂瑰紡涓�6鏃�,鍙栧�间笅: - * 1-瀛樺偍璁惧纾佺洏鏁呴殰鎶ヨ; - * 2-瀛樺偍璁惧椋庢墖鏁呴殰鎶ヨ銆� - */ - @Schema(description = "鎶ヨ绫诲瀷") - private String alarmType; - - @Schema(description = "鍒涘缓鏃堕棿") - private String createTime; - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getAlarmPriority() { - return alarmPriority; - } - - public void setAlarmPriority(String alarmPriority) { - this.alarmPriority = alarmPriority; - } - - public String getAlarmMethod() { - return alarmMethod; - } - - public void setAlarmMethod(String alarmMethod) { - this.alarmMethod = alarmMethod; - } - - public String getAlarmTime() { - return alarmTime; - } - - public void setAlarmTime(String alarmTime) { - this.alarmTime = alarmTime; - } - - public String getAlarmDescription() { - return alarmDescription; - } - - public void setAlarmDescription(String alarmDescription) { - this.alarmDescription = alarmDescription; - } - - public double getLongitude() { - return longitude; - } - - public void setLongitude(double longitude) { - this.longitude = longitude; - } - - public double getLatitude() { - return latitude; - } - - public void setLatitude(double latitude) { - this.latitude = latitude; - } - - public String getAlarmType() { - return alarmType; - } - - public void setAlarmType(String alarmType) { - this.alarmType = alarmType; - } - - public String getChannelId() { - return channelId; - } - - public void setChannelId(String channelId) { - this.channelId = channelId; - } - - public String getCreateTime() { - return createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } -} +package com.genersoft.iot.vmp.gb28181.bean; + +import io.swagger.v3.oas.annotations.media.Schema; + +/** + * @author lin + */ +@Schema(description = "鎶ヨ淇℃伅") +public class DeviceAlarm { + + /** + * 鏁版嵁搴搃d + */ + @Schema(description = "鏁版嵁搴搃d") + private String id; + + /** + * 璁惧Id + */ + @Schema(description = "璁惧鐨勫浗鏍囩紪鍙�") + private String deviceId; + + /** + * 閫氶亾Id + */ + @Schema(description = "閫氶亾鐨勫浗鏍囩紪鍙�") + private String channelId; + + /** + * 鎶ヨ绾у埆, 1涓轰竴绾ц鎯�, 2涓轰簩绾ц鎯�, 3涓轰笁绾ц鎯�, 4涓哄洓绾ц鎯� + */ + @Schema(description = "鎶ヨ绾у埆, 1涓轰竴绾ц鎯�, 2涓轰簩绾ц鎯�, 3涓轰笁绾ц鎯�, 4涓哄洓绾ц鎯�") + private String alarmPriority; + + /** + * 鎶ヨ鏂瑰紡 , 1涓虹數璇濇姤璀�, 2涓鸿澶囨姤璀�, 3涓虹煭淇℃姤璀�, 4涓� GPS鎶ヨ, 5涓鸿棰戞姤璀�, 6涓鸿澶囨晠闅滄姤璀�, + * 7鍏朵粬鎶ヨ;鍙互涓虹洿鎺ョ粍鍚堝12涓虹數璇濇姤璀︽垨 璁惧鎶ヨ- + */ + @Schema(description = "鎶ヨ鏂瑰紡 , 1涓虹數璇濇姤璀�, 2涓鸿澶囨姤璀�, 3涓虹煭淇℃姤璀�, 4涓� GPS鎶ヨ, 5涓鸿棰戞姤璀�, 6涓鸿澶囨晠闅滄姤璀�,\n" + + "\t * 7鍏朵粬鎶ヨ;鍙互涓虹洿鎺ョ粍鍚堝12涓虹數璇濇姤璀︽垨璁惧鎶ヨ") + private String alarmMethod; + + /** + * 鎶ヨ鏃堕棿 + */ + @Schema(description = "鎶ヨ鏃堕棿") + private String alarmTime; + + /** + * 鎶ヨ鍐呭鎻忚堪 + */ + @Schema(description = "鎶ヨ鍐呭鎻忚堪") + private String alarmDescription; + + /** + * 缁忓害 + */ + @Schema(description = "缁忓害") + private double longitude; + + /** + * 绾害 + */ + @Schema(description = "绾害") + private double latitude; + + /** + * 鎶ヨ绫诲瀷, + * 鎶ヨ鏂瑰紡涓�2鏃�,涓嶆惡甯� AlarmType涓洪粯璁ょ殑鎶ヨ璁惧鎶ヨ, + * 鎼哄甫 AlarmType鍙栧�煎強瀵瑰簲鎶ヨ绫诲瀷濡備笅: + * 1-瑙嗛涓㈠け鎶ヨ; + * 2-璁惧闃叉媶鎶ヨ; + * 3-瀛樺偍璁惧纾佺洏婊℃姤璀�; + * 4-璁惧楂樻俯鎶ヨ; + * 5-璁惧浣庢俯鎶ヨ銆� + * 鎶ヨ鏂瑰紡涓�5鏃�,鍙栧�煎涓�: + * 1-浜哄伐瑙嗛鎶ヨ; + * 2-杩愬姩鐩爣妫�娴嬫姤璀�; + * 3-閬楃暀鐗╂娴嬫姤璀�; + * 4-鐗╀綋绉婚櫎妫�娴嬫姤璀�; + * 5-缁婄嚎妫�娴嬫姤璀�; + * 6-鍏ヤ镜妫�娴嬫姤璀�; + * 7-閫嗚妫�娴嬫姤璀�; + * 8-寰樺緤妫�娴嬫姤璀�; + * 9-娴侀噺缁熻鎶ヨ; + * 10-瀵嗗害妫�娴嬫姤璀�; + * 11-瑙嗛寮傚父妫�娴嬫姤璀�; + * 12-蹇�熺Щ鍔ㄦ姤璀︺�� + * 鎶ヨ鏂瑰紡涓�6鏃�,鍙栧�间笅: + * 1-瀛樺偍璁惧纾佺洏鏁呴殰鎶ヨ; + * 2-瀛樺偍璁惧椋庢墖鏁呴殰鎶ヨ銆� + */ + @Schema(description = "鎶ヨ绫诲瀷") + private String alarmType; + + @Schema(description = "鍒涘缓鏃堕棿") + private String createTime; + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getAlarmPriority() { + return alarmPriority; + } + + public void setAlarmPriority(String alarmPriority) { + this.alarmPriority = alarmPriority; + } + + public String getAlarmMethod() { + return alarmMethod; + } + + public void setAlarmMethod(String alarmMethod) { + this.alarmMethod = alarmMethod; + } + + public String getAlarmTime() { + return alarmTime; + } + + public void setAlarmTime(String alarmTime) { + this.alarmTime = alarmTime; + } + + public String getAlarmDescription() { + return alarmDescription; + } + + public void setAlarmDescription(String alarmDescription) { + this.alarmDescription = alarmDescription; + } + + public double getLongitude() { + return longitude; + } + + public void setLongitude(double longitude) { + this.longitude = longitude; + } + + public double getLatitude() { + return latitude; + } + + public void setLatitude(double latitude) { + this.latitude = latitude; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getChannelId() { + return channelId; + } + + public void setChannelId(String channelId) { + this.channelId = channelId; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GBStringMsgParser.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GBStringMsgParser.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStringMsgParserFactory.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStringMsgParserFactory.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/HandlerCatchData.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/HandlerCatchData.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/HomePositionRequest.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/HomePositionRequest.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Host.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Host.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/InviteStreamCallback.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/InviteStreamCallback.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/InviteStreamInfo.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/InviteStreamInfo.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/InviteStreamType.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/InviteStreamType.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/MobilePosition.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/MobilePosition.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatformCatch.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatformCatch.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformCatalog.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformCatalog.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformGbStream.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformRegister.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PlatformRegister.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PresetQuerySipReq.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/PresetQuerySipReq.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordInfo.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordInfo.java old mode 100644 new mode 100755 index 7ff5283..5b524cf --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordInfo.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordInfo.java @@ -1,102 +1,102 @@ -package com.genersoft.iot.vmp.gb28181.bean; - - -import io.swagger.v3.oas.annotations.media.Schema; - -import java.time.Instant; -import java.util.List; - -/** - * @description:璁惧褰曞儚淇℃伅bean - * @author: swwheihei - * @date: 2020骞�5鏈�8鏃� 涓嬪崍2:05:56 - */ -@Schema(description = "璁惧褰曞儚鏌ヨ缁撴灉淇℃伅") -public class RecordInfo { - - @Schema(description = "璁惧缂栧彿") - private String deviceId; - - @Schema(description = "閫氶亾缂栧彿") - private String channelId; - - @Schema(description = "鍛戒护搴忓垪鍙�") - private String sn; - - @Schema(description = "璁惧鍚嶇О") - private String name; - - @Schema(description = "鍒楄〃鎬绘暟") - private int sumNum; - - private int count; - - private Instant lastTime; - - @Schema(description = "") - private List<RecordItem> recordList; - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getSumNum() { - return sumNum; - } - - public void setSumNum(int sumNum) { - this.sumNum = sumNum; - } - - public List<RecordItem> getRecordList() { - return recordList; - } - - public void setRecordList(List<RecordItem> recordList) { - this.recordList = recordList; - } - - public String getChannelId() { - return channelId; - } - - public void setChannelId(String channelId) { - this.channelId = channelId; - } - - public String getSn() { - return sn; - } - - public void setSn(String sn) { - this.sn = sn; - } - - public Instant getLastTime() { - return lastTime; - } - - public void setLastTime(Instant lastTime) { - this.lastTime = lastTime; - } - - public int getCount() { - return count; - } - - public void setCount(int count) { - this.count = count; - } -} +package com.genersoft.iot.vmp.gb28181.bean; + + +import io.swagger.v3.oas.annotations.media.Schema; + +import java.time.Instant; +import java.util.List; + +/** + * @description:璁惧褰曞儚淇℃伅bean + * @author: swwheihei + * @date: 2020骞�5鏈�8鏃� 涓嬪崍2:05:56 + */ +@Schema(description = "璁惧褰曞儚鏌ヨ缁撴灉淇℃伅") +public class RecordInfo { + + @Schema(description = "璁惧缂栧彿") + private String deviceId; + + @Schema(description = "閫氶亾缂栧彿") + private String channelId; + + @Schema(description = "鍛戒护搴忓垪鍙�") + private String sn; + + @Schema(description = "璁惧鍚嶇О") + private String name; + + @Schema(description = "鍒楄〃鎬绘暟") + private int sumNum; + + private int count; + + private Instant lastTime; + + @Schema(description = "") + private List<RecordItem> recordList; + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getSumNum() { + return sumNum; + } + + public void setSumNum(int sumNum) { + this.sumNum = sumNum; + } + + public List<RecordItem> getRecordList() { + return recordList; + } + + public void setRecordList(List<RecordItem> recordList) { + this.recordList = recordList; + } + + public String getChannelId() { + return channelId; + } + + public void setChannelId(String channelId) { + this.channelId = channelId; + } + + public String getSn() { + return sn; + } + + public void setSn(String sn) { + this.sn = sn; + } + + public Instant getLastTime() { + return lastTime; + } + + public void setLastTime(Instant lastTime) { + this.lastTime = lastTime; + } + + public int getCount() { + return count; + } + + public void setCount(int count) { + this.count = count; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java old mode 100644 new mode 100755 index 07e559c..452e138 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java @@ -1,144 +1,144 @@ -package com.genersoft.iot.vmp.gb28181.bean; - - -import com.genersoft.iot.vmp.utils.DateUtil; -import io.swagger.v3.oas.annotations.media.Schema; -import org.jetbrains.annotations.NotNull; - -import java.time.Instant; -import java.time.temporal.TemporalAccessor; - -/** - * @description:璁惧褰曞儚bean - * @author: swwheihei - * @date: 2020骞�5鏈�8鏃� 涓嬪崍2:06:54 - */ -@Schema(description = "璁惧褰曞儚璇︽儏") -public class RecordItem implements Comparable<RecordItem>{ - - @Schema(description = "璁惧缂栧彿") - private String deviceId; - - @Schema(description = "鍚嶇О") - private String name; - - @Schema(description = "鏂囦欢璺緞鍚� (鍙��)") - private String filePath; - - @Schema(description = "褰曞儚鏂囦欢澶у皬,鍗曚綅:Byte(鍙��)") - private String fileSize; - - @Schema(description = "褰曞儚鍦板潃(鍙��)") - private String address; - - @Schema(description = "褰曞儚寮�濮嬫椂闂�(鍙��)") - private String startTime; - - @Schema(description = "褰曞儚缁撴潫鏃堕棿(鍙��)") - private String endTime; - - @Schema(description = "淇濆瘑灞炴��(蹇呴��)缂虹渷涓�0;0:涓嶆秹瀵�,1:娑夊瘑") - private int secrecy; - - @Schema(description = "褰曞儚浜х敓绫诲瀷(鍙��)time鎴朼larm 鎴� manua") - private String type; - - @Schema(description = "褰曞儚瑙﹀彂鑰匢D(鍙��)") - private String recorderId; - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getFilePath() { - return filePath; - } - - public void setFilePath(String filePath) { - this.filePath = filePath; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getStartTime() { - return startTime; - } - - public void setStartTime(String startTime) { - this.startTime = startTime; - } - - public String getEndTime() { - return endTime; - } - - public void setEndTime(String endTime) { - this.endTime = endTime; - } - - public int getSecrecy() { - return secrecy; - } - - public void setSecrecy(int secrecy) { - this.secrecy = secrecy; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getRecorderId() { - return recorderId; - } - - public void setRecorderId(String recorderId) { - this.recorderId = recorderId; - } - - public String getFileSize() { - return fileSize; - } - - public void setFileSize(String fileSize) { - this.fileSize = fileSize; - } - - @Override - public int compareTo(@NotNull RecordItem recordItem) { - TemporalAccessor startTimeNow = DateUtil.formatter.parse(startTime); - TemporalAccessor startTimeParam = DateUtil.formatter.parse(recordItem.getStartTime()); - Instant startTimeParamInstant = Instant.from(startTimeParam); - Instant startTimeNowInstant = Instant.from(startTimeNow); - if (startTimeNowInstant.equals(startTimeParamInstant)) { - return 0; - }else if (Instant.from(startTimeParam).isAfter(Instant.from(startTimeNow)) ) { - return -1; - }else { - return 1; - } - - } -} +package com.genersoft.iot.vmp.gb28181.bean; + + +import com.genersoft.iot.vmp.utils.DateUtil; +import io.swagger.v3.oas.annotations.media.Schema; +import org.jetbrains.annotations.NotNull; + +import java.time.Instant; +import java.time.temporal.TemporalAccessor; + +/** + * @description:璁惧褰曞儚bean + * @author: swwheihei + * @date: 2020骞�5鏈�8鏃� 涓嬪崍2:06:54 + */ +@Schema(description = "璁惧褰曞儚璇︽儏") +public class RecordItem implements Comparable<RecordItem>{ + + @Schema(description = "璁惧缂栧彿") + private String deviceId; + + @Schema(description = "鍚嶇О") + private String name; + + @Schema(description = "鏂囦欢璺緞鍚� (鍙��)") + private String filePath; + + @Schema(description = "褰曞儚鏂囦欢澶у皬,鍗曚綅:Byte(鍙��)") + private String fileSize; + + @Schema(description = "褰曞儚鍦板潃(鍙��)") + private String address; + + @Schema(description = "褰曞儚寮�濮嬫椂闂�(鍙��)") + private String startTime; + + @Schema(description = "褰曞儚缁撴潫鏃堕棿(鍙��)") + private String endTime; + + @Schema(description = "淇濆瘑灞炴��(蹇呴��)缂虹渷涓�0;0:涓嶆秹瀵�,1:娑夊瘑") + private int secrecy; + + @Schema(description = "褰曞儚浜х敓绫诲瀷(鍙��)time鎴朼larm 鎴� manua") + private String type; + + @Schema(description = "褰曞儚瑙﹀彂鑰匢D(鍙��)") + private String recorderId; + + public String getDeviceId() { + return deviceId; + } + + public void setDeviceId(String deviceId) { + this.deviceId = deviceId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public int getSecrecy() { + return secrecy; + } + + public void setSecrecy(int secrecy) { + this.secrecy = secrecy; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getRecorderId() { + return recorderId; + } + + public void setRecorderId(String recorderId) { + this.recorderId = recorderId; + } + + public String getFileSize() { + return fileSize; + } + + public void setFileSize(String fileSize) { + this.fileSize = fileSize; + } + + @Override + public int compareTo(@NotNull RecordItem recordItem) { + TemporalAccessor startTimeNow = DateUtil.formatter.parse(startTime); + TemporalAccessor startTimeParam = DateUtil.formatter.parse(recordItem.getStartTime()); + Instant startTimeParamInstant = Instant.from(startTimeParam); + Instant startTimeNowInstant = Instant.from(startTimeNow); + if (startTimeNowInstant.equals(startTimeParamInstant)) { + return 0; + }else if (Instant.from(startTimeParam).isAfter(Instant.from(startTimeNow)) ) { + return -1; + }else { + return 1; + } + + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/RemoteAddressInfo.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/RemoteAddressInfo.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SDPInfo.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SDPInfo.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SendRtpItem.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SendRtpItem.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SipMsgInfo.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SipMsgInfo.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SipTransactionInfo.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SipTransactionInfo.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SsrcTransaction.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SsrcTransaction.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 index ba905b5..d385d9a --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeHolder.java @@ -2,12 +2,9 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants; import com.genersoft.iot.vmp.conf.DynamicTask; +import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask; import com.genersoft.iot.vmp.gb28181.task.impl.MobilePositionSubscribeHandlerTask; -import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; -import com.genersoft.iot.vmp.service.IPlatformService; -import com.genersoft.iot.vmp.storager.IRedisCatchStorage; -import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -23,6 +20,9 @@ @Autowired private DynamicTask dynamicTask; + + @Autowired + private UserSetting userSetting; private final String taskOverduePrefix = "subscribe_overdue_"; @@ -58,7 +58,7 @@ public void putMobilePositionSubscribe(String platformId, SubscribeInfo subscribeInfo) { mobilePositionMap.put(platformId, subscribeInfo); - String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + "MobilePosition_" + platformId; + String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "MobilePosition_" + platformId; // 娣诲姞浠诲姟澶勭悊GPS瀹氭椂鎺ㄩ�� dynamicTask.startCron(key, new MobilePositionSubscribeHandlerTask(platformId), subscribeInfo.getGpsInterval() * 1000); @@ -76,7 +76,7 @@ public void removeMobilePositionSubscribe(String platformId) { mobilePositionMap.remove(platformId); - String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + "MobilePosition_" + platformId; + String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "MobilePosition_" + platformId; // 缁撴潫浠诲姟澶勭悊GPS瀹氭椂鎺ㄩ�� dynamicTask.stop(key); String taskOverdueKey = taskOverduePrefix + "MobilePosition_" + platformId; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeInfo.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SubscribeInfo.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SyncStatus.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/SyncStatus.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/conf/DefaultProperties.java b/src/main/java/com/genersoft/iot/vmp/gb28181/conf/DefaultProperties.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/conf/ServerLoggerImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/conf/ServerLoggerImpl.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/conf/StackLoggerImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/conf/StackLoggerImpl.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 index 26ababd..d56e744 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java @@ -1,118 +1,118 @@ -package com.genersoft.iot.vmp.gb28181.event; - -import com.genersoft.iot.vmp.gb28181.bean.*; -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.media.zlm.event.ZLMOfflineEvent; -import com.genersoft.iot.vmp.media.zlm.event.ZLMOnlineEvent; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationEventPublisher; -import org.springframework.stereotype.Component; - -import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEvent; - -import javax.sip.TimeoutEvent; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * @description:Event浜嬩欢閫氱煡鎺ㄩ�佸櫒锛屾敮鎸佹帹閫佸湪绾夸簨浠躲�佺绾夸簨浠� - * @author: swwheihei - * @date: 2020骞�5鏈�6鏃� 涓婂崍11:30:50 - */ -@Component -public class EventPublisher { - - @Autowired - private ApplicationEventPublisher applicationEventPublisher; - - /** - * 璁惧鎶ヨ浜嬩欢 - * @param deviceAlarm - */ - public void deviceAlarmEventPublish(DeviceAlarm deviceAlarm) { - AlarmEvent alarmEvent = new AlarmEvent(this); - alarmEvent.setAlarmInfo(deviceAlarm); - applicationEventPublisher.publishEvent(alarmEvent); - } - - public void zlmOfflineEventPublish(String mediaServerId){ - ZLMOfflineEvent outEvent = new ZLMOfflineEvent(this); - outEvent.setMediaServerId(mediaServerId); - applicationEventPublisher.publishEvent(outEvent); - } - - public void zlmOnlineEventPublish(String mediaServerId) { - ZLMOnlineEvent outEvent = new ZLMOnlineEvent(this); - outEvent.setMediaServerId(mediaServerId); - applicationEventPublisher.publishEvent(outEvent); - } - - - public void catalogEventPublish(String platformId, DeviceChannel deviceChannel, String type) { - List<DeviceChannel> deviceChannelList = new ArrayList<>(); - deviceChannelList.add(deviceChannel); - catalogEventPublish(platformId, deviceChannelList, type); - } - - - public void requestTimeOut(TimeoutEvent timeoutEvent) { - RequestTimeoutEvent requestTimeoutEvent = new RequestTimeoutEvent(this); - requestTimeoutEvent.setTimeoutEvent(timeoutEvent); - applicationEventPublisher.publishEvent(requestTimeoutEvent); - } - - - /** - * - * @param platformId - * @param deviceChannels - * @param type - */ - public void catalogEventPublish(String platformId, List<DeviceChannel> deviceChannels, String type) { - CatalogEvent outEvent = new CatalogEvent(this); - List<DeviceChannel> channels = new ArrayList<>(); - if (deviceChannels.size() > 1) { - // 鏁版嵁鍘婚噸 - Set<String> gbIdSet = new HashSet<>(); - for (DeviceChannel deviceChannel : deviceChannels) { - if (!gbIdSet.contains(deviceChannel.getChannelId())) { - gbIdSet.add(deviceChannel.getChannelId()); - channels.add(deviceChannel); - } - } - }else { - channels = deviceChannels; - } - outEvent.setDeviceChannels(channels); - outEvent.setType(type); - outEvent.setPlatformId(platformId); - applicationEventPublisher.publishEvent(outEvent); - } - - - public void catalogEventPublishForStream(String platformId, List<GbStream> gbStreams, String type) { - CatalogEvent outEvent = new CatalogEvent(this); - outEvent.setGbStreams(gbStreams); - outEvent.setType(type); - outEvent.setPlatformId(platformId); - applicationEventPublisher.publishEvent(outEvent); - } - - - public void catalogEventPublishForStream(String platformId, GbStream gbStream, String type) { - List<GbStream> gbStreamList = new ArrayList<>(); - gbStreamList.add(gbStream); - catalogEventPublishForStream(platformId, gbStreamList, type); - } - - public void recordEndEventPush(RecordInfo recordInfo) { - RecordEndEvent outEvent = new RecordEndEvent(this); - outEvent.setRecordInfo(recordInfo); - applicationEventPublisher.publishEvent(outEvent); - } - -} +package com.genersoft.iot.vmp.gb28181.event; + +import com.genersoft.iot.vmp.gb28181.bean.*; +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.media.zlm.event.ZLMOfflineEvent; +import com.genersoft.iot.vmp.media.zlm.event.ZLMOnlineEvent; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.stereotype.Component; + +import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEvent; + +import javax.sip.TimeoutEvent; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * @description:Event浜嬩欢閫氱煡鎺ㄩ�佸櫒锛屾敮鎸佹帹閫佸湪绾夸簨浠躲�佺绾夸簨浠� + * @author: swwheihei + * @date: 2020骞�5鏈�6鏃� 涓婂崍11:30:50 + */ +@Component +public class EventPublisher { + + @Autowired + private ApplicationEventPublisher applicationEventPublisher; + + /** + * 璁惧鎶ヨ浜嬩欢 + * @param deviceAlarm + */ + public void deviceAlarmEventPublish(DeviceAlarm deviceAlarm) { + AlarmEvent alarmEvent = new AlarmEvent(this); + alarmEvent.setAlarmInfo(deviceAlarm); + applicationEventPublisher.publishEvent(alarmEvent); + } + + public void zlmOfflineEventPublish(String mediaServerId){ + ZLMOfflineEvent outEvent = new ZLMOfflineEvent(this); + outEvent.setMediaServerId(mediaServerId); + applicationEventPublisher.publishEvent(outEvent); + } + + public void zlmOnlineEventPublish(String mediaServerId) { + ZLMOnlineEvent outEvent = new ZLMOnlineEvent(this); + outEvent.setMediaServerId(mediaServerId); + applicationEventPublisher.publishEvent(outEvent); + } + + + public void catalogEventPublish(String platformId, DeviceChannel deviceChannel, String type) { + List<DeviceChannel> deviceChannelList = new ArrayList<>(); + deviceChannelList.add(deviceChannel); + catalogEventPublish(platformId, deviceChannelList, type); + } + + + public void requestTimeOut(TimeoutEvent timeoutEvent) { + RequestTimeoutEvent requestTimeoutEvent = new RequestTimeoutEvent(this); + requestTimeoutEvent.setTimeoutEvent(timeoutEvent); + applicationEventPublisher.publishEvent(requestTimeoutEvent); + } + + + /** + * + * @param platformId + * @param deviceChannels + * @param type + */ + public void catalogEventPublish(String platformId, List<DeviceChannel> deviceChannels, String type) { + CatalogEvent outEvent = new CatalogEvent(this); + List<DeviceChannel> channels = new ArrayList<>(); + if (deviceChannels.size() > 1) { + // 鏁版嵁鍘婚噸 + Set<String> gbIdSet = new HashSet<>(); + for (DeviceChannel deviceChannel : deviceChannels) { + if (!gbIdSet.contains(deviceChannel.getChannelId())) { + gbIdSet.add(deviceChannel.getChannelId()); + channels.add(deviceChannel); + } + } + }else { + channels = deviceChannels; + } + outEvent.setDeviceChannels(channels); + outEvent.setType(type); + outEvent.setPlatformId(platformId); + applicationEventPublisher.publishEvent(outEvent); + } + + + public void catalogEventPublishForStream(String platformId, List<GbStream> gbStreams, String type) { + CatalogEvent outEvent = new CatalogEvent(this); + outEvent.setGbStreams(gbStreams); + outEvent.setType(type); + outEvent.setPlatformId(platformId); + applicationEventPublisher.publishEvent(outEvent); + } + + + public void catalogEventPublishForStream(String platformId, GbStream gbStream, String type) { + List<GbStream> gbStreamList = new ArrayList<>(); + gbStreamList.add(gbStream); + catalogEventPublishForStream(platformId, gbStreamList, type); + } + + public void recordEndEventPush(RecordInfo recordInfo) { + RecordEndEvent outEvent = new RecordEndEvent(this); + outEvent.setRecordInfo(recordInfo); + applicationEventPublisher.publishEvent(outEvent); + } + +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/SipSubscribe.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/SipSubscribe.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/alarm/AlarmEvent.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/alarm/AlarmEvent.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/alarm/AlarmEventListener.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/alarm/AlarmEventListener.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/device/RequestTimeoutEvent.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/device/RequestTimeoutEvent.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/device/RequestTimeoutEventImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/device/RequestTimeoutEventImpl.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/record/RecordEndEvent.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/record/RecordEndEvent.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/record/RecordEndEventListener.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/record/RecordEndEventListener.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEvent.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEvent.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java b/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/session/RecordDataCatch.java b/src/main/java/com/genersoft/iot/vmp/gb28181/session/RecordDataCatch.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/session/SSRCFactory.java b/src/main/java/com/genersoft/iot/vmp/gb28181/session/SSRCFactory.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 index a5da018..c46e38a --- a/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java @@ -1,139 +1,139 @@ -package com.genersoft.iot.vmp.gb28181.session; - -import com.genersoft.iot.vmp.common.InviteSessionType; -import com.genersoft.iot.vmp.common.VideoManagerConstants; -import com.genersoft.iot.vmp.conf.UserSetting; -import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo; -import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; -import com.genersoft.iot.vmp.utils.JsonUtil; -import com.genersoft.iot.vmp.utils.redis.RedisUtil; -import gov.nist.javax.sip.message.SIPResponse; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Component; -import org.springframework.util.ObjectUtils; - -import java.util.ArrayList; -import java.util.List; - -/** - * 瑙嗛娴乻ession绠$悊鍣紝绠$悊瑙嗛棰勮銆侀瑙堝洖鏀剧殑閫氫俊鍙ユ焺 - */ -@Component -public class VideoStreamSessionManager { - - @Autowired - private UserSetting userSetting; - - @Autowired - private RedisTemplate<Object, Object> redisTemplate; - - /** - * 娣诲姞涓�涓偣鎾�/鍥炴斁鐨勪簨鍔′俊鎭� - * 鍚庣画鍙互閫氳繃娴両d/callID - * @param deviceId 璁惧ID - * @param channelId 閫氶亾ID - * @param callId 涓�娆¤姹傜殑CallID - * @param stream 娴佸悕绉� - * @param mediaServerId 鎵�浣跨敤鐨勬祦濯掍綋ID - * @param response 鍥炲 - */ - public void put(String deviceId, String channelId, String callId, String stream, String ssrc, String mediaServerId, SIPResponse response, InviteSessionType type){ - SsrcTransaction ssrcTransaction = new SsrcTransaction(); - ssrcTransaction.setDeviceId(deviceId); - ssrcTransaction.setChannelId(channelId); - ssrcTransaction.setStream(stream); - ssrcTransaction.setSipTransactionInfo(new SipTransactionInfo(response)); - ssrcTransaction.setCallId(callId); - ssrcTransaction.setSsrc(ssrc); - ssrcTransaction.setMediaServerId(mediaServerId); - ssrcTransaction.setType(type); - - redisTemplate.opsForValue().set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() - + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); - } - - public SsrcTransaction getSsrcTransaction(String deviceId, String channelId, String callId, String stream){ - - if (ObjectUtils.isEmpty(deviceId)) { - deviceId ="*"; - } - if (ObjectUtils.isEmpty(channelId)) { - channelId ="*"; - } - if (ObjectUtils.isEmpty(callId)) { - callId ="*"; - } - if (ObjectUtils.isEmpty(stream)) { - 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; - } - return (SsrcTransaction)redisTemplate.opsForValue().get(scanResult.get(0)); - } - - public List<SsrcTransaction> getSsrcTransactionForAll(String deviceId, String channelId, String callId, String stream){ - if (ObjectUtils.isEmpty(deviceId)) { - deviceId ="*"; - } - if (ObjectUtils.isEmpty(channelId)) { - channelId ="*"; - } - if (ObjectUtils.isEmpty(callId)) { - callId ="*"; - } - if (ObjectUtils.isEmpty(stream)) { - 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; - } - List<SsrcTransaction> result = new ArrayList<>(); - for (Object keyObj : scanResult) { - result.add((SsrcTransaction)redisTemplate.opsForValue().get(keyObj)); - } - return result; - } - - public String getMediaServerId(String deviceId, String channelId, String stream){ - SsrcTransaction ssrcTransaction = getSsrcTransaction(deviceId, channelId, null, stream); - if (ssrcTransaction == null) { - return null; - } - return ssrcTransaction.getMediaServerId(); - } - - public String getSSRC(String deviceId, String channelId, String stream){ - SsrcTransaction ssrcTransaction = getSsrcTransaction(deviceId, channelId, null, stream); - if (ssrcTransaction == null) { - return null; - } - return ssrcTransaction.getSsrc(); - } - - public void remove(String deviceId, String channelId, String stream) { - SsrcTransaction ssrcTransaction = getSsrcTransaction(deviceId, channelId, null, stream); - if (ssrcTransaction == null) { - return; - } - redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" - + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream()); - } - - - public List<SsrcTransaction> getAllSsrc() { - List<Object> ssrcTransactionKeys = RedisUtil.scan(redisTemplate, String.format("%s_*_*_*_*", VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX+ userSetting.getServerId())); - List<SsrcTransaction> result= new ArrayList<>(); - for (Object ssrcTransactionKey : ssrcTransactionKeys) { - String key = (String) ssrcTransactionKey; - SsrcTransaction ssrcTransaction = JsonUtil.redisJsonToObject(redisTemplate, key, SsrcTransaction.class); - result.add(ssrcTransaction); - } - return result; - } -} +package com.genersoft.iot.vmp.gb28181.session; + +import com.genersoft.iot.vmp.common.InviteSessionType; +import com.genersoft.iot.vmp.common.VideoManagerConstants; +import com.genersoft.iot.vmp.conf.UserSetting; +import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo; +import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; +import com.genersoft.iot.vmp.utils.JsonUtil; +import com.genersoft.iot.vmp.utils.redis.RedisUtil; +import gov.nist.javax.sip.message.SIPResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * 瑙嗛娴乻ession绠$悊鍣紝绠$悊瑙嗛棰勮銆侀瑙堝洖鏀剧殑閫氫俊鍙ユ焺 + */ +@Component +public class VideoStreamSessionManager { + + @Autowired + private UserSetting userSetting; + + @Autowired + private RedisTemplate<Object, Object> redisTemplate; + + /** + * 娣诲姞涓�涓偣鎾�/鍥炴斁鐨勪簨鍔′俊鎭� + * 鍚庣画鍙互閫氳繃娴両d/callID + * @param deviceId 璁惧ID + * @param channelId 閫氶亾ID + * @param callId 涓�娆¤姹傜殑CallID + * @param stream 娴佸悕绉� + * @param mediaServerId 鎵�浣跨敤鐨勬祦濯掍綋ID + * @param response 鍥炲 + */ + public void put(String deviceId, String channelId, String callId, String stream, String ssrc, String mediaServerId, SIPResponse response, InviteSessionType type){ + SsrcTransaction ssrcTransaction = new SsrcTransaction(); + ssrcTransaction.setDeviceId(deviceId); + ssrcTransaction.setChannelId(channelId); + ssrcTransaction.setStream(stream); + ssrcTransaction.setSipTransactionInfo(new SipTransactionInfo(response)); + ssrcTransaction.setCallId(callId); + ssrcTransaction.setSsrc(ssrc); + ssrcTransaction.setMediaServerId(mediaServerId); + ssrcTransaction.setType(type); + + redisTemplate.opsForValue().set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); + } + + public SsrcTransaction getSsrcTransaction(String deviceId, String channelId, String callId, String stream){ + + if (ObjectUtils.isEmpty(deviceId)) { + deviceId ="*"; + } + if (ObjectUtils.isEmpty(channelId)) { + channelId ="*"; + } + if (ObjectUtils.isEmpty(callId)) { + callId ="*"; + } + if (ObjectUtils.isEmpty(stream)) { + 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; + } + return (SsrcTransaction)redisTemplate.opsForValue().get(scanResult.get(0)); + } + + public List<SsrcTransaction> getSsrcTransactionForAll(String deviceId, String channelId, String callId, String stream){ + if (ObjectUtils.isEmpty(deviceId)) { + deviceId ="*"; + } + if (ObjectUtils.isEmpty(channelId)) { + channelId ="*"; + } + if (ObjectUtils.isEmpty(callId)) { + callId ="*"; + } + if (ObjectUtils.isEmpty(stream)) { + 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; + } + List<SsrcTransaction> result = new ArrayList<>(); + for (Object keyObj : scanResult) { + result.add((SsrcTransaction)redisTemplate.opsForValue().get(keyObj)); + } + return result; + } + + public String getMediaServerId(String deviceId, String channelId, String stream){ + SsrcTransaction ssrcTransaction = getSsrcTransaction(deviceId, channelId, null, stream); + if (ssrcTransaction == null) { + return null; + } + return ssrcTransaction.getMediaServerId(); + } + + public String getSSRC(String deviceId, String channelId, String stream){ + SsrcTransaction ssrcTransaction = getSsrcTransaction(deviceId, channelId, null, stream); + if (ssrcTransaction == null) { + return null; + } + return ssrcTransaction.getSsrc(); + } + + public void remove(String deviceId, String channelId, String stream) { + SsrcTransaction ssrcTransaction = getSsrcTransaction(deviceId, channelId, null, stream); + if (ssrcTransaction == null) { + return; + } + redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream()); + } + + + public List<SsrcTransaction> getAllSsrc() { + List<Object> ssrcTransactionKeys = RedisUtil.scan(redisTemplate, String.format("%s_*_*_*_*", VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX+ userSetting.getServerId())); + List<SsrcTransaction> result= new ArrayList<>(); + for (Object ssrcTransactionKey : ssrcTransactionKeys) { + String key = (String) ssrcTransactionKey; + SsrcTransaction ssrcTransaction = JsonUtil.redisJsonToObject(redisTemplate, key, SsrcTransaction.class); + result.add(ssrcTransaction); + } + return result; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/task/ISubscribeTask.java b/src/main/java/com/genersoft/iot/vmp/gb28181/task/ISubscribeTask.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/task/SipRunner.java b/src/main/java/com/genersoft/iot/vmp/gb28181/task/SipRunner.java old mode 100644 new mode 100755 index 4b92443..199979e --- a/src/main/java/com/genersoft/iot/vmp/gb28181/task/SipRunner.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/task/SipRunner.java @@ -12,13 +12,19 @@ import com.genersoft.iot.vmp.service.IDeviceService; import com.genersoft.iot.vmp.service.IMediaServerService; import com.genersoft.iot.vmp.service.IPlatformService; +import com.genersoft.iot.vmp.service.impl.PlatformServiceImpl; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; 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.boot.CommandLineRunner; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; +import javax.sip.InvalidArgumentException; +import javax.sip.SipException; +import java.text.ParseException; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -58,6 +64,8 @@ @Autowired private ISIPCommanderForPlatform commanderForPlatform; + + private final static Logger logger = LoggerFactory.getLogger(PlatformServiceImpl.class); @Override public void run(String... args) throws Exception { @@ -110,7 +118,11 @@ if (jsonObject != null && jsonObject.getInteger("code") == 0) { ParentPlatform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId()); if (platform != null) { - commanderForPlatform.streamByeCmd(platform, sendRtpItem.getCallId()); + try { + commanderForPlatform.streamByeCmd(platform, sendRtpItem.getCallId()); + } catch (InvalidArgumentException | ParseException | SipException e) { + logger.error("[鍛戒护鍙戦�佸け璐 鍥芥爣绾ц仈 鍙戦�丅YE: {}", e.getMessage()); + } } } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/CatalogSubscribeTask.java b/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/CatalogSubscribeTask.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeHandlerTask.java b/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeHandlerTask.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeTask.java b/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeTask.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/DeferredResultHolder.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/DeferredResultHolder.java old mode 100644 new mode 100755 index 8a62182..8d0ed7f --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/DeferredResultHolder.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/DeferredResultHolder.java @@ -1,160 +1,160 @@ -package com.genersoft.iot.vmp.gb28181.transmit.callback; - -import com.genersoft.iot.vmp.vmanager.bean.DeferredResultEx; -import org.springframework.stereotype.Component; -import org.springframework.util.ObjectUtils; -import org.springframework.web.context.request.async.DeferredResult; - -import java.util.Collection; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -/** - * @description: 寮傛璇锋眰澶勭悊 - * @author: swwheihei - * @date: 2020骞�5鏈�8鏃� 涓嬪崍7:59:05 - */ -@SuppressWarnings(value = {"rawtypes", "unchecked"}) -@Component -public class DeferredResultHolder { - - public static final String CALLBACK_CMD_DEVICESTATUS = "CALLBACK_DEVICESTATUS"; - - public static final String CALLBACK_CMD_DEVICEINFO = "CALLBACK_DEVICEINFO"; - - public static final String CALLBACK_CMD_DEVICECONTROL = "CALLBACK_DEVICECONTROL"; - - public static final String CALLBACK_CMD_DEVICECONFIG = "CALLBACK_DEVICECONFIG"; - - public static final String CALLBACK_CMD_CONFIGDOWNLOAD = "CALLBACK_CONFIGDOWNLOAD"; - - public static final String CALLBACK_CMD_CATALOG = "CALLBACK_CATALOG"; - - public static final String CALLBACK_CMD_RECORDINFO = "CALLBACK_RECORDINFO"; - - public static final String CALLBACK_CMD_PLAY = "CALLBACK_PLAY"; - - public static final String CALLBACK_CMD_PLAYBACK = "CALLBACK_PLAYBACK"; - - public static final String CALLBACK_CMD_DOWNLOAD = "CALLBACK_DOWNLOAD"; - - public static final String CALLBACK_CMD_PROXY = "CALLBACK_PROXY"; - - public static final String CALLBACK_CMD_STOP = "CALLBACK_STOP"; - - public static final String UPLOAD_FILE_CHANNEL = "UPLOAD_FILE_CHANNEL"; - - public static final String CALLBACK_CMD_MOBILE_POSITION = "CALLBACK_CMD_MOBILE_POSITION"; - - public static final String CALLBACK_CMD_PRESETQUERY = "CALLBACK_PRESETQUERY"; - - public static final String CALLBACK_CMD_ALARM = "CALLBACK_ALARM"; - - public static final String CALLBACK_CMD_BROADCAST = "CALLBACK_BROADCAST"; - - public static final String CALLBACK_CMD_SNAP= "CALLBACK_SNAP"; - - private Map<String, Map<String, DeferredResultEx>> map = new ConcurrentHashMap<>(); - - - public void put(String key, String id, DeferredResultEx result) { - Map<String, DeferredResultEx> deferredResultMap = map.get(key); - if (deferredResultMap == null) { - deferredResultMap = new ConcurrentHashMap<>(); - map.put(key, deferredResultMap); - } - deferredResultMap.put(id, result); - } - - public void put(String key, String id, DeferredResult result) { - Map<String, DeferredResultEx> deferredResultMap = map.get(key); - if (deferredResultMap == null) { - deferredResultMap = new ConcurrentHashMap<>(); - map.put(key, deferredResultMap); - } - deferredResultMap.put(id, new DeferredResultEx(result)); - } - - public DeferredResultEx get(String key, String id) { - Map<String, DeferredResultEx> deferredResultMap = map.get(key); - if (deferredResultMap == null || ObjectUtils.isEmpty(id)) { - return null; - } - return deferredResultMap.get(id); - } - - public Collection<DeferredResultEx> getAllByKey(String key) { - Map<String, DeferredResultEx> deferredResultMap = map.get(key); - if (deferredResultMap == null) { - return null; - } - return deferredResultMap.values(); - } - - public boolean exist(String key, String id){ - if (key == null) { - return false; - } - Map<String, DeferredResultEx> deferredResultMap = map.get(key); - if (id == null) { - return deferredResultMap != null; - }else { - return deferredResultMap != null && deferredResultMap.get(id) != null; - } - } - - /** - * 閲婃斁鍗曚釜璇锋眰 - * @param msg - */ - public void invokeResult(RequestMessage msg) { - Map<String, DeferredResultEx> deferredResultMap = map.get(msg.getKey()); - if (deferredResultMap == null) { - return; - } - DeferredResultEx result = deferredResultMap.get(msg.getId()); - if (result == null) { - return; - } - result.getDeferredResult().setResult(msg.getData()); - deferredResultMap.remove(msg.getId()); - if (deferredResultMap.size() == 0) { - map.remove(msg.getKey()); - } - } - - /** - * 閲婃斁鎵�鏈夌殑璇锋眰 - * @param msg - */ - public void invokeAllResult(RequestMessage msg) { - Map<String, DeferredResultEx> deferredResultMap = map.get(msg.getKey()); - if (deferredResultMap == null) { - return; - } - synchronized (this) { - deferredResultMap = map.get(msg.getKey()); - if (deferredResultMap == null) { - return; - } - Set<String> ids = deferredResultMap.keySet(); - for (String id : ids) { - DeferredResultEx result = deferredResultMap.get(id); - if (result == null) { - return; - } - if (result.getFilter() != null) { - Object handler = result.getFilter().handler(msg.getData()); - result.getDeferredResult().setResult(handler); - }else { - result.getDeferredResult().setResult(msg.getData()); - } - - } - map.remove(msg.getKey()); - } - } - - -} +package com.genersoft.iot.vmp.gb28181.transmit.callback; + +import com.genersoft.iot.vmp.vmanager.bean.DeferredResultEx; +import org.springframework.stereotype.Component; +import org.springframework.util.ObjectUtils; +import org.springframework.web.context.request.async.DeferredResult; + +import java.util.Collection; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @description: 寮傛璇锋眰澶勭悊 + * @author: swwheihei + * @date: 2020骞�5鏈�8鏃� 涓嬪崍7:59:05 + */ +@SuppressWarnings(value = {"rawtypes", "unchecked"}) +@Component +public class DeferredResultHolder { + + public static final String CALLBACK_CMD_DEVICESTATUS = "CALLBACK_DEVICESTATUS"; + + public static final String CALLBACK_CMD_DEVICEINFO = "CALLBACK_DEVICEINFO"; + + public static final String CALLBACK_CMD_DEVICECONTROL = "CALLBACK_DEVICECONTROL"; + + public static final String CALLBACK_CMD_DEVICECONFIG = "CALLBACK_DEVICECONFIG"; + + public static final String CALLBACK_CMD_CONFIGDOWNLOAD = "CALLBACK_CONFIGDOWNLOAD"; + + public static final String CALLBACK_CMD_CATALOG = "CALLBACK_CATALOG"; + + public static final String CALLBACK_CMD_RECORDINFO = "CALLBACK_RECORDINFO"; + + public static final String CALLBACK_CMD_PLAY = "CALLBACK_PLAY"; + + public static final String CALLBACK_CMD_PLAYBACK = "CALLBACK_PLAYBACK"; + + public static final String CALLBACK_CMD_DOWNLOAD = "CALLBACK_DOWNLOAD"; + + public static final String CALLBACK_CMD_PROXY = "CALLBACK_PROXY"; + + public static final String CALLBACK_CMD_STOP = "CALLBACK_STOP"; + + public static final String UPLOAD_FILE_CHANNEL = "UPLOAD_FILE_CHANNEL"; + + public static final String CALLBACK_CMD_MOBILE_POSITION = "CALLBACK_CMD_MOBILE_POSITION"; + + public static final String CALLBACK_CMD_PRESETQUERY = "CALLBACK_PRESETQUERY"; + + public static final String CALLBACK_CMD_ALARM = "CALLBACK_ALARM"; + + public static final String CALLBACK_CMD_BROADCAST = "CALLBACK_BROADCAST"; + + public static final String CALLBACK_CMD_SNAP= "CALLBACK_SNAP"; + + private Map<String, Map<String, DeferredResultEx>> map = new ConcurrentHashMap<>(); + + + public void put(String key, String id, DeferredResultEx result) { + Map<String, DeferredResultEx> deferredResultMap = map.get(key); + if (deferredResultMap == null) { + deferredResultMap = new ConcurrentHashMap<>(); + map.put(key, deferredResultMap); + } + deferredResultMap.put(id, result); + } + + public void put(String key, String id, DeferredResult result) { + Map<String, DeferredResultEx> deferredResultMap = map.get(key); + if (deferredResultMap == null) { + deferredResultMap = new ConcurrentHashMap<>(); + map.put(key, deferredResultMap); + } + deferredResultMap.put(id, new DeferredResultEx(result)); + } + + public DeferredResultEx get(String key, String id) { + Map<String, DeferredResultEx> deferredResultMap = map.get(key); + if (deferredResultMap == null || ObjectUtils.isEmpty(id)) { + return null; + } + return deferredResultMap.get(id); + } + + public Collection<DeferredResultEx> getAllByKey(String key) { + Map<String, DeferredResultEx> deferredResultMap = map.get(key); + if (deferredResultMap == null) { + return null; + } + return deferredResultMap.values(); + } + + public boolean exist(String key, String id){ + if (key == null) { + return false; + } + Map<String, DeferredResultEx> deferredResultMap = map.get(key); + if (id == null) { + return deferredResultMap != null; + }else { + return deferredResultMap != null && deferredResultMap.get(id) != null; + } + } + + /** + * 閲婃斁鍗曚釜璇锋眰 + * @param msg + */ + public void invokeResult(RequestMessage msg) { + Map<String, DeferredResultEx> deferredResultMap = map.get(msg.getKey()); + if (deferredResultMap == null) { + return; + } + DeferredResultEx result = deferredResultMap.get(msg.getId()); + if (result == null) { + return; + } + result.getDeferredResult().setResult(msg.getData()); + deferredResultMap.remove(msg.getId()); + if (deferredResultMap.size() == 0) { + map.remove(msg.getKey()); + } + } + + /** + * 閲婃斁鎵�鏈夌殑璇锋眰 + * @param msg + */ + public void invokeAllResult(RequestMessage msg) { + Map<String, DeferredResultEx> deferredResultMap = map.get(msg.getKey()); + if (deferredResultMap == null) { + return; + } + synchronized (this) { + deferredResultMap = map.get(msg.getKey()); + if (deferredResultMap == null) { + return; + } + Set<String> ids = deferredResultMap.keySet(); + for (String id : ids) { + DeferredResultEx result = deferredResultMap.get(id); + if (result == null) { + return; + } + if (result.getFilter() != null) { + Object handler = result.getFilter().handler(msg.getData()); + result.getDeferredResult().setResult(handler); + }else { + result.getDeferredResult().setResult(msg.getData()); + } + + } + map.remove(msg.getKey()); + } + } + + +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/RequestMessage.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/RequestMessage.java old mode 100644 new mode 100755 index 42ae577..f4e2d20 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/RequestMessage.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/callback/RequestMessage.java @@ -1,39 +1,39 @@ -package com.genersoft.iot.vmp.gb28181.transmit.callback; - -/** - * @description: 璇锋眰淇℃伅瀹氫箟 - * @author: swwheihei - * @date: 2020骞�5鏈�8鏃� 涓嬪崍1:09:18 - */ -public class RequestMessage { - - private String id; - - private String key; - - private Object data; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public void setKey(String key) { - this.key = key; - } - - public String getKey() { - return key; - } - - public Object getData() { - return data; - } - - public void setData(Object data) { - this.data = data; - } -} +package com.genersoft.iot.vmp.gb28181.transmit.callback; + +/** + * @description: 璇锋眰淇℃伅瀹氫箟 + * @author: swwheihei + * @date: 2020骞�5鏈�8鏃� 涓嬪崍1:09:18 + */ +public class RequestMessage { + + private String id; + + private String key; + + private Object data; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public void setKey(String key) { + this.key = key; + } + + public String getKey() { + return key; + } + + public Object getData() { + return data; + } + + public void setData(Object data) { + this.data = data; + } +} 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 old mode 100644 new mode 100755 index 80ea890..9c68336 --- 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 @@ -1,364 +1,364 @@ -package com.genersoft.iot.vmp.gb28181.transmit.cmd; - -import com.genersoft.iot.vmp.common.StreamInfo; -import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; -import com.genersoft.iot.vmp.gb28181.bean.*; -import com.genersoft.iot.vmp.gb28181.bean.Device; -import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; -import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; -import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; -import com.genersoft.iot.vmp.service.bean.SSRCInfo; -import gov.nist.javax.sip.message.SIPRequest; - -import javax.sip.InvalidArgumentException; -import javax.sip.SipException; -import java.text.ParseException; - -/** - * @description:璁惧鑳藉姏鎺ュ彛锛岀敤浜庡畾涔夎澶囩殑鎺у埗銆佹煡璇㈣兘鍔� - * @author: swwheihei - * @date: 2020骞�5鏈�3鏃� 涓嬪崍9:16:34 - */ -public interface ISIPCommander { - - /** - * 浜戝彴鏂瑰悜鏀炬帶鍒讹紝浣跨敤閰嶇疆鏂囦欢涓殑榛樿闀滃ご绉诲姩閫熷害 - * - * @param device 鎺у埗璁惧 - * @param channelId 棰勮閫氶亾 - * @param leftRight 闀滃ご宸︾Щ鍙崇Щ 0:鍋滄 1:宸︾Щ 2:鍙崇Щ - * @param upDown 闀滃ご涓婄Щ涓嬬Щ 0:鍋滄 1:涓婄Щ 2:涓嬬Щ - */ - void ptzdirectCmd(Device device,String channelId,int leftRight, int upDown) throws InvalidArgumentException, ParseException, SipException; - - /** - * 浜戝彴鏂瑰悜鏀炬帶鍒� - * - * @param device 鎺у埗璁惧 - * @param channelId 棰勮閫氶亾 - * @param leftRight 闀滃ご宸︾Щ鍙崇Щ 0:鍋滄 1:宸︾Щ 2:鍙崇Щ - * @param upDown 闀滃ご涓婄Щ涓嬬Щ 0:鍋滄 1:涓婄Щ 2:涓嬬Щ - * @param moveSpeed 闀滃ご绉诲姩閫熷害 - */ - void ptzdirectCmd(Device device,String channelId,int leftRight, int upDown, int moveSpeed) throws InvalidArgumentException, ParseException, SipException; - - /** - * 浜戝彴缂╂斁鎺у埗锛屼娇鐢ㄩ厤缃枃浠朵腑鐨勯粯璁ら暅澶寸缉鏀鹃�熷害 - * - * @param device 鎺у埗璁惧 - * @param channelId 棰勮閫氶亾 - * @param inOut 闀滃ご鏀惧ぇ缂╁皬 0:鍋滄 1:缂╁皬 2:鏀惧ぇ - */ - void ptzZoomCmd(Device device,String channelId,int inOut) throws InvalidArgumentException, ParseException, SipException; - - /** - * 浜戝彴缂╂斁鎺у埗 - * - * @param device 鎺у埗璁惧 - * @param channelId 棰勮閫氶亾 - * @param inOut 闀滃ご鏀惧ぇ缂╁皬 0:鍋滄 1:缂╁皬 2:鏀惧ぇ - */ - void ptzZoomCmd(Device device,String channelId,int inOut, int moveSpeed) throws InvalidArgumentException, ParseException, SipException; - - /** - * 浜戝彴鎺у埗锛屾敮鎸佹柟鍚戜笌缂╂斁鎺у埗 - * - * @param device 鎺у埗璁惧 - * @param channelId 棰勮閫氶亾 - * @param leftRight 闀滃ご宸︾Щ鍙崇Щ 0:鍋滄 1:宸︾Щ 2:鍙崇Щ - * @param upDown 闀滃ご涓婄Щ涓嬬Щ 0:鍋滄 1:涓婄Щ 2:涓嬬Щ - * @param inOut 闀滃ご鏀惧ぇ缂╁皬 0:鍋滄 1:缂╁皬 2:鏀惧ぇ - * @param moveSpeed 闀滃ご绉诲姩閫熷害 - * @param zoomSpeed 闀滃ご缂╂斁閫熷害 - */ - void ptzCmd(Device device,String channelId,int leftRight, int upDown, int inOut, int moveSpeed, int zoomSpeed) throws InvalidArgumentException, SipException, ParseException; - - /** - * 鍓嶇鎺у埗锛屽寘鎷琍TZ鎸囦护銆丗I鎸囦护銆侀缃綅鎸囦护銆佸贰鑸寚浠ゃ�佹壂鎻忔寚浠ゅ拰杈呭姪寮�鍏虫寚浠� - * - * @param device 鎺у埗璁惧 - * @param channelId 棰勮閫氶亾 - * @param cmdCode 鎸囦护鐮� - * @param parameter1 鏁版嵁1 - * @param parameter2 鏁版嵁2 - * @param combineCode2 缁勫悎鐮�2 - */ - void frontEndCmd(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combineCode2) throws SipException, InvalidArgumentException, ParseException; - - /** - * 鍓嶇鎺у埗鎸囦护锛堢敤浜庤浆鍙戜笂绾ф寚浠わ級 - * @param device 鎺у埗璁惧 - * @param channelId 棰勮閫氶亾 - * @param cmdString 鍓嶇鎺у埗鎸囦护涓� - */ - void fronEndCmd(Device device, String channelId, String cmdString, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException; - - /** - * 璇锋眰棰勮瑙嗛娴� - * @param device 瑙嗛璁惧 - * @param channelId 棰勮閫氶亾 - */ - void playStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, ZlmHttpHookSubscribe.Event event, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; - - /** - * 璇锋眰鍥炴斁瑙嗛娴� - * - * @param device 瑙嗛璁惧 - * @param channelId 棰勮閫氶亾 - * @param startTime 寮�濮嬫椂闂�,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss - * @param endTime 缁撴潫鏃堕棿,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss - */ - void playbackStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInf, Device device, String channelId, String startTime, String endTime,ZlmHttpHookSubscribe.Event event, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; - - /** - * 璇锋眰鍘嗗彶濯掍綋涓嬭浇 - * - * @param device 瑙嗛璁惧 - * @param channelId 棰勮閫氶亾 - * @param startTime 寮�濮嬫椂闂�,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss - * @param endTime 缁撴潫鏃堕棿,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss - * @param downloadSpeed 涓嬭浇鍊嶉�熷弬鏁� - */ - void downloadStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, - String startTime, String endTime, int downloadSpeed, ZlmHttpHookSubscribe.Event hookEvent, - SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException; - - - /** - * 瑙嗛娴佸仠姝� - */ - void streamByeCmd(Device device, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException; - - void talkStreamCmd(MediaServerItem mediaServerItem, SendRtpItem sendRtpItem, Device device, String channelId, String callId, ZlmHttpHookSubscribe.Event event, ZlmHttpHookSubscribe.Event eventForPush, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; - - - void streamByeCmd(Device device, String channelId, String stream, String callId) throws InvalidArgumentException, ParseException, SipException, SsrcTransactionNotFoundException; - - void streamByeCmd(Device device, String channelId, SipTransactionInfo sipTransactionInfo, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException; - - /** - * 鍥炴斁鏆傚仠 - */ - void playPauseCmd(Device device, StreamInfo streamInfo) throws InvalidArgumentException, ParseException, SipException; - - /** - * 鍥炴斁鎭㈠ - */ - void playResumeCmd(Device device, StreamInfo streamInfo) throws InvalidArgumentException, ParseException, SipException; - - /** - * 鍥炴斁鎷栧姩鎾斁 - */ - void playSeekCmd(Device device, StreamInfo streamInfo, long seekTime) throws InvalidArgumentException, ParseException, SipException; - - /** - * 鍥炴斁鍊嶉�熸挱鏀� - */ - void playSpeedCmd(Device device, StreamInfo streamInfo, Double speed) throws InvalidArgumentException, ParseException, SipException; - - /** - * 鍥炴斁鎺у埗 - * @param device - * @param streamInfo - * @param content - */ - void playbackControlCmd(Device device, StreamInfo streamInfo, String content,SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws SipException, InvalidArgumentException, ParseException; - - - /** - * /** - * 璇煶骞挎挱 - * - * @param device 瑙嗛璁惧 - */ - void audioBroadcastCmd(Device device, String channelId, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; - - /** - * 闊宠棰戝綍鍍忔帶鍒� - * - * @param device 瑙嗛璁惧 - * @param channelId 棰勮閫氶亾 - * @param recordCmdStr 褰曞儚鍛戒护锛歊ecord / StopRecord - */ - void recordCmd(Device device, String channelId, String recordCmdStr, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException; - - /** - * 杩滅▼鍚姩鎺у埗鍛戒护 - * - * @param device 瑙嗛璁惧 - */ - void teleBootCmd(Device device) throws InvalidArgumentException, SipException, ParseException; - - /** - * 鎶ヨ甯冮槻/鎾ら槻鍛戒护 - * - * @param device 瑙嗛璁惧 - */ - void guardCmd(Device device, String guardCmdStr, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException; - - /** - * 鎶ヨ澶嶄綅鍛戒护 - * - * @param device 瑙嗛璁惧 - * @param alarmMethod 鎶ヨ鏂瑰紡锛堝彲閫夛級 - * @param alarmType 鎶ヨ绫诲瀷锛堝彲閫夛級 - */ - void alarmCmd(Device device, String alarmMethod, String alarmType, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException; - - /** - * 寮哄埗鍏抽敭甯у懡浠�,璁惧鏀跺埌姝ゅ懡浠ゅ簲绔嬪埢鍙戦�佷竴涓狪DR甯� - * - * @param device 瑙嗛璁惧 - * @param channelId 棰勮閫氶亾 - */ - void iFrameCmd(Device device, String channelId) throws InvalidArgumentException, SipException, ParseException; - - /** - * 鐪嬪畧浣嶆帶鍒跺懡浠� - * - * @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; - - /** - * 璁惧閰嶇疆鍛戒护 - * - * @param device 瑙嗛璁惧 - */ - void deviceConfigCmd(Device device); - - /** - * 璁惧閰嶇疆鍛戒护锛歜asicParam - * - * @param device 瑙嗛璁惧 - * @param channelId 閫氶亾缂栫爜锛堝彲閫夛級 - * @param name 璁惧/閫氶亾鍚嶇О锛堝彲閫夛級 - * @param expiration 娉ㄥ唽杩囨湡鏃堕棿锛堝彲閫夛級 - * @param heartBeatInterval 蹇冭烦闂撮殧鏃堕棿锛堝彲閫夛級 - * @param heartBeatCount 蹇冭烦瓒呮椂娆℃暟锛堝彲閫夛級 - */ - void deviceBasicConfigCmd(Device device, String channelId, String name, String expiration, String heartBeatInterval, String heartBeatCount, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; - - /** - * 鏌ヨ璁惧鐘舵�� - * - * @param device 瑙嗛璁惧 - */ - void deviceStatusQuery(Device device, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; - - /** - * 鏌ヨ璁惧淇℃伅 - * - * @param device 瑙嗛璁惧 - * @return - */ - void deviceInfoQuery(Device device) throws InvalidArgumentException, SipException, ParseException; - - /** - * 鏌ヨ鐩綍鍒楄〃 - * - * @param device 瑙嗛璁惧 - */ - void catalogQuery(Device device, int sn, SipSubscribe.Event errorEvent) throws SipException, InvalidArgumentException, ParseException; - - /** - * 鏌ヨ褰曞儚淇℃伅 - * - * @param device 瑙嗛璁惧 - * @param startTime 寮�濮嬫椂闂�,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss - * @param endTime 缁撴潫鏃堕棿,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss - * @param sn - */ - void recordInfoQuery(Device device, String channelId, String startTime, String endTime, int sn, Integer Secrecy, String type, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; - - /** - * 鏌ヨ鎶ヨ淇℃伅 - * - * @param device 瑙嗛璁惧 - * @param startPriority 鎶ヨ璧峰绾у埆锛堝彲閫夛級 - * @param endPriority 鎶ヨ缁堟绾у埆锛堝彲閫夛級 - * @param alarmMethod 鎶ヨ鏂瑰紡鏉′欢锛堝彲閫夛級 - * @param alarmType 鎶ヨ绫诲瀷 - * @param startTime 鎶ヨ鍙戠敓璧峰鏃堕棿锛堝彲閫夛級 - * @param endTime 鎶ヨ鍙戠敓缁堟鏃堕棿锛堝彲閫夛級 - * @return true = 鍛戒护鍙戦�佹垚鍔� - */ - void alarmInfoQuery(Device device, String startPriority, String endPriority, String alarmMethod, - String alarmType, String startTime, String endTime, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; - - /** - * 鏌ヨ璁惧閰嶇疆 - * - * @param device 瑙嗛璁惧 - * @param channelId 閫氶亾缂栫爜锛堝彲閫夛級 - * @param configType 閰嶇疆绫诲瀷锛� - */ - void deviceConfigQuery(Device device, String channelId, String configType, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; - - /** - * 鏌ヨ璁惧棰勭疆浣嶇疆 - * - * @param device 瑙嗛璁惧 - */ - void presetQuery(Device device, String channelId, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; - - /** - * 鏌ヨ绉诲姩璁惧浣嶇疆鏁版嵁 - * - * @param device 瑙嗛璁惧 - */ - void mobilePostitionQuery(Device device, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; - - /** - * 璁㈤槄銆佸彇娑堣闃呯Щ鍔ㄤ綅缃� - * - * @param device 瑙嗛璁惧 - * @return true = 鍛戒护鍙戦�佹垚鍔� - */ - SIPRequest mobilePositionSubscribe(Device device, SIPRequest request, SipSubscribe.Event okEvent , SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; - - /** - * 璁㈤槄銆佸彇娑堣闃呮姤璀︿俊鎭� - * @param device 瑙嗛璁惧 - * @param expires 璁㈤槄杩囨湡鏃堕棿锛�0 = 鍙栨秷璁㈤槄锛� - * @param startPriority 鎶ヨ璧峰绾у埆锛堝彲閫夛級 - * @param endPriority 鎶ヨ缁堟绾у埆锛堝彲閫夛級 - * @param alarmType 鎶ヨ绫诲瀷 - * @param startTime 鎶ヨ鍙戠敓璧峰鏃堕棿锛堝彲閫夛級 - * @param endTime 鎶ヨ鍙戠敓缁堟鏃堕棿锛堝彲閫夛級 - * @return true = 鍛戒护鍙戦�佹垚鍔� - */ - void alarmSubscribe(Device device, int expires, String startPriority, String endPriority, String alarmMethod, String startTime, String endTime) throws InvalidArgumentException, SipException, ParseException; - - /** - * 璁㈤槄銆佸彇娑堣闃呯洰褰曚俊鎭� - * @param device 瑙嗛璁惧 - * @return true = 鍛戒护鍙戦�佹垚鍔� - */ - SIPRequest catalogSubscribe(Device device, SIPRequest request, SipSubscribe.Event okEvent ,SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; - - /** - * 鎷夋鎺у埗鍛戒护 - * - * @param device 鎺у埗璁惧 - * @param channelId 閫氶亾id - * @param cmdString 鍓嶇鎺у埗鎸囦护涓� - */ - void dragZoomCmd(Device device, String channelId, String cmdString) throws InvalidArgumentException, SipException, ParseException; - - - /** - * 鍚戣澶囧彂閫佹姤璀OTIFY娑堟伅锛� 鐢ㄤ簬浜掕仈缁撴瀯涓嬶紝姝ゆ椂灏嗚澶囧綋鎴愪竴涓钩绾у钩鍙扮湅寰� - * @param device 璁惧 - * @param deviceAlarm 鎶ヨ淇℃伅淇℃伅 - * @return - */ - void sendAlarmMessage(Device device, DeviceAlarm deviceAlarm) throws InvalidArgumentException, SipException, ParseException; - - -} +package com.genersoft.iot.vmp.gb28181.transmit.cmd; + +import com.genersoft.iot.vmp.common.StreamInfo; +import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; +import com.genersoft.iot.vmp.gb28181.bean.*; +import com.genersoft.iot.vmp.gb28181.bean.Device; +import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; +import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; +import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; +import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; +import com.genersoft.iot.vmp.service.bean.SSRCInfo; +import gov.nist.javax.sip.message.SIPRequest; + +import javax.sip.InvalidArgumentException; +import javax.sip.SipException; +import java.text.ParseException; + +/** + * @description:璁惧鑳藉姏鎺ュ彛锛岀敤浜庡畾涔夎澶囩殑鎺у埗銆佹煡璇㈣兘鍔� + * @author: swwheihei + * @date: 2020骞�5鏈�3鏃� 涓嬪崍9:16:34 + */ +public interface ISIPCommander { + + /** + * 浜戝彴鏂瑰悜鏀炬帶鍒讹紝浣跨敤閰嶇疆鏂囦欢涓殑榛樿闀滃ご绉诲姩閫熷害 + * + * @param device 鎺у埗璁惧 + * @param channelId 棰勮閫氶亾 + * @param leftRight 闀滃ご宸︾Щ鍙崇Щ 0:鍋滄 1:宸︾Щ 2:鍙崇Щ + * @param upDown 闀滃ご涓婄Щ涓嬬Щ 0:鍋滄 1:涓婄Щ 2:涓嬬Щ + */ + void ptzdirectCmd(Device device,String channelId,int leftRight, int upDown) throws InvalidArgumentException, ParseException, SipException; + + /** + * 浜戝彴鏂瑰悜鏀炬帶鍒� + * + * @param device 鎺у埗璁惧 + * @param channelId 棰勮閫氶亾 + * @param leftRight 闀滃ご宸︾Щ鍙崇Щ 0:鍋滄 1:宸︾Щ 2:鍙崇Щ + * @param upDown 闀滃ご涓婄Щ涓嬬Щ 0:鍋滄 1:涓婄Щ 2:涓嬬Щ + * @param moveSpeed 闀滃ご绉诲姩閫熷害 + */ + void ptzdirectCmd(Device device,String channelId,int leftRight, int upDown, int moveSpeed) throws InvalidArgumentException, ParseException, SipException; + + /** + * 浜戝彴缂╂斁鎺у埗锛屼娇鐢ㄩ厤缃枃浠朵腑鐨勯粯璁ら暅澶寸缉鏀鹃�熷害 + * + * @param device 鎺у埗璁惧 + * @param channelId 棰勮閫氶亾 + * @param inOut 闀滃ご鏀惧ぇ缂╁皬 0:鍋滄 1:缂╁皬 2:鏀惧ぇ + */ + void ptzZoomCmd(Device device,String channelId,int inOut) throws InvalidArgumentException, ParseException, SipException; + + /** + * 浜戝彴缂╂斁鎺у埗 + * + * @param device 鎺у埗璁惧 + * @param channelId 棰勮閫氶亾 + * @param inOut 闀滃ご鏀惧ぇ缂╁皬 0:鍋滄 1:缂╁皬 2:鏀惧ぇ + */ + void ptzZoomCmd(Device device,String channelId,int inOut, int moveSpeed) throws InvalidArgumentException, ParseException, SipException; + + /** + * 浜戝彴鎺у埗锛屾敮鎸佹柟鍚戜笌缂╂斁鎺у埗 + * + * @param device 鎺у埗璁惧 + * @param channelId 棰勮閫氶亾 + * @param leftRight 闀滃ご宸︾Щ鍙崇Щ 0:鍋滄 1:宸︾Щ 2:鍙崇Щ + * @param upDown 闀滃ご涓婄Щ涓嬬Щ 0:鍋滄 1:涓婄Щ 2:涓嬬Щ + * @param inOut 闀滃ご鏀惧ぇ缂╁皬 0:鍋滄 1:缂╁皬 2:鏀惧ぇ + * @param moveSpeed 闀滃ご绉诲姩閫熷害 + * @param zoomSpeed 闀滃ご缂╂斁閫熷害 + */ + void ptzCmd(Device device,String channelId,int leftRight, int upDown, int inOut, int moveSpeed, int zoomSpeed) throws InvalidArgumentException, SipException, ParseException; + + /** + * 鍓嶇鎺у埗锛屽寘鎷琍TZ鎸囦护銆丗I鎸囦护銆侀缃綅鎸囦护銆佸贰鑸寚浠ゃ�佹壂鎻忔寚浠ゅ拰杈呭姪寮�鍏虫寚浠� + * + * @param device 鎺у埗璁惧 + * @param channelId 棰勮閫氶亾 + * @param cmdCode 鎸囦护鐮� + * @param parameter1 鏁版嵁1 + * @param parameter2 鏁版嵁2 + * @param combineCode2 缁勫悎鐮�2 + */ + void frontEndCmd(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combineCode2) throws SipException, InvalidArgumentException, ParseException; + + /** + * 鍓嶇鎺у埗鎸囦护锛堢敤浜庤浆鍙戜笂绾ф寚浠わ級 + * @param device 鎺у埗璁惧 + * @param channelId 棰勮閫氶亾 + * @param cmdString 鍓嶇鎺у埗鎸囦护涓� + */ + void fronEndCmd(Device device, String channelId, String cmdString, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException; + + /** + * 璇锋眰棰勮瑙嗛娴� + * @param device 瑙嗛璁惧 + * @param channelId 棰勮閫氶亾 + */ + void playStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, ZlmHttpHookSubscribe.Event event, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; + + /** + * 璇锋眰鍥炴斁瑙嗛娴� + * + * @param device 瑙嗛璁惧 + * @param channelId 棰勮閫氶亾 + * @param startTime 寮�濮嬫椂闂�,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss + * @param endTime 缁撴潫鏃堕棿,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss + */ + void playbackStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInf, Device device, String channelId, String startTime, String endTime,ZlmHttpHookSubscribe.Event event, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; + + /** + * 璇锋眰鍘嗗彶濯掍綋涓嬭浇 + * + * @param device 瑙嗛璁惧 + * @param channelId 棰勮閫氶亾 + * @param startTime 寮�濮嬫椂闂�,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss + * @param endTime 缁撴潫鏃堕棿,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss + * @param downloadSpeed 涓嬭浇鍊嶉�熷弬鏁� + */ + void downloadStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, + String startTime, String endTime, int downloadSpeed, ZlmHttpHookSubscribe.Event hookEvent, + SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException; + + + /** + * 瑙嗛娴佸仠姝� + */ + void streamByeCmd(Device device, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException; + + void talkStreamCmd(MediaServerItem mediaServerItem, SendRtpItem sendRtpItem, Device device, String channelId, String callId, ZlmHttpHookSubscribe.Event event, ZlmHttpHookSubscribe.Event eventForPush, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; + + + void streamByeCmd(Device device, String channelId, String stream, String callId) throws InvalidArgumentException, ParseException, SipException, SsrcTransactionNotFoundException; + + void streamByeCmd(Device device, String channelId, SipTransactionInfo sipTransactionInfo, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException; + + /** + * 鍥炴斁鏆傚仠 + */ + void playPauseCmd(Device device, StreamInfo streamInfo) throws InvalidArgumentException, ParseException, SipException; + + /** + * 鍥炴斁鎭㈠ + */ + void playResumeCmd(Device device, StreamInfo streamInfo) throws InvalidArgumentException, ParseException, SipException; + + /** + * 鍥炴斁鎷栧姩鎾斁 + */ + void playSeekCmd(Device device, StreamInfo streamInfo, long seekTime) throws InvalidArgumentException, ParseException, SipException; + + /** + * 鍥炴斁鍊嶉�熸挱鏀� + */ + void playSpeedCmd(Device device, StreamInfo streamInfo, Double speed) throws InvalidArgumentException, ParseException, SipException; + + /** + * 鍥炴斁鎺у埗 + * @param device + * @param streamInfo + * @param content + */ + void playbackControlCmd(Device device, StreamInfo streamInfo, String content,SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws SipException, InvalidArgumentException, ParseException; + + + /** + * /** + * 璇煶骞挎挱 + * + * @param device 瑙嗛璁惧 + */ + void audioBroadcastCmd(Device device, String channelId, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; + + /** + * 闊宠棰戝綍鍍忔帶鍒� + * + * @param device 瑙嗛璁惧 + * @param channelId 棰勮閫氶亾 + * @param recordCmdStr 褰曞儚鍛戒护锛歊ecord / StopRecord + */ + void recordCmd(Device device, String channelId, String recordCmdStr, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException; + + /** + * 杩滅▼鍚姩鎺у埗鍛戒护 + * + * @param device 瑙嗛璁惧 + */ + void teleBootCmd(Device device) throws InvalidArgumentException, SipException, ParseException; + + /** + * 鎶ヨ甯冮槻/鎾ら槻鍛戒护 + * + * @param device 瑙嗛璁惧 + */ + void guardCmd(Device device, String guardCmdStr, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException; + + /** + * 鎶ヨ澶嶄綅鍛戒护 + * + * @param device 瑙嗛璁惧 + * @param alarmMethod 鎶ヨ鏂瑰紡锛堝彲閫夛級 + * @param alarmType 鎶ヨ绫诲瀷锛堝彲閫夛級 + */ + void alarmCmd(Device device, String alarmMethod, String alarmType, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException; + + /** + * 寮哄埗鍏抽敭甯у懡浠�,璁惧鏀跺埌姝ゅ懡浠ゅ簲绔嬪埢鍙戦�佷竴涓狪DR甯� + * + * @param device 瑙嗛璁惧 + * @param channelId 棰勮閫氶亾 + */ + void iFrameCmd(Device device, String channelId) throws InvalidArgumentException, SipException, ParseException; + + /** + * 鐪嬪畧浣嶆帶鍒跺懡浠� + * + * @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; + + /** + * 璁惧閰嶇疆鍛戒护 + * + * @param device 瑙嗛璁惧 + */ + void deviceConfigCmd(Device device); + + /** + * 璁惧閰嶇疆鍛戒护锛歜asicParam + * + * @param device 瑙嗛璁惧 + * @param channelId 閫氶亾缂栫爜锛堝彲閫夛級 + * @param name 璁惧/閫氶亾鍚嶇О锛堝彲閫夛級 + * @param expiration 娉ㄥ唽杩囨湡鏃堕棿锛堝彲閫夛級 + * @param heartBeatInterval 蹇冭烦闂撮殧鏃堕棿锛堝彲閫夛級 + * @param heartBeatCount 蹇冭烦瓒呮椂娆℃暟锛堝彲閫夛級 + */ + void deviceBasicConfigCmd(Device device, String channelId, String name, String expiration, String heartBeatInterval, String heartBeatCount, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; + + /** + * 鏌ヨ璁惧鐘舵�� + * + * @param device 瑙嗛璁惧 + */ + void deviceStatusQuery(Device device, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; + + /** + * 鏌ヨ璁惧淇℃伅 + * + * @param device 瑙嗛璁惧 + * @return + */ + void deviceInfoQuery(Device device) throws InvalidArgumentException, SipException, ParseException; + + /** + * 鏌ヨ鐩綍鍒楄〃 + * + * @param device 瑙嗛璁惧 + */ + void catalogQuery(Device device, int sn, SipSubscribe.Event errorEvent) throws SipException, InvalidArgumentException, ParseException; + + /** + * 鏌ヨ褰曞儚淇℃伅 + * + * @param device 瑙嗛璁惧 + * @param startTime 寮�濮嬫椂闂�,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss + * @param endTime 缁撴潫鏃堕棿,鏍煎紡瑕佹眰锛歽yyy-MM-dd HH:mm:ss + * @param sn + */ + void recordInfoQuery(Device device, String channelId, String startTime, String endTime, int sn, Integer Secrecy, String type, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; + + /** + * 鏌ヨ鎶ヨ淇℃伅 + * + * @param device 瑙嗛璁惧 + * @param startPriority 鎶ヨ璧峰绾у埆锛堝彲閫夛級 + * @param endPriority 鎶ヨ缁堟绾у埆锛堝彲閫夛級 + * @param alarmMethod 鎶ヨ鏂瑰紡鏉′欢锛堝彲閫夛級 + * @param alarmType 鎶ヨ绫诲瀷 + * @param startTime 鎶ヨ鍙戠敓璧峰鏃堕棿锛堝彲閫夛級 + * @param endTime 鎶ヨ鍙戠敓缁堟鏃堕棿锛堝彲閫夛級 + * @return true = 鍛戒护鍙戦�佹垚鍔� + */ + void alarmInfoQuery(Device device, String startPriority, String endPriority, String alarmMethod, + String alarmType, String startTime, String endTime, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; + + /** + * 鏌ヨ璁惧閰嶇疆 + * + * @param device 瑙嗛璁惧 + * @param channelId 閫氶亾缂栫爜锛堝彲閫夛級 + * @param configType 閰嶇疆绫诲瀷锛� + */ + void deviceConfigQuery(Device device, String channelId, String configType, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; + + /** + * 鏌ヨ璁惧棰勭疆浣嶇疆 + * + * @param device 瑙嗛璁惧 + */ + void presetQuery(Device device, String channelId, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; + + /** + * 鏌ヨ绉诲姩璁惧浣嶇疆鏁版嵁 + * + * @param device 瑙嗛璁惧 + */ + void mobilePostitionQuery(Device device, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; + + /** + * 璁㈤槄銆佸彇娑堣闃呯Щ鍔ㄤ綅缃� + * + * @param device 瑙嗛璁惧 + * @return true = 鍛戒护鍙戦�佹垚鍔� + */ + SIPRequest mobilePositionSubscribe(Device device, SIPRequest request, SipSubscribe.Event okEvent , SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; + + /** + * 璁㈤槄銆佸彇娑堣闃呮姤璀︿俊鎭� + * @param device 瑙嗛璁惧 + * @param expires 璁㈤槄杩囨湡鏃堕棿锛�0 = 鍙栨秷璁㈤槄锛� + * @param startPriority 鎶ヨ璧峰绾у埆锛堝彲閫夛級 + * @param endPriority 鎶ヨ缁堟绾у埆锛堝彲閫夛級 + * @param alarmType 鎶ヨ绫诲瀷 + * @param startTime 鎶ヨ鍙戠敓璧峰鏃堕棿锛堝彲閫夛級 + * @param endTime 鎶ヨ鍙戠敓缁堟鏃堕棿锛堝彲閫夛級 + * @return true = 鍛戒护鍙戦�佹垚鍔� + */ + void alarmSubscribe(Device device, int expires, String startPriority, String endPriority, String alarmMethod, String startTime, String endTime) throws InvalidArgumentException, SipException, ParseException; + + /** + * 璁㈤槄銆佸彇娑堣闃呯洰褰曚俊鎭� + * @param device 瑙嗛璁惧 + * @return true = 鍛戒护鍙戦�佹垚鍔� + */ + SIPRequest catalogSubscribe(Device device, SIPRequest request, SipSubscribe.Event okEvent ,SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException; + + /** + * 鎷夋鎺у埗鍛戒护 + * + * @param device 鎺у埗璁惧 + * @param channelId 閫氶亾id + * @param cmdString 鍓嶇鎺у埗鎸囦护涓� + */ + void dragZoomCmd(Device device, String channelId, String cmdString) throws InvalidArgumentException, SipException, ParseException; + + + /** + * 鍚戣澶囧彂閫佹姤璀OTIFY娑堟伅锛� 鐢ㄤ簬浜掕仈缁撴瀯涓嬶紝姝ゆ椂灏嗚澶囧綋鎴愪竴涓钩绾у钩鍙扮湅寰� + * @param device 璁惧 + * @param deviceAlarm 鎶ヨ淇℃伅淇℃伅 + * @return + */ + void sendAlarmMessage(Device device, DeviceAlarm deviceAlarm) throws InvalidArgumentException, SipException, ParseException; + + +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommanderForPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommanderForPlatform.java old mode 100644 new mode 100755 index 407ccc5..a412a6c --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommanderForPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommanderForPlatform.java @@ -25,6 +25,8 @@ void register(ParentPlatform parentPlatform, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException; void register(ParentPlatform parentPlatform, SipTransactionInfo sipTransactionInfo, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException; + + void register(ParentPlatform parentPlatform, SipTransactionInfo sipTransactionInfo, WWWAuthenticateHeader www, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent, boolean isRegister) throws SipException, InvalidArgumentException, ParseException; /** diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/ISIPRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/ISIPRequestProcessor.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/SIPRequestProcessorParent.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/SIPRequestProcessorParent.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/CancelRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/CancelRequestProcessor.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 index 08eb71a..30a27be --- 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 @@ -21,10 +21,7 @@ import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; import com.genersoft.iot.vmp.media.zlm.dto.*; import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; -import com.genersoft.iot.vmp.service.IMediaServerService; -import com.genersoft.iot.vmp.service.IPlayService; -import com.genersoft.iot.vmp.service.IStreamProxyService; -import com.genersoft.iot.vmp.service.IStreamPushService; +import com.genersoft.iot.vmp.service.*; import com.genersoft.iot.vmp.service.bean.ErrorCallback; import com.genersoft.iot.vmp.service.bean.InviteErrorCode; import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; @@ -82,6 +79,9 @@ @Autowired private IRedisCatchStorage redisCatchStorage; + + @Autowired + private IInviteStreamService inviteStreamService; @Autowired private SSRCFactory ssrcFactory; @@ -518,10 +518,10 @@ errorEvent.run(code, msg, data); } }); - }else { + } else { SSRCInfo ssrcInfo = playService.play(mediaServerItem, device.getDeviceId(), channelId, ssrc, ((code, msg, data) -> { - if (code == InviteErrorCode.SUCCESS.getCode()){ + if (code == InviteErrorCode.SUCCESS.getCode()) { hookEvent.run(code, msg, data); } else if (code == InviteErrorCode.ERROR_FOR_SIGNALLING_TIMEOUT.getCode() || code == InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getCode()) { logger.info("[涓婄骇鐐规挱]瓒呮椂, 鐢ㄦ埛锛歿}锛� 閫氶亾锛歿}", username, channelId); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForCatalogProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForCatalogProcessor.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 index d44ff5a..dbe49d5 --- 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 @@ -132,7 +132,7 @@ if (CmdType.CATALOG.equals(cmd)) { logger.info("鎺ユ敹鍒癈atalog閫氱煡"); -// processNotifyCatalogList(take.getEvt()); + processNotifyCatalogList(take.getEvt()); notifyRequestForCatalogProcessor.process(take.getEvt()); } else if (CmdType.ALARM.equals(cmd)) { logger.info("鎺ユ敹鍒癆larm閫氱煡"); @@ -319,6 +319,7 @@ logger.info("[鏀跺埌Notify-Alarm]锛歿}/{}", device.getDeviceId(), deviceAlarm.getChannelId()); if ("4".equals(deviceAlarm.getAlarmMethod())) { MobilePosition mobilePosition = new MobilePosition(); + mobilePosition.setChannelId(channelId); mobilePosition.setCreateTime(DateUtil.getNow()); mobilePosition.setDeviceId(deviceAlarm.getDeviceId()); mobilePosition.setTime(deviceAlarm.getAlarmTime()); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java old mode 100644 new mode 100755 index 70a9f77..76e9d2c --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java @@ -88,7 +88,11 @@ Response response = null; boolean passwordCorrect = false; // 娉ㄥ唽鏍囧織 - boolean registerFlag; + boolean registerFlag = true; + if (request.getExpires().getExpires() == 0) { + // 娉ㄩ攢鎴愬姛 + registerFlag = false; + } FromHeader fromHeader = (FromHeader) request.getHeader(FromHeader.NAME); AddressImpl address = (AddressImpl) fromHeader.getAddress(); SipUri uri = (SipUri) address.getURI(); @@ -99,11 +103,12 @@ RemoteAddressInfo remoteAddressInfo = SipUtils.getRemoteAddressFromRequest(request, userSetting.getSipUseSourceIpAsRemoteAddress()); String requestAddress = remoteAddressInfo.getIp() + ":" + remoteAddressInfo.getPort(); - logger.info("[娉ㄥ唽璇锋眰] 璁惧锛歿}, 寮�濮嬪鐞�: {}", deviceId, requestAddress); + String title = registerFlag ? "[娉ㄥ唽璇锋眰]": "[娉ㄩ攢璇锋眰]"; + logger.info(title + "璁惧锛歿}, 寮�濮嬪鐞�: {}", deviceId, requestAddress); if (device != null && device.getSipTransactionInfo() != null && request.getCallIdHeader().getCallId().equals(device.getSipTransactionInfo().getCallId())) { - logger.info("[娉ㄥ唽璇锋眰] 璁惧锛歿}, 娉ㄥ唽缁: {}",device.getDeviceId(), device.getDeviceId()); + logger.info(title + "璁惧锛歿}, 娉ㄥ唽缁: {}",device.getDeviceId(), device.getDeviceId()); device.setExpires(request.getExpires().getExpires()); device.setIp(remoteAddressInfo.getIp()); device.setPort(remoteAddressInfo.getPort()); @@ -123,7 +128,7 @@ String password = (device != null && !ObjectUtils.isEmpty(device.getPassword()))? device.getPassword() : sipConfig.getPassword(); AuthorizationHeader authHead = (AuthorizationHeader) request.getHeader(AuthorizationHeader.NAME); if (authHead == null && !ObjectUtils.isEmpty(password)) { - logger.info("[娉ㄥ唽璇锋眰] 璁惧锛歿}, 鍥炲401: {}",deviceId, requestAddress); + logger.info(title + " 璁惧锛歿}, 鍥炲401: {}",deviceId, requestAddress); response = getMessageFactory().createResponse(Response.UNAUTHORIZED, request); new DigestServerAuthenticationHelper().generateChallenge(getHeaderFactory(), response, sipConfig.getDomain()); sipSender.transmitRequest(request.getLocalAddress().getHostAddress(), response); @@ -138,7 +143,7 @@ // 娉ㄥ唽澶辫触 response = getMessageFactory().createResponse(Response.FORBIDDEN, request); response.setReasonPhrase("wrong password"); - logger.info("[娉ㄥ唽璇锋眰] 璁惧锛歿}, 瀵嗙爜/SIP鏈嶅姟鍣↖D閿欒, 鍥炲403: {}", deviceId, requestAddress); + logger.info(title + " 璁惧锛歿}, 瀵嗙爜/SIP鏈嶅姟鍣↖D閿欒, 鍥炲403: {}", deviceId, requestAddress); sipSender.transmitRequest(request.getLocalAddress().getHostAddress(), response); return; } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/info/InfoRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/info/InfoRequestProcessor.java old mode 100644 new mode 100755 index 62290c5..92175ac --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/info/InfoRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/info/InfoRequestProcessor.java @@ -1,149 +1,149 @@ -package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.info; - -import com.genersoft.iot.vmp.common.InviteInfo; -import com.genersoft.iot.vmp.common.InviteSessionType; -import com.genersoft.iot.vmp.gb28181.bean.*; -import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; -import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; -import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; -import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; -import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; -import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; -import com.genersoft.iot.vmp.gb28181.utils.SipUtils; -import com.genersoft.iot.vmp.service.IInviteStreamService; -import com.genersoft.iot.vmp.storager.IRedisCatchStorage; -import com.genersoft.iot.vmp.storager.IVideoManagerStorage; -import gov.nist.javax.sip.message.SIPRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import javax.sip.InvalidArgumentException; -import javax.sip.RequestEvent; -import javax.sip.SipException; -import javax.sip.header.CallIdHeader; -import javax.sip.header.ContentTypeHeader; -import javax.sip.message.Response; -import java.text.ParseException; - -@Component -public class InfoRequestProcessor extends SIPRequestProcessorParent implements InitializingBean, ISIPRequestProcessor { - - private final static Logger logger = LoggerFactory.getLogger(InfoRequestProcessor.class); - - private final String method = "INFO"; - - @Autowired - private SIPProcessorObserver sipProcessorObserver; - - @Autowired - private IVideoManagerStorage storage; - - @Autowired - private SipSubscribe sipSubscribe; - - @Autowired - private IRedisCatchStorage redisCatchStorage; - - @Autowired - private IInviteStreamService inviteStreamService; - - @Autowired - private IVideoManagerStorage storager; - - @Autowired - private SIPCommander cmder; - - @Autowired - private VideoStreamSessionManager sessionManager; - - @Override - public void afterPropertiesSet() throws Exception { - // 娣诲姞娑堟伅澶勭悊鐨勮闃� - sipProcessorObserver.addRequestProcessor(method, this); - } - - @Override - public void process(RequestEvent evt) { - logger.debug("鎺ユ敹鍒版秷鎭細" + evt.getRequest()); - SIPRequest request = (SIPRequest) evt.getRequest(); - String deviceId = SipUtils.getUserIdFromFromHeader(request); - CallIdHeader callIdHeader = request.getCallIdHeader(); - // 鍏堜粠浼氳瘽鍐呮煡鎵� - SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransaction(null, null, callIdHeader.getCallId(), null); - - // 鍏煎娴峰悍 濯掍綋閫氱煡 娑堟伅from瀛楁涓嶆槸璁惧ID鐨勯棶棰� - if (ssrcTransaction != null) { - deviceId = ssrcTransaction.getDeviceId(); - } - // 鏌ヨ璁惧鏄惁瀛樺湪 - Device device = redisCatchStorage.getDevice(deviceId); - // 鏌ヨ涓婄骇骞冲彴鏄惁瀛樺湪 - ParentPlatform parentPlatform = storage.queryParentPlatByServerGBId(deviceId); - try { - if (device != null && parentPlatform != null) { - logger.warn("[閲嶅]骞冲彴涓庤澶囩紪鍙烽噸澶嶏細{}", deviceId); - String hostAddress = request.getRemoteAddress().getHostAddress(); - int remotePort = request.getRemotePort(); - if (device.getHostAddress().equals(hostAddress + ":" + remotePort)) { - parentPlatform = null; - }else { - device = null; - } - } - if (device == null && parentPlatform == null) { - // 涓嶅瓨鍦ㄥ垯鍥炲404 - responseAck(request, Response.NOT_FOUND, "device "+ deviceId +" not found"); - logger.warn("[璁惧鏈壘鍒� ]锛� {}", deviceId); - if (sipSubscribe.getErrorSubscribe(callIdHeader.getCallId()) != null){ - DeviceNotFoundEvent deviceNotFoundEvent = new DeviceNotFoundEvent(evt.getDialog()); - deviceNotFoundEvent.setCallId(callIdHeader.getCallId()); - SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(deviceNotFoundEvent); - sipSubscribe.getErrorSubscribe(callIdHeader.getCallId()).response(eventResult); - }; - }else { - ContentTypeHeader header = (ContentTypeHeader)evt.getRequest().getHeader(ContentTypeHeader.NAME); - String contentType = header.getContentType(); - String contentSubType = header.getContentSubType(); - if ("Application".equalsIgnoreCase(contentType) && "MANSRTSP".equalsIgnoreCase(contentSubType)) { - SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(null, null, null, callIdHeader.getCallId()); - String streamId = sendRtpItem.getStream(); - InviteInfo inviteInfo = inviteStreamService.getInviteInfoByStream(InviteSessionType.PLAYBACK, streamId); - if (null == inviteInfo) { - responseAck(request, Response.NOT_FOUND, "stream " + streamId + " not found"); - return; - } - Device device1 = storager.queryVideoDevice(inviteInfo.getDeviceId()); - if (inviteInfo.getStreamInfo() != null) { - cmder.playbackControlCmd(device1,inviteInfo.getStreamInfo(),new String(evt.getRequest().getRawContent()),eventResult -> { - // 澶辫触鐨勫洖澶� - try { - responseAck(request, eventResult.statusCode, eventResult.msg); - } catch (SipException | InvalidArgumentException | ParseException e) { - logger.error("[鍛戒护鍙戦�佸け璐 鍥芥爣绾ц仈 褰曞儚鎺у埗: {}", e.getMessage()); - } - }, eventResult -> { - // 鎴愬姛鐨勫洖澶� - try { - responseAck(request, eventResult.statusCode); - } catch (SipException | InvalidArgumentException | ParseException e) { - logger.error("[鍛戒护鍙戦�佸け璐 鍥芥爣绾ц仈 褰曞儚鎺у埗: {}", e.getMessage()); - } - }); - } - - } - } - } catch (SipException e) { - logger.warn("SIP 鍥炲閿欒", e); - } catch (InvalidArgumentException e) { - logger.warn("鍙傛暟鏃犳晥", e); - } catch (ParseException e) { - logger.warn("SIP鍥炲鏃惰В鏋愬紓甯�", e); - } - } - - -} +package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.info; + +import com.genersoft.iot.vmp.common.InviteInfo; +import com.genersoft.iot.vmp.common.InviteSessionType; +import com.genersoft.iot.vmp.gb28181.bean.*; +import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; +import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; +import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; +import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; +import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; +import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; +import com.genersoft.iot.vmp.gb28181.utils.SipUtils; +import com.genersoft.iot.vmp.service.IInviteStreamService; +import com.genersoft.iot.vmp.storager.IRedisCatchStorage; +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; +import gov.nist.javax.sip.message.SIPRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.sip.InvalidArgumentException; +import javax.sip.RequestEvent; +import javax.sip.SipException; +import javax.sip.header.CallIdHeader; +import javax.sip.header.ContentTypeHeader; +import javax.sip.message.Response; +import java.text.ParseException; + +@Component +public class InfoRequestProcessor extends SIPRequestProcessorParent implements InitializingBean, ISIPRequestProcessor { + + private final static Logger logger = LoggerFactory.getLogger(InfoRequestProcessor.class); + + private final String method = "INFO"; + + @Autowired + private SIPProcessorObserver sipProcessorObserver; + + @Autowired + private IVideoManagerStorage storage; + + @Autowired + private SipSubscribe sipSubscribe; + + @Autowired + private IRedisCatchStorage redisCatchStorage; + + @Autowired + private IInviteStreamService inviteStreamService; + + @Autowired + private IVideoManagerStorage storager; + + @Autowired + private SIPCommander cmder; + + @Autowired + private VideoStreamSessionManager sessionManager; + + @Override + public void afterPropertiesSet() throws Exception { + // 娣诲姞娑堟伅澶勭悊鐨勮闃� + sipProcessorObserver.addRequestProcessor(method, this); + } + + @Override + public void process(RequestEvent evt) { + logger.debug("鎺ユ敹鍒版秷鎭細" + evt.getRequest()); + SIPRequest request = (SIPRequest) evt.getRequest(); + String deviceId = SipUtils.getUserIdFromFromHeader(request); + CallIdHeader callIdHeader = request.getCallIdHeader(); + // 鍏堜粠浼氳瘽鍐呮煡鎵� + SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransaction(null, null, callIdHeader.getCallId(), null); + + // 鍏煎娴峰悍 濯掍綋閫氱煡 娑堟伅from瀛楁涓嶆槸璁惧ID鐨勯棶棰� + if (ssrcTransaction != null) { + deviceId = ssrcTransaction.getDeviceId(); + } + // 鏌ヨ璁惧鏄惁瀛樺湪 + Device device = redisCatchStorage.getDevice(deviceId); + // 鏌ヨ涓婄骇骞冲彴鏄惁瀛樺湪 + ParentPlatform parentPlatform = storage.queryParentPlatByServerGBId(deviceId); + try { + if (device != null && parentPlatform != null) { + logger.warn("[閲嶅]骞冲彴涓庤澶囩紪鍙烽噸澶嶏細{}", deviceId); + String hostAddress = request.getRemoteAddress().getHostAddress(); + int remotePort = request.getRemotePort(); + if (device.getHostAddress().equals(hostAddress + ":" + remotePort)) { + parentPlatform = null; + }else { + device = null; + } + } + if (device == null && parentPlatform == null) { + // 涓嶅瓨鍦ㄥ垯鍥炲404 + responseAck(request, Response.NOT_FOUND, "device "+ deviceId +" not found"); + logger.warn("[璁惧鏈壘鍒� ]锛� {}", deviceId); + if (sipSubscribe.getErrorSubscribe(callIdHeader.getCallId()) != null){ + DeviceNotFoundEvent deviceNotFoundEvent = new DeviceNotFoundEvent(evt.getDialog()); + deviceNotFoundEvent.setCallId(callIdHeader.getCallId()); + SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(deviceNotFoundEvent); + sipSubscribe.getErrorSubscribe(callIdHeader.getCallId()).response(eventResult); + }; + }else { + ContentTypeHeader header = (ContentTypeHeader)evt.getRequest().getHeader(ContentTypeHeader.NAME); + String contentType = header.getContentType(); + String contentSubType = header.getContentSubType(); + if ("Application".equalsIgnoreCase(contentType) && "MANSRTSP".equalsIgnoreCase(contentSubType)) { + SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(null, null, null, callIdHeader.getCallId()); + String streamId = sendRtpItem.getStream(); + InviteInfo inviteInfo = inviteStreamService.getInviteInfoByStream(InviteSessionType.PLAYBACK, streamId); + if (null == inviteInfo) { + responseAck(request, Response.NOT_FOUND, "stream " + streamId + " not found"); + return; + } + Device device1 = storager.queryVideoDevice(inviteInfo.getDeviceId()); + if (inviteInfo.getStreamInfo() != null) { + cmder.playbackControlCmd(device1,inviteInfo.getStreamInfo(),new String(evt.getRequest().getRawContent()),eventResult -> { + // 澶辫触鐨勫洖澶� + try { + responseAck(request, eventResult.statusCode, eventResult.msg); + } catch (SipException | InvalidArgumentException | ParseException e) { + logger.error("[鍛戒护鍙戦�佸け璐 鍥芥爣绾ц仈 褰曞儚鎺у埗: {}", e.getMessage()); + } + }, eventResult -> { + // 鎴愬姛鐨勫洖澶� + try { + responseAck(request, eventResult.statusCode); + } catch (SipException | InvalidArgumentException | ParseException e) { + logger.error("[鍛戒护鍙戦�佸け璐 鍥芥爣绾ц仈 褰曞儚鎺у埗: {}", e.getMessage()); + } + }); + } + + } + } + } catch (SipException e) { + logger.warn("SIP 鍥炲閿欒", e); + } catch (InvalidArgumentException e) { + logger.warn("鍙傛暟鏃犳晥", e); + } catch (ParseException e) { + logger.warn("SIP鍥炲鏃惰В鏋愬紓甯�", e); + } + } + + +} diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/IMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/IMessageHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageHandlerAbstract.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageHandlerAbstract.java old mode 100644 new mode 100755 index b5db5b3..69b4b25 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageHandlerAbstract.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageHandlerAbstract.java @@ -3,7 +3,6 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; -import gov.nist.javax.sip.message.SIPRequest; import org.dom4j.Element; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -24,6 +23,9 @@ public Map<String, IMessageHandler> messageHandlerMap = new ConcurrentHashMap<>(); + @Autowired + private IVideoManagerStorage storage; + public void addHandler(String cmdType, IMessageHandler messageHandler) { messageHandlerMap.put(cmdType, messageHandler); } @@ -40,7 +42,15 @@ return; } IMessageHandler messageHandler = messageHandlerMap.get(cmd); + if (messageHandler != null) { + //涓や釜鍥芥爣骞冲彴浜掔浉绾ц仈鏃剁敱浜庝笂涓�姝ュ垽鏂鑷存湰璇ュ湪骞冲彴澶勭悊鐨勬秷鎭� 鏀惧埌浜嗚澶囩殑澶勭悊閫昏緫 + //鎵�浠ュ鐩綍鏌ヨ鍗曠嫭鍋氫簡鏍¢獙 + if(messageHandler instanceof CatalogQueryMessageHandler){ + ParentPlatform parentPlatform = storage.queryParentPlatByServerGBId(device.getDeviceId()); + messageHandler.handForPlatform(evt, parentPlatform, element); + return; + } messageHandler.handForDevice(evt, device, element); } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageRequestProcessor.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/control/ControlMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/control/ControlMessageHandler.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/NotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/NotifyMessageHandler.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 index 6928def..2fc7ae0 --- 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 @@ -137,6 +137,7 @@ MobilePosition mobilePosition = new MobilePosition(); mobilePosition.setCreateTime(DateUtil.getNow()); mobilePosition.setDeviceId(deviceAlarm.getDeviceId()); + mobilePosition.setChannelId(channelId); mobilePosition.setTime(deviceAlarm.getAlarmTime()); mobilePosition.setLongitude(deviceAlarm.getLongitude()); mobilePosition.setLatitude(deviceAlarm.getLatitude()); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java old mode 100644 new mode 100755 index 5526e15..7d94787 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java @@ -13,6 +13,7 @@ import com.genersoft.iot.vmp.service.IDeviceService; import com.genersoft.iot.vmp.utils.DateUtil; import gov.nist.javax.sip.message.SIPRequest; +import org.apache.commons.lang3.ObjectUtils; import org.dom4j.Element; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -68,7 +69,7 @@ } catch (SipException | InvalidArgumentException | ParseException e) { logger.error("[鍛戒护鍙戦�佸け璐 蹇冭烦鍥炲: {}", e.getMessage()); } - if (device.getKeepaliveTime() != null && DateUtil.getDifferenceForNow(device.getKeepaliveTime()) <= 3000L){ + if (!ObjectUtils.isEmpty(device.getKeepaliveTime()) && DateUtil.getDifferenceForNow(device.getKeepaliveTime()) <= 3000L) { logger.info("[鏀跺埌蹇冭烦] 蹇冭烦鍙戦�佽繃浜庨绻侊紝宸插拷鐣� device: {}, callId: {}", device.getDeviceId(), request.getCallIdHeader().getCallId()); return; } @@ -109,7 +110,11 @@ @Override public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element element) { - // 涓嶄細鏀跺埌涓婄骇骞冲彴鐨勫績璺充俊鎭� - + // 涓埆骞冲彴淇濇椿涓嶅洖澶�200OK浼氬垽瀹氱绾� + try { + responseAck((SIPRequest) evt.getRequest(), Response.OK); + } catch (SipException | InvalidArgumentException | ParseException e) { + logger.error("[鍛戒护鍙戦�佸け璐 蹇冭烦鍥炲: {}", e.getMessage()); + } } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MediaStatusNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MediaStatusNotifyMessageHandler.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/QueryMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/QueryMessageHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/AlarmQueryMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/AlarmQueryMessageHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/DeviceInfoQueryMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/DeviceInfoQueryMessageHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/DeviceStatusQueryMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/DeviceStatusQueryMessageHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/RecordInfoQueryMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/RecordInfoQueryMessageHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/ResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/ResponseMessageHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/AlarmResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/AlarmResponseMessageHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/BroadcastResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/BroadcastResponseMessageHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java old mode 100644 new mode 100755 index 2283fa2..19dde71 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java @@ -30,6 +30,7 @@ import java.util.Iterator; import java.util.List; import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.atomic.AtomicBoolean; /** * 鐩綍鏌ヨ鐨勫洖澶� @@ -61,6 +62,7 @@ @Autowired private SipConfig sipConfig; + private AtomicBoolean processing = new AtomicBoolean(false); @Override public void afterPropertiesSet() throws Exception { @@ -69,7 +71,6 @@ @Override public void handForDevice(RequestEvent evt, Device device, Element element) { - boolean isEmpty = taskQueue.isEmpty(); taskQueue.offer(new HandlerCatchData(evt, device, element)); // 鍥炲200 OK try { @@ -77,8 +78,8 @@ } catch (SipException | InvalidArgumentException | ParseException e) { logger.error("[鍛戒护鍙戦�佸け璐 鐩綍鏌ヨ鍥炲: {}", e.getMessage()); } - // 濡傛灉涓嶄负绌哄垯璇存槑宸茬粡寮�鍚秷鎭鐞� - if (isEmpty) { + // 宸茬粡寮�鍚秷鎭鐞嗗垯璺宠繃 + if (processing.compareAndSet(false, true)) { taskExecutor.execute(() -> { while (!taskQueue.isEmpty()) { // 鍏ㄥ眬寮傚父鎹曡幏锛屼繚璇佷笅涓�鏉″彲浠ュ緱鍒板鐞� @@ -147,11 +148,12 @@ } } - }catch (Exception e) { + } catch (Exception e) { logger.warn("[鏀跺埌閫氶亾] 鍙戠幇鏈鐞嗙殑寮傚父, \r\n{}", evt.getRequest()); logger.error("[鏀跺埌閫氶亾] 寮傚父鍐呭锛� ", e); } } + processing.set(false); }); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/ConfigDownloadResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/ConfigDownloadResponseMessageHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceConfigResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceConfigResponseMessageHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceControlResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceControlResponseMessageHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceStatusResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceStatusResponseMessageHandler.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/PresetQueryResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/PresetQueryResponseMessageHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/RecordInfoResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/RecordInfoResponseMessageHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/ISIPResponseProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/ISIPResponseProcessor.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/SIPResponseProcessorAbstract.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/SIPResponseProcessorAbstract.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/ByeResponseProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/ByeResponseProcessor.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/CancelResponseProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/CancelResponseProcessor.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/InviteResponseProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/InviteResponseProcessor.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/timeout/ITimeoutProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/timeout/ITimeoutProcessor.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/timeout/impl/TimeoutProcessorImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/timeout/impl/TimeoutProcessorImpl.java old mode 100644 new mode 100755 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 8c96a8e..e614b9f 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 @@ -1,647 +1,647 @@ -package com.genersoft.iot.vmp.gb28181.utils; - -import com.alibaba.fastjson2.JSONArray; -import com.alibaba.fastjson2.JSONObject; -import com.genersoft.iot.vmp.common.CivilCodePo; -import com.genersoft.iot.vmp.conf.CivilCodeFileConf; -import com.genersoft.iot.vmp.gb28181.bean.Device; -import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; -import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; -import com.genersoft.iot.vmp.utils.DateUtil; -import org.apache.commons.lang3.math.NumberUtils; -import org.dom4j.Attribute; -import org.dom4j.Document; -import org.dom4j.DocumentException; -import org.dom4j.Element; -import org.dom4j.io.SAXReader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.ObjectUtils; -import org.springframework.util.ReflectionUtils; - -import javax.sip.RequestEvent; -import javax.sip.message.Request; -import java.io.ByteArrayInputStream; -import java.io.StringReader; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.*; - -/** - * 鍩轰簬dom4j鐨勫伐鍏峰寘 - * - * - */ -public class XmlUtil { - /** - * 鏃ュ織鏈嶅姟 - */ - private static Logger logger = LoggerFactory.getLogger(XmlUtil.class); - - /** - * 瑙f瀽XML涓篋ocument瀵硅薄 - * - * @param xml 琚В鏋愮殑XMl - * - * @return Document - */ - public static Element parseXml(String xml) { - Document document = null; - // - StringReader sr = new StringReader(xml); - SAXReader saxReader = new SAXReader(); - try { - document = saxReader.read(sr); - } catch (DocumentException e) { - logger.error("瑙f瀽澶辫触", e); - } - return null == document ? null : document.getRootElement(); - } - - /** - * 鑾峰彇element瀵硅薄鐨則ext鐨勫�� - * - * @param em 鑺傜偣鐨勫璞� - * @param tag 鑺傜偣鐨則ag - * @return 鑺傜偣 - */ - public static String getText(Element em, String tag) { - if (null == em) { - return null; - } - Element e = em.element(tag); - // - return null == e ? null : e.getText().trim(); - } - - /** - * 閫掑綊瑙f瀽xml鑺傜偣锛岄�傜敤浜� 澶氳妭鐐规暟鎹� - * - * @param node node - * @param nodeName nodeName - * @return List<Map<String, Object>> - */ - public static List<Map<String, Object>> listNodes(Element node, String nodeName) { - if (null == node) { - return null; - } - // 鍒濆鍖栬繑鍥� - List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); - // 棣栧厛鑾峰彇褰撳墠鑺傜偣鐨勬墍鏈夊睘鎬ц妭鐐� - List<Attribute> list = node.attributes(); - - Map<String, Object> map = null; - // 閬嶅巻灞炴�ц妭鐐� - for (Attribute attribute : list) { - if (nodeName.equals(node.getName())) { - if (null == map) { - map = new HashMap<String, Object>(); - listMap.add(map); - } - // 鍙栧埌鐨勮妭鐐瑰睘鎬ф斁鍒癿ap涓� - map.put(attribute.getName(), attribute.getValue()); - } - - } - // 閬嶅巻褰撳墠鑺傜偣涓嬬殑鎵�鏈夎妭鐐� 锛宯odeName 瑕佽В鏋愮殑鑺傜偣鍚嶇О - // 浣跨敤閫掑綊 - Iterator<Element> iterator = node.elementIterator(); - while (iterator.hasNext()) { - Element e = iterator.next(); - listMap.addAll(listNodes(e, nodeName)); - } - return listMap; - } - - /** - * xml杞琷son - * - * @param element - * @param json - */ - public static void node2Json(Element element, JSONObject json) { - // 濡傛灉鏄睘鎬� - for (Object o : element.attributes()) { - Attribute attr = (Attribute) o; - if (!ObjectUtils.isEmpty(attr.getValue())) { - json.put("@" + attr.getName(), attr.getValue()); - } - } - List<Element> chdEl = element.elements(); - if (chdEl.isEmpty() && !ObjectUtils.isEmpty(element.getText())) {// 濡傛灉娌℃湁瀛愬厓绱�,鍙湁涓�涓�� - json.put(element.getName(), element.getText()); - } - - for (Element e : chdEl) { // 鏈夊瓙鍏冪礌 - if (!e.elements().isEmpty()) { // 瀛愬厓绱犱篃鏈夊瓙鍏冪礌 - JSONObject chdjson = new JSONObject(); - node2Json(e, chdjson); - Object o = json.get(e.getName()); - if (o != null) { - JSONArray jsona = null; - if (o instanceof JSONObject) { // 濡傛灉姝ゅ厓绱犲凡瀛樺湪,鍒欒浆涓簀sonArray - JSONObject jsono = (JSONObject) o; - json.remove(e.getName()); - jsona = new JSONArray(); - jsona.add(jsono); - jsona.add(chdjson); - } - if (o instanceof JSONArray) { - jsona = (JSONArray) o; - jsona.add(chdjson); - } - json.put(e.getName(), jsona); - } else { - if (!chdjson.isEmpty()) { - json.put(e.getName(), chdjson); - } - } - } else { // 瀛愬厓绱犳病鏈夊瓙鍏冪礌 - for (Object o : element.attributes()) { - Attribute attr = (Attribute) o; - if (!ObjectUtils.isEmpty(attr.getValue())) { - json.put("@" + attr.getName(), attr.getValue()); - } - } - if (!e.getText().isEmpty()) { - json.put(e.getName(), e.getText()); - } - } - } - } - public static Element getRootElement(RequestEvent evt) throws DocumentException { - - return getRootElement(evt, "gb2312"); - } - - public static Element getRootElement(RequestEvent evt, String charset) throws DocumentException { - Request request = evt.getRequest(); - return getRootElement(request.getRawContent(), charset); - } - - public static Element getRootElement(byte[] content, String charset) throws DocumentException { - if (charset == null) { - charset = "gb2312"; - } - SAXReader reader = new SAXReader(); - reader.setEncoding(charset); - Document xml = reader.read(new ByteArrayInputStream(content)); - return xml.getRootElement(); - } - - private enum ChannelType{ - CivilCode, BusinessGroup,VirtualOrganization,Other - } - - public static DeviceChannel channelContentHandler(Element itemDevice, Device device, String event, CivilCodeFileConf civilCodeFileConf){ - DeviceChannel deviceChannel = new DeviceChannel(); - deviceChannel.setDeviceId(device.getDeviceId()); - Element channdelIdElement = itemDevice.element("DeviceID"); - if (channdelIdElement == null) { - logger.warn("瑙f瀽Catalog娑堟伅鏃跺彂鐜扮己灏� DeviceID"); - return null; - } - String channelId = channdelIdElement.getTextTrim(); - if (ObjectUtils.isEmpty(channelId)) { - logger.warn("瑙f瀽Catalog娑堟伅鏃跺彂鐜扮己灏� DeviceID"); - return null; - } - deviceChannel.setChannelId(channelId); - if (event != null && !event.equals(CatalogEvent.ADD) && !event.equals(CatalogEvent.UPDATE)) { - // 闄や簡ADD鍜寀pdate鎯呭喌涓嬮渶瑕佽瘑鍒叏閮ㄥ唴瀹癸紝 - return deviceChannel; - } - Element nameElement = itemDevice.element("Name"); - if (nameElement != null) { - deviceChannel.setName(nameElement.getText()); - } - if(channelId.length() <= 8) { - deviceChannel.setHasAudio(false); - CivilCodePo parentCode = civilCodeFileConf.getParentCode(channelId); - if (parentCode != null) { - deviceChannel.setParentId(parentCode.getCode()); - deviceChannel.setCivilCode(parentCode.getCode()); - }else { - logger.warn("[xml瑙f瀽] 鏃犳硶纭畾琛屾斂鍖哄垝{}鐨勪笂绾ц鏀垮尯鍒�", channelId); - } - deviceChannel.setStatus(true); - return deviceChannel; - }else { - if(channelId.length() != 20) { - logger.warn("[xml瑙f瀽] 澶辫触锛岀紪鍙蜂笉绗﹀悎鍥芥爣28181瀹氫箟锛� {}", channelId); - return null; - } - - int code = Integer.parseInt(channelId.substring(10, 13)); - if (code == 136 || code == 137 || code == 138) { - deviceChannel.setHasAudio(true); - }else { - deviceChannel.setHasAudio(false); - } - // 璁惧鍘傚晢 - String manufacturer = getText(itemDevice, "Manufacturer"); - // 璁惧鍨嬪彿 - String model = getText(itemDevice, "Model"); - // 璁惧褰掑睘 - String owner = getText(itemDevice, "Owner"); - // 琛屾斂鍖哄煙 - String civilCode = getText(itemDevice, "CivilCode"); - // 铏氭嫙缁勭粐鎵�灞炵殑涓氬姟鍒嗙粍ID,涓氬姟鍒嗙粍鏍规嵁鐗瑰畾鐨勪笟鍔¢渶姹傚埗瀹�,涓�涓笟鍔″垎缁勫寘鍚竴缁勭壒瀹氱殑铏氭嫙缁勭粐 - String businessGroupID = getText(itemDevice, "BusinessGroupID"); - // 鐖惰澶�/鍖哄煙/绯荤粺ID - String parentID = getText(itemDevice, "ParentID"); - if (parentID != null && parentID.equalsIgnoreCase("null")) { - parentID = null; - } - // 娉ㄥ唽鏂瑰紡(蹇呴��)缂虹渷涓�1;1:绗﹀悎IETFRFC3261鏍囧噯鐨勮璇佹敞鍐屾ā寮�;2:鍩轰簬鍙d护鐨勫弻鍚戣璇佹敞鍐屾ā寮�;3:鍩轰簬鏁板瓧璇佷功鐨勫弻鍚戣璇佹敞鍐屾ā寮� - String registerWay = getText(itemDevice, "RegisterWay"); - // 淇濆瘑灞炴��(蹇呴��)缂虹渷涓�0;0:涓嶆秹瀵�,1:娑夊瘑 - String secrecy = getText(itemDevice, "Secrecy"); - // 瀹夎鍦板潃 - String address = getText(itemDevice, "Address"); - - switch (code){ - case 200: - // 绯荤粺鐩綍 - if (!ObjectUtils.isEmpty(manufacturer)) { - deviceChannel.setManufacture(manufacturer); - } - if (!ObjectUtils.isEmpty(model)) { - deviceChannel.setModel(model); - } - if (!ObjectUtils.isEmpty(owner)) { - deviceChannel.setOwner(owner); - } - if (!ObjectUtils.isEmpty(civilCode)) { - deviceChannel.setCivilCode(civilCode); - deviceChannel.setParentId(civilCode); - }else { - if (!ObjectUtils.isEmpty(parentID)) { - deviceChannel.setParentId(parentID); - } - } - if (!ObjectUtils.isEmpty(address)) { - deviceChannel.setAddress(address); - } - deviceChannel.setStatus(true); - if (!ObjectUtils.isEmpty(registerWay)) { - try { - deviceChannel.setRegisterWay(Integer.parseInt(registerWay)); - }catch (NumberFormatException exception) { - logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁鑾峰彇registerWay澶辫触锛� {}", registerWay); - } - } - if (!ObjectUtils.isEmpty(secrecy)) { - deviceChannel.setSecrecy(secrecy); - } - return deviceChannel; - case 215: - // 涓氬姟鍒嗙粍 - deviceChannel.setStatus(true); - if (!ObjectUtils.isEmpty(parentID)) { - if (!parentID.trim().equalsIgnoreCase(device.getDeviceId())) { - deviceChannel.setParentId(parentID); - } - }else { - logger.warn("[xml瑙f瀽] 涓氬姟鍒嗙粍鏁版嵁涓己灏戝叧閿俊鎭�->ParentId"); - if (!ObjectUtils.isEmpty(civilCode)) { - deviceChannel.setCivilCode(civilCode); - } - } - break; - case 216: - // 铏氭嫙缁勭粐 - deviceChannel.setStatus(true); - if (!ObjectUtils.isEmpty(businessGroupID)) { - deviceChannel.setBusinessGroupId(businessGroupID); - } - - if (!ObjectUtils.isEmpty(parentID)) { - if (parentID.contains("/")) { - String[] parentIdArray = parentID.split("/"); - parentID = parentIdArray[parentIdArray.length - 1]; - } - deviceChannel.setParentId(parentID); - }else { - if (!ObjectUtils.isEmpty(businessGroupID)) { - deviceChannel.setParentId(businessGroupID); - } - } - break; - default: - // 璁惧鐩綍 - if (!ObjectUtils.isEmpty(manufacturer)) { - deviceChannel.setManufacture(manufacturer); - } - if (!ObjectUtils.isEmpty(model)) { - deviceChannel.setModel(model); - } - if (!ObjectUtils.isEmpty(owner)) { - deviceChannel.setOwner(owner); - } - if (!ObjectUtils.isEmpty(civilCode) - && civilCode.length() <= 8 - && NumberUtils.isParsable(civilCode) - && civilCode.length()%2 == 0 - ) { - deviceChannel.setCivilCode(civilCode); - } - if (!ObjectUtils.isEmpty(businessGroupID)) { - deviceChannel.setBusinessGroupId(businessGroupID); - } - - // 璀﹀尯 - String block = getText(itemDevice, "Block"); - if (!ObjectUtils.isEmpty(block)) { - deviceChannel.setBlock(block); - } - if (!ObjectUtils.isEmpty(address)) { - deviceChannel.setAddress(address); - } - - if (!ObjectUtils.isEmpty(secrecy)) { - deviceChannel.setSecrecy(secrecy); - } - - // 褰撲负璁惧鏃�,鏄惁鏈夊瓙璁惧(蹇呴��)1鏈�,0娌℃湁 - String parental = getText(itemDevice, "Parental"); - if (!ObjectUtils.isEmpty(parental)) { - try { - // 鐢变簬娴峰悍浼氶敊璇殑鍙戦��65535浣滀负杩欓噷鐨勫彇鍊�,鎵�浠ヨ繖閲岄櫎闈炴槸0鍚﹀垯璁や负鏄�1 - if (!ObjectUtils.isEmpty(parental) && parental.length() == 1 && Integer.parseInt(parental) == 0) { - deviceChannel.setParental(0); - }else { - deviceChannel.setParental(1); - } - }catch (NumberFormatException e) { - logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁鑾峰彇 parental澶辫触锛� {}", parental); - } - } - // 鐖惰澶�/鍖哄煙/绯荤粺ID - - if (!ObjectUtils.isEmpty(parentID) ) { - if (parentID.contains("/")) { - String[] parentIdArray = parentID.split("/"); - deviceChannel.setParentId(parentIdArray[parentIdArray.length - 1]); - }else { - if (parentID.length()%2 == 0) { - deviceChannel.setParentId(parentID); - }else { - logger.warn("[xml瑙f瀽] 涓嶈鑼冪殑parentID锛歿}, 宸茶垗寮�", parentID); - } - } - }else { - if (!ObjectUtils.isEmpty(businessGroupID)) { - deviceChannel.setParentId(businessGroupID); - }else { - if (!ObjectUtils.isEmpty(deviceChannel.getCivilCode())) { - deviceChannel.setParentId(deviceChannel.getCivilCode()); - } - } - } - // 娉ㄥ唽鏂瑰紡 - if (!ObjectUtils.isEmpty(registerWay)) { - try { - int registerWayInt = Integer.parseInt(registerWay); - deviceChannel.setRegisterWay(registerWayInt); - }catch (NumberFormatException exception) { - logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁鑾峰彇registerWay澶辫触锛� {}", registerWay); - deviceChannel.setRegisterWay(1); - } - }else { - deviceChannel.setRegisterWay(1); - } - - // 淇′护瀹夊叏妯″紡(鍙��)缂虹渷涓�0; 0:涓嶉噰鐢�;2:S/MIME 绛惧悕鏂瑰紡;3:S/MIME鍔犲瘑绛惧悕鍚屾椂閲囩敤鏂瑰紡;4:鏁板瓧鎽樿鏂瑰紡 - String safetyWay = getText(itemDevice, "SafetyWay"); - if (!ObjectUtils.isEmpty(safetyWay)) { - try { - deviceChannel.setSafetyWay(Integer.parseInt(safetyWay)); - }catch (NumberFormatException e) { - logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁鑾峰彇 safetyWay澶辫触锛� {}", safetyWay); - } - } - - // 璇佷功搴忓垪鍙�(鏈夎瘉涔︾殑璁惧蹇呴��) - String certNum = getText(itemDevice, "CertNum"); - if (!ObjectUtils.isEmpty(certNum)) { - deviceChannel.setCertNum(certNum); - } - - // 璇佷功鏈夋晥鏍囪瘑(鏈夎瘉涔︾殑璁惧蹇呴��)缂虹渷涓�0;璇佷功鏈夋晥鏍囪瘑:0:鏃犳晥 1:鏈夋晥 - String certifiable = getText(itemDevice, "Certifiable"); - if (!ObjectUtils.isEmpty(certifiable)) { - try { - deviceChannel.setCertifiable(Integer.parseInt(certifiable)); - }catch (NumberFormatException e) { - logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁鑾峰彇 Certifiable澶辫触锛� {}", certifiable); - } - } - - // 鏃犳晥鍘熷洜鐮�(鏈夎瘉涔︿笖璇佷功鏃犳晥鐨勮澶囧繀閫�) - String errCode = getText(itemDevice, "ErrCode"); - if (!ObjectUtils.isEmpty(errCode)) { - try { - deviceChannel.setErrCode(Integer.parseInt(errCode)); - }catch (NumberFormatException e) { - logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁鑾峰彇 ErrCode澶辫触锛� {}", errCode); - } - } - - // 璇佷功缁堟鏈夋晥鏈�(鏈夎瘉涔︾殑璁惧蹇呴��) - String endTime = getText(itemDevice, "EndTime"); - if (!ObjectUtils.isEmpty(endTime)) { - deviceChannel.setEndTime(endTime); - } - - - // 璁惧/鍖哄煙/绯荤粺IP鍦板潃 - String ipAddress = getText(itemDevice, "IPAddress"); - if (!ObjectUtils.isEmpty(ipAddress)) { - deviceChannel.setIpAddress(ipAddress); - } - - // 璁惧/鍖哄煙/绯荤粺绔彛 - String port = getText(itemDevice, "Port"); - if (!ObjectUtils.isEmpty(port)) { - try { - deviceChannel.setPort(Integer.parseInt(port)); - }catch (NumberFormatException e) { - logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁鑾峰彇 Port澶辫触锛� {}", port); - } - } - - // 璁惧鍙d护 - String password = getText(itemDevice, "Password"); - if (!ObjectUtils.isEmpty(password)) { - deviceChannel.setPassword(password); - } - - - // 璁惧鐘舵�� - String status = getText(itemDevice, "Status"); - if (status != null) { - // ONLINE OFFLINE HIKVISION DS-7716N-E4 NVR鐨勫吋瀹规�у鐞� - if (status.equals("ON") || status.equals("On") || status.equals("ONLINE") || status.equals("OK")) { - deviceChannel.setStatus(true); - } - if (status.equals("OFF") || status.equals("Off") || status.equals("OFFLINE")) { - deviceChannel.setStatus(false); - } - }else { - deviceChannel.setStatus(true); - } - - // 缁忓害 - String longitude = getText(itemDevice, "Longitude"); - if (NumericUtil.isDouble(longitude)) { - deviceChannel.setLongitude(Double.parseDouble(longitude)); - } else { - deviceChannel.setLongitude(0.00); - } - - // 绾害 - String latitude = getText(itemDevice, "Latitude"); - if (NumericUtil.isDouble(latitude)) { - deviceChannel.setLatitude(Double.parseDouble(latitude)); - } else { - deviceChannel.setLatitude(0.00); - } - - deviceChannel.setGpsTime(DateUtil.getNow()); - - // -鎽勫儚鏈虹被鍨嬫墿灞�,鏍囪瘑鎽勫儚鏈虹被鍨�:1-鐞冩満;2-鍗婄悆;3-鍥哄畾鏋満;4-閬ユ帶鏋満銆傚綋鐩綍椤逛负鎽勫儚鏈烘椂鍙�� - String ptzType = getText(itemDevice, "PTZType"); - if (ObjectUtils.isEmpty(ptzType)) { - //鍏煎INFO涓殑淇℃伅 - Element info = itemDevice.element("Info"); - String ptzTypeFromInfo = XmlUtil.getText(info, "PTZType"); - if(!ObjectUtils.isEmpty(ptzTypeFromInfo)){ - try { - deviceChannel.setPTZType(Integer.parseInt(ptzTypeFromInfo)); - }catch (NumberFormatException e){ - logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁info涓幏鍙朠TZType澶辫触锛� {}", ptzTypeFromInfo); - } - } - } else { - try { - deviceChannel.setPTZType(Integer.parseInt(ptzType)); - }catch (NumberFormatException e){ - logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁涓幏鍙朠TZType澶辫触锛� {}", ptzType); - } - } - - // TODO 鎽勫儚鏈轰綅缃被鍨嬫墿灞曘�� - // 1-鐪侀檯妫�鏌ョ珯銆� - // 2-鍏氭斂鏈哄叧銆� - // 3-杞︾珯鐮佸ご銆� - // 4-涓績骞垮満銆� - // 5-浣撹偛鍦洪銆� - // 6-鍟嗕笟涓績銆� - // 7-瀹楁暀鍦烘墍銆� - // 8-鏍″洯鍛ㄨ竟銆� - // 9-娌诲畨澶嶆潅鍖哄煙銆� - // 10-浜ら�氬共绾裤�� - // String positionType = getText(itemDevice, "PositionType"); - - // TODO 鎽勫儚鏈哄畨瑁呬綅缃澶栥�佸鍐呭睘鎬с��1-瀹ゅ銆�2-瀹ゅ唴銆� - // String roomType = getText(itemDevice, "RoomType"); - // TODO 鎽勫儚鏈虹敤閫斿睘鎬� - // String useType = getText(itemDevice, "UseType"); - // TODO 鎽勫儚鏈鸿ˉ鍏夊睘鎬с��1-鏃犺ˉ鍏夈��2-绾㈠琛ュ厜銆�3-鐧藉厜琛ュ厜 - // String supplyLightType = getText(itemDevice, "SupplyLightType"); - // TODO 鎽勫儚鏈虹洃瑙嗘柟浣嶅睘鎬с��1-涓溿��2-瑗裤��3-鍗椼��4-鍖椼��5-涓滃崡銆�6-涓滃寳銆�7-瑗垮崡銆�8-瑗垮寳銆� - // String directionType = getText(itemDevice, "DirectionType"); - // TODO 鎽勫儚鏈烘敮鎸佺殑鍒嗚鲸鐜�,鍙湁澶氫釜鍒嗚鲸鐜囧��,鍚勪釜鍙栧�奸棿浠モ��/鈥濆垎闅斻�傚垎杈ㄧ巼鍙栧�煎弬瑙侀檮褰� F涓璖DPf瀛楁瑙勫畾 - // String resolution = getText(itemDevice, "Resolution"); - - // TODO 涓嬭浇鍊嶉�熻寖鍥�(鍙��),鍚勫彲閫夊弬鏁颁互鈥�/鈥濆垎闅�,濡傝澶囨敮鎸�1,2,4鍊嶉�熶笅杞藉垯搴斿啓涓衡��1/2/4 - // String downloadSpeed = getText(itemDevice, "DownloadSpeed"); - // TODO 绌哄煙缂栫爜鑳藉姏,鍙栧��0:涓嶆敮鎸�;1:1绾у寮�(1涓寮哄眰);2:2绾у寮�(2涓寮哄眰);3:3绾у寮�(3涓寮哄眰) - // String svcSpaceSupportMode = getText(itemDevice, "SVCSpaceSupportMode"); - // TODO 鏃跺煙缂栫爜鑳藉姏,鍙栧��0:涓嶆敮鎸�;1:1绾у寮�;2:2绾у寮�;3:3绾у寮� - // String svcTimeSupportMode = getText(itemDevice, "SVCTimeSupportMode"); - - - deviceChannel.setSecrecy(secrecy); - break; - } - } - - return deviceChannel; - } - - /** - * 鏂板鏂规硶鏀寔鍐呴儴宓屽 - * - * @param element xmlElement - * @param clazz 缁撴灉绫� - * @param <T> 娉涘瀷 - * @return 缁撴灉瀵硅薄 - * @throws NoSuchMethodException - * @throws InvocationTargetException - * @throws InstantiationException - * @throws IllegalAccessException - */ - public static <T> T loadElement(Element element, Class<T> clazz) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { - Field[] fields = clazz.getDeclaredFields(); - T t = clazz.getDeclaredConstructor().newInstance(); - for (Field field : fields) { - ReflectionUtils.makeAccessible(field); - MessageElement annotation = field.getAnnotation(MessageElement.class); - if (annotation == null) { - continue; - } - String value = annotation.value(); - String subVal = annotation.subVal(); - Element element1 = element.element(value); - if (element1 == null) { - continue; - } - if ("".equals(subVal)) { - // 鏃犱笅绾ф暟鎹� - Object fieldVal = element1.isTextOnly() ? element1.getText() : loadElement(element1, field.getType()); - Object o = simpleTypeDeal(field.getType(), fieldVal); - ReflectionUtils.setField(field, t, o); - } else { - // 瀛樺湪涓嬬骇鏁版嵁 - ArrayList<Object> list = new ArrayList<>(); - Type genericType = field.getGenericType(); - if (!(genericType instanceof ParameterizedType)) { - continue; - } - Class<?> aClass = (Class<?>) ((ParameterizedType) genericType).getActualTypeArguments()[0]; - for (Element element2 : element1.elements(subVal)) { - list.add(loadElement(element2, aClass)); - } - ReflectionUtils.setField(field, t, list); - } - } - return t; - } - - /** - * 绠�鍗曠被鍨嬪鐞� - * - * @param tClass - * @param val - * @return - */ - private static Object simpleTypeDeal(Class<?> tClass, Object val) { - if (tClass.equals(String.class)) { - return val.toString(); - } - if (tClass.equals(Integer.class)) { - return Integer.valueOf(val.toString()); - } - if (tClass.equals(Double.class)) { - return Double.valueOf(val.toString()); - } - if (tClass.equals(Long.class)) { - return Long.valueOf(val.toString()); - } - return val; - } +package com.genersoft.iot.vmp.gb28181.utils; + +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import com.genersoft.iot.vmp.common.CivilCodePo; +import com.genersoft.iot.vmp.conf.CivilCodeFileConf; +import com.genersoft.iot.vmp.gb28181.bean.Device; +import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; +import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; +import com.genersoft.iot.vmp.utils.DateUtil; +import org.apache.commons.lang3.math.NumberUtils; +import org.dom4j.Attribute; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.ObjectUtils; +import org.springframework.util.ReflectionUtils; + +import javax.sip.RequestEvent; +import javax.sip.message.Request; +import java.io.ByteArrayInputStream; +import java.io.StringReader; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.*; + +/** + * 鍩轰簬dom4j鐨勫伐鍏峰寘 + * + * + */ +public class XmlUtil { + /** + * 鏃ュ織鏈嶅姟 + */ + private static Logger logger = LoggerFactory.getLogger(XmlUtil.class); + + /** + * 瑙f瀽XML涓篋ocument瀵硅薄 + * + * @param xml 琚В鏋愮殑XMl + * + * @return Document + */ + public static Element parseXml(String xml) { + Document document = null; + // + StringReader sr = new StringReader(xml); + SAXReader saxReader = new SAXReader(); + try { + document = saxReader.read(sr); + } catch (DocumentException e) { + logger.error("瑙f瀽澶辫触", e); + } + return null == document ? null : document.getRootElement(); + } + + /** + * 鑾峰彇element瀵硅薄鐨則ext鐨勫�� + * + * @param em 鑺傜偣鐨勫璞� + * @param tag 鑺傜偣鐨則ag + * @return 鑺傜偣 + */ + public static String getText(Element em, String tag) { + if (null == em) { + return null; + } + Element e = em.element(tag); + // + return null == e ? null : e.getText().trim(); + } + + /** + * 閫掑綊瑙f瀽xml鑺傜偣锛岄�傜敤浜� 澶氳妭鐐规暟鎹� + * + * @param node node + * @param nodeName nodeName + * @return List<Map<String, Object>> + */ + public static List<Map<String, Object>> listNodes(Element node, String nodeName) { + if (null == node) { + return null; + } + // 鍒濆鍖栬繑鍥� + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); + // 棣栧厛鑾峰彇褰撳墠鑺傜偣鐨勬墍鏈夊睘鎬ц妭鐐� + List<Attribute> list = node.attributes(); + + Map<String, Object> map = null; + // 閬嶅巻灞炴�ц妭鐐� + for (Attribute attribute : list) { + if (nodeName.equals(node.getName())) { + if (null == map) { + map = new HashMap<String, Object>(); + listMap.add(map); + } + // 鍙栧埌鐨勮妭鐐瑰睘鎬ф斁鍒癿ap涓� + map.put(attribute.getName(), attribute.getValue()); + } + + } + // 閬嶅巻褰撳墠鑺傜偣涓嬬殑鎵�鏈夎妭鐐� 锛宯odeName 瑕佽В鏋愮殑鑺傜偣鍚嶇О + // 浣跨敤閫掑綊 + Iterator<Element> iterator = node.elementIterator(); + while (iterator.hasNext()) { + Element e = iterator.next(); + listMap.addAll(listNodes(e, nodeName)); + } + return listMap; + } + + /** + * xml杞琷son + * + * @param element + * @param json + */ + public static void node2Json(Element element, JSONObject json) { + // 濡傛灉鏄睘鎬� + for (Object o : element.attributes()) { + Attribute attr = (Attribute) o; + if (!ObjectUtils.isEmpty(attr.getValue())) { + json.put("@" + attr.getName(), attr.getValue()); + } + } + List<Element> chdEl = element.elements(); + if (chdEl.isEmpty() && !ObjectUtils.isEmpty(element.getText())) {// 濡傛灉娌℃湁瀛愬厓绱�,鍙湁涓�涓�� + json.put(element.getName(), element.getText()); + } + + for (Element e : chdEl) { // 鏈夊瓙鍏冪礌 + if (!e.elements().isEmpty()) { // 瀛愬厓绱犱篃鏈夊瓙鍏冪礌 + JSONObject chdjson = new JSONObject(); + node2Json(e, chdjson); + Object o = json.get(e.getName()); + if (o != null) { + JSONArray jsona = null; + if (o instanceof JSONObject) { // 濡傛灉姝ゅ厓绱犲凡瀛樺湪,鍒欒浆涓簀sonArray + JSONObject jsono = (JSONObject) o; + json.remove(e.getName()); + jsona = new JSONArray(); + jsona.add(jsono); + jsona.add(chdjson); + } + if (o instanceof JSONArray) { + jsona = (JSONArray) o; + jsona.add(chdjson); + } + json.put(e.getName(), jsona); + } else { + if (!chdjson.isEmpty()) { + json.put(e.getName(), chdjson); + } + } + } else { // 瀛愬厓绱犳病鏈夊瓙鍏冪礌 + for (Object o : element.attributes()) { + Attribute attr = (Attribute) o; + if (!ObjectUtils.isEmpty(attr.getValue())) { + json.put("@" + attr.getName(), attr.getValue()); + } + } + if (!e.getText().isEmpty()) { + json.put(e.getName(), e.getText()); + } + } + } + } + public static Element getRootElement(RequestEvent evt) throws DocumentException { + + return getRootElement(evt, "gb2312"); + } + + public static Element getRootElement(RequestEvent evt, String charset) throws DocumentException { + Request request = evt.getRequest(); + return getRootElement(request.getRawContent(), charset); + } + + public static Element getRootElement(byte[] content, String charset) throws DocumentException { + if (charset == null) { + charset = "gb2312"; + } + SAXReader reader = new SAXReader(); + reader.setEncoding(charset); + Document xml = reader.read(new ByteArrayInputStream(content)); + return xml.getRootElement(); + } + + private enum ChannelType{ + CivilCode, BusinessGroup,VirtualOrganization,Other + } + + public static DeviceChannel channelContentHandler(Element itemDevice, Device device, String event, CivilCodeFileConf civilCodeFileConf){ + DeviceChannel deviceChannel = new DeviceChannel(); + deviceChannel.setDeviceId(device.getDeviceId()); + Element channdelIdElement = itemDevice.element("DeviceID"); + if (channdelIdElement == null) { + logger.warn("瑙f瀽Catalog娑堟伅鏃跺彂鐜扮己灏� DeviceID"); + return null; + } + String channelId = channdelIdElement.getTextTrim(); + if (ObjectUtils.isEmpty(channelId)) { + logger.warn("瑙f瀽Catalog娑堟伅鏃跺彂鐜扮己灏� DeviceID"); + return null; + } + deviceChannel.setChannelId(channelId); + if (event != null && !event.equals(CatalogEvent.ADD) && !event.equals(CatalogEvent.UPDATE)) { + // 闄や簡ADD鍜寀pdate鎯呭喌涓嬮渶瑕佽瘑鍒叏閮ㄥ唴瀹癸紝 + return deviceChannel; + } + Element nameElement = itemDevice.element("Name"); + if (nameElement != null) { + deviceChannel.setName(nameElement.getText()); + } + if(channelId.length() <= 8) { + deviceChannel.setHasAudio(false); + CivilCodePo parentCode = civilCodeFileConf.getParentCode(channelId); + if (parentCode != null) { + deviceChannel.setParentId(parentCode.getCode()); + deviceChannel.setCivilCode(parentCode.getCode()); + }else { + logger.warn("[xml瑙f瀽] 鏃犳硶纭畾琛屾斂鍖哄垝{}鐨勪笂绾ц鏀垮尯鍒�", channelId); + } + deviceChannel.setStatus(true); + return deviceChannel; + }else { + if(channelId.length() != 20) { + logger.warn("[xml瑙f瀽] 澶辫触锛岀紪鍙蜂笉绗﹀悎鍥芥爣28181瀹氫箟锛� {}", channelId); + return null; + } + + int code = Integer.parseInt(channelId.substring(10, 13)); + if (code == 136 || code == 137 || code == 138) { + deviceChannel.setHasAudio(true); + }else { + deviceChannel.setHasAudio(false); + } + // 璁惧鍘傚晢 + String manufacturer = getText(itemDevice, "Manufacturer"); + // 璁惧鍨嬪彿 + String model = getText(itemDevice, "Model"); + // 璁惧褰掑睘 + String owner = getText(itemDevice, "Owner"); + // 琛屾斂鍖哄煙 + String civilCode = getText(itemDevice, "CivilCode"); + // 铏氭嫙缁勭粐鎵�灞炵殑涓氬姟鍒嗙粍ID,涓氬姟鍒嗙粍鏍规嵁鐗瑰畾鐨勪笟鍔¢渶姹傚埗瀹�,涓�涓笟鍔″垎缁勫寘鍚竴缁勭壒瀹氱殑铏氭嫙缁勭粐 + String businessGroupID = getText(itemDevice, "BusinessGroupID"); + // 鐖惰澶�/鍖哄煙/绯荤粺ID + String parentID = getText(itemDevice, "ParentID"); + if (parentID != null && parentID.equalsIgnoreCase("null")) { + parentID = null; + } + // 娉ㄥ唽鏂瑰紡(蹇呴��)缂虹渷涓�1;1:绗﹀悎IETFRFC3261鏍囧噯鐨勮璇佹敞鍐屾ā寮�;2:鍩轰簬鍙d护鐨勫弻鍚戣璇佹敞鍐屾ā寮�;3:鍩轰簬鏁板瓧璇佷功鐨勫弻鍚戣璇佹敞鍐屾ā寮� + String registerWay = getText(itemDevice, "RegisterWay"); + // 淇濆瘑灞炴��(蹇呴��)缂虹渷涓�0;0:涓嶆秹瀵�,1:娑夊瘑 + String secrecy = getText(itemDevice, "Secrecy"); + // 瀹夎鍦板潃 + String address = getText(itemDevice, "Address"); + + switch (code){ + case 200: + // 绯荤粺鐩綍 + if (!ObjectUtils.isEmpty(manufacturer)) { + deviceChannel.setManufacture(manufacturer); + } + if (!ObjectUtils.isEmpty(model)) { + deviceChannel.setModel(model); + } + if (!ObjectUtils.isEmpty(owner)) { + deviceChannel.setOwner(owner); + } + if (!ObjectUtils.isEmpty(civilCode)) { + deviceChannel.setCivilCode(civilCode); + deviceChannel.setParentId(civilCode); + }else { + if (!ObjectUtils.isEmpty(parentID)) { + deviceChannel.setParentId(parentID); + } + } + if (!ObjectUtils.isEmpty(address)) { + deviceChannel.setAddress(address); + } + deviceChannel.setStatus(true); + if (!ObjectUtils.isEmpty(registerWay)) { + try { + deviceChannel.setRegisterWay(Integer.parseInt(registerWay)); + }catch (NumberFormatException exception) { + logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁鑾峰彇registerWay澶辫触锛� {}", registerWay); + } + } + if (!ObjectUtils.isEmpty(secrecy)) { + deviceChannel.setSecrecy(secrecy); + } + return deviceChannel; + case 215: + // 涓氬姟鍒嗙粍 + deviceChannel.setStatus(true); + if (!ObjectUtils.isEmpty(parentID)) { + if (!parentID.trim().equalsIgnoreCase(device.getDeviceId())) { + deviceChannel.setParentId(parentID); + } + }else { + logger.warn("[xml瑙f瀽] 涓氬姟鍒嗙粍鏁版嵁涓己灏戝叧閿俊鎭�->ParentId"); + if (!ObjectUtils.isEmpty(civilCode)) { + deviceChannel.setCivilCode(civilCode); + } + } + break; + case 216: + // 铏氭嫙缁勭粐 + deviceChannel.setStatus(true); + if (!ObjectUtils.isEmpty(businessGroupID)) { + deviceChannel.setBusinessGroupId(businessGroupID); + } + + if (!ObjectUtils.isEmpty(parentID)) { + if (parentID.contains("/")) { + String[] parentIdArray = parentID.split("/"); + parentID = parentIdArray[parentIdArray.length - 1]; + } + deviceChannel.setParentId(parentID); + }else { + if (!ObjectUtils.isEmpty(businessGroupID)) { + deviceChannel.setParentId(businessGroupID); + } + } + break; + default: + // 璁惧鐩綍 + if (!ObjectUtils.isEmpty(manufacturer)) { + deviceChannel.setManufacture(manufacturer); + } + if (!ObjectUtils.isEmpty(model)) { + deviceChannel.setModel(model); + } + if (!ObjectUtils.isEmpty(owner)) { + deviceChannel.setOwner(owner); + } + if (!ObjectUtils.isEmpty(civilCode) + && civilCode.length() <= 8 + && NumberUtils.isParsable(civilCode) + && civilCode.length()%2 == 0 + ) { + deviceChannel.setCivilCode(civilCode); + } + if (!ObjectUtils.isEmpty(businessGroupID)) { + deviceChannel.setBusinessGroupId(businessGroupID); + } + + // 璀﹀尯 + String block = getText(itemDevice, "Block"); + if (!ObjectUtils.isEmpty(block)) { + deviceChannel.setBlock(block); + } + if (!ObjectUtils.isEmpty(address)) { + deviceChannel.setAddress(address); + } + + if (!ObjectUtils.isEmpty(secrecy)) { + deviceChannel.setSecrecy(secrecy); + } + + // 褰撲负璁惧鏃�,鏄惁鏈夊瓙璁惧(蹇呴��)1鏈�,0娌℃湁 + String parental = getText(itemDevice, "Parental"); + if (!ObjectUtils.isEmpty(parental)) { + try { + // 鐢变簬娴峰悍浼氶敊璇殑鍙戦��65535浣滀负杩欓噷鐨勫彇鍊�,鎵�浠ヨ繖閲岄櫎闈炴槸0鍚﹀垯璁や负鏄�1 + if (!ObjectUtils.isEmpty(parental) && parental.length() == 1 && Integer.parseInt(parental) == 0) { + deviceChannel.setParental(0); + }else { + deviceChannel.setParental(1); + } + }catch (NumberFormatException e) { + logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁鑾峰彇 parental澶辫触锛� {}", parental); + } + } + // 鐖惰澶�/鍖哄煙/绯荤粺ID + + if (!ObjectUtils.isEmpty(parentID) ) { + if (parentID.contains("/")) { + String[] parentIdArray = parentID.split("/"); + deviceChannel.setParentId(parentIdArray[parentIdArray.length - 1]); + }else { + if (parentID.length()%2 == 0) { + deviceChannel.setParentId(parentID); + }else { + logger.warn("[xml瑙f瀽] 涓嶈鑼冪殑parentID锛歿}, 宸茶垗寮�", parentID); + } + } + }else { + if (!ObjectUtils.isEmpty(businessGroupID)) { + deviceChannel.setParentId(businessGroupID); + }else { + if (!ObjectUtils.isEmpty(deviceChannel.getCivilCode())) { + deviceChannel.setParentId(deviceChannel.getCivilCode()); + } + } + } + // 娉ㄥ唽鏂瑰紡 + if (!ObjectUtils.isEmpty(registerWay)) { + try { + int registerWayInt = Integer.parseInt(registerWay); + deviceChannel.setRegisterWay(registerWayInt); + }catch (NumberFormatException exception) { + logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁鑾峰彇registerWay澶辫触锛� {}", registerWay); + deviceChannel.setRegisterWay(1); + } + }else { + deviceChannel.setRegisterWay(1); + } + + // 淇′护瀹夊叏妯″紡(鍙��)缂虹渷涓�0; 0:涓嶉噰鐢�;2:S/MIME 绛惧悕鏂瑰紡;3:S/MIME鍔犲瘑绛惧悕鍚屾椂閲囩敤鏂瑰紡;4:鏁板瓧鎽樿鏂瑰紡 + String safetyWay = getText(itemDevice, "SafetyWay"); + if (!ObjectUtils.isEmpty(safetyWay)) { + try { + deviceChannel.setSafetyWay(Integer.parseInt(safetyWay)); + }catch (NumberFormatException e) { + logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁鑾峰彇 safetyWay澶辫触锛� {}", safetyWay); + } + } + + // 璇佷功搴忓垪鍙�(鏈夎瘉涔︾殑璁惧蹇呴��) + String certNum = getText(itemDevice, "CertNum"); + if (!ObjectUtils.isEmpty(certNum)) { + deviceChannel.setCertNum(certNum); + } + + // 璇佷功鏈夋晥鏍囪瘑(鏈夎瘉涔︾殑璁惧蹇呴��)缂虹渷涓�0;璇佷功鏈夋晥鏍囪瘑:0:鏃犳晥 1:鏈夋晥 + String certifiable = getText(itemDevice, "Certifiable"); + if (!ObjectUtils.isEmpty(certifiable)) { + try { + deviceChannel.setCertifiable(Integer.parseInt(certifiable)); + }catch (NumberFormatException e) { + logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁鑾峰彇 Certifiable澶辫触锛� {}", certifiable); + } + } + + // 鏃犳晥鍘熷洜鐮�(鏈夎瘉涔︿笖璇佷功鏃犳晥鐨勮澶囧繀閫�) + String errCode = getText(itemDevice, "ErrCode"); + if (!ObjectUtils.isEmpty(errCode)) { + try { + deviceChannel.setErrCode(Integer.parseInt(errCode)); + }catch (NumberFormatException e) { + logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁鑾峰彇 ErrCode澶辫触锛� {}", errCode); + } + } + + // 璇佷功缁堟鏈夋晥鏈�(鏈夎瘉涔︾殑璁惧蹇呴��) + String endTime = getText(itemDevice, "EndTime"); + if (!ObjectUtils.isEmpty(endTime)) { + deviceChannel.setEndTime(endTime); + } + + + // 璁惧/鍖哄煙/绯荤粺IP鍦板潃 + String ipAddress = getText(itemDevice, "IPAddress"); + if (!ObjectUtils.isEmpty(ipAddress)) { + deviceChannel.setIpAddress(ipAddress); + } + + // 璁惧/鍖哄煙/绯荤粺绔彛 + String port = getText(itemDevice, "Port"); + if (!ObjectUtils.isEmpty(port)) { + try { + deviceChannel.setPort(Integer.parseInt(port)); + }catch (NumberFormatException e) { + logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁鑾峰彇 Port澶辫触锛� {}", port); + } + } + + // 璁惧鍙d护 + String password = getText(itemDevice, "Password"); + if (!ObjectUtils.isEmpty(password)) { + deviceChannel.setPassword(password); + } + + + // 璁惧鐘舵�� + String status = getText(itemDevice, "Status"); + if (status != null) { + // ONLINE OFFLINE HIKVISION DS-7716N-E4 NVR鐨勫吋瀹规�у鐞� + if (status.equals("ON") || status.equals("On") || status.equals("ONLINE") || status.equals("OK")) { + deviceChannel.setStatus(true); + } + if (status.equals("OFF") || status.equals("Off") || status.equals("OFFLINE")) { + deviceChannel.setStatus(false); + } + }else { + deviceChannel.setStatus(true); + } + + // 缁忓害 + String longitude = getText(itemDevice, "Longitude"); + if (NumericUtil.isDouble(longitude)) { + deviceChannel.setLongitude(Double.parseDouble(longitude)); + } else { + deviceChannel.setLongitude(0.00); + } + + // 绾害 + String latitude = getText(itemDevice, "Latitude"); + if (NumericUtil.isDouble(latitude)) { + deviceChannel.setLatitude(Double.parseDouble(latitude)); + } else { + deviceChannel.setLatitude(0.00); + } + + deviceChannel.setGpsTime(DateUtil.getNow()); + + // -鎽勫儚鏈虹被鍨嬫墿灞�,鏍囪瘑鎽勫儚鏈虹被鍨�:1-鐞冩満;2-鍗婄悆;3-鍥哄畾鏋満;4-閬ユ帶鏋満銆傚綋鐩綍椤逛负鎽勫儚鏈烘椂鍙�� + String ptzType = getText(itemDevice, "PTZType"); + if (ObjectUtils.isEmpty(ptzType)) { + //鍏煎INFO涓殑淇℃伅 + Element info = itemDevice.element("Info"); + String ptzTypeFromInfo = XmlUtil.getText(info, "PTZType"); + if(!ObjectUtils.isEmpty(ptzTypeFromInfo)){ + try { + deviceChannel.setPTZType(Integer.parseInt(ptzTypeFromInfo)); + }catch (NumberFormatException e){ + logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁info涓幏鍙朠TZType澶辫触锛� {}", ptzTypeFromInfo); + } + } + } else { + try { + deviceChannel.setPTZType(Integer.parseInt(ptzType)); + }catch (NumberFormatException e){ + logger.warn("[xml瑙f瀽] 浠庨�氶亾鏁版嵁涓幏鍙朠TZType澶辫触锛� {}", ptzType); + } + } + + // TODO 鎽勫儚鏈轰綅缃被鍨嬫墿灞曘�� + // 1-鐪侀檯妫�鏌ョ珯銆� + // 2-鍏氭斂鏈哄叧銆� + // 3-杞︾珯鐮佸ご銆� + // 4-涓績骞垮満銆� + // 5-浣撹偛鍦洪銆� + // 6-鍟嗕笟涓績銆� + // 7-瀹楁暀鍦烘墍銆� + // 8-鏍″洯鍛ㄨ竟銆� + // 9-娌诲畨澶嶆潅鍖哄煙銆� + // 10-浜ら�氬共绾裤�� + // String positionType = getText(itemDevice, "PositionType"); + + // TODO 鎽勫儚鏈哄畨瑁呬綅缃澶栥�佸鍐呭睘鎬с��1-瀹ゅ銆�2-瀹ゅ唴銆� + // String roomType = getText(itemDevice, "RoomType"); + // TODO 鎽勫儚鏈虹敤閫斿睘鎬� + // String useType = getText(itemDevice, "UseType"); + // TODO 鎽勫儚鏈鸿ˉ鍏夊睘鎬с��1-鏃犺ˉ鍏夈��2-绾㈠琛ュ厜銆�3-鐧藉厜琛ュ厜 + // String supplyLightType = getText(itemDevice, "SupplyLightType"); + // TODO 鎽勫儚鏈虹洃瑙嗘柟浣嶅睘鎬с��1-涓溿��2-瑗裤��3-鍗椼��4-鍖椼��5-涓滃崡銆�6-涓滃寳銆�7-瑗垮崡銆�8-瑗垮寳銆� + // String directionType = getText(itemDevice, "DirectionType"); + // TODO 鎽勫儚鏈烘敮鎸佺殑鍒嗚鲸鐜�,鍙湁澶氫釜鍒嗚鲸鐜囧��,鍚勪釜鍙栧�奸棿浠モ��/鈥濆垎闅斻�傚垎杈ㄧ巼鍙栧�煎弬瑙侀檮褰� F涓璖DPf瀛楁瑙勫畾 + // String resolution = getText(itemDevice, "Resolution"); + + // TODO 涓嬭浇鍊嶉�熻寖鍥�(鍙��),鍚勫彲閫夊弬鏁颁互鈥�/鈥濆垎闅�,濡傝澶囨敮鎸�1,2,4鍊嶉�熶笅杞藉垯搴斿啓涓衡��1/2/4 + // String downloadSpeed = getText(itemDevice, "DownloadSpeed"); + // TODO 绌哄煙缂栫爜鑳藉姏,鍙栧��0:涓嶆敮鎸�;1:1绾у寮�(1涓寮哄眰);2:2绾у寮�(2涓寮哄眰);3:3绾у寮�(3涓寮哄眰) + // String svcSpaceSupportMode = getText(itemDevice, "SVCSpaceSupportMode"); + // TODO 鏃跺煙缂栫爜鑳藉姏,鍙栧��0:涓嶆敮鎸�;1:1绾у寮�;2:2绾у寮�;3:3绾у寮� + // String svcTimeSupportMode = getText(itemDevice, "SVCTimeSupportMode"); + + + deviceChannel.setSecrecy(secrecy); + break; + } + } + + return deviceChannel; + } + + /** + * 鏂板鏂规硶鏀寔鍐呴儴宓屽 + * + * @param element xmlElement + * @param clazz 缁撴灉绫� + * @param <T> 娉涘瀷 + * @return 缁撴灉瀵硅薄 + * @throws NoSuchMethodException + * @throws InvocationTargetException + * @throws InstantiationException + * @throws IllegalAccessException + */ + public static <T> T loadElement(Element element, Class<T> clazz) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { + Field[] fields = clazz.getDeclaredFields(); + T t = clazz.getDeclaredConstructor().newInstance(); + for (Field field : fields) { + ReflectionUtils.makeAccessible(field); + MessageElement annotation = field.getAnnotation(MessageElement.class); + if (annotation == null) { + continue; + } + String value = annotation.value(); + String subVal = annotation.subVal(); + Element element1 = element.element(value); + if (element1 == null) { + continue; + } + if ("".equals(subVal)) { + // 鏃犱笅绾ф暟鎹� + Object fieldVal = element1.isTextOnly() ? element1.getText() : loadElement(element1, field.getType()); + Object o = simpleTypeDeal(field.getType(), fieldVal); + ReflectionUtils.setField(field, t, o); + } else { + // 瀛樺湪涓嬬骇鏁版嵁 + ArrayList<Object> list = new ArrayList<>(); + Type genericType = field.getGenericType(); + if (!(genericType instanceof ParameterizedType)) { + continue; + } + Class<?> aClass = (Class<?>) ((ParameterizedType) genericType).getActualTypeArguments()[0]; + for (Element element2 : element1.elements(subVal)) { + list.add(loadElement(element2, aClass)); + } + ReflectionUtils.setField(field, t, list); + } + } + return t; + } + + /** + * 绠�鍗曠被鍨嬪鐞� + * + * @param tClass + * @param val + * @return + */ + private static Object simpleTypeDeal(Class<?> tClass, Object val) { + if (tClass.equals(String.class)) { + return val.toString(); + } + if (tClass.equals(Integer.class)) { + return Integer.valueOf(val.toString()); + } + if (tClass.equals(Double.class)) { + return Double.valueOf(val.toString()); + } + if (tClass.equals(Long.class)) { + return Long.valueOf(val.toString()); + } + return val; + } } \ No newline at end of file diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java index 863ff32..cf71bf1 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java @@ -21,6 +21,7 @@ private final static Logger logger = LoggerFactory.getLogger(AssistRESTfulUtils.class); + public interface RequestCallback{ void run(JSONObject response); } @@ -145,4 +146,25 @@ return sendGet(mediaServerItem, "api/record/addStreamCallInfo",param, callback); } + public JSONObject getDateList(MediaServerItem mediaServerItem, String app, String stream, int year, int month) { + Map<String, Object> param = new HashMap<>(); + param.put("app", app); + param.put("stream", stream); + param.put("year", year); + param.put("month", month); + return sendGet(mediaServerItem, "api/record/date/list", param, null); + } + + public JSONObject getFileList(MediaServerItem mediaServerItem, int page, int count, String app, String stream, + String startTime, String endTime) { + Map<String, Object> param = new HashMap<>(); + param.put("app", app); + param.put("stream", stream); + param.put("page", page); + param.put("count", count); + param.put("startTime", startTime); + param.put("endTime", endTime); + return sendGet(mediaServerItem, "api/record/file/listWithDate", param, null); + } + } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/SendRtpPortManager.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/SendRtpPortManager.java old mode 100644 new mode 100755 index f960c7d..3f28d02 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/SendRtpPortManager.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/SendRtpPortManager.java @@ -30,7 +30,7 @@ private final String KEY = "VM_MEDIA_SEND_RTP_PORT_"; - public int getNextPort(MediaServerItem mediaServer) { + public synchronized int getNextPort(MediaServerItem mediaServer) { if (mediaServer == null) { logger.warn("[鍙戦�佺鍙g鐞哴 鍙傛暟閿欒锛宮ediaServer涓篘ULL"); return -1; @@ -50,17 +50,15 @@ String sendRtpPortRange = mediaServer.getSendRtpPortRange(); int startPort; int endPort; - if (sendRtpPortRange == null) { - logger.warn("{}鏈缃彂閫佺鍙i粯璁ゅ�硷紝鑷姩浣跨敤40000-50000浣滀负绔彛鑼冨洿", mediaServer.getId()); + if (sendRtpPortRange != null) { String[] portArray = sendRtpPortRange.split(","); if (portArray.length != 2 || !NumberUtils.isParsable(portArray[0]) || !NumberUtils.isParsable(portArray[1])) { - logger.warn("{}鍙戦�佺鍙i厤缃牸寮忛敊璇紝鑷姩浣跨敤40000-50000浣滀负绔彛鑼冨洿", mediaServer.getId()); + logger.warn("{}鍙戦�佺鍙i厤缃牸寮忛敊璇紝鑷姩浣跨敤50000-60000浣滀负绔彛鑼冨洿", mediaServer.getId()); startPort = 50000; endPort = 60000; }else { - if ( Integer.parseInt(portArray[1]) - Integer.parseInt(portArray[0]) < 1) { - logger.warn("{}鍙戦�佺鍙i厤缃敊璇�,缁撴潫绔彛鑷冲皯姣斿紑濮嬬鍙eぇ涓�锛岃嚜鍔ㄤ娇鐢�40000-50000浣滀负绔彛鑼冨洿", mediaServer.getId()); + logger.warn("{}鍙戦�佺鍙i厤缃敊璇�,缁撴潫绔彛鑷冲皯姣斿紑濮嬬鍙eぇ涓�锛岃嚜鍔ㄤ娇鐢�50000-60000浣滀负绔彛鑼冨洿", mediaServer.getId()); startPort = 50000; endPort = 60000; }else { @@ -69,6 +67,7 @@ } } }else { + logger.warn("{}鏈缃彂閫佺鍙i粯璁ゅ�硷紝鑷姩浣跨敤50000-60000浣滀负绔彛鑼冨洿", mediaServer.getId()); startPort = 50000; endPort = 60000; } @@ -76,10 +75,35 @@ logger.warn("{}鑾峰彇redis杩炴帴淇℃伅澶辫触", mediaServer.getId()); return -1; } +// RedisAtomicInteger redisAtomicInteger = new RedisAtomicInteger(sendIndexKey , redisTemplate.getConnectionFactory()); +// return redisAtomicInteger.getAndUpdate((current)->{ +// return getPort(current, startPort, endPort, checkPort-> !sendRtpItemMap.containsKey(checkPort)); +// }); + return getSendPort(startPort, endPort, sendIndexKey, sendRtpItemMap); + } + + private synchronized int getSendPort(int startPort, int endPort, String sendIndexKey, Map<Integer, SendRtpItem> sendRtpItemMap){ RedisAtomicInteger redisAtomicInteger = new RedisAtomicInteger(sendIndexKey , redisTemplate.getConnectionFactory()); - return redisAtomicInteger.getAndUpdate((current)->{ - return getPort(current, startPort, endPort, checkPort-> !sendRtpItemMap.containsKey(checkPort)); - }); + if (redisAtomicInteger.get() < startPort) { + redisAtomicInteger.set(startPort); + return startPort; + }else { + int port = redisAtomicInteger.getAndIncrement(); + if (port > endPort) { + redisAtomicInteger.set(startPort); + if (sendRtpItemMap.containsKey(startPort)) { + return getSendPort(startPort, endPort, sendIndexKey, sendRtpItemMap); + }else { + return startPort; + } + } + if (sendRtpItemMap.containsKey(port)) { + return getSendPort(startPort, endPort, sendIndexKey, sendRtpItemMap); + }else { + return port; + } + } + } interface CheckPortCallback{ 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 old mode 100644 new mode 100755 index 0cd1602..87a3fc5 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java @@ -30,6 +30,7 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; +import com.genersoft.iot.vmp.vmanager.bean.OtherPsSendInfo; import com.genersoft.iot.vmp.vmanager.bean.OtherRtpSendInfo; import com.genersoft.iot.vmp.vmanager.bean.StreamContent; import org.slf4j.Logger; @@ -311,7 +312,10 @@ if (param.getApp().equalsIgnoreCase("rtp")) { String receiveKey = VideoManagerConstants.WVP_OTHER_RECEIVE_RTP_INFO + userSetting.getServerId() + "_" + param.getStream(); OtherRtpSendInfo otherRtpSendInfo = (OtherRtpSendInfo)redisTemplate.opsForValue().get(receiveKey); - if (otherRtpSendInfo != null) { + + String receiveKeyForPS = VideoManagerConstants.WVP_OTHER_RECEIVE_PS_INFO + userSetting.getServerId() + "_" + param.getStream(); + OtherPsSendInfo otherPsSendInfo = (OtherPsSendInfo)redisTemplate.opsForValue().get(receiveKeyForPS); + if (otherRtpSendInfo != null || otherPsSendInfo != null) { result.setEnable_mp4(true); } } @@ -696,7 +700,9 @@ result.onTimeout(() -> { logger.info("[ZLM HOOK] 棰勮娴佽嚜鍔ㄧ偣鎾�, 绛夊緟瓒呮椂"); msg.setData(new HookResult(ErrorCode.ERROR100.getCode(), "鐐规挱瓒呮椂")); - resultHolder.invokeResult(msg); + resultHolder.invokeAllResult(msg); + inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceId, channelId); + storager.stopPlay(deviceId, channelId); }); resultHolder.put(key, uuid, result); diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerConfig.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerConfig.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 index 72fed07..2422206 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java @@ -42,7 +42,7 @@ * @param tcpMode 0/null udp 妯″紡锛�1 tcp 琚姩妯″紡, 2 tcp 涓诲姩妯″紡銆� * @return */ - public int createRTPServer(MediaServerItem mediaServerItem, String streamId, int ssrc, Integer port, Boolean onlyAuto, Boolean reUsePort, Integer tcpMode) { + public int createRTPServer(MediaServerItem mediaServerItem, String streamId, long ssrc, Integer port, Boolean onlyAuto, Boolean reUsePort, Integer tcpMode) { int result = -1; // 鏌ヨ姝tp server 鏄惁宸茬粡瀛樺湪 JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, streamId); diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZlmHttpHookSubscribe.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZlmHttpHookSubscribe.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/ChannelOnlineEvent.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/ChannelOnlineEvent.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeFactory.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeFactory.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeForRtpServerTimeout.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeForRtpServerTimeout.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeForServerStarted.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeForServerStarted.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeForStreamChange.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeForStreamChange.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookType.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookType.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/IHookSubscribe.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/IHookSubscribe.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/ServerKeepaliveData.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/ServerKeepaliveData.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamAuthorityInfo.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamAuthorityInfo.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxyItem.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxyItem.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/ZLMRunInfo.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/ZLMRunInfo.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/HookParam.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/HookParam.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/HookResult.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/HookResult.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/HookResultForOnPublish.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/HookResultForOnPublish.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnPlayHookParam.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnPlayHookParam.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnPublishHookParam.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnPublishHookParam.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnRtpServerTimeoutHookParam.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnRtpServerTimeoutHookParam.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnSendRtpStoppedHookParam.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnSendRtpStoppedHookParam.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnServerKeepaliveHookParam.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnServerKeepaliveHookParam.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnStreamChangedHookParam.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnStreamChangedHookParam.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnStreamNoneReaderHookParam.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnStreamNoneReaderHookParam.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnStreamNotFoundHookParam.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnStreamNotFoundHookParam.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OriginType.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OriginType.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMEventAbstract.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMEventAbstract.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMOfflineEvent.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMOfflineEvent.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMOnlineEvent.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMOnlineEvent.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMStatusEventListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMStatusEventListener.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/IDeviceAlarmService.java b/src/main/java/com/genersoft/iot/vmp/service/IDeviceAlarmService.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java b/src/main/java/com/genersoft/iot/vmp/service/IDeviceChannelService.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/IDeviceService.java b/src/main/java/com/genersoft/iot/vmp/service/IDeviceService.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java b/src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/IInviteStreamService.java b/src/main/java/com/genersoft/iot/vmp/service/IInviteStreamService.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/ILogService.java b/src/main/java/com/genersoft/iot/vmp/service/ILogService.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java b/src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java old mode 100644 new mode 100755 index 657f294..bf7df28 --- a/src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java +++ b/src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java @@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.ServerKeepaliveData; import com.genersoft.iot.vmp.service.bean.MediaServerLoad; import com.genersoft.iot.vmp.service.bean.SSRCInfo; +import com.genersoft.iot.vmp.vmanager.bean.RecordFile; import java.util.List; @@ -95,4 +96,14 @@ * @return */ MediaServerLoad getLoad(MediaServerItem mediaServerItem); + + /** + * 鎸夋椂闂存煡鎵惧綍鍍忔枃浠� + */ + List<RecordFile> getRecords(String app, String stream, String startTime, String endTime, List<MediaServerItem> mediaServerItems); + + /** + * 鏌ユ壘瀛樺湪褰曞儚鏂囦欢鐨勬椂闂� + */ + List<String> getRecordDates(String app, String stream, int year, int month, List<MediaServerItem> mediaServerItems); } diff --git a/src/main/java/com/genersoft/iot/vmp/service/IMediaService.java b/src/main/java/com/genersoft/iot/vmp/service/IMediaService.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/IPlatformChannelService.java b/src/main/java/com/genersoft/iot/vmp/service/IPlatformChannelService.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/IPlatformService.java b/src/main/java/com/genersoft/iot/vmp/service/IPlatformService.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/IPlayService.java b/src/main/java/com/genersoft/iot/vmp/service/IPlayService.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/IRoleService.java b/src/main/java/com/genersoft/iot/vmp/service/IRoleService.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java b/src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java b/src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/IUserService.java b/src/main/java/com/genersoft/iot/vmp/service/IUserService.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/ErrorCallback.java b/src/main/java/com/genersoft/iot/vmp/service/bean/ErrorCallback.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/InviteErrorCode.java b/src/main/java/com/genersoft/iot/vmp/service/bean/InviteErrorCode.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/InviteTimeOutCallback.java b/src/main/java/com/genersoft/iot/vmp/service/bean/InviteTimeOutCallback.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/MediaServerLoad.java b/src/main/java/com/genersoft/iot/vmp/service/bean/MediaServerLoad.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/MessageForPushChannel.java b/src/main/java/com/genersoft/iot/vmp/service/bean/MessageForPushChannel.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/MessageForPushChannelResponse.java b/src/main/java/com/genersoft/iot/vmp/service/bean/MessageForPushChannelResponse.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/PlayBackCallback.java b/src/main/java/com/genersoft/iot/vmp/service/bean/PlayBackCallback.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/PlayBackResult.java b/src/main/java/com/genersoft/iot/vmp/service/bean/PlayBackResult.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/PushStreamStatusChangeFromRedisDto.java b/src/main/java/com/genersoft/iot/vmp/service/bean/PushStreamStatusChangeFromRedisDto.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/RequestPushStreamMsg.java b/src/main/java/com/genersoft/iot/vmp/service/bean/RequestPushStreamMsg.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/RequestSendItemMsg.java b/src/main/java/com/genersoft/iot/vmp/service/bean/RequestSendItemMsg.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/ResponseSendItemMsg.java b/src/main/java/com/genersoft/iot/vmp/service/bean/ResponseSendItemMsg.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/SSRCInfo.java b/src/main/java/com/genersoft/iot/vmp/service/bean/SSRCInfo.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/StreamPushItemFromRedis.java b/src/main/java/com/genersoft/iot/vmp/service/bean/StreamPushItemFromRedis.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/ThirdPartyGB.java b/src/main/java/com/genersoft/iot/vmp/service/bean/ThirdPartyGB.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/WvpRedisMsg.java b/src/main/java/com/genersoft/iot/vmp/service/bean/WvpRedisMsg.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceAlarmServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceAlarmServiceImpl.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 index 5192d1d..68e12f0 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java @@ -115,6 +115,7 @@ inviteStreamService.clearInviteInfo(device.getDeviceId()); } device.setUpdateTime(now); + device.setKeepaliveTime(now); if (device.getKeepaliveIntervalTime() == 0) { // 榛樿蹇冭烦闂撮殧60 device.setKeepaliveIntervalTime(60); @@ -535,6 +536,13 @@ if (!ObjectUtils.isEmpty(device.getSdpIp())) { deviceInStore.setSdpIp(device.getSdpIp()); } + if (!ObjectUtils.isEmpty(device.getPassword())) { + deviceInStore.setPassword(device.getPassword()); + } + if (!ObjectUtils.isEmpty(device.getStreamMode())) { + deviceInStore.setStreamMode(device.getStreamMode()); + } + // 鐩綍璁㈤槄鐩稿叧鐨勪俊鎭� if (device.getSubscribeCycleForCatalog() > 0) { @@ -568,18 +576,23 @@ if (deviceInStore.getGeoCoordSys() != null) { // 鍧愭爣绯诲彉鍖栵紝闇�瑕侀噸鏂拌绠桮CJ02鍧愭爣鍜學GS84鍧愭爣 if (!deviceInStore.getGeoCoordSys().equals(device.getGeoCoordSys())) { - updateDeviceChannelGeoCoordSys(device); + deviceInStore.setGeoCoordSys(device.getGeoCoordSys()); + updateDeviceChannelGeoCoordSys(deviceInStore); } }else { - device.setGeoCoordSys("WGS84"); + deviceInStore.setGeoCoordSys("WGS84"); } if (device.getCharset() == null) { - device.setCharset("GB2312"); + deviceInStore.setCharset("GB2312"); } - + //SSRC鏍¢獙 + deviceInStore.setSsrcCheck(device.isSsrcCheck()); + //浣滀负娑堟伅閫氶亾 + deviceInStore.setAsMessageChannel(device.isAsMessageChannel()); + // 鏇存柊redis - redisCatchStorage.updateDevice(device); - deviceMapper.updateCustom(device); + deviceMapper.updateCustom(deviceInStore); + redisCatchStorage.removeDevice(deviceInStore.getDeviceId()); } @Override diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/LogServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/LogServiceImpl.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java old mode 100644 new mode 100755 index b5faf1b..0556a84 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java @@ -24,23 +24,30 @@ import com.genersoft.iot.vmp.utils.JsonUtil; import com.genersoft.iot.vmp.utils.redis.RedisUtil; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; +import com.genersoft.iot.vmp.vmanager.bean.RecordFile; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.scheduling.annotation.Async; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Service; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionStatus; +import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; import java.io.File; import java.time.LocalDateTime; import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; /** * 濯掍綋鏈嶅姟鍣ㄨ妭鐐圭鐞� @@ -104,6 +111,11 @@ @Autowired private RedisTemplate<Object, Object> redisTemplate; + @Qualifier("taskExecutor") + @Autowired + private ThreadPoolTaskExecutor taskExecutor; + + @@ -118,7 +130,7 @@ continue; } // 鏇存柊 - if (ssrcFactory.hasMediaServerSSRC(mediaServerItem.getId())) { + if (!ssrcFactory.hasMediaServerSSRC(mediaServerItem.getId())) { ssrcFactory.initMediaServerSSRC(mediaServerItem.getId(), null); } // 鏌ヨredis鏄惁瀛樺湪姝ediaServer @@ -151,7 +163,7 @@ } if (streamId == null) { - streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase(); + streamId = String.format("%08x", Long.parseLong(ssrc)).toUpperCase(); } int ssrcCheckParam = 0; if (ssrcCheck && tcpMode > 1) { @@ -160,7 +172,7 @@ } int rtpServerPort; if (mediaServerItem.isRtpEnable()) { - rtpServerPort = zlmServerFactory.createRTPServer(mediaServerItem, streamId, (ssrcCheck && tcpMode == 0)?Integer.parseInt(ssrc):0, port, onlyAuto, reUsePort, tcpMode); + rtpServerPort = zlmServerFactory.createRTPServer(mediaServerItem, streamId, (ssrcCheck && tcpMode == 0) ? Long.parseLong(ssrc) : 0, port, onlyAuto, reUsePort, tcpMode); } else { rtpServerPort = mediaServerItem.getRtpProxyPort(); } @@ -225,7 +237,7 @@ mediaServerMapper.update(mediaSerItem); MediaServerItem mediaServerItemInRedis = getOne(mediaSerItem.getId()); MediaServerItem mediaServerItemInDataBase = mediaServerMapper.queryOne(mediaSerItem.getId()); - if (mediaServerItemInRedis == null || ssrcFactory.hasMediaServerSSRC(mediaSerItem.getId())) { + if (mediaServerItemInRedis == null || !ssrcFactory.hasMediaServerSSRC(mediaSerItem.getId())) { ssrcFactory.initMediaServerSSRC(mediaServerItemInDataBase.getId(),null); } String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItemInDataBase.getId(); @@ -408,7 +420,7 @@ } mediaServerMapper.update(serverItem); String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + zlmServerConfig.getGeneralMediaServerId(); - if (ssrcFactory.hasMediaServerSSRC(serverItem.getId())) { + if (!ssrcFactory.hasMediaServerSSRC(serverItem.getId())) { ssrcFactory.initMediaServerSSRC(zlmServerConfig.getGeneralMediaServerId(), null); } redisTemplate.opsForValue().set(key, serverItem); @@ -758,4 +770,89 @@ return result; } + @Override + public List<RecordFile> getRecords(String app, String stream, String startTime, String endTime, List<MediaServerItem> mediaServerItems) { + Assert.notNull(app, "app涓嶅瓨鍦�"); + Assert.notNull(stream, "stream涓嶅瓨鍦�"); + Assert.notNull(startTime, "startTime涓嶅瓨鍦�"); + Assert.notNull(endTime, "endTime涓嶅瓨鍦�"); + Assert.notEmpty(mediaServerItems, "娴佸獟浣撳垪琛ㄤ负绌�"); + + CompletableFuture[] completableFutures = new CompletableFuture[mediaServerItems.size()]; + for (int i = 0; i < mediaServerItems.size(); i++) { + completableFutures[i] = getRecordFilesForOne(app, stream, startTime, endTime, mediaServerItems.get(i)); + } + List<RecordFile> result = new ArrayList<>(); + for (int i = 0; i < completableFutures.length; i++) { + try { + List<RecordFile> list = (List<RecordFile>) completableFutures[i].get(); + if (!list.isEmpty()) { + for (int g = 0; g < list.size(); g++) { + list.get(g).setMediaServerId(mediaServerItems.get(i).getId()); + } + result.addAll(list); + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } catch (ExecutionException e) { + throw new RuntimeException(e); + } + } + Comparator<RecordFile> comparator = Comparator.comparing(RecordFile::getFileName); + result.sort(comparator); + return result; + } + + @Override + public List<String> getRecordDates(String app, String stream, int year, int month, List<MediaServerItem> mediaServerItems) { + Assert.notNull(app, "app涓嶅瓨鍦�"); + Assert.notNull(stream, "stream涓嶅瓨鍦�"); + Assert.notEmpty(mediaServerItems, "娴佸獟浣撳垪琛ㄤ负绌�"); + CompletableFuture[] completableFutures = new CompletableFuture[mediaServerItems.size()]; + + for (int i = 0; i < mediaServerItems.size(); i++) { + completableFutures[i] = getRecordDatesForOne(app, stream, year, month, mediaServerItems.get(i)); + } + List<String> result = new ArrayList<>(); + CompletableFuture.allOf(completableFutures).join(); + for (CompletableFuture completableFuture : completableFutures) { + try { + List<String> list = (List<String>) completableFuture.get(); + result.addAll(list); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } catch (ExecutionException e) { + throw new RuntimeException(e); + } + } + Collections.sort(result); + return result; + } + + @Async + public CompletableFuture<List<String>> getRecordDatesForOne(String app, String stream, int year, int month, MediaServerItem mediaServerItem) { + JSONObject fileListJson = assistRESTfulUtils.getDateList(mediaServerItem, app, stream, year, month); + if (fileListJson != null && !fileListJson.isEmpty()) { + if (fileListJson.getString("code") != null && fileListJson.getInteger("code") == 0) { + JSONArray data = fileListJson.getJSONArray("data"); + return CompletableFuture.completedFuture(data.toJavaList(String.class)); + } + } + return CompletableFuture.completedFuture(new ArrayList<>()); + } + + @Async + public CompletableFuture<List<RecordFile>> getRecordFilesForOne(String app, String stream, String startTime, String endTime, MediaServerItem mediaServerItem) { + JSONObject fileListJson = assistRESTfulUtils.getFileList(mediaServerItem, 1, 100000000, app, stream, startTime, endTime); + if (fileListJson != null && !fileListJson.isEmpty()) { + if (fileListJson.getString("code") != null && fileListJson.getInteger("code") == 0) { + JSONObject data = fileListJson.getJSONObject("data"); + JSONArray list = data.getJSONArray("list"); + if (list != null) { + return CompletableFuture.completedFuture(list.toJavaList(RecordFile.class)); + } + } + } + return CompletableFuture.completedFuture(new ArrayList<>()); + } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java old mode 100644 new mode 100755 index dbde373..067329d --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java @@ -251,7 +251,6 @@ // 璁剧疆骞冲彴绂荤嚎锛屽苟閲嶆柊娉ㄥ唽 logger.info("[鍥芥爣绾ц仈] 涓夋蹇冭烦瓒呮椂, 骞冲彴{}({})绂荤嚎", parentPlatform.getName(), parentPlatform.getServerGBId()); offline(parentPlatform, false); - } }else { @@ -266,6 +265,7 @@ platformCatch.setKeepAliveReply(0); redisCatchStorage.updatePlatformCatchInfo(platformCatch); } + logger.info("[鍙戦�佸績璺砞 鍥芥爣绾ц仈 鍙戦�佸績璺�, code锛� {}, msg: {}", eventResult.statusCode, eventResult.msg); }); } catch (SipException | InvalidArgumentException | ParseException e) { logger.error("[鍛戒护鍙戦�佸け璐 鍥芥爣绾ц仈 鍙戦�佸績璺�: {}", e.getMessage()); @@ -293,7 +293,7 @@ eventResult.statusCode, eventResult.msg); offline(parentPlatform, false); }, null); - } catch (InvalidArgumentException | ParseException | SipException e) { + } catch (Exception e) { logger.error("[鍛戒护鍙戦�佸け璐 鍥芥爣绾ц仈瀹氭椂娉ㄥ唽: {}", e.getMessage()); } } 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 old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/RoleServerImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/RoleServerImpl.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/UserServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/UserServiceImpl.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisAlarmMsgListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisAlarmMsgListener.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisCloseStreamMsgListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisCloseStreamMsgListener.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGpsMsgListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGpsMsgListener.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamResponseListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamResponseListener.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusMsgListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusMsgListener.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisStreamMsgListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisStreamMsgListener.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java b/src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java b/src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 index bdc45bf..d48b802 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java @@ -193,7 +193,7 @@ @Update(value = {"UPDATE wvp_device_channel SET status=false WHERE device_id=#{deviceId} AND channel_id=#{channelId}"}) void offline(String deviceId, String channelId); - @Update(value = {"UPDATE wvp_device_channel SET status=fasle WHERE device_id=#{deviceId}"}) + @Update(value = {"UPDATE wvp_device_channel SET status=false WHERE device_id=#{deviceId}"}) void offlineByDeviceId(String deviceId); @Insert("<script> " + 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 old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/dto/ChannelSourceInfo.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/dto/ChannelSourceInfo.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/dto/LogDto.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/dto/LogDto.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/dto/PlatformRegisterInfo.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/dto/PlatformRegisterInfo.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/dto/RecordInfo.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/dto/RecordInfo.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/dto/Role.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/dto/Role.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/dto/User.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/dto/User.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 index eeb0e62..891f13d --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java @@ -16,6 +16,7 @@ import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; 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.dto.PlatformRegisterInfo; import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.utils.JsonUtil; @@ -39,6 +40,9 @@ @Autowired private DeviceChannelMapper deviceChannelMapper; + + @Autowired + private DeviceMapper deviceMapper; @Autowired private UserSetting userSetting; @@ -375,7 +379,8 @@ for (Object o : keys) { String key = (String) o; Device device = JsonUtil.redisJsonToObject(redisTemplate, key, Device.class); - if (Objects.nonNull(device)) { // 鍙彇娌℃湁瀛樿繃寰� + if (Objects.nonNull(device)) { + // 鍙彇娌℃湁瀛樿繃寰� result.add(JsonUtil.redisJsonToObject(redisTemplate, key, Device.class)); } } @@ -386,14 +391,22 @@ @Override public Device getDevice(String deviceId) { String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId; - return JsonUtil.redisJsonToObject(redisTemplate, key, Device.class); + Device device = JsonUtil.redisJsonToObject(redisTemplate, key, Device.class); + if (device == null){ + device = deviceMapper.getDeviceByDeviceId(deviceId); + if (device != null) { + updateDevice(device); + } + } + return device; } @Override public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) { String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gpsMsgInfo.getId(); Duration duration = Duration.ofSeconds(60L); - redisTemplate.opsForValue().set(key, gpsMsgInfo, duration); // 榛樿GPS娑堟伅淇濆瓨1鍒嗛挓 + redisTemplate.opsForValue().set(key, gpsMsgInfo, duration); + // 榛樿GPS娑堟伅淇濆瓨1鍒嗛挓 } @Override diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/utils/Coordtransform.java b/src/main/java/com/genersoft/iot/vmp/utils/Coordtransform.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java b/src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java old mode 100644 new mode 100755 index 23cb9da..1abf2c6 --- a/src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java +++ b/src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java @@ -1,6 +1,8 @@ package com.genersoft.iot.vmp.utils; +import org.apache.commons.lang3.ObjectUtils; + import java.time.Instant; import java.time.LocalDate; import java.time.LocalDateTime; @@ -109,6 +111,9 @@ } public static long getDifferenceForNow(String keepaliveTime) { + if (ObjectUtils.isEmpty(keepaliveTime)) { + return 0; + } Instant beforeInstant = Instant.from(formatter.parse(keepaliveTime)); return ChronoUnit.MILLIS.between(beforeInstant, Instant.now()); } diff --git a/src/main/java/com/genersoft/iot/vmp/utils/GitUtil.java b/src/main/java/com/genersoft/iot/vmp/utils/GitUtil.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/utils/GpsUtil.java b/src/main/java/com/genersoft/iot/vmp/utils/GpsUtil.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/utils/JsonUtil.java b/src/main/java/com/genersoft/iot/vmp/utils/JsonUtil.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/utils/SpringBeanFactory.java b/src/main/java/com/genersoft/iot/vmp/utils/SpringBeanFactory.java old mode 100644 new mode 100755 index 5323875..1806524 --- a/src/main/java/com/genersoft/iot/vmp/utils/SpringBeanFactory.java +++ b/src/main/java/com/genersoft/iot/vmp/utils/SpringBeanFactory.java @@ -1,50 +1,50 @@ -package com.genersoft.iot.vmp.utils; - -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.stereotype.Component; - -/** - * @description:spring bean鑾峰彇宸ュ巶锛岃幏鍙杝pring涓殑宸插垵濮嬪寲鐨刡ean - * @author: swwheihei - * @date: 2019骞�6鏈�25鏃� 涓嬪崍4:51:52 - * - */ -@Component -public class SpringBeanFactory implements ApplicationContextAware { - - // Spring搴旂敤涓婁笅鏂囩幆澧� - private static ApplicationContext applicationContext; - - /** - * 瀹炵幇ApplicationContextAware鎺ュ彛鐨勫洖璋冩柟娉曪紝璁剧疆涓婁笅鏂囩幆澧� - */ - @Override - public void setApplicationContext(ApplicationContext applicationContext) - throws BeansException { - SpringBeanFactory.applicationContext = applicationContext; - } - - public static ApplicationContext getApplicationContext() { - return applicationContext; - } - - /** - * 鑾峰彇瀵硅薄 杩欓噷閲嶅啓浜哹ean鏂规硶锛岃捣涓昏浣滅敤 - */ - public static <T> T getBean(String beanId) throws BeansException { - if (applicationContext == null) { - return null; - } - return (T) applicationContext.getBean(beanId); - } - - /** - * 鑾峰彇褰撳墠鐜 - */ - public static String getActiveProfile() { - return applicationContext.getEnvironment().getActiveProfiles()[0]; - } - -} +package com.genersoft.iot.vmp.utils; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +/** + * @description:spring bean鑾峰彇宸ュ巶锛岃幏鍙杝pring涓殑宸插垵濮嬪寲鐨刡ean + * @author: swwheihei + * @date: 2019骞�6鏈�25鏃� 涓嬪崍4:51:52 + * + */ +@Component +public class SpringBeanFactory implements ApplicationContextAware { + + // Spring搴旂敤涓婁笅鏂囩幆澧� + private static ApplicationContext applicationContext; + + /** + * 瀹炵幇ApplicationContextAware鎺ュ彛鐨勫洖璋冩柟娉曪紝璁剧疆涓婁笅鏂囩幆澧� + */ + @Override + public void setApplicationContext(ApplicationContext applicationContext) + throws BeansException { + SpringBeanFactory.applicationContext = applicationContext; + } + + public static ApplicationContext getApplicationContext() { + return applicationContext; + } + + /** + * 鑾峰彇瀵硅薄 杩欓噷閲嶅啓浜哹ean鏂规硶锛岃捣涓昏浣滅敤 + */ + public static <T> T getBean(String beanId) throws BeansException { + if (applicationContext == null) { + return null; + } + return (T) applicationContext.getBean(beanId); + } + + /** + * 鑾峰彇褰撳墠鐜 + */ + public static String getActiveProfile() { + return applicationContext.getEnvironment().getActiveProfiles()[0]; + } + +} diff --git a/src/main/java/com/genersoft/iot/vmp/utils/SystemInfoUtils.java b/src/main/java/com/genersoft/iot/vmp/utils/SystemInfoUtils.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/utils/UJson.java b/src/main/java/com/genersoft/iot/vmp/utils/UJson.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/utils/redis/FastJsonRedisSerializer.java b/src/main/java/com/genersoft/iot/vmp/utils/redis/FastJsonRedisSerializer.java old mode 100644 new mode 100755 index 466a503..86b7dce --- a/src/main/java/com/genersoft/iot/vmp/utils/redis/FastJsonRedisSerializer.java +++ b/src/main/java/com/genersoft/iot/vmp/utils/redis/FastJsonRedisSerializer.java @@ -1,45 +1,45 @@ -package com.genersoft.iot.vmp.utils.redis; - -import com.alibaba.fastjson2.JSON; -import com.alibaba.fastjson2.JSONReader; -import com.alibaba.fastjson2.JSONWriter; -import org.springframework.data.redis.serializer.RedisSerializer; -import org.springframework.data.redis.serializer.SerializationException; - -import java.nio.charset.Charset; - -/** - * @description:浣跨敤fastjson瀹炵幇redis鐨勫簭鍒楀寲 - * @author: swwheihei - * @date: 2020骞�5鏈�6鏃� 涓嬪崍8:40:11 - */ -public class FastJsonRedisSerializer<T> implements RedisSerializer<T> { - - public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); - - private Class<T> clazz; - - public FastJsonRedisSerializer(Class<T> clazz) { - super(); - this.clazz = clazz; - } - - @Override - public byte[] serialize(T t) throws SerializationException { - if (t == null) { - return new byte[0]; - } - return JSON.toJSONString(t, JSONWriter.Feature.WriteClassName, JSONWriter.Feature.WritePairAsJavaBean).getBytes(DEFAULT_CHARSET); - } - - @Override - public T deserialize(byte[] bytes) throws SerializationException { - if (bytes == null || bytes.length <= 0) { - return null; - } - String str = new String(bytes, DEFAULT_CHARSET); - return JSON.parseObject(str, clazz, JSONReader.Feature.SupportAutoType); - } - - -} +package com.genersoft.iot.vmp.utils.redis; + +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONReader; +import com.alibaba.fastjson2.JSONWriter; +import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.data.redis.serializer.SerializationException; + +import java.nio.charset.Charset; + +/** + * @description:浣跨敤fastjson瀹炵幇redis鐨勫簭鍒楀寲 + * @author: swwheihei + * @date: 2020骞�5鏈�6鏃� 涓嬪崍8:40:11 + */ +public class FastJsonRedisSerializer<T> implements RedisSerializer<T> { + + public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); + + private Class<T> clazz; + + public FastJsonRedisSerializer(Class<T> clazz) { + super(); + this.clazz = clazz; + } + + @Override + public byte[] serialize(T t) throws SerializationException { + if (t == null) { + return new byte[0]; + } + return JSON.toJSONString(t, JSONWriter.Feature.WriteClassName, JSONWriter.Feature.WritePairAsJavaBean).getBytes(DEFAULT_CHARSET); + } + + @Override + public T deserialize(byte[] bytes) throws SerializationException { + if (bytes == null || bytes.length <= 0) { + return null; + } + String str = new String(bytes, DEFAULT_CHARSET); + return JSON.parseObject(str, clazz, JSONReader.Feature.SupportAutoType); + } + + +} diff --git a/src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java b/src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java old mode 100644 new mode 100755 index 31e89f9..101a3b3 --- a/src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java +++ b/src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java @@ -1,46 +1,47 @@ -package com.genersoft.iot.vmp.utils.redis; - -import org.springframework.data.redis.core.Cursor; -import org.springframework.data.redis.core.RedisCallback; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.core.ScanOptions; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * Redis宸ュ叿绫� - * - * @author swwheihei - * @date 2020骞�5鏈�6鏃� 涓嬪崍8:27:29 - */ -@SuppressWarnings(value = {"rawtypes", "unchecked"}) -public class RedisUtil { - - /** - * 妯$硦鏌ヨ - * - * @param query 鏌ヨ鍙傛暟 - * @return - */ - public static List<Object> scan(RedisTemplate redisTemplate, String query) { - - Set<String> resultKeys = (Set<String>) redisTemplate.execute((RedisCallback<Set<String>>) connection -> { - ScanOptions scanOptions = ScanOptions.scanOptions().match("*" + query + "*").count(1000).build(); - Cursor<byte[]> scan = connection.scan(scanOptions); - Set<String> keys = new HashSet<>(); - while (scan.hasNext()) { - byte[] next = scan.next(); - keys.add(new String(next)); - } - return keys; - }); - - return new ArrayList<>(resultKeys); - } -} - - - +package com.genersoft.iot.vmp.utils.redis; + +import com.google.common.collect.Lists; +import org.springframework.data.redis.core.Cursor; +import org.springframework.data.redis.core.RedisCallback; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ScanOptions; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Redis宸ュ叿绫� + * + * @author swwheihei + * @date 2020骞�5鏈�6鏃� 涓嬪崍8:27:29 + */ +@SuppressWarnings(value = {"rawtypes", "unchecked"}) +public class RedisUtil { + + /** + * 妯$硦鏌ヨ + * + * @param query 鏌ヨ鍙傛暟 + * @return + */ + public static List<Object> scan(RedisTemplate redisTemplate, String query) { + + Set<String> resultKeys = (Set<String>) redisTemplate.execute((RedisCallback<Set<String>>) connection -> { + ScanOptions scanOptions = ScanOptions.scanOptions().match("*" + query + "*").count(1000).build(); + Cursor<byte[]> scan = connection.scan(scanOptions); + Set<String> keys = new HashSet<>(); + while (scan.hasNext()) { + byte[] next = scan.next(); + keys.add(new String(next)); + } + return keys; + }); + + return Lists.newArrayList(resultKeys); + } +} + + + diff --git a/src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil2.java b/src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil2.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/BaseTree.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/BaseTree.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/BatchGBStreamParam.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/BatchGBStreamParam.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/DeferredResultEx.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/DeferredResultEx.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/DeferredResultFilter.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/DeferredResultFilter.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/ErrorCode.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/ErrorCode.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/OtherPsSendInfo.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/OtherPsSendInfo.java new file mode 100755 index 0000000..ac98409 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/OtherPsSendInfo.java @@ -0,0 +1,137 @@ +package com.genersoft.iot.vmp.vmanager.bean; + +public class OtherPsSendInfo { + + /** + * 鍙戞祦IP + */ + private String sendLocalIp; + + /** + * 鍙戞祦绔彛 + */ + private int sendLocalPort; + + /** + * 鏀舵祦IP + */ + private String receiveIp; + + /** + * 鏀舵祦绔彛 + */ + private int receivePort; + + + /** + * 浼氳瘽ID + */ + private String callId; + + /** + * 娴両D + */ + private String stream; + + /** + * 鎺ㄦ祦搴旂敤鍚� + */ + private String pushApp; + + /** + * 鎺ㄦ祦娴両D + */ + private String pushStream; + + /** + * 鎺ㄦ祦SSRC + */ + private String pushSSRC; + + public String getSendLocalIp() { + return sendLocalIp; + } + + public void setSendLocalIp(String sendLocalIp) { + this.sendLocalIp = sendLocalIp; + } + + public int getSendLocalPort() { + return sendLocalPort; + } + + public void setSendLocalPort(int sendLocalPort) { + this.sendLocalPort = sendLocalPort; + } + + public String getReceiveIp() { + return receiveIp; + } + + public void setReceiveIp(String receiveIp) { + this.receiveIp = receiveIp; + } + + public int getReceivePort() { + return receivePort; + } + + public void setReceivePort(int receivePort) { + this.receivePort = receivePort; + } + + public String getCallId() { + return callId; + } + + public void setCallId(String callId) { + this.callId = callId; + } + + public String getStream() { + return stream; + } + + public void setStream(String stream) { + this.stream = stream; + } + + public String getPushApp() { + return pushApp; + } + + public void setPushApp(String pushApp) { + this.pushApp = pushApp; + } + + public String getPushStream() { + return pushStream; + } + + public void setPushStream(String pushStream) { + this.pushStream = pushStream; + } + + public String getPushSSRC() { + return pushSSRC; + } + + public void setPushSSRC(String pushSSRC) { + this.pushSSRC = pushSSRC; + } + + @Override + public String toString() { + return "OtherPsSendInfo{" + + "sendLocalIp='" + sendLocalIp + '\'' + + ", sendLocalPort=" + sendLocalPort + + ", receiveIp='" + receiveIp + '\'' + + ", receivePort=" + receivePort + + ", callId='" + callId + '\'' + + ", stream='" + stream + '\'' + + ", pushApp='" + pushApp + '\'' + + ", pushStream='" + pushStream + '\'' + + ", pushSSRC='" + pushSSRC + '\'' + + '}'; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/OtherRtpSendInfo.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/OtherRtpSendInfo.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/PageInfo.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/PageInfo.java new file mode 100755 index 0000000..8894191 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/PageInfo.java @@ -0,0 +1,99 @@ +package com.genersoft.iot.vmp.vmanager.bean; + +import java.util.ArrayList; +import java.util.List; + +public class PageInfo<T> { + //褰撳墠椤� + private int pageNum; + //姣忛〉鐨勬暟閲� + private int pageSize; + //褰撳墠椤电殑鏁伴噺 + private int size; + //鎬婚〉鏁� + private int pages; + //鎬绘暟 + private int total; + + private List<T> resultData; + + private List<T> list; + + public PageInfo(List<T> resultData) { + this.resultData = resultData; + } + + public PageInfo() { + } + + public void startPage(int page, int count) { + if (count <= 0) count = 10; + if (page <= 0) page = 1; + this.pageNum = page; + this.pageSize = count; + this.total = resultData.size(); + + this.pages = total % count == 0 ? total / count : total / count + 1; + int fromIndx = (page - 1) * count; + if (fromIndx > this.total - 1) { + this.list = new ArrayList<>(); + this.size = 0; + return; + } + + int toIndx = page * count; + if (toIndx > this.total) { + toIndx = this.total; + } + this.list = this.resultData.subList(fromIndx, toIndx); + this.size = this.list.size(); + } + + public int getPageNum() { + return pageNum; + } + + public void setPageNum(int pageNum) { + this.pageNum = pageNum; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getSize() { + return size; + } + + public void setSize(int size) { + this.size = size; + } + + public int getPages() { + return pages; + } + + public void setPages(int pages) { + this.pages = pages; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public List<T> getList() { + return list; + } + + public void setList(List<T> list) { + this.list = list; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/PlayTypeEnum.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/PlayTypeEnum.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/RecordFile.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/RecordFile.java new file mode 100755 index 0000000..72d6561 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/RecordFile.java @@ -0,0 +1,53 @@ +package com.genersoft.iot.vmp.vmanager.bean; + +public class RecordFile { + private String app; + private String stream; + + private String fileName; + + private String mediaServerId; + + private String date; + + + public String getApp() { + return app; + } + + public void setApp(String app) { + this.app = app; + } + + public String getStream() { + return stream; + } + + public void setStream(String stream) { + this.stream = stream; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getMediaServerId() { + return mediaServerId; + } + + public void setMediaServerId(String mediaServerId) { + this.mediaServerId = mediaServerId; + } + + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceBaseInfo.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceBaseInfo.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceInfo.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/ResourceInfo.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/SnapPath.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/SnapPath.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/StreamContent.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/StreamContent.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/StreamPushExcelDto.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/StreamPushExcelDto.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/SystemConfigInfo.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/SystemConfigInfo.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/WVPResult.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/WVPResult.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/cloudRecord/CloudRecordController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/cloudRecord/CloudRecordController.java new file mode 100755 index 0000000..0f37a7d --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/cloudRecord/CloudRecordController.java @@ -0,0 +1,145 @@ +package com.genersoft.iot.vmp.vmanager.cloudRecord; + +import com.genersoft.iot.vmp.conf.DynamicTask; +import com.genersoft.iot.vmp.conf.UserSetting; +import com.genersoft.iot.vmp.conf.exception.ControllerException; +import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager; +import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; +import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; +import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; +import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; +import com.genersoft.iot.vmp.vmanager.bean.PageInfo; +import com.genersoft.iot.vmp.vmanager.bean.RecordFile; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.commons.lang3.ObjectUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +@SuppressWarnings("rawtypes") +@Tag(name = "浜戠褰曞儚鎺ュ彛") + +@RestController +@RequestMapping("/api/cloud/record") +public class CloudRecordController { + + @Autowired + private ZLMServerFactory zlmServerFactory; + + @Autowired + private SendRtpPortManager sendRtpPortManager; + + private final static Logger logger = LoggerFactory.getLogger(CloudRecordController.class); + + @Autowired + private ZlmHttpHookSubscribe hookSubscribe; + + @Autowired + private IMediaServerService mediaServerService; + + @Autowired + private UserSetting userSetting; + + @Autowired + private DynamicTask dynamicTask; + + @Autowired + private RedisTemplate<Object, Object> redisTemplate; + + @ResponseBody + @GetMapping("/date/list") + @Operation(summary = "鏌ヨ瀛樺湪浜戠褰曞儚鐨勬棩鏈�") + @Parameter(name = "app", description = "搴旂敤鍚�", required = true) + @Parameter(name = "stream", description = "娴両D", required = true) + @Parameter(name = "year", description = "骞达紝缃┖鍒欐煡璇㈠綋骞�", required = false) + @Parameter(name = "month", description = "鏈堬紝缃┖鍒欐煡璇㈠綋鏈�", required = false) + @Parameter(name = "mediaServerId", description = "娴佸獟浣揑D锛岀疆绌哄垯鏌ヨ鍏ㄩ儴", required = false) + public List<String> openRtpServer( + @RequestParam String app, + @RequestParam String stream, + @RequestParam(required = false) int year, + @RequestParam(required = false) int month, + @RequestParam(required = false) String mediaServerId + + ) { + logger.info("[浜戠褰曞儚] 鏌ヨ瀛樺湪浜戠褰曞儚鐨勬棩鏈� app->{}, stream->{}, mediaServerId->{}, year->{}, month->{}", + app, stream, mediaServerId, year, month); + Calendar calendar = Calendar.getInstance(); + if (ObjectUtils.isEmpty(year)) { + year = calendar.get(Calendar.YEAR); + } + if (ObjectUtils.isEmpty(month)) { + month = calendar.get(Calendar.MONTH) + 1; + } + List<MediaServerItem> mediaServerItems; + if (!ObjectUtils.isEmpty(mediaServerId)) { + mediaServerItems = new ArrayList<>(); + MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId); + if (mediaServerItem == null) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "鏈壘鍒版祦濯掍綋: " + mediaServerId); + } + mediaServerItems.add(mediaServerItem); + } else { + mediaServerItems = mediaServerService.getAll(); + } + if (mediaServerItems.isEmpty()) { + return new ArrayList<>(); + } + + return mediaServerService.getRecordDates(app, stream, year, month, mediaServerItems); + } + + @ResponseBody + @GetMapping("/list") + @Operation(summary = "鍒嗛〉鏌ヨ浜戠褰曞儚") + @Parameter(name = "app", description = "搴旂敤鍚�", required = true) + @Parameter(name = "stream", description = "娴両D", required = true) + @Parameter(name = "page", description = "褰撳墠椤�", required = false) + @Parameter(name = "count", description = "姣忛〉鏌ヨ鏁伴噺", required = false) + @Parameter(name = "startTime", description = "寮�濮嬫椂闂�(yyyy-MM-dd HH:mm:ss)", required = true) + @Parameter(name = "endTime", description = "缁撴潫鏃堕棿(yyyy-MM-dd HH:mm:ss)", required = true) + @Parameter(name = "mediaServerId", description = "娴佸獟浣揑D锛岀疆绌哄垯鏌ヨ鍏ㄩ儴娴佸獟浣�", required = false) + public PageInfo<RecordFile> openRtpServer( + @RequestParam String app, + @RequestParam String stream, + @RequestParam int page, + @RequestParam int count, + @RequestParam String startTime, + @RequestParam String endTime, + @RequestParam(required = false) String mediaServerId + + ) { + logger.info("[浜戠褰曞儚] 鏌ヨ app->{}, stream->{}, mediaServerId->{}, page->{}, count->{}, startTime->{}, endTime->{}", + app, stream, mediaServerId, page, count, startTime, endTime); + + List<MediaServerItem> mediaServerItems; + if (!ObjectUtils.isEmpty(mediaServerId)) { + mediaServerItems = new ArrayList<>(); + MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId); + if (mediaServerItem == null) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "鏈壘鍒版祦濯掍綋: " + mediaServerId); + } + mediaServerItems.add(mediaServerItem); + } else { + mediaServerItems = mediaServerService.getAll(); + } + if (mediaServerItems.isEmpty()) { + return new PageInfo<>(); + } + List<RecordFile> records = mediaServerService.getRecords(app, stream, startTime, endTime, mediaServerItems); + PageInfo<RecordFile> pageInfo = new PageInfo<>(records); + pageInfo.startPage(page, count); + return pageInfo; + } + + +} diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/MobilePosition/MobilePositionController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/MobilePosition/MobilePositionController.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/alarm/AlarmController.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceConfig.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceConfig.java old mode 100644 new mode 100755 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 old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/bean/GbStreamParam.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/bean/GbStreamParam.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/ChannelReduce.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/ChannelReduce.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/UpdateChannelParam.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/bean/UpdateChannelParam.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/bean/PlayResult.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/bean/PlayResult.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/record/GBRecordController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/record/GBRecordController.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java old mode 100644 new mode 100755 index 3aabd92..937bc08 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java @@ -61,7 +61,7 @@ query = null; } - if (!userSetting.getLogInDatebase()) { + if (!userSetting.getLogInDatabase()) { logger.warn("鑷姩璁板綍鏃ュ織鍔熻兘宸插叧闂紝鏌ヨ缁撴灉鍙兘涓嶅畬鏁淬��"); } diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/ps/PsController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/ps/PsController.java new file mode 100755 index 0000000..d5fbf43 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/ps/PsController.java @@ -0,0 +1,322 @@ +package com.genersoft.iot.vmp.vmanager.ps; + +import com.alibaba.fastjson2.JSONObject; +import com.genersoft.iot.vmp.common.VideoManagerConstants; +import com.genersoft.iot.vmp.conf.DynamicTask; +import com.genersoft.iot.vmp.conf.UserSetting; +import com.genersoft.iot.vmp.conf.exception.ControllerException; +import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager; +import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; +import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory; +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForRtpServerTimeout; +import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange; +import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; +import com.genersoft.iot.vmp.media.zlm.dto.hook.OnRtpServerTimeoutHookParam; +import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.utils.redis.RedisUtil; +import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; +import com.genersoft.iot.vmp.vmanager.bean.OtherPsSendInfo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.web.bind.annotation.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +@SuppressWarnings("rawtypes") +@Tag(name = "绗笁鏂筆S鏈嶅姟瀵规帴") + +@RestController +@RequestMapping("/api/ps") +public class PsController { + + private final static Logger logger = LoggerFactory.getLogger(PsController.class); + + @Autowired + private ZLMServerFactory zlmServerFactory; + + @Autowired + private ZlmHttpHookSubscribe hookSubscribe; + + @Autowired + private IMediaServerService mediaServerService; + + @Autowired + private SendRtpPortManager sendRtpPortManager; + + @Autowired + private UserSetting userSetting; + + @Autowired + private DynamicTask dynamicTask; + + + @Autowired + private RedisTemplate<Object, Object> redisTemplate; + + + @GetMapping(value = "/receive/open") + @ResponseBody + @Operation(summary = "寮�鍚敹娴佸拰鑾峰彇鍙戞祦淇℃伅") + @Parameter(name = "isSend", description = "鏄惁鍙戦�侊紝false鏃跺彧寮�鍚敹娴侊紝 true鍚屾椂杩斿洖鎺ㄦ祦淇℃伅", required = true) + @Parameter(name = "callId", description = "鏁翠釜杩囩▼鐨勫敮涓�鏍囪瘑锛屼负浜嗕笌鍚庣画鎺ュ彛鍏宠仈", required = true) + @Parameter(name = "ssrc", description = "鏉ユ簮娴佺殑SSRC锛屼笉浼犲垯涓嶆牎楠屾潵婧恠src", required = false) + @Parameter(name = "stream", description = "褰㈡垚鐨勬祦鐨処D", required = true) + @Parameter(name = "tcpMode", description = "鏀舵祦妯″紡锛� 0涓篣DP锛� 1涓篢CP琚姩", required = true) + @Parameter(name = "callBack", description = "鍥炶皟鍦板潃锛屽鏋滄敹娴佽秴鏃朵細閫氶亾鍥炶皟閫氱煡锛屽洖璋冧负get璇锋眰锛屽弬鏁颁负callId", required = true) + public OtherPsSendInfo openRtpServer(Boolean isSend, @RequestParam(required = false)String ssrc, String callId, String stream, Integer tcpMode, String callBack) { + + logger.info("[绗笁鏂筆S鏈嶅姟瀵规帴->寮�鍚敹娴佸拰鑾峰彇鍙戞祦淇℃伅] isSend->{}, ssrc->{}, callId->{}, stream->{}, tcpMode->{}, callBack->{}", + isSend, ssrc, callId, stream, tcpMode==0?"UDP":"TCP琚姩", callBack); + + MediaServerItem mediaServerItem = mediaServerService.getDefaultMediaServer(); + if (mediaServerItem == null) { + throw new ControllerException(ErrorCode.ERROR100.getCode(),"娌℃湁鍙敤鐨凪ediaServer"); + } + if (stream == null) { + throw new ControllerException(ErrorCode.ERROR100.getCode(),"stream鍙傛暟涓嶅彲涓虹┖"); + } + if (isSend != null && isSend && callId == null) { + throw new ControllerException(ErrorCode.ERROR100.getCode(),"isSend涓簍rue鏃讹紝CallID涓嶈兘涓虹┖"); + } + long ssrcInt = 0; + if (ssrc != null) { + try { + ssrcInt = Long.parseLong(ssrc); + }catch (NumberFormatException e) { + throw new ControllerException(ErrorCode.ERROR100.getCode(),"ssrc鏍煎紡閿欒"); + } + } + String receiveKey = VideoManagerConstants.WVP_OTHER_RECEIVE_PS_INFO + userSetting.getServerId() + "_" + callId + "_" + stream; + int localPort = zlmServerFactory.createRTPServer(mediaServerItem, stream, ssrcInt, null, false, tcpMode); + if (localPort == 0) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "鑾峰彇绔彛澶辫触"); + } + // 娉ㄥ唽鍥炶皟濡傛灉rtp鏀舵祦瓒呮椂鍒欓�氳繃鍥炶皟鍙戦�侀�氱煡 + if (callBack != null) { + HookSubscribeForRtpServerTimeout hookSubscribeForRtpServerTimeout = HookSubscribeFactory.on_rtp_server_timeout(stream, String.valueOf(ssrcInt), mediaServerItem.getId()); + // 璁㈤槄 zlm鍚姩浜嬩欢, 鏂扮殑zlm涔熶細浠庤繖閲岃繘鍏ョ郴缁� + hookSubscribe.addSubscribe(hookSubscribeForRtpServerTimeout, + (mediaServerItemInUse, hookParam)->{ + OnRtpServerTimeoutHookParam serverTimeoutHookParam = (OnRtpServerTimeoutHookParam) hookParam; + if (stream.equals(serverTimeoutHookParam.getStream_id())) { + logger.info("[绗笁鏂筆S鏈嶅姟瀵规帴->寮�鍚敹娴佸拰鑾峰彇鍙戞祦淇℃伅] 绛夊緟鏀舵祦瓒呮椂 callId->{}, 鍙戦�佸洖璋�", callId); + // 灏嗕俊鎭啓鍏edis涓紝浠ュ鍚庣敤 + redisTemplate.delete(receiveKey); + OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder(); + OkHttpClient client = httpClientBuilder.build(); + String url = callBack + "?callId=" + callId; + Request request = new Request.Builder().get().url(url).build(); + try { + client.newCall(request).execute(); + } catch (IOException e) { + logger.error("[绗笁鏂筆S鏈嶅姟瀵规帴->寮�鍚敹娴佸拰鑾峰彇鍙戞祦淇℃伅] 绛夊緟鏀舵祦瓒呮椂 callId->{}, 鍙戦�佸洖璋冨け璐�", callId, e); + } + hookSubscribe.removeSubscribe(hookSubscribeForRtpServerTimeout); + } + }); + } + OtherPsSendInfo otherPsSendInfo = new OtherPsSendInfo(); + otherPsSendInfo.setReceiveIp(mediaServerItem.getSdpIp()); + otherPsSendInfo.setReceivePort(localPort); + otherPsSendInfo.setCallId(callId); + otherPsSendInfo.setStream(stream); + + // 灏嗕俊鎭啓鍏edis涓紝浠ュ鍚庣敤 + redisTemplate.opsForValue().set(receiveKey, otherPsSendInfo); + if (isSend != null && isSend) { + String key = VideoManagerConstants.WVP_OTHER_SEND_PS_INFO + userSetting.getServerId() + "_" + callId; + // 棰勫垱寤哄彂娴佷俊鎭� + int port = sendRtpPortManager.getNextPort(mediaServerItem); + + otherPsSendInfo.setSendLocalIp(mediaServerItem.getSdpIp()); + otherPsSendInfo.setSendLocalPort(port); + // 灏嗕俊鎭啓鍏edis涓紝浠ュ鍚庣敤 + redisTemplate.opsForValue().set(key, otherPsSendInfo, 300, TimeUnit.SECONDS); + logger.info("[绗笁鏂筆S鏈嶅姟瀵规帴->寮�鍚敹娴佸拰鑾峰彇鍙戞祦淇℃伅] 缁撴灉锛宑allId->{}锛� {}", callId, otherPsSendInfo); + } + return otherPsSendInfo; + } + + @GetMapping(value = "/receive/close") + @ResponseBody + @Operation(summary = "鍏抽棴鏀舵祦") + @Parameter(name = "stream", description = "娴佺殑ID", required = true) + public void closeRtpServer(String stream) { + logger.info("[绗笁鏂筆S鏈嶅姟瀵规帴->鍏抽棴鏀舵祦] stream->{}", stream); + MediaServerItem mediaServerItem = mediaServerService.getDefaultMediaServer(); + zlmServerFactory.closeRtpServer(mediaServerItem,stream); + String receiveKey = VideoManagerConstants.WVP_OTHER_RECEIVE_PS_INFO + userSetting.getServerId() + "_*_" + stream; + List<Object> scan = RedisUtil.scan(redisTemplate, receiveKey); + if (!scan.isEmpty()) { + for (Object key : scan) { + // 灏嗕俊鎭啓鍏edis涓紝浠ュ鍚庣敤 + redisTemplate.delete(key); + } + } + } + + @GetMapping(value = "/send/start") + @ResponseBody + @Operation(summary = "鍙戦�佹祦") + @Parameter(name = "ssrc", description = "鍙戦�佹祦鐨凷SRC", required = true) + @Parameter(name = "dstIp", description = "鐩爣鏀舵祦IP", required = true) + @Parameter(name = "dstPort", description = "鐩爣鏀舵祦绔彛", required = true) + @Parameter(name = "app", description = "寰呭彂閫佸簲鐢ㄥ悕", required = true) + @Parameter(name = "stream", description = "寰呭彂閫佹祦Id", required = true) + @Parameter(name = "callId", description = "鏁翠釜杩囩▼鐨勫敮涓�鏍囪瘑锛屼笉浼犲垯浣跨敤闅忔満绔彛鍙戞祦", required = true) + @Parameter(name = "isUdp", description = "鏄惁涓篣DP", required = true) + public void sendRTP(String ssrc, + String dstIp, + Integer dstPort, + String app, + String stream, + String callId, + Boolean isUdp + ) { + logger.info("[绗笁鏂筆S鏈嶅姟瀵规帴->鍙戦�佹祦] " + + "ssrc->{}, \r\n" + + "dstIp->{}, \n" + + "dstPort->{}, \n" + + "app->{}, \n" + + "stream->{}, \n" + + "callId->{} \n", + ssrc, + dstIp, + dstPort, + app, + stream, + callId); + MediaServerItem mediaServerItem = mediaServerService.getDefaultMediaServer(); + String key = VideoManagerConstants.WVP_OTHER_SEND_PS_INFO + userSetting.getServerId() + "_" + callId; + OtherPsSendInfo sendInfo = (OtherPsSendInfo)redisTemplate.opsForValue().get(key); + if (sendInfo == null) { + sendInfo = new OtherPsSendInfo(); + } + sendInfo.setPushApp(app); + sendInfo.setPushStream(stream); + sendInfo.setPushSSRC(ssrc); + + Map<String, Object> param; + + + param = new HashMap<>(); + param.put("vhost","__defaultVhost__"); + param.put("app",app); + param.put("stream",stream); + param.put("ssrc", ssrc); + + param.put("dst_url", dstIp); + param.put("dst_port", dstPort); + String is_Udp = isUdp ? "1" : "0"; + param.put("is_udp", is_Udp); + param.put("src_port", sendInfo.getSendLocalPort()); + + + Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, app, stream); + if (streamReady) { + JSONObject jsonObject = zlmServerFactory.startSendRtpStream(mediaServerItem, param); + if (jsonObject.getInteger("code") == 0) { + logger.info("[绗笁鏂筆S鏈嶅姟瀵规帴->鍙戦�佹祦] 瑙嗛娴佸彂娴佹垚鍔燂紝callId->{}锛宲aram->{}", callId, param); + redisTemplate.opsForValue().set(key, sendInfo); + }else { + redisTemplate.delete(key); + logger.info("[绗笁鏂筆S鏈嶅姟瀵规帴->鍙戦�佹祦] 瑙嗛娴佸彂娴佸け璐ワ紝callId->{}, {}", callId, jsonObject.getString("msg")); + throw new ControllerException(ErrorCode.ERROR100.getCode(), "[瑙嗛娴佸彂娴佸け璐 " + jsonObject.getString("msg")); + } + }else { + logger.info("[绗笁鏂筆S鏈嶅姟瀵规帴->鍙戦�佹祦] 娴佷笉瀛樺湪锛岀瓑寰呮祦涓婄嚎锛宑allId->{}", callId); + String uuid = UUID.randomUUID().toString(); + HookSubscribeForStreamChange hookSubscribeForStreamChange = HookSubscribeFactory.on_stream_changed(app, stream, true, "rtsp", mediaServerItem.getId()); + dynamicTask.startDelay(uuid, ()->{ + logger.info("[绗笁鏂筆S鏈嶅姟瀵规帴->鍙戦�佹祦] 绛夊緟娴佷笂绾胯秴鏃� callId->{}", callId); + redisTemplate.delete(key); + hookSubscribe.removeSubscribe(hookSubscribeForStreamChange); + }, 10000); + + // 璁㈤槄 zlm鍚姩浜嬩欢, 鏂扮殑zlm涔熶細浠庤繖閲岃繘鍏ョ郴缁� + OtherPsSendInfo finalSendInfo = sendInfo; + hookSubscribe.removeSubscribe(hookSubscribeForStreamChange); + hookSubscribe.addSubscribe(hookSubscribeForStreamChange, + (mediaServerItemInUse, response)->{ + dynamicTask.stop(uuid); + logger.info("[绗笁鏂筆S鏈嶅姟瀵规帴->鍙戦�佹祦] 娴佷笂绾匡紝寮�濮嬪彂娴� callId->{}", callId); + try { + Thread.sleep(400); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + JSONObject jsonObject = zlmServerFactory.startSendRtpStream(mediaServerItem, param); + if (jsonObject.getInteger("code") == 0) { + logger.info("[绗笁鏂筆S鏈嶅姟瀵规帴->鍙戦�佹祦] 瑙嗛娴佸彂娴佹垚鍔燂紝callId->{}锛宲aram->{}", callId, param); + redisTemplate.opsForValue().set(key, finalSendInfo); + }else { + redisTemplate.delete(key); + logger.info("[绗笁鏂筆S鏈嶅姟瀵规帴->鍙戦�佹祦] 瑙嗛娴佸彂娴佸け璐ワ紝callId->{}, {}", callId, jsonObject.getString("msg")); + throw new ControllerException(ErrorCode.ERROR100.getCode(), "[瑙嗛娴佸彂娴佸け璐 " + jsonObject.getString("msg")); + } + hookSubscribe.removeSubscribe(hookSubscribeForStreamChange); + }); + } + } + + @GetMapping(value = "/send/stop") + @ResponseBody + @Operation(summary = "鍏抽棴鍙戦�佹祦") + @Parameter(name = "callId", description = "鏁翠釜杩囩▼鐨勫敮涓�鏍囪瘑锛屼笉浼犲垯浣跨敤闅忔満绔彛鍙戞祦", required = true) + public void closeSendRTP(String callId) { + logger.info("[绗笁鏂筆S鏈嶅姟瀵规帴->鍏抽棴鍙戦�佹祦] callId->{}", callId); + String key = VideoManagerConstants.WVP_OTHER_SEND_PS_INFO + userSetting.getServerId() + "_" + callId; + OtherPsSendInfo sendInfo = (OtherPsSendInfo)redisTemplate.opsForValue().get(key); + if (sendInfo == null){ + throw new ControllerException(ErrorCode.ERROR100.getCode(), "鏈紑鍚彂娴�"); + } + Map<String, Object> param = new HashMap<>(); + param.put("vhost","__defaultVhost__"); + param.put("app",sendInfo.getPushApp()); + param.put("stream",sendInfo.getPushStream()); + param.put("ssrc",sendInfo.getPushSSRC()); + MediaServerItem mediaServerItem = mediaServerService.getDefaultMediaServer(); + Boolean result = zlmServerFactory.stopSendRtpStream(mediaServerItem, param); + if (!result) { + logger.info("[绗笁鏂筆S鏈嶅姟瀵规帴->鍏抽棴鍙戦�佹祦] 澶辫触 callId->{}", callId); + throw new ControllerException(ErrorCode.ERROR100.getCode(), "鍋滄鍙戞祦澶辫触"); + }else { + logger.info("[绗笁鏂筆S鏈嶅姟瀵规帴->鍏抽棴鍙戦�佹祦] 鎴愬姛 callId->{}", callId); + } + redisTemplate.delete(key); + } + + + @GetMapping(value = "/getTestPort") + @ResponseBody + public int getTestPort() { + MediaServerItem defaultMediaServer = mediaServerService.getDefaultMediaServer(); + +// for (int i = 0; i <300; i++) { +// new Thread(() -> { +// int nextPort = sendRtpPortManager.getNextPort(defaultMediaServer); +// try { +// Thread.sleep((int)Math.random()*10); +// } catch (InterruptedException e) { +// throw new RuntimeException(e); +// } +// System.out.println(nextPort); +// }).start(); +// } + + return sendRtpPortManager.getNextPort(defaultMediaServer); + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/record/RecordController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/record/RecordController.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java old mode 100644 new mode 100755 index f609a8d..bd283a2 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java @@ -91,10 +91,10 @@ if (isSend != null && isSend && callId == null) { throw new ControllerException(ErrorCode.ERROR100.getCode(),"isSend涓簍rue鏃讹紝CallID涓嶈兘涓虹┖"); } - int ssrcInt = 0; + long ssrcInt = 0; if (ssrc != null) { try { - ssrcInt = Integer.parseInt(ssrc); + ssrcInt = Long.parseLong(ssrc); }catch (NumberFormatException e) { throw new ControllerException(ErrorCode.ERROR100.getCode(),"ssrc鏍煎紡閿欒"); } @@ -247,7 +247,6 @@ String is_Udp = isUdp ? "1" : "0"; paramForAudio.put("is_udp", is_Udp); paramForAudio.put("src_port", sendInfo.getSendLocalPortForAudio()); - paramForAudio.put("use_ps", "0"); paramForAudio.put("only_audio", "1"); if (ptForAudio != null) { paramForAudio.put("pt", ptForAudio); @@ -268,7 +267,6 @@ String is_Udp = isUdp ? "1" : "0"; paramForVideo.put("is_udp", is_Udp); paramForVideo.put("src_port", sendInfo.getSendLocalPortForVideo()); - paramForVideo.put("use_ps", "0"); paramForVideo.put("only_audio", "0"); if (ptForVideo != null) { paramForVideo.put("pt", ptForVideo); diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/user/RoleController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/user/RoleController.java old mode 100644 new mode 100755 diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java old mode 100644 new mode 100755 index 090cf33..25137e5 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java @@ -58,7 +58,7 @@ if (user == null) { throw new ControllerException(ErrorCode.ERROR100.getCode(), "鐢ㄦ埛鍚嶆垨瀵嗙爜閿欒"); }else { - String jwt = JwtUtils.createToken(username, password, user.getRole().getId()); + String jwt = JwtUtils.createToken(username); response.setHeader(JwtUtils.getHeader(), jwt); user.setAccessToken(jwt); } diff --git a/src/main/resources/all-application.yml b/src/main/resources/all-application.yml index 1368961..a59acc3 100644 --- a/src/main/resources/all-application.yml +++ b/src/main/resources/all-application.yml @@ -178,7 +178,7 @@ # 鍥芥爣鏄惁褰曞埗 record-sip: true # 鏄惁灏嗘棩蹇楀瓨鍌ㄨ繘鏁版嵁搴� - logInDatebase: true + logInDatabase: true # 浣跨敤鎺ㄦ祦鐘舵�佷綔涓烘帹娴侀�氶亾鐘舵�� use-pushing-as-status: true # 浣跨敤鏉ユ簮璇锋眰ip浣滀负streamIp,褰撲笖浠呭綋浣犲彧鏈墇lm鑺傜偣瀹冧笌wvp鍦ㄤ竴璧风殑鎯呭喌涓嬪紑鍚� diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 504c9c6..e149886 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -19,14 +19,14 @@ # [鍙�塢 鏁版嵁搴� DB database: 7 # [鍙�塢 璁块棶瀵嗙爜,鑻ヤ綘鐨剅edis鏈嶅姟鍣ㄦ病鏈夎缃瘑鐮侊紝灏变笉闇�瑕佺敤瀵嗙爜鍘昏繛鎺� - password: + password: luna # [鍙�塢 瓒呮椂鏃堕棿 timeout: 10000 # mysql鏁版嵁婧� datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://127.0.0.1:3306/test_gb-89wulian?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true + url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true username: root password: root hikari: @@ -38,7 +38,7 @@ max-lifetime: 1200000 # 鏄睜涓繛鎺ュ叧闂悗鐨勬渶闀跨敓鍛藉懆鏈燂紙浠ユ绉掍负鍗曚綅) #[鍙�塢 WVP鐩戝惉鐨凥TTP绔彛, 缃戦〉鍜屾帴鍙h皟鐢ㄩ兘鏄繖涓鍙� server: - port: 18978 + port: 8080 # [鍙�塢 HTTPS閰嶇疆锛� 榛樿涓嶅紑鍚� ssl: # [鍙�塢 鏄惁寮�鍚疕TTPS璁块棶 @@ -56,7 +56,7 @@ # 濡傛灉瑕佺洃鍚寮犵綉鍗★紝鍙互浣跨敤閫楀彿鍒嗛殧澶氫釜IP锛� 渚嬪锛� 192.168.1.4,10.0.0.4 # 濡傛灉涓嶆槑鐧斤紝灏变娇鐢�0.0.0.0锛屽ぇ閮ㄥ垎鎯呭喌閮芥槸鍙互鐨� # 璇蜂笉瑕佷娇鐢�127.0.0.1锛屼换浣曞寘鎷琹ocalhost鍦ㄥ唴鐨勫煙鍚嶉兘鏄笉鍙互鐨勩�� - ip: 192.168.1.18 + ip: 172.19.128.50 # [鍙�塢 28181鏈嶅姟鐩戝惉鐨勭鍙� port: 8116 # 鏍规嵁鍥芥爣6.1.2涓瀹氾紝domain瀹滈噰鐢↖D缁熶竴缂栫爜鐨勫墠鍗佷綅缂栫爜銆傚浗鏍囬檮褰旸涓畾涔夊墠8浣嶄负涓績缂栫爜锛堢敱鐪佺骇銆佸競绾с�佸尯绾с�佸熀灞傜紪鍙风粍鎴愶紝鍙傜収GB/T 2260-2007锛� @@ -73,21 +73,21 @@ #zlm 榛樿鏈嶅姟鍣ㄩ厤缃� media: - id: 89wulian-one + id: zlmediakit-local # [蹇呴』淇敼] zlm鏈嶅姟鍣ㄧ殑鍐呯綉IP - ip: 192.168.1.18 + ip: 172.19.128.50 # [蹇呴』淇敼] zlm鏈嶅姟鍣ㄧ殑http.port - http-port: 80 + http-port: 9092 # [鍙�塢 杩斿洖娴佸湴鍧�鏃剁殑ip锛岀疆绌轰娇鐢� media.ip - stream-ip: 192.168.1.18 + stream-ip: 172.19.128.50 # [鍙�塢 wvp鍦ㄥ浗鏍囦俊浠や腑浣跨敤鐨刬p锛屾ip涓烘憚鍍忔満鍙互璁块棶鍒扮殑ip锛� 缃┖浣跨敤 media.ip - sdp-ip: 192.168.1.18 + sdp-ip: 172.19.128.50 # [鍙�塢 zlm鏈嶅姟鍣ㄧ殑hook鎵�浣跨敤鐨処P, 榛樿浣跨敤sip.ip - hook-ip: 192.168.1.18 + hook-ip: 172.19.128.50 # [鍙�塢 zlm鏈嶅姟鍣ㄧ殑http.sslport, 缃┖浣跨敤zlm閰嶇疆鏂囦欢閰嶇疆 - http-ssl-port: 443 + http-ssl-port: 1443 # [鍙�塢 zlm鏈嶅姟鍣ㄧ殑hook.admin_params=secret - secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc + secret: 10000 # 鍚敤澶氱鍙fā寮�, 澶氱鍙fā寮忎娇鐢ㄧ鍙e尯鍒嗘瘡璺祦锛屽吋瀹规�ф洿濂姐�� 鍗曠鍙d娇鐢ㄦ祦鐨剆src鍖哄垎锛� 鐐规挱瓒呮椂寤鸿浣跨敤澶氱鍙f祴璇� rtp: # [鍙�塢 鏄惁鍚敤澶氱鍙fā寮�, 寮�鍚悗浼氬湪portRange鑼冨洿鍐呴�夋嫨绔彛鐢ㄤ簬濯掍綋娴佷紶杈� diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3f47844..80de5ef 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -2,4 +2,4 @@ application: name: wvp profiles: - active: local \ No newline at end of file + active: dev \ No newline at end of file diff --git a/web_src/src/App.vue b/web_src/src/App.vue old mode 100644 new mode 100755 diff --git a/web_src/src/assets/icons.png b/web_src/src/assets/icons.png old mode 100644 new mode 100755 Binary files differ diff --git a/web_src/src/assets/loading.png b/web_src/src/assets/loading.png old mode 100644 new mode 100755 Binary files differ diff --git a/web_src/src/assets/login-bg.jpg b/web_src/src/assets/login-bg.jpg old mode 100644 new mode 100755 Binary files differ diff --git a/web_src/src/assets/login-cloud.png b/web_src/src/assets/login-cloud.png old mode 100644 new mode 100755 Binary files differ diff --git a/web_src/src/assets/logo.png b/web_src/src/assets/logo.png old mode 100644 new mode 100755 Binary files differ diff --git a/web_src/src/assets/play.png b/web_src/src/assets/play.png old mode 100644 new mode 100755 Binary files differ diff --git a/web_src/src/assets/zlm-log.png b/web_src/src/assets/zlm-log.png old mode 100644 new mode 100755 Binary files differ diff --git a/web_src/src/components/CloudRecord.vue b/web_src/src/components/CloudRecord.vue old mode 100644 new mode 100755 index b046fc9..c13cdc4 --- a/web_src/src/components/CloudRecord.vue +++ b/web_src/src/components/CloudRecord.vue @@ -47,19 +47,17 @@ :total="total"> </el-pagination> </div> - <cloud-record-detail ref="cloudRecordDetail" v-if="recordDetail" :recordFile="chooseRecord" :mediaServerId="mediaServerId" :mediaServerPath="mediaServerPath" ></cloud-record-detail> </div> </template> <script> import uiHeader from '../layout/UiHeader.vue' - import cloudRecordDetail from './CloudRecordDetail.vue' import MediaServer from './service/MediaServer' export default { name: 'app', components: { - uiHeader, cloudRecordDetail + uiHeader }, data() { return { @@ -178,7 +176,7 @@ // }).catch(function (error) { // console.log(error); // }); - + this.$router.push(`/cloudRecordDetail/${row.app}/${row.stream}`) }, deleteRecord(){ // TODO diff --git a/web_src/src/components/CloudRecordDetail.vue b/web_src/src/components/CloudRecordDetail.vue old mode 100644 new mode 100755 index 6983b54..4dbd06e --- a/web_src/src/components/CloudRecordDetail.vue +++ b/web_src/src/components/CloudRecordDetail.vue @@ -1,33 +1,62 @@ <template> - <div id="recordDetail"> - <el-container> + <div id="recordDetail" style="width: 100%"> + <div class="page-header" style="margin-bottom: 0"> + <div class="page-title"> + <el-page-header @back="backToList" content="浜戠褰曞儚"></el-page-header> + </div> + + <div class="page-header-btn" v-if="!this.$route.params.mediaServerId" style="padding-right: 1rem"> + <!-- 鑺傜偣閫夋嫨:--> + <!-- <el-select size="mini" @change="chooseMediaChange" style="width: 16rem; margin-right: 1rem;" v-model="mediaServerId" placeholder="璇烽�夋嫨" >--> + <!-- <el-option--> + <!-- key="undefined"--> + <!-- label="鍏ㄩ儴"--> + <!-- value="undefined">--> + <!-- </el-option>--> + <!-- <el-option--> + <!-- v-for="item in mediaServerList"--> + <!-- :key="item"--> + <!-- :label="item"--> + <!-- :value="item">--> + <!-- </el-option>--> + <!-- </el-select>--> + <b>鑺傜偣锛�</b> {{ mediaServerId }} + </div> + <div v-if="this.$route.params.mediaServerId" style="margin-right: 1rem;"> + <span>娴佸獟浣擄細{{ this.$route.params.mediaServerId }}</span> + </div> + </div> + <el-container> <el-aside width="260px"> <div class="record-list-box-box"> <div style="margin-top: 20px"> - <el-date-picker size="mini" style="width: 160px" v-model="chooseDate" :picker-options="pickerOptions" type="date" value-format="yyyy-MM-dd" placeholder="鏃ユ湡" @change="dateChange()"></el-date-picker> - <el-button size="mini" type="primary" icon="fa fa-cloud-download" style="margin: auto; margin-left: 12px " title="瑁佸壀鍚堝苟" @click="drawerOpen"></el-button> + <el-date-picker size="mini" v-model="chooseDate" :picker-options="pickerOptions" type="date" + value-format="yyyy-MM-dd" placeholder="鏃ユ湡" @change="dateChange()"></el-date-picker> + <!-- <el-button :disabled="!mediaServerId" size="mini" type="primary" icon="fa fa-cloud-download" style="margin: auto; margin-left: 12px " title="瑁佸壀鍚堝苟" @click="drawerOpen"></el-button>--> </div> <div class="record-list-box" :style="recordListStyle"> <ul v-if="detailFiles.length >0" class="infinite-list record-list" v-infinite-scroll="infiniteScroll" > <li v-for="(item,index) in detailFiles" :key="index" class="infinite-list-item record-list-item" > - <el-tag v-if="choosedFile != item" @click="chooseFile(item)"> + <el-tag v-if="choosedFile !== item.filename" @click="chooseFile(item)"> <i class="el-icon-video-camera" ></i> - {{ item.substring(0,17)}} + {{ getFileShowName(item.fileName) }} </el-tag> - <el-tag type="danger" v-if="choosedFile == item"> + <el-tag type="danger" v-if="choosedFile === item.filename"> <i class="el-icon-video-camera" ></i> - {{ item.substring(0,17)}} + {{ getFileShowName(item.fileName) }} </el-tag> - <a class="el-icon-download" style="color: #409EFF;font-weight: 600;margin-left: 10px;" :href="`${getFileBasePath()}/download.html?url=download/${recordFile.app}/${recordFile.stream}/${chooseDate}/${item}`" target="_blank" /> + <a class="el-icon-download" style="color: #409EFF;font-weight: 600;margin-left: 10px;" + :href="`${getFileBasePath(item)}/download.html?url=download/${app}/${stream}/${chooseDate}/${item.fileName}`" + target="_blank"/> </li> </ul> </div> - <div v-if="detailFiles.length ==0" class="record-list-no-val" >鏆傛棤鏁版嵁</div> + <div v-if="detailFiles.length === 0" class="record-list-no-val">鏆傛棤鏁版嵁</div> </div> </el-aside> - <el-main style="padding: 22px"> + <el-main style="padding: 22px"> <div class="playBox" :style="playerStyle"> <player ref="recordVideoPlayer" :videoUrl="videoUrl" :height="true" style="width: 100%" ></player> </div> @@ -48,8 +77,8 @@ </div> </div> - </el-main> - </el-container> + </el-main> + </el-container> <el-drawer title="褰曞儚涓嬭浇" :visible.sync="drawer" @@ -76,7 +105,8 @@ <li class="task-list-item" v-for="(item, index) in taskListEnded" :key="index"> <div class="task-list-item-box" style="height: 2rem;line-height: 2rem;"> <span>{{ item.startTime.substr(10) }}-{{item.endTime.substr(10)}}</span> - <a class="el-icon-download download-btn" :href="getFileBasePath() + '/download.html?url=download/' + item.recordFile" target="_blank"> + <a class="el-icon-download download-btn" :href="getFileBasePath() + '/download.html?url=download/' " + target="_blank"> </a> </div> </li> @@ -113,11 +143,16 @@ components: { uiHeader, player }, - props: ['recordFile', 'mediaServerId', 'dateFiles'], + // props: [ 'mediaServerId',], data() { return { + app: this.$route.params.app, + stream: this.$route.params.stream, + mediaServerId: this.$route.params.mediaServerId, dateFilesObj: [], + mediaServerList: [], detailFiles: [], + loading: false, chooseDate: null, videoUrl: null, choosedFile: null, @@ -195,6 +230,9 @@ mounted() { this.recordListStyle.height = this.winHeight + "px"; this.playerStyle["height"] = this.winHeight + "px"; + console.log(this.app) + console.log(this.stream) + console.log(this.mediaServerId) // 鏌ヨ褰撳勾鏈夎棰戠殑鏃ユ湡 this.getDateInYear(()=>{ if (Object.values(this.dateFilesObj).length > 0){ @@ -216,7 +254,8 @@ let chooseFullDate = new Date(this.chooseDate +" " + this.timeFormat); if (chooseFullDate.getFullYear() !== this.queryDate.getFullYear() || chooseFullDate.getMonth() !== this.queryDate.getMonth()){ - // this.getDateInYear() + this.queryDate = chooseFullDate; + this.getDateInYear() } this.queryRecordDetails(()=>{ if (this.detailFiles.length > 0){ @@ -242,48 +281,69 @@ } }, queryRecordDetails: function (callback){ - let that = this; - that.$axios({ + this.$axios({ method: 'get', - url:`/record_proxy/${that.mediaServerId}/api/record/file/list`, + url: `/api/cloud/record/list`, params: { - app: that.recordFile.app, - stream: that.recordFile.stream, - startTime: that.chooseDate + " 00:00:00", - endTime: that.chooseDate + " 23:59:59", - page: that.currentPage, - count: that.count + app: this.app, + stream: this.stream, + startTime: this.chooseDate + " 00:00:00", + endTime: this.chooseDate + " 23:59:59", + page: this.currentPage, + count: this.count, + mediaServerId: this.mediaServerId } - }).then(function (res) { + }).then((res) => { if (res.data.code === 0) { - that.total = res.data.data.total; - that.detailFiles = that.detailFiles.concat(res.data.data.list); + this.total = res.data.data.total; + this.detailFiles = this.detailFiles.concat(res.data.data.list); + let temp = new Set() + for (let i = 0; i < this.detailFiles.length; i++) { + temp.add(this.detailFiles[i].mediaServerId) + } + this.mediaServerList = Array.from(temp) + if (this.mediaServerList.length === 1) { + this.mediaServerId = this.mediaServerList[0] + } } - that.loading = false; + this.loading = false; if (callback) callback(); - }).catch(function (error) { + }).catch((error) => { console.log(error); - that.loading = false; + this.loading = false; }); }, chooseFile(file){ - this.choosedFile = file; if (file == null) { this.videoUrl = ""; + this.choosedFile = ""; }else { - this.videoUrl = `${this.getFileBasePath()}/download/${this.recordFile.app}/${this.recordFile.stream}/${this.chooseDate}/${this.choosedFile}` - + this.choosedFile = file.fileName; + this.videoUrl = `${this.getFileBasePath(file)}/download/${this.app}/${this.stream}/${this.chooseDate}/${this.choosedFile}` console.log(this.videoUrl) } }, + backToList() { + this.$router.back() + }, + getFileShowName(name) { + return name.substring(0, 2) + ":" + name.substring(2, 4) + ":" + name.substring(4, 6) + "-" + + name.substring(7, 9) + ":" + name.substring(9, 11) + ":" + name.substring(11, 13) + }, + chooseMediaChange() { - getFileBasePath(){ + }, + getRecordList() { + + }, + + getFileBasePath(item) { let basePath = "" if (axios.defaults.baseURL.startsWith("http")) { - basePath = `${axios.defaults.baseURL}/record_proxy/${this.mediaServerId}` + basePath = `${axios.defaults.baseURL}/record_proxy/${item.mediaServerId}` }else { - basePath = `${window.location.origin}${axios.defaults.baseURL}/record_proxy/${this.mediaServerId}` + basePath = `${window.location.origin}${axios.defaults.baseURL}/record_proxy/${item.mediaServerId}` } return basePath; }, @@ -316,7 +376,7 @@ }, getTimeForFile(file){ console.log(file) - let timeStr = file.substring(0,17); + let timeStr = file.fileName.substring(0, 17); if(timeStr.indexOf("~") > 0){ timeStr = timeStr.replaceAll("-",":") } @@ -370,27 +430,30 @@ }); }, getDateInYear(callback){ - let that = this; - that.dateFilesObj = {}; + this.dateFilesObj = {}; this.$axios({ method: 'get', - url:`/record_proxy/${that.mediaServerId}/api/record/date/list`, + url: `/api/cloud/record/date/list`, params: { - app: that.recordFile.app, - stream: that.recordFile.stream + app: this.app, + stream: this.stream, + year: this.queryDate.getFullYear(), + month: this.queryDate.getMonth() + 1, + mediaServerId: this.mediaServerId, } - }).then(function (res) { + }).then((res) => { + console.log(res) if (res.data.code === 0) { if (res.data.data.length > 0) { for (let i = 0; i < res.data.data.length; i++) { - that.dateFilesObj[res.data.data[i]] = res.data.data[i] + this.dateFilesObj[res.data.data[i]] = res.data.data[i] } - console.log(that.dateFilesObj) + console.log(this.dateFilesObj) } } if(callback)callback(); - }).catch(function (error) { + }).catch((error) => { console.log(error); }); }, @@ -414,8 +477,8 @@ }, addTask(){ this.showTaskBox = true; - let startTimeStr = this.chooseDate + " " + this.detailFiles[0].substring(0,8); - let endTimeStr = this.chooseDate + " " + this.detailFiles[this.detailFiles.length - 1].substring(9,17); + let startTimeStr = this.chooseDate + " " + this.detailFiles[0].fileName.substring(0, 8); + let endTimeStr = this.chooseDate + " " + this.detailFiles[this.detailFiles.length - 1].fileName.substring(9, 17); this.taskTimeRange[0] = new Date(startTimeStr) this.taskTimeRange[1] = new Date(endTimeStr) }, @@ -425,8 +488,8 @@ method: 'get', url:`/record_proxy/${that.mediaServerId}/api/record/file/download/task/add`, params: { - app: that.recordFile.app, - stream: that.recordFile.stream, + app: that.app, + stream: that.stream, startTime: moment(this.taskTimeRange[0]).format('YYYY-MM-DD HH:mm:ss'), endTime: moment(this.taskTimeRange[1]).format('YYYY-MM-DD HH:mm:ss'), } diff --git a/web_src/src/components/DeviceList.vue b/web_src/src/components/DeviceList.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/GBRecordDetail.vue b/web_src/src/components/GBRecordDetail.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/GeoConvertTools.js b/web_src/src/components/GeoConvertTools.js old mode 100644 new mode 100755 diff --git a/web_src/src/components/Login.vue b/web_src/src/components/Login.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/MediaServerManger.vue b/web_src/src/components/MediaServerManger.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/ParentPlatformList.vue b/web_src/src/components/ParentPlatformList.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/PushVideoList.vue b/web_src/src/components/PushVideoList.vue old mode 100644 new mode 100755 index 6aed98a..e69f56d --- a/web_src/src/components/PushVideoList.vue +++ b/web_src/src/components/PushVideoList.vue @@ -89,6 +89,8 @@ <el-button size="medium" icon="el-icon-position" type="text" v-if="!!scope.row.gbId" @click="removeFromGB(scope.row)">绉诲嚭鍥芥爣 </el-button> + <el-button size="medium" icon="el-icon-cloudy" type="text" @click="queryCloudRecords(scope.row)">浜戠褰曞儚 + </el-button> </template> </el-table-column> </el-table> @@ -257,6 +259,10 @@ console.error(error); }); }, + queryCloudRecords: function (row) { + + this.$router.push(`/cloudRecordDetail/${row.app}/${row.stream}`) + }, importChannel: function () { this.$refs.importChannel.openDialog(() => { diff --git a/web_src/src/components/StreamProxyList.vue b/web_src/src/components/StreamProxyList.vue old mode 100644 new mode 100755 index ff079cb..eb1f7d8 --- a/web_src/src/components/StreamProxyList.vue +++ b/web_src/src/components/StreamProxyList.vue @@ -91,6 +91,8 @@ <el-button size="medium" icon="el-icon-check" type="text" :loading="scope.row.startBtnLoading" v-if="!scope.row.enable" @click="start(scope.row)">鍚敤</el-button> <el-divider v-if="!scope.row.enable" direction="vertical"></el-divider> <el-button size="medium" icon="el-icon-delete" type="text" style="color: #f56c6c" @click="deleteStreamProxy(scope.row)">鍒犻櫎</el-button> + <el-button size="medium" icon="el-icon-cloudy" type="text" @click="queryCloudRecords(scope.row)">浜戠褰曞儚 + </el-button> </template> </el-table-column> </el-table> @@ -243,6 +245,10 @@ }); }, + queryCloudRecords: function (row) { + + this.$router.push(`/cloudRecordDetail/${row.app}/${row.stream}`) + }, deleteStreamProxy: function(row){ let that = this; this.$confirm('纭畾鍒犻櫎姝や唬鐞嗗悧锛�', '鎻愮ず', { diff --git a/web_src/src/components/UserManager.vue b/web_src/src/components/UserManager.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/channelList.vue b/web_src/src/components/channelList.vue old mode 100644 new mode 100755 index a8e8433..612416b --- a/web_src/src/components/channelList.vue +++ b/web_src/src/components/channelList.vue @@ -105,6 +105,9 @@ <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> </template> </el-table-column> </el-table> @@ -283,6 +286,12 @@ this.$router.push(`/gbRecordDetail/${deviceId}/${channelId}`) }, + queryCloudRecords: function (itemData) { + let deviceId = this.deviceId; + let channelId = itemData.channelId; + + this.$router.push(`/cloudRecordDetail/rtp/${deviceId}_${channelId}`) + }, stopDevicePush: function (itemData) { var that = this; this.$axios({ diff --git a/web_src/src/components/common/ h265web.vue b/web_src/src/components/common/ h265web.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/common/DeviceTree.vue b/web_src/src/components/common/DeviceTree.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/common/DeviceTreeForZtree.vue b/web_src/src/components/common/DeviceTreeForZtree.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/common/MapComponent.vue b/web_src/src/components/common/MapComponent.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/common/jessibuca.vue b/web_src/src/components/common/jessibuca.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/console.vue b/web_src/src/components/console.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/console/ConsoleCPU.vue b/web_src/src/components/console/ConsoleCPU.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/console/ConsoleDisk.vue b/web_src/src/components/console/ConsoleDisk.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/console/ConsoleMEM.vue b/web_src/src/components/console/ConsoleMEM.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/console/ConsoleMediaServer.vue b/web_src/src/components/console/ConsoleMediaServer.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/console/ConsoleNet.vue b/web_src/src/components/console/ConsoleNet.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/console/ConsoleNodeLoad.vue b/web_src/src/components/console/ConsoleNodeLoad.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/console/ConsoleResource.vue b/web_src/src/components/console/ConsoleResource.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/MediaServerEdit.vue b/web_src/src/components/dialog/MediaServerEdit.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/StreamProxyEdit.vue b/web_src/src/components/dialog/StreamProxyEdit.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/SyncChannelProgress.vue b/web_src/src/components/dialog/SyncChannelProgress.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/catalogEdit.vue b/web_src/src/components/dialog/catalogEdit.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/changePassword.vue b/web_src/src/components/dialog/changePassword.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/changePasswordForAdmin.vue b/web_src/src/components/dialog/changePasswordForAdmin.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/changePushKey.vue b/web_src/src/components/dialog/changePushKey.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/channelMapInfobox.vue b/web_src/src/components/dialog/channelMapInfobox.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/chooseChannel.vue b/web_src/src/components/dialog/chooseChannel.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/chooseChannelForCatalog.vue b/web_src/src/components/dialog/chooseChannelForCatalog.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/chooseChannelForGb.vue b/web_src/src/components/dialog/chooseChannelForGb.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/chooseChannelForStream.vue b/web_src/src/components/dialog/chooseChannelForStream.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/configInfo.vue b/web_src/src/components/dialog/configInfo.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/deviceEdit.vue b/web_src/src/components/dialog/deviceEdit.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/devicePlayer.vue b/web_src/src/components/dialog/devicePlayer.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/easyPlayer.vue b/web_src/src/components/dialog/easyPlayer.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/getCatalog.vue b/web_src/src/components/dialog/getCatalog.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/importChannel.vue b/web_src/src/components/dialog/importChannel.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/importChannelShowErrorData.vue b/web_src/src/components/dialog/importChannelShowErrorData.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/onvifEdit.vue b/web_src/src/components/dialog/onvifEdit.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/platformEdit.vue b/web_src/src/components/dialog/platformEdit.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/pushStreamEdit.vue b/web_src/src/components/dialog/pushStreamEdit.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/queryTrace.vue b/web_src/src/components/dialog/queryTrace.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/recordDownload.vue b/web_src/src/components/dialog/recordDownload.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/dialog/rtcPlayer.vue b/web_src/src/components/dialog/rtcPlayer.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/live.vue b/web_src/src/components/live.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/map.vue b/web_src/src/components/map.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/service/DeviceService.js b/web_src/src/components/service/DeviceService.js old mode 100644 new mode 100755 diff --git a/web_src/src/components/service/MediaServer.js b/web_src/src/components/service/MediaServer.js old mode 100644 new mode 100755 diff --git a/web_src/src/components/service/UserService.js b/web_src/src/components/service/UserService.js old mode 100644 new mode 100755 diff --git a/web_src/src/components/setting/Media.vue b/web_src/src/components/setting/Media.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/setting/Sip.vue b/web_src/src/components/setting/Sip.vue old mode 100644 new mode 100755 diff --git a/web_src/src/components/setting/Web.vue b/web_src/src/components/setting/Web.vue old mode 100644 new mode 100755 diff --git a/web_src/src/layout/UiHeader.vue b/web_src/src/layout/UiHeader.vue old mode 100644 new mode 100755 diff --git a/web_src/src/layout/index.vue b/web_src/src/layout/index.vue old mode 100644 new mode 100755 diff --git a/web_src/src/main.js b/web_src/src/main.js old mode 100644 new mode 100755 diff --git a/web_src/src/router/index.js b/web_src/src/router/index.js old mode 100644 new mode 100755 index 23c0a82..d5e9f7e --- a/web_src/src/router/index.js +++ b/web_src/src/router/index.js @@ -12,6 +12,7 @@ import login from '../components/Login.vue' import parentPlatformList from '../components/ParentPlatformList.vue' import cloudRecord from '../components/CloudRecord.vue' +import cloudRecordDetail from '../components/CloudRecordDetail.vue' import mediaServerManger from '../components/MediaServerManger.vue' import web from '../components/setting/Web.vue' import sip from '../components/setting/Sip.vue' @@ -86,6 +87,16 @@ component: cloudRecord, }, { + path: '/cloudRecordDetail/:app/:stream', + name: 'cloudRecordDetail', + component: cloudRecordDetail, + }, + { + path: '/cloudRecordDetail/:mediaServerId/:app/:stream', + name: 'cloudRecordDetail', + component: cloudRecordDetail, + }, + { path: '/mediaServerManger', name: 'mediaServerManger', component: mediaServerManger, -- Gitblit v1.8.0