支持从redis消息更新推流设备状态

This commit is contained in:
648540858
2022-07-12 17:33:17 +08:00
parent 0b1cae75fe
commit 81f69eb6f4
10 changed files with 210 additions and 17 deletions

View File

@@ -233,4 +233,9 @@ public interface IRedisCatchStorage {
* @return
*/
StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream);
/**
* 发送redis消息 查询所有推流设备的状态
*/
void sendStreamPushRequestedMsgForStatus();
}

View File

@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
import org.apache.ibatis.annotations.*;
// import org.omg.PortableInterceptor.INACTIVE;
import org.springframework.stereotype.Repository;
@@ -117,4 +118,45 @@ public interface StreamPushMapper {
"SET status=#{status} " +
"WHERE mediaServerId=#{mediaServerId}")
void updateStatusByMediaServerId(String mediaServerId, boolean status);
@Select("<script> "+
"SELECT gs.* FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream " +
"where sp.status = 1 and (gs.app, gs.stream) in" +
"<foreach collection='offlineStreams' item='item' separator=','>" +
"(#{item.app}, {item.stream}) " +
"</foreach>" +
"</script>")
List<GbStream> getOnlinePusherForGbInList(List<StreamPushItemFromRedis> offlineStreams);
@Update("<script> "+
"UPDATE stream_push SET status=0 where (app, stream) in" +
"<foreach collection='offlineStreams' item='item' separator=','>" +
"(#{item.app}, {item.stream}) " +
"</foreach>" +
"</script>")
void offline(List<StreamPushItemFromRedis> offlineStreams);
@Select("<script> "+
"SELECT * FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream " +
"where sp.status = 0 and (gs.app, gs.stream) in" +
"<foreach collection='offlineStreams' item='item' separator=','>" +
"(#{item.app}, {item.stream}) " +
"</foreach>" +
"</script>")
List<GbStream> getOfflinePusherForGbInList(List<StreamPushItemFromRedis> onlineStreams);
@Update("<script> "+
"UPDATE stream_push SET status=1 where (app, stream) in" +
"<foreach collection='offlineStreams' item='item' separator=','>" +
"(#{item.app}, {item.stream}) " +
"</foreach>" +
"</script>")
void online(List<StreamPushItemFromRedis> onlineStreams);
@Select("SELECT gs.* FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream")
List<GbStream> getOnlinePusherForGb();
@Update("UPDATE stream_push SET status=0")
void allStreamOffline();
}