Merge branch 'wvp-28181-2.0' into main-dev

# Conflicts:
#	pom.xml
#	src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java
#	src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
#	src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
#	src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
#	src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java
#	src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
#	src/main/java/com/genersoft/iot/vmp/media/zlm/dto/HookSubscribeFactory.java
#	src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
#	src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
#	src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java
#	src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
#	src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
#	src/main/resources/all-application.yml
#	src/main/resources/application-dev.yml
This commit is contained in:
648540858
2024-02-07 20:30:37 +08:00
144 changed files with 6070 additions and 28330 deletions

View File

@@ -208,4 +208,8 @@ public interface IRedisCatchStorage {
void sendPlatformStartPlayMsg(MessageForPushChannel messageForPushChannel);
void sendPlatformStopPlayMsg(MessageForPushChannel messageForPushChannel);
void addPushListItem(String app, String stream, OnStreamChangedHookParam param);
void removePushListItem(String app, String stream, String mediaServerId);
}

View File

@@ -0,0 +1,122 @@
package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import com.genersoft.iot.vmp.service.bean.CloudRecordItem;
import org.apache.ibatis.annotations.*;
import java.util.List;
@Mapper
public interface CloudRecordServiceMapper {
@Insert(" <script>" +
"INSERT INTO wvp_cloud_record (" +
" app," +
" stream," +
"<if test=\"callId != null\"> call_id,</if>" +
" start_time," +
" end_time," +
" media_server_id," +
" file_name," +
" folder," +
" file_path," +
" file_size," +
" time_len ) " +
"VALUES (" +
" #{app}," +
" #{stream}," +
" <if test=\"callId != null\"> #{callId},</if>" +
" #{startTime}," +
" #{endTime}," +
" #{mediaServerId}," +
" #{fileName}," +
" #{folder}," +
" #{filePath}," +
" #{fileSize}," +
" #{timeLen})" +
" </script>")
int add(CloudRecordItem cloudRecordItem);
@Select(" <script>" +
"select * " +
" from wvp_cloud_record " +
" where 0 = 0" +
" <if test='query != null'> AND (app LIKE concat('%',#{query},'%') OR stream LIKE concat('%',#{query},'%') )</if> " +
" <if test= 'app != null '> and app=#{app}</if>" +
" <if test= 'stream != null '> and stream=#{stream}</if>" +
" <if test= 'startTimeStamp != null '> and end_time &gt;= #{startTimeStamp}</if>" +
" <if test= 'endTimeStamp != null '> and start_time &lt;= #{endTimeStamp}</if>" +
" <if test= 'callId != null '> and call_id = #{callId}</if>" +
" <if test= 'mediaServerItemList != null ' > and media_server_id in " +
" <foreach collection='mediaServerItemList' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
" </if>" +
" order by start_time DESC" +
" </script>")
List<CloudRecordItem> getList(@Param("query") String query, @Param("app") String app, @Param("stream") String stream,
@Param("startTimeStamp")Long startTimeStamp, @Param("endTimeStamp")Long endTimeStamp,
@Param("callId")String callId, List<MediaServerItem> mediaServerItemList);
@Select(" <script>" +
"select file_path" +
" from wvp_cloud_record " +
" where 0 = 0" +
" <if test= 'app != null '> and app=#{app}</if>" +
" <if test= 'stream != null '> and stream=#{stream}</if>" +
" <if test= 'startTimeStamp != null '> and end_time &gt;= #{startTimeStamp}</if>" +
" <if test= 'endTimeStamp != null '> and start_time &lt;= #{endTimeStamp}</if>" +
" <if test= 'callId != null '> and call_id = #{callId}</if>" +
" <if test= 'mediaServerItemList != null ' > and media_server_id in " +
" <foreach collection='mediaServerItemList' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
" </if>" +
" </script>")
List<String> queryRecordFilePathList(@Param("app") String app, @Param("stream") String stream,
@Param("startTimeStamp")Long startTimeStamp, @Param("endTimeStamp")Long endTimeStamp,
@Param("callId")String callId, List<MediaServerItem> mediaServerItemList);
@Update(" <script>" +
"update wvp_cloud_record set collect = #{collect} where file_path in " +
" <foreach collection='cloudRecordItemList' item='item' open='(' separator=',' close=')' > #{item.filePath}</foreach>" +
" </script>")
int updateCollectList(@Param("collect") boolean collect, List<CloudRecordItem> cloudRecordItemList);
@Delete(" <script>" +
"delete from wvp_cloud_record where media_server_id=#{mediaServerId} and file_path in " +
" <foreach collection='filePathList' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
" </script>")
void deleteByFileList(List<String> filePathList, @Param("mediaServerId") String mediaServerId);
@Select(" <script>" +
"select *" +
" from wvp_cloud_record " +
" where collect = false and end_time &lt;= #{endTimeStamp} and media_server_id = #{mediaServerId} " +
" </script>")
List<CloudRecordItem> queryRecordListForDelete(@Param("endTimeStamp")Long endTimeStamp, String mediaServerId);
@Update(" <script>" +
"update wvp_cloud_record set collect = #{collect} where id = #{recordId} " +
" </script>")
int changeCollectById(@Param("collect") boolean collect, @Param("recordId") Integer recordId);
@Delete(" <script>" +
"delete from wvp_cloud_record where id in " +
" <foreach collection='cloudRecordItemIdList' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
" </script>")
int deleteList(List<CloudRecordItem> cloudRecordItemIdList);
@Select(" <script>" +
"select *" +
" from wvp_cloud_record " +
"where call_id = #{callId}" +
" </script>")
List<CloudRecordItem> getListByCallId(@Param("callId") String callId);
@Select(" <script>" +
"select *" +
" from wvp_cloud_record " +
"where id = #{id}" +
" </script>")
CloudRecordItem queryOne(@Param("id") Integer id);
}

View File

@@ -6,7 +6,6 @@ import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@@ -31,7 +30,7 @@ public interface DeviceChannelMapper {
@Update(value = {" <script>" +
"UPDATE wvp_device_channel " +
"SET update_time=#{updateTime}" +
"<if test='name != null'>, name=#{name}</if>" +
", custom_name=#{name}" +
"<if test='manufacture != null'>, manufacture=#{manufacture}</if>" +
"<if test='model != null'>, model=#{model}</if>" +
"<if test='owner != null'>, owner=#{owner}</if>" +
@@ -49,12 +48,12 @@ public interface DeviceChannelMapper {
"<if test='ipAddress != null'>, ip_address=#{ipAddress}</if>" +
"<if test='port != null'>, port=#{port}</if>" +
"<if test='password != null'>, password=#{password}</if>" +
"<if test='PTZType != null'>, ptz_type=#{PTZType}</if>" +
"<if test='PTZType != null'>, custom_ptz_type=#{PTZType}</if>" +
"<if test='status != null'>, status=#{status}</if>" +
"<if test='streamId != null'>, stream_id=#{streamId}</if>" +
"<if test='hasAudio != null'>, has_audio=#{hasAudio}</if>" +
"<if test='longitude != null'>, longitude=#{longitude}</if>" +
"<if test='latitude != null'>, latitude=#{latitude}</if>" +
", custom_longitude=#{longitude}" +
", custom_latitude=#{latitude}" +
"<if test='longitudeGcj02 != null'>, longitude_gcj02=#{longitudeGcj02}</if>" +
"<if test='latitudeGcj02 != null'>, latitude_gcj02=#{latitudeGcj02}</if>" +
"<if test='longitudeWgs84 != null'>, longitude_wgs84=#{longitudeWgs84}</if>" +
@@ -67,12 +66,52 @@ public interface DeviceChannelMapper {
@Select(value = {" <script>" +
"SELECT " +
"dc.* " +
"dc.id, " +
"dc.channel_id, " +
"COALESCE(dc.custom_name, dc.name) AS name, " +
"dc.manufacture, " +
"dc.model, " +
"dc.owner, " +
"dc.civil_code, " +
"dc.block, " +
"dc.address, " +
"dc.parent_id, " +
"dc.safety_way, " +
"dc.register_way, " +
"dc.cert_num, " +
"dc.certifiable, " +
"dc.err_code, " +
"dc.end_time, " +
"dc.secrecy, " +
"dc.ip_address, " +
"dc.port, " +
"dc.password, " +
"COALESCE(dc.custom_ptz_type, dc.ptz_type) AS ptz_type, " +
"dc.status, " +
"COALESCE(dc.custom_longitude, dc.longitude) AS longitude, " +
"COALESCE(dc.custom_latitude, dc.latitude) AS latitude, " +
"dc.stream_id, " +
"dc.device_id, " +
"dc.parental, " +
"dc.has_audio, " +
"dc.create_time, " +
"dc.update_time, " +
"dc.sub_count, " +
"dc.longitude_gcj02, " +
"dc.latitude_gcj02, " +
"dc.longitude_wgs84, " +
"dc.latitude_wgs84, " +
"dc.business_group_id, " +
"dc.gps_time " +
"from " +
"wvp_device_channel dc " +
"WHERE " +
"dc.device_id = #{deviceId} " +
" <if test='query != null'> AND (dc.channel_id LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%') OR dc.name LIKE concat('%',#{query},'%'))</if> " +
" <if test='query != null'> AND (" +
"dc.channel_id LIKE concat('%',#{query},'%') " +
"OR dc.name LIKE concat('%',#{query},'%') " +
"OR dc.custom_name LIKE concat('%',#{query},'%')" +
")</if> " +
" <if test='parentChannelId != null'> AND (dc.parent_id=#{parentChannelId} OR dc.civil_code = #{parentChannelId}) </if> " +
" <if test='online == true' > AND dc.status= true</if>" +
" <if test='online == false' > AND dc.status= false</if>" +
@@ -154,7 +193,7 @@ public interface DeviceChannelMapper {
" dc.id,\n" +
" dc.channel_id,\n" +
" dc.device_id,\n" +
" dc.name,\n" +
" COALESCE(dc.custom_name, dc.name) AS name,\n" +
" de.manufacturer,\n" +
" de.host_address,\n" +
" dc.sub_count,\n" +
@@ -392,10 +431,10 @@ public interface DeviceChannelMapper {
@Select("select * from wvp_device_channel where device_id=#{deviceId} and SUBSTRING(channel_id, 11, 3)=#{typeCode}")
List<DeviceChannel> getBusinessGroups(@Param("deviceId") String deviceId, @Param("typeCode") String typeCode);
@Select("select dc.id, dc.channel_id, dc.device_id, dc.name, dc.manufacture,dc.model,dc.owner, pc.civil_code,dc.block, " +
@Select("select dc.id, dc.channel_id, dc.device_id, COALESCE(dc.custom_name, dc.name) AS name, dc.manufacture,dc.model,dc.owner, pc.civil_code,dc.block, " +
" dc.address, '0' as parental,'0' as channel_type, pc.id as parent_id, dc.safety_way, dc.register_way,dc.cert_num, dc.certifiable, " +
" dc.err_code,dc.end_time, dc.secrecy, dc.ip_address, dc.port, dc.ptz_type, dc.password, dc.status, " +
" dc.longitude_wgs84 as longitude, dc.latitude_wgs84 as latitude, pc.business_group_id " +
" dc.err_code,dc.end_time, dc.secrecy, dc.ip_address, dc.port, COALESCE(dc.custom_ptz_type, dc.ptz_type) AS ptz_type, dc.password, dc.status, " +
" COALESCE(dc.custom_longitude, dc.longitude) AS longitude, COALESCE(dc.custom_latitude, dc.latitude) AS latitude, pc.business_group_id " +
" from wvp_device_channel dc" +
" LEFT JOIN wvp_platform_gb_channel pgc on dc.id = pgc.device_channel_id" +
" LEFT JOIN wvp_platform_catalog pc on pgc.catalog_id = pc.id and pgc.platform_id = pc.platform_id" +
@@ -457,7 +496,44 @@ public interface DeviceChannelMapper {
void clearPlay(String deviceId);
// 设备主子码流逻辑END
@Select(value = {" <script>" +
"select * " +
"SELECT id,\n" +
" channel_id,\n" +
" COALESCE(custom_name, name) AS name,\n" +
" custom_name,\n" +
" manufacture,\n" +
" model,\n" +
" owner,\n" +
" civil_code,\n" +
" block,\n" +
" address,\n" +
" parent_id,\n" +
" safety_way,\n" +
" register_way,\n" +
" cert_num,\n" +
" certifiable,\n" +
" err_code,\n" +
" end_time,\n" +
" secrecy,\n" +
" ip_address,\n" +
" port,\n" +
" password,\n" +
" COALESCE(custom_ptz_type, ptz_type) AS ptz_type,\n" +
" status,\n" +
" COALESCE(custom_longitude, longitude) AS longitude,\n" +
" COALESCE(custom_latitude, latitude) AS latitude,\n" +
" stream_id,\n" +
" device_id,\n" +
" parental,\n" +
" has_audio,\n" +
" create_time,\n" +
" update_time,\n" +
" sub_count,\n" +
" longitude_gcj02,\n" +
" latitude_gcj02,\n" +
" longitude_wgs84,\n" +
" latitude_wgs84,\n" +
" business_group_id,\n" +
" gps_time\n" +
"from wvp_device_channel " +
"where device_id=#{deviceId}" +
" <if test='parentId != null and parentId != deviceId'> and parent_id = #{parentId} </if>" +

View File

@@ -20,7 +20,7 @@ public interface GbStreamMapper {
"(#{app}, #{stream}, #{gbId}, #{name}, " +
"#{longitude}, #{latitude}, #{streamType}, " +
"#{mediaServerId}, #{createTime})")
@Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId")
@Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gb_stream_id")
int add(GbStream gbStream);
@Update("UPDATE wvp_gb_stream " +
@@ -158,7 +158,7 @@ public interface GbStreamMapper {
" <foreach collection='list' item='item' index='index' separator=';'>"+
"UPDATE wvp_gb_stream " +
" SET name=#{item.name},"+
" gb_id=#{item.gb_id}"+
" gb_id=#{item.gbId}"+
" WHERE app=#{item.app} and stream=#{item.stream}"+
"</foreach>"+
"</script>")

View File

@@ -31,6 +31,8 @@ public interface MediaServerMapper {
"rtp_port_range,"+
"send_rtp_port_range,"+
"record_assist_port,"+
"record_day,"+
"record_path,"+
"default_server,"+
"create_time,"+
"update_time,"+
@@ -55,6 +57,8 @@ public interface MediaServerMapper {
"#{rtpPortRange}, " +
"#{sendRtpPortRange}, " +
"#{recordAssistPort}, " +
"#{recordDay}, " +
"#{recordPath}, " +
"#{defaultServer}, " +
"#{createTime}, " +
"#{updateTime}, " +
@@ -82,6 +86,8 @@ public interface MediaServerMapper {
"<if test=\"secret != null\">, secret=#{secret}</if>" +
"<if test=\"recordAssistPort != null\">, record_assist_port=#{recordAssistPort}</if>" +
"<if test=\"hookAliveInterval != null\">, hook_alive_interval=#{hookAliveInterval}</if>" +
"<if test=\"recordDay != null\">, record_day=#{recordDay}</if>" +
"<if test=\"recordPath != null\">, record_path=#{recordPath}</if>" +
"WHERE id=#{id}"+
" </script>"})
int update(MediaServerItem mediaServerItem);
@@ -105,6 +111,8 @@ public interface MediaServerMapper {
"<if test=\"sendRtpPortRange != null\">, send_rtp_port_range=#{sendRtpPortRange}</if>" +
"<if test=\"secret != null\">, secret=#{secret}</if>" +
"<if test=\"recordAssistPort != null\">, record_assist_port=#{recordAssistPort}</if>" +
"<if test=\"recordDay != null\">, record_day=#{recordDay}</if>" +
"<if test=\"recordPath != null\">, record_path=#{recordPath}</if>" +
"<if test=\"hookAliveInterval != null\">, hook_alive_interval=#{hookAliveInterval}</if>" +
"WHERE ip=#{ip} and http_port=#{httpPort}"+
" </script>"})
@@ -130,4 +138,8 @@ public interface MediaServerMapper {
@Select("SELECT * FROM wvp_media_server WHERE default_server=true")
MediaServerItem queryDefault();
@Select("SELECT * FROM wvp_media_server WHERE record_assist_port > 0")
List<MediaServerItem> queryAllWithAssistPort();
}

View File

@@ -58,7 +58,10 @@ public interface PlatformChannelMapper {
@Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id=#{channelId} and pgc.platform_id=#{platformId}")
List<DeviceChannel> queryChannelInParentPlatform(@Param("platformId") String platformId, @Param("channelId") String channelId);
@Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}")
@Select("<script> "+
"SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE pgc.platform_id=#{platformId} " +
" <if test='catalogId != null' > and pgc.catalog_id=#{catalogId}</if>" +
"</script>")
List<DeviceChannel> queryAllChannelInCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
@Select(" select dc.channel_id as id, dc.name as name, pgc.platform_id as platform_id, pgc.catalog_id as parent_id, 0 as children_count, 1 as type " +
@@ -117,8 +120,6 @@ public interface PlatformChannelMapper {
"where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
List<Device> queryDeviceInfoByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
@Select("SELECT pgc.platform_id from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id='${channelId}'")
List<String> queryParentPlatformByChannelId(String channelId);
@Select("SELECT pgc.platform_id from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id=#{channelId}")
List<String> queryParentPlatformByChannelId(@Param("channelId") String channelId);
}

View File

@@ -53,11 +53,14 @@ public interface PlatformGbStreamMapper {
"WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platform_id=#{platformId}")
StreamProxyItem selectOne(@Param("app") String app, @Param("stream") String stream, @Param("platformId") String platformId);
@Select("select gs.* \n" +
"from wvp_gb_stream gs\n" +
@Select("<script> " +
"select gs.* " +
" from wvp_gb_stream gs\n" +
" left join wvp_platform_gb_stream pgs\n" +
" on gs.gb_stream_id = pgs.gb_stream_id\n" +
"where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}")
" where pgs.platform_id=#{platformId} " +
" <if test='catalogId != null' > and pgs.catalog_id=#{catalogId}</if>" +
"</script>")
List<GbStream> queryChannelInParentPlatformAndCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
@Select("select gs.gb_id as id, gs.name as name, pgs.platform_id as platform_id, pgs.catalog_id as catalog_id , 0 as children_count, 2 as type\n" +
@@ -103,6 +106,9 @@ public interface PlatformGbStreamMapper {
"</script>")
void delByAppAndStreamsByPlatformId(@Param("gbStreams") List<GbStream> gbStreams, @Param("platformId") String platformId);
@Delete("DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId} and catalog_id=#{catalogId}")
@Delete("<script> "+
"DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId}" +
" <if test='catalogId != null' > and catalog_id=#{catalogId}</if>" +
"</script>")
int delByPlatformAndCatalogId(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
}

View File

@@ -13,9 +13,9 @@ import java.util.List;
public interface StreamPushMapper {
@Insert("INSERT INTO wvp_stream_push (app, stream, total_reader_count, origin_type, origin_type_str, " +
"push_time, alive_second, media_server_id, update_time, create_time, push_ing, self) VALUES" +
"push_time, alive_second, media_server_id, server_id, update_time, create_time, push_ing, self) VALUES" +
"(#{app}, #{stream}, #{totalReaderCount}, #{originType}, #{originTypeStr}, " +
"#{pushTime}, #{aliveSecond}, #{mediaServerId} , #{updateTime} , #{createTime}, " +
"#{pushTime}, #{aliveSecond}, #{mediaServerId} , #{serverId} , #{updateTime} , #{createTime}, " +
"#{pushIng}, #{self} )")
int add(StreamPushItem streamPushItem);
@@ -24,6 +24,7 @@ public interface StreamPushMapper {
"UPDATE wvp_stream_push " +
"SET update_time=#{updateTime}" +
"<if test=\"mediaServerId != null\">, media_server_id=#{mediaServerId}</if>" +
"<if test=\"serverId != null\">, server_id=#{serverId}</if>" +
"<if test=\"totalReaderCount != null\">, total_reader_count=#{totalReaderCount}</if>" +
"<if test=\"originType != null\">, origin_type=#{originType}</if>" +
"<if test=\"originTypeStr != null\">, origin_type_str=#{originTypeStr}</if>" +
@@ -89,10 +90,10 @@ public interface StreamPushMapper {
@Insert("<script>" +
"Insert INTO wvp_stream_push (app, stream, total_reader_count, origin_type, origin_type_str, " +
"create_time, alive_second, media_server_id, status, push_ing) " +
"create_time, alive_second, media_server_id, server_id, status, push_ing) " +
"VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" +
"( #{item.app}, #{item.stream}, #{item.totalReaderCount}, #{item.originType}, " +
"#{item.originTypeStr},#{item.createTime}, #{item.aliveSecond}, #{item.mediaServerId}, #{item.status} ," +
"#{item.originTypeStr},#{item.createTime}, #{item.aliveSecond}, #{item.mediaServerId},#{item.serverId}, #{item.status} ," +
" #{item.pushIng} )" +
" </foreach>" +
"</script>")

View File

@@ -609,14 +609,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
@Override
public void sendDeviceOrChannelStatus(String deviceId, String channelId, boolean online) {
String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_DEVICE_STATUS;
logger.info("[redis通知] 发送 推送设备/通道状态, {}/{}-{}", deviceId, channelId, online);
StringBuilder msg = new StringBuilder();
msg.append(deviceId);
if (channelId != null) {
msg.append(":").append(channelId);
}
msg.append(" ").append(online? "ON":"OFF");
logger.info("[redis通知] 推送状态-> {} ", msg);
logger.info("[redis通知] 推送设备/通道状态-> {} ", msg);
// 使用 RedisTemplate<Object, Object> 发送字符串消息会导致发送的消息多带了双引号
stringRedisTemplate.convertAndSend(key, msg.toString());
}
@@ -650,4 +649,20 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
logger.info("[redis发送通知] 发送 上级平台停止观看 {}: {}/{}->{}", key, msg.getApp(), msg.getStream(), msg.getPlatFormId());
redisTemplate.convertAndSend(key, JSON.toJSON(msg));
}
@Override
public void addPushListItem(String app, String stream, OnStreamChangedHookParam param) {
String key = VideoManagerConstants.PUSH_STREAM_LIST + app + "_" + stream;
redisTemplate.opsForValue().set(key, param);
}
@Override
public void removePushListItem(String app, String stream, String mediaServerId) {
String key = VideoManagerConstants.PUSH_STREAM_LIST + app + "_" + stream;
OnStreamChangedHookParam param = (OnStreamChangedHookParam)redisTemplate.opsForValue().get(key);
if (param != null && param.getMediaServerId().equalsIgnoreCase(mediaServerId)) {
redisTemplate.delete(key);
}
}
}

View File

@@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.storager.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.*;
@@ -39,6 +40,7 @@ import java.util.concurrent.ConcurrentHashMap;
*/
@SuppressWarnings("rawtypes")
@Component
@DS("master")
public class VideoManagerStorageImpl implements IVideoManagerStorage {
private final Logger logger = LoggerFactory.getLogger(VideoManagerStorageImpl.class);