diff --git a/src/main/java/com/genersoft/iot/vmp/conf/CloudRecordTimer.java b/src/main/java/com/genersoft/iot/vmp/conf/CloudRecordTimer.java index f98977fa..92e7f51f 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/CloudRecordTimer.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/CloudRecordTimer.java @@ -2,13 +2,11 @@ package com.genersoft.iot.vmp.conf; import com.alibaba.fastjson2.JSONObject; -import com.genersoft.iot.vmp.media.zlm.AssistRESTfulUtils; import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.bean.CloudRecordItem; import com.genersoft.iot.vmp.storager.dao.CloudRecordServiceMapper; -import com.genersoft.iot.vmp.vmanager.cloudRecord.CloudRecordController; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -16,7 +14,6 @@ import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.io.File; -import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; 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 a7416a8e..dbab513d 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java @@ -1,7 +1,7 @@ package com.genersoft.iot.vmp.conf; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import org.apache.http.HttpHost; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; diff --git a/src/main/java/com/genersoft/iot/vmp/conf/WVPTimerTask.java b/src/main/java/com/genersoft/iot/vmp/conf/WVPTimerTask.java index 77d83ee2..c5862550 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/WVPTimerTask.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/WVPTimerTask.java @@ -1,7 +1,6 @@ package com.genersoft.iot.vmp.conf; import com.alibaba.fastjson2.JSONObject; -import com.genersoft.iot.vmp.service.IMediaServerService; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -14,9 +13,6 @@ public class WVPTimerTask { @Autowired private IRedisCatchStorage redisCatchStorage; - @Autowired - private IMediaServerService mediaServerService; - @Value("${server.port}") private int serverPort; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java index d56e744d..c363583a 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java @@ -4,8 +4,8 @@ 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 com.genersoft.iot.vmp.media.zlm.event.MediaServerOfflineEvent; +import com.genersoft.iot.vmp.media.zlm.event.MediaServerOnlineEvent; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; import org.springframework.stereotype.Component; @@ -40,13 +40,13 @@ public class EventPublisher { } public void zlmOfflineEventPublish(String mediaServerId){ - ZLMOfflineEvent outEvent = new ZLMOfflineEvent(this); + MediaServerOfflineEvent outEvent = new MediaServerOfflineEvent(this); outEvent.setMediaServerId(mediaServerId); applicationEventPublisher.publishEvent(outEvent); } - public void zlmOnlineEventPublish(String mediaServerId) { - ZLMOnlineEvent outEvent = new ZLMOnlineEvent(this); + public void mediaServerOnlineEventPublish(String mediaServerId) { + MediaServerOnlineEvent outEvent = new MediaServerOnlineEvent(this); outEvent.setMediaServerId(mediaServerId); applicationEventPublisher.publishEvent(outEvent); } 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 index 5ca95a0d..010f1140 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/task/SipRunner.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/task/SipRunner.java @@ -10,7 +10,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.service.IDeviceService; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.IPlatformService; import com.genersoft.iot.vmp.service.impl.PlatformServiceImpl; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java index 723c715f..91595f8d 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java @@ -25,7 +25,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange; import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamPush; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.media.zlm.dto.hook.HookParam; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.bean.SSRCInfo; import com.genersoft.iot.vmp.utils.DateUtil; import gov.nist.javax.sip.message.SIPRequest; @@ -44,7 +44,6 @@ import javax.sip.SipFactory; import javax.sip.header.CallIdHeader; import javax.sip.message.Request; import java.text.ParseException; -import java.util.ArrayList; import java.util.List; /** diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java index abd32fba..7c9036b0 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java @@ -19,7 +19,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange; import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.media.zlm.dto.hook.HookParam; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; import com.genersoft.iot.vmp.service.bean.SSRCInfo; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java index 70048209..37ae5b67 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java @@ -13,7 +13,7 @@ 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.IDeviceService; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.IPlayService; import com.genersoft.iot.vmp.service.bean.RequestPushStreamMsg; import com.genersoft.iot.vmp.service.redisMsg.RedisGbPlayMsgListener; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java index f66e3c38..36f9d6bd 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java @@ -13,6 +13,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; 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.media.IMediaServerService; import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.service.*; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java index 3205498f..f75cc4d7 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java @@ -18,6 +18,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; 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.media.IMediaServerService; import com.genersoft.iot.vmp.media.zlm.ZLMMediaListManager; import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/BroadcastNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/BroadcastNotifyMessageHandler.java index a05847aa..e7191bf4 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/BroadcastNotifyMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/BroadcastNotifyMessageHandler.java @@ -1,7 +1,6 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; import com.alibaba.fastjson2.JSONObject; -import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager; import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; @@ -12,7 +11,7 @@ import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; import com.genersoft.iot.vmp.service.IDeviceService; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.IPlatformService; import com.genersoft.iot.vmp.service.IPlayService; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; diff --git a/src/main/java/com/genersoft/iot/vmp/media/IMediaNodeServerService.java b/src/main/java/com/genersoft/iot/vmp/media/IMediaNodeServerService.java new file mode 100644 index 00000000..c72c7e23 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/media/IMediaNodeServerService.java @@ -0,0 +1,20 @@ +package com.genersoft.iot.vmp.media; + +import com.genersoft.iot.vmp.common.CommonCallback; +import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; + +public interface IMediaNodeServerService { + int createRTPServer(MediaServerItem mediaServerItem, String streamId, long ssrc, Integer port, Boolean onlyAuto, Boolean reUsePort, Integer tcpMode); + + void closeRtpServer(MediaServerItem mediaServerItem, String streamId); + + void closeRtpServer(MediaServerItem mediaServerItem, String streamId, CommonCallback callback); + + void closeStreams(MediaServerItem mediaServerItem, String rtp, String streamId); + + Boolean updateRtpServerSSRC(MediaServerItem mediaServerItem, String streamId, String ssrc); + + boolean checkNodeId(MediaServerItem mediaServerItem); + + void online(MediaServerItem mediaServerItem); +} diff --git a/src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java b/src/main/java/com/genersoft/iot/vmp/media/IMediaServerService.java similarity index 98% rename from src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java rename to src/main/java/com/genersoft/iot/vmp/media/IMediaServerService.java index 2e6151d6..49203d2c 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java +++ b/src/main/java/com/genersoft/iot/vmp/media/IMediaServerService.java @@ -1,4 +1,4 @@ -package com.genersoft.iot.vmp.service; +package com.genersoft.iot.vmp.media; import com.genersoft.iot.vmp.common.CommonCallback; import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; diff --git a/src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaNodeServerService.java b/src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaNodeServerService.java new file mode 100644 index 00000000..6e86153d --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/media/abl/ABLMediaNodeServerService.java @@ -0,0 +1,8 @@ +package com.genersoft.iot.vmp.media.abl; + +import com.genersoft.iot.vmp.media.IMediaNodeServerService; +import org.springframework.stereotype.Service; + +@Service("abl") +public class ABLMediaNodeServerService implements IMediaNodeServerService { +} diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/media/impl/MediaServerServiceImpl.java similarity index 83% rename from src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java rename to src/main/java/com/genersoft/iot/vmp/media/impl/MediaServerServiceImpl.java index 190d665b..4e8ed274 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/media/impl/MediaServerServiceImpl.java @@ -1,4 +1,4 @@ -package com.genersoft.iot.vmp.service.impl; +package com.genersoft.iot.vmp.media.impl; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONArray; @@ -12,11 +12,12 @@ import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.exception.ControllerException; import com.genersoft.iot.vmp.gb28181.event.EventPublisher; import com.genersoft.iot.vmp.gb28181.session.SSRCFactory; +import com.genersoft.iot.vmp.media.IMediaNodeServerService; import com.genersoft.iot.vmp.media.zlm.*; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.media.zlm.dto.ServerKeepaliveData; import com.genersoft.iot.vmp.service.IInviteStreamService; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.bean.MediaServerLoad; import com.genersoft.iot.vmp.service.bean.SSRCInfo; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; @@ -25,30 +26,23 @@ import com.genersoft.iot.vmp.utils.DateUtil; 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; /** * 媒体服务器节点管理 @@ -82,9 +76,6 @@ public class MediaServerServiceImpl implements IMediaServerService { @Autowired private AssistRESTfulUtils assistRESTfulUtils; - @Autowired - private ZLMRESTfulUtils zlmresTfulUtils; - @Autowired private MediaServerMapper mediaServerMapper; @@ -113,20 +104,16 @@ public class MediaServerServiceImpl implements IMediaServerService { @Autowired private RedisTemplate redisTemplate; - @Qualifier("taskExecutor") @Autowired - private ThreadPoolTaskExecutor taskExecutor; - - - + private Map nodeServerServiceMap; /** * 初始化 */ @Override - public void updateVmServer(List mediaServerItemList) { - logger.info("[zlm] 缓存初始化 "); + public void updateVmServer(List mediaServerItemList) { + logger.info("[媒体服务节点] 缓存初始化 "); for (MediaServerItem mediaServerItem : mediaServerItemList) { if (ObjectUtils.isEmpty(mediaServerItem.getId())) { continue; @@ -173,7 +160,12 @@ public class MediaServerServiceImpl implements IMediaServerService { } int rtpServerPort; if (mediaServerItem.isRtpEnable()) { - rtpServerPort = zlmServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck ? Long.parseLong(ssrc) : 0, port, onlyAuto, reUsePort, tcpMode); + IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServerItem.getType()); + if (mediaNodeServerService == null) { + logger.info("[openRTPServer] 失败, mediaServerItem的类型: {},未找到对应的实现类", mediaServerItem.getType()); + return null; + } + rtpServerPort = mediaNodeServerService.createRTPServer(mediaServerItem, streamId, ssrcCheck ? Long.parseLong(ssrc) : 0, port, onlyAuto, reUsePort, tcpMode); } else { rtpServerPort = mediaServerItem.getRtpProxyPort(); } @@ -191,7 +183,12 @@ public class MediaServerServiceImpl implements IMediaServerService { if (mediaServerItem == null) { return; } - zlmServerFactory.closeRtpServer(mediaServerItem, streamId); + IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServerItem.getType()); + if (mediaNodeServerService == null) { + logger.info("[closeRTPServer] 失败, mediaServerItem的类型: {},未找到对应的实现类", mediaServerItem.getType()); + return; + } + mediaNodeServerService.closeRtpServer(mediaServerItem, streamId); } @Override @@ -200,21 +197,42 @@ public class MediaServerServiceImpl implements IMediaServerService { callback.run(false); return; } - zlmServerFactory.closeRtpServer(mediaServerItem, streamId, callback); + IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServerItem.getType()); + if (mediaNodeServerService == null) { + logger.info("[closeRTPServer] 失败, mediaServerItem的类型: {},未找到对应的实现类", mediaServerItem.getType()); + return; + } + mediaNodeServerService.closeRtpServer(mediaServerItem, streamId, callback); } @Override public void closeRTPServer(String mediaServerId, String streamId) { MediaServerItem mediaServerItem = this.getOne(mediaServerId); - if (mediaServerItem != null && mediaServerItem.isRtpEnable()) { + if (mediaServerItem == null) { + return; + } + if (mediaServerItem.isRtpEnable()) { closeRTPServer(mediaServerItem, streamId); } - zlmresTfulUtils.closeStreams(mediaServerItem, "rtp", streamId); + IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServerItem.getType()); + if (mediaNodeServerService == null) { + logger.info("[closeRTPServer] 失败, mediaServerItem的类型: {},未找到对应的实现类", mediaServerItem.getType()); + return; + } + mediaNodeServerService.closeStreams(mediaServerItem, "rtp", streamId); } @Override public Boolean updateRtpServerSSRC(MediaServerItem mediaServerItem, String streamId, String ssrc) { - return zlmServerFactory.updateRtpServerSSRC(mediaServerItem, streamId, ssrc); + if (mediaServerItem == null) { + return false; + } + IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServerItem.getType()); + if (mediaNodeServerService == null) { + logger.info("[updateRtpServerSSRC] 失败, mediaServerItem的类型: {},未找到对应的实现类", mediaServerItem.getType()); + return false; + } + return mediaNodeServerService.updateRtpServerSSRC(mediaServerItem, streamId, ssrc); } @Override @@ -227,12 +245,11 @@ public class MediaServerServiceImpl implements IMediaServerService { } /** - * zlm 重启后重置他的推流信息, TODO 给正在使用的设备发送停止命令 + * 媒体服务节点 重启后重置他的推流信息, TODO 给正在使用的设备发送停止命令 */ @Override public void clearRTPServer(MediaServerItem mediaServerItem) { ssrcFactory.reset(mediaServerItem.getId()); - } @@ -301,7 +318,7 @@ public class MediaServerServiceImpl implements IMediaServerService { } /** - * 获取单个zlm服务器 + * 获取单个媒体服务节点服务器 * @param mediaServerId 服务id * @return MediaServerItem */ @@ -331,24 +348,20 @@ public class MediaServerServiceImpl implements IMediaServerService { mediaServerItem.setCreateTime(DateUtil.getNow()); mediaServerItem.setUpdateTime(DateUtil.getNow()); mediaServerItem.setHookAliveInterval(30f); - JSONObject responseJSON = zlmresTfulUtils.getMediaServerConfig(mediaServerItem); - if (responseJSON != null) { - JSONArray data = responseJSON.getJSONArray("data"); - if (data != null && data.size() > 0) { - ZLMServerConfig zlmServerConfig= JSON.parseObject(JSON.toJSONString(data.get(0)), ZLMServerConfig.class); - if (mediaServerMapper.queryOne(zlmServerConfig.getGeneralMediaServerId()) != null) { - throw new ControllerException(ErrorCode.ERROR100.getCode(),"保存失败,媒体服务ID [ " + zlmServerConfig.getGeneralMediaServerId() + " ] 已存在,请修改媒体服务器配置"); - } - mediaServerItem.setId(zlmServerConfig.getGeneralMediaServerId()); - zlmServerConfig.setIp(mediaServerItem.getIp()); - mediaServerMapper.add(mediaServerItem); - zlmServerOnline(zlmServerConfig); - }else { - throw new ControllerException(ErrorCode.ERROR100.getCode(),"连接失败"); - } - + if (mediaServerItem.getType() == null) { + logger.info("[添加媒体节点] 失败, mediaServerItem的类型:为空"); + return; + } + IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServerItem.getType()); + if (mediaNodeServerService == null) { + logger.info("[添加媒体节点] 失败, mediaServerItem的类型: {},未找到对应的实现类", mediaServerItem.getType()); + return; + } + if (mediaNodeServerService.checkNodeId(mediaServerItem)) { + mediaServerMapper.add(mediaServerItem); + mediaNodeServerService.online(mediaServerItem); }else { - throw new ControllerException(ErrorCode.ERROR100.getCode(),"连接失败"); + throw new ControllerException(ErrorCode.ERROR100.getCode(),"保存失败,媒体服务ID [ " + mediaServerItem.getId() + " ] 已存在,请修改媒体服务器配置"); } } @@ -364,7 +377,7 @@ public class MediaServerServiceImpl implements IMediaServerService { TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); int delResult = mediaServerMapper.delDefault(); if (delResult == 0) { - logger.error("移除数据库默认zlm节点失败"); + logger.error("移除数据库默认媒体服务节点节点失败"); //事务回滚 dataSourceTransactionManager.rollback(transactionStatus); return 0; @@ -378,19 +391,19 @@ public class MediaServerServiceImpl implements IMediaServerService { } /** - * 处理zlm上线 - * @param zlmServerConfig zlm上线携带的参数 + * 处理媒体服务节点上线 + * @param zlmServerConfig 媒体服务节点上线携带的参数 */ @Override public void zlmServerOnline(ZLMServerConfig zlmServerConfig) { MediaServerItem serverItem = mediaServerMapper.queryOne(zlmServerConfig.getGeneralMediaServerId()); if (serverItem == null) { - logger.warn("[未注册的zlm] 拒接接入:{}来自{}:{}", zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(),zlmServerConfig.getHttpPort() ); - logger.warn("请检查ZLM的配置是否与WVP的一致"); + logger.warn("[未注册的媒体服务节点] 拒接接入:{}来自{}:{}", zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(),zlmServerConfig.getHttpPort() ); + logger.warn("请检查媒体服务节点的ID配置是否与WVP的一致"); return; }else { - logger.info("[ZLM] 正在连接 : {} -> {}:{}", + logger.info("[媒体服务节点] 正在连接 : {} -> {}:{}", zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(), zlmServerConfig.getHttpPort()); } serverItem.setHookAliveInterval(zlmServerConfig.getHookAliveInterval()); @@ -418,7 +431,7 @@ public class MediaServerServiceImpl implements IMediaServerService { serverItem.setStatus(true); if (ObjectUtils.isEmpty(serverItem.getId())) { - logger.warn("[未注册的zlm] serverItem缺少ID, 无法接入:{}:{}", zlmServerConfig.getIp(),zlmServerConfig.getHttpPort() ); + logger.warn("[未注册的媒体服务节点] serverItem缺少ID, 无法接入:{}:{}", zlmServerConfig.getIp(),zlmServerConfig.getHttpPort() ); return; } mediaServerMapper.update(serverItem); @@ -436,9 +449,9 @@ public class MediaServerServiceImpl implements IMediaServerService { final String zlmKeepaliveKey = zlmKeepaliveKeyPrefix + serverItem.getId(); dynamicTask.stop(zlmKeepaliveKey); dynamicTask.startDelay(zlmKeepaliveKey, new KeepAliveTimeoutRunnable(serverItem), (serverItem.getHookAliveInterval().intValue() + 5) * 1000); - publisher.zlmOnlineEventPublish(serverItem.getId()); + publisher.mediaServerOnlineEventPublish(serverItem.getId()); - logger.info("[ZLM] 连接成功 {} - {}:{} ", + logger.info("[媒体服务节点] 连接成功 {} - {}:{} ", zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(), zlmServerConfig.getHttpPort()); } @@ -452,12 +465,12 @@ public class MediaServerServiceImpl implements IMediaServerService { @Override public void run() { - logger.info("[zlm心跳到期]:" + serverItem.getId()); + logger.info("[媒体服务节点心跳到期]:" + serverItem.getId()); // 发起http请求验证zlm是否确实无法连接,如果确实无法连接则发送离线事件,否则不作处理 JSONObject mediaServerConfig = zlmresTfulUtils.getMediaServerConfig(serverItem); if (mediaServerConfig != null && mediaServerConfig.getInteger("code") == 0) { - logger.info("[zlm心跳到期]:{}验证后zlm仍在线,恢复心跳信息,请检查zlm是否可以正常向wvp发送心跳", serverItem.getId()); - // 添加zlm信息 + logger.info("[媒体服务节点心跳到期]:{}验证后媒体服务节点仍在线,恢复心跳信息,请检查媒体服务节点是否可以正常向wvp发送心跳", serverItem.getId()); + // 添加媒体服务节点信息 updateMediaServerKeepalive(serverItem.getId(), null); }else { publisher.zlmOfflineEventPublish(serverItem.getId()); @@ -556,13 +569,13 @@ public class MediaServerServiceImpl implements IMediaServerService { } /** - * 对zlm服务器进行基础配置 + * 对媒体服务节点服务器进行基础配置 * @param mediaServerItem 服务ID - * @param restart 是否重启zlm + * @param restart 是否重启媒体服务节点 */ @Override public void setZLMConfig(MediaServerItem mediaServerItem, boolean restart) { - logger.info("[ZLM] 正在设置 :{} -> {}:{}", + logger.info("[媒体服务节点] 正在设置 :{} -> {}:{}", mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort()); String protocol = sslEnabled ? "https" : "http"; String hookPrefix = String.format("%s://%s:%s/index/hook", protocol, mediaServerItem.getHookIp(), serverPort); @@ -612,17 +625,17 @@ public class MediaServerServiceImpl implements IMediaServerService { if (responseJSON != null && responseJSON.getInteger("code") == 0) { if (restart) { - logger.info("[ZLM] 设置成功,开始重启以保证配置生效 {} -> {}:{}", + logger.info("[媒体服务节点] 设置成功,开始重启以保证配置生效 {} -> {}:{}", mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort()); zlmresTfulUtils.restartServer(mediaServerItem); }else { - logger.info("[ZLM] 设置成功 {} -> {}:{}", + logger.info("[媒体服务节点] 设置成功 {} -> {}:{}", mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort()); } }else { - logger.info("[ZLM] 设置zlm失败 {} -> {}:{}", + logger.info("[媒体服务节点] 设置媒体服务节点失败 {} -> {}:{}", mediaServerItem.getId(), mediaServerItem.getIp(), mediaServerItem.getHttpPort()); } @@ -701,11 +714,11 @@ public class MediaServerServiceImpl implements IMediaServerService { // 缓存不存在,从数据库查询,如果数据库不存在则是错误的 mediaServerItem = getOneFromDatabase(mediaServerId); if (mediaServerItem == null) { - logger.warn("[更新ZLM 保活信息] 流媒体{}尚未加入使用,请检查节点中是否含有此流媒体 ", mediaServerId); + logger.warn("[更新媒体服务节点 保活信息] 流媒体{}尚未加入使用,请检查节点中是否含有此流媒体 ", mediaServerId); return; } - // zlm连接重试 - logger.warn("[更新ZLM 保活信息]尝试链接zml id {}", mediaServerId); + // 媒体服务节点连接重试 + logger.warn("[更新媒体服务节点 保活信息]尝试链接zml id {}", mediaServerId); ssrcFactory.initMediaServerSSRC(mediaServerItem.getId(), null); String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(); redisTemplate.opsForValue().set(key, mediaServerItem); diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java index 72df8a05..1ac61bd1 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java @@ -18,6 +18,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.media.zlm.dto.HookType; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; 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 index cbc5fde6..686649ca 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java @@ -4,7 +4,7 @@ import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.gb28181.bean.GbStream; 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.media.IMediaServerService; import com.genersoft.iot.vmp.service.IStreamProxyService; import com.genersoft.iot.vmp.service.IStreamPushService; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java new file mode 100644 index 00000000..4b9013cf --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java @@ -0,0 +1,9 @@ +package com.genersoft.iot.vmp.media.zlm; + +import com.genersoft.iot.vmp.media.IMediaNodeServerService; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +@Service("zlm") +public class ZLMMediaNodeServerService implements IMediaNodeServerService { +} 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 index 4a781f31..1d8c81be 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java @@ -9,8 +9,7 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher; import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory; import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForServerStarted; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; -import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; 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 index cebfec3b..d00cfbe4 100755 --- 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 @@ -85,6 +85,8 @@ public class MediaServerItem{ @Schema(description = "录像存储路径") private String recordPath; + @Schema(description = "类型: zlm/abl") + private String type; public MediaServerItem() { } @@ -318,4 +320,12 @@ public class MediaServerItem{ public void setRecordPath(String recordPath) { this.recordPath = recordPath; } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } } 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/MediaServerEventAbstract.java similarity index 71% rename from src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMEventAbstract.java rename to src/main/java/com/genersoft/iot/vmp/media/zlm/event/MediaServerEventAbstract.java index 8ffbddea..66108fc9 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMEventAbstract.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/event/MediaServerEventAbstract.java @@ -1,9 +1,8 @@ package com.genersoft.iot.vmp.media.zlm.event; -import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; import org.springframework.context.ApplicationEvent; -public abstract class ZLMEventAbstract extends ApplicationEvent { +public abstract class MediaServerEventAbstract extends ApplicationEvent { private static final long serialVersionUID = 1L; @@ -11,7 +10,7 @@ public abstract class ZLMEventAbstract extends ApplicationEvent { private String mediaServerId; - public ZLMEventAbstract(Object source) { + public MediaServerEventAbstract(Object source) { super(source); } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/event/MediaServerOfflineEvent.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/event/MediaServerOfflineEvent.java new file mode 100755 index 00000000..de0ed334 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/event/MediaServerOfflineEvent.java @@ -0,0 +1,11 @@ +package com.genersoft.iot.vmp.media.zlm.event; + +/** + * zlm离线事件类 + */ +public class MediaServerOfflineEvent extends MediaServerEventAbstract { + + public MediaServerOfflineEvent(Object source) { + super(source); + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/event/MediaServerOnlineEvent.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/event/MediaServerOnlineEvent.java new file mode 100755 index 00000000..d3a746a5 --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/event/MediaServerOnlineEvent.java @@ -0,0 +1,11 @@ +package com.genersoft.iot.vmp.media.zlm.event; + +/** + * zlm在线事件 + */ +public class MediaServerOnlineEvent extends MediaServerEventAbstract { + + public MediaServerOnlineEvent(Object source) { + super(source); + } +} 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/MediaServerStatusEventListener.java similarity index 83% rename from src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMStatusEventListener.java rename to src/main/java/com/genersoft/iot/vmp/media/zlm/event/MediaServerStatusEventListener.java index bad8e560..c9a09d7b 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMStatusEventListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/event/MediaServerStatusEventListener.java @@ -1,6 +1,6 @@ package com.genersoft.iot.vmp.media.zlm.event; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.IPlayService; import com.genersoft.iot.vmp.service.IStreamProxyService; import com.genersoft.iot.vmp.service.IStreamPushService; @@ -20,9 +20,9 @@ import org.springframework.stereotype.Component; * @date: 2020年5月6日 下午1:51:23 */ @Component -public class ZLMStatusEventListener { +public class MediaServerStatusEventListener { - private final static Logger logger = LoggerFactory.getLogger(ZLMStatusEventListener.class); + private final static Logger logger = LoggerFactory.getLogger(MediaServerStatusEventListener.class); @Autowired private IStreamPushService streamPushService; @@ -38,7 +38,7 @@ public class ZLMStatusEventListener { @Async("taskExecutor") @EventListener - public void onApplicationEvent(ZLMOnlineEvent event) { + public void onApplicationEvent(MediaServerOnlineEvent event) { logger.info("[ZLM] 上线 ID:" + event.getMediaServerId()); streamPushService.zlmServerOnline(event.getMediaServerId()); streamProxyService.zlmServerOnline(event.getMediaServerId()); @@ -47,7 +47,7 @@ public class ZLMStatusEventListener { @Async("taskExecutor") @EventListener - public void onApplicationEvent(ZLMOfflineEvent event) { + public void onApplicationEvent(MediaServerOfflineEvent event) { logger.info("[ZLM] 离线,ID:" + event.getMediaServerId()); // 处理ZLM离线 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 deleted file mode 100755 index 8207bdd3..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMOfflineEvent.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.genersoft.iot.vmp.media.zlm.event; - -/** - * zlm离线事件类 - */ -public class ZLMOfflineEvent extends ZLMEventAbstract { - - public ZLMOfflineEvent(Object source) { - super(source); - } -} 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 deleted file mode 100755 index 612ff9d0..00000000 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMOnlineEvent.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.genersoft.iot.vmp.media.zlm.event; - -/** - * zlm在线事件 - */ -public class ZLMOnlineEvent extends ZLMEventAbstract { - - public ZLMOnlineEvent(Object source) { - super(source); - } -} diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/CloudRecordServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/CloudRecordServiceImpl.java index a23252f6..e18db682 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/CloudRecordServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/CloudRecordServiceImpl.java @@ -10,7 +10,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; import com.genersoft.iot.vmp.media.zlm.dto.hook.OnRecordMp4HookParam; import com.genersoft.iot.vmp.service.ICloudRecordService; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.bean.CloudRecordItem; import com.genersoft.iot.vmp.service.bean.DownloadFileInfo; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java index 1dc7db44..9a1a5b39 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java @@ -19,7 +19,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.service.IDeviceChannelService; import com.genersoft.iot.vmp.service.IDeviceService; import com.genersoft.iot.vmp.service.IInviteStreamService; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; import com.genersoft.iot.vmp.storager.dao.DeviceMapper; 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 index 784f43f3..cca27e8f 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java @@ -1,6 +1,5 @@ package com.genersoft.iot.vmp.service.impl; -import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.genersoft.iot.vmp.common.StreamInfo; @@ -8,7 +7,7 @@ import com.genersoft.iot.vmp.conf.MediaConfig; import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.IMediaService; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IVideoManagerStorage; @@ -22,13 +21,9 @@ public class MediaServiceImpl implements IMediaService { @Autowired private IRedisCatchStorage redisCatchStorage; - @Autowired - private IVideoManagerStorage storager; - @Autowired private IMediaServerService mediaServerService; - @Autowired private MediaConfig mediaConfig; @@ -36,7 +31,6 @@ public class MediaServiceImpl implements IMediaService { private ZLMRESTfulUtils zlmresTfulUtils; - @Override public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String callId) { return getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null, callId, true); 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 index 06c621e5..3bd01538 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java @@ -15,14 +15,12 @@ import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; 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.HookSubscribeForStreamChange; import com.genersoft.iot.vmp.gb28181.utils.SipUtils; import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; import com.genersoft.iot.vmp.service.IInviteStreamService; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.IPlatformService; import com.genersoft.iot.vmp.service.IPlayService; import com.genersoft.iot.vmp.service.bean.*; @@ -31,7 +29,6 @@ import com.genersoft.iot.vmp.storager.dao.*; import com.genersoft.iot.vmp.utils.DateUtil; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; -import gov.nist.javax.sip.message.SIPRequest; import gov.nist.javax.sip.message.SIPResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -41,17 +38,12 @@ import org.springframework.stereotype.Service; import javax.sdp.*; import javax.sip.InvalidArgumentException; import javax.sip.ResponseEvent; -import javax.sip.PeerUnavailableException; import javax.sip.SipException; import java.text.ParseException; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; import java.util.*; /** diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index c8d203f4..0bde0cfb 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -18,6 +18,7 @@ import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; import com.genersoft.iot.vmp.gb28181.utils.SipUtils; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager; import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; 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 index 59c5acef..12022246 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java @@ -8,7 +8,6 @@ import com.genersoft.iot.vmp.common.StreamInfo; 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.gb28181.event.EventPublisher; import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; @@ -19,13 +18,12 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; import com.genersoft.iot.vmp.service.IGbStreamService; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.IMediaService; import com.genersoft.iot.vmp.service.IStreamProxyService; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; -import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper; import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper; import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper; import com.genersoft.iot.vmp.utils.DateUtil; 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 index e2d7e68c..51bd3ded 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java @@ -15,7 +15,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.*; import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType; import com.genersoft.iot.vmp.service.IGbStreamService; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.IStreamPushService; import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java index eb261e34..eedc2be4 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java +++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java @@ -11,7 +11,7 @@ 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.HookSubscribeForStreamChange; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.bean.*; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.utils.redis.RedisUtil; diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java index 1d7c2fd5..f47bd1f7 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java +++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java @@ -9,7 +9,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.IStreamPushService; import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; import com.genersoft.iot.vmp.service.bean.MessageForPushChannelResponse; diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusListMsgListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusListMsgListener.java index 65239c8f..13edaee9 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusListMsgListener.java +++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusListMsgListener.java @@ -5,7 +5,7 @@ import com.alibaba.fastjson2.JSONObject; import com.genersoft.iot.vmp.gb28181.bean.GbStream; import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; import com.genersoft.iot.vmp.service.IGbStreamService; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.IStreamPushService; import com.genersoft.iot.vmp.utils.DateUtil; import org.slf4j.Logger; 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 index b3d19908..b4552b7d 100755 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/cloudRecord/CloudRecordController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/cloudRecord/CloudRecordController.java @@ -1,15 +1,11 @@ package com.genersoft.iot.vmp.vmanager.cloudRecord; import com.alibaba.fastjson2.JSONArray; -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.conf.security.JwtUtils; -import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager; -import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.service.ICloudRecordService; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.bean.CloudRecordItem; import com.genersoft.iot.vmp.service.bean.DownloadFileInfo; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; @@ -22,7 +18,6 @@ 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 javax.servlet.http.HttpServletRequest; 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 index ca8cbcf8..04245b16 100755 --- 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 @@ -19,7 +19,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.service.IInviteStreamService; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.IMediaService; import com.genersoft.iot.vmp.service.IPlayService; import com.genersoft.iot.vmp.service.bean.InviteErrorCode; 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 index dbbc7b0b..5b1589e4 100755 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/ps/PsController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/ps/PsController.java @@ -14,7 +14,7 @@ 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.media.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; 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 index 5bd4b9dc..208c58c1 100755 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java @@ -14,7 +14,7 @@ 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.media.IMediaServerService; import com.genersoft.iot.vmp.utils.redis.RedisUtil; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.genersoft.iot.vmp.vmanager.bean.OtherRtpSendInfo; 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 index d1c72fc0..7a417c83 100755 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java @@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.VersionInfo; import com.genersoft.iot.vmp.conf.exception.ControllerException; import com.genersoft.iot.vmp.conf.security.JwtUtils; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager; import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; import com.genersoft.iot.vmp.media.zlm.dto.IHookSubscribe; 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 index 95650004..bcc205c8 100755 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java @@ -9,7 +9,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.IStreamProxyService; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.genersoft.iot.vmp.vmanager.bean.StreamContent; 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 index 8202bf5a..d10a2845 100755 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java @@ -13,7 +13,7 @@ import com.genersoft.iot.vmp.gb28181.bean.GbStream; import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; -import com.genersoft.iot.vmp.service.IMediaServerService; +import com.genersoft.iot.vmp.media.IMediaServerService; import com.genersoft.iot.vmp.service.IMediaService; import com.genersoft.iot.vmp.service.IStreamPushService; import com.genersoft.iot.vmp.service.impl.StreamPushUploadFileHandler; diff --git a/数据库/abl/初始化-mysql-2.7.0.sql b/数据库/abl/初始化-mysql-2.7.0.sql new file mode 100644 index 00000000..7fece768 --- /dev/null +++ b/数据库/abl/初始化-mysql-2.7.0.sql @@ -0,0 +1,325 @@ +/*建表*/ +create table wvp_device ( + id serial primary key , + device_id character varying(50) not null , + name character varying(255), + manufacturer character varying(255), + model character varying(255), + firmware character varying(255), + transport character varying(50), + stream_mode character varying(50), + on_line bool default false, + register_time character varying(50), + keepalive_time character varying(50), + ip character varying(50), + create_time character varying(50), + update_time character varying(50), + port integer, + expires integer, + subscribe_cycle_for_catalog integer DEFAULT 0, + subscribe_cycle_for_mobile_position integer DEFAULT 0, + mobile_position_submission_interval integer DEFAULT 5, + subscribe_cycle_for_alarm integer DEFAULT 0, + host_address character varying(50), + charset character varying(50), + ssrc_check bool default false, + geo_coord_sys character varying(50), + media_server_id character varying(50), + custom_name character varying(255), + sdp_ip character varying(50), + local_ip character varying(50), + password character varying(255), + as_message_channel bool default false, + keepalive_interval_time integer, + switch_primary_sub_stream bool default false, + broadcast_push_after_ack bool default false, + constraint uk_device_device unique (device_id) +); + +create table wvp_device_alarm ( + id serial primary key , + device_id character varying(50) not null, + channel_id character varying(50) not null, + alarm_priority character varying(50), + alarm_method character varying(50), + alarm_time character varying(50), + alarm_description character varying(255), + longitude double precision, + latitude double precision, + alarm_type character varying(50), + create_time character varying(50) not null +); + +create table wvp_device_channel ( + id serial primary key , + channel_id character varying(50) not null, + name character varying(255), + custom_name character varying(255), + manufacture character varying(50), + model character varying(50), + owner character varying(50), + civil_code character varying(50), + block character varying(50), + address character varying(50), + parent_id character varying(50), + safety_way integer, + register_way integer, + cert_num character varying(50), + certifiable integer, + err_code integer, + end_time character varying(50), + secrecy character varying(50), + ip_address character varying(50), + port integer, + password character varying(255), + ptz_type integer, + custom_ptz_type integer, + status bool default false, + longitude double precision, + custom_longitude double precision, + latitude double precision, + custom_latitude double precision, + stream_id character varying(255), + device_id character varying(50) not null, + parental character varying(50), + has_audio bool default false, + create_time character varying(50) not null, + update_time character varying(50) not null, + sub_count integer, + longitude_gcj02 double precision, + latitude_gcj02 double precision, + longitude_wgs84 double precision, + latitude_wgs84 double precision, + business_group_id character varying(50), + gps_time character varying(50), + stream_identification character varying(50), + constraint uk_wvp_device_channel_unique_device_channel unique (device_id, channel_id) +); + +create table wvp_device_mobile_position ( + id serial primary key, + device_id character varying(50) not null, + channel_id character varying(50) not null, + device_name character varying(255), + time character varying(50), + longitude double precision, + latitude double precision, + altitude double precision, + speed double precision, + direction double precision, + report_source character varying(50), + longitude_gcj02 double precision, + latitude_gcj02 double precision, + longitude_wgs84 double precision, + latitude_wgs84 double precision, + create_time character varying(50) +); + +create table wvp_gb_stream ( + gb_stream_id serial primary key, + app character varying(255) not null, + stream character varying(255) not null, + gb_id character varying(50) not null, + name character varying(255), + longitude double precision, + latitude double precision, + stream_type character varying(50), + media_server_id character varying(50), + create_time character varying(50), + constraint uk_gb_stream_unique_gb_id unique (gb_id), + constraint uk_gb_stream_unique_app_stream unique (app, stream) +); + +create table wvp_log ( + id serial primary key , + name character varying(50), + type character varying(50), + uri character varying(200), + address character varying(50), + result character varying(50), + timing bigint, + username character varying(50), + create_time character varying(50) +); + +create table wvp_media_server ( + id character varying(255) primary key , + ip character varying(50), + hook_ip character varying(50), + sdp_ip character varying(50), + stream_ip character varying(50), + http_port integer, + http_ssl_port integer, + rtmp_port integer, + rtmp_ssl_port integer, + rtp_proxy_port integer, + rtsp_port integer, + rtsp_ssl_port integer, + auto_config bool default false, + secret character varying(50), + type character varying(50) default 'zlm', + rtp_enable bool default false, + rtp_port_range character varying(50), + send_rtp_port_range character varying(50), + record_assist_port integer, + default_server bool default false, + create_time character varying(50), + update_time character varying(50), + hook_alive_interval integer, + record_path character varying(255), + record_day integer default 7, + constraint uk_media_server_unique_ip_http_port unique (ip, http_port) +); + +create table wvp_platform ( + id serial primary key , + enable bool default false, + name character varying(255), + server_gb_id character varying(50), + server_gb_domain character varying(50), + server_ip character varying(50), + server_port integer, + device_gb_id character varying(50), + device_ip character varying(50), + device_port character varying(50), + username character varying(255), + password character varying(50), + expires character varying(50), + keep_timeout character varying(50), + transport character varying(50), + character_set character varying(50), + catalog_id character varying(50), + ptz bool default false, + rtcp bool default false, + status bool default false, + start_offline_push bool default false, + administrative_division character varying(50), + catalog_group integer, + create_time character varying(50), + update_time character varying(50), + as_message_channel bool default false, + auto_push_channel bool default false, + constraint uk_platform_unique_server_gb_id unique (server_gb_id) +); + +create table wvp_platform_catalog ( + id character varying(50), + platform_id character varying(50), + name character varying(255), + parent_id character varying(50), + civil_code character varying(50), + business_group_id character varying(50), + constraint uk_platform_catalog_id_platform_id unique (id, platform_id) +); + +create table wvp_platform_gb_channel ( + id serial primary key , + platform_id character varying(50), + catalog_id character varying(50), + device_channel_id integer, + constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, catalog_id, device_channel_id) +); + +create table wvp_platform_gb_stream ( + id serial primary key, + platform_id character varying(50), + catalog_id character varying(50), + gb_stream_id integer, + constraint uk_platform_gb_stream_platform_id_catalog_id_gb_stream_id unique (platform_id, catalog_id, gb_stream_id) +); + +create table wvp_stream_proxy ( + id serial primary key, + type character varying(50), + app character varying(255), + stream character varying(255), + url character varying(255), + src_url character varying(255), + dst_url character varying(255), + timeout_ms integer, + ffmpeg_cmd_key character varying(255), + rtp_type character varying(50), + media_server_id character varying(50), + enable_audio bool default false, + enable_mp4 bool default false, + enable bool default false, + status boolean, + enable_remove_none_reader bool default false, + create_time character varying(50), + name character varying(255), + update_time character varying(50), + stream_key character varying(255), + enable_disable_none_reader bool default false, + constraint uk_stream_proxy_app_stream unique (app, stream) +); + +create table wvp_stream_push ( + id serial primary key, + app character varying(255), + stream character varying(255), + total_reader_count character varying(50), + origin_type integer, + origin_type_str character varying(50), + create_time character varying(50), + alive_second integer, + media_server_id character varying(50), + server_id character varying(50), + push_time character varying(50), + status bool default false, + update_time character varying(50), + push_ing bool default false, + self bool default false, + constraint uk_stream_push_app_stream unique (app, stream) +); +create table wvp_cloud_record ( + id serial primary key, + app character varying(255), + stream character varying(255), + call_id character varying(255), + start_time bigint, + end_time bigint, + media_server_id character varying(50), + file_name character varying(255), + folder character varying(255), + file_path character varying(255), + collect bool default false, + file_size bigint, + time_len bigint, + constraint uk_stream_push_app_stream_path unique (app, stream, file_path) +); + +create table wvp_user ( + id serial primary key, + username character varying(255), + password character varying(255), + role_id integer, + create_time character varying(50), + update_time character varying(50), + push_key character varying(50), + constraint uk_user_username unique (username) +); + +create table wvp_user_role ( + id serial primary key, + name character varying(50), + authority character varying(50), + create_time character varying(50), + update_time character varying(50) +); +create table wvp_resources_tree ( + id serial primary key , + is_catalog bool default true, + device_channel_id integer , + gb_stream_id integer, + name character varying(255), + parentId integer, + path character varying(255) +); + + +/*初始数据*/ +INSERT INTO wvp_user VALUES (1, 'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57','3e80d1762a324d5b0ff636e0bd16f1e3'); +INSERT INTO wvp_user_role VALUES (1, 'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57'); + + + diff --git a/数据库/abl/初始化-postgresql-kingbase-2.7.0.sql b/数据库/abl/初始化-postgresql-kingbase-2.7.0.sql new file mode 100644 index 00000000..656f7a00 --- /dev/null +++ b/数据库/abl/初始化-postgresql-kingbase-2.7.0.sql @@ -0,0 +1,325 @@ +/*建表*/ +create table wvp_device ( + id serial primary key , + device_id character varying(50) not null , + name character varying(255), + manufacturer character varying(255), + model character varying(255), + firmware character varying(255), + transport character varying(50), + stream_mode character varying(50), + on_line bool default false, + register_time character varying(50), + keepalive_time character varying(50), + ip character varying(50), + create_time character varying(50), + update_time character varying(50), + port integer, + expires integer, + subscribe_cycle_for_catalog integer DEFAULT 0, + subscribe_cycle_for_mobile_position integer DEFAULT 0, + mobile_position_submission_interval integer DEFAULT 5, + subscribe_cycle_for_alarm integer DEFAULT 0, + host_address character varying(50), + charset character varying(50), + ssrc_check bool default false, + geo_coord_sys character varying(50), + media_server_id character varying(50), + custom_name character varying(255), + sdp_ip character varying(50), + local_ip character varying(50), + password character varying(255), + as_message_channel bool default false, + keepalive_interval_time integer, + switch_primary_sub_stream bool default false, + broadcast_push_after_ack bool default false, + constraint uk_device_device unique (device_id) +); + +create table wvp_device_alarm ( + id serial primary key , + device_id character varying(50) not null, + channel_id character varying(50) not null, + alarm_priority character varying(50), + alarm_method character varying(50), + alarm_time character varying(50), + alarm_description character varying(255), + longitude double precision, + latitude double precision, + alarm_type character varying(50), + create_time character varying(50) not null +); + +create table wvp_device_channel ( + id serial primary key , + channel_id character varying(50) not null, + name character varying(255), + custom_name character varying(255), + manufacture character varying(50), + model character varying(50), + owner character varying(50), + civil_code character varying(50), + block character varying(50), + address character varying(50), + parent_id character varying(50), + safety_way integer, + register_way integer, + cert_num character varying(50), + certifiable integer, + err_code integer, + end_time character varying(50), + secrecy character varying(50), + ip_address character varying(50), + port integer, + password character varying(255), + ptz_type integer, + custom_ptz_type integer, + status bool default false, + longitude double precision, + custom_longitude double precision, + latitude double precision, + custom_latitude double precision, + stream_id character varying(255), + device_id character varying(50) not null, + parental character varying(50), + has_audio bool default false, + create_time character varying(50) not null, + update_time character varying(50) not null, + sub_count integer, + longitude_gcj02 double precision, + latitude_gcj02 double precision, + longitude_wgs84 double precision, + latitude_wgs84 double precision, + business_group_id character varying(50), + gps_time character varying(50), + stream_identification character varying(50), + constraint uk_wvp_device_channel_unique_device_channel unique (device_id, channel_id) +); + +create table wvp_device_mobile_position ( + id serial primary key, + device_id character varying(50) not null, + channel_id character varying(50) not null, + device_name character varying(255), + time character varying(50), + longitude double precision, + latitude double precision, + altitude double precision, + speed double precision, + direction double precision, + report_source character varying(50), + longitude_gcj02 double precision, + latitude_gcj02 double precision, + longitude_wgs84 double precision, + latitude_wgs84 double precision, + create_time character varying(50) +); + +create table wvp_gb_stream ( + gb_stream_id serial primary key, + app character varying(255) not null, + stream character varying(255) not null, + gb_id character varying(50) not null, + name character varying(255), + longitude double precision, + latitude double precision, + stream_type character varying(50), + media_server_id character varying(50), + create_time character varying(50), + constraint uk_gb_stream_unique_gb_id unique (gb_id), + constraint uk_gb_stream_unique_app_stream unique (app, stream) +); + +create table wvp_log ( + id serial primary key , + name character varying(50), + type character varying(50), + uri character varying(200), + address character varying(50), + result character varying(50), + timing bigint, + username character varying(50), + create_time character varying(50) +); + +create table wvp_media_server ( + id character varying(255) primary key , + ip character varying(50), + hook_ip character varying(50), + sdp_ip character varying(50), + stream_ip character varying(50), + http_port integer, + http_ssl_port integer, + rtmp_port integer, + rtmp_ssl_port integer, + rtp_proxy_port integer, + rtsp_port integer, + rtsp_ssl_port integer, + auto_config bool default false, + secret character varying(50), + type character varying(50) default 'zlm', + rtp_enable bool default false, + rtp_port_range character varying(50), + send_rtp_port_range character varying(50), + record_assist_port integer, + default_server bool default false, + create_time character varying(50), + update_time character varying(50), + hook_alive_interval integer, + record_path character varying(255), + record_day integer default 7, + constraint uk_media_server_unique_ip_http_port unique (ip, http_port) +); + +create table wvp_platform ( + id serial primary key , + enable bool default false, + name character varying(255), + server_gb_id character varying(50), + server_gb_domain character varying(50), + server_ip character varying(50), + server_port integer, + device_gb_id character varying(50), + device_ip character varying(50), + device_port character varying(50), + username character varying(255), + password character varying(50), + expires character varying(50), + keep_timeout character varying(50), + transport character varying(50), + character_set character varying(50), + catalog_id character varying(50), + ptz bool default false, + rtcp bool default false, + status bool default false, + start_offline_push bool default false, + administrative_division character varying(50), + catalog_group integer, + create_time character varying(50), + update_time character varying(50), + as_message_channel bool default false, + auto_push_channel bool default false, + constraint uk_platform_unique_server_gb_id unique (server_gb_id) +); + +create table wvp_platform_catalog ( + id character varying(50), + platform_id character varying(50), + name character varying(255), + parent_id character varying(50), + civil_code character varying(50), + business_group_id character varying(50), + constraint uk_platform_catalog_id_platform_id unique (id, platform_id) +); + +create table wvp_platform_gb_channel ( + id serial primary key , + platform_id character varying(50), + catalog_id character varying(50), + device_channel_id integer, + constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, catalog_id, device_channel_id) +); + +create table wvp_platform_gb_stream ( + id serial primary key, + platform_id character varying(50), + catalog_id character varying(50), + gb_stream_id integer, + constraint uk_platform_gb_stream_platform_id_catalog_id_gb_stream_id unique (platform_id, catalog_id, gb_stream_id) +); + +create table wvp_stream_proxy ( + id serial primary key, + type character varying(50), + app character varying(255), + stream character varying(255), + url character varying(255), + src_url character varying(255), + dst_url character varying(255), + timeout_ms integer, + ffmpeg_cmd_key character varying(255), + rtp_type character varying(50), + media_server_id character varying(50), + enable_audio bool default false, + enable_mp4 bool default false, + enable bool default false, + status boolean, + enable_remove_none_reader bool default false, + create_time character varying(50), + name character varying(255), + update_time character varying(50), + stream_key character varying(255), + enable_disable_none_reader bool default false, + constraint uk_stream_proxy_app_stream unique (app, stream) +); + +create table wvp_stream_push ( + id serial primary key, + app character varying(255), + stream character varying(255), + total_reader_count character varying(50), + origin_type integer, + origin_type_str character varying(50), + create_time character varying(50), + alive_second integer, + media_server_id character varying(50), + server_id character varying(50), + push_time character varying(50), + status bool default false, + update_time character varying(50), + push_ing bool default false, + self bool default false, + constraint uk_stream_push_app_stream unique (app, stream) +); +create table wvp_cloud_record ( + id serial primary key, + app character varying(255), + stream character varying(255), + call_id character varying(255), + start_time int8, + end_time int8, + media_server_id character varying(50), + file_name character varying(255), + folder character varying(255), + file_path character varying(255), + collect bool default false, + file_size int8, + time_len int8, + constraint uk_stream_push_app_stream_path unique (app, stream, file_path) +); + +create table wvp_user ( + id serial primary key, + username character varying(255), + password character varying(255), + role_id integer, + create_time character varying(50), + update_time character varying(50), + push_key character varying(50), + constraint uk_user_username unique (username) +); + +create table wvp_user_role ( + id serial primary key, + name character varying(50), + authority character varying(50), + create_time character varying(50), + update_time character varying(50) +); +create table wvp_resources_tree ( + id serial primary key , + is_catalog bool default true, + device_channel_id integer , + gb_stream_id integer, + name character varying(255), + parentId integer, + path character varying(255) +); + + +/*初始数据*/ +INSERT INTO wvp_user VALUES (1, 'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57','3e80d1762a324d5b0ff636e0bd16f1e3'); +INSERT INTO wvp_user_role VALUES (1, 'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57'); + + + diff --git a/数据库/abl/更新-mysql-2.7.0.sql b/数据库/abl/更新-mysql-2.7.0.sql new file mode 100644 index 00000000..2b38f06d --- /dev/null +++ b/数据库/abl/更新-mysql-2.7.0.sql @@ -0,0 +1,2 @@ +alter table wvp_media_server + add type character varying(50) default 'zlm',; diff --git a/数据库/abl/更新-postgresql-kingbase-2.7.0.sql b/数据库/abl/更新-postgresql-kingbase-2.7.0.sql new file mode 100644 index 00000000..45f69593 --- /dev/null +++ b/数据库/abl/更新-postgresql-kingbase-2.7.0.sql @@ -0,0 +1,2 @@ +alter table wvp_media_server + add type character varying(50) default 'zlm',; \ No newline at end of file