浏览代码

临时提交

648540858 1 年之前
父节点
当前提交
88c021948f

+ 2 - 4
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java

@@ -25,13 +25,11 @@ import com.genersoft.iot.vmp.media.event.hook.Hook;
 import com.genersoft.iot.vmp.media.event.hook.HookSubscribe;
 import com.genersoft.iot.vmp.media.event.hook.HookType;
 import com.genersoft.iot.vmp.media.service.IMediaServerService;
-import com.genersoft.iot.vmp.media.zlm.dto.StreamProxy;
+import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
 import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
-import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
-import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
 import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
 import com.genersoft.iot.vmp.service.IPlayService;
-import com.genersoft.iot.vmp.service.IStreamProxyService;
+import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyService;
 import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
 import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
 import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcService;

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/media/event/mediaServer/MediaServerStatusEventListener.java

@@ -1,7 +1,7 @@
 package com.genersoft.iot.vmp.media.event.mediaServer;
 
 import com.genersoft.iot.vmp.service.IPlayService;
-import com.genersoft.iot.vmp.service.IStreamProxyService;
+import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;

+ 1 - 0
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java

@@ -24,6 +24,7 @@ import com.genersoft.iot.vmp.service.*;
 import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcService;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
+import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyService;
 import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
 import com.genersoft.iot.vmp.utils.MediaServerUtils;
 import org.slf4j.Logger;

+ 2 - 1
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java

@@ -13,10 +13,11 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
 import com.genersoft.iot.vmp.media.bean.MediaServer;
 import com.genersoft.iot.vmp.media.bean.ResultForOnPublish;
 import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
-import com.genersoft.iot.vmp.media.zlm.dto.StreamProxy;
+import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
 import com.genersoft.iot.vmp.service.*;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
+import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyService;
 import com.genersoft.iot.vmp.utils.DateUtil;
 import com.genersoft.iot.vmp.utils.MediaServerUtils;
 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java

@@ -1,7 +1,7 @@
 package com.genersoft.iot.vmp.storager;
 
 import com.genersoft.iot.vmp.gb28181.bean.*;
-import com.genersoft.iot.vmp.media.zlm.dto.StreamProxy;
+import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
 import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
 import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java

@@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.storager.dao;
 
 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
 import com.genersoft.iot.vmp.gb28181.bean.GbStream;
-import com.genersoft.iot.vmp.media.zlm.dto.StreamProxy;
+import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
 import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
 import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
 import org.apache.ibatis.annotations.*;

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java

@@ -4,7 +4,7 @@ import com.genersoft.iot.vmp.gb28181.bean.GbStream;
 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
 import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
 import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream;
-import com.genersoft.iot.vmp.media.zlm.dto.StreamProxy;
+import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
 import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
 import org.apache.ibatis.annotations.*;
 import org.springframework.stereotype.Repository;

+ 0 - 1
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java

@@ -10,7 +10,6 @@ import com.genersoft.iot.vmp.media.bean.MediaInfo;
 import com.genersoft.iot.vmp.media.bean.MediaServer;
 import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
 import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
-import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
 import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
 import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
 import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;

+ 2 - 1
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java

@@ -6,12 +6,13 @@ import com.genersoft.iot.vmp.conf.UserSetting;
 import com.genersoft.iot.vmp.gb28181.bean.*;
 import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
 import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
-import com.genersoft.iot.vmp.media.zlm.dto.StreamProxy;
+import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
 import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
 import com.genersoft.iot.vmp.storager.dao.*;
 import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
+import com.genersoft.iot.vmp.streamProxy.dao.StreamProxyMapper;
 import com.genersoft.iot.vmp.streamPush.dao.StreamPushMapper;
 import com.genersoft.iot.vmp.utils.DateUtil;
 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxy.java → src/main/java/com/genersoft/iot/vmp/streamProxy/bean/StreamProxy.java

@@ -1,4 +1,4 @@
-package com.genersoft.iot.vmp.media.zlm.dto;
+package com.genersoft.iot.vmp.streamProxy.bean;
 
 import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
 import io.swagger.v3.oas.annotations.media.Schema;

+ 3 - 3
src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java → src/main/java/com/genersoft/iot/vmp/streamProxy/controller/StreamProxyController.java

@@ -1,4 +1,4 @@
-package com.genersoft.iot.vmp.vmanager.streamProxy;
+package com.genersoft.iot.vmp.streamProxy.controller;
 
 import com.alibaba.fastjson2.JSONObject;
 import com.genersoft.iot.vmp.common.StreamInfo;
@@ -8,9 +8,9 @@ import com.genersoft.iot.vmp.conf.security.JwtUtils;
 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
 import com.genersoft.iot.vmp.media.bean.MediaServer;
-import com.genersoft.iot.vmp.media.zlm.dto.StreamProxy;
+import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
 import com.genersoft.iot.vmp.media.service.IMediaServerService;
-import com.genersoft.iot.vmp.service.IStreamProxyService;
+import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyService;
 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
 import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java → src/main/java/com/genersoft/iot/vmp/streamProxy/dao/StreamProxyMapper.java

@@ -1,6 +1,6 @@
-package com.genersoft.iot.vmp.storager.dao;
+package com.genersoft.iot.vmp.streamProxy.dao;
 
-import com.genersoft.iot.vmp.media.zlm.dto.StreamProxy;
+import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
 import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
 import org.apache.ibatis.annotations.*;
 import org.springframework.stereotype.Repository;

+ 3 - 3
src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java → src/main/java/com/genersoft/iot/vmp/streamProxy/service/IStreamProxyService.java

@@ -1,9 +1,9 @@
-package com.genersoft.iot.vmp.service;
+package com.genersoft.iot.vmp.streamProxy.service;
 
 import com.genersoft.iot.vmp.common.GeneralCallback;
 import com.genersoft.iot.vmp.common.StreamInfo;
 import com.genersoft.iot.vmp.media.bean.MediaServer;
-import com.genersoft.iot.vmp.media.zlm.dto.StreamProxy;
+import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
 import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
 import com.github.pagehelper.PageInfo;
@@ -63,7 +63,7 @@ public interface IStreamProxyService {
      * @param app
      * @param stream
      */
-    int updateStatus(boolean status, String app, String stream);
+    int updateStatusByAppAndStream(String app, String stream, boolean status);
 
 
 

+ 20 - 20
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java → src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyServiceImpl.java

@@ -1,4 +1,4 @@
-package com.genersoft.iot.vmp.service.impl;
+package com.genersoft.iot.vmp.streamProxy.service.impl;
 
 import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DS;
@@ -17,18 +17,19 @@ import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
 import com.genersoft.iot.vmp.media.event.media.MediaDepartureEvent;
 import com.genersoft.iot.vmp.media.event.media.MediaNotFoundEvent;
 import com.genersoft.iot.vmp.media.service.IMediaServerService;
-import com.genersoft.iot.vmp.media.zlm.dto.StreamProxy;
+import com.genersoft.iot.vmp.streamProxy.bean.StreamProxy;
 import com.genersoft.iot.vmp.service.IGbStreamService;
-import com.genersoft.iot.vmp.service.IStreamProxyService;
+import com.genersoft.iot.vmp.streamProxy.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.PlatformGbStreamMapper;
-import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper;
+import com.genersoft.iot.vmp.streamProxy.dao.StreamProxyMapper;
 import com.genersoft.iot.vmp.utils.DateUtil;
 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
 import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
+import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -59,9 +60,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
 
     private final static Logger logger = LoggerFactory.getLogger(StreamProxyServiceImpl.class);
 
-    @Autowired
-    private IVideoManagerStorage videoManagerStorager;
-
     @Autowired
     private StreamProxyMapper streamProxyMapper;
 
@@ -105,7 +103,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
     @org.springframework.context.event.EventListener
     public void onApplicationEvent(MediaArrivalEvent event) {
         if ("rtsp".equals(event.getSchema())) {
-            updateStatus(true, event.getApp(), event.getStream());
+            updateStatusByAppAndStream(event.getApp(), event.getStream(), true);
         }
     }
 
@@ -116,7 +114,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
     @EventListener
     public void onApplicationEvent(MediaDepartureEvent event) {
         if ("rtsp".equals(event.getSchema())) {
-            updateStatus(false, event.getApp(), event.getStream());
+            updateStatusByAppAndStream(event.getApp(), event.getStream(), false);
         }
     }
 
@@ -185,7 +183,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
         param.setMediaServerId(mediaServer.getId());
         boolean saveResult;
         // 更新
-        if (videoManagerStorager.queryStreamProxy(param.getApp(), param.getStream()) != null) {
+        if (streamProxyMapper.selectOne(param.getApp(), param.getStream()) != null) {
             saveResult = updateStreamProxy(param);
         }else { // 新增
             saveResult = addStreamProxy(param);
@@ -395,19 +393,21 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
 
     @Override
     public PageInfo<StreamProxy> getAll(Integer page, Integer count) {
-        return videoManagerStorager.queryStreamProxyList(page, count);
+        PageHelper.startPage(page, count);
+        List<StreamProxy> all = streamProxyMapper.selectAll();
+        return new PageInfo<>(all);
     }
 
     @Override
     public void del(String app, String stream) {
-        StreamProxy streamProxyItem = videoManagerStorager.queryStreamProxy(app, stream);
+        StreamProxy streamProxyItem = streamProxyMapper.selectOne(app, stream);
         if (streamProxyItem != null) {
             gbStreamService.sendCatalogMsg(streamProxyItem, CatalogEvent.DEL);
 
             // 如果关联了国标那么移除关联
             platformGbStreamMapper.delByAppAndStream(app, stream);
             gbStreamMapper.del(app, stream);
-            videoManagerStorager.deleteStreamProxy(app, stream);
+            streamProxyMapper.del(app, stream);
             redisCatchStorage.removeStream(streamProxyItem.getMediaServerId(), "PULL", app, stream);
             redisCatchStorage.removeStream(streamProxyItem.getMediaServerId(), "PUSH", app, stream);
             Boolean result = removeStreamProxyFromZlm(streamProxyItem);
@@ -422,7 +422,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
     @Override
     public boolean start(String app, String stream) {
         boolean result = false;
-        StreamProxy streamProxy = videoManagerStorager.queryStreamProxy(app, stream);
+        StreamProxy streamProxy = streamProxyMapper.selectOne(app, stream);
         if (streamProxy != null && !streamProxy.isEnable() ) {
             WVPResult<String> wvpResult = addStreamProxyToZlm(streamProxy);
             if (wvpResult == null) {
@@ -445,7 +445,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
     @Override
     public boolean stop(String app, String stream) {
         boolean result = false;
-        StreamProxy streamProxyDto = videoManagerStorager.queryStreamProxy(app, stream);
+        StreamProxy streamProxyDto = streamProxyMapper.selectOne(app, stream);
         if (streamProxyDto != null && streamProxyDto.isEnable()) {
             Boolean removed = removeStreamProxyFromZlm(streamProxyDto);
             if (removed != null && removed) {
@@ -464,7 +464,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
 
     @Override
     public StreamProxy getStreamProxyByAppAndStream(String app, String streamId) {
-        return videoManagerStorager.getStreamProxyByAppAndStream(app, streamId);
+        return streamProxyMapper.selectOne(app, streamId);
     }
 
     @Override
@@ -488,9 +488,9 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
             if (wvpResult == null) {
                 // 设置为离线
                 logger.info("恢复流代理失败" + streamProxyDto.getApp() + "/" + streamProxyDto.getStream());
-                updateStatus(false, streamProxyDto.getApp(), streamProxyDto.getStream());
+                updateStatusByAppAndStream(streamProxyDto.getApp(), streamProxyDto.getStream(), false);
             }else {
-                updateStatus(true, streamProxyDto.getApp(), streamProxyDto.getStream());
+                updateStatusByAppAndStream(streamProxyDto.getApp(), streamProxyDto.getStream(), true);
             }
         }
     }
@@ -530,7 +530,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
     }
 
     @Override
-    public int updateStatus(boolean status, String app, String stream) {
+    public int updateStatusByAppAndStream(String app, String stream, boolean status) {
         // 状态变化时推送到国标上级
         StreamProxy streamProxyItem = streamProxyMapper.selectOne(app, stream);
         if (streamProxyItem == null) {
@@ -591,7 +591,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
 
         Map<String, MediaServer> serverItemMap = all.stream().collect(Collectors.toMap(MediaServer::getId, Function.identity(), (m1, m2) -> m1));
 
-        List<StreamProxy> list = videoManagerStorager.getStreamProxyListForEnable(true);
+        List<StreamProxy> list = streamProxyMapper.selectForEnable(true);
 
         if (CollectionUtils.isEmpty(list)){
             return;

+ 1 - 2
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java

@@ -7,8 +7,7 @@ import com.genersoft.iot.vmp.conf.security.SecurityUtils;
 import com.genersoft.iot.vmp.conf.security.dto.LoginUser;
 import com.genersoft.iot.vmp.media.service.IMediaServerService;
 import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
-import com.genersoft.iot.vmp.service.IMediaService;
-import com.genersoft.iot.vmp.service.IStreamProxyService;
+import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyService;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
 import com.genersoft.iot.vmp.vmanager.bean.StreamContent;

+ 1 - 0
src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java

@@ -14,6 +14,7 @@ import com.genersoft.iot.vmp.media.bean.MediaServer;
 import com.genersoft.iot.vmp.service.*;
 import com.genersoft.iot.vmp.service.bean.MediaServerLoad;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
+import com.genersoft.iot.vmp.streamProxy.service.IStreamProxyService;
 import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
 import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;