临时提交
parent
6fcf05e04b
commit
0722aa3aeb
|
@ -31,7 +31,7 @@ public class UserSetting {
|
|||
|
||||
private Boolean recordSip = Boolean.TRUE;
|
||||
|
||||
private Boolean logInDatabase = Boolean.TRUE;
|
||||
private Boolean logInDatabase = Boolean.FALSE;
|
||||
|
||||
private Boolean usePushingAsStatus = Boolean.FALSE;
|
||||
|
||||
|
|
|
@ -29,6 +29,12 @@ public class Group implements Comparable<Group>{
|
|||
@Schema(description = "区域名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 父分组ID
|
||||
*/
|
||||
@Schema(description = "父分组ID")
|
||||
private Integer parentId;
|
||||
|
||||
/**
|
||||
* 父区域国标ID
|
||||
*/
|
||||
|
@ -53,12 +59,6 @@ public class Group implements Comparable<Group>{
|
|||
@Schema(description = "更新时间")
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 平台ID
|
||||
*/
|
||||
@Schema(description = "平台ID")
|
||||
private Integer platformId;
|
||||
|
||||
public static Group getInstance(DeviceChannel channel) {
|
||||
GbCode gbCode = GbCode.decode(channel.getDeviceId());
|
||||
if (gbCode == null || (!gbCode.getTypeCode().equals("215") && !gbCode.getTypeCode().equals("216"))) {
|
||||
|
|
|
@ -8,37 +8,10 @@ import lombok.Data;
|
|||
*/
|
||||
@Data
|
||||
@Schema(description = "业务分组树")
|
||||
public class GroupTree {
|
||||
public class GroupTree extends Group{
|
||||
|
||||
/**
|
||||
* 数据库Id
|
||||
*/
|
||||
@Schema(description = "数据库Id")
|
||||
private int dbId;
|
||||
|
||||
/**
|
||||
* 区域国标编号
|
||||
*/
|
||||
@Schema(description = "区域国标编号")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 区域名称
|
||||
*/
|
||||
@Schema(description = "区域名称")
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 父区域国标ID
|
||||
*/
|
||||
@Schema(description = "父区域国标ID")
|
||||
private String parentDeviceId;
|
||||
|
||||
/**
|
||||
* 业务分组ID
|
||||
*/
|
||||
@Schema(description = "父区域国标ID")
|
||||
private String businessGroup;
|
||||
@Schema(description = "树节点Id")
|
||||
private String treeId;
|
||||
|
||||
@Schema(description = "是否有子节点")
|
||||
private boolean isLeaf;
|
||||
|
@ -46,13 +19,4 @@ public class GroupTree {
|
|||
@Schema(description = "类型, 行政区划:0 摄像头: 1")
|
||||
private int type;
|
||||
|
||||
public static GroupTree getInstance(CommonGBChannel channel) {
|
||||
GroupTree regionTree = new GroupTree();
|
||||
regionTree.setId(channel.getGbDeviceId());
|
||||
regionTree.setLabel(channel.getGbName());
|
||||
regionTree.setParentDeviceId(channel.getGbCivilCode());
|
||||
regionTree.setType(1);
|
||||
regionTree.setLeaf(true);
|
||||
return regionTree;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,21 +36,16 @@ public class GroupController {
|
|||
@Operation(summary = "查询分组")
|
||||
@Parameter(name = "query", description = "要搜索的内容", required = true)
|
||||
@Parameter(name = "parent", description = "所属分组编号", required = true)
|
||||
@Parameter(name = "platformId", description = "上级平台ID", required = true)
|
||||
@ResponseBody
|
||||
@GetMapping("/tree/list")
|
||||
public List<GroupTree> queryForTree(
|
||||
@RequestParam(required = false) String query,
|
||||
@RequestParam(required = false) String parent,
|
||||
@RequestParam(required = false) Integer platformId
|
||||
@RequestParam(required = false) Integer parent
|
||||
){
|
||||
if (ObjectUtils.isEmpty(parent)) {
|
||||
parent = null;
|
||||
}
|
||||
if (ObjectUtils.isEmpty(query)) {
|
||||
query = null;
|
||||
}
|
||||
return groupService.queryForTree(query, parent, platformId);
|
||||
return groupService.queryForTree(query, parent);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新分组")
|
||||
|
|
|
@ -298,6 +298,7 @@ public class PlatformController {
|
|||
public PageInfo<PlatformChannel> queryChannelList(int page, int count,
|
||||
@RequestParam(required = false) Integer platformId,
|
||||
@RequestParam(required = false) String query,
|
||||
@RequestParam(required = false) Boolean channelType,
|
||||
@RequestParam(required = false) Boolean online,
|
||||
@RequestParam(required = false) Boolean hasShare) {
|
||||
|
||||
|
|
|
@ -343,11 +343,11 @@ public interface CommonGBChannelMapper {
|
|||
|
||||
@Select("<script>" +
|
||||
" select " +
|
||||
" coalesce(gb_device_id, device_id) as id," +
|
||||
" coalesce(gb_name, name) as label, " +
|
||||
" concat('channel_', id) as tree_id," +
|
||||
" coalesce(gb_device_id, device_id) as device_id," +
|
||||
" coalesce(gb_name, name) as name, " +
|
||||
" coalesce(gb_parent_id, parent_id) as parent_device_id, " +
|
||||
" coalesce(gb_business_group_id, business_group_id) as business_group, " +
|
||||
" id as db_id, " +
|
||||
" 1 as type, " +
|
||||
" true as is_leaf " +
|
||||
" from wvp_device_channel " +
|
||||
|
@ -450,12 +450,58 @@ public interface CommonGBChannelMapper {
|
|||
" coalesce(wpgc.svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||
" 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_gb_channel wpgc on wdc.id = wpgc.device_channel_id" +
|
||||
" left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id" +
|
||||
" where wpgc.platform_id = #{platformId} "
|
||||
|
||||
)
|
||||
List<CommonGBChannel> queryWithPlatform(@Param("platformId") Integer platformId);
|
||||
|
||||
|
||||
@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.create_time,\n" +
|
||||
" wdc.update_time,\n" +
|
||||
" coalesce(wpgc.device_id, wdc.gb_device_id, wdc.device_id) as gb_device_id,\n" +
|
||||
" coalesce(wpgc.name, wdc.gb_name, wdc.name) as gb_name,\n" +
|
||||
" coalesce(wpgc.manufacturer, wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||
" coalesce(wpgc.model, wdc.gb_model, wdc.model) as gb_model,\n" +
|
||||
" coalesce(wpgc.owner, wdc.gb_owner, wdc.owner) as gb_owner,\n" +
|
||||
" coalesce(wpgc.civil_code, wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,\n" +
|
||||
" coalesce(wpgc.block, wdc.gb_block, wdc.block) as gb_block,\n" +
|
||||
" coalesce(wpgc.address, wdc.gb_address, wdc.address) as gb_address,\n" +
|
||||
" coalesce(wpgc.parental, wdc.gb_parental, wdc.parental) as gb_parental,\n" +
|
||||
" coalesce(wpgc.parent_id, wdc.gb_parent_id, wdc.parent_id) as gb_parent_id,\n" +
|
||||
" coalesce(wpgc.safety_way, wdc.gb_safety_way, wdc.safety_way) as gb_safety_way,\n" +
|
||||
" coalesce(wpgc.register_way, wdc.gb_register_way, wdc.register_way) as gb_register_way,\n" +
|
||||
" coalesce(wpgc.cert_num, wdc.gb_cert_num, wdc.cert_num) as gb_cert_num,\n" +
|
||||
" coalesce(wpgc.certifiable, wdc.gb_certifiable, wdc.certifiable) as gb_certifiable,\n" +
|
||||
" coalesce(wpgc.err_code, wdc.gb_err_code, wdc.err_code) as gb_err_code,\n" +
|
||||
" coalesce(wpgc.end_time, wdc.gb_end_time, wdc.end_time) as gb_end_time,\n" +
|
||||
" coalesce(wpgc.secrecy, wdc.gb_secrecy, wdc.secrecy) as gb_secrecy,\n" +
|
||||
" coalesce(wpgc.ip_address, wdc.gb_ip_address, wdc.ip_address) as gb_ip_address,\n" +
|
||||
" coalesce(wpgc.port, wdc.gb_port, wdc.port) as gb_port,\n" +
|
||||
" coalesce(wpgc.password, wdc.gb_password, wdc.password) as gb_password,\n" +
|
||||
" coalesce(wpgc.status, wdc.gb_status, wdc.status) as gb_status,\n" +
|
||||
" coalesce(wpgc.longitude, wdc.gb_longitude, wdc.longitude) as gb_longitude,\n" +
|
||||
" coalesce(wpgc.latitude, wdc.gb_latitude, wdc.latitude) as gb_latitude,\n" +
|
||||
" coalesce(wpgc.ptz_type, wdc.gb_ptz_type, wdc.ptz_type) as gb_ptz_type,\n" +
|
||||
" coalesce(wpgc.position_type, wdc.gb_position_type, wdc.position_type) as gb_position_type,\n" +
|
||||
" coalesce(wpgc.room_type, wdc.gb_room_type, wdc.room_type) as gb_room_type,\n" +
|
||||
" coalesce(wpgc.use_type, wdc.gb_use_type, wdc.use_type) as gb_use_type,\n" +
|
||||
" coalesce(wpgc.supply_light_type, wdc.gb_supply_light_type, wdc.supply_light_type) as gb_supply_light_type,\n" +
|
||||
" coalesce(wpgc.direction_type, wdc.gb_direction_type, wdc.direction_type) as gb_direction_type,\n" +
|
||||
" coalesce(wpgc.resolution, wdc.gb_resolution, wdc.resolution) as gb_resolution,\n" +
|
||||
" coalesce(wpgc.business_group_id, wdc.gb_business_group_id, wdc.business_group_id) as gb_business_group_id,\n" +
|
||||
" coalesce(wpgc.download_speed, wdc.gb_download_speed, wdc.download_speed) as gb_download_speed,\n" +
|
||||
" coalesce(wpgc.svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||
" 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.parent_id, wdc.gb_parent_id, wdc.parent_id) = #{parentId}"
|
||||
|
||||
)
|
||||
List<CommonGBChannel> queryShareChannelByParentId(@Param("parentId") String parentId, @Param("platformId") Integer platformId);
|
||||
}
|
||||
|
|
|
@ -328,7 +328,7 @@ public interface DeviceChannelMapper {
|
|||
" 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_platform_gb_channel pgc on pgc.device_channel_id = dc.id " +
|
||||
" LEFT JOIN wvp_platform_channel pgc on pgc.device_channel_id = dc.id " +
|
||||
" WHERE 1=1 " +
|
||||
" <if test='query != null'> " +
|
||||
"AND " +
|
||||
|
@ -338,7 +338,7 @@ public interface DeviceChannelMapper {
|
|||
" <if test='online == false' > AND dc.status=0</if> " +
|
||||
" <if test='hasSubChannel!= null and hasSubChannel == true' > AND dc.sub_count > 0</if> " +
|
||||
" <if test='hasSubChannel!= null and hasSubChannel == false' > AND dc.sub_count = 0</if> " +
|
||||
" <if test='catalogId == null ' > AND dc.id not in (select device_channel_id from wvp_platform_gb_channel where platform_id=#{platformId} ) </if> " +
|
||||
" <if test='catalogId == null ' > AND dc.id not in (select device_channel_id from wvp_platform_channel where platform_id=#{platformId} ) </if> " +
|
||||
" <if test='catalogId != null ' > AND pgc.platform_id = #{platformId} and pgc.catalog_id=#{catalogId} </if> " +
|
||||
" ORDER BY COALESCE(dc.gb_device_id, dc.device_id) ASC" +
|
||||
" </script>"})
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.genersoft.iot.vmp.gb28181.dao;
|
|||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Group;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GroupTree;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Region;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -12,13 +11,13 @@ import java.util.Set;
|
|||
@Mapper
|
||||
public interface GroupMapper {
|
||||
|
||||
@Insert("INSERT INTO wvp_common_group (device_id, name, parent_device_id, business_group, platform_id, create_time, update_time) " +
|
||||
"VALUES (#{deviceId}, #{name}, #{parentDeviceId}, #{businessGroup}, #{platformId}, #{createTime}, #{updateTime})")
|
||||
@Insert("INSERT INTO wvp_common_group (device_id, name, parent_id, parent_device_id, business_group, create_time, update_time) " +
|
||||
"VALUES (#{deviceId}, #{name}, #{parentId}, #{parentDeviceId}, #{businessGroup}, #{createTime}, #{updateTime})")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
int add(Group group);
|
||||
|
||||
@Insert("INSERT INTO wvp_common_group (device_id, name, business_group, platform_id, create_time, update_time) " +
|
||||
"VALUES (#{deviceId}, #{name}, #{businessGroup}, #{platformId}, #{createTime}, #{updateTime})")
|
||||
@Insert("INSERT INTO wvp_common_group (device_id, name, business_group, create_time, update_time) " +
|
||||
"VALUES (#{deviceId}, #{name}, #{businessGroup}, #{createTime}, #{updateTime})")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
int addBusinessGroup(Group group);
|
||||
|
||||
|
@ -26,7 +25,7 @@ public interface GroupMapper {
|
|||
int delete(@Param("id") int id);
|
||||
|
||||
@Update(" UPDATE wvp_common_group " +
|
||||
" SET update_time=#{updateTime}, device_id=#{deviceId}, name=#{name}, parent_device_id=#{parentDeviceId}, business_group=#{businessGroup}" +
|
||||
" SET update_time=#{updateTime}, device_id=#{deviceId}, name=#{name}, parent_id=#{parentId}, parent_device_id=#{parentDeviceId}, business_group=#{businessGroup}" +
|
||||
" WHERE id = #{id}")
|
||||
int update(Group group);
|
||||
|
||||
|
@ -38,99 +37,67 @@ public interface GroupMapper {
|
|||
" </script>"})
|
||||
List<Group> query(@Param("query") String query, @Param("parentId") String parentId, @Param("businessGroup") String businessGroup);
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
"SELECT * from wvp_common_group WHERE parent_device_id = #{parentId} "+
|
||||
" <if test='platformId != null'> AND platform_id = #{platformId}</if> " +
|
||||
" <if test='platformId == null'> AND platform_id is null</if> " +
|
||||
" </script>"})
|
||||
List<Group> getChildren(@Param("parentId") String parentId , @Param("platformId") Integer platformId);
|
||||
@Select("SELECT * from wvp_common_group WHERE parent_id = #{parentId} ")
|
||||
List<Group> getChildren(@Param("parentId") int parentId);
|
||||
|
||||
@Select("SELECT * from wvp_common_group WHERE id = #{id} ")
|
||||
Group queryOne(@Param("id") int id);
|
||||
|
||||
@Select(" select coalesce(dc.gb_civil_code, dc.civil_code) as civil_code " +
|
||||
" from wvp_device_channel dc " +
|
||||
" where coalesce(dc.gb_civil_code, dc.civil_code) not in " +
|
||||
" (select device_id from wvp_common_group)")
|
||||
List<String> getUninitializedCivilCode();
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT device_id from wvp_common_group " +
|
||||
" where device_id in " +
|
||||
" <foreach collection='codes' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||
" </script>")
|
||||
List<String> queryInList(Set<String> codes);
|
||||
|
||||
|
||||
@Insert(" <script>" +
|
||||
" INSERT INTO wvp_common_group (" +
|
||||
" device_id," +
|
||||
" name, " +
|
||||
" parent_device_id," +
|
||||
" parent_id," +
|
||||
" business_group," +
|
||||
" create_time," +
|
||||
" update_time) " +
|
||||
" VALUES " +
|
||||
" <foreach collection='groupList' index='index' item='item' separator=','> " +
|
||||
" (#{item.deviceId}, #{item.name}, #{item.parentDeviceId}, #{item.businessGroup},#{item.createTime},#{item.updateTime})" +
|
||||
" (#{item.deviceId}, #{item.name}, #{item.parentDeviceId}, #{item.parentId}, #{item.businessGroup},#{item.createTime},#{item.updateTime})" +
|
||||
" </foreach> " +
|
||||
" </script>")
|
||||
int batchAdd(List<Group> groupList);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
" device_id as id," +
|
||||
" name as label, " +
|
||||
" parent_device_id," +
|
||||
" business_group," +
|
||||
" id as db_id," +
|
||||
" *," +
|
||||
" concat('group_', id) as tree_id," +
|
||||
" 0 as type," +
|
||||
" false as is_leaf" +
|
||||
" from wvp_common_group " +
|
||||
" where 1=1 " +
|
||||
" <if test='parentId != null'> and parent_device_id = #{parentId} </if> " +
|
||||
" <if test='parentId == null'> and parent_device_id is null </if> " +
|
||||
" <if test='platformId != null'> and platform_id = #{platformId} </if> " +
|
||||
" <if test='platformId == null'> and platform_id is null </if> " +
|
||||
" <if test='parentId != null'> and parent_id = #{parentId} </if> " +
|
||||
" <if test='parentId == null'> and parent_id is null </if> " +
|
||||
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
|
||||
" </script>")
|
||||
List<GroupTree> queryForTree(@Param("query") String query, @Param("parentId") String parentId,
|
||||
@Param("platformId") Integer platformId);
|
||||
List<GroupTree> queryForTree(@Param("query") String query, @Param("parentId") Integer parentId);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
" device_id as id," +
|
||||
" name as label, " +
|
||||
" parent_device_id," +
|
||||
" business_group," +
|
||||
" id as db_id," +
|
||||
" concat('group_', id) as tree_id," +
|
||||
" *, " +
|
||||
" 0 as type," +
|
||||
" false as is_leaf" +
|
||||
" from wvp_common_group " +
|
||||
" where parent_device_id is null and business_group = #{businessGroup} and device_id != #{businessGroup}" +
|
||||
" <if test='platformId != null'> and platform_id = #{platformId} </if> " +
|
||||
" <if test='platformId == null'> and platform_id is null </if> " +
|
||||
" where parent_id is not null and business_group = #{businessGroup} and device_id != #{businessGroup}" +
|
||||
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
|
||||
" </script>")
|
||||
List<GroupTree> queryForTreeByBusinessGroup(@Param("query") String query,
|
||||
@Param("businessGroup") String businessGroup,
|
||||
@Param("platformId") Integer platformId);
|
||||
@Param("businessGroup") String businessGroup);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
" device_id as id," +
|
||||
" name as label, " +
|
||||
" parent_device_id," +
|
||||
" id as db_id," +
|
||||
" *," +
|
||||
" concat('group_', id) as tree_id," +
|
||||
" 0 as type," +
|
||||
" false as is_leaf" +
|
||||
" from wvp_common_group " +
|
||||
" where device_id=business_group" +
|
||||
" <if test='platformId != null'> AND platform_id = #{platformId} </if> " +
|
||||
" <if test='platformId == null'> AND platform_id is null </if> " +
|
||||
" <if test='query != null'> AND (device_id LIKE concat('%',#{query},'%') OR name LIKE concat('%',#{query},'%'))</if> " +
|
||||
" </script>")
|
||||
List<GroupTree> queryBusinessGroupForTree(String query, Integer platformId);
|
||||
List<GroupTree> queryBusinessGroupForTree(@Param("query") String query);
|
||||
|
||||
@Select("SELECT * from wvp_common_group WHERE device_id = #{deviceId} and business_group = #{businessGroup}")
|
||||
Group queryOneByDeviceId(@Param("deviceId") String deviceId, @Param("businessGroup") String businessGroup);
|
||||
|
@ -152,15 +119,15 @@ public interface GroupMapper {
|
|||
|
||||
@Update(" UPDATE wvp_common_group " +
|
||||
" SET parent_device_id=#{group.deviceId}, business_group = #{group.businessGroup}" +
|
||||
" WHERE parent_device_id = #{oldDeviceId}")
|
||||
int updateChild(@Param("oldDeviceId") String oldDeviceId, Group group);
|
||||
" WHERE parentId = #{parentId}")
|
||||
int updateChild(@Param("parentId") Integer parentId, Group group);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT * from wvp_common_group " +
|
||||
" where device_id in " +
|
||||
" <foreach collection='groupList' item='item' open='(' separator=',' close=')' > #{item.deviceId}</foreach>" +
|
||||
" </script>")
|
||||
List<Region> queryInGroupList(List<Group> groupList);
|
||||
List<Group> queryInGroupListByDeviceId(List<Group> groupList);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
|
@ -175,19 +142,10 @@ public interface GroupMapper {
|
|||
" SELECT " +
|
||||
" * " +
|
||||
" from wvp_common_group " +
|
||||
" where device_id in " +
|
||||
" <foreach collection='regionChannelList' item='item' open='(' separator=',' close=')' > #{item.parentDeviceId}</foreach>" +
|
||||
" where id in " +
|
||||
" <foreach collection='groupSet' item='item' open='(' separator=',' close=')' > #{item.parentId}</foreach>" +
|
||||
" </script>")
|
||||
Set<Group> queryParentInChannelList(Set<Group> regionChannelList);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
" * " +
|
||||
" from wvp_common_group " +
|
||||
" where device_id in " +
|
||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbBusinessGroupId}</foreach>" +
|
||||
" </script>")
|
||||
Set<Group> queryBusinessGroupInChannelList(List<CommonGBChannel> channelList);
|
||||
Set<Group> queryParentInChannelList(Set<Group> groupSet);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT " +
|
||||
|
@ -206,7 +164,7 @@ public interface GroupMapper {
|
|||
" SELECT * " +
|
||||
" from wvp_common_group wcg" +
|
||||
" left join wvp_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}" +
|
||||
" where wpg.platform_id = null and wcg.device_id in " +
|
||||
" where wpg.platform_id is null and wcg.device_id in " +
|
||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbParentId}</foreach>" +
|
||||
" </script>")
|
||||
Set<Group> queryNotShareForPlatformByChannelList(List<CommonGBChannel> channelList, @Param("platformId") Integer platformId);
|
||||
|
@ -215,7 +173,7 @@ public interface GroupMapper {
|
|||
" SELECT * " +
|
||||
" from wvp_common_group wcg" +
|
||||
" left join wvp_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}" +
|
||||
" where wpg.platform_id = null and wcg.id in " +
|
||||
" where wpg.platform_id IS NULL and wcg.id in " +
|
||||
" <foreach collection='allGroup' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
" </script>")
|
||||
Set<Group> queryNotShareForPlatformByGroupList(Set<Group> allGroup, @Param("platformId") Integer platformId);
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Select;
|
|||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
|
@ -19,13 +20,13 @@ public interface PlatformChannelMapper {
|
|||
* 查询列表里已经关联的
|
||||
*/
|
||||
@Select("<script> "+
|
||||
"SELECT device_channel_id from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" +
|
||||
"SELECT device_channel_id from wvp_platform_channel WHERE platform_id=#{platformId} AND device_channel_id in" +
|
||||
"<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> #{item.id}</foreach>" +
|
||||
"</script>")
|
||||
List<Integer> findChannelRelatedPlatform(@Param("platformId") String platformId, @Param("channelReduces") List<ChannelReduce> channelReduces);
|
||||
|
||||
@Insert("<script> "+
|
||||
"INSERT INTO wvp_platform_gb_channel (platform_id, device_channel_id) VALUES" +
|
||||
"INSERT INTO wvp_platform_channel (platform_id, device_channel_id) VALUES" +
|
||||
"<foreach collection='channelList' item='item' separator=','>" +
|
||||
" (#{platformId}, #{item.gbId} )" +
|
||||
"</foreach>" +
|
||||
|
@ -33,53 +34,53 @@ public interface PlatformChannelMapper {
|
|||
int addChannels(@Param("platformId") Integer platformId, @Param("channelList") List<CommonGBChannel> channelList);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} AND device_channel_id in" +
|
||||
"DELETE from wvp_platform_channel WHERE platform_id=#{platformId} AND device_channel_id in" +
|
||||
"<foreach collection='channelReducesToDel' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
|
||||
"</script>")
|
||||
int delChannelForGB(@Param("platformId") String platformId, @Param("channelReducesToDel") List<ChannelReduce> channelReducesToDel);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE from wvp_platform_gb_channel WHERE device_channel_id in " +
|
||||
"DELETE from wvp_platform_channel WHERE device_channel_id in " +
|
||||
"( select temp.device_channel_id from " +
|
||||
"(select pgc.device_channel_id from wvp_platform_gb_channel pgc " +
|
||||
"(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} " +
|
||||
") temp)" +
|
||||
"</script>")
|
||||
int delChannelForDeviceId(String deviceId);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId}" +
|
||||
"DELETE from wvp_platform_channel WHERE platform_id=#{platformId}" +
|
||||
"</script>")
|
||||
int cleanChannelForGB(String platformId);
|
||||
|
||||
@Select("SELECT dc.* from wvp_platform_gb_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_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_gb_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 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_gb_channel pgc on dc.id = pgc.device_channel_id " +
|
||||
" 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}")
|
||||
List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
|
||||
|
||||
@Select("select d.*\n" +
|
||||
"from wvp_platform_gb_channel pgc\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}")
|
||||
List<Device> queryVideoDeviceByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} and catalog_id=#{id}" +
|
||||
"DELETE from wvp_platform_channel WHERE platform_id=#{platformId} and catalog_id=#{id}" +
|
||||
"</script>")
|
||||
int delByCatalogId(@Param("platformId") String platformId, @Param("id") String id);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE from wvp_platform_gb_channel WHERE catalog_id=#{parentId} AND platform_id=#{platformId} AND channel_id=#{id}" +
|
||||
"DELETE from wvp_platform_channel WHERE catalog_id=#{parentId} AND platform_id=#{platformId} AND channel_id=#{id}" +
|
||||
"</script>")
|
||||
int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog);
|
||||
|
||||
|
@ -88,7 +89,7 @@ public interface PlatformChannelMapper {
|
|||
"pp.* " +
|
||||
"FROM " +
|
||||
"wvp_platform pp " +
|
||||
"left join wvp_platform_gb_channel pgc on " +
|
||||
"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 " +
|
||||
|
@ -100,24 +101,24 @@ public interface PlatformChannelMapper {
|
|||
List<Platform> queryPlatFormListForGBWithGBId(@Param("channelId") String channelId, @Param("platforms") List<String> platforms);
|
||||
|
||||
@Delete("<script> " +
|
||||
"DELETE from wvp_platform_gb_channel WHERE platform_id=#{serverGBId}" +
|
||||
"DELETE from wvp_platform_channel WHERE platform_id=#{serverGBId}" +
|
||||
"</script>")
|
||||
void delByPlatformId(String serverGBId);
|
||||
|
||||
@Delete("<script> " +
|
||||
"DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} " +
|
||||
"DELETE from wvp_platform_channel WHERE platform_id=#{platformId} " +
|
||||
" <if test=\"catalogId != null\" > and catalog_id=#{catalogId}</if>" +
|
||||
"</script>")
|
||||
int delChannelForGBByCatalogId(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
|
||||
|
||||
@Select("select dc.channel_id dc.device_id,dc.name,d.manufacturer,d.model,d.firmware\n" +
|
||||
"from wvp_platform_gb_channel pgc\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}")
|
||||
List<Device> queryDeviceInfoByPlatformIdAndChannelId(@Param("platformId") String platformId, @Param("channelId") String channelId);
|
||||
|
||||
@Select("SELECT pgc.platform_id from wvp_platform_gb_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.device_id=#{channelId}")
|
||||
List<Integer> queryParentPlatformByChannelId(@Param("channelId") String channelId);
|
||||
|
||||
|
||||
|
@ -166,7 +167,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" +
|
||||
" wpgc.platform_id " +
|
||||
" from wvp_device_channel wdc" +
|
||||
" left join wvp_platform_gb_channel wpgc on wdc.id = wpgc.device_channel_id and wpgc.platform_id = #{platformId}" +
|
||||
" left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id and wpgc.platform_id = #{platformId}" +
|
||||
" where 1=1" +
|
||||
" <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> " +
|
||||
|
@ -221,7 +222,7 @@ public interface PlatformChannelMapper {
|
|||
" coalesce(wpgc.svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||
" 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_gb_channel wpgc on wdc.id = wpgc.device_channel_id" +
|
||||
" 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}"
|
||||
|
||||
)
|
||||
|
@ -271,12 +272,11 @@ public interface PlatformChannelMapper {
|
|||
" coalesce(wpgc.svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||
" 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_gb_channel wpgc on wdc.id = wpgc.device_channel_id and wpgc.platform_id = #{platformId}" +
|
||||
" left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id and wpgc.platform_id = #{platformId}" +
|
||||
" where 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>" +
|
||||
|
||||
"<if test='channelIds != null'> AND wdc.id in " +
|
||||
"<foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'> #{item} </foreach> " +
|
||||
"</if>" +
|
||||
"</script>")
|
||||
List<CommonGBChannel> queryNotShare(@Param("platformId") Integer platformId, List<Integer> channelIds);
|
||||
|
||||
|
@ -323,7 +323,7 @@ public interface PlatformChannelMapper {
|
|||
" coalesce(wpgc.svc_space_support_mod, wdc.gb_svc_space_support_mod, wdc.svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||
" 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_gb_channel wpgc on wdc.id = wpgc.device_channel_id" +
|
||||
" left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id" +
|
||||
" where wpgc.platform_id = #{platformId}" +
|
||||
"<if test='channelIds != null'> AND wdc.id in " +
|
||||
" <foreach item='item' index='index' collection='channelIds' open='(' separator=',' close=')'>" +
|
||||
|
@ -334,7 +334,7 @@ public interface PlatformChannelMapper {
|
|||
List<CommonGBChannel> queryShare(@Param("platformId") Integer platformId, List<Integer> channelIds);
|
||||
|
||||
@Delete("<script> " +
|
||||
"DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} " +
|
||||
"DELETE from wvp_platform_channel WHERE platform_id=#{platformId} " +
|
||||
"<if test='channelList != null'> AND device_channel_id in " +
|
||||
" <foreach item='item' index='index' collection='channelList' open='(' separator=',' close=')'>" +
|
||||
" #{item.gbId} " +
|
||||
|
@ -344,7 +344,7 @@ public interface PlatformChannelMapper {
|
|||
int removeChannels(@Param("platformId") Integer platformId, List<CommonGBChannel> channelList);
|
||||
|
||||
@Insert("<script> "+
|
||||
"INSERT INTO wvp_platform_group (platform_id, group_id) VALUES" +
|
||||
"INSERT INTO wvp_platform_group (platform_id, group_id) VALUES " +
|
||||
"<foreach collection='groupListNotShare' item='item' separator=','>" +
|
||||
" (#{platformId}, #{item.id} )" +
|
||||
"</foreach>" +
|
||||
|
@ -361,4 +361,21 @@ public interface PlatformChannelMapper {
|
|||
"DELETE from wvp_platform_group WHERE platform_id=#{platformId} AND group_id =#{id}" +
|
||||
"</script>")
|
||||
void removePlatformGroupById(@Param("id") int id, @Param("platformId") Integer platformId);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT wcg.* " +
|
||||
" from wvp_common_group wcg" +
|
||||
" left join wvp_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}" +
|
||||
" where wpg.platform_id IS NOT NULL and wcg.parent_device_id = #{parentId} " +
|
||||
" </script>")
|
||||
Set<Group> queryShareChildrenGroup(@Param("parentId") String parentId, @Param("platformId") Integer platformId);
|
||||
|
||||
@Select(" <script>" +
|
||||
" SELECT wcg.* " +
|
||||
" from wvp_common_group wcg" +
|
||||
" left join wvp_platform_group wpg on wpg.group_id = wcg.id and wpg.platform_id = #{platformId}" +
|
||||
" where wpg.platform_id is not null and wcg.parent_device_id in " +
|
||||
"<foreach collection='groupSet' item='item' open='(' separator=',' close=')' > #{item.deviceId}</foreach>" +
|
||||
" </script>")
|
||||
Set<Group> queryShareParentGroupByGroupSet(Set<Group> groupSet, @Param("platformId") Integer platformId);
|
||||
}
|
||||
|
|
|
@ -15,11 +15,11 @@ public interface PlatformMapper {
|
|||
|
||||
@Insert("INSERT INTO wvp_platform (enable, name, server_gb_id, server_gb_domain, server_ip, server_port,device_gb_id,device_ip,"+
|
||||
" device_port,username,password,expires,keep_timeout,transport,character_set,ptz,rtcp,status,catalog_group, update_time," +
|
||||
" create_time, as_message_channel, send_stream_ip, auto_push_channel, catalog_with_platform, custom_group, custom_civil_code, "+
|
||||
" create_time, as_message_channel, send_stream_ip, auto_push_channel, catalog_with_platform,catalog_with_group,catalog_with_region, "+
|
||||
" civil_code,manufacturer,model,address,register_way,secrecy) " +
|
||||
" VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIp}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " +
|
||||
" #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, #{status}, #{catalogGroup},#{updateTime}," +
|
||||
" #{createTime}, #{asMessageChannel}, #{sendStreamIp}, #{autoPushChannel}, #{catalogWithPlatform}, #{customGroup},#{customCivilCode}, " +
|
||||
" #{createTime}, #{asMessageChannel}, #{sendStreamIp}, #{autoPushChannel}, #{catalogWithPlatform}, #{catalogWithGroup},#{catalogWithRegion}, " +
|
||||
" #{civilCode}, #{manufacturer}, #{model}, #{address}, #{registerWay}, #{secrecy})")
|
||||
int add(Platform parentPlatform);
|
||||
|
||||
|
@ -48,8 +48,8 @@ public interface PlatformMapper {
|
|||
" send_stream_ip=#{sendStreamIp}, " +
|
||||
" auto_push_channel=#{autoPushChannel}, " +
|
||||
" catalog_with_platform=#{catalogWithPlatform}, " +
|
||||
" custom_group=#{customGroup}, " +
|
||||
" custom_civil_code=#{customCivilCode}, " +
|
||||
" catalog_with_group=#{catalogWithGroup}, " +
|
||||
" catalog_with_region=#{catalogWithRegion}, " +
|
||||
" civil_code=#{civilCode}, " +
|
||||
" manufacturer=#{manufacturer}, " +
|
||||
" model=#{model}, " +
|
||||
|
@ -63,7 +63,7 @@ public interface PlatformMapper {
|
|||
int delParentPlatform(Platform parentPlatform);
|
||||
|
||||
@Select(" SELECT pp.*, " +
|
||||
" (SELECT count(0) FROM wvp_platform_gb_channel pc WHERE pc.platform_id = pp.id ) as channel_count" +
|
||||
" (SELECT count(0) FROM wvp_platform_channel pc WHERE pc.platform_id = pp.id ) as channel_count" +
|
||||
" FROM wvp_platform pp "
|
||||
)
|
||||
List<Platform> queryList();
|
||||
|
|
|
@ -14,7 +14,7 @@ public interface IGroupService {
|
|||
|
||||
Group queryGroupByDeviceId(String regionDeviceId);
|
||||
|
||||
List<GroupTree> queryForTree(String query, String parent, Integer platformId);
|
||||
List<GroupTree> queryForTree(String query, Integer parent);
|
||||
|
||||
void syncFromChannel();
|
||||
|
||||
|
|
|
@ -60,6 +60,8 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
|||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "此代理已经关联通道");
|
||||
}
|
||||
}
|
||||
commonGBChannel.setCreateTime(DateUtil.getNow());
|
||||
commonGBChannel.setUpdateTime(DateUtil.getNow());
|
||||
return commonGBChannelMapper.insert(commonGBChannel);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package com.genersoft.iot.vmp.gb28181.service.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GbCode;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Group;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GroupTree;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.GroupMapper;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
|
@ -19,7 +22,6 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 区域管理类
|
||||
|
@ -73,15 +75,6 @@ public class GroupServiceImpl implements IGroupService {
|
|||
group.setCreateTime(DateUtil.getNow());
|
||||
group.setUpdateTime(DateUtil.getNow());
|
||||
groupManager.add(group);
|
||||
if (group.getPlatformId() != null) {
|
||||
CommonGBChannel channel = CommonGBChannel.build(group);
|
||||
try {
|
||||
// 发送catalog
|
||||
eventPublisher.catalogEventPublish(group.getPlatformId(), channel, CatalogEvent.ADD);
|
||||
}catch (Exception e) {
|
||||
log.warn("[添加虚拟组织] 发送失败, {}-{}", channel.getGbName(), channel.getGbDeviceDbId(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addBusinessGroup(Group group) {
|
||||
|
@ -89,24 +82,15 @@ public class GroupServiceImpl implements IGroupService {
|
|||
group.setCreateTime(DateUtil.getNow());
|
||||
group.setUpdateTime(DateUtil.getNow());
|
||||
groupManager.addBusinessGroup(group);
|
||||
if (group.getPlatformId() != null) {
|
||||
CommonGBChannel channel = CommonGBChannel.build(group);
|
||||
try {
|
||||
// 发送catalog
|
||||
eventPublisher.catalogEventPublish(group.getPlatformId(), channel, CatalogEvent.ADD);
|
||||
}catch (Exception e) {
|
||||
log.warn("[添加虚拟组织] 发送失败, {}-{}", channel.getGbName(), channel.getGbDeviceDbId(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<Group> queryAllChildren(String deviceId, Integer platformId) {
|
||||
List<Group> children = groupManager.getChildren(deviceId, platformId);
|
||||
private List<Group> queryAllChildren(Integer id) {
|
||||
List<Group> children = groupManager.getChildren(id);
|
||||
if (ObjectUtils.isEmpty(children)) {
|
||||
return children;
|
||||
}
|
||||
for (int i = 0; i < children.size(); i++) {
|
||||
children.addAll(queryAllChildren(children.get(i).getDeviceId(), platformId));
|
||||
children.addAll(queryAllChildren(children.get(i).getId()));
|
||||
}
|
||||
return children;
|
||||
}
|
||||
|
@ -126,9 +110,9 @@ public class GroupServiceImpl implements IGroupService {
|
|||
// 修改他的子节点
|
||||
if (!group.getDeviceId().equals(groupInDb.getDeviceId())
|
||||
|| !group.getBusinessGroup().equals(groupInDb.getBusinessGroup())) {
|
||||
List<Group> groupList = queryAllChildren(groupInDb.getDeviceId(), groupInDb.getPlatformId());
|
||||
List<Group> groupList = queryAllChildren(groupInDb.getId());
|
||||
if (!groupList.isEmpty()) {
|
||||
int result = groupManager.updateChild(groupInDb.getDeviceId(), group);
|
||||
int result = groupManager.updateChild(groupInDb.getId(), group);
|
||||
if (result > 0) {
|
||||
for (Group chjildGroup : groupList) {
|
||||
chjildGroup.setParentDeviceId(group.getDeviceId());
|
||||
|
@ -173,32 +157,21 @@ public class GroupServiceImpl implements IGroupService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<GroupTree> queryForTree(String query, String parent, Integer platformId) {
|
||||
if (parent == null) {
|
||||
// 查询所有业务分组
|
||||
return groupManager.queryBusinessGroupForTree(query, platformId);
|
||||
}else {
|
||||
GbCode gbCode = GbCode.decode(parent);
|
||||
if (gbCode.getTypeCode().equals("215")) {
|
||||
return groupManager.queryForTreeByBusinessGroup(query, parent, platformId);
|
||||
}else {
|
||||
// 查询业务分组以及所属的通道
|
||||
List<GroupTree> groupTrees = groupManager.queryForTree(query, parent, platformId);
|
||||
if (platformId == null) {
|
||||
List<GroupTree> channelList = commonGBChannelMapper.queryForGroupTreeByParentId(query, parent);
|
||||
List<GroupTree> channelListForResult = channelList.stream().filter(groupTree -> {
|
||||
GbCode gbCodeForChannel = GbCode.decode(groupTree.getId());
|
||||
return !gbCodeForChannel.getTypeCode().equals("215") && !gbCodeForChannel.getTypeCode().equals("216");
|
||||
}).collect(Collectors.toList());
|
||||
groupTrees.addAll(channelListForResult);
|
||||
}else {
|
||||
// TODO 查询平台独属的关联通道
|
||||
}
|
||||
|
||||
return groupTrees;
|
||||
}
|
||||
public List<GroupTree> queryForTree(String query, Integer parentId) {
|
||||
|
||||
List<GroupTree> groupTrees = groupManager.queryForTree(query, parentId);
|
||||
if (parentId == null) {
|
||||
return groupTrees;
|
||||
}
|
||||
// 查询含有的通道
|
||||
Group parentGroup = groupManager.queryOne(parentId);
|
||||
if (parentGroup != null && !parentGroup.getDeviceId().equals(parentGroup.getBusinessGroup())) {
|
||||
List<GroupTree> groupTreesForChannel = commonGBChannelMapper.queryForGroupTreeByParentId(query, parentGroup.getDeviceId());
|
||||
if (ObjectUtils.isEmpty(groupTreesForChannel)) {
|
||||
groupTrees.addAll(groupTreesForChannel);
|
||||
}
|
||||
}
|
||||
return groupTrees;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -221,7 +194,7 @@ public class GroupServiceImpl implements IGroupService {
|
|||
// 业务分组
|
||||
gbChannelService.removeParentIdByBusinessGroup(group.getDeviceId());
|
||||
}else {
|
||||
List<Group> groupList = queryAllChildren(group.getDeviceId(), group.getPlatformId());
|
||||
List<Group> groupList = queryAllChildren(group.getId());
|
||||
if (!groupList.isEmpty()) {
|
||||
groupListForDelete.addAll(groupList);
|
||||
}
|
||||
|
@ -252,10 +225,10 @@ public class GroupServiceImpl implements IGroupService {
|
|||
groupMapForVerification.put(group.getDeviceId(), group);
|
||||
}
|
||||
// 查询数据库中已经存在的.
|
||||
List<Region> regionListInDb = groupManager.queryInGroupList(groupList);
|
||||
List<Group> regionListInDb = groupManager.queryInGroupListByDeviceId(groupList);
|
||||
if (!regionListInDb.isEmpty()) {
|
||||
for (Region region : regionListInDb) {
|
||||
groupMapForVerification.remove(region.getDeviceId());
|
||||
for (Group group : regionListInDb) {
|
||||
groupMapForVerification.remove(group.getDeviceId());
|
||||
}
|
||||
}
|
||||
if (!groupMapForVerification.isEmpty()) {
|
||||
|
|
|
@ -105,7 +105,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
|||
continue;
|
||||
}
|
||||
// 获取分组关联的通道
|
||||
List<CommonGBChannel> channelList = platformChannelMapper.queryShareChannelByParentId(group.getDeviceId(), platformId);
|
||||
List<CommonGBChannel> channelList = commonGBChannelMapper.queryShareChannelByParentId(group.getDeviceId(), platformId);
|
||||
if (!channelList.isEmpty()) {
|
||||
groupSet.remove(group);
|
||||
continue;
|
||||
|
@ -129,6 +129,11 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
|||
if (groupList.isEmpty()) {
|
||||
return new HashSet<>();
|
||||
}
|
||||
for (Group group : groupList) {
|
||||
if (group.getParentDeviceId() == null) {
|
||||
|
||||
}
|
||||
}
|
||||
Set<Group> channelList = groupMapper.queryParentInChannelList(groupList);
|
||||
if (channelList.isEmpty()) {
|
||||
return channelList;
|
||||
|
@ -147,13 +152,16 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
|||
if (result > 0) {
|
||||
// 查询通道相关的分组信息是否共享,如果没共享就添加
|
||||
Set<Group> groupListNotShare = getGroupNotShareByChannelList(channelListNotShare, platformId);
|
||||
int addGroupResult = platformChannelMapper.addPlatformGroup(new ArrayList<>(groupListNotShare), platformId);
|
||||
if (addGroupResult > 0) {
|
||||
for (Group group : groupListNotShare) {
|
||||
// 分组信息排序时需要将顶层排在最后
|
||||
channelListNotShare.add(0, CommonGBChannel.build(group));
|
||||
if (!groupListNotShare.isEmpty()) {
|
||||
int addGroupResult = platformChannelMapper.addPlatformGroup(new ArrayList<>(groupListNotShare), platformId);
|
||||
if (addGroupResult > 0) {
|
||||
for (Group group : groupListNotShare) {
|
||||
// 分组信息排序时需要将顶层排在最后
|
||||
channelListNotShare.add(0, CommonGBChannel.build(group));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 发送消息
|
||||
try {
|
||||
// 发送catalog
|
||||
|
@ -175,7 +183,9 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
|||
Set<Group> groupSet = groupMapper.queryByChannelList(channelListNotShare);
|
||||
Set<Group> deleteGroup = deleteEmptyGroup(groupSet, platformId);
|
||||
if (!deleteGroup.isEmpty()) {
|
||||
channelListNotShare.add(0, CommonGBChannel.build(group));
|
||||
for (Group group : deleteGroup) {
|
||||
channelListNotShare.add(0, CommonGBChannel.build(group));
|
||||
}
|
||||
}
|
||||
// 发送消息
|
||||
try {
|
||||
|
@ -195,11 +205,10 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
|||
int result = platformChannelMapper.removeChannels(platformId, channelList);
|
||||
if (result > 0) {
|
||||
// 查询通道相关的分组信息是否共享,如果没共享就添加
|
||||
List<Group> groupListShareEmptyChannel = getGroupShareEmptyChannel(channelList, platformId);
|
||||
int addGroupResult = platformChannelMapper.removePlatformGroup(groupListShareEmptyChannel, platformId);
|
||||
if (addGroupResult > 0) {
|
||||
for (Group group : groupListShareEmptyChannel) {
|
||||
// 分组信息排序时需要将顶层排在最后
|
||||
Set<Group> groupSet = groupMapper.queryByChannelList(channelList);
|
||||
Set<Group> deleteGroup = deleteEmptyGroup(groupSet, platformId);
|
||||
if (!deleteGroup.isEmpty()) {
|
||||
for (Group group : deleteGroup) {
|
||||
channelList.add(0, CommonGBChannel.build(group));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,6 +125,8 @@
|
|||
<el-checkbox label="消息通道" v-model="value.asMessageChannel"></el-checkbox>
|
||||
<el-checkbox label="主动推送通道" v-model="value.autoPushChannel"></el-checkbox>
|
||||
<el-checkbox label="推送平台信息" v-model="value.catalogWithPlatform"></el-checkbox>
|
||||
<el-checkbox label="推送分组信息" v-model="value.catalogWithGroup"></el-checkbox>
|
||||
<el-checkbox label="推送行政区划" v-model="value.catalogWithRegion"></el-checkbox>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -21,18 +21,19 @@
|
|||
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 > 2 " style="margin-right: 0" v-model="chooseId" @input="chooseIdChange(node.data.id, node.data.businessGroup)" :label="node.data.id">{{''}}</el-radio>
|
||||
<el-radio v-if="node.data.type === 0 && node.level > 2 " style="margin-right: 0" v-model="chooseId" @input="chooseIdChange(node.data.deviceId, node.data.businessGroup)" :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,10 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
props: {
|
||||
id: "treeId",
|
||||
label: "name",
|
||||
},
|
||||
showCode: false,
|
||||
searchSrt: "",
|
||||
chooseId: "",
|
||||
|
@ -70,7 +75,7 @@ export default {
|
|||
if (node.level === 0) {
|
||||
resolve([{
|
||||
id: "",
|
||||
label: "根资源组",
|
||||
name: "根资源组",
|
||||
isLeaf: false,
|
||||
type: 0
|
||||
}]);
|
||||
|
@ -112,7 +117,7 @@ export default {
|
|||
method: "post",
|
||||
url: `/api/common/channel/group/delete`,
|
||||
data: {
|
||||
channelIds: [data.dbId]
|
||||
channelIds: [data.id]
|
||||
}
|
||||
}).then((res) => {
|
||||
console.log("移除成功")
|
||||
|
@ -225,7 +230,7 @@ export default {
|
|||
method: "delete",
|
||||
url: `/api/group/delete`,
|
||||
params: {
|
||||
id: node.data.dbId,
|
||||
id: node.data.id,
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.data.code === 0) {
|
||||
|
|
|
@ -14,6 +14,14 @@
|
|||
<el-option label="在线" value="true"></el-option>
|
||||
<el-option label="离线" value="false"></el-option>
|
||||
</el-select>
|
||||
类型:
|
||||
<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="gb"></el-option>
|
||||
<el-option label="推流设备" value="push"></el-option>
|
||||
<el-option label="拉流代理" value="proxy"></el-option>
|
||||
</el-select>
|
||||
添加状态:
|
||||
<el-select size="mini" style="width: 8rem; margin-right: 1rem;" @change="search" v-model="hasShare" placeholder="请选择"
|
||||
default-first-option>
|
||||
|
@ -46,9 +54,9 @@
|
|||
<el-table-column label="类型" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
<div slot="reference" class="name-wrapper">
|
||||
<el-tag size="medium" v-if="scope.row.gbDeviceDbId">国标设备</el-tag>
|
||||
<el-tag size="medium" v-if="scope.row.streamPushId">推流设备</el-tag>
|
||||
<el-tag size="medium" v-if="scope.row.streamProxyId">拉流代理</el-tag>
|
||||
<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>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -131,6 +139,7 @@ export default {
|
|||
count: this.count,
|
||||
query: this.searchSrt,
|
||||
online: this.online,
|
||||
channelType: this.channelType,
|
||||
platformId: this.platformId,
|
||||
hasShare: this.hasShare
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ create table wvp_platform_catalog (
|
|||
constraint uk_platform_catalog_id_platform_id unique (id, platform_id)
|
||||
);
|
||||
|
||||
create table wvp_platform_gb_channel (
|
||||
create table wvp_platform_channel (
|
||||
id serial primary key ,
|
||||
platform_id character varying(50),
|
||||
catalog_id character varying(50),
|
||||
|
|
|
@ -210,7 +210,7 @@ create table wvp_platform_catalog (
|
|||
constraint uk_platform_catalog_id_platform_id unique (id, platform_id)
|
||||
);
|
||||
|
||||
create table wvp_platform_gb_channel (
|
||||
create table wvp_platform_channel (
|
||||
id serial primary key ,
|
||||
platform_id character varying(50),
|
||||
catalog_id character varying(50),
|
||||
|
|
|
@ -445,7 +445,7 @@ rename table log to wvp_log;
|
|||
rename table media_server to wvp_media_server;
|
||||
rename table parent_platform to wvp_platform;
|
||||
rename table platform_catalog to wvp_platform_catalog;
|
||||
rename table platform_gb_channel to wvp_platform_gb_channel;
|
||||
rename table platform_gb_channel to wvp_platform_channel;
|
||||
rename table platform_gb_stream to wvp_platform_gb_stream;
|
||||
rename table stream_proxy to wvp_stream_proxy;
|
||||
rename table stream_push to wvp_stream_push;
|
||||
|
|
|
@ -446,7 +446,7 @@ rename table log to wvp_log;
|
|||
rename table media_server to wvp_media_server;
|
||||
rename table parent_platform to wvp_platform;
|
||||
rename table platform_catalog to wvp_platform_catalog;
|
||||
rename table platform_gb_channel to wvp_platform_gb_channel;
|
||||
rename table platform_gb_channel to wvp_platform_channel;
|
||||
rename table platform_gb_stream to wvp_platform_gb_stream;
|
||||
rename table stream_proxy to wvp_stream_proxy;
|
||||
rename table stream_push to wvp_stream_push;
|
||||
|
|
|
@ -211,7 +211,7 @@ create table wvp_platform_catalog (
|
|||
constraint uk_platform_catalog_id_platform_id unique (id, platform_id)
|
||||
);
|
||||
|
||||
create table wvp_platform_gb_channel (
|
||||
create table wvp_platform_channel (
|
||||
id serial primary key ,
|
||||
platform_id character varying(50),
|
||||
catalog_id character varying(50),
|
||||
|
|
|
@ -211,7 +211,7 @@ create table wvp_platform_catalog (
|
|||
constraint uk_platform_catalog_id_platform_id unique (id, platform_id)
|
||||
);
|
||||
|
||||
create table wvp_platform_gb_channel (
|
||||
create table wvp_platform_channel (
|
||||
id serial primary key ,
|
||||
platform_id character varying(50),
|
||||
catalog_id character varying(50),
|
||||
|
|
|
@ -217,7 +217,7 @@ create table wvp_platform_catalog (
|
|||
constraint uk_platform_catalog_id_platform_id unique (id, platform_id)
|
||||
);
|
||||
|
||||
create table wvp_platform_gb_channel (
|
||||
create table wvp_platform_channel (
|
||||
id serial primary key ,
|
||||
platform_id character varying(50),
|
||||
catalog_id character varying(50),
|
||||
|
|
|
@ -217,7 +217,7 @@ create table wvp_platform_catalog (
|
|||
constraint uk_platform_catalog_id_platform_id unique (id, platform_id)
|
||||
);
|
||||
|
||||
create table wvp_platform_gb_channel (
|
||||
create table wvp_platform_channel (
|
||||
id serial primary key ,
|
||||
platform_id character varying(50),
|
||||
catalog_id character varying(50),
|
||||
|
|
|
@ -456,12 +456,12 @@ CREATE TABLE wvp_common_group
|
|||
id serial primary key,
|
||||
device_id varchar(50) NOT NULL,
|
||||
name varchar(255) NOT NULL,
|
||||
parent_id int,
|
||||
parent_device_id varchar(50) DEFAULT NULL,
|
||||
business_group varchar(50) NOT NULL,
|
||||
platform_id int,
|
||||
create_time varchar(50) NOT NULL,
|
||||
update_time varchar(50) NOT NULL,
|
||||
UNIQUE KEY common_group_device_platform (device_id, platform_id)
|
||||
UNIQUE KEY common_group_device_platform (device_id)
|
||||
);
|
||||
|
||||
CREATE TABLE wvp_common_region
|
||||
|
@ -469,6 +469,7 @@ CREATE TABLE wvp_common_region
|
|||
id serial primary key,
|
||||
device_id varchar(50) NOT NULL,
|
||||
name varchar(255) NOT NULL,
|
||||
parent_id int,
|
||||
parent_device_id varchar(50) DEFAULT NULL,
|
||||
create_time varchar(50) NOT NULL,
|
||||
update_time varchar(50) NOT NULL,
|
||||
|
|
|
@ -217,7 +217,7 @@ create table wvp_platform_catalog (
|
|||
constraint uk_platform_catalog_id_platform_id unique (id, platform_id)
|
||||
);
|
||||
|
||||
create table wvp_platform_gb_channel (
|
||||
create table wvp_platform_channel (
|
||||
id serial primary key ,
|
||||
platform_id character varying(50),
|
||||
catalog_id character varying(50),
|
||||
|
|
|
@ -217,7 +217,7 @@ create table wvp_platform_catalog (
|
|||
constraint uk_platform_catalog_id_platform_id unique (id, platform_id)
|
||||
);
|
||||
|
||||
create table wvp_platform_gb_channel (
|
||||
create table wvp_platform_channel (
|
||||
id serial primary key ,
|
||||
platform_id character varying(50),
|
||||
catalog_id character varying(50),
|
||||
|
|
|
@ -217,7 +217,7 @@ create table wvp_platform_catalog (
|
|||
constraint uk_platform_catalog_id_platform_id unique (id, platform_id)
|
||||
);
|
||||
|
||||
create table wvp_platform_gb_channel (
|
||||
create table wvp_platform_channel (
|
||||
id serial primary key ,
|
||||
platform_id character varying(50),
|
||||
catalog_id character varying(50),
|
||||
|
|
|
@ -448,7 +448,7 @@ rename table log to wvp_log;
|
|||
rename table media_server to wvp_media_server;
|
||||
rename table parent_platform to wvp_platform;
|
||||
rename table platform_catalog to wvp_platform_catalog;
|
||||
rename table platform_gb_channel to wvp_platform_gb_channel;
|
||||
rename table platform_gb_channel to wvp_platform_channel;
|
||||
rename table platform_gb_stream to wvp_platform_gb_stream;
|
||||
rename table stream_proxy to wvp_stream_proxy;
|
||||
rename table stream_push to wvp_stream_push;
|
||||
|
|
Loading…
Reference in New Issue