优化收到目录时的分组信息处理
parent
a1671c3c3e
commit
7f8a15f017
|
@ -1,6 +1,6 @@
|
|||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.utils.MessageElement;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.MessageElementForCatalog;
|
||||
import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
@ -23,149 +23,149 @@ public class DeviceChannel extends CommonGBChannel {
|
|||
@Schema(description = "设备的数据库自增ID")
|
||||
private Integer deviceDbId;
|
||||
|
||||
@MessageElement("DeviceID")
|
||||
@MessageElementForCatalog("DeviceID")
|
||||
@Schema(description = "编码")
|
||||
private String deviceId;
|
||||
|
||||
@MessageElement("Name")
|
||||
@MessageElementForCatalog("Name")
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@MessageElement("Manufacturer")
|
||||
@MessageElementForCatalog("Manufacturer")
|
||||
@Schema(description = "设备厂商")
|
||||
private String manufacturer;
|
||||
|
||||
@MessageElement("Model")
|
||||
@MessageElementForCatalog("Model")
|
||||
@Schema(description = "设备型号")
|
||||
private String model;
|
||||
|
||||
// 2016
|
||||
@MessageElement("Owner")
|
||||
@MessageElementForCatalog("Owner")
|
||||
@Schema(description = "设备归属")
|
||||
private String owner;
|
||||
|
||||
@MessageElement("CivilCode")
|
||||
@MessageElementForCatalog("CivilCode")
|
||||
@Schema(description = "行政区域")
|
||||
private String civilCode;
|
||||
|
||||
@MessageElement("Block")
|
||||
@MessageElementForCatalog("Block")
|
||||
@Schema(description = "警区")
|
||||
private String block;
|
||||
|
||||
@MessageElement("Address")
|
||||
@MessageElementForCatalog("Address")
|
||||
@Schema(description = "安装地址")
|
||||
private String address;
|
||||
|
||||
@MessageElement("Parental")
|
||||
@MessageElementForCatalog("Parental")
|
||||
@Schema(description = "是否有子设备(必选)1有,0没有")
|
||||
private Integer parental;
|
||||
|
||||
|
||||
@MessageElement("ParentID")
|
||||
@MessageElementForCatalog("ParentID")
|
||||
@Schema(description = "父节点ID")
|
||||
private String parentId;
|
||||
|
||||
// 2016
|
||||
@MessageElement("SafetyWay")
|
||||
@MessageElementForCatalog("SafetyWay")
|
||||
@Schema(description = "信令安全模式")
|
||||
private Integer safetyWay;
|
||||
|
||||
@MessageElement("RegisterWay")
|
||||
@MessageElementForCatalog("RegisterWay")
|
||||
@Schema(description = "注册方式")
|
||||
private Integer registerWay;
|
||||
|
||||
// 2016
|
||||
@MessageElement("CertNum")
|
||||
@MessageElementForCatalog("CertNum")
|
||||
@Schema(description = "证书序列号")
|
||||
private String certNum;
|
||||
|
||||
// 2016
|
||||
@MessageElement("Certifiable")
|
||||
@MessageElementForCatalog("Certifiable")
|
||||
@Schema(description = "证书有效标识, 缺省为0;证书有效标识:0:无效 1:有效")
|
||||
private Integer certifiable;
|
||||
|
||||
// 2016
|
||||
@MessageElement("ErrCode")
|
||||
@MessageElementForCatalog("ErrCode")
|
||||
@Schema(description = "无效原因码(有证书且证书无效的设备必选)")
|
||||
private Integer errCode;
|
||||
|
||||
// 2016
|
||||
@MessageElement("EndTime")
|
||||
@MessageElementForCatalog("EndTime")
|
||||
@Schema(description = "证书终止有效期(有证书且证书无效的设备必选)")
|
||||
private String endTime;
|
||||
|
||||
@MessageElement("Secrecy")
|
||||
@MessageElementForCatalog("Secrecy")
|
||||
@Schema(description = "保密属性(必选)缺省为0;0-不涉密,1-涉密")
|
||||
private Integer secrecy;
|
||||
|
||||
@MessageElement("IPAddress")
|
||||
@MessageElementForCatalog("IPAddress")
|
||||
@Schema(description = "设备/系统IPv4/IPv6地址")
|
||||
private String ipAddress;
|
||||
|
||||
@MessageElement("Port")
|
||||
@MessageElementForCatalog("Port")
|
||||
@Schema(description = "设备/系统端口")
|
||||
private Integer port;
|
||||
|
||||
@MessageElement("Password")
|
||||
@MessageElementForCatalog("Password")
|
||||
@Schema(description = "设备口令")
|
||||
private String password;
|
||||
|
||||
@MessageElement("Status")
|
||||
@MessageElementForCatalog("Status")
|
||||
@Schema(description = "设备状态")
|
||||
private String status;
|
||||
|
||||
@MessageElement("Longitude")
|
||||
@MessageElementForCatalog("Longitude")
|
||||
@Schema(description = "经度 WGS-84坐标系")
|
||||
private Double longitude;
|
||||
|
||||
|
||||
@MessageElement("Latitude")
|
||||
@MessageElementForCatalog("Latitude")
|
||||
@Schema(description = ",纬度 WGS-84坐标系")
|
||||
private Double latitude;
|
||||
|
||||
@MessageElement("Info.PTZType")
|
||||
@MessageElementForCatalog("Info.PTZType")
|
||||
@Schema(description = "摄像机结构类型,标识摄像机类型: 1-球机; 2-半球; 3-固定枪机; 4-遥控枪机;5-遥控半球;6-多目设备的全景/拼接通道;7-多目设备的分割通道")
|
||||
private Integer ptzType;
|
||||
|
||||
@MessageElement("Info.PositionType")
|
||||
@MessageElementForCatalog("Info.PositionType")
|
||||
@Schema(description = "摄像机位置类型扩展。1-省际检查站、2-党政机关、3-车站码头、4-中心广场、5-体育场馆、" +
|
||||
"6-商业中心、7-宗教场所、8-校园周边、9-治安复杂区域、10-交通干线")
|
||||
private Integer positionType;
|
||||
|
||||
@MessageElement("Info.RoomType")
|
||||
@MessageElementForCatalog("Info.RoomType")
|
||||
@Schema(description = "摄像机安装位置室外、室内属性。1-室外、2-室内。")
|
||||
private Integer roomType;
|
||||
|
||||
@MessageElement("Info.UseType")
|
||||
@MessageElementForCatalog("Info.UseType")
|
||||
@Schema(description = "用途属性, 1-治安、2-交通、3-重点。")
|
||||
private Integer useType;
|
||||
|
||||
@MessageElement("Info.SupplyLightType")
|
||||
@MessageElementForCatalog("Info.SupplyLightType")
|
||||
@Schema(description = "摄像机补光属性。1-无补光;2-红外补光;3-白光补光;4-激光补光;9-其他")
|
||||
private Integer supplyLightType;
|
||||
|
||||
@MessageElement("Info.DirectionType")
|
||||
@MessageElementForCatalog("Info.DirectionType")
|
||||
@Schema(description = "摄像机监视方位(光轴方向)属性。1-东(西向东)、2-西(东向西)、3-南(北向南)、4-北(南向北)、" +
|
||||
"5-东南(西北到东南)、6-东北(西南到东北)、7-西南(东北到西南)、8-西北(东南到西北)")
|
||||
private Integer directionType;
|
||||
|
||||
@MessageElement("Info.Resolution")
|
||||
@MessageElementForCatalog("Info.Resolution")
|
||||
@Schema(description = "摄像机支持的分辨率,可多值")
|
||||
private String resolution;
|
||||
|
||||
@MessageElement("Info.BusinessGroupID")
|
||||
@MessageElementForCatalog({"BusinessGroupID","Info.BusinessGroupID"})
|
||||
@Schema(description = "虚拟组织所属的业务分组ID")
|
||||
private String businessGroupId;
|
||||
|
||||
@MessageElement("Info.DownloadSpeed")
|
||||
@MessageElementForCatalog("Info.DownloadSpeed")
|
||||
@Schema(description = "下载倍速(可选),可多值")
|
||||
private String downloadSpeed;
|
||||
|
||||
@MessageElement("Info.SVCSpaceSupportMode")
|
||||
@MessageElementForCatalog("Info.SVCSpaceSupportMode")
|
||||
@Schema(description = "空域编码能力,取值0-不支持;1-1级增强(1个增强层);2-2级增强(2个增强层);3-3级增强(3个增强层)")
|
||||
private Integer svcSpaceSupportMod;
|
||||
|
||||
@MessageElement("Info.SVCTimeSupportMode")
|
||||
@MessageElementForCatalog("Info.SVCTimeSupportMode")
|
||||
@Schema(description = "时域编码能力,取值0-不支持;1-1级增强;2-2级增强;3-3级增强(可选)")
|
||||
private Integer svcTimeSupportMode;
|
||||
|
||||
|
|
|
@ -75,6 +75,9 @@ public class Group implements Comparable<Group>{
|
|||
group.setBusinessGroup(channel.getBusinessGroupId());
|
||||
group.setParentDeviceId(channel.getParentId());
|
||||
}
|
||||
if (group.getBusinessGroup() == null) {
|
||||
return null;
|
||||
}
|
||||
return group;
|
||||
}
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ public interface CommonGBChannelMapper {
|
|||
" coalesce(wdc.gb_manufacturer, wdc.manufacturer) as gb_manufacturer,\n" +
|
||||
" coalesce(wdc.gb_model, wdc.model) as gb_model,\n" +
|
||||
" coalesce(wdc.gb_owner, wdc.owner) as gb_owner,\n" +
|
||||
" wdc.gb_civil_code,\n" +
|
||||
" coalesce(wdc.gb_civil_code, wdc.civil_code) as gb_civil_code,\n" +
|
||||
" coalesce(wdc.gb_block, wdc.block) as gb_block,\n" +
|
||||
" coalesce(wdc.gb_address, wdc.address) as gb_address,\n" +
|
||||
" coalesce(wpgc.parental, wdc.gb_parental, wdc.parental) as gb_parental,\n" +
|
||||
|
@ -317,7 +317,7 @@ public interface CommonGBChannelMapper {
|
|||
" 1 as type, " +
|
||||
" true as is_leaf " +
|
||||
" from wvp_device_channel " +
|
||||
" where gb_civil_code = #{parent} " +
|
||||
" where coalesce(gb_civil_code, civil_code) = #{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>")
|
||||
|
@ -325,7 +325,7 @@ public interface CommonGBChannelMapper {
|
|||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET gb_civil_code = null" +
|
||||
" SET gb_civil_code = null, civil_code = null" +
|
||||
" WHERE gb_civil_code in "+
|
||||
" <foreach collection='allChildren' item='item' open='(' separator=',' close=')' > #{item.deviceId}</foreach>" +
|
||||
" </script>"})
|
||||
|
@ -345,7 +345,7 @@ public interface CommonGBChannelMapper {
|
|||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET gb_civil_code = null" +
|
||||
" SET gb_civil_code = null, civil_code = null" +
|
||||
" WHERE id in "+
|
||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
|
||||
" </script>"})
|
||||
|
@ -362,7 +362,7 @@ public interface CommonGBChannelMapper {
|
|||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET gb_parent_id = null, gb_business_group_id = null" +
|
||||
" SET gb_parent_id = null, gb_business_group_id = null, parent_id = null, business_group_id = null" +
|
||||
" WHERE id in "+
|
||||
" <foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.gbId}</foreach>" +
|
||||
" </script>"})
|
||||
|
@ -390,6 +390,22 @@ public interface CommonGBChannelMapper {
|
|||
" </script>"})
|
||||
int updateParentIdByChannelList(@Param("parentId") String parentId, List<CommonGBChannel> channelList);
|
||||
|
||||
@Select("<script>" +
|
||||
" select " +
|
||||
" coalesce(gb_device_id, device_id) as id," +
|
||||
" coalesce(gb_name, name) as label, " +
|
||||
" 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 " +
|
||||
" where 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>")
|
||||
List<GroupTree> queryForGroupTreeByParentId(@Param("query") String query, @Param("parent") String parent);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
" UPDATE wvp_device_channel " +
|
||||
" SET gb_parent_id = #{parentId}, gb_business_group_id = #{businessGroup}" +
|
||||
|
@ -398,20 +414,4 @@ public interface CommonGBChannelMapper {
|
|||
" </script>"})
|
||||
int updateGroup(@Param("parentId") String parentId, @Param("businessGroup") String businessGroup,
|
||||
List<CommonGBChannel> channelList);
|
||||
|
||||
@Select("<script>" +
|
||||
" select " +
|
||||
" coalesce(gb_device_id, device_id) as id," +
|
||||
" coalesce(gb_name, name) as label, " +
|
||||
" id as db_id, " +
|
||||
" gb_parent_id as parent_device_id," +
|
||||
" gb_business_group_id as business_group," +
|
||||
" 1 as type, " +
|
||||
" true as is_leaf " +
|
||||
" from wvp_device_channel " +
|
||||
" where gb_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>")
|
||||
List<GroupTree> queryForGroupTreeByParentId(@Param("query") String query, @Param("parent") String parent);
|
||||
}
|
||||
|
|
|
@ -16,12 +16,12 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface DeviceChannelMapper {
|
||||
|
||||
@Insert("INSERT INTO wvp_device_channel (device_id, device_db_id, name, manufacturer, model, owner, civil_code, gb_civil_code, block, " +
|
||||
@Insert("INSERT INTO wvp_device_channel (device_id, device_db_id, name, manufacturer, model, owner, civil_code, block, " +
|
||||
"address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, end_time, secrecy, " +
|
||||
"ip_address, port, password, status, longitude, latitude, ptz_type, position_type, room_type, use_type, " +
|
||||
"supply_light_type, direction_type, resolution, business_group_id, download_speed, svc_space_support_mod, " +
|
||||
"svc_time_support_mode, create_time, update_time, sub_count,stream_id, has_audio, gps_time, stream_identification) " +
|
||||
"VALUES (#{deviceId}, #{deviceDbId}, #{name}, #{manufacturer}, #{model}, #{owner}, #{civilCode}, #{civilCode}, #{block}," +
|
||||
"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}," +
|
||||
|
@ -132,7 +132,7 @@ public interface DeviceChannelMapper {
|
|||
" coalesce(dc.gb_manufacturer, dc.manufacturer) as manufacturer,\n" +
|
||||
" coalesce(dc.gb_model, dc.model) as model,\n" +
|
||||
" coalesce(dc.gb_owner, dc.owner) as owner,\n" +
|
||||
" gb_civil_code as civil_code,\n" +
|
||||
" coalesce(dc.gb_civil_code, dc.civil_code) as civil_code,\n" +
|
||||
" coalesce(dc.gb_block, dc.block) as block,\n" +
|
||||
" coalesce(dc.gb_address, dc.address) as address,\n" +
|
||||
" coalesce(dc.gb_parental, dc.parental) as parental,\n" +
|
||||
|
@ -169,7 +169,7 @@ public interface DeviceChannelMapper {
|
|||
"coalesce(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%') " +
|
||||
"OR coalesce(dc.gb_name, dc.name) LIKE concat('%',#{query},'%') " +
|
||||
")</if> " +
|
||||
" <if test='parentChannelId != null'> AND (dc.parent_id=#{parentChannelId} OR dc.gb_civil_code = #{parentChannelId}) </if> " +
|
||||
" <if test='parentChannelId != null'> AND (dc.parent_id=#{parentChannelId} OR coalesce(dc.gb_civil_code, dc.civil_code) = #{parentChannelId}) </if> " +
|
||||
" <if test='online == true' > AND dc.status= true</if>" +
|
||||
" <if test='online == false' > AND dc.status= false</if>" +
|
||||
" <if test='hasSubChannel == true' > AND dc.sub_count > 0 </if>" +
|
||||
|
@ -197,7 +197,7 @@ public interface DeviceChannelMapper {
|
|||
" coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
|
||||
" coalesce(gb_model, model) as model,\n" +
|
||||
" coalesce(gb_owner, owner) as owner,\n" +
|
||||
" gb_civil_code as civil_code,\n" +
|
||||
" coalesce(gb_civil_code, civil_code) as civil_code,\n" +
|
||||
" coalesce(gb_block, block) as block,\n" +
|
||||
" coalesce(gb_address, address) as address,\n" +
|
||||
" coalesce(gb_parental, parental) as parental,\n" +
|
||||
|
@ -269,7 +269,7 @@ public interface DeviceChannelMapper {
|
|||
" coalesce(dc.gb_manufacturer, dc.manufacturer) as manufacturer,\n" +
|
||||
" coalesce(dc.gb_model, dc.model) as model,\n" +
|
||||
" coalesce(dc.gb_owner, dc.owner) as owner,\n" +
|
||||
" dc.gb_civil_code as civil_code,\n" +
|
||||
" coalesce(dc.gb_civil_code, dc.civil_code) as civil_code,\n" +
|
||||
" coalesce(dc.gb_block, dc.block) as block,\n" +
|
||||
" coalesce(dc.gb_address, dc.address) as address,\n" +
|
||||
" coalesce(dc.gb_parental, dc.parental) as parental,\n" +
|
||||
|
@ -359,7 +359,7 @@ public interface DeviceChannelMapper {
|
|||
" coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
|
||||
" coalesce(gb_model, model) as model,\n" +
|
||||
" coalesce(gb_owner, owner) as owner,\n" +
|
||||
" gb_civil_code as civil_code,\n" +
|
||||
" coalesce(gb_civil_code, civil_code) as civil_code,\n" +
|
||||
" coalesce(gb_block, block) as block,\n" +
|
||||
" coalesce(gb_address, address) as address,\n" +
|
||||
" coalesce(gb_parental, parental) as parental,\n" +
|
||||
|
@ -396,14 +396,14 @@ public interface DeviceChannelMapper {
|
|||
|
||||
@Insert("<script> " +
|
||||
"insert into wvp_device_channel " +
|
||||
"(device_id, device_db_id, name, manufacturer, model, owner, civil_code, gb_civil_code, block, " +
|
||||
"(device_id, device_db_id, name, manufacturer, model, owner, civil_code, block, " +
|
||||
"address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, end_time, secrecy, " +
|
||||
"ip_address, port, password, status, longitude, latitude, ptz_type, position_type, room_type, use_type, " +
|
||||
"supply_light_type, direction_type, resolution, business_group_id, download_speed, svc_space_support_mod, " +
|
||||
"svc_time_support_mode, create_time, update_time, sub_count, stream_id, has_audio, gps_time, stream_identification) " +
|
||||
"values " +
|
||||
"<foreach collection='addChannels' index='index' item='item' separator=','> " +
|
||||
"(#{item.deviceId}, #{item.deviceDbId}, #{item.name}, #{item.manufacturer}, #{item.model}, #{item.owner}, #{item.civilCode}, #{item.gbCivilCode}, #{item.block}, " +
|
||||
"(#{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}," +
|
||||
|
@ -499,7 +499,7 @@ public interface DeviceChannelMapper {
|
|||
" coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
|
||||
" coalesce(gb_model, model) as model,\n" +
|
||||
" coalesce(gb_owner, owner) as owner,\n" +
|
||||
" gb_civil_code as civil_code,\n" +
|
||||
" coalesce(gb_civil_code, civil_code) as civil_code,\n" +
|
||||
" coalesce(gb_block, block) as block,\n" +
|
||||
" coalesce(gb_address, address) as address,\n" +
|
||||
" coalesce(gb_parental, parental) as parental,\n" +
|
||||
|
@ -579,7 +579,7 @@ public interface DeviceChannelMapper {
|
|||
" coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
|
||||
" coalesce(gb_model, model) as model,\n" +
|
||||
" coalesce(gb_owner, owner) as owner,\n" +
|
||||
" gb_civil_code as civil_code,\n" +
|
||||
" coalesce(gb_civil_code, civil_code) as civil_code,\n" +
|
||||
" coalesce(gb_block, block) as block,\n" +
|
||||
" coalesce(gb_address, address) as address,\n" +
|
||||
" coalesce(gb_parental, parental) as parental,\n" +
|
||||
|
@ -652,7 +652,7 @@ public interface DeviceChannelMapper {
|
|||
" coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
|
||||
" coalesce(gb_model, model) as model,\n" +
|
||||
" coalesce(gb_owner, owner) as owner,\n" +
|
||||
" gb_civil_code as civil_code,\n" +
|
||||
" coalesce(gb_civil_code, civil_code) as civil_code,\n" +
|
||||
" coalesce(gb_block, block) as block,\n" +
|
||||
" coalesce(gb_address, address) as address,\n" +
|
||||
" coalesce(gb_parental, parental) as parental,\n" +
|
||||
|
@ -702,7 +702,7 @@ public interface DeviceChannelMapper {
|
|||
" coalesce(gb_manufacturer, manufacturer) as manufacturer,\n" +
|
||||
" coalesce(gb_model, model) as model,\n" +
|
||||
" coalesce(gb_owner, owner) as owner,\n" +
|
||||
" gb_civil_code as civil_code,\n" +
|
||||
" coalesce(gb_civil_code, civil_code) as civil_code,\n" +
|
||||
" coalesce(gb_block, block) as block,\n" +
|
||||
" coalesce(gb_address, address) as address,\n" +
|
||||
" coalesce(gb_parental, parental) as parental,\n" +
|
||||
|
|
|
@ -22,11 +22,11 @@ public class ChannelProvider {
|
|||
" coalesce(gb_manufacturer, manufacturer) as gb_manufacturer,\n" +
|
||||
" coalesce(gb_model, model) as gb_model,\n" +
|
||||
" coalesce(gb_owner, owner) as gb_owner,\n" +
|
||||
" gb_civil_code,\n" +
|
||||
" coalesce(gb_civil_code, civil_code),\n" +
|
||||
" coalesce(gb_block, block) as gb_block,\n" +
|
||||
" coalesce(gb_address, address) as gb_address,\n" +
|
||||
" coalesce(gb_parental, parental) as gb_parental,\n" +
|
||||
" gb_parent_id,\n" +
|
||||
" coalesce(gb_parent_id, parent_id) as gb_parent_id,\n" +
|
||||
" coalesce(gb_safety_way, safety_way) as gb_safety_way,\n" +
|
||||
" coalesce(gb_register_way, register_way) as gb_register_way,\n" +
|
||||
" coalesce(gb_cert_num, cert_num) as gb_cert_num,\n" +
|
||||
|
@ -47,7 +47,7 @@ public class ChannelProvider {
|
|||
" coalesce(gb_supply_light_type, supply_light_type) as gb_supply_light_type,\n" +
|
||||
" coalesce(gb_direction_type, direction_type) as gb_direction_type,\n" +
|
||||
" coalesce(gb_resolution, resolution) as gb_resolution,\n" +
|
||||
" gb_business_group_id,\n" +
|
||||
" coalesce(gb_business_group_id, business_group_id) as gb_business_group_id,\n" +
|
||||
" coalesce(gb_download_speed, download_speed) as gb_download_speed,\n" +
|
||||
" coalesce(gb_svc_space_support_mod, svc_space_support_mod) as gb_svc_space_support_mod,\n" +
|
||||
" coalesce(gb_svc_time_support_mode,svc_time_support_mode) as gb_svc_time_support_mode\n" +
|
||||
|
@ -89,16 +89,16 @@ public class ChannelProvider {
|
|||
sqlBuild.append(" AND coalesce(gb_status, status) = 'OFF'");
|
||||
}
|
||||
if (params.get("hasCivilCode") != null && (Boolean)params.get("hasCivilCode")) {
|
||||
sqlBuild.append(" AND gb_civil_code is not null");
|
||||
sqlBuild.append(" AND coalesce(gb_civil_code, civil_code) is not null");
|
||||
}
|
||||
if (params.get("hasCivilCode") != null && !(Boolean)params.get("hasCivilCode")) {
|
||||
sqlBuild.append(" AND gb_civil_code is null");
|
||||
sqlBuild.append(" AND coalesce(gb_civil_code, civil_code) is null");
|
||||
}
|
||||
if (params.get("hasGroup") != null && (Boolean)params.get("hasGroup")) {
|
||||
sqlBuild.append(" AND gb_business_group_id is not null");
|
||||
sqlBuild.append(" AND coalesce(gb_business_group_id, business_group_id) is not null");
|
||||
}
|
||||
if (params.get("hasGroup") != null && !(Boolean)params.get("hasGroup")) {
|
||||
sqlBuild.append(" AND gb_business_group_id is null");
|
||||
sqlBuild.append(" AND coalesce(gb_business_group_id, business_group_id) is null");
|
||||
}
|
||||
return sqlBuild.toString();
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ public class ChannelProvider {
|
|||
sqlBuild.append(getBaseSelectSql());
|
||||
sqlBuild.append("where ");
|
||||
if (params.get("civilCode") != null) {
|
||||
sqlBuild.append(" gb_civil_code = #{civilCode} ");
|
||||
sqlBuild.append(" coalesce(gb_civil_code, civil_code) = #{civilCode} ");
|
||||
if (params.get("ids") != null) {
|
||||
sqlBuild.append(" OR ");
|
||||
}
|
||||
|
@ -186,14 +186,14 @@ public class ChannelProvider {
|
|||
public String queryByCivilCode(Map<String, Object> params ){
|
||||
StringBuilder sqlBuild = new StringBuilder();
|
||||
sqlBuild.append(getBaseSelectSql());
|
||||
sqlBuild.append("where gb_civil_code = #{civilCode} ");
|
||||
return sqlBuild.toString() ;
|
||||
sqlBuild.append("where 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 gb_business_group_id = #{businessGroup} ");
|
||||
sqlBuild.append("where coalesce(gb_business_group_id, business_group_id) = #{businessGroup} ");
|
||||
return sqlBuild.toString() ;
|
||||
}
|
||||
|
||||
|
|
|
@ -456,7 +456,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
|||
deviceChannel.setStreamId(channelInDb.getStreamId());
|
||||
deviceChannel.setHasAudio(channelInDb.isHasAudio());
|
||||
deviceChannel.setId(channelInDb.getId());
|
||||
if (channelInDb.getStatus().equalsIgnoreCase(deviceChannel.getStatus())){
|
||||
if (channelInDb.getStatus() != null && channelInDb.getStatus().equalsIgnoreCase(deviceChannel.getStatus())){
|
||||
List<Integer> ids = platformChannelMapper.queryParentPlatformByChannelId(deviceChannel.getDeviceId());
|
||||
if (!CollectionUtils.isEmpty(ids)){
|
||||
ids.forEach(platformId->{
|
||||
|
|
|
@ -19,6 +19,7 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 区域管理类
|
||||
|
@ -185,7 +186,11 @@ public class GroupServiceImpl implements IGroupService {
|
|||
List<GroupTree> groupTrees = groupManager.queryForTree(query, parent, platformId);
|
||||
if (platformId == null) {
|
||||
List<GroupTree> channelList = commonGBChannelMapper.queryForGroupTreeByParentId(query, parent);
|
||||
groupTrees.addAll(channelList);
|
||||
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 查询平台独属的关联通道
|
||||
}
|
||||
|
@ -253,7 +258,9 @@ public class GroupServiceImpl implements IGroupService {
|
|||
groupMapForVerification.remove(region.getDeviceId());
|
||||
}
|
||||
}
|
||||
groupManager.batchAdd(new ArrayList<>(groupMapForVerification.values()));
|
||||
return false;
|
||||
if (!groupMapForVerification.isEmpty()) {
|
||||
groupManager.batchAdd(new ArrayList<>(groupMapForVerification.values()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,9 +58,26 @@ public class CatalogDataCatch {
|
|||
catalogData.setTotal(total);
|
||||
catalogData.setDevice(device);
|
||||
catalogData.setStatus(CatalogData.CatalogDataStatus.runIng);
|
||||
catalogData.getChannelList().addAll(deviceChannelList);
|
||||
catalogData.getRegionListList().addAll(regionList);
|
||||
catalogData.getGroupListListList().addAll(groupList);
|
||||
|
||||
if (deviceChannelList != null && !deviceChannelList.isEmpty()) {
|
||||
if (catalogData.getChannelList() != null) {
|
||||
catalogData.getChannelList().addAll(deviceChannelList);
|
||||
}
|
||||
}
|
||||
if (regionList != null && !regionList.isEmpty()) {
|
||||
if (catalogData.getRegionListList() != null) {
|
||||
catalogData.getRegionListList().addAll(regionList);
|
||||
}else {
|
||||
catalogData.setRegionListList(regionList);
|
||||
}
|
||||
}
|
||||
if (groupList != null && !groupList.isEmpty()) {
|
||||
if (catalogData.getGroupListListList() != null) {
|
||||
catalogData.getGroupListListList().addAll(groupList);
|
||||
}else {
|
||||
catalogData.setGroupListListList(groupList);
|
||||
}
|
||||
}
|
||||
catalogData.setLastTime(Instant.now());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
|||
@Transactional
|
||||
public void handForDevice(RequestEvent evt, Device device, Element element) {
|
||||
taskQueue.offer(new HandlerCatchData(evt, device, element));
|
||||
System.out.println(evt.getRequest());
|
||||
// 回复200 OK
|
||||
try {
|
||||
responseAck((SIPRequest) evt.getRequest(), Response.OK);
|
||||
|
@ -176,12 +177,20 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
|
|||
@Transactional
|
||||
public boolean saveData(Device device) {
|
||||
|
||||
boolean result = deviceChannelService.resetChannels(device.getId(), catalogDataCatch.getDeviceChannelList(device.getDeviceId()));
|
||||
if (!catalogDataCatch.getRegionList(device.getDeviceId()).isEmpty()) {
|
||||
boolean result = true;
|
||||
List<DeviceChannel> deviceChannelList = catalogDataCatch.getDeviceChannelList(device.getDeviceId());
|
||||
if (deviceChannelList != null && !deviceChannelList.isEmpty()) {
|
||||
result &= deviceChannelService.resetChannels(device.getId(), deviceChannelList);
|
||||
}
|
||||
|
||||
List<Region> regionList = catalogDataCatch.getRegionList(device.getDeviceId());
|
||||
if ( regionList!= null && !regionList.isEmpty()) {
|
||||
result &= regionService.batchAdd(catalogDataCatch.getRegionList(device.getDeviceId()));
|
||||
}
|
||||
if (!catalogDataCatch.getGroupList(device.getDeviceId()).isEmpty()) {
|
||||
result &= groupService.batchAdd(catalogDataCatch.getGroupList(device.getDeviceId()));
|
||||
|
||||
List<Group> groupList = catalogDataCatch.getGroupList(device.getDeviceId());
|
||||
if (groupList != null && !groupList.isEmpty()) {
|
||||
result &= groupService.batchAdd(groupList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package com.genersoft.iot.vmp.gb28181.utils;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author gaofuwang
|
||||
* @version 1.0
|
||||
* @date 2022/6/28 14:58
|
||||
*/
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface MessageElementForCatalog {
|
||||
String[] value();
|
||||
|
||||
String subVal() default "";
|
||||
}
|
|
@ -659,37 +659,41 @@ public class XmlUtil {
|
|||
T t = clazz.getDeclaredConstructor().newInstance();
|
||||
for (Field field : fields) {
|
||||
ReflectionUtils.makeAccessible(field);
|
||||
MessageElement annotation = field.getAnnotation(MessageElement.class);
|
||||
MessageElementForCatalog annotation = field.getAnnotation(MessageElementForCatalog.class);
|
||||
if (annotation == null) {
|
||||
continue;
|
||||
}
|
||||
String value = annotation.value();
|
||||
boolean subVal = value.contains(".");
|
||||
if (!subVal) {
|
||||
Element element1 = element.element(value);
|
||||
if (element1 == null) {
|
||||
continue;
|
||||
}
|
||||
// 无下级数据
|
||||
Object fieldVal = element1.isTextOnly() ? element1.getText() : loadElement(element1, field.getType());
|
||||
Object o = simpleTypeDeal(field.getType(), fieldVal);
|
||||
ReflectionUtils.setField(field, t, o);
|
||||
} else {
|
||||
String[] pathArray = value.split("\\.");
|
||||
Element subElement = element;
|
||||
for (String path : pathArray) {
|
||||
subElement = subElement.element(path);
|
||||
if (subElement == null) {
|
||||
break;
|
||||
String[] values = annotation.value();
|
||||
for (String value : values) {
|
||||
boolean subVal = value.contains(".");
|
||||
if (!subVal) {
|
||||
Element element1 = element.element(value);
|
||||
if (element1 == null) {
|
||||
continue;
|
||||
}
|
||||
// 无下级数据
|
||||
Object fieldVal = element1.isTextOnly() ? element1.getText() : loadElement(element1, field.getType());
|
||||
Object o = simpleTypeDeal(field.getType(), fieldVal);
|
||||
ReflectionUtils.setField(field, t, o);
|
||||
break;
|
||||
} else {
|
||||
String[] pathArray = value.split("\\.");
|
||||
Element subElement = element;
|
||||
for (String path : pathArray) {
|
||||
subElement = subElement.element(path);
|
||||
if (subElement == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (subElement == null) {
|
||||
continue;
|
||||
}
|
||||
Object fieldVal = subElement.isTextOnly() ? subElement.getText() : loadElement(subElement, field.getType());
|
||||
Object o = simpleTypeDeal(field.getType(), fieldVal);
|
||||
ReflectionUtils.setField(field, t, o);
|
||||
}
|
||||
if (subElement == null) {
|
||||
continue;
|
||||
}
|
||||
Object fieldVal = subElement.isTextOnly() ? subElement.getText() : loadElement(subElement, field.getType());
|
||||
Object o = simpleTypeDeal(field.getType(), fieldVal);
|
||||
ReflectionUtils.setField(field, t, o);
|
||||
}
|
||||
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
|
|
@ -708,7 +708,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
if (param != null && param.getMediaServerId().equalsIgnoreCase(mediaServerId)) {
|
||||
redisTemplate.delete(key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue