648540858 1 gadu atpakaļ
vecāks
revīzija
d2654660cb
18 mainītis faili ar 153 papildinājumiem un 219 dzēšanām
  1. 3 0
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
  2. 6 1
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/Region.java
  3. 1 51
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/RegionTree.java
  4. 5 25
      src/main/java/com/genersoft/iot/vmp/gb28181/controller/RegionController.java
  5. 4 6
      src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java
  6. 14 4
      src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java
  7. 25 0
      src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java
  8. 22 24
      src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java
  9. 13 36
      src/main/java/com/genersoft/iot/vmp/gb28181/dao/RegionMapper.java
  10. 14 14
      src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java
  11. 2 7
      src/main/java/com/genersoft/iot/vmp/gb28181/service/IRegionService.java
  12. 0 16
      src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java
  13. 10 4
      src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GroupServiceImpl.java
  14. 13 18
      src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/RegionServiceImpl.java
  15. 2 0
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java
  16. 15 11
      web_src/src/components/common/RegionTree.vue
  17. 3 2
      web_src/src/components/dialog/regionCode.vue
  18. 1 0
      数据库/2.7.2-重构/初始化-mysql-2.7.2.sql

+ 3 - 0
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java

@@ -188,6 +188,9 @@ public class DeviceChannel extends CommonGBChannel {
 			"用于选择码流时组成码流标识。默认为null,不设置。可选值: stream/streamnumber/streamprofile/streamMode")
 	private String streamIdentification;
 
+	@Schema(description = "通道类型, 默认0, 0: 普通通道,1 行政区划 2 业务分组/虚拟组织")
+	private int channelType;
+
 	public void setPtzType(int ptzType) {
 		this.ptzType = ptzType;
 		switch (ptzType) {

+ 6 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Region.java

@@ -1,7 +1,6 @@
 package com.genersoft.iot.vmp.gb28181.bean;
 
 import com.genersoft.iot.vmp.common.CivilCodePo;
-import com.genersoft.iot.vmp.jt1078.proc.request.Re;
 import com.genersoft.iot.vmp.utils.CivilCodeUtil;
 import com.genersoft.iot.vmp.utils.DateUtil;
 import io.swagger.v3.oas.annotations.media.Schema;
@@ -32,6 +31,12 @@ public class Region implements Comparable<Region>{
     @Schema(description = "区域名称")
     private String name;
 
+    /**
+     * 父区域国标ID
+     */
+    @Schema(description = "父区域ID")
+    private Integer parentId;
+
     /**
      * 父区域国标ID
      */

+ 1 - 51
src/main/java/com/genersoft/iot/vmp/gb28181/bean/RegionTree.java

@@ -8,61 +8,11 @@ import lombok.Data;
  */
 @Data
 @Schema(description = "区域树")
-public class RegionTree {
-
-    /**
-     * 数据库Id
-     */
-    @Schema(description = "数据库Id")
-    private int dbId;
-
-    /**
-     * 区域国标编号
-     */
-    @Schema(description = "区域国标编号")
-    private String id;
-
-    /**
-     * 区域名称
-     */
-    @Schema(description = "区域名称")
-    private String label;
-
-    /**
-     * 父区域国标ID
-     */
-    @Schema(description = "父区域国标ID")
-    private String parentDeviceId;
+public class RegionTree extends Region {
 
     @Schema(description = "是否有子节点")
     private boolean isLeaf;
 
     @Schema(description = "类型, 行政区划:0 摄像头: 1")
     private int type;
-
-
-
-    public static RegionTree getInstance(Region region) {
-        RegionTree regionTree = new RegionTree();
-        regionTree.setId(region.getDeviceId());
-        regionTree.setLabel(region.getName());
-        regionTree.setParentDeviceId(region.getParentDeviceId());
-        regionTree.setType(0);
-        if (region.getDeviceId().length() < 8) {
-            regionTree.setLeaf(false);
-        }else {
-            regionTree.setLeaf(true);
-        }
-        return regionTree;
-    }
-
-    public static RegionTree getInstance(CommonGBChannel channel) {
-        RegionTree regionTree = new RegionTree();
-        regionTree.setId(channel.getGbDeviceId());
-        regionTree.setLabel(channel.getGbName());
-        regionTree.setParentDeviceId(channel.getGbCivilCode());
-        regionTree.setType(1);
-        regionTree.setLeaf(true);
-        return regionTree;
-    }
 }

+ 5 - 25
src/main/java/com/genersoft/iot/vmp/gb28181/controller/RegionController.java

@@ -57,11 +57,8 @@ public class RegionController {
     @GetMapping("/tree/list")
     public List<RegionTree> queryForTree(
             @RequestParam(required = false) String query,
-            @RequestParam(required = false) String parent
+            @RequestParam(required = false) Integer parent
     ){
-        if (ObjectUtils.isEmpty(parent)) {
-            parent = null;
-        }
         if (ObjectUtils.isEmpty(query)) {
             query = null;
         }
@@ -77,34 +74,17 @@ public class RegionController {
     }
 
     @Operation(summary = "删除区域")
-    @Parameter(name = "deviceId", description = "区域编码", required = true)
+    @Parameter(name = "id", description = "区域ID", required = true)
     @ResponseBody
     @DeleteMapping("/delete")
-    public void delete(String deviceId){
-        Assert.hasLength(deviceId, "区域编码(deviceId)不需要存在");
-        boolean result = regionService.deleteByDeviceId(deviceId);
+    public void delete(Integer id){
+        Assert.notNull(id, "区域ID需要存在");
+        boolean result = regionService.deleteByDeviceId(id);
         if (!result) {
             throw new ControllerException(ErrorCode.ERROR100.getCode(), "移除失败");
         }
     }
 
-    @Operation(summary = "分页区域子节点")
-    @Parameter(name = "regionParentId", description = "行政区划父节点编号", required = true)
-    @Parameter(name = "page", description = "当前页", required = true)
-    @Parameter(name = "count", description = "每页查询数量", required = true)
-    @ResponseBody
-    @GetMapping("/child/list")
-    public PageInfo<Region> queryChildRegionList(
-            @RequestParam(required = true) String regionParentId,
-            @RequestParam(required = true) int page,
-            @RequestParam(required = true) int count
-    ){
-        if (ObjectUtils.isEmpty(regionParentId.trim())) {
-            regionParentId = null;
-        }
-        return regionService.queryChildRegionList(regionParentId, page, count);
-    }
-
     @Operation(summary = "根据区域Id查询区域")
     @Parameter(name = "regionDeviceId", description = "行政区划节点编号", required = true)
     @ResponseBody

+ 4 - 6
src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java

@@ -262,17 +262,15 @@ public interface CommonGBChannelMapper {
 
     @Select("<script>" +
             " select " +
-            "    coalesce(gb_device_id, device_id) as id," +
-            "    coalesce(gb_name, name) as label, " +
-            "    id as db_id, " +
+            "    *, " +
             "    1 as type, " +
             "    true as is_leaf " +
             " from wvp_device_channel " +
-            " where coalesce(gb_civil_code, civil_code) = #{parent} " +
+            " where coalesce(gb_civil_code, civil_code) = #{parentDeviceId} " +
             " <if test='query != null'> AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') " +
             " OR coalesce(gb_name, name) LIKE concat('%',#{query},'%'))</if> " +
             " </script>")
-    List<RegionTree> queryForRegionTreeByCivilCode(@Param("query") String query, @Param("parent") String parent);
+    List<RegionTree> queryForRegionTreeByCivilCode(@Param("query") String query, @Param("parentDeviceId") String parentDeviceId);
 
     @Update(value = {" <script>" +
             " UPDATE wvp_device_channel " +
@@ -351,7 +349,7 @@ public interface CommonGBChannelMapper {
             "    1 as type, " +
             "    true as is_leaf " +
             " from wvp_device_channel " +
-            " where coalesce(gb_parent_id, parent_id) = #{parent} " +
+            " where channel_type = 0 and coalesce(gb_parent_id, parent_id) = #{parent} " +
             " <if test='query != null'> AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') " +
             " OR coalesce(gb_name, name) LIKE concat('%',#{query},'%'))</if> " +
             " </script>")

+ 14 - 4
src/main/java/com/genersoft/iot/vmp/gb28181/dao/DeviceChannelMapper.java

@@ -20,12 +20,12 @@ public interface DeviceChannelMapper {
             "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) " +
+            "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}," +
             "#{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}," +
-            " #{svcTimeSupportMode}, #{createTime}, #{updateTime}, #{subCount}, #{streamId}, #{hasAudio}, #{gpsTime}, #{streamIdentification})")
+            " #{svcTimeSupportMode}, #{createTime}, #{updateTime}, #{subCount}, #{streamId}, #{hasAudio}, #{gpsTime}, #{streamIdentification}, #{channelType})")
     @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
     int add(DeviceChannel channel);
 
@@ -72,6 +72,7 @@ public interface DeviceChannelMapper {
             ", has_audio=#{hasAudio}" +
             ", gps_time=#{gpsTime}" +
             ", stream_identification=#{streamIdentification}" +
+            ", channel_type=#{channelType}" +
             " WHERE id=#{id}" +
             " </script>"})
     int update(DeviceChannel channel);
@@ -127,6 +128,7 @@ public interface DeviceChannelMapper {
             " dc.has_audio,\n" +
             " dc.gps_time,\n" +
             " dc.stream_identification,\n" +
+            " dc.channel_type,\n" +
             " coalesce(dc.gb_device_id, dc.device_id) as device_id,\n" +
             " coalesce(dc.gb_name, dc.name) as name,\n" +
             " coalesce(dc.gb_manufacturer, dc.manufacturer) as manufacturer,\n" +
@@ -192,6 +194,7 @@ public interface DeviceChannelMapper {
             " has_audio,\n" +
             " gps_time,\n" +
             " stream_identification,\n" +
+            " channel_type,\n" +
             " coalesce(gb_device_id, device_id) as device_id,\n" +
             " coalesce(gb_name, name) as name,\n" +
             " coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
@@ -264,6 +267,7 @@ public interface DeviceChannelMapper {
             " dc.has_audio,\n" +
             " dc.gps_time,\n" +
             " dc.stream_identification,\n" +
+            " dc.channel_type,\n" +
             " coalesce(dc.gb_device_id, dc.device_id) as device_id,\n" +
             " coalesce(dc.gb_name, dc.name) as name,\n" +
             " coalesce(dc.gb_manufacturer, dc.manufacturer) as manufacturer,\n" +
@@ -354,6 +358,7 @@ public interface DeviceChannelMapper {
             " has_audio,\n" +
             " gps_time,\n" +
             " stream_identification,\n" +
+            " channel_type,\n" +
             " coalesce(gb_device_id, device_id) as device_id,\n" +
             " coalesce(gb_name, name) as name,\n" +
             " coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
@@ -400,14 +405,14 @@ public interface DeviceChannelMapper {
             "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) " +
+            "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.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}," +
-            " #{item.svcTimeSupportMode}, #{item.createTime}, #{item.updateTime}, #{item.subCount}, #{item.streamId}, #{item.hasAudio}, #{item.gpsTime}, #{item.streamIdentification}) " +
+            " #{item.svcTimeSupportMode}, #{item.createTime}, #{item.updateTime}, #{item.subCount}, #{item.streamId}, #{item.hasAudio}, #{item.gpsTime}, #{item.streamIdentification}, #{item.channelType}) " +
             "</foreach> " +
             "</script>")
     int batchAdd(@Param("addChannels") List<DeviceChannel> addChannels);
@@ -461,6 +466,7 @@ public interface DeviceChannelMapper {
             ", has_audio=#{item.hasAudio}" +
             ", gps_time=#{item.gpsTime}" +
             ", stream_identification=#{item.streamIdentification}" +
+            ", channel_type=#{item.channelType}" +
             " WHERE id=#{item.id}" +
             "</foreach>" +
             "</script>"})
@@ -494,6 +500,7 @@ public interface DeviceChannelMapper {
             " has_audio,\n" +
             " gps_time,\n" +
             " stream_identification,\n" +
+            " channel_type,\n" +
             " coalesce(gb_device_id, device_id) as device_id,\n" +
             " coalesce(gb_name, name) as name,\n" +
             " coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
@@ -574,6 +581,7 @@ public interface DeviceChannelMapper {
             " has_audio,\n" +
             " gps_time,\n" +
             " stream_identification,\n" +
+            " channel_type,\n" +
             " coalesce(gb_device_id, device_id) as device_id,\n" +
             " coalesce(gb_name, name) as name,\n" +
             " coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
@@ -647,6 +655,7 @@ public interface DeviceChannelMapper {
             " has_audio,\n" +
             " gps_time,\n" +
             " stream_identification,\n" +
+            " channel_type,\n" +
             " coalesce(gb_device_id, device_id) as device_id,\n" +
             " coalesce(gb_name, name) as name,\n" +
             " coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
@@ -697,6 +706,7 @@ public interface DeviceChannelMapper {
             " has_audio,\n" +
             " gps_time,\n" +
             " stream_identification,\n" +
+            " channel_type,\n" +
             " coalesce(gb_device_id, device_id) as device_id,\n" +
             " coalesce(gb_name, name) as name,\n" +
             " coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +

+ 25 - 0
src/main/java/com/genersoft/iot/vmp/gb28181/dao/GroupMapper.java

@@ -58,6 +58,7 @@ public interface GroupMapper {
             " (#{item.deviceId}, #{item.name}, #{item.parentDeviceId}, #{item.parentId}, #{item.businessGroup},#{item.createTime},#{item.updateTime})" +
             " </foreach> " +
             " </script>")
+    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
     int batchAdd(List<Group> groupList);
 
     @Select(" <script>" +
@@ -183,4 +184,28 @@ public interface GroupMapper {
             " <foreach collection='channelList'  item='item'  open='(' separator=',' close=')' > #{item.gbParentId}</foreach>" +
             " </script>")
     Set<Group> queryByChannelList(List<CommonGBChannel> channelList);
+
+    @Update(" <script>" +
+            " update wvp_common_group w1 " +
+            " inner join (select * from wvp_common_group ) w2 on w1.parent_device_id = w2.device_id " +
+            " set w1.parent_id = w2.id" +
+            " where w1.id in " +
+            " <foreach collection='groupListForAdd'  item='item'  open='(' separator=',' close=')' > #{item.id}</foreach>" +
+            " </script>")
+    void updateParentId(List<Group> groupListForAdd);
+
+    @Update(" <script>" +
+            " update wvp_common_group w1 " +
+            "    inner join (select * from wvp_common_group ) w2" +
+            "    on w1.parent_device_id is null" +
+            "           and w2.parent_device_id is null" +
+            "           and w2.device_id = w2.business_group " +
+            "           and w1.business_group = w2.device_id " +
+            "            and w1.device_id != w1.business_group " +
+            " set w1.parent_id = w2.id" +
+            " where w1.id in " +
+            " <foreach collection='groupListForAdd'  item='item'  open='(' separator=',' close=')' > #{item.id}</foreach>" +
+            " </script>")
+    void updateParentIdWithBusinessGroup(List<Group> groupListForAdd);
+
 }

+ 22 - 24
src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java

@@ -43,7 +43,7 @@ public interface PlatformChannelMapper {
             "DELETE from wvp_platform_channel WHERE device_channel_id in " +
             "( select  temp.device_channel_id from " +
             "(select pgc.device_channel_id from wvp_platform_channel pgc " +
-            "left join wvp_device_channel dc on dc.id = pgc.device_channel_id where dc.device_id  =#{deviceId} " +
+            "left join wvp_device_channel dc on dc.id = pgc.device_channel_id where dc.channel_type = 0 and dc.device_id  =#{deviceId} " +
             ") temp)" +
             "</script>")
     int delChannelForDeviceId(String deviceId);
@@ -53,25 +53,25 @@ public interface PlatformChannelMapper {
             "</script>")
     int cleanChannelForGB(String platformId);
 
-    @Select("SELECT dc.* from wvp_platform_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id=#{channelId} and pgc.platform_id=#{platformId}")
+    @Select("SELECT dc.* from wvp_platform_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_type = 0 and dc.channel_id=#{channelId} and pgc.platform_id=#{platformId}")
     List<DeviceChannel> queryChannelInParentPlatform(@Param("platformId") String platformId, @Param("channelId") String channelId);
 
     @Select("<script> "+
-            "SELECT dc.* from wvp_platform_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE pgc.platform_id=#{platformId} " +
+            "SELECT dc.* from wvp_platform_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_type = 0 and pgc.platform_id=#{platformId} " +
             " <if test='catalogId != null' > and pgc.catalog_id=#{catalogId}</if>" +
             "</script>")
     List<CommonGBChannel> queryAllChannelInCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
 
     @Select(" select dc.channel_id as id, dc.name as name, pgc.platform_id as platform_id, pgc.catalog_id as parent_id, 0 as children_count, 1 as type " +
             " from wvp_device_channel dc left join wvp_platform_channel pgc on dc.id = pgc.device_channel_id " +
-            " where pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}")
+            " where  dc.channel_type = 0 and pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}")
     List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
 
     @Select("select d.*\n" +
             "from wvp_platform_channel pgc\n" +
             "         left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" +
             "         left join wvp_device d on dc.device_id = d.device_id\n" +
-            "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
+            "where  dc.channel_type = 0 and dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
     List<Device> queryVideoDeviceByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
 
     @Delete("<script> "+
@@ -85,17 +85,17 @@ public interface PlatformChannelMapper {
     int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog);
 
     @Select("<script> " +
-            "SELECT " +
-            "pp.* " +
-            "FROM " +
-            "wvp_platform pp " +
-            "left join wvp_platform_channel pgc on " +
-            "pp.id = pgc.platform_id " +
-            "left join wvp_device_channel dc on " +
-            "dc.id = pgc.device_channel_id " +
-            "WHERE " +
-            "dc.device_id = #{channelId} and pp.status = true " +
-            "AND pp.server_gb_id IN" +
+            " SELECT " +
+            " pp.* " +
+            " FROM " +
+            " wvp_platform pp " +
+            " left join wvp_platform_channel pgc on " +
+            " pp.id = pgc.platform_id " +
+            " left join wvp_device_channel dc on " +
+            " dc.id = pgc.device_channel_id " +
+            " WHERE " +
+            "  dc.channel_type = 0 and dc.device_id = #{channelId} and pp.status = true " +
+            " AND pp.server_gb_id IN" +
             "<foreach collection='platforms' item='item'  open='(' separator=',' close=')' > #{item}</foreach>" +
             "</script> ")
     List<Platform> queryPlatFormListForGBWithGBId(@Param("channelId") String channelId, @Param("platforms") List<String> platforms);
@@ -115,14 +115,12 @@ public interface PlatformChannelMapper {
             "from wvp_platform_channel pgc\n" +
             "         left join wvp_device_channel dc on dc.id = pgc.device_channel_id\n" +
             "         left join wvp_device d on dc.device_id = d.device_id\n" +
-            "where dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
+            "where dc.channel_type = 0 and dc.channel_id = #{channelId} and pgc.platform_id=#{platformId}")
     List<Device> queryDeviceInfoByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
 
-    @Select("SELECT pgc.platform_id from wvp_platform_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.device_id=#{channelId}")
+    @Select("SELECT pgc.platform_id from wvp_platform_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE  dc.channel_type = 0 and dc.device_id=#{channelId}")
     List<Integer> queryParentPlatformByChannelId(@Param("channelId") String channelId);
 
-
-
     @Select("<script>" +
             " select " +
             "    wdc.id as gb_id,\n" +
@@ -168,7 +166,7 @@ public interface PlatformChannelMapper {
             "    wpgc.platform_id " +
             " from wvp_device_channel wdc" +
             " left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id and wpgc.platform_id = #{platformId}" +
-            " where  1=1" +
+            " where wdc.channel_type = 0 " +
             " <if test='query != null'> AND (coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) LIKE concat('%',#{query},'%') " +
             " OR coalesce(wpgc.name, wdc.gb_name, wdc.name)  LIKE concat('%',#{query},'%'))</if> " +
             " <if test='online == true'> AND coalesce(wpgc.status, wdc.gb_status, wdc.status) = 'ON'</if> " +
@@ -223,7 +221,7 @@ public interface PlatformChannelMapper {
             "    coalesce(wpgc.svc_time_support_mode, wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
             " from wvp_device_channel wdc" +
             " left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id" +
-            " where wpgc.platform_id = #{platformId} and coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) = #{channelDeviceId}"
+            " where wdc.channel_type = 0 and wpgc.platform_id = #{platformId} and coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) = #{channelDeviceId}"
 
     )
     CommonGBChannel queryOneWithPlatform(@Param("platformId") Integer platformId, @Param("channelDeviceId") String channelDeviceId);
@@ -273,7 +271,7 @@ public interface PlatformChannelMapper {
             "    coalesce(wpgc.svc_time_support_mode, wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
             " from wvp_device_channel wdc" +
             " left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id and wpgc.platform_id = #{platformId}" +
-            " where  wpgc.platform_id is null" +
+            " where wdc.channel_type = 0 and wpgc.platform_id is null" +
             "<if test='channelIds != null'> AND wdc.id in " +
             "<foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'> #{item} </foreach> " +
             "</if>" +
@@ -324,7 +322,7 @@ public interface PlatformChannelMapper {
             "    coalesce(wpgc.svc_time_support_mode, wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
             " from wvp_device_channel wdc" +
             " left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id" +
-            " where  wpgc.platform_id = #{platformId}" +
+            " where wdc.channel_type = 0 and wpgc.platform_id = #{platformId}" +
             "<if test='channelIds != null'> AND wdc.id in " +
             "   <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
             "   #{item} " +

+ 13 - 36
src/main/java/com/genersoft/iot/vmp/gb28181/dao/RegionMapper.java

@@ -11,8 +11,8 @@ import java.util.Set;
 @Mapper
 public interface RegionMapper {
 
-    @Insert("INSERT INTO wvp_common_region (device_id, name, parent_device_id, create_time, update_time) " +
-            "VALUES (#{deviceId}, #{name}, #{parentDeviceId}, #{createTime}, #{updateTime})")
+    @Insert("INSERT INTO wvp_common_region (device_id, name, parent_id, parent_device_id, create_time, update_time) " +
+            "VALUES (#{deviceId}, #{name}, #{parentId}, #{parentDeviceId}, #{createTime}, #{updateTime})")
     @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
     void add(Region region);
 
@@ -20,7 +20,7 @@ public interface RegionMapper {
     int delete(@Param("id") int id);
 
     @Update(" UPDATE wvp_common_region " +
-            " SET update_time=#{updateTime}, device_id=#{deviceId}, name=#{name}, parent_device_id=#{parentDeviceId}" +
+            " SET update_time=#{updateTime}, device_id=#{deviceId}, name=#{name}, parent_id=#{parentId}, parent_device_id=#{parentDeviceId}" +
             " WHERE id = #{id}")
     int update(Region region);
 
@@ -32,8 +32,8 @@ public interface RegionMapper {
             " </script>"})
     List<Region> query(@Param("query") String query, @Param("parentId") String parentId);
 
-    @Select("SELECT * from wvp_common_region WHERE parent_device_id = #{parentId} ORDER BY id ")
-    List<Region> getChildren(@Param("parentId") String parentId);
+    @Select("SELECT * from wvp_common_region WHERE parent_id = #{parentId} ORDER BY id ")
+    List<Region> getChildren(@Param("parentId") Integer parentId);
 
     @Select("SELECT * from wvp_common_region WHERE id = #{id} ")
     Region queryOne(@Param("id") int id);
@@ -57,33 +57,29 @@ public interface RegionMapper {
             " device_id," +
             " name, " +
             " parent_device_id," +
+            " parent_id," +
             " create_time," +
             " update_time) " +
             " VALUES " +
             " <foreach collection='regionList' index='index' item='item' separator=','> " +
-            " (#{item.deviceId}, #{item.name}, #{item.parentDeviceId},#{item.createTime},#{item.updateTime})" +
+            " (#{item.deviceId}, #{item.name}, #{item.parentDeviceId},#{item.parentId},#{item.createTime},#{item.updateTime})" +
             " </foreach> " +
             " </script>")
+    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
     int batchAdd(List<Region> regionList);
 
     @Select(" <script>" +
             " SELECT " +
-            " device_id as id," +
-            " name as label, " +
-            " parent_device_id," +
-            " id as db_id," +
+            " *, " +
             " 0 as type," +
             " false as is_leaf" +
             " from wvp_common_region " +
             " where " +
-            " <if test='parentId != null'> parent_device_id = #{parentId} </if> " +
-            " <if test='parentId == null'> parent_device_id is null </if> " +
+            " <if test='parentId != null'> parent_id = #{parentId} </if> " +
+            " <if test='parentId == null'> parent_id is null </if> " +
             " <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
             " </script>")
-    List<RegionTree> queryForTree(@Param("query") String query, @Param("parentId") String parentId);
-
-    @Select("SELECT * from wvp_common_region WHERE device_id = #{deviceId} ")
-    Region queryOneByDeviceId(@Param("deviceId") String deviceId);
+    List<RegionTree> queryForTree(@Param("query") String query, @Param("parentId") Integer parentId);
 
     @Delete("<script>" +
             " DELETE FROM wvp_common_region WHERE id in " +
@@ -96,26 +92,7 @@ public interface RegionMapper {
             " where device_id in " +
             " <foreach collection='regionList'  item='item'  open='(' separator=',' close=')' > #{item.deviceId}</foreach>" +
             " </script>")
-    List<Region> queryInRegionList(List<Region> regionList);
-
-    @Select(" <script>" +
-            " SELECT " +
-            " * " +
-            " from wvp_common_region " +
-            " where device_id in " +
-            " <foreach collection='channelList'  item='item'  open='(' separator=',' close=')' > #{item.gbCivilCode}</foreach>" +
-            " </script>")
-    Set<Region> queryInChannelList(List<CommonGBChannel> channelList);
-
-
-    @Select(" <script>" +
-            " SELECT " +
-            " * " +
-            " from wvp_common_region " +
-            " where device_id in " +
-            " <foreach collection='regionChannelList'  item='item'  open='(' separator=',' close=')' > #{item.parentDeviceId}</foreach>" +
-            " </script>")
-    Set<Region> queryParentInChannelList(Set<Region> regionChannelList);
+    List<Region> queryInRegionListByDeviceId(List<Region> regionList);
 
     @Select(" <script>" +
             " SELECT " +

+ 14 - 14
src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java

@@ -57,26 +57,26 @@ public class ChannelProvider {
 
 
     public String queryByDeviceId(Map<String, Object> params ){
-        return getBaseSelectSql() + " where gb_device_id = #{gbDeviceId} or device_id = #{gbDeviceId}";
+        return getBaseSelectSql() + " where channel_type = 0 and coalesce(gb_device_id, device_id) = #{gbDeviceId}";
     }
 
     public String queryById(Map<String, Object> params ){
-        return getBaseSelectSql() + " where id = #{gbId}";
+        return getBaseSelectSql() + " where channel_type = 0 and id = #{gbId}";
     }
 
     public String queryByStreamPushId(Map<String, Object> params ){
-        return getBaseSelectSql() + " where stream_push_id = #{streamPushId}";
+        return getBaseSelectSql() + " where channel_type = 0 and stream_push_id = #{streamPushId}";
     }
 
     public String queryByStreamProxyId(Map<String, Object> params ){
-        return getBaseSelectSql() + " where stream_proxy_id = #{streamProxyId}";
+        return getBaseSelectSql() + " where channel_type = 0 and stream_proxy_id = #{streamProxyId}";
     }
 
 
     public String queryList(Map<String, Object> params ){
         StringBuilder sqlBuild = new StringBuilder();
         sqlBuild.append(getBaseSelectSql());
-        sqlBuild.append(" where 1 = 1 ");
+        sqlBuild.append(" where channel_type = 0 ");
         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},'%') )")
@@ -106,7 +106,7 @@ public class ChannelProvider {
     public String queryInListByStatus(Map<String, Object> params ){
         StringBuilder sqlBuild = new StringBuilder();
         sqlBuild.append(getBaseSelectSql());
-        sqlBuild.append("where gb_status=#{status} and id in ( ");
+        sqlBuild.append("where channel_type = 0 and gb_status=#{status} and id in ( ");
 
         List<CommonGBChannel> commonGBChannelList = (List<CommonGBChannel>)params.get("commonGBChannelList");
         boolean first = true;
@@ -124,7 +124,7 @@ public class ChannelProvider {
     public String queryByIds(Map<String, Object> params ){
         StringBuilder sqlBuild = new StringBuilder();
         sqlBuild.append(getBaseSelectSql());
-        sqlBuild.append("where id in ( ");
+        sqlBuild.append("where channel_type = 0 and id in ( ");
 
         Collection<Integer> ids = (Collection<Integer>)params.get("ids");
         boolean first = true;
@@ -142,7 +142,7 @@ public class ChannelProvider {
     public String queryByGbDeviceIds(Map<String, Object> params ){
         StringBuilder sqlBuild = new StringBuilder();
         sqlBuild.append(getBaseSelectSql());
-        sqlBuild.append("where device_db_id in ( ");
+        sqlBuild.append("where channel_type = 0 and device_db_id in ( ");
 
         Collection<Integer> ids = (Collection<Integer>)params.get("deviceIds");
         boolean first = true;
@@ -160,7 +160,7 @@ public class ChannelProvider {
     public String queryByDeviceIds(Map<String, Object> params ){
         StringBuilder sqlBuild = new StringBuilder();
         sqlBuild.append(getBaseSelectSql());
-        sqlBuild.append("where id in ( ");
+        sqlBuild.append("where channel_type = 0 and id in ( ");
 
         Collection<Integer> ids = (Collection<Integer>)params.get("deviceIds");
         boolean first = true;
@@ -178,7 +178,7 @@ public class ChannelProvider {
     public String queryByIdsOrCivilCode(Map<String, Object> params ){
         StringBuilder sqlBuild = new StringBuilder();
         sqlBuild.append(getBaseSelectSql());
-        sqlBuild.append("where ");
+        sqlBuild.append("where channel_type = 0 and ");
         if (params.get("civilCode") != null) {
             sqlBuild.append(" coalesce(gb_civil_code, civil_code) = #{civilCode} ");
             if (params.get("ids") != null) {
@@ -204,21 +204,21 @@ public class ChannelProvider {
     public String queryByCivilCode(Map<String, Object> params ){
         StringBuilder sqlBuild = new StringBuilder();
         sqlBuild.append(getBaseSelectSql());
-        sqlBuild.append("where coalesce(gb_civil_code, civil_code) = #{civilCode} ");
+        sqlBuild.append("where channel_type = 0 and coalesce(gb_civil_code, civil_code) = #{civilCode} ");
         return sqlBuild.toString();
     }
 
     public String queryByBusinessGroup(Map<String, Object> params ){
         StringBuilder sqlBuild = new StringBuilder();
         sqlBuild.append(getBaseSelectSql());
-        sqlBuild.append("where coalesce(gb_business_group_id, business_group_id) = #{businessGroup} ");
+        sqlBuild.append("where channel_type = 0 and coalesce(gb_business_group_id, business_group_id) = #{businessGroup} ");
         return sqlBuild.toString() ;
     }
 
     public String queryByParentId(Map<String, Object> params ){
         StringBuilder sqlBuild = new StringBuilder();
         sqlBuild.append(getBaseSelectSql());
-        sqlBuild.append("where gb_parent_id = #{parentId} ");
+        sqlBuild.append("where channel_type = 0 and gb_parent_id = #{parentId} ");
         return sqlBuild.toString() ;
     }
 
@@ -226,7 +226,7 @@ public class ChannelProvider {
         StringBuilder sqlBuild = new StringBuilder();
         sqlBuild.append(getBaseSelectSql());
 
-        sqlBuild.append(" where gb_parent_id in ( ");
+        sqlBuild.append(" where channel_type = 0 and gb_parent_id in ( ");
         Collection<Group> ids = (Collection<Group>)params.get("groupList");
         boolean first = true;
         for (Group group : ids) {

+ 2 - 7
src/main/java/com/genersoft/iot/vmp/gb28181/service/IRegionService.java

@@ -11,18 +11,13 @@ public interface IRegionService {
 
     void add(Region region);
 
-    boolean deleteByDeviceId(String regionDeviceId);
+    boolean deleteByDeviceId(Integer regionDeviceId);
 
     /**
      * 查询区划列表
      */
     PageInfo<Region> query(String query, int page, int count);
 
-    /**
-     * 查询子区划列表
-     */
-    PageInfo<Region> queryChildRegionList(String regionParentId, int page, int count);
-
     /**
      * 更新区域
      */
@@ -32,7 +27,7 @@ public interface IRegionService {
 
     Region queryRegionByDeviceId(String regionDeviceId);
 
-    List<RegionTree> queryForTree(String query, String parent);
+    List<RegionTree> queryForTree(String query, Integer parent);
 
     void syncFromChannel();
 

+ 0 - 16
src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java

@@ -344,22 +344,6 @@ public class GbChannelServiceImpl implements IGbChannelService {
         return channelList;
     }
 
-    private Set<Region> getAllRegion(Set<Region> regionChannelList ) {
-        if (regionChannelList.isEmpty()) {
-            return new HashSet<>();
-        }
-        Set<Region> channelList = regionMapper.queryParentInChannelList(regionChannelList);
-        if (channelList.isEmpty()) {
-            return channelList;
-        }
-        Set<Region> allParentRegion = getAllRegion(channelList);
-        channelList.addAll(allParentRegion);
-        return channelList;
-    }
-
-
-
-
     @Override
     public CommonGBChannel getOne(int id) {
         return commonGBChannelMapper.queryById(id);

+ 10 - 4
src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GroupServiceImpl.java

@@ -216,6 +216,7 @@ public class GroupServiceImpl implements IGroupService {
     }
 
     @Override
+    @Transactional
     public boolean batchAdd(List<Group> groupList) {
         if (groupList== null || groupList.isEmpty()) {
             return false;
@@ -225,15 +226,20 @@ public class GroupServiceImpl implements IGroupService {
             groupMapForVerification.put(group.getDeviceId(), group);
         }
         // 查询数据库中已经存在的.
-        List<Group> regionListInDb = groupManager.queryInGroupListByDeviceId(groupList);
-        if (!regionListInDb.isEmpty()) {
-            for (Group group : regionListInDb) {
+        List<Group> groupListInDb = groupManager.queryInGroupListByDeviceId(groupList);
+        if (!groupListInDb.isEmpty()) {
+            for (Group group : groupListInDb) {
                 groupMapForVerification.remove(group.getDeviceId());
             }
         }
         if (!groupMapForVerification.isEmpty()) {
-            groupManager.batchAdd(new ArrayList<>(groupMapForVerification.values()));
+            List<Group> groupListForAdd = new ArrayList<>(groupMapForVerification.values());
+            groupManager.batchAdd(groupListForAdd);
+            // 更新分组关系
+            groupManager.updateParentId(groupListForAdd);
+            groupManager.updateParentIdWithBusinessGroup(groupListForAdd);
         }
+
         return true;
     }
 }

+ 13 - 18
src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/RegionServiceImpl.java

@@ -45,7 +45,7 @@ public class RegionServiceImpl implements IRegionService {
     public void add(Region region) {
         Assert.hasLength(region.getName(), "名称必须存在");
         Assert.hasLength(region.getDeviceId(), "国标编号必须存在");
-        if (ObjectUtils.isEmpty(region.getParentDeviceId().trim())) {
+        if (ObjectUtils.isEmpty(region.getParentDeviceId()) || ObjectUtils.isEmpty(region.getParentDeviceId().trim())) {
             region.setParentDeviceId(null);
         }
         region.setCreateTime(DateUtil.getNow());
@@ -60,8 +60,8 @@ public class RegionServiceImpl implements IRegionService {
 
     @Override
     @Transactional
-    public boolean deleteByDeviceId(String regionDeviceId) {
-        Region region = regionMapper.queryOneByDeviceId(regionDeviceId);
+    public boolean deleteByDeviceId(Integer regionDeviceId) {
+        Region region = regionMapper.queryOne(regionDeviceId);
         // 获取所有子节点
         List<Region> allChildren = getAllChildren(regionDeviceId);
         allChildren.add(region);
@@ -71,8 +71,8 @@ public class RegionServiceImpl implements IRegionService {
         return true;
     }
 
-    private List<Region> getAllChildren(String deviceId) {
-        if (deviceId == null || deviceId.length() >= 8) {
+    private List<Region> getAllChildren(Integer deviceId) {
+        if (deviceId == null) {
             return new ArrayList<>();
         }
         List<Region> children = regionMapper.getChildren(deviceId);
@@ -82,7 +82,7 @@ public class RegionServiceImpl implements IRegionService {
         List<Region> regions = new ArrayList<>(children);
         for (Region region : children) {
             if (region.getDeviceId().length() < 8) {
-                regions.addAll(getAllChildren(region.getDeviceId()));
+                regions.addAll(getAllChildren(region.getId()));
             }
         }
         return regions;
@@ -95,14 +95,6 @@ public class RegionServiceImpl implements IRegionService {
         return new PageInfo<>(regionList);
     }
 
-    @Override
-    public PageInfo<Region> queryChildRegionList(String regionParentId, int page, int count) {
-        Assert.hasLength(regionParentId, "上级行政区划编号必须存在");
-        PageHelper.startPage(page, count);
-        List<Region> all = regionMapper.getChildren(regionParentId);
-        return new PageInfo<>(all);
-    }
-
     @Override
     @Transactional
     public void update(Region region) {
@@ -122,11 +114,14 @@ public class RegionServiceImpl implements IRegionService {
     }
 
     @Override
-    public List<RegionTree> queryForTree(String query, String parent) {
+    public List<RegionTree> queryForTree(String query, Integer parent) {
         List<RegionTree> regionList = regionMapper.queryForTree(query, parent);
         if (parent != null) {
-            List<RegionTree> channelList = commonGBChannelMapper.queryForRegionTreeByCivilCode(query, parent);
-            regionList.addAll(channelList);
+            Region parentRegion = regionMapper.queryOne(parent);
+            if (parentRegion != null) {
+                List<RegionTree> channelList = commonGBChannelMapper.queryForRegionTreeByCivilCode(query, parentRegion.getDeviceId());
+                regionList.addAll(channelList);
+            }
         }
         return regionList;
     }
@@ -189,7 +184,7 @@ public class RegionServiceImpl implements IRegionService {
             regionMapForVerification.put(region.getDeviceId(), region);
         }
         // 查询数据库中已经存在的.
-        List<Region> regionListInDb = regionMapper.queryInRegionList(regionList);
+        List<Region> regionListInDb = regionMapper.queryInRegionListByDeviceId(regionList);
         if (!regionListInDb.isEmpty()) {
             for (Region region : regionListInDb) {
                 regionMapForVerification.remove(region.getDeviceId());

+ 2 - 0
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java

@@ -136,10 +136,12 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
                                         // 行政区划
                                         Region region = Region.getInstance(channel);
                                         regionList.add(region);
+                                        channel.setChannelType(1);
                                     }else if (channel.getDeviceId().length() == 20){
                                         // 业务分组/虚拟组织
                                         Group group = Group.getInstance(channel);
                                         if (group != null) {
+                                            channel.setChannelType(2);
                                             groupList.add(group);
                                         }
                                     }

+ 15 - 11
web_src/src/components/common/RegionTree.vue

@@ -15,24 +15,25 @@
       <vue-easy-tree
         class="flow-tree"
         ref="veTree"
-        node-key="id"
+        node-key="deviceId"
         height="78vh"
         lazy
         style="padding: 2rem 0 2rem 0.5rem"
         :load="loadNode"
         :data="treeData"
+        :props="props"
         :default-expanded-keys="['']"
         @node-contextmenu="contextmenuEventHandler"
         @node-click="nodeClickHandler"
       >
         <span class="custom-tree-node" slot-scope="{ node, data }">
           <span @click.stop >
-            <el-radio v-if="node.data.type === 0 && node.level !== 1 " style="margin-right: 0" v-model="chooseId" @input="chooseIdChange" :label="node.data.id">{{''}}</el-radio>
+            <el-radio v-if="node.data.type === 0 && node.level !== 1 " style="margin-right: 0" v-model="chooseId" @input="chooseIdChange" :label="node.data.deviceId">{{''}}</el-radio>
           </span>
           <span v-if="node.data.type === 0" style="color: #409EFF" class="iconfont icon-bianzubeifen3"></span>
           <span v-if="node.data.type === 1" style="color: #409EFF" class="iconfont icon-shexiangtou2"></span>
-          <span style=" padding-left: 1px" v-if="node.data.id !=='' && showCode" :title="node.data.id">{{ node.label }}(编号:{{ node.data.id }})</span>
-          <span style=" padding-left: 1px" v-if="node.data.id ==='' || !showCode" :title="node.data.id">{{ node.label }}</span>
+          <span style=" padding-left: 1px" v-if="node.data.deviceId !=='' && showCode" :title="node.data.deviceId">{{ node.label }}(编号:{{ node.data.deviceId }})</span>
+          <span style=" padding-left: 1px" v-if="node.data.deviceId ==='' || !showCode" :title="node.data.deviceId">{{ node.label }}</span>
         </span>
       </vue-easy-tree>
     </div>
@@ -53,6 +54,9 @@ export default {
   },
   data() {
     return {
+      props: {
+        label: "name",
+      },
       showCode: false,
       searchSrt: "",
       chooseId: "",
@@ -69,12 +73,12 @@ export default {
     loadNode: function (node, resolve) {
       if (node.level === 0) {
         resolve([{
-          id: "",
-          label: "根资源组",
+          deviceId: "",
+          name: "根资源组",
           isLeaf: false,
           type: 0
         }]);
-      } else if (node.data.id.length <= 8) {
+      } else if (node.data.deviceId.length <= 8) {
         this.$axios({
           method: 'get',
           url: `/api/region/tree/list`,
@@ -114,7 +118,7 @@ export default {
                   method: "post",
                   url: `/api/common/channel/region/delete`,
                   data: {
-                    channelIds: [data.dbId]
+                    channelIds: [data.id]
                   }
                 }).then((res) => {
                   console.log("移除成功")
@@ -227,7 +231,7 @@ export default {
         method: "delete",
         url: `/api/region/delete`,
         params: {
-          deviceId: id,
+          id: node.data.id,
         }
       }).then((res) => {
         if (res.data.code === 0) {
@@ -249,7 +253,7 @@ export default {
           method: 'post',
           url: `/api/common/channel/region/device/add`,
           data: {
-            civilCode: node.data.id,
+            civilCode: node.data.deviceId,
             deviceIds: deviceIds,
           }
         }).then((res)=> {
@@ -317,7 +321,7 @@ export default {
       this.$refs.regionCode.openDialog(form => {
         node.loaded = false
         node.expand();
-      }, id);
+      }, node.data.deviceId, node.data.id);
     },
     nodeClickHandler: function (data, node, tree) {
       console.log(data)

+ 3 - 2
web_src/src/components/dialog/regionCode.vue

@@ -89,7 +89,7 @@ export default {
       form: {
         name: "",
         deviceId: "",
-        parentDeviceId: ""
+        parentId: ""
       },
       allVal: [
         {
@@ -129,11 +129,12 @@ export default {
     };
   },
   methods: {
-    openDialog: function (endCallBck, parentDeviceId, code, lockContent) {
+    openDialog: function (endCallBck, parentDeviceId, parentId, code, lockContent) {
       this.showVideoDialog = true
       this.activeKey= '0';
       this.regionList = []
       this.form.parentDeviceId = parentDeviceId
+      this.form.parentId = parentId
       this.allVal =  [
         {
           id: [1, 2],

+ 1 - 0
数据库/2.7.2-重构/初始化-mysql-2.7.2.sql

@@ -145,6 +145,7 @@ create table wvp_device_channel
     has_audio                    bool default false,
     gps_time                     character varying(50),
     stream_identification        character varying(50),
+    channel_type                  int  default 0        not null,
     gb_device_id                 character varying(50),
     gb_name                      character varying(255),
     gb_manufacturer              character varying(255),