diff --git a/src/main/java/com/genersoft/iot/vmp/common/enums/ChannelDataType.java b/src/main/java/com/genersoft/iot/vmp/common/enums/ChannelDataType.java index 07e3a92a..5ca59025 100644 --- a/src/main/java/com/genersoft/iot/vmp/common/enums/ChannelDataType.java +++ b/src/main/java/com/genersoft/iot/vmp/common/enums/ChannelDataType.java @@ -10,7 +10,6 @@ import lombok.Getter; public enum ChannelDataType { GB28181(1,"国标28181"), - STREAM_PUSH(2,"推流设备"), STREAM_PROXY(3,"拉流代理"); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java index 28eb01a8..924a8ca7 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java @@ -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) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java index 5e9ee17e..226e51d8 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java @@ -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)) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java index 507f8dd8..a00ef36e 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java @@ -20,8 +20,8 @@ public interface CommonGBChannelMapper { @Insert(" "}) - 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") @@ -252,13 +252,13 @@ public interface CommonGBChannelMapper { @SelectProvider(type = ChannelProvider.class, method = "queryListByCivilCode") List 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 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); @@ -311,14 +311,14 @@ public interface CommonGBChannelMapper { List queryByCivilCode(@Param("civilCode") String civilCode); @SelectProvider(type = ChannelProvider.class, method = "queryByGbDeviceIds") - List queryByGbDeviceIds(List deviceIds); + List queryByGbDeviceIds(@Param("dataType") Integer dataType, List deviceIds); @Select(value = {" "}) - List queryByGbDeviceIdsForIds(List deviceIds); + List queryByGbDeviceIdsForIds(@Param("dataType") Integer dataType, List deviceIds); @SelectProvider(type = ChannelProvider.class, method = "queryByGroupList") List queryByGroupList(List groupList); @@ -440,19 +440,20 @@ public interface CommonGBChannelMapper { int updateCivilCodeByChannelList(@Param("civilCode") String civilCode, List channelList); @SelectProvider(type = ChannelProvider.class, method = "queryListByStreamPushList") - List queryListByStreamPushList(List streamPushList); + List queryListByStreamPushList(@Param("dataType") Integer dataType, List streamPushList); @Update(value = {" "}) - void updateGpsByDeviceIdForStreamPush(List channels); + void updateGpsByDeviceIdForStreamPush(@Param("dataType") Integer dataType, List channels); @SelectProvider(type = ChannelProvider.class, method = "queryList") - List queryList(@Param("query") String query, @Param("online") Boolean online, @Param("hasRecordPlan") Boolean hasRecordPlan, @Param("channelType") Integer channelType); + List queryList(@Param("query") String query, @Param("online") Boolean online, + @Param("hasRecordPlan") Boolean hasRecordPlan, @Param("dataType") Integer dataType); @Update(value = {" ") List 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") diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java index 068eb4b7..b33a7dc0 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java @@ -21,13 +21,13 @@ public interface DeviceChannelMapper { @Insert(""}) + " ") List queryChaneIdListByDeviceDbIds(List 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=#{deviceId}") + 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 " + " AND de.device_id = #{deviceId} " + " AND (dc.device_id LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%') " + " AND dc.parent_id=#{parentChannelId} " + @@ -155,7 +156,7 @@ public interface DeviceChannelMapper { " " + "ORDER BY dc.device_id ASC" + " "}) - List queryChannelsWithDeviceInfo(@Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List channelIds); + List queryChannelsWithDeviceInfo( @Param("deviceId") String deviceId, @Param("parentChannelId") String parentChannelId, @Param("query") String query, @Param("hasSubChannel") Boolean hasSubChannel, @Param("online") Boolean online, @Param("channelIds") List 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 " + " " + "AND " + "(COALESCE(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%') " + @@ -195,14 +196,14 @@ public interface DeviceChannelMapper { @Insert(""}) int batchUpdateForNotify(List 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 = {" "}) int batchUpdateStatus(List channels); @@ -427,7 +430,7 @@ public interface DeviceChannelMapper { ", latitude=#{item.latitude}" + ", gps_time=#{item.gpsTime}" + "WHERE id=#{item.id}" + - "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}" + "" + ""}) void batchUpdatePosition(List channelList); @@ -438,7 +441,7 @@ public interface DeviceChannelMapper { @Select(value = {" "}) - 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 { "") void updateStreamGPS(List 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 = {" "}) - DeviceChannel getOneBySourceChannelId(int deviceDbId, String channelId); + DeviceChannel getOneBySourceChannelId(@Param("dataDeviceId") int dataDeviceId, @Param("channelId") String channelId); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java index abac64bb..9eec2a9a 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceMapper.java @@ -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, " + @@ -167,13 +167,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" + - " where de.on_line=${onLine}"+ + " where de.on_line=${online}"+ " order by de.create_time desc "+ " " ) - List getDevices(Boolean onLine); + List getDevices(@Param("dataType") Integer dataType, @Param("online") Boolean online); @Delete("DELETE FROM wvp_device WHERE device_id=#{deviceId}") int del(String deviceId); @@ -326,7 +326,7 @@ 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" + " where 1 = 1 "+ " AND de.on_line=${status}"+ @@ -337,7 +337,7 @@ public interface DeviceMapper { " " + " order by create_time desc "+ " ") - List getDeviceList(@Param("query") String query, @Param("status") Boolean status); + List 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); @@ -345,10 +345,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); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java index d23eec4b..52c12936 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java @@ -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 { " AND coalesce(wpgc.status, wdc.gb_status, wdc.status) = 'OFF' " + " AND wpgc.platform_id = #{platformId} " + " AND wpgc.platform_id is null " + - " AND wdc.device_db_id is not null " + - " AND wdc.stream_push_id is not null " + - " AND wdc.stream_proxy_id is not null " + + " AND wdc.data_type = #{dataType} " + "") List 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(""}) List 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(" + diff --git a/web_src/src/components/dialog/GbChannelSelect.vue b/web_src/src/components/dialog/GbChannelSelect.vue index 258e313e..6c781ce8 100644 --- a/web_src/src/components/dialog/GbChannelSelect.vue +++ b/web_src/src/components/dialog/GbChannelSelect.vue @@ -23,13 +23,7 @@ 类型: - - - - - - + 刷新 确 定 @@ -49,9 +43,9 @@ - 国标设备 - 推流设备 - 拉流代理 + 国标设备 + 推流设备 + 拉流代理 @@ -86,8 +80,11 @@