diff --git a/sql/common.sql b/sql/common.sql index 8b58841f..474aa1d0 100644 --- a/sql/common.sql +++ b/sql/common.sql @@ -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; + diff --git a/sql/初始化.sql b/sql/初始化.sql index 608d5d0d..128deaf0 100644 --- a/sql/初始化.sql +++ b/sql/初始化.sql @@ -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) -); /*初始数据*/ diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Gb28181Sdp.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Gb28181Sdp.java index c336462f..e4bca7f2 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Gb28181Sdp.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Gb28181Sdp.java @@ -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 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java index 4a781f31..6e594024 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java @@ -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; diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxy.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxy.java index 3a438998..8124aae8 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxy.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamProxy.java @@ -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; + } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java b/src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java index ce0d1792..b656931f 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java +++ b/src/main/java/com/genersoft/iot/vmp/service/IStreamProxyService.java @@ -118,4 +118,10 @@ public interface IStreamProxyService { * 更新redis发来的gps更新消息 */ void updateStreamGPS(List gpsMsgInfoList); + + /** + * 获取所有启用的拉流代理 + */ + List getAllForEnable(); + } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java index c16405e7..1c938523 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java @@ -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); diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java index f6be2db1..67024703 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java @@ -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 serverItemMap = all.stream().collect(Collectors.toMap(MediaServerItem::getId, Function.identity(), (m1, m2) -> m1)); - List list = videoManagerStorager.getStreamProxyListForEnable(true); + List 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 gpsMsgInfoList) { streamProxyMapper.updateStreamGPS(gpsMsgInfoList); } + + @Override + public List getAllForEnable() { + return streamProxyMapper.selectForEnable(true); + } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java index 87f518b1..7ea38d5f 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java @@ -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; diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java index 2dac39da..78004776 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java @@ -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 = {" "}) - List queryChannelByPlatformId(String platformId); - - @Select("SELECT * FROM wvp_device_channel WHERE channel_id=#{channelId}") List queryChannelByChannelId( String channelId); @@ -331,53 +318,10 @@ public interface DeviceChannelMapper { " "}) void updatePosition(DeviceChannel deviceChannel); - @Select("SELECT * FROM wvp_device_channel WHERE length(trim(stream_id)) > 0") - List getAllChannelInPlay(); - @Select("select * from wvp_device_channel where longitude*latitude > 0 and device_id = #{deviceId}") List getAllChannelWithCoordinate(String deviceId); - @Select(value = {" "}) - List getChannelsWithCivilCodeAndLength(@Param("deviceId") String deviceId, @Param("parentId") String parentId, @Param("length") Integer length); - - @Select(value = {" "}) - List 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 getChannelWithoutCivilCode(String deviceId); - - @Select("select * from wvp_device_channel where device_id=#{deviceId} and SUBSTRING(channel_id, 11, 3)=#{typeCode}") - List 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 queryChannelWithCatalog(String serverGBId); - @Select("select * from wvp_device_channel where device_id = #{deviceId}") List queryAllChannels(String deviceId); @@ -445,13 +389,6 @@ public interface DeviceChannelMapper { " "}) List 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 = {" "}) @@ -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}," + diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java index b9ad4e70..e601cc30 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java @@ -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("") List 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 = {" "}) - 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 getChannelSource(@Param("platform_id") String platform_id, @Param("gbId") String gbId); @Select("SELECT * FROM wvp_platform WHERE share_all_channel=true") List queryAllWithShareAll(); @Select("") List querySharePlatform(@Param("channelList") List channelList, @Param("platformIdList") List platformIdList); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java index 91f05ce8..eee3bfb9 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java @@ -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 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 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 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 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 selectAutoRemoveItemByMediaServerId(String mediaServerId); @Select("select count(1) as total, sum(status) as online from wvp_stream_proxy") diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java index 97afb591..a9dbe79e 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java @@ -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}" + ", media_server_id=#{mediaServerId}" + ", total_reader_count=#{totalReaderCount}" + - ", origin_type=#{originType}" + - ", origin_type_str=#{originTypeStr}" + ", push_time=#{pushTime}" + ", alive_second=#{aliveSecond}" + ", push_ing=#{pushIng}" + @@ -41,9 +39,9 @@ public interface StreamPushMapper { int del(String app, String stream); @Delete("") int delAllWithoutGBId(List streamPushItems); @@ -67,34 +65,31 @@ public interface StreamPushMapper { @Select(value = {" "}) List 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 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("") @@ -114,7 +109,7 @@ public interface StreamPushMapper { @Select("SELECT * FROM wvp_stream_push WHERE media_server_id=#{mediaServerId}") List 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 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("") - List getOnlinePusherForGbInList(List offlineStreams); - @Update("") void offline(List offlineStreams); - @Select("") - List getOfflinePusherForGbInList(List onlineStreams); - @Update("