Merge branch 'master' into dev/数据库统合

# Conflicts:
#	src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java
#	src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelPlayServiceImpl.java
#	src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformChannelServiceImpl.java
master
648540858 2024-12-27 10:57:42 +08:00
commit e05d988755
47 changed files with 473 additions and 392 deletions

View File

@ -0,0 +1,24 @@
package com.genersoft.iot.vmp.common.enums;
import lombok.Getter;
/**
*
*/
public enum ChannelDataType {
GB28181(1,"国标28181"),
STREAM_PUSH(2,"推流设备"),
STREAM_PROXY(3,"拉流代理");
public final int value;
public final String desc;
ChannelDataType(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
}

View File

@ -123,17 +123,14 @@ public class CommonGBChannel {
@Schema(description = "国标-时域编码能力,取值0-不支持;1-1级增强;2-2级增强;3-3级增强(可选)")
private Integer gbSvcTimeSupportMode;
@Schema(description = "关联的国标设备数据库ID")
private Integer gbDeviceDbId;
@Schema(description = "二进制保存的录制计划, 每一位表示每个小时的前半个小时")
private Long recordPLan;
@Schema(description = "关联的推流Id流来源是推流时有效")
private Integer streamPushId;
@Schema(description = "关联的数据类型")
private Integer dataType;
@Schema(description = "关联的拉流代理Id流来源是拉流代理时有效")
private Integer streamProxyId;
@Schema(description = "关联的设备ID")
private Integer dataDeviceId;
@Schema(description = "创建时间")
private String createTime;

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.bean;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.gb28181.utils.MessageElementForCatalog;
import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
import io.swagger.v3.oas.annotations.media.Schema;
@ -20,9 +21,6 @@ public class DeviceChannel extends CommonGBChannel {
@Schema(description = "数据库自增ID")
private int id;
@Schema(description = "设备的数据库自增ID")
private Integer deviceDbId;
@MessageElementForCatalog("DeviceID")
@Schema(description = "编码")
private String deviceId;
@ -191,6 +189,8 @@ public class DeviceChannel extends CommonGBChannel {
@Schema(description = "通道类型, 默认0, 0 普通通道1 行政区划 2 业务分组/虚拟组织")
private int channelType;
private Integer dataType = ChannelDataType.GB28181.value;
public void setPtzType(int ptzType) {
this.ptzType = ptzType;
switch (ptzType) {

View File

@ -241,7 +241,7 @@ public class DeviceQuery {
return deviceChannelPageResult;
}
return deviceChannelService.getSubChannels(deviceChannel.getDeviceDbId(), channelId, query, channelType, online, page, count);
return deviceChannelService.getSubChannels(deviceChannel.getDataDeviceId(), channelId, query, channelType, online, page, count);
}
@Operation(summary = "开启/关闭通道的音频", security = @SecurityRequirement(name = JwtUtils.HEADER))

View File

@ -20,8 +20,8 @@ public interface CommonGBChannelMapper {
@Insert(" <script>" +
"INSERT INTO wvp_device_channel (" +
"gb_device_id," +
" <if test='streamProxyId != null' > stream_proxy_id,</if>" +
" <if test='streamPushId != null' > stream_push_id,</if>" +
"data_type," +
"data_device_id," +
"create_time," +
"update_time," +
"gb_name," +
@ -59,8 +59,8 @@ public interface CommonGBChannelMapper {
"gb_svc_time_support_mode ) " +
"VALUES (" +
"#{gbDeviceId}, " +
" <if test='streamProxyId != null' > #{streamProxyId},</if>" +
" <if test='streamPushId != null' > #{streamPushId},</if>" +
"#{dataType}, " +
"#{dataDeviceId}, " +
"#{createTime}, " +
"#{updateTime}, " +
"#{gbName}, " +
@ -168,8 +168,8 @@ public interface CommonGBChannelMapper {
@Insert(" <script>" +
"INSERT INTO wvp_device_channel (" +
"gb_device_id," +
"stream_proxy_id, " +
"stream_push_id," +
"data_type, " +
"data_device_id," +
"create_time," +
"update_time," +
"gb_name," +
@ -207,7 +207,7 @@ public interface CommonGBChannelMapper {
"gb_svc_time_support_mode ) " +
"VALUES" +
"<foreach collection='commonGBChannels' index='index' item='item' separator=','> " +
"(#{item.gbDeviceId}, #{item.streamProxyId}, #{item.streamPushId},#{item.createTime},#{item.updateTime}," +
"(#{item.gbDeviceId}, #{item.dataType}, #{item.dataDeviceId},#{item.createTime},#{item.updateTime}," +
"#{item.gbName},#{item.gbManufacturer}, #{item.gbModel}," +
"#{item.gbOwner},#{item.gbCivilCode},#{item.gbBlock}, #{item.gbAddress}, #{item.gbParental}, #{item.gbParentId},#{item.gbSafetyWay}, " +
"#{item.gbRegisterWay},#{item.gbCertNum},#{item.gbCertifiable},#{item.gbErrCode},#{item.gbEndTime}, #{item.gbSecrecy},#{item.gbIpAddress}," +
@ -235,9 +235,9 @@ public interface CommonGBChannelMapper {
" gb_ptz_type = null, gb_position_type = null, gb_room_type = null, gb_use_type = null, gb_supply_light_type = null, " +
" gb_direction_type = null, gb_resolution = null, gb_business_group_id = null, gb_download_speed = null, gb_svc_space_support_mod = null, " +
" gb_svc_time_support_mode = null" +
" WHERE id = #{id} and device_db_id = #{gbDeviceDbId}"+
" WHERE id = #{id} and data_type = #{dataType} and data_device_id = #{dataDeviceId}"+
" </script>"})
void reset(@Param("id") int id, @Param("gbDeviceDbId") int gbDeviceDbId, @Param("updateTime") String updateTime);
void reset(@Param("id") int id, @Param("dataType") Integer dataType, @Param("dataDeviceId") int dataDeviceId, @Param("updateTime") String updateTime);
@SelectProvider(type = ChannelProvider.class, method = "queryByIds")
@ -250,21 +250,15 @@ public interface CommonGBChannelMapper {
"</script>"})
void batchDelete(List<CommonGBChannel> channelListInDb);
@SelectProvider(type = ChannelProvider.class, method = "queryByStreamPushId")
CommonGBChannel queryByStreamPushId(@Param("streamPushId") Integer streamPushId);
@SelectProvider(type = ChannelProvider.class, method = "queryByStreamProxyId")
CommonGBChannel queryByStreamProxyId(@Param("streamProxyId") Integer streamProxyId);
@SelectProvider(type = ChannelProvider.class, method = "queryListByCivilCode")
List<CommonGBChannel> queryListByCivilCode(@Param("query") String query, @Param("online") Boolean online,
@Param("channelType") Integer channelType, @Param("civilCode") String civilCode);
@Param("dataType") Integer dataType, @Param("civilCode") String civilCode);
@SelectProvider(type = ChannelProvider.class, method = "queryListByParentId")
List<CommonGBChannel> queryListByParentId(@Param("query") String query, @Param("online") Boolean online,
@Param("channelType") Integer channelType, @Param("groupDeviceId") String groupDeviceId);
@Param("dataType") Integer dataType, @Param("groupDeviceId") String groupDeviceId);
@ -317,14 +311,14 @@ public interface CommonGBChannelMapper {
List<CommonGBChannel> queryByCivilCode(@Param("civilCode") String civilCode);
@SelectProvider(type = ChannelProvider.class, method = "queryByGbDeviceIds")
List<CommonGBChannel> queryByGbDeviceIds(List<Integer> deviceIds);
List<CommonGBChannel> queryByGbDeviceIds(@Param("dataType") Integer dataType, List<Integer> deviceIds);
@Select(value = {" <script>" +
" select id from wvp_device_channel " +
" where channel_type = 0 and device_db_id in "+
" where channel_type = 0 and data_type = #{dataType} and data_device_id in "+
" <foreach collection='deviceIds' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
" </script>"})
List<Integer> queryByGbDeviceIdsForIds(List<Integer> deviceIds);
List<Integer> queryByGbDeviceIdsForIds(@Param("dataType") Integer dataType, List<Integer> deviceIds);
@SelectProvider(type = ChannelProvider.class, method = "queryByGroupList")
List<CommonGBChannel> queryByGroupList(List<Group> groupList);
@ -446,19 +440,20 @@ public interface CommonGBChannelMapper {
int updateCivilCodeByChannelList(@Param("civilCode") String civilCode, List<CommonGBChannel> channelList);
@SelectProvider(type = ChannelProvider.class, method = "queryListByStreamPushList")
List<CommonGBChannel> queryListByStreamPushList(List<StreamPush> streamPushList);
List<CommonGBChannel> queryListByStreamPushList(@Param("dataType") Integer dataType, List<StreamPush> streamPushList);
@Update(value = {" <script>" +
" <foreach collection='channels' item='item' separator=';' >" +
" UPDATE wvp_device_channel " +
" SET gb_longitude=#{item.gbLongitude}, gb_latitude=#{item.gbLatitude} " +
" WHERE stream_push_id IS NOT NULL AND gb_device_id=#{item.gbDeviceId} "+
" WHERE data_type = #{dataType} AND gb_device_id=#{item.gbDeviceId} "+
"</foreach>"+
" </script>"})
void updateGpsByDeviceIdForStreamPush(List<CommonGBChannel> channels);
void updateGpsByDeviceIdForStreamPush(@Param("dataType") Integer dataType, List<CommonGBChannel> channels);
@SelectProvider(type = ChannelProvider.class, method = "queryList")
List<CommonGBChannel> queryList(@Param("query") String query, @Param("online") Boolean online, @Param("hasRecordPlan") Boolean hasRecordPlan, @Param("channelType") Integer channelType);
List<CommonGBChannel> queryList(@Param("query") String query, @Param("online") Boolean online,
@Param("hasRecordPlan") Boolean hasRecordPlan, @Param("dataType") Integer dataType);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
@ -493,9 +488,8 @@ public interface CommonGBChannelMapper {
@Select("<script>" +
" select " +
" wdc.id as gb_id,\n" +
" wdc.device_db_id as gb_device_db_id,\n" +
" wdc.stream_push_id,\n" +
" wdc.stream_proxy_id,\n" +
" wdc.data_type,\n" +
" wdc.data_device_id,\n" +
" wdc.create_time,\n" +
" wdc.update_time,\n" +
" wdc.record_plan_id,\n" +
@ -542,12 +536,12 @@ public interface CommonGBChannelMapper {
" <if test='online == false'> AND coalesce(wdc.gb_status, wdc.status) = 'OFF'</if> " +
" <if test='hasLink == true'> AND wdc.record_plan_id = #{planId}</if> " +
" <if test='hasLink == false'> AND wdc.record_plan_id is null</if> " +
" <if test='channelType == 0'> AND wdc.device_db_id is not null</if> " +
" <if test='channelType == 1'> AND wdc.stream_push_id is not null</if> " +
" <if test='channelType == 2'> AND wdc.stream_proxy_id is not null</if> " +
" <if test='dataType != null'> AND wdc.data_type = #{dataType}</if> " +
"</script>")
List<CommonGBChannel> queryForRecordPlanForWebList(@Param("planId") Integer planId, @Param("query") String query,
@Param("channelType") Integer channelType, @Param("online") Boolean online,
@Param("dataType") Integer dataType, @Param("online") Boolean online,
@Param("hasLink") Boolean hasLink);
@SelectProvider(type = ChannelProvider.class, method = "queryByDataId")
CommonGBChannel queryByDataId(@Param("dataType") Integer dataType, @Param("dataDeviceId") Integer dataDeviceId);
}

View File

@ -21,13 +21,13 @@ public interface DeviceChannelMapper {
@Insert("<script> " +
"insert into wvp_device_channel " +
"(device_id, device_db_id, name, manufacturer, model, owner, civil_code, block, " +
"(device_id, data_type, data_device_id, name, manufacturer, model, owner, civil_code, block, " +
"address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, end_time, secrecy, " +
"ip_address, port, password, status, longitude, latitude, ptz_type, position_type, room_type, use_type, " +
"supply_light_type, direction_type, resolution, business_group_id, download_speed, svc_space_support_mod, " +
"svc_time_support_mode, create_time, update_time, sub_count, stream_id, has_audio, gps_time, stream_identification, channel_type) " +
"values " +
"(#{deviceId}, #{deviceDbId}, #{name}, #{manufacturer}, #{model}, #{owner}, #{civilCode}, #{block}, " +
"(#{deviceId}, #{dataType}, #{dataDeviceId}, #{name}, #{manufacturer}, #{model}, #{owner}, #{civilCode}, #{block}, " +
"#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{endTime}, #{secrecy}, " +
"#{ipAddress}, #{port}, #{password}, #{status}, #{longitude}, #{latitude}, #{ptzType}, #{positionType}, #{roomType}, #{useType}, " +
"#{supplyLightType}, #{directionType}, #{resolution}, #{businessGroupId}, #{downloadSpeed}, #{svcSpaceSupportMod}," +
@ -40,7 +40,8 @@ public interface DeviceChannelMapper {
"UPDATE wvp_device_channel " +
"SET update_time=#{updateTime}" +
", device_id=#{deviceId}" +
", device_db_id=#{deviceDbId}" +
", data_type=#{dataType}" +
", data_device_id=#{dataDeviceId}" +
", name=#{name}" +
", manufacturer=#{manufacturer}" +
", model=#{model}" +
@ -85,22 +86,22 @@ public interface DeviceChannelMapper {
int update(DeviceChannel channel);
@SelectProvider(type = DeviceChannelProvider.class, method = "queryChannels")
List<DeviceChannel> queryChannels(@Param("deviceDbId") int deviceDbId, @Param("civilCode") String civilCode,
List<DeviceChannel> queryChannels(@Param("dataDeviceId") int dataDeviceId, @Param("civilCode") String civilCode,
@Param("businessGroupId") String businessGroupId, @Param("parentChannelId") String parentChannelId,
@Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel,
@Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
@SelectProvider(type = DeviceChannelProvider.class, method = "queryChannelsByDeviceDbId")
List<DeviceChannel> queryChannelsByDeviceDbId(@Param("deviceDbId") int deviceDbId);
List<DeviceChannel> queryChannelsByDeviceDbId(@Param("dataDeviceId") int dataDeviceId);
@Select(value = {" <script> " +
"select id from wvp_device_channel where device_db_id in " +
@Select("<script> " +
"select id from wvp_device_channel where data_type =1 and data_device_id in " +
" <foreach item='item' index='index' collection='deviceDbIds' open='(' separator=',' close=')'> #{item} </foreach>" +
" </script>"})
" </script>")
List<Integer> queryChaneIdListByDeviceDbIds(List<Integer> deviceDbIds);
@Delete("DELETE FROM wvp_device_channel WHERE device_db_id=#{deviceId}")
int cleanChannelsByDeviceId(@Param("deviceId") int deviceId);
@Delete("DELETE FROM wvp_device_channel WHERE data_type =1 and data_device_id=#{dataDeviceId}")
int cleanChannelsByDeviceId(@Param("dataDeviceId") int dataDeviceId);
@Delete("DELETE FROM wvp_device_channel WHERE id=#{id}")
int del(@Param("id") int id);
@ -141,8 +142,8 @@ public interface DeviceChannelMapper {
" coalesce(dc.gb_business_group_id, dc.business_group_id) as business_group_id " +
" from " +
" wvp_device_channel dc " +
" LEFT JOIN wvp_device de ON dc.device_db_id = de.id " +
" WHERE 1=1" +
" LEFT JOIN wvp_device de ON dc.data_device_id = de.id " +
" WHERE dc.data_type = 1 " +
" <if test='deviceId != null'> AND de.device_id = #{deviceId} </if> " +
" <if test='query != null'> AND (dc.device_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
" <if test='parentChannelId != null'> AND dc.parent_id=#{parentChannelId} </if> " +
@ -155,7 +156,7 @@ public interface DeviceChannelMapper {
"</foreach> </if>" +
"ORDER BY dc.device_id ASC" +
" </script>"})
List<DeviceChannelExtend> queryChannelsWithDeviceInfo(@Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
List<DeviceChannelExtend> queryChannelsWithDeviceInfo( @Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List<String> channelIds);
@Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE id=#{channelId}"})
void startPlay(@Param("channelId") Integer channelId, @Param("streamId") String streamId);
@ -172,9 +173,9 @@ public interface DeviceChannelMapper {
" pgc.platform_id as platform_id,\n" +
" pgc.catalog_id as catalog_id " +
" FROM wvp_device_channel dc " +
" LEFT JOIN wvp_device de ON dc.device_db_id = de.id " +
" LEFT JOIN wvp_device de ON dc.data_device_id = de.id " +
" LEFT JOIN wvp_platform_channel pgc on pgc.device_channel_id = dc.id " +
" WHERE 1=1 " +
" WHERE dc.data_type = 1 " +
" <if test='query != null'> " +
"AND " +
"(COALESCE(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%') " +
@ -195,14 +196,14 @@ public interface DeviceChannelMapper {
@Insert("<script> " +
"insert into wvp_device_channel " +
"(device_id, device_db_id, name, manufacturer, model, owner, civil_code, block, " +
"(device_id, data_type, data_device_id, name, manufacturer, model, owner, civil_code, block, " +
"address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, end_time, secrecy, " +
"ip_address, port, password, status, longitude, latitude, ptz_type, position_type, room_type, use_type, " +
"supply_light_type, direction_type, resolution, business_group_id, download_speed, svc_space_support_mod, " +
"svc_time_support_mode, create_time, update_time, sub_count, stream_id, has_audio, gps_time, stream_identification, channel_type) " +
"values " +
"<foreach collection='addChannels' index='index' item='item' separator=','> " +
"(#{item.deviceId}, #{item.deviceDbId}, #{item.name}, #{item.manufacturer}, #{item.model}, #{item.owner}, #{item.civilCode}, #{item.block}, " +
"(#{item.deviceId}, #{item.dataType}, #{item.dataDeviceId}, #{item.name}, #{item.manufacturer}, #{item.model}, #{item.owner}, #{item.civilCode}, #{item.block}, " +
"#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, #{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.endTime}, #{item.secrecy}, " +
"#{item.ipAddress}, #{item.port}, #{item.password}, #{item.status}, #{item.longitude}, #{item.latitude}, #{item.ptzType}, #{item.positionType}, #{item.roomType}, #{item.useType}, " +
"#{item.supplyLightType}, #{item.directionType}, #{item.resolution}, #{item.businessGroupId}, #{item.downloadSpeed}, #{item.svcSpaceSupportMod}," +
@ -221,7 +222,8 @@ public interface DeviceChannelMapper {
" wvp_device_channel" +
" SET update_time=#{item.updateTime}" +
", device_id=#{item.deviceId}" +
", device_db_id=#{item.deviceDbId}" +
", data_type=#{item.dataType}" +
", data_device_id=#{item.dataDeviceId}" +
", name=#{item.name}" +
", manufacturer=#{item.manufacturer}" +
", model=#{item.model}" +
@ -273,7 +275,8 @@ public interface DeviceChannelMapper {
" wvp_device_channel" +
" SET update_time=#{item.updateTime}" +
", device_id=#{item.deviceId}" +
", device_db_id=#{item.deviceDbId}" +
", data_type=#{item.dataType}" +
", data_device_id=#{item.dataDeviceId}" +
", name=#{item.name}" +
", manufacturer=#{item.manufacturer}" +
", model=#{item.model}" +
@ -313,7 +316,7 @@ public interface DeviceChannelMapper {
", gps_time=#{item.gpsTime}" +
", stream_identification=#{item.streamIdentification}" +
", channel_type=#{item.channelType}" +
" WHERE device_db_id = #{item.deviceDbId} and device_id=#{item.deviceId}" +
" WHERE data_type = #{item.dataType} and data_device_id = #{item.dataDeviceId} and device_id=#{item.deviceId}" +
"</foreach>" +
"</script>"})
int batchUpdateForNotify(List<DeviceChannel> updateChannels);
@ -322,9 +325,9 @@ public interface DeviceChannelMapper {
" set sub_count = (select *" +
" from (select count(0)" +
" from wvp_device_channel" +
" where device_db_id = #{deviceDbId} and parent_id = #{channelId}) as temp)" +
" where device_db_id = #{deviceDbId} and device_id = #{channelId}")
int updateChannelSubCount(@Param("deviceDbId") int deviceDbId, @Param("channelId") String channelId);
" where data_type = 1 and data_device_id = #{dataDeviceId} and parent_id = #{channelId}) as temp)" +
" where data_type = 1 and data_device_id = #{dataDeviceId} and device_id = #{channelId}")
int updateChannelSubCount(@Param("dataDeviceId") int dataDeviceId, @Param("channelId") String channelId);
@Update(value = {" <script>" +
" UPDATE wvp_device_channel " +
@ -338,7 +341,7 @@ public interface DeviceChannelMapper {
@Select("select " +
" id,\n" +
" device_db_id,\n" +
" data_device_id,\n" +
" create_time,\n" +
" update_time,\n" +
" sub_count,\n" +
@ -381,11 +384,11 @@ public interface DeviceChannelMapper {
" download_speed,\n" +
" svc_space_support_mod,\n" +
" svc_time_support_mode\n" +
" from wvp_device_channel where device_db_id = #{deviceDbId}")
List<DeviceChannel> queryAllChannelsForRefresh(@Param("deviceDbId") int deviceDbId);
" from wvp_device_channel where data_type = 1 and data_device_id = #{dataDeviceId}")
List<DeviceChannel> queryAllChannelsForRefresh(@Param("dataDeviceId") int dataDeviceId);
@Select("select de.* from wvp_device de left join wvp_device_channel dc on de.device_id = dc.device_id where dc.device_id=#{channelId}")
List<Device> getDeviceByChannelDeviceId(String channelId);
@Select("select de.* from wvp_device de left join wvp_device_channel dc on de.device_id = dc.device_id where dc.data_type = 1 and dc.device_id=#{channelId}")
List<Device> getDeviceByChannelDeviceId(@Param("channelId") String channelId);
@Delete({"<script>" +
@ -397,7 +400,7 @@ public interface DeviceChannelMapper {
@Update({"<script>" +
"<foreach collection='channels' item='item' separator=';'>" +
"UPDATE wvp_device_channel SET status=#{item.status} WHERE device_id=#{item.deviceId}" +
"UPDATE wvp_device_channel SET status=#{item.status} WHERE data_type = #{item.dataType} and device_id=#{item.deviceId}" +
"</foreach>" +
"</script>"})
int batchUpdateStatus(List<DeviceChannel> channels);
@ -427,7 +430,7 @@ public interface DeviceChannelMapper {
"<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" +
"<if test='item.gpsTime != null'>, gps_time=#{item.gpsTime}</if>" +
"<if test='item.id > 0'>WHERE id=#{item.id}</if>" +
"<if test='item.id == 0'>WHERE device_db_id=#{item.deviceDbId} AND device_id=#{item.deviceId}</if>" +
"<if test='item.id == 0'>WHERE data_type = #{item.dataType} and data_device_id=#{item.dataDeviceId} AND device_id=#{item.deviceId}</if>" +
"</foreach>" +
"</script>"})
void batchUpdatePosition(List<DeviceChannel> channelList);
@ -438,7 +441,7 @@ public interface DeviceChannelMapper {
@Select(value = {" <script>" +
" SELECT " +
" id,\n" +
" device_db_id,\n" +
" data_device_id,\n" +
" create_time,\n" +
" update_time,\n" +
" sub_count,\n" +
@ -487,13 +490,13 @@ public interface DeviceChannelMapper {
DeviceChannel getOneForSource(@Param("id") int id);
@SelectProvider(type = DeviceChannelProvider.class, method = "getOneByDeviceId")
DeviceChannel getOneByDeviceId(@Param("deviceDbId") int deviceDbId, @Param("channelId") String channelId);
DeviceChannel getOneByDeviceId(@Param("dataDeviceId") int dataDeviceId, @Param("channelId") String channelId);
@Select(value = {" <script>" +
" SELECT " +
" id,\n" +
" device_db_id,\n" +
" data_device_id,\n" +
" create_time,\n" +
" update_time,\n" +
" sub_count,\n" +
@ -537,9 +540,9 @@ public interface DeviceChannelMapper {
" svc_space_support_mod,\n" +
" svc_time_support_mode\n" +
" from wvp_device_channel " +
" where device_db_id=#{deviceDbId} and coalesce(gb_device_id, device_id) = #{channelId}" +
" where data_type = 1 and data_device_id=#{dataDeviceId} and coalesce(gb_device_id, device_id) = #{channelId}" +
" </script>"})
DeviceChannel getOneByDeviceIdForSource(@Param("deviceDbId") int deviceDbId, @Param("channelId") String channelId);
DeviceChannel getOneByDeviceIdForSource(@Param("dataDeviceId") int dataDeviceId, @Param("channelId") String channelId);
@Update(value = {"UPDATE wvp_device_channel SET stream_id=null WHERE id=#{channelId}"})
@ -559,7 +562,7 @@ public interface DeviceChannelMapper {
"</script>")
void updateStreamGPS(List<GPSMsgInfo> gpsMsgInfoList);
@Update("UPDATE wvp_device_channel SET status=#{status} WHERE device_db_id=#{deviceDbId} AND device_id=#{deviceId}")
@Update("UPDATE wvp_device_channel SET status=#{status} WHERE data_type=#{dataType} and data_device_id=#{dataDeviceId} AND device_id=#{deviceId}")
void updateStatus(DeviceChannel channel);
@ -568,7 +571,7 @@ public interface DeviceChannelMapper {
" wvp_device_channel" +
" SET update_time=#{updateTime}" +
", device_id=#{deviceId}" +
", device_db_id=#{deviceDbId}" +
", data_device_id=#{dataDeviceId}" +
", name=#{name}" +
", manufacturer=#{manufacturer}" +
", model=#{model}" +
@ -616,7 +619,7 @@ public interface DeviceChannelMapper {
@Select(value = {" <script>" +
" SELECT " +
" id,\n" +
" device_db_id,\n" +
" data_device_id,\n" +
" create_time,\n" +
" update_time,\n" +
" sub_count,\n" +
@ -660,7 +663,7 @@ public interface DeviceChannelMapper {
" svc_space_support_mod,\n" +
" svc_time_support_mode\n" +
" from wvp_device_channel " +
" where device_db_id=#{deviceDbId} and device_id = #{channelId}" +
" where data_type = 1 and data_device_id=#{dataDeviceId} and device_id = #{channelId}" +
" </script>"})
DeviceChannel getOneBySourceChannelId(int deviceDbId, String channelId);
DeviceChannel getOneBySourceChannelId(@Param("dataDeviceId") int dataDeviceId, @Param("channelId") String channelId);
}

View File

@ -45,9 +45,9 @@ public interface DeviceMapper {
"on_line," +
"media_server_id," +
"broadcast_push_after_ack," +
"(SELECT count(0) FROM wvp_device_channel dc WHERE dc.device_db_id= de.id) as channel_count "+
"(SELECT count(0) FROM wvp_device_channel dc WHERE dc.data_type = 1 and dc.data_device_id= de.id) as channel_count "+
" FROM wvp_device de WHERE de.device_id = #{deviceId}")
Device getDeviceByDeviceId(String deviceId);
Device getDeviceByDeviceId( @Param("deviceId") String deviceId);
@Insert("INSERT INTO wvp_device (" +
"device_id, " +
@ -170,13 +170,13 @@ public interface DeviceMapper {
"geo_coord_sys,"+
"on_line,"+
"media_server_id,"+
"(SELECT count(0) FROM wvp_device_channel dc WHERE dc.device_db_id= de.id) as channel_count " +
"(SELECT count(0) FROM wvp_device_channel dc WHERE dc.data_type = #{dataType} and dc.data_device_id= de.id) as channel_count " +
"FROM wvp_device de" +
"<if test=\"onLine != null\"> where de.on_line=${onLine}</if>"+
"<if test='online != null'> where de.on_line=${online}</if>"+
" order by de.create_time desc "+
" </script>"
)
List<Device> getDevices(Boolean onLine);
List<Device> getDevices(@Param("dataType") Integer dataType, @Param("online") Boolean online);
@Delete("DELETE FROM wvp_device WHERE device_id=#{deviceId}")
int del(String deviceId);
@ -366,7 +366,7 @@ public interface DeviceMapper {
"on_line,"+
"media_server_id,"+
"server_id,"+
"(SELECT count(0) FROM wvp_device_channel dc WHERE dc.device_db_id= de.id) as channel_count " +
"(SELECT count(0) FROM wvp_device_channel dc WHERE dc.data_type = #{dataType} and dc.data_device_id= de.id) as channel_count " +
" FROM wvp_device de" +
" where 1 = 1 "+
" <if test='status != null'> AND de.on_line=${status}</if>"+
@ -377,7 +377,7 @@ public interface DeviceMapper {
"</if> " +
" order by create_time desc "+
" </script>")
List<Device> getDeviceList(@Param("query") String query, @Param("status") Boolean status);
List<Device> getDeviceList(@Param("dataType") Integer dataType, @Param("query") String query, @Param("status") Boolean status);
@Select("select * from wvp_device_channel where id = #{id}")
DeviceChannel getRawChannel(@Param("id") int id);
@ -385,10 +385,10 @@ public interface DeviceMapper {
@Select("select * from wvp_device where id = #{id}")
Device query(@Param("id") Integer id);
@Select("select wd.* from wvp_device wd left join wvp_device_channel wdc on wd.id = wdc.device_db_id where wdc.id = #{channelId}")
Device queryByChannelId(@Param("channelId") Integer channelId);
@Select("select wd.* from wvp_device wd left join wvp_device_channel wdc on wdc.data_type = #{dataType} and wd.id = wdc.data_device_id where wdc.id = #{channelId}")
Device queryByChannelId(@Param("dataType") Integer dataType, @Param("channelId") Integer channelId);
@Select("select wd.* from wvp_device wd left join wvp_device_channel wdc on wd.id = wdc.device_db_id where wdc.device_id = #{channelDeviceId}")
Device getDeviceBySourceChannelDeviceId(@Param("channelDeviceId") String channelDeviceId);
@Select("select wd.* from wvp_device wd left join wvp_device_channel wdc on wdc.data_type = #{dataType} and wd.id = wdc.data_device_id where wdc.device_id = #{channelDeviceId}")
Device getDeviceBySourceChannelDeviceId(@Param("dataType") Integer dataType, @Param("channelDeviceId") String channelDeviceId);
}

View File

@ -65,9 +65,8 @@ public interface PlatformChannelMapper {
" select " +
" wpgc.id ,\n" +
" wdc.id as gb_id,\n" +
" wdc.device_db_id as gb_device_db_id,\n" +
" wdc.stream_push_id,\n" +
" wdc.stream_proxy_id,\n" +
" wdc.data_type ,\n" +
" wdc.data_device_id,\n" +
" wdc.create_time,\n" +
" wdc.update_time,\n" +
" wpgc.custom_device_id, \n" +
@ -149,19 +148,16 @@ public interface PlatformChannelMapper {
" <if test='online == false'> AND coalesce(wpgc.status, wdc.gb_status, wdc.status) = 'OFF'</if> " +
" <if test='hasShare == true'> AND wpgc.platform_id = #{platformId}</if> " +
" <if test='hasShare == false'> AND wpgc.platform_id is null</if> " +
" <if test='channelType == 0'> AND wdc.device_db_id is not null</if> " +
" <if test='channelType == 1'> AND wdc.stream_push_id is not null</if> " +
" <if test='channelType == 2'> AND wdc.stream_proxy_id is not null</if> " +
" <if test='dataType != null'> AND wdc.data_type = #{dataType}</if> " +
"</script>")
List<PlatformChannel> queryForPlatformForWebList(@Param("platformId") Integer platformId, @Param("query") String query,
@Param("channelType") Integer channelType, @Param("online") Boolean online,
@Param("dataType") Integer dataType, @Param("online") Boolean online,
@Param("hasShare") Boolean hasShare);
@Select("select\n" +
" wdc.id as gb_id,\n" +
" wdc.device_db_id as gb_device_db_id,\n" +
" wdc.stream_push_id,\n" +
" wdc.stream_proxy_id,\n" +
" wdc.data_type,\n" +
" wdc.data_device_id,\n" +
" wdc.create_time,\n" +
" wdc.update_time,\n" +
" coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
@ -209,9 +205,8 @@ public interface PlatformChannelMapper {
@Select("<script>" +
" select " +
" wdc.id as gb_id,\n" +
" wdc.device_db_id as gb_device_db_id,\n" +
" wdc.stream_push_id,\n" +
" wdc.stream_proxy_id,\n" +
" wdc.data_type,\n" +
" wdc.data_device_id,\n" +
" wdc.create_time,\n" +
" wdc.update_time,\n" +
" coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
@ -260,9 +255,8 @@ public interface PlatformChannelMapper {
@Select("<script>" +
" select " +
" wdc.id as gb_id,\n" +
" wdc.device_db_id as gb_device_db_id,\n" +
" wdc.stream_push_id,\n" +
" wdc.stream_proxy_id,\n" +
" wdc.data_type,\n" +
" wdc.data_device_id,\n" +
" wdc.create_time,\n" +
" wdc.update_time,\n" +
" coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
@ -485,9 +479,8 @@ public interface PlatformChannelMapper {
@Select("<script>" +
" select " +
" wdc.id as gb_id,\n" +
" wdc.device_db_id as gb_device_db_id,\n" +
" wdc.stream_push_id,\n" +
" wdc.stream_proxy_id,\n" +
" wdc.data_type,\n" +
" wdc.data_device_id,\n" +
" wdc.create_time,\n" +
" wdc.update_time,\n" +
" coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +

View File

@ -12,9 +12,8 @@ public class ChannelProvider {
public final static String BASE_SQL = "select\n" +
" id as gb_id,\n" +
" device_db_id as gb_device_db_id,\n" +
" stream_push_id,\n" +
" stream_proxy_id,\n" +
" data_type,\n" +
" data_device_id,\n" +
" create_time,\n" +
" update_time,\n" +
" record_plan_id,\n" +
@ -58,9 +57,8 @@ public class ChannelProvider {
private final static String BASE_SQL_FOR_PLATFORM =
"select\n" +
" wdc.id as gb_id,\n" +
" wdc.device_db_id as gb_device_db_id,\n" +
" wdc.stream_push_id,\n" +
" wdc.stream_proxy_id,\n" +
" wdc.data_type,\n" +
" wdc.data_device_id,\n" +
" wdc.create_time,\n" +
" wdc.update_time,\n" +
" coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
@ -109,15 +107,10 @@ public class ChannelProvider {
return BASE_SQL + " where channel_type = 0 and id = #{gbId}";
}
public String queryByStreamPushId(Map<String, Object> params ){
return BASE_SQL + " where channel_type = 0 and stream_push_id = #{streamPushId}";
public String queryByDataId(Map<String, Object> params ){
return BASE_SQL + " where channel_type = 0 and data_type = #{dataType} and data_device_id = #{dataDeviceId}";
}
public String queryByStreamProxyId(Map<String, Object> params ){
return BASE_SQL + " where channel_type = 0 and stream_proxy_id = #{streamProxyId}";
}
public String queryListByCivilCode(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(BASE_SQL);
@ -138,14 +131,8 @@ public class ChannelProvider {
}else {
sqlBuild.append(" AND coalesce(gb_civil_code, civil_code) is null");
}
if (params.get("channelType") != null) {
if ((Integer)params.get("channelType") == 0) {
sqlBuild.append(" AND device_db_id is not null");
}else if ((Integer)params.get("channelType") == 1) {
sqlBuild.append(" AND stream_push_id is not null");
}else if ((Integer)params.get("channelType") == 2) {
sqlBuild.append(" AND stream_proxy_id is not null");
}
if (params.get("dataType") != null) {
sqlBuild.append(" AND data_type = #{dataType}");
}
return sqlBuild.toString();
}
@ -170,15 +157,8 @@ public class ChannelProvider {
}else {
sqlBuild.append(" AND coalesce(gb_parent_id, parent_id) is null");
}
if (params.get("channelType") != null) {
if ((Integer)params.get("channelType") == 0) {
sqlBuild.append(" AND device_db_id is not null");
}else if ((Integer)params.get("channelType") == 1) {
sqlBuild.append(" AND stream_push_id is not null");
}else if ((Integer)params.get("channelType") == 2) {
sqlBuild.append(" AND stream_proxy_id is not null");
}
if (params.get("dataType") != null) {
sqlBuild.append(" AND data_type = #{dataType}");
}
return sqlBuild.toString();
}
@ -201,15 +181,8 @@ public class ChannelProvider {
if (params.get("hasRecordPlan") != null && (Boolean)params.get("hasRecordPlan")) {
sqlBuild.append(" AND record_plan_id > 0");
}
if (params.get("channelType") != null) {
if ((Integer)params.get("channelType") == 0) {
sqlBuild.append(" AND device_db_id is not null");
}else if ((Integer)params.get("channelType") == 1) {
sqlBuild.append(" AND stream_push_id is not null");
}else if ((Integer)params.get("channelType") == 2) {
sqlBuild.append(" AND stream_proxy_id is not null");
}
if (params.get("dataType") != null) {
sqlBuild.append(" AND data_type = #{dataType}");
}
return sqlBuild.toString();
}
@ -253,7 +226,7 @@ public class ChannelProvider {
public String queryByGbDeviceIds(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(BASE_SQL);
sqlBuild.append("where channel_type = 0 and device_db_id in ( ");
sqlBuild.append("where channel_type = 0 and data_type = #{dataType} and data_device_id in ( ");
Collection<Integer> ids = (Collection<Integer>)params.get("deviceIds");
boolean first = true;
@ -356,7 +329,7 @@ public class ChannelProvider {
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(BASE_SQL);
sqlBuild.append(" where channel_type = 0 and stream_push_id in ( ");
sqlBuild.append(" where channel_type = 0 and data_type = #{dataType} and data_device_id in ( ");
Collection<StreamPush> ids = (Collection<StreamPush>)params.get("streamPushList");
boolean first = true;
for (StreamPush streamPush : ids) {

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.dao.provider;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import org.springframework.util.ObjectUtils;
import java.util.List;
@ -10,7 +11,7 @@ public class DeviceChannelProvider {
public String getBaseSelectSql(){
return "SELECT " +
" dc.id,\n" +
" dc.device_db_id,\n" +
" dc.data_device_id,\n" +
" dc.create_time,\n" +
" dc.update_time,\n" +
" dc.sub_count,\n" +
@ -60,7 +61,7 @@ public class DeviceChannelProvider {
public String queryChannels(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(getBaseSelectSql());
sqlBuild.append(" where dc.device_db_id = #{deviceDbId} ");
sqlBuild.append(" where data_type = " + ChannelDataType.GB28181.value + " and dc.data_device_id = #{dataDeviceId} ");
if (params.get("businessGroupId") != null ) {
sqlBuild.append(" AND coalesce(dc.gb_business_group_id, dc.business_group_id)=#{businessGroupId} AND coalesce(dc.gb_parent_id, dc.parent_id) is null");
}else if (params.get("parentChannelId") != null ) {
@ -107,14 +108,14 @@ public class DeviceChannelProvider {
public String queryChannelsByDeviceDbId(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(getBaseSelectSql());
sqlBuild.append(" where dc.device_db_id = #{deviceDbId}");
sqlBuild.append(" where data_type = " + ChannelDataType.GB28181.value + " and dc.data_device_id = #{dataDeviceId}");
return sqlBuild.toString();
}
public String queryAllChannels(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(getBaseSelectSql());
sqlBuild.append(" where dc.device_db_id = #{deviceDbId}");
sqlBuild.append(" where data_type = " + ChannelDataType.GB28181.value + " and dc.data_device_id = #{dataDeviceId}");
return sqlBuild.toString();
}
@ -128,33 +129,25 @@ public class DeviceChannelProvider {
public String getOneByDeviceId(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(getBaseSelectSql());
sqlBuild.append(" where dc.device_db_id=#{deviceDbId} and coalesce(dc.gb_device_id, dc.device_id) = #{channelId}");
sqlBuild.append(" where data_type = " + ChannelDataType.GB28181.value + " and dc.data_device_id=#{dataDeviceId} and coalesce(dc.gb_device_id, dc.device_id) = #{channelId}");
return sqlBuild.toString();
}
public String queryByDeviceId(Map<String, Object> params ){
return getBaseSelectSql() + " where channel_type = 0 and coalesce(gb_device_id, device_id) = #{gbDeviceId}";
return getBaseSelectSql() + " where data_type = " + ChannelDataType.GB28181.value + " and channel_type = 0 and coalesce(gb_device_id, device_id) = #{gbDeviceId}";
}
public String queryById(Map<String, Object> params ){
return getBaseSelectSql() + " where channel_type = 0 and id = #{gbId}";
}
public String queryByStreamPushId(Map<String, Object> params ){
return getBaseSelectSql() + " where channel_type = 0 and stream_push_id = #{streamPushId}";
}
public String queryByStreamProxyId(Map<String, Object> params ){
return getBaseSelectSql() + " where channel_type = 0 and stream_proxy_id = #{streamProxyId}";
return getBaseSelectSql() + " where data_type = " + ChannelDataType.GB28181.value + " and channel_type = 0 and id = #{gbId}";
}
public String queryList(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(getBaseSelectSql());
sqlBuild.append(" where channel_type = 0 ");
sqlBuild.append(" where channel_type = 0 and data_type = " + ChannelDataType.GB28181.value);
if (params.get("query") != null) {
sqlBuild.append(" AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%')" +
" OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') )")

View File

@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.gb28181.service.impl;
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.common.InviteInfo;
import com.genersoft.iot.vmp.common.InviteSessionType;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.*;
@ -110,7 +111,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
List<DeviceChannel> channelList = channelMapper.queryChannelsByDeviceDbId(device.getId());
if (channelList.isEmpty()) {
for (DeviceChannel channel : channels) {
channel.setDeviceDbId(device.getId());
channel.setDataDeviceId(device.getId());
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId());
if (inviteInfo != null && inviteInfo.getStreamInfo() != null) {
channel.setStreamId(inviteInfo.getStreamInfo().getStream());
@ -122,7 +123,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
}else {
for (DeviceChannel deviceChannel : channelList) {
channelsInStore.put(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId(), deviceChannel);
channelsInStore.put(deviceChannel.getDataDeviceId() + deviceChannel.getDeviceId(), deviceChannel);
}
for (DeviceChannel channel : channels) {
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId());
@ -131,7 +132,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
String now = DateUtil.getNow();
channel.setUpdateTime(now);
DeviceChannel deviceChannelInDb = channelsInStore.get(channel.getDeviceDbId() + channel.getDeviceId());
DeviceChannel deviceChannelInDb = channelsInStore.get(channel.getDataDeviceId() + channel.getDeviceId());
if ( deviceChannelInDb != null) {
channel.setId(deviceChannelInDb.getId());
channel.setUpdateTime(now);
@ -348,7 +349,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
for (DeviceChannel channel : channels) {
if (channel.getParentId() != null) {
channelMapper.updateChannelSubCount(channel.getDeviceDbId(), channel.getParentId());
channelMapper.updateChannelSubCount(channel.getDataDeviceId(), channel.getParentId());
}
}
}
@ -511,7 +512,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
Map<String,DeviceChannel> allChannelMap = new HashMap<>();
if (!allChannels.isEmpty()) {
for (DeviceChannel deviceChannel : allChannels) {
allChannelMap.put(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId(), deviceChannel);
allChannelMap.put(deviceChannel.getDataDeviceId() + deviceChannel.getDeviceId(), deviceChannel);
}
}
// 数据去重
@ -524,7 +525,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
Map<String, Integer> subContMap = new HashMap<>();
for (DeviceChannel deviceChannel : deviceChannelList) {
DeviceChannel channelInDb = allChannelMap.get(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId());
DeviceChannel channelInDb = allChannelMap.get(deviceChannel.getDataDeviceId() + deviceChannel.getDeviceId());
if (channelInDb != null) {
deviceChannel.setStreamId(channelInDb.getStreamId());
deviceChannel.setHasAudio(channelInDb.isHasAudio());
@ -544,7 +545,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
deviceChannel.setUpdateTime(DateUtil.getNow());
addChannels.add(deviceChannel);
}
allChannelMap.remove(deviceChannel.getDeviceDbId() + deviceChannel.getDeviceId());
allChannelMap.remove(deviceChannel.getDataDeviceId() + deviceChannel.getDeviceId());
channels.add(deviceChannel);
if (!ObjectUtils.isEmpty(deviceChannel.getParentId())) {
if (subContMap.get(deviceChannel.getParentId()) == null) {
@ -724,6 +725,8 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
@Override
public void addChannel(DeviceChannel channel) {
channel.setDataType(ChannelDataType.GB28181.value);
channel.setDataDeviceId(channel.getDataDeviceId());
channelMapper.add(channel);
}

View File

@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.gb28181.service.impl;
import com.alibaba.fastjson2.JSON;
import com.genersoft.iot.vmp.common.CommonCallback;
import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
@ -98,11 +99,15 @@ public class DeviceServiceImpl implements IDeviceService {
@Autowired
private AudioBroadcastManager audioBroadcastManager;
private Device getDeviceByDeviceIdFromDb(String deviceId) {
return deviceMapper.getDeviceByDeviceId(deviceId);
}
@Override
public void online(Device device, SipTransactionInfo sipTransactionInfo) {
log.info("[设备上线] deviceId{}->{}:{}", device.getDeviceId(), device.getIp(), device.getPort());
Device deviceInRedis = redisCatchStorage.getDevice(device.getDeviceId());
Device deviceInDb = deviceMapper.getDeviceByDeviceId(device.getDeviceId());
Device deviceInDb = getDeviceByDeviceIdFromDb(device.getDeviceId());
String now = DateUtil.getNow();
if (deviceInRedis != null && deviceInDb == null) {
@ -197,7 +202,7 @@ public class DeviceServiceImpl implements IDeviceService {
@Override
public void offline(String deviceId, String reason) {
log.warn("[设备离线]{}, device{}", reason, deviceId);
Device device = deviceMapper.getDeviceByDeviceId(deviceId);
Device device = getDeviceByDeviceIdFromDb(deviceId);
if (device == null) {
return;
}
@ -349,7 +354,7 @@ public class DeviceServiceImpl implements IDeviceService {
public Device getDeviceByDeviceId(String deviceId) {
Device device = redisCatchStorage.getDevice(deviceId);
if (device == null) {
device = deviceMapper.getDeviceByDeviceId(deviceId);
device = getDeviceByDeviceIdFromDb(deviceId);
if (device != null) {
redisCatchStorage.updateDevice(device);
}
@ -364,7 +369,7 @@ public class DeviceServiceImpl implements IDeviceService {
@Override
public List<Device> getAllByStatus(Boolean status) {
return deviceMapper.getDevices(status);
return deviceMapper.getDevices(ChannelDataType.GB28181.value, status);
}
@Override
@ -406,7 +411,7 @@ public class DeviceServiceImpl implements IDeviceService {
@Override
public boolean isExist(String deviceId) {
return deviceMapper.getDeviceByDeviceId(deviceId) != null;
return getDeviceByDeviceIdFromDb(deviceId) != null;
}
@Override
@ -499,7 +504,7 @@ public class DeviceServiceImpl implements IDeviceService {
@Override
@Transactional
public boolean delete(String deviceId) {
Device device = deviceMapper.getDeviceByDeviceId(deviceId);
Device device = getDeviceByDeviceIdFromDb(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备:" + deviceId);
}
@ -530,7 +535,7 @@ public class DeviceServiceImpl implements IDeviceService {
.replaceAll("%", "/%")
.replaceAll("_", "/_");
}
List<Device> all = deviceMapper.getDeviceList(query, status);
List<Device> all = deviceMapper.getDeviceList(ChannelDataType.GB28181.value, query, status);
return new PageInfo<>(all);
}
@ -541,11 +546,11 @@ public class DeviceServiceImpl implements IDeviceService {
@Override
public Device getDeviceByChannelId(Integer channelId) {
return deviceMapper.queryByChannelId(channelId);
return deviceMapper.queryByChannelId(ChannelDataType.GB28181.value,channelId);
}
@Override
public Device getDeviceBySourceChannelDeviceId(String channelId) {
return deviceMapper.getDeviceBySourceChannelDeviceId(channelId);
return deviceMapper.getDeviceBySourceChannelDeviceId(ChannelDataType.GB28181.value,channelId);
}
}

View File

@ -4,6 +4,11 @@ import com.genersoft.iot.vmp.common.InviteSessionType;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.exception.ServiceException;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.InviteInfo;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import com.genersoft.iot.vmp.gb28181.bean.PlayException;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelPlayService;
import com.genersoft.iot.vmp.gb28181.service.IPlayService;
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
@ -35,7 +40,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
@Override
public void start(CommonGBChannel channel, InviteMessageInfo inviteInfo, Platform platform, ErrorCallback<StreamInfo> callback) {
if (channel == null || inviteInfo == null || callback == null) {
if (channel == null || inviteInfo == null || callback == null || channel.getDataType() == null) {
log.warn("[通用通道点播] 参数异常, channel: {}, inviteInfo: {}, callback: {}", channel != null, inviteInfo != null, callback != null);
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
}
@ -43,14 +48,14 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
if ("Play".equalsIgnoreCase(inviteInfo.getSessionName())) {
play(channel, platform, callback);
}else if ("Playback".equals(inviteInfo.getSessionName())) {
if (channel.getGbDeviceDbId() != null) {
if (channel.getDataType() == ChannelDataType.GB28181.value) {
// 国标通道
playbackGbDeviceChannel(channel, inviteInfo.getStartTime(), inviteInfo.getStopTime(), callback);
} else if (channel.getStreamProxyId() != null) {
} else if (channel.getDataType() == ChannelDataType.STREAM_PROXY.value) {
// 拉流代理
log.warn("[回放通用通道] 不支持回放拉流代理的录像: {}({})", channel.getGbName(), channel.getGbDeviceId());
throw new PlayException(Response.FORBIDDEN, "forbidden");
} else if (channel.getStreamPushId() != null) {
} else if (channel.getDataType() == ChannelDataType.STREAM_PUSH.value) {
// 推流
log.warn("[回放通用通道] 不支持回放推流的录像: {}({})", channel.getGbName(), channel.getGbDeviceId());
throw new PlayException(Response.FORBIDDEN, "forbidden");
@ -60,7 +65,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
}
}else if ("Download".equals(inviteInfo.getSessionName())) {
if (channel.getGbDeviceDbId() != null) {
if (channel.getDataType() == ChannelDataType.GB28181.value) {
int downloadSpeed = 4;
try {
if (inviteInfo.getDownloadSpeed() != null){
@ -70,11 +75,11 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
// 国标通道
downloadGbDeviceChannel(channel, inviteInfo.getStartTime(), inviteInfo.getStopTime(), downloadSpeed, callback);
} else if (channel.getStreamProxyId() != null) {
} else if (channel.getDataType() == ChannelDataType.STREAM_PROXY.value) {
// 拉流代理
log.warn("[下载通用通道录像] 不支持下载拉流代理的录像: {}({})", channel.getGbName(), channel.getGbDeviceId());
throw new PlayException(Response.FORBIDDEN, "forbidden");
} else if (channel.getStreamPushId() != null) {
} else if (channel.getDataType() == ChannelDataType.STREAM_PUSH.value) {
// 推流
log.warn("[下载通用通道录像] 不支持下载推流的录像: {}({})", channel.getGbName(), channel.getGbDeviceId());
throw new PlayException(Response.FORBIDDEN, "forbidden");
@ -110,13 +115,13 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
@Override
public void play(CommonGBChannel channel, Platform platform, ErrorCallback<StreamInfo> callback) {
if (channel.getGbDeviceDbId() != null) {
if (channel.getDataType() == ChannelDataType.GB28181.value) {
// 国标通道
playGbDeviceChannel(channel, callback);
} else if (channel.getStreamProxyId() != null) {
} else if (channel.getDataType() == ChannelDataType.STREAM_PROXY.value) {
// 拉流代理
playProxy(channel, callback);
} else if (channel.getStreamPushId() != null) {
} else if (channel.getDataType() == ChannelDataType.STREAM_PUSH.value) {
if (platform != null) {
// 推流
playPush(channel, platform.getServerGBId(), platform.getName(), callback);
@ -158,7 +163,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
public void playProxy(CommonGBChannel channel, ErrorCallback<StreamInfo> callback){
// 拉流代理通道
try {
StreamInfo streamInfo = streamProxyPlayService.start(channel.getStreamProxyId());
StreamInfo streamInfo = streamProxyPlayService.start(channel.getDataDeviceId());
if (streamInfo == null) {
callback.run(Response.BUSY_HERE, "busy here", null);
}else {
@ -183,7 +188,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService {
public void playPush(CommonGBChannel channel, String platformDeviceId, String platformName, ErrorCallback<StreamInfo> callback){
// 推流
try {
streamPushPlayService.start(channel.getStreamPushId(), callback, platformDeviceId, platformName);
streamPushPlayService.start(channel.getDataDeviceId(), callback, platformDeviceId, platformName);
}catch (PlayException e) {
callback.run(e.getCode(), e.getMsg(), null);
}catch (Exception e) {

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.service.impl;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
@ -62,17 +63,12 @@ public class GbChannelServiceImpl implements IGbChannelService {
@Override
public int add(CommonGBChannel commonGBChannel) {
if (commonGBChannel.getStreamPushId() != null && commonGBChannel.getStreamPushId() > 0) {
CommonGBChannel commonGBChannelInDb = commonGBChannelMapper.queryByStreamPushId(commonGBChannel.getStreamPushId());
if (commonGBChannelInDb != null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "此推流已经关联通道");
}
if (commonGBChannel.getDataType() == null || commonGBChannel.getDataDeviceId() == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "缺少通道数据类型或通道数据关联设备ID");
}
if (commonGBChannel.getStreamProxyId() != null && commonGBChannel.getStreamProxyId() > 0) {
CommonGBChannel commonGBChannelInDb = commonGBChannelMapper.queryByStreamProxyId(commonGBChannel.getStreamProxyId());
if (commonGBChannelInDb != null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "此代理已经关联通道");
}
CommonGBChannel commonGBChannelInDb = commonGBChannelMapper.queryByDataId(commonGBChannel.getDataType(), commonGBChannel.getDataDeviceId());
if (commonGBChannelInDb != null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "此推流已经关联通道");
}
commonGBChannel.setCreateTime(DateUtil.getNow());
commonGBChannel.setUpdateTime(DateUtil.getNow());
@ -122,7 +118,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
public int update(CommonGBChannel commonGBChannel) {
log.info("[更新通道] 通道ID: {}, ", commonGBChannel.getGbId());
if (commonGBChannel.getGbId() <= 0) {
log.warn("[更新通道] 未找到数据库ID更新失败 {}", commonGBChannel.getGbDeviceDbId());
log.warn("[更新通道] 未找到数据库ID更新失败 {}({})", commonGBChannel.getGbName(), commonGBChannel.getGbDeviceId());
return 0;
}
commonGBChannel.setUpdateTime(DateUtil.getNow());
@ -141,7 +137,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
@Override
public int offline(CommonGBChannel commonGBChannel) {
if (commonGBChannel.getGbId() <= 0) {
log.warn("[通道离线] 未找到数据库ID更新失败 {}", commonGBChannel.getGbDeviceDbId());
log.warn("[通道离线] 未找到数据库ID更新失败 {}({})", commonGBChannel.getGbName(), commonGBChannel.getGbDeviceId());
return 0;
}
int result = commonGBChannelMapper.updateStatusById(commonGBChannel.getGbId(), 0);
@ -195,7 +191,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
@Override
public int online(CommonGBChannel commonGBChannel) {
if (commonGBChannel.getGbId() <= 0) {
log.warn("[通道上线] 未找到数据库ID更新失败 {}", commonGBChannel.getGbDeviceDbId());
log.warn("[通道上线] 未找到数据库ID更新失败 {}({})", commonGBChannel.getGbName(), commonGBChannel.getGbDeviceId());
return 0;
}
int result = commonGBChannelMapper.updateStatusById(commonGBChannel.getGbId(), 1);
@ -380,12 +376,12 @@ public class GbChannelServiceImpl implements IGbChannelService {
log.warn("[重置国标通道] 未找到对应Id的通道: id: {}", id);
throw new ControllerException(ErrorCode.ERROR400);
}
if (channel.getGbDeviceDbId() <= 0) {
if (channel.getDataType() != ChannelDataType.GB28181.value) {
log.warn("[重置国标通道] 非国标下级通道无法重置: id: {}", id);
throw new ControllerException(ErrorCode.ERROR100.getCode(), "非国标下级通道无法重置");
}
// 这个多加一个参数,为了防止将非国标的通道通过此方法清空内容,导致意外发生
commonGBChannelMapper.reset(id, channel.getGbDeviceDbId(), DateUtil.getNow());
commonGBChannelMapper.reset(id, ChannelDataType.GB28181.value, channel.getDataDeviceId(), DateUtil.getNow());
CommonGBChannel channelNew = getOne(id);
// 发送通过更新通知
try {
@ -508,7 +504,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
@Override
public void addChannelToRegionByGbDevice(String civilCode, List<Integer> deviceIds) {
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(deviceIds);
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(ChannelDataType.GB28181.value, deviceIds);
if (channelList.isEmpty()) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
}
@ -529,7 +525,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
@Override
public void deleteChannelToRegionByGbDevice(List<Integer> deviceIds) {
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(deviceIds);
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(ChannelDataType.GB28181.value, deviceIds);
if (channelList.isEmpty()) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
}
@ -646,7 +642,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
@Override
@Transactional
public void addChannelToGroupByGbDevice(String parentId, String businessGroup, List<Integer> deviceIds) {
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(deviceIds);
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(ChannelDataType.GB28181.value, deviceIds);
if (channelList.isEmpty()) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
}
@ -674,7 +670,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
@Override
public void deleteChannelToGroupByGbDevice(List<Integer> deviceIds) {
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(deviceIds);
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(ChannelDataType.GB28181.value, deviceIds);
if (channelList.isEmpty()) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
}
@ -716,12 +712,12 @@ public class GbChannelServiceImpl implements IGbChannelService {
@Override
public List<CommonGBChannel> queryListByStreamPushList(List<StreamPush> streamPushList) {
return commonGBChannelMapper.queryListByStreamPushList(streamPushList);
return commonGBChannelMapper.queryListByStreamPushList(ChannelDataType.STREAM_PUSH.value, streamPushList);
}
@Override
public void updateGpsByDeviceIdForStreamPush(List<CommonGBChannel> channels) {
commonGBChannelMapper.updateGpsByDeviceIdForStreamPush(channels);
commonGBChannelMapper.updateGpsByDeviceIdForStreamPush(ChannelDataType.STREAM_PUSH.value, channels);
}
@Override

View File

@ -1,5 +1,7 @@
package com.genersoft.iot.vmp.gb28181.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.dao.*;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
@ -286,14 +288,14 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
@Override
@Transactional
public void addChannelByDevice(Integer platformId, List<Integer> deviceIds) {
List<Integer> channelList = commonGBChannelMapper.queryByGbDeviceIdsForIds(deviceIds);
List<Integer> channelList = commonGBChannelMapper.queryByGbDeviceIdsForIds(ChannelDataType.GB28181.value, deviceIds);
addChannels(platformId, channelList);
}
@Override
@Transactional
public void removeChannelByDevice(Integer platformId, List<Integer> deviceIds) {
List<Integer> channelList = commonGBChannelMapper.queryByGbDeviceIdsForIds(deviceIds);
List<Integer> channelList = commonGBChannelMapper.queryByGbDeviceIdsForIds(ChannelDataType.GB28181.value, deviceIds);
removeChannels(platformId, channelList);
}
@ -429,7 +431,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
eventPublisher.catalogEventPublish(channel.getPlatformId(), commonGBChannel, CatalogEvent.UPDATE);
} catch (Exception e) {
log.warn("[自定义通道信息] 发送失败, 平台ID {} 通道: {}{}", channel.getPlatformId(),
channel.getGbName(), channel.getGbDeviceDbId(), e);
channel.getGbName(), channel.getId(), e);
}
}

View File

@ -1671,7 +1671,7 @@ public class PlayServiceImpl implements IPlayService {
log.warn("[停止点播] 发现通道不存在");
return;
}
Device device = deviceService.getDevice(channel.getDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
log.warn("[停止点播] 发现设备不存在");
return;
@ -1696,7 +1696,7 @@ public class PlayServiceImpl implements IPlayService {
@Override
public void play(CommonGBChannel channel, ErrorCallback<StreamInfo> callback) {
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
log.warn("[点播] 未找到通道{}的设备信息", channel);
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
@ -1722,7 +1722,7 @@ public class PlayServiceImpl implements IPlayService {
throw new PlayException(Response.BAD_REQUEST, "bad request");
}
// 国标通道
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
log.warn("[点播] 未找到通道{}的设备信息", channel);
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");
@ -1743,7 +1743,7 @@ public class PlayServiceImpl implements IPlayService {
throw new PlayException(Response.BAD_REQUEST, "bad request");
}
// 国标通道
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
log.warn("[点播] 未找到通道{}的设备信息", channel);
throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error");

View File

@ -199,7 +199,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
platformService.stopBroadcast(platform, channel, ssrcTransaction.getStream(), false,
mediaServerService.getOne(mediaServerId));
DeviceChannel deviceChannel = deviceChannelService.getOneForSourceById(channel.getGbId());
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
playService.stopAudioBroadcast(device, deviceChannel);
}

View File

@ -115,7 +115,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
log.info("[解析CatalogChannelEvent]成功:但是解析通道信息失败, 原文如下: \n{}", new String(evt.getRequest().getRawContent()));
continue;
}
catalogChannelEvent.getChannel().setDeviceDbId(device.getId());
catalogChannelEvent.getChannel().setDataDeviceId(device.getId());
} catch (InvocationTargetException | NoSuchMethodException | InstantiationException |
IllegalAccessException e) {
log.error("[解析CatalogChannelEvent]失败,", e);

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.info;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
import com.genersoft.iot.vmp.gb28181.service.*;
@ -101,7 +102,7 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I
return;
}
// 判断通道类型
if (channel.getGbDeviceDbId() == null) {
if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 非国标通道不支持录像回放控制
log.warn("[INFO 消息] 非国标通道不支持录像回放控制: 通道ID {}", sendRtpInfo.getChannelId());
responseAck(request, Response.FORBIDDEN, "");
@ -109,7 +110,7 @@ public class InfoRequestProcessor extends SIPRequestProcessorParent implements I
}
// 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
// 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", sendRtpInfo.getChannelId());

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.control.cmd;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.common.enums.DeviceControlType;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
@ -134,7 +135,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
*
*/
private void handlePtzCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) {
if (channel.getGbDeviceDbId() == 0) {
if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的云台控制, 通道ID {}", channel.getGbId());
try {
@ -145,7 +146,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
return;
}
// 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
// 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());
@ -184,7 +185,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
*
*/
private void handleIFameCmd(CommonGBChannel channel, SIPRequest request) {
if (channel.getGbDeviceDbId() == 0) {
if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的处理强制关键帧, 通道ID {}", channel.getGbId());
try {
@ -195,7 +196,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
return;
}
// 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
// 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());
@ -232,7 +233,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
*
*/
private void handleTeleBootCmd(CommonGBChannel channel, SIPRequest request) {
if (channel.getGbDeviceDbId() == 0) {
if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的重启命令, 通道ID {}", channel.getGbId());
try {
@ -243,7 +244,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
return;
}
// 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
// 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());
@ -267,7 +268,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
*
*/
private void handleDragZoom(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) {
if (channel.getGbDeviceDbId() == 0) {
if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的拉框控制, 通道ID {}", channel.getGbId());
try {
@ -278,7 +279,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
return;
}
// 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
// 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());
@ -330,7 +331,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
*
*/
private void handleHomePositionCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) {
if (channel.getGbDeviceDbId() == 0) {
if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的看守位命令, 通道ID {}", channel.getGbId());
try {
@ -341,7 +342,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
return;
}
// 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
// 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());
@ -382,7 +383,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
*
*/
private void handleAlarmCmd(CommonGBChannel channel, Element rootElement, SIPRequest request) {
if (channel.getGbDeviceDbId() == 0) {
if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的告警消息, 通道ID {}", channel.getGbId());
try {
@ -393,7 +394,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
return;
}
// 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
// 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());
@ -428,7 +429,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
*
*/
private void handleRecordCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) {
if (channel.getGbDeviceDbId() == 0) {
if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的息录像控制, 通道ID {}", channel.getGbId());
try {
@ -439,7 +440,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
return;
}
// 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
// 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());
@ -480,7 +481,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
* /
*/
private void handleGuardCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) {
if (channel.getGbDeviceDbId() == 0) {
if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的报警布防/撤防命令, 通道ID {}", channel.getGbId());
try {
@ -491,7 +492,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
return;
}
// 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
// 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.service.*;
@ -106,8 +107,18 @@ public class BroadcastNotifyMessageHandler extends SIPRequestProcessorParent imp
responseAck(request, Response.NOT_FOUND, "TargetID not found");
return;
}
if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的语音喊话
log.warn("[INFO 消息] 只支持国标的语音喊话命令, 通道ID {}", channel.getGbId());
try {
responseAck(request, Response.FORBIDDEN, "");
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 错误信息: {}", e.getMessage());
}
return;
}
// 向下级发送语音的喊话请求
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
responseAck(request, Response.NOT_FOUND, "device not found");
return;

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
@ -93,7 +94,7 @@ public class DeviceInfoQueryMessageHandler extends SIPRequestProcessorParent imp
return;
}
// 判断通道类型
if (channel.getGbDeviceDbId() == null) {
if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 非国标通道不支持录像回放控制
log.warn("[DeviceInfo] 非国标通道不支持录像回放控制: 通道ID {}", channel.getGbId());
try {
@ -106,10 +107,10 @@ public class DeviceInfoQueryMessageHandler extends SIPRequestProcessorParent imp
}
// 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
// 不存在则回复404
log.warn("[DeviceInfo] 通道所属设备不存在, 通道ID {}", channel.getGbDeviceDbId());
log.warn("[DeviceInfo] 通道所属设备不存在, 通道ID {}", channel.getDataDeviceId());
try {
responseAck(request, Response.NOT_FOUND, "device not found ");

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
@ -104,8 +105,8 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
}
return;
}
if (channel.getGbId() == 0 ) {
log.info("[平台查询录像记录] 不支持查询推流和拉流代理的录像数据 {}/{}", platform.getName(), channelId );
if (channel.getDataType() != ChannelDataType.GB28181.value) {
log.info("[平台查询录像记录] 只支持查询国标28181的录像数据 {}/{}", platform.getName(), channelId );
try {
responseAck(request, Response.NOT_IMPLEMENTED); // 回复未实现
} catch (SipException | InvalidArgumentException | ParseException e) {
@ -113,7 +114,7 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
}
return;
}
Device device = deviceService.getDevice(channel.getGbDeviceDbId());
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
log.warn("[平台查询录像记录] 未找到通道对应的设备 {}/{}", platform.getName(), channelId );
try {

View File

@ -139,7 +139,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
log.info("[收到目录订阅]:但是解析失败 {}", new String(evt.getRequest().getRawContent()));
continue;
}
channel.setDeviceDbId(take.getDevice().getId());
channel.setDataDeviceId(take.getDevice().getId());
if (channel.getParentId() != null && channel.getParentId().equals(sipConfig.getId())) {
channel.setParentId(null);
}

View File

@ -106,63 +106,62 @@ public class MediaInfo {
}
}
JSONArray jsonArray = jsonObject.getJSONArray("tracks");
if (jsonArray.isEmpty()) {
return null;
}
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject trackJson = jsonArray.getJSONObject(i);
Integer channels = trackJson.getInteger("channels");
Integer codecId = trackJson.getInteger("codec_id");
Integer codecType = trackJson.getInteger("codec_type");
Integer sampleRate = trackJson.getInteger("sample_rate");
Integer height = trackJson.getInteger("height");
Integer width = trackJson.getInteger("width");
Integer fps = trackJson.getInteger("fps");
Integer loss = trackJson.getInteger("loss");
Integer frames = trackJson.getInteger("frames");
Long keyFrames = trackJson.getLongValue("key_frames");
Integer gop_interval_ms = trackJson.getInteger("gop_interval_ms");
Long gop_size = trackJson.getLongValue("gop_size");
if (!jsonArray.isEmpty()) {
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject trackJson = jsonArray.getJSONObject(i);
Integer channels = trackJson.getInteger("channels");
Integer codecId = trackJson.getInteger("codec_id");
Integer codecType = trackJson.getInteger("codec_type");
Integer sampleRate = trackJson.getInteger("sample_rate");
Integer height = trackJson.getInteger("height");
Integer width = trackJson.getInteger("width");
Integer fps = trackJson.getInteger("fps");
Integer loss = trackJson.getInteger("loss");
Integer frames = trackJson.getInteger("frames");
Long keyFrames = trackJson.getLongValue("key_frames");
Integer gop_interval_ms = trackJson.getInteger("gop_interval_ms");
Long gop_size = trackJson.getLongValue("gop_size");
Long duration = trackJson.getLongValue("duration");
if (channels != null) {
mediaInfo.setAudioChannels(channels);
}
if (sampleRate != null) {
mediaInfo.setAudioSampleRate(sampleRate);
}
if (height != null) {
mediaInfo.setHeight(height);
}
if (width != null) {
mediaInfo.setWidth(width);
}
if (fps != null) {
mediaInfo.setFps(fps);
}
if (loss != null) {
mediaInfo.setLoss(loss);
}
if (duration > 0L) {
mediaInfo.setDuration(duration);
}
if (codecId != null) {
switch (codecId) {
case 0:
mediaInfo.setVideoCodec("H264");
break;
case 1:
mediaInfo.setVideoCodec("H265");
break;
case 2:
mediaInfo.setAudioCodec("AAC");
break;
case 3:
mediaInfo.setAudioCodec("G711A");
break;
case 4:
mediaInfo.setAudioCodec("G711U");
break;
Long duration = trackJson.getLongValue("duration");
if (channels != null) {
mediaInfo.setAudioChannels(channels);
}
if (sampleRate != null) {
mediaInfo.setAudioSampleRate(sampleRate);
}
if (height != null) {
mediaInfo.setHeight(height);
}
if (width != null) {
mediaInfo.setWidth(width);
}
if (fps != null) {
mediaInfo.setFps(fps);
}
if (loss != null) {
mediaInfo.setLoss(loss);
}
if (duration > 0L) {
mediaInfo.setDuration(duration);
}
if (codecId != null) {
switch (codecId) {
case 0:
mediaInfo.setVideoCodec("H264");
break;
case 1:
mediaInfo.setVideoCodec("H265");
break;
case 2:
mediaInfo.setAudioCodec("AAC");
break;
case 3:
mediaInfo.setAudioCodec("G711A");
break;
case 4:
mediaInfo.setAudioCodec("G711U");
break;
}
}
}
}

View File

@ -179,15 +179,17 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaServer, app, stream);
if (mediaList != null) {
if (mediaList.getInteger("code") == 0) {
JSONArray data = mediaList.getJSONArray("data");
if (data == null) {
JSONArray dataArray = mediaList.getJSONArray("data");
if (dataArray == null) {
return streamInfoList;
}
JSONObject mediaJSON = data.getJSONObject(0);
MediaInfo mediaInfo = MediaInfo.getInstance(mediaJSON, mediaServer, userSetting.getServerId());
StreamInfo streamInfo = getStreamInfoByAppAndStream(mediaServer, app, stream, mediaInfo, callId, true);
if (streamInfo != null) {
streamInfoList.add(streamInfo);
for (int i = 0; i < dataArray.size(); i++) {
JSONObject mediaJSON = dataArray.getJSONObject(0);
MediaInfo mediaInfo = MediaInfo.getInstance(mediaJSON, mediaServer, userSetting.getServerId());
StreamInfo streamInfo = getStreamInfoByAppAndStream(mediaServer, mediaInfo.getApp(), mediaInfo.getStream(), mediaInfo, callId, true);
if (streamInfo != null) {
streamInfoList.add(streamInfo);
}
}
}
}

View File

@ -266,14 +266,14 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
}
@Override
public PageInfo<CommonGBChannel> queryChannelList(int page, int count, String query, Integer channelType, Boolean online, Integer planId, Boolean hasLink) {
public PageInfo<CommonGBChannel> queryChannelList(int page, int count, String query, Integer dataType, Boolean online, Integer planId, Boolean hasLink) {
PageHelper.startPage(page, count);
if (query != null) {
query = query.replaceAll("/", "//")
.replaceAll("%", "/%")
.replaceAll("_", "/_");
}
List<CommonGBChannel> all = channelMapper.queryForRecordPlanForWebList(planId, query, channelType, online, hasLink);
List<CommonGBChannel> all = channelMapper.queryForRecordPlanForWebList(planId, query, dataType, online, hasLink);
return new PageInfo<>(all);
}

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.common.SystemAllInfo;
import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper;

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.streamProxy.bean;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -72,7 +73,8 @@ public class StreamProxy extends CommonGBChannel {
if (ObjectUtils.isEmpty(this.getGbName())) {
this.setGbName( app+ "-" +stream);
}
this.setStreamProxyId(this.getId());
this.setDataType(ChannelDataType.STREAM_PROXY.value);
this.setDataDeviceId(this.getId());
return this;
}
}

View File

@ -1,5 +1,7 @@
package com.genersoft.iot.vmp.streamProxy.dao.provider;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import java.util.Map;
public class StreamProxyProvider {
@ -7,12 +9,13 @@ public class StreamProxyProvider {
public String getBaseSelectSql(){
return "SELECT " +
" st.*, " +
" st.id as stream_proxy_id, " +
ChannelDataType.STREAM_PROXY.value + " as data_type, " +
" st.id as data_device_id, " +
" wdc.*, " +
" wdc.id as gb_id" +
" FROM wvp_stream_proxy st " +
" LEFT join wvp_device_channel wdc " +
" on st.id = wdc.stream_proxy_id ";
" on wdc.data_type = 3 and st.id = wdc.data_device_id ";
}
public String select(Map<String, Object> params ){
@ -20,7 +23,7 @@ public class StreamProxyProvider {
}
public String selectForPushingInMediaServer(Map<String, Object> params ){
return getBaseSelectSql() + " WHERE st.pulling=1 and st.media_server_id=#{mediaServerId} order by st.create_time desc";
return getBaseSelectSql() + " WHERE st.pulling=true and st.media_server_id=#{mediaServerId} order by st.create_time desc";
}
public String selectOneByAppAndStream(Map<String, Object> params ){

View File

@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.streamProxy.service.impl;
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
@ -177,7 +178,8 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
streamProxy.setCreateTime(DateUtil.getNow());
streamProxy.setUpdateTime(DateUtil.getNow());
streamProxyMapper.add(streamProxy);
streamProxy.setStreamProxyId(streamProxy.getId());
streamProxy.setDataType(ChannelDataType.STREAM_PROXY.value);
streamProxy.setDataDeviceId(streamProxy.getId());
}
@Override

View File

@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.streamPush.bean;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
import com.genersoft.iot.vmp.utils.DateUtil;
@ -78,6 +79,8 @@ public class StreamPush extends CommonGBChannel implements Comparable<StreamPush
private String uniqueKey;
private Integer dataType = ChannelDataType.STREAM_PUSH.value;
@Override
public int compareTo(@NotNull StreamPush streamPushItem) {
return Long.valueOf(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(this.createTime)
@ -115,7 +118,8 @@ public class StreamPush extends CommonGBChannel implements Comparable<StreamPush
if (ObjectUtils.isEmpty(this.getGbName())) {
this.setGbName( app+ "-" +stream);
}
this.setStreamPushId(this.getId());
this.setDataType(ChannelDataType.STREAM_PUSH.value);
this.setDataDeviceId(this.getId());
return this;
}

View File

@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.streamPush.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.conf.security.JwtUtils;
@ -28,7 +29,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
@ -215,7 +215,8 @@ public class StreamPushController {
if (!streamPushService.add(stream)) {
throw new ControllerException(ErrorCode.ERROR100);
}
stream.setStreamPushId(stream.getId());
stream.setDataType(ChannelDataType.STREAM_PUSH.value);
stream.setDataDeviceId(stream.getId());
return stream;
}

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.streamPush.dao;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
import org.apache.ibatis.annotations.*;
@ -13,6 +14,8 @@ import java.util.Set;
@Repository
public interface StreamPushMapper {
Integer dataType = ChannelDataType.GB28181.value;
@Insert("INSERT INTO wvp_stream_push (app, stream, media_server_id, server_id, push_time, update_time, create_time, pushing, start_offline_push) VALUES" +
"(#{app}, #{stream}, #{mediaServerId} , #{serverId} , #{pushTime} ,#{updateTime}, #{createTime}, #{pushing}, #{startOfflinePush})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@ -39,13 +42,13 @@ public interface StreamPushMapper {
@Select(value = {" <script>" +
" SELECT " +
" st.*, " +
" st.id as stream_push_id, " +
" st.id as data_device_id, " +
" wdc.*, " +
" wdc.id as gb_id" +
" from " +
" wvp_stream_push st " +
" LEFT join wvp_device_channel wdc " +
" on st.id = wdc.stream_push_id " +
" on wdc.data_type = 2 and st.id = wdc.data_device_id " +
" WHERE " +
" 1=1 " +
" <if test='query != null'> AND (st.app LIKE concat('%',#{query},'%') escape '/' OR st.stream LIKE concat('%',#{query},'%') escape '/' " +
@ -57,7 +60,7 @@ public interface StreamPushMapper {
" </script>"})
List<StreamPush> selectAll(@Param("query") String query, @Param("pushing") Boolean pushing, @Param("mediaServerId") String mediaServerId);
@Select("SELECT st.*, st.id as stream_push_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on st.id = wdc.stream_push_id WHERE st.app=#{app} AND st.stream=#{stream}")
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.app=#{app} AND st.stream=#{stream}")
StreamPush selectByAppAndStream(@Param("app") String app, @Param("stream") String stream);
@Insert("<script>" +
@ -70,10 +73,10 @@ public interface StreamPushMapper {
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
int addAll(List<StreamPush> streamPushItems);
@Select("SELECT st.*, st.id as stream_push_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on st.id = wdc.stream_push_id WHERE st.media_server_id=#{mediaServerId}")
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.media_server_id=#{mediaServerId}")
List<StreamPush> selectAllByMediaServerId(String mediaServerId);
@Select("SELECT st.*, st.id as stream_push_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on st.id = wdc.stream_push_id WHERE st.media_server_id=#{mediaServerId} and wdc.gb_device_id is null")
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.media_server_id=#{mediaServerId} and wdc.gb_device_id is null")
List<StreamPush> selectAllByMediaServerIdWithOutGbID(String mediaServerId);
@Update("UPDATE wvp_stream_push " +
@ -83,7 +86,7 @@ public interface StreamPushMapper {
@Select("<script> "+
"SELECT st.*, st.id as stream_push_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on st.id = wdc.stream_push_id " +
"SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id " +
"where (st.app, st.stream) in (" +
"<foreach collection='offlineStreams' item='item' separator=','>" +
"(#{item.app}, #{item.stream}) " +
@ -106,21 +109,21 @@ public interface StreamPushMapper {
@MapKey("uniqueKey")
@Select("SELECT CONCAT(wsp.app, wsp.stream) as unique_key, wsp.*, wsp.* , wdc.id as gb_id " +
" from wvp_stream_push wsp " +
" LEFT join wvp_device_channel wdc on wsp.id = wdc.stream_push_id")
" LEFT join wvp_device_channel wdc on wdc.data_type = 2 and wsp.id = wdc.data_device_id")
Map<String, StreamPush> getAllAppAndStreamMap();
@MapKey("gbDeviceId")
@Select("SELECT wdc.gb_device_id, wsp.id as stream_push_id, wsp.*, wsp.* , wdc.id as gb_id " +
@Select("SELECT wdc.gb_device_id, wsp.id as data_device_id, wsp.*, wsp.* , wdc.id as gb_id " +
" from wvp_stream_push wsp " +
" LEFT join wvp_device_channel wdc on wsp.id = wdc.stream_push_id")
" LEFT join wvp_device_channel wdc on wdc.data_type = 2 and wsp.id = wdc.data_device_id")
Map<String, StreamPush> getAllGBId();
@Select("SELECT st.*, st.id as stream_push_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on st.id = wdc.stream_push_id WHERE st.id=#{id}")
@Select("SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id WHERE st.id=#{id}")
StreamPush queryOne(@Param("id") int id);
@Select("<script> "+
"SELECT st.*, st.id as stream_push_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on st.id = wdc.stream_push_id " +
"SELECT st.*, st.id as data_device_id, wdc.*, wdc.id as gb_id FROM wvp_stream_push st LEFT join wvp_device_channel wdc on wdc.data_type = 2 and st.id = wdc.data_device_id " +
" where st.id in (" +
" <foreach collection='ids' item='item' separator=','>" +
" #{item} " +

View File

@ -4,6 +4,8 @@ import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.common.SystemAllInfo;
import com.genersoft.iot.vmp.common.VersionPo;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.common.enums.DeviceControlType;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.VersionInfo;
@ -42,10 +44,7 @@ import oshi.software.os.OperatingSystem;
import java.io.File;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@SuppressWarnings("rawtypes")
@Tag(name = "服务控制")
@ -346,6 +345,20 @@ public class ServerController {
return result;
}
@GetMapping(value = "/channel/datatype")
@ResponseBody
@Operation(summary = "获取系统接入的数据类型")
public List<Map<String, Object>> getDataType() {
List<Map<String, Object>> result = new LinkedList<>();
for (ChannelDataType item : ChannelDataType.values()) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("key", item.desc);
map.put("value", item.value);
result.add(map);
}
return result;
}
/**
*
*/

View File

@ -153,7 +153,6 @@ export default {
onSubmit: function () {
console.log(typeof this.streamProxy.noneReader)
this.saveLoading = true;
this.noneReaderHandler();
if (this.streamProxy.id) {
this.$axios({

View File

@ -204,6 +204,7 @@
// this.$refs.streamProxyEdit.openDialog(null, this.initData)
this.streamProxy = {
type: "default",
dataType: 3,
noneReader: 1,
enable: true,
enableAudio: true,

View File

@ -206,7 +206,7 @@
<div style="float: right;">
<el-button type="primary" @click="onSubmit"></el-button>
<el-button v-if="cancel" @click="cancelSubmit"></el-button>
<el-button v-if="form.gbDeviceDbId" @click="reset"></el-button>
<el-button v-if="form.dataType === 1" @click="reset"></el-button>
</div>
</div>

View File

@ -26,9 +26,9 @@
<el-select size="mini" style="width: 8rem; margin-right: 1rem;" @change="getChannelList" v-model="channelType" placeholder="请选择"
default-first-option>
<el-option label="全部" value=""></el-option>
<el-option label="国标设备" :value="0"></el-option>
<el-option label="推流设备" :value="1"></el-option>
<el-option label="拉流代理" :value="2"></el-option>
<el-option label="国标设备" :value="1"></el-option>
<el-option label="推流设备" :value="2"></el-option>
<el-option label="拉流代理" :value="3"></el-option>
</el-select>
<el-button size="mini" :loading="getChannelListLoading"
@click="getChannelList()">刷新</el-button>
@ -49,9 +49,9 @@
<el-table-column label="类型" min-width="100">
<template v-slot:default="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" effect="plain" v-if="scope.row.gbDeviceDbId"></el-tag>
<el-tag size="medium" effect="plain" type="success" v-if="scope.row.streamPushId"></el-tag>
<el-tag size="medium" effect="plain" type="warning" v-if="scope.row.streamProxyId"></el-tag>
<el-tag size="medium" effect="plain" v-if="scope.row.dataType === 1"></el-tag>
<el-tag size="medium" effect="plain" type="success" v-else-if="scope.row.dataType === 2" >推流设备</el-tag>
<el-tag size="medium" effect="plain" type="warning" v-else-if="scope.row.dataType === 3">拉流代理</el-tag>
</div>
</template>
</el-table-column>
@ -86,6 +86,7 @@
<script>
export default {
name: "gbChannelSelect",
props: ['dataType', "selected"],

View File

@ -25,9 +25,9 @@
<el-select size="mini" style="width: 8rem; margin-right: 1rem;" @change="search" v-model="channelType" placeholder="请选择"
default-first-option>
<el-option label="全部" value=""></el-option>
<el-option label="国标设备" :value="0"></el-option>
<el-option label="推流设备" :value="1"></el-option>
<el-option label="拉流代理" :value="2"></el-option>
<el-option label="国标设备" :value="1"></el-option>
<el-option label="推流设备" :value="2"></el-option>
<el-option label="拉流代理" :value="3"></el-option>
</el-select>
<el-button v-if="hasLink !=='true'" size="mini" type="primary" @click="add()">
添加
@ -56,9 +56,9 @@
<el-table-column label="类型" min-width="100">
<template v-slot:default="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" effect="plain" v-if="scope.row.gbDeviceDbId"></el-tag>
<el-tag size="medium" effect="plain" type="success" v-if="scope.row.streamPushId"></el-tag>
<el-tag size="medium" effect="plain" type="warning" v-if="scope.row.streamProxyId"></el-tag>
<el-tag size="medium" effect="plain" v-if="scope.row.dataType === 1"></el-tag>
<el-tag size="medium" effect="plain" type="success" v-else-if="scope.row.dataType === 2" >推流设备</el-tag>
<el-tag size="medium" effect="plain" type="warning" v-else-if="scope.row.dataType === 3">拉流代理</el-tag>
</div>
</template>
</el-table-column>

View File

@ -23,9 +23,9 @@
<el-select size="mini" style="width: 8rem; margin-right: 1rem;" @change="search" v-model="channelType" placeholder="请选择"
default-first-option>
<el-option label="全部" value=""></el-option>
<el-option label="国标设备" :value="0"></el-option>
<el-option label="推流设备" :value="1"></el-option>
<el-option label="拉流代理" :value="2"></el-option>
<el-option label="国标设备" :value="1"></el-option>
<el-option label="推流设备" :value="2"></el-option>
<el-option label="拉流代理" :value="3"></el-option>
</el-select>
<el-button v-if="hasShare !=='true'" size="mini" type="primary" @click="add()">
添加
@ -74,9 +74,9 @@
<el-table-column label="类型" min-width="100">
<template v-slot:default="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" effect="plain" v-if="scope.row.gbDeviceDbId"></el-tag>
<el-tag size="medium" effect="plain" type="success" v-if="scope.row.streamPushId"></el-tag>
<el-tag size="medium" effect="plain" type="warning" v-if="scope.row.streamProxyId"></el-tag>
<el-tag size="medium" effect="plain" v-if="scope.row.dataType === 1"></el-tag>
<el-tag size="medium" effect="plain" type="success" v-else-if="scope.row.dataType === 2" >推流设备</el-tag>
<el-tag size="medium" effect="plain" type="warning" v-else-if="scope.row.dataType === 3">拉流代理</el-tag>
</div>
</template>
</el-table-column>

View File

@ -32,9 +32,9 @@
v-model="channelType" placeholder="请选择"
default-first-option>
<el-option label="全部" value=""></el-option>
<el-option label="国标设备" :value="0"></el-option>
<el-option label="推流设备" :value="1"></el-option>
<el-option label="拉流代理" :value="2"></el-option>
<el-option label="国标设备" :value="1"></el-option>
<el-option label="推流设备" :value="2"></el-option>
<el-option label="拉流代理" :value="3"></el-option>
</el-select>
<el-button size="mini" type="primary" @click="add()">
添加通道
@ -60,9 +60,9 @@
<el-table-column label="类型" min-width="100">
<template v-slot:default="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" effect="plain" v-if="scope.row.gbDeviceDbId"></el-tag>
<el-tag size="medium" effect="plain" type="success" v-if="scope.row.streamPushId"></el-tag>
<el-tag size="medium" effect="plain" type="warning" v-if="scope.row.streamProxyId"></el-tag>
<el-tag size="medium" effect="plain" v-if="scope.row.dataType === 1"></el-tag>
<el-tag size="medium" effect="plain" type="success" v-else-if="scope.row.dataType === 2" >推流设备</el-tag>
<el-tag size="medium" effect="plain" type="warning" v-else-if="scope.row.dataType === 3">拉流代理</el-tag>
</div>
</template>
</el-table-column>

View File

@ -31,9 +31,9 @@
<el-select size="mini" style="width: 8rem; margin-right: 1rem;" @change="getChannelList" v-model="channelType" placeholder="请选择"
default-first-option>
<el-option label="全部" value=""></el-option>
<el-option label="国标设备" :value="0"></el-option>
<el-option label="推流设备" :value="1"></el-option>
<el-option label="拉流代理" :value="2"></el-option>
<el-option label="国标设备" :value="1"></el-option>
<el-option label="推流设备" :value="2"></el-option>
<el-option label="拉流代理" :value="3"></el-option>
</el-select>
<el-button size="mini" type="primary" @click="add()">
添加通道
@ -59,9 +59,9 @@
<el-table-column label="类型" min-width="100">
<template v-slot:default="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" effect="plain" v-if="scope.row.gbDeviceDbId"></el-tag>
<el-tag size="medium" effect="plain" type="success" v-if="scope.row.streamPushId"></el-tag>
<el-tag size="medium" effect="plain" type="warning" v-if="scope.row.streamProxyId"></el-tag>
<el-tag size="medium" effect="plain" v-if="scope.row.dataType === 1"></el-tag>
<el-tag size="medium" effect="plain" type="success" v-else-if="scope.row.dataType === 2" >推流设备</el-tag>
<el-tag size="medium" effect="plain" type="warning" v-else-if="scope.row.dataType === 3">拉流代理</el-tag>
</div>
</template>
</el-table-column>

View File

@ -72,7 +72,6 @@ create table wvp_device_mobile_position
create table wvp_device_channel
(
id serial primary key,
device_db_id integer,
device_id character varying(50),
name character varying(255),
manufacturer character varying(50),
@ -150,16 +149,11 @@ create table wvp_device_channel
gb_svc_space_support_mod integer,
gb_svc_time_support_mode integer,
record_plan_id integer,
stream_push_id integer,
stream_proxy_id integer,
constraint uk_wvp_device_channel_unique_device_channel unique (device_db_id, device_id),
constraint uk_wvp_unique_channel unique (gb_device_id),
constraint uk_wvp_unique_stream_push_id unique (stream_push_id),
constraint uk_wvp_unique_stream_proxy_id unique (stream_proxy_id)
data_type integer not null,
data_device_id integer not null,
constraint uk_wvp_unique_channel unique (gb_device_id)
);
create index uk_wvp_device_db_id on wvp_device_channel (device_db_id);
create table wvp_media_server
(
id character varying(255) primary key,

View File

@ -88,7 +88,6 @@ create table wvp_gb_stream
create table wvp_device_channel
(
id serial primary key,
device_db_id integer,
device_id character varying(50),
name character varying(255),
manufacturer character varying(50),
@ -166,17 +165,11 @@ create table wvp_device_channel
gb_svc_space_support_mod integer,
gb_svc_time_support_mode integer,
record_plan_id integer,
stream_push_id integer,
stream_proxy_id integer,
constraint uk_wvp_device_channel_unique_device_channel unique (device_db_id, device_id),
constraint uk_wvp_unique_channel unique (gb_device_id),
constraint uk_wvp_unique_stream_push_id unique (stream_push_id),
constraint uk_wvp_unique_stream_proxy_id unique (stream_proxy_id)
data_type integer not null,
data_device_id integer not null,
constraint uk_wvp_unique_channel unique (gb_device_id)
);
create index uk_wvp_device_db_id on wvp_device_channel (device_db_id);
create table wvp_media_server
(
id character varying(255) primary key,

View File

@ -0,0 +1,31 @@
/*
* 20241222
*/
alter table wvp_device_channel
drop index uk_wvp_device_channel_unique_device_channel;
alter table wvp_device_channel
drop index uk_wvp_unique_stream_push_id;
alter table wvp_device_channel
drop index uk_wvp_unique_stream_proxy_id;
alter table wvp_device_channel
add data_type integer not null;
alter table wvp_device_channel
add data_device_id integer not null;
update wvp_device_channel wdc INNER JOIN
(SELECT id, device_db_id from wvp_device_channel where device_db_id is not null ) ct on ct.id = wdc.id
set wdc.data_type = 1, wdc.data_device_id = ct.device_db_id where wdc.device_db_id is not null;
update wvp_device_channel wdc INNER JOIN
(SELECT id, stream_push_id from wvp_device_channel where stream_push_id is not null ) ct on ct.id = wdc.id
set wdc.data_type = 2, wdc.data_device_id = ct.stream_push_id where wdc.stream_push_id is not null;
update wvp_device_channel wdc INNER JOIN
(SELECT id, stream_proxy_id from wvp_device_channel where stream_proxy_id is not null ) ct on ct.id = wdc.id
set wdc.data_type = 3, wdc.data_device_id = ct.stream_proxy_id where wdc.stream_proxy_id is not null;
alter table wvp_device_channel drop device_db_id;
alter table wvp_device_channel drop stream_push_id;
alter table wvp_device_channel drop stream_proxy_id;

View File

@ -0,0 +1,29 @@
/*
* 20241222
*/
alter table wvp_device_channel
drop index uk_wvp_device_channel_unique_device_channel;
alter table wvp_device_channel
drop index uk_wvp_unique_stream_push_id;
alter table wvp_device_channel
drop index uk_wvp_unique_stream_proxy_id;
alter table wvp_device_channel
add data_type integer not null;
alter table wvp_device_channel
add data_device_id integer not null;
update wvp_device_channel wdc
set data_type = 1, data_device_id = (SELECT device_db_id from wvp_device_channel where device_db_id is not null and id = wdc.id ) where device_db_id is not null;
update wvp_device_channel wdc
set data_type = 2, data_device_id = (SELECT stream_push_id from wvp_device_channel where stream_push_id is not null and id = wdc.id ) where stream_push_id is not null;
update wvp_device_channel wdc
set data_type = 1, data_device_id = (SELECT stream_proxy_id from wvp_device_channel where stream_proxy_id is not null and id = wdc.id ) where stream_proxy_id is not null;
alter table wvp_device_channel drop device_db_id;
alter table wvp_device_channel drop stream_push_id;
alter table wvp_device_channel drop stream_proxy_id;