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
new file mode 100644
index 00000000..5ca59025
--- /dev/null
+++ b/src/main/java/com/genersoft/iot/vmp/common/enums/ChannelDataType.java
@@ -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;
+ }
+}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java
index ea606692..43c22cb2 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/CommonGBChannel.java
@@ -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;
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 64f7dad8..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")
@@ -250,21 +250,15 @@ public interface CommonGBChannelMapper {
""})
void batchDelete(List 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 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);
@@ -317,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);
@@ -446,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")
+ CommonGBChannel queryByDataId(@Param("dataType") Integer dataType, @Param("dataDeviceId") Integer dataDeviceId);
}
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..f700dad8 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=#{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 " +
" 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 b33f906b..e1ac39e2 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, " +
@@ -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" +
- " 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);
@@ -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 "+
" AND de.on_line=${status}"+
@@ -377,7 +377,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);
@@ -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);
}
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("