修复推流的添加

结构优化
648540858 2023-12-19 18:49:49 +08:00
parent 6d0361edf8
commit 9ae08fd6c3
15 changed files with 120 additions and 299 deletions

View File

@ -140,6 +140,9 @@ alter table wvp_stream_proxy
alter table wvp_stream_proxy
add status bool default false;
alter table wvp_device
drop column auto_sync_channel;

View File

@ -33,7 +33,6 @@ create table wvp_device (
keepalive_interval_time integer,
switch_primary_sub_stream bool default false,
broadcast_push_after_ack bool default false,
auto_sync_channel bool default true,
constraint uk_device_device unique (device_id)
);
@ -116,21 +115,6 @@ create table wvp_device_mobile_position (
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),
@ -200,16 +184,6 @@ create table wvp_platform (
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),
@ -218,14 +192,6 @@ create table wvp_platform_gb_channel (
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),
@ -288,15 +254,6 @@ create table wvp_user_role (
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)
);
/*初始数据*/

View File

@ -53,8 +53,9 @@ public class Gb28181Sdp {
for (Object description : mediaDescriptions) {
MediaDescription mediaDescription = (MediaDescription) description;
gb28181Sdp.setDownloadSpeed(Integer.parseInt(mediaDescription.getAttribute("downloadspeed")));
if (mediaDescription.getAttribute("downloadspeed") != null) {
gb28181Sdp.setDownloadSpeed(Integer.parseInt(mediaDescription.getAttribute("downloadspeed")));
}
Media media = mediaDescription.getMedia();
Vector mediaFormats = media.getMediaFormats(false);
// 查看是否支持PS 负载96

View File

@ -9,7 +9,6 @@ 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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -76,14 +76,6 @@ public class StreamProxy {
this.id = id;
}
public String getCreateTime() {
return createTime;
}
public String getUpdateTime() {
return updateTime;
}
public String getType() {
return type;
}
@ -96,27 +88,22 @@ public class StreamProxy {
return app;
}
public void setApp(String app) {
this.app = app;
}
public String getStream() {
return stream;
}
public void setStream(String stream) {
this.stream = stream;
}
public String getMediaServerId() {
return mediaServerId;
}
public void setMediaServerId(String mediaServerId) {
this.mediaServerId = mediaServerId;
}
@ -133,40 +120,40 @@ public class StreamProxy {
return srcUrl;
}
public void setSrcUrl(String src_url) {
this.srcUrl = src_url;
public void setSrcUrl(String srcUrl) {
this.srcUrl = srcUrl;
}
public String getDstUrl() {
return dstUrl;
}
public void setDstUrl(String dst_url) {
this.dstUrl = dst_url;
public void setDstUrl(String dstUrl) {
this.dstUrl = dstUrl;
}
public int getTimeoutMs() {
return timeoutMs;
}
public void setTimeoutMs(int timeout_ms) {
this.timeoutMs = timeout_ms;
public void setTimeoutMs(int timeoutMs) {
this.timeoutMs = timeoutMs;
}
public String getFfmpegCmdKey() {
return ffmpegCmdKey;
}
public void setFfmpegCmdKey(String ffmpeg_cmd_key) {
this.ffmpegCmdKey = ffmpeg_cmd_key;
public void setFfmpegCmdKey(String ffmpegCmdKey) {
this.ffmpegCmdKey = ffmpegCmdKey;
}
public String getRtpType() {
return rtpType;
}
public void setRtpType(String rtp_type) {
this.rtpType = rtp_type;
public void setRtpType(String rtpType) {
this.rtpType = rtpType;
}
public boolean isEnable() {
@ -177,36 +164,36 @@ public class StreamProxy {
this.enable = enable;
}
public boolean isEnableAudio() {
return enableAudio;
}
public void setEnableAudio(boolean enableAudio) {
this.enableAudio = enableAudio;
}
public boolean isEnableMp4() {
return enableMp4;
}
public void setEnableMp4(boolean enable_mp4) {
this.enableMp4 = enable_mp4;
public void setEnableMp4(boolean enableMp4) {
this.enableMp4 = enableMp4;
}
public boolean isEnableRemoveNoneReader() {
return enableRemoveNoneReader;
}
public void setEnableRemoveNoneReader(boolean enable_remove_none_reader) {
this.enableRemoveNoneReader = enable_remove_none_reader;
public void setEnableRemoveNoneReader(boolean enableRemoveNoneReader) {
this.enableRemoveNoneReader = enableRemoveNoneReader;
}
public boolean isEnableDisableNoneReader() {
return enableDisableNoneReader;
}
public void setEnableDisableNoneReader(boolean enable_disable_none_reader) {
this.enableDisableNoneReader = enable_disable_none_reader;
}
public boolean isEnableAudio() {
return enableAudio;
}
public void setEnableAudio(boolean enable_audio) {
this.enableAudio = enable_audio;
public void setEnableDisableNoneReader(boolean enableDisableNoneReader) {
this.enableDisableNoneReader = enableDisableNoneReader;
}
public String getStreamKey() {
@ -217,14 +204,6 @@ public class StreamProxy {
this.streamKey = streamKey;
}
public int getCommonGbChannelId() {
return commonGbChannelId;
}
public void setCommonGbChannelId(int commonGbChannelId) {
this.commonGbChannelId = commonGbChannelId;
}
public String getGbId() {
return gbId;
}
@ -265,7 +244,7 @@ public class StreamProxy {
this.status = status;
}
public String isCreateTime() {
public String getCreateTime() {
return createTime;
}
@ -273,11 +252,19 @@ public class StreamProxy {
this.createTime = createTime;
}
public String isUpdateTime() {
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public int getCommonGbChannelId() {
return commonGbChannelId;
}
public void setCommonGbChannelId(int commonGbChannelId) {
this.commonGbChannelId = commonGbChannelId;
}
}

View File

@ -118,4 +118,10 @@ public interface IStreamProxyService {
* redisgps
*/
void updateStreamGPS(List<GPSMsgInfo> gpsMsgInfoList);
/**
*
*/
List<StreamProxy> getAllForEnable();
}

View File

@ -149,22 +149,6 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
return null;
}
@Override
public int delAllChannelForGB(String platformId, String catalogId) {
int result;
if (platformId == null) {
return 0;
}
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId);
if (platform == null) {
return 0;
}
if (ObjectUtils.isEmpty(catalogId)) {
catalogId = null;
}
}
@Override
public CommonGbChannel queryChannelByPlatformIdAndChannelDeviceId(Integer platformId, String channelId) {
return platformChannelMapper.queryChannelByPlatformIdAndChannelDeviceId(platformId, channelId);

View File

@ -86,12 +86,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
@Autowired
private ICommonGbChannelService commonGbChannelService;
@Autowired
private EventPublisher eventPublisher;
@Autowired
private ParentPlatformMapper parentPlatformMapper;
@Autowired
private IMediaServerService mediaServerService;
@ -159,24 +153,25 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
// 更新
StreamProxy streamProxyInDb = videoManagerStorager.queryStreamProxy(param.getApp(), param.getStream());
if (streamProxyInDb != null) {
if (streamProxyInDb.getCommonGbChannelId() == 0 && param.getGbId() != null ) {
if (streamProxyInDb.getCommonGbChannelId() == 0 && !ObjectUtils.isEmpty(param.getGbId()) ) {
// 新增通用通道
CommonGbChannel commonGbChannel = CommonGbChannel.getInstance(param);
commonGbChannelService.add(commonGbChannel);
param.setCommonGbChannelId(commonGbChannel.getCommonGbId());
}
if (streamProxyInDb.getCommonGbChannelId() > 0 && param.getGbId() == null ) {
if (streamProxyInDb.getCommonGbChannelId() > 0 && ObjectUtils.isEmpty(param.getGbId()) ) {
// 移除通用通道
commonGbChannelService.deleteById(streamProxyInDb.getCommonGbChannelId());
}
param.setUpdateTime(DateUtil.getNow());
streamProxyMapper.update(param);
}else { // 新增
// 新增通用通道
CommonGbChannel commonGbChannel = CommonGbChannel.getInstance(param);
commonGbChannelService.add(commonGbChannel);
param.setCommonGbChannelId(commonGbChannel.getCommonGbId());
if (!ObjectUtils.isEmpty(param.getGbId())) {
// 新增通用通道
CommonGbChannel commonGbChannel = CommonGbChannel.getInstance(param);
commonGbChannelService.add(commonGbChannel);
param.setCommonGbChannelId(commonGbChannel.getCommonGbId());
}
param.setCreateTime(DateUtil.getNow());
param.setUpdateTime(DateUtil.getNow());
streamProxyMapper.add(param);
@ -533,6 +528,9 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
}
/**
*
*/
@Scheduled(cron = "* 0/10 * * * ?")
public void asyncCheckStreamProxyStatus() {
@ -544,13 +542,13 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
Map<String, MediaServerItem> serverItemMap = all.stream().collect(Collectors.toMap(MediaServerItem::getId, Function.identity(), (m1, m2) -> m1));
List<StreamProxyItem> list = videoManagerStorager.getStreamProxyListForEnable(true);
List<StreamProxy> list = getAllForEnable();
if (CollectionUtils.isEmpty(list)){
return;
}
for (StreamProxyItem streamProxyItem : list) {
for (StreamProxy streamProxyItem : list) {
MediaServerItem mediaServerItem = serverItemMap.get(streamProxyItem.getMediaServerId());
@ -575,4 +573,9 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
public void updateStreamGPS(List<GPSMsgInfo> gpsMsgInfoList) {
streamProxyMapper.updateStreamGPS(gpsMsgInfoList);
}
@Override
public List<StreamProxy> getAllForEnable() {
return streamProxyMapper.selectForEnable(true);
}
}

View File

@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.TypeReference;
import com.genersoft.iot.vmp.common.BatchLimit;
import com.genersoft.iot.vmp.common.CommonGbChannel;
import com.genersoft.iot.vmp.conf.MediaConfig;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
@ -67,10 +68,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
private ICommonGbChannelService commonGbChannelService;
@Autowired
private DataSourceTransactionManager dataSourceTransactionManager;
@Autowired
private TransactionDefinition transactionDefinition;
private MediaConfig mediaConfig;
@Autowired
private IGroupService groupService;

View File

@ -148,19 +148,6 @@ public interface DeviceChannelMapper {
@Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE device_id=#{deviceId} AND channel_id=#{channelId}"})
void startPlay(@Param("deviceId") String deviceId, @Param("channelId") String channelId, @Param("streamId") String streamId);
@Select(value = {" <script>" +
"SELECT " +
" dc.*,\n" +
" pgc.platform_id as platform_id,\n" +
" pgc.catalog_id as catalog_id " +
" FROM wvp_device_channel dc " +
" LEFT JOIN wvp_platform_gb_channel pgc on pgc.device_channel_id = dc.id " +
" WHERE pgc.platform_id = #{platformId} " +
" ORDER BY dc.device_id, dc.channel_id ASC" +
" </script>"})
List<DeviceChannelInPlatform> queryChannelByPlatformId(String platformId);
@Select("SELECT * FROM wvp_device_channel WHERE channel_id=#{channelId}")
List<DeviceChannel> queryChannelByChannelId( String channelId);
@ -331,53 +318,10 @@ public interface DeviceChannelMapper {
" </script>"})
void updatePosition(DeviceChannel deviceChannel);
@Select("SELECT * FROM wvp_device_channel WHERE length(trim(stream_id)) > 0")
List<DeviceChannel> getAllChannelInPlay();
@Select("select * from wvp_device_channel where longitude*latitude > 0 and device_id = #{deviceId}")
List<DeviceChannel> getAllChannelWithCoordinate(String deviceId);
@Select(value = {" <script>" +
"select * " +
"from wvp_device_channel " +
"where device_id=#{deviceId}" +
" <if test='parentId != null and length != null' > and parent_id= #{parentId} or left(channel_id, LENGTH(#{parentId})) = #{parentId} and length(channel_id)=#{length} </if>" +
" <if test='parentId == null and length != null' > and parent_id= #{parentId} or length(channel_id)=#{length} </if>" +
" <if test='parentId == null and length == null' > and parent_id= #{parentId} </if>" +
" <if test='parentId != null and length == null' > and parent_id= #{parentId} or left(channel_id, LENGTH(#{parentId})) = #{parentId} </if>" +
" </script>"})
List<DeviceChannel> getChannelsWithCivilCodeAndLength(@Param("deviceId") String deviceId, @Param("parentId") String parentId, @Param("length") Integer length);
@Select(value = {" <script>" +
"select * " +
"from wvp_device_channel " +
"where device_id=#{deviceId} and length(channel_id)>14 and civil_code=#{parentId}" +
" </script>"})
List<DeviceChannel> getChannelsByCivilCode(@Param("deviceId") String deviceId, @Param("parentId") String parentId);
@Select("select min(length(channel_id)) as minLength " +
"from wvp_device_channel " +
"where device_id=#{deviceId}")
Integer getChannelMinLength(String deviceId);
@Select("select * from wvp_device_channel where device_id=#{deviceId} and civil_code not in " +
"(select civil_code from wvp_device_channel where device_id=#{deviceId} group by civil_code)")
List<DeviceChannel> getChannelWithoutCivilCode(String deviceId);
@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, " +
" 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 " +
" 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" +
" where pgc.platform_id=#{serverGBId}")
List<DeviceChannel> queryChannelWithCatalog(String serverGBId);
@Select("select * from wvp_device_channel where device_id = #{deviceId}")
List<DeviceChannel> queryAllChannels(String deviceId);
@ -445,13 +389,6 @@ public interface DeviceChannelMapper {
" </script>"})
List<DeviceChannel> getSubChannelsByDeviceId(@Param("deviceId") String deviceId, @Param("parentId") String parentId, @Param("onlyCatalog") boolean onlyCatalog);
@Update(" update wvp_device_channel wdc " +
" set " +
" common_gb_channel_id=" +
" (select wcgc.common_gb_id from wvp_common_channel wcgc where wdc.channel_id = wcgc.common_gb_device_id) " +
" where wdc.device_id = #{deviceId}")
int updateCommonChannelId(@Param("deviceId") String deviceId);
@Select(value = {" <script>" +
"select * " +
"from wvp_device_channel " +

View File

@ -44,7 +44,6 @@ public interface DeviceMapper {
"on_line," +
"media_server_id," +
"switch_primary_sub_stream," +
"auto_sync_channel," +
"(SELECT count(0) FROM wvp_device_channel WHERE device_id=wvp_device.device_id) as channel_count "+
" FROM wvp_device WHERE device_id = #{deviceId}")
Device getDeviceByDeviceId(String deviceId);
@ -75,7 +74,6 @@ public interface DeviceMapper {
"subscribe_cycle_for_alarm,"+
"ssrc_check,"+
"as_message_channel,"+
"auto_sync_channel,"+
"geo_coord_sys,"+
"on_line"+
") VALUES (" +
@ -104,7 +102,6 @@ public interface DeviceMapper {
"#{subscribeCycleForAlarm}," +
"#{ssrcCheck}," +
"#{asMessageChannel}," +
"#{autoSyncChannel}," +
"#{geoCoordSys}," +
"#{onLine}" +
")")
@ -163,7 +160,6 @@ public interface DeviceMapper {
"on_line,"+
"media_server_id,"+
"switch_primary_sub_stream switchPrimarySubStream,"+
"auto_sync_channel,"+
"(SELECT count(0) FROM wvp_device_channel WHERE device_id=de.device_id) as channel_count " +
"FROM wvp_device de" +
"<if test=\"onLine != null\"> where on_line=${onLine}</if>"+
@ -201,7 +197,6 @@ public interface DeviceMapper {
"subscribe_cycle_for_alarm,"+
"ssrc_check,"+
"as_message_channel,"+
"auto_sync_channel,"+
"geo_coord_sys,"+
"on_line"+
" FROM wvp_device WHERE on_line = true")
@ -232,7 +227,6 @@ public interface DeviceMapper {
"subscribe_cycle_for_alarm,"+
"ssrc_check,"+
"as_message_channel,"+
"auto_sync_channel,"+
"geo_coord_sys,"+
"on_line"+
" FROM wvp_device WHERE ip = #{host} AND port=#{port}")
@ -256,7 +250,6 @@ public interface DeviceMapper {
"<if test=\"asMessageChannel != null\">, as_message_channel=#{asMessageChannel}</if>" +
"<if test=\"geoCoordSys != null\">, geo_coord_sys=#{geoCoordSys}</if>" +
"<if test=\"switchPrimarySubStream != null\">, switch_primary_sub_stream=#{switchPrimarySubStream}</if>" +
"<if test=\"autoSyncChannel != null\">, auto_sync_channel=#{autoSyncChannel}</if>" +
"<if test=\"mediaServerId != null\">, media_server_id=#{mediaServerId}</if>" +
"WHERE device_id=#{deviceId}"+
" </script>"})
@ -272,7 +265,6 @@ public interface DeviceMapper {
"charset,"+
"ssrc_check,"+
"as_message_channel,"+
"auto_sync_channel,"+
"geo_coord_sys,"+
"on_line,"+
"media_server_id,"+
@ -287,7 +279,6 @@ public interface DeviceMapper {
"#{charset}," +
"#{ssrcCheck}," +
"#{asMessageChannel}," +
"#{autoSyncChannel}," +
"#{geoCoordSys}," +
"#{onLine}," +
"#{mediaServerId}," +

View File

@ -62,18 +62,16 @@ public interface ParentPlatformMapper {
@Delete("DELETE FROM wvp_platform WHERE server_gb_id=#{serverGBId}")
int delParentPlatform(ParentPlatform parentPlatform);
@Select("SELECT *, ((SELECT count(0)\n" +
" FROM wvp_platform_gb_channel pc\n" +
" WHERE pc.platform_id = pp.server_gb_id)\n" +
" +\n" +
" (SELECT count(0)\n" +
" FROM wvp_platform_gb_stream pgs\n" +
" WHERE pgs.platform_id = pp.server_gb_id)\n" +
" +\n" +
" (SELECT count(0)\n" +
" FROM wvp_platform_catalog pgc\n" +
" WHERE pgc.platform_id = pp.server_gb_id)) as channel_count\n" +
"FROM wvp_platform pp ")
@Select("<script>" +
"SELECT * " +
"<if test='shareAllChannel == false'> " +
"(SELECT count(0) as channel_count FROM wvp_common_channel_platform wccp WHERE wccp.platform_id = pp.id) " +
"</if>" +
"<if test='shareAllChannel == true'> " +
"(SELECT count(0) as channel_count FROM wvp_common_channel ) " +
"</if>" +
"FROM wvp_platform pp " +
"</script>")
List<ParentPlatform> getParentPlatformList();
@Select("SELECT * FROM wvp_platform WHERE enable=#{enable} ")
@ -88,37 +86,33 @@ public interface ParentPlatformMapper {
@Select("SELECT * FROM wvp_platform WHERE id=#{id}")
ParentPlatform getParentPlatById(int id);
@Update("UPDATE wvp_platform SET status=false" )
int outlineForAllParentPlatform();
@Update("UPDATE wvp_platform SET status=#{online} WHERE server_gb_id=#{platformGbID}" )
int updateParentPlatformStatus(@Param("platformGbID") String platformGbID, @Param("online") boolean online);
@Update(value = {" <script>" +
"UPDATE wvp_platform " +
"SET catalog_id=#{catalogId}, update_time=#{updateTime}" +
"WHERE server_gb_id=#{platformId}"+
"</script>"})
int setDefaultCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId, @Param("updateTime") String updateTime);
@Select("select 'channel' as name, count(pgc.platform_id) count from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id where pgc.platform_id=#{platform_id} and dc.channel_id =#{gbId} " +
"union " +
"select 'stream' as name, count(pgs.platform_id) count from wvp_platform_gb_stream pgs left join wvp_gb_stream gs on pgs.gb_stream_id = gs.gb_stream_id where pgs.platform_id=#{platform_id} and gs.gb_id =#{gbId}")
List<ChannelSourceInfo> getChannelSource(@Param("platform_id") String platform_id, @Param("gbId") String gbId);
@Select("SELECT * FROM wvp_platform WHERE share_all_channel=true")
List<ParentPlatform> queryAllWithShareAll();
@Select("<script>" +
"select wp.*" +
"from wvp_platform wp\n" +
"select wp.* " +
" from wvp_platform wp\n" +
" left join wvp_common_channel_platform wccp on wp.id = wccp.platform_id\n" +
"where wp.share_all_channel = true " +
"or (wccp.common_gb_channel_id in " +
"<foreach collection='channelList' item='item' open='(' separator=',' close=')' >#{item.commonGbId}</foreach>" +
"and wccp.platform_id in " +
"<foreach collection='platformIdList' item='item' open='(' separator=',' close=')' >#{item}</foreach>" +
" where wp.share_all_channel = true " +
"<if test='(channelList != null and channelList.size != 0) and (platformIdList != null and platformIdList.size != 0) '> " +
" or (wccp.common_gb_channel_id in " +
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' >#{item.commonGbId}</foreach>" +
" and wccp.platform_id in " +
" <foreach collection='platformIdList' item='item' open='(' separator=',' close=')' >#{item}</foreach>)" +
"</if>" +
"<if test='(channelList != null and channelList.size != 0) and (platformIdList == null or platformIdList.size == 0) '> " +
" or wccp.common_gb_channel_id in " +
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' >#{item.commonGbId}</foreach>" +
"</if>" +
"<if test='(channelList == null or channelList.size == 0) and (platformIdList != null and platformIdList.size != 0) '> " +
" or wccp.platform_id in " +
" <foreach collection='platformIdList' item='item' open='(' separator=',' close=')' >#{item}</foreach>" +
"</if>" +
"</script>")
List<ParentPlatform> querySharePlatform(@Param("channelList") List<CommonGbChannel> channelList,
@Param("platformIdList") List<Integer> platformIdList);

View File

@ -13,11 +13,12 @@ import java.util.List;
public interface StreamProxyMapper {
@Insert("INSERT INTO wvp_stream_proxy (type, name, app, stream,media_server_id, url, src_url, dst_url, " +
"timeout_ms, ffmpeg_cmd_key, rtp_type, enable_audio, enable_mp4, enable, status, stream_key, enable_remove_none_reader, enable_disable_none_reader, create_time) VALUES" +
"timeout_ms, ffmpeg_cmd_key, rtp_type, enable_audio, enable_mp4, enable, status, stream_key, " +
"enable_remove_none_reader, enable_disable_none_reader, create_time) VALUES " +
"(#{type}, #{name}, #{app}, #{stream}, #{mediaServerId}, #{url}, #{srcUrl}, #{dstUrl}, " +
"#{timeoutMs}, #{ffmpegCmdKey}, #{rtpType}, #{enableAudio}, #{enableMp4}, #{enable}, #{status}, #{streamKey}, " +
"#{enableRemoveNoneReader}, #{enableDisableNoneReader}, #{createTime} )")
int add(StreamProxy streamProxyDto);
int add(StreamProxy streamProxy);
@Update("UPDATE wvp_stream_proxy " +
"SET type=#{type}, " +
@ -44,22 +45,20 @@ public interface StreamProxyMapper {
@Delete("DELETE FROM wvp_stream_proxy WHERE app=#{app} AND stream=#{stream}")
int del(String app, String stream);
@Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream order by st.create_time desc")
@Select("SELECT st.* FROM wvp_stream_proxy st order by st.create_time desc")
List<StreamProxy> selectAll();
@Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude, 'proxy' as streamType FROM wvp_stream_proxy st LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.enable=#{enable} order by st.create_time desc")
@Select("SELECT st.* FROM wvp_stream_proxy st WHERE st.enable=#{enable} order by st.create_time desc")
List<StreamProxy> selectForEnable(boolean enable);
@Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.app=#{app} AND st.stream=#{stream} order by st.create_time desc")
@Select("SELECT st.* from wvp_stream_proxy st WHERE st.app=#{app} AND st.stream=#{stream} order by st.create_time desc")
StreamProxy selectOne(@Param("app") String app, @Param("stream") String stream);
@Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st " +
"LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " +
@Select("SELECT st.* FROM wvp_stream_proxy st " +
"WHERE st.enable=#{enable} and st.media_server_id= #{id} order by st.create_time desc")
List<StreamProxy> selectForEnableInMediaServer(@Param("id") String id, @Param("enable") boolean enable);
@Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st " +
"LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " +
@Select("SELECT st.* FROM wvp_stream_proxy st " +
"WHERE st.media_server_id= #{id} order by st.create_time desc")
List<StreamProxy> selectInMediaServer(String id);
@ -76,7 +75,7 @@ public interface StreamProxyMapper {
@Delete("DELETE FROM wvp_stream_proxy WHERE enable_remove_none_reader=true AND media_server_id=#{mediaServerId}")
void deleteAutoRemoveItemByMediaServerId(String mediaServerId);
@Select("SELECT st.*, pgs.gb_id, pgs.name, pgs.longitude, pgs.latitude FROM wvp_stream_proxy st LEFT join wvp_gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream WHERE st.enable_remove_none_reader=true AND st.media_server_id=#{mediaServerId} order by st.create_time desc")
@Select("SELECT st.* FROM wvp_stream_proxy st WHERE st.enable_remove_none_reader=true AND st.media_server_id=#{mediaServerId} order by st.create_time desc")
List<StreamProxy> selectAutoRemoveItemByMediaServerId(String mediaServerId);
@Select("select count(1) as total, sum(status) as online from wvp_stream_proxy")

View File

@ -14,9 +14,9 @@ import java.util.Map;
@Repository
public interface StreamPushMapper {
@Insert("INSERT INTO wvp_stream_push (app, stream, total_reader_count, origin_type, origin_type_str, " +
@Insert("INSERT INTO wvp_stream_push (app, stream, total_reader_count, " +
"push_time, alive_second, media_server_id, update_time, create_time, push_ing, self) VALUES" +
"(#{app}, #{stream}, #{totalReaderCount}, #{originType}, #{originTypeStr}, " +
"(#{app}, #{stream}, #{totalReaderCount}, " +
"#{pushTime}, #{aliveSecond}, #{mediaServerId} , #{updateTime} , #{createTime}, " +
"#{pushIng}, #{self} )")
int add(StreamPush streamPushItem);
@ -27,8 +27,6 @@ public interface StreamPushMapper {
"SET update_time=#{updateTime}" +
"<if test=\"mediaServerId != null\">, media_server_id=#{mediaServerId}</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>" +
"<if test=\"pushTime != null\">, push_time=#{pushTime}</if>" +
"<if test=\"aliveSecond != null\">, alive_second=#{aliveSecond}</if>" +
"<if test=\"pushIng != null\">, push_ing=#{pushIng}</if>" +
@ -41,9 +39,9 @@ public interface StreamPushMapper {
int del(String app, String stream);
@Delete("<script> "+
"DELETE sp FROM wvp_stream_push sp left join wvp_gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream where " +
"DELETE sp FROM wvp_stream_push sp where " +
"<foreach collection='streamPushItems' item='item' separator='or'>" +
"(sp.app=#{item.app} and sp.stream=#{item.stream} and gs.gb_id is null) " +
"(sp.app=#{item.app} and sp.stream=#{item.stream} and sp.gb_id is null) " +
"</foreach>" +
"</script>")
int delAllWithoutGBId(List<StreamPush> streamPushItems);
@ -67,34 +65,31 @@ public interface StreamPushMapper {
@Select(value = {" <script>" +
"SELECT " +
"st.*, " +
"gs.gb_id, gs.name, gs.longitude, gs.latitude, gs.gb_stream_id " +
"* " +
"from " +
"wvp_stream_push st " +
"LEFT join wvp_gb_stream gs " +
"on st.app = gs.app AND st.stream = gs.stream " +
"wvp_stream_push " +
"WHERE " +
"1=1 " +
" <if test='query != null'> AND (st.app LIKE concat('%',#{query},'%') OR st.stream LIKE concat('%',#{query},'%') OR gs.gb_id LIKE concat('%',#{query},'%') OR gs.name LIKE concat('%',#{query},'%'))</if> " +
" <if test='pushing == true' > AND (gs.gb_id is null OR st.push_ing=1)</if>" +
" <if test='pushing == false' > AND (st.push_ing is null OR st.push_ing=0) </if>" +
" <if test='mediaServerId != null' > AND st.media_server_id=#{mediaServerId} </if>" +
"order by st.create_time desc" +
" <if test='query != null'> AND (app LIKE concat('%',#{query},'%') OR stream LIKE concat('%',#{query},'%') OR gb_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
" <if test='pushing == true' > AND (gb_id is null OR push_ing=1)</if>" +
" <if test='pushing == false' > AND (push_ing is null OR push_ing=0) </if>" +
" <if test='mediaServerId != null' > AND media_server_id=#{mediaServerId} </if>" +
"order by create_time desc" +
" </script>"})
List<StreamPush> selectAllForList(@Param("query") String query, @Param("pushing") Boolean pushing, @Param("mediaServerId") String mediaServerId);
@Select("SELECT st.*, gs.gb_id, gs.name, gs.longitude, gs.latitude FROM wvp_stream_push st LEFT join wvp_gb_stream gs on st.app = gs.app AND st.stream = gs.stream order by st.create_time desc")
@Select("SELECT * from wvp_stream_push order by create_time desc")
List<StreamPush> selectAll();
@Select("SELECT st.*, gs.gb_id, gs.name, gs.longitude, gs.latitude FROM wvp_stream_push st LEFT join wvp_gb_stream gs on st.app = gs.app AND st.stream = gs.stream WHERE st.app=#{app} AND st.stream=#{stream}")
@Select("SELECT * from wvp_stream_push WHERE app=#{app} AND stream=#{stream}")
StreamPush selectOne(@Param("app") String app, @Param("stream") String stream);
@Insert("<script>" +
"Insert INTO wvp_stream_push (app, stream, total_reader_count, origin_type, origin_type_str, " +
"Insert INTO wvp_stream_push (app, stream, total_reader_count, " +
"create_time, alive_second, media_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.app}, #{item.stream}, #{item.totalReaderCount}, " +
"#{item.createTime}, #{item.aliveSecond}, #{item.mediaServerId}, #{item.status} ," +
" #{item.pushIng} )" +
" </foreach>" +
"</script>")
@ -114,7 +109,7 @@ public interface StreamPushMapper {
@Select("SELECT * FROM wvp_stream_push WHERE media_server_id=#{mediaServerId}")
List<StreamPush> selectAllByMediaServerId(String mediaServerId);
@Select("SELECT sp.* FROM wvp_stream_push sp left join wvp_gb_stream gs on gs.app = sp.app and gs.stream= sp.stream WHERE sp.media_server_id=#{mediaServerId} and gs.gb_id is null")
@Select("SELECT sp.* FROM wvp_stream_push sp WHERE sp.media_server_id=#{mediaServerId} and sp.gb_id is null")
List<StreamPush> selectAllByMediaServerIdWithOutGbID(String mediaServerId);
@Update("UPDATE wvp_stream_push " +
@ -132,16 +127,6 @@ public interface StreamPushMapper {
"WHERE media_server_id=#{mediaServerId}")
void updateStatusByMediaServerId(@Param("mediaServerId") String mediaServerId, @Param("status") boolean status);
@Select("<script> "+
"SELECT gs.* FROM wvp_stream_push sp left join wvp_gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream " +
"where sp.status = true 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 wvp_stream_push SET status=0 where id in (" +
"<foreach collection='offlineStreams' item='item' separator=','>" +
@ -150,15 +135,6 @@ public interface StreamPushMapper {
")</script>")
void offline(List<StreamPush> offlineStreams);
@Select("<script> "+
"SELECT * FROM wvp_stream_push sp left join wvp_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='onlineStreams' item='item' separator=','>" +
"(#{item.app}, #{item.stream}) " +
"</foreach>" +
") </script>")
List<GbStream> getOfflinePusherForGbInList(List<StreamPushItemFromRedis> onlineStreams);
@Update("<script> "+
"UPDATE wvp_stream_push SET status=1 where (app, stream) in (" +
"<foreach collection='onlineStreams' item='item' separator=','>" +
@ -174,7 +150,7 @@ public interface StreamPushMapper {
void setAllStreamOffline();
@MapKey("key")
@Select("SELECT CONCAT(wgs.app,wgs.stream) as keyId, wgs.* from wvp_gb_stream as wgs")
@Select("SELECT CONCAT(wsp.app,wsp.stream) as keyId, wsp.* from wvp_stream_push as wsp ")
Map<String, StreamPush> getAllAppAndStream();
@Select("select count(1) from wvp_stream_push ")

View File

@ -58,23 +58,9 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
@Autowired
private ParentPlatformMapper platformMapper;
@Autowired
private IRedisCatchStorage redisCatchStorage;
@Autowired
private PlatformChannelMapper platformChannelMapper;
@Autowired
private PlatformCatalogMapper platformCatalogMapper;
@Autowired
private StreamProxyMapper streamProxyMapper;
@Autowired
private StreamPushMapper streamPushMapper;
@Autowired
private UserSetting userSetting;
/**
* ID