From a683d9f6763cbe7a36dc36dd09502ce2a595f937 Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期二, 12 一月 2021 10:46:41 +0800
Subject: [PATCH] 关闭播放窗口停止回放 回滚回放代码

---
 src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java |   26 +++++++-------------------
 1 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
index 8eaaf68..d4b6f44 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
@@ -6,7 +6,6 @@
 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
-import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
 import com.genersoft.iot.vmp.utils.redis.RedisUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -23,9 +22,6 @@
 	private RedisUtil redis;
 
     @Autowired
-    private DeviceMapper deviceMapper;
-
-    @Autowired
     private DeviceChannelMapper deviceChannelMapper;
 
 
@@ -36,7 +32,7 @@
      */
     @Override
     public boolean startPlay(StreamInfo stream) {
-        return redis.set(String.format("%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, stream.getStreamId(),stream.getDeviceID(), stream.getCahnnelId()),
+        return redis.set(String.format("%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, stream.getStreamId(),stream.getDeviceID(), stream.getChannelId()),
                 stream);
     }
 
@@ -48,17 +44,10 @@
     @Override
     public boolean stopPlay(StreamInfo streamInfo) {
         if (streamInfo == null) return false;
-        DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(streamInfo.getDeviceID(), streamInfo.getCahnnelId());
-        if (deviceChannel != null) {
-            deviceChannel.setStreamId(null);
-            deviceChannel.setPlay(false);
-            deviceChannel.setDeviceId(streamInfo.getDeviceID());
-            deviceChannelMapper.update(deviceChannel);
-        }
         return redis.del(String.format("%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
                 streamInfo.getStreamId(),
                 streamInfo.getDeviceID(),
-                streamInfo.getCahnnelId()));
+                streamInfo.getChannelId()));
     }
 
     /**
@@ -71,7 +60,7 @@
                 VideoManagerConstants.PLAYER_PREFIX,
                 streamInfo.getStreamId(),
                 streamInfo.getDeviceID(),
-                streamInfo.getCahnnelId()));
+                streamInfo.getChannelId()));
     }
     @Override
     public StreamInfo queryPlayByStreamId(String steamId) {
@@ -125,7 +114,7 @@
         for (int i = 0; i < players.size(); i++) {
             String key = (String) players.get(i);
             StreamInfo streamInfo = (StreamInfo)redis.get(key);
-            streamInfos.put(streamInfo.getDeviceID() + "_" + streamInfo.getCahnnelId(), streamInfo);
+            streamInfos.put(streamInfo.getDeviceID() + "_" + streamInfo.getChannelId(), streamInfo);
         }
         return streamInfos;
     }
@@ -133,7 +122,7 @@
 
     @Override
     public boolean startPlayback(StreamInfo stream) {
-        return redis.set(String.format("%S_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, stream.getStreamId(),stream.getDeviceID(), stream.getCahnnelId()),
+        return redis.set(String.format("%S_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, stream.getStreamId(),stream.getDeviceID(), stream.getChannelId()),
                 stream);
     }
 
@@ -141,17 +130,16 @@
     @Override
     public boolean stopPlayback(StreamInfo streamInfo) {
         if (streamInfo == null) return false;
-        DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(streamInfo.getDeviceID(), streamInfo.getCahnnelId());
+        DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(streamInfo.getDeviceID(), streamInfo.getChannelId());
         if (deviceChannel != null) {
             deviceChannel.setStreamId(null);
-            deviceChannel.setPlay(false);
             deviceChannel.setDeviceId(streamInfo.getDeviceID());
             deviceChannelMapper.update(deviceChannel);
         }
         return redis.del(String.format("%S_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
                 streamInfo.getStreamId(),
                 streamInfo.getDeviceID(),
-                streamInfo.getCahnnelId()));
+                streamInfo.getChannelId()));
     }
 
     @Override

--
Gitblit v1.8.0