Merge remote-tracking branch 'gitee-c/dev/master-通道结构重构' into dev/master-通道结构重构

This commit is contained in:
648540858
2024-06-26 18:41:37 +08:00
33 changed files with 1055 additions and 932 deletions

View File

@@ -0,0 +1,38 @@
package com.genersoft.iot.vmp.gb28181.bean;
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
import org.dom4j.Element;
import java.lang.reflect.InvocationTargetException;
@Data
@Slf4j
@EqualsAndHashCode(callSuper = true)
public class CatalogChannelEvent extends DeviceChannel{
private String event;
private DeviceChannel channel;
public static CatalogChannelEvent decode(Element element) throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
Element eventElement = element.element("Event");
CatalogChannelEvent catalogChannelEvent = new CatalogChannelEvent();
if (eventElement != null) {
catalogChannelEvent.setEvent(eventElement.getText());
}else {
catalogChannelEvent.setEvent(CatalogEvent.ADD);
}
DeviceChannel deviceChannel;
if (CatalogEvent.ADD.equalsIgnoreCase(catalogChannelEvent.getEvent()) ||
CatalogEvent.UPDATE.equalsIgnoreCase(catalogChannelEvent.getEvent()) ){
deviceChannel = DeviceChannel.decode(element);
}else {
deviceChannel = DeviceChannel.decodeWithOnlyDeviceId(element);
}
catalogChannelEvent.setChannel(deviceChannel);
return catalogChannelEvent;
}
}

View File

@@ -1,9 +0,0 @@
package com.genersoft.iot.vmp.gb28181.bean;
import com.genersoft.iot.vmp.gb28181.utils.MessageElement;
public class CatalogEvent extends DeviceChannel{
@MessageElement("Event")
private String event;
}

View File

@@ -7,6 +7,9 @@ import lombok.Data;
@Schema(description = "国标通道")
public class CommonGBChannel {
@Schema(description = "国标-数据库自增ID")
private int gbId;
@Schema(description = "国标-编码")
private String gbDeviceId;

View File

@@ -1,257 +1,170 @@
package com.genersoft.iot.vmp.gb28181.bean;
import com.genersoft.iot.vmp.gb28181.utils.MessageElement;
import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
import org.dom4j.Element;
import java.lang.reflect.InvocationTargetException;
@Data
@Slf4j
@Schema(description = "通道信息")
@EqualsAndHashCode(callSuper = true)
public class DeviceChannel extends CommonGBChannel {
@Schema(description = "数据库自增ID")
private int id;
@MessageElement("DeviceID")
@Schema(description = "编码")
private String deviceId;
@MessageElement("DeviceID")
@MessageElement("Name")
@Schema(description = "名称")
private String name;
@MessageElement("DeviceID")
@MessageElement("Manufacturer")
@Schema(description = "设备厂商")
private String manufacturer;
@MessageElement("DeviceID")
@MessageElement("Model")
@Schema(description = "设备型号")
private String model;
// 2016
@MessageElement("DeviceID")
@MessageElement("Owner")
@Schema(description = "设备归属")
private String owner;
@MessageElement("DeviceID")
@MessageElement("CivilCode")
@Schema(description = "行政区域")
private String civilCode;
@MessageElement("DeviceID")
@MessageElement("Block")
@Schema(description = "警区")
private String block;
@MessageElement("DeviceID")
@MessageElement("Address")
@Schema(description = "安装地址")
private String address;
@MessageElement("DeviceID")
@Schema(description = "是否有子设备")
private Boolean parental;
@MessageElement("Parental")
@Schema(description = "是否有子设备(必选)1有,0没有")
private Integer parental;
@MessageElement("DeviceID")
@MessageElement("ParentID")
@Schema(description = "父节点ID")
private String parentId;
// 2016
@MessageElement("DeviceID")
@MessageElement("SafetyWay")
@Schema(description = "信令安全模式")
private Integer safetyWay;
@MessageElement("DeviceID")
@MessageElement("RegisterWay")
@Schema(description = "注册方式")
private Integer registerWay;
// 2016
@MessageElement("DeviceID")
@MessageElement("CertNum")
@Schema(description = "证书序列号")
private Integer certNum;
private String certNum;
// 2016
@MessageElement("DeviceID")
@Schema(description = "证书有效标识")
@MessageElement("Certifiable")
@Schema(description = "证书有效标识, 缺省为0;证书有效标识:0:无效 1:有效")
private Integer certifiable;
// 2016
@MessageElement("DeviceID")
@MessageElement("ErrCode")
@Schema(description = "无效原因码(有证书且证书无效的设备必选)")
private Integer errCode;
// 2016
@MessageElement("DeviceID")
@MessageElement("EndTime")
@Schema(description = "证书终止有效期(有证书且证书无效的设备必选)")
private Integer endTime;
private String endTime;
// 2022
@MessageElement("DeviceID")
@Schema(description = "摄像机安全能力等级代码")
private String securityLevelCode;
@MessageElement("DeviceID")
@MessageElement("Secrecy")
@Schema(description = "保密属性(必选)缺省为0;0-不涉密,1-涉密")
private Integer secrecy;
@MessageElement("DeviceID")
@MessageElement("IPAddress")
@Schema(description = "设备/系统IPv4/IPv6地址")
private String ipAddress;
@MessageElement("DeviceID")
@MessageElement("Port")
@Schema(description = "设备/系统端口")
private Integer port;
@MessageElement("DeviceID")
@MessageElement("Password")
@Schema(description = "设备口令")
private String password;
@MessageElement("DeviceID")
@MessageElement("Status")
@Schema(description = "设备状态")
private Boolean status;
private String status;
@MessageElement("DeviceID")
@MessageElement("Longitude")
@Schema(description = "经度 WGS-84坐标系")
private Double longitude;
@MessageElement("DeviceID")
@MessageElement("Latitude")
@Schema(description = ",纬度 WGS-84坐标系")
private Double latitude;
@MessageElement("DeviceID")
@Schema(description = "虚拟组织所属的业务分组ID")
private String businessGroupId;
@MessageElement("DeviceID")
@MessageElement("Info.PTZType")
@Schema(description = "摄像机结构类型,标识摄像机类型: 1-球机; 2-半球; 3-固定枪机; 4-遥控枪机;5-遥控半球;6-多目设备的全景/拼接通道;7-多目设备的分割通道")
private Integer ptzType;
@MessageElement("DeviceID")
@Schema(description = "摄像机光电成像类型。1-可见光成像;2-热成像;3-雷达成像;4-X光成像;5-深度光场成像;9-其他。可多值,")
private String photoelectricImagingTyp;
@MessageElement("Info.PositionType")
@Schema(description = "摄像机位置类型扩展。1-省际检查站、2-党政机关、3-车站码头、4-中心广场、5-体育场馆、" +
"6-商业中心、7-宗教场所、8-校园周边、9-治安复杂区域、10-交通干线")
private Integer positionType;
@MessageElement("DeviceID")
@Schema(description = "摄像机采集部位类型")
private String capturePositionType;
@MessageElement("DeviceID")
@MessageElement("Info.RoomType")
@Schema(description = "摄像机安装位置室外、室内属性。1-室外、2-室内。")
private Integer roomType;
// 2016
@MessageElement("DeviceID")
@Schema(description = "用途属性")
@MessageElement("Info.UseType")
@Schema(description = "用途属性, 1-治安、2-交通、3-重点。")
private Integer useType;
@MessageElement("DeviceID")
@MessageElement("Info.SupplyLightType")
@Schema(description = "摄像机补光属性。1-无补光;2-红外补光;3-白光补光;4-激光补光;9-其他")
private Integer supplyLightType;
@MessageElement("DeviceID")
@MessageElement("Info.DirectionType")
@Schema(description = "摄像机监视方位(光轴方向)属性。1-东(西向东)、2-西(东向西)、3-南(北向南)、4-北(南向北)、" +
"5-东南(西北到东南)、6-东北(西南到东北)、7-西南(东北到西南)、8-西北(东南到西北)")
private Integer directionType;
@MessageElement("DeviceID")
@MessageElement("Info.Resolution")
@Schema(description = "摄像机支持的分辨率,可多值")
private String resolution;
// 2022
@MessageElement("DeviceID")
@Schema(description = "摄像机支持的码流编号列表,用于实时点播时指定码流编号(可选)")
private String streamNumberList;
@MessageElement("Info.BusinessGroupID")
@Schema(description = "虚拟组织所属的业务分组ID")
private String businessGroupId;
@MessageElement("DeviceID")
@MessageElement("Info.DownloadSpeed")
@Schema(description = "下载倍速(可选),可多值")
private String downloadSpeed;
@MessageElement("DeviceID")
@MessageElement("Info.SVCSpaceSupportMode")
@Schema(description = "空域编码能力,取值0-不支持;1-1级增强(1个增强层);2-2级增强(2个增强层);3-3级增强(3个增强层)")
private Integer svcSpaceSupportMod;
@MessageElement("DeviceID")
@MessageElement("Info.SVCTimeSupportMode")
@Schema(description = "时域编码能力,取值0-不支持;1-1级增强;2-2级增强;3-3级增强(可选)")
private Integer svcTimeSupportMode;
// 2022
@MessageElement("DeviceID")
@Schema(description = " SSVC增强层与基本层比例能力 ")
private String ssvcRatioSupportList;
// 2022
@MessageElement("DeviceID")
@Schema(description = "移动采集设备类型(仅移动采集设备适用,必选);1-移动机器人载摄像机;2-执法记录仪;3-移动单兵设备;" +
"4-车载视频记录设备;5-无人机载摄像机;9-其他")
private Integer mobileDeviceType;
// 2022
@MessageElement("DeviceID")
@Schema(description = "摄像机水平视场角(可选),取值范围大于0度小于等于360度")
private Double horizontalFieldAngle;
// 2022
@MessageElement("DeviceID")
@Schema(description = "摄像机竖直视场角(可选),取值范围大于0度小于等于360度 ")
private Double verticalFieldAngle;
// 2022
@MessageElement("DeviceID")
@Schema(description = "摄像机可视距离(可选),单位:米")
private Double maxViewDistance;
// 2022
@MessageElement("DeviceID")
@Schema(description = "基层组织编码(必选,非基层建设时为“000000”)")
private String grassrootsCode;
// 2022
@MessageElement("DeviceID")
@Schema(description = "监控点位类型(当为摄像机时必选),1-一类视频监控点;2-二类视频监控点;3-三类视频监控点;9-其他点位。")
private Integer poType;
// 2022
@MessageElement("DeviceID")
@Schema(description = "点位俗称")
private String poCommonName;
// 2022
@MessageElement("DeviceID")
@Schema(description = "设备MAC地址(可选),用“XX-XX-XX-XX-XX-XX”格式表达")
private String mac;
// 2022
@MessageElement("DeviceID")
@Schema(description = "摄像机卡口功能类型,01-人脸卡口;02-人员卡口;03-机动车卡口;04-非机动车卡口;05-物品卡口;99-其他")
private String functionType;
// 2022
@MessageElement("DeviceID")
@Schema(description = "摄像机视频编码格式")
private String encodeType;
// 2022
@MessageElement("DeviceID")
@Schema(description = "摄像机安装使用时间")
private String installTime;
// 2022
@MessageElement("DeviceID")
@Schema(description = "摄像机所属管理单位名称")
private String managementUnit;
// 2022
@MessageElement("DeviceID")
@Schema(description = "摄像机所属管理单位联系人的联系方式(电话号码,可多值,用英文半角“/”分割)")
private String contactInfo;
// 2022
@MessageElement("DeviceID")
@Schema(description = "录像保存天数(可选)")
private Integer recordSaveDays;
// 2022
@MessageElement("DeviceID")
@Schema(description = "国民经济行业分类代码(可选)")
private String industrialClassification;
@Schema(description = "云台类型描述字符串")
private String ptzTypeText;
@@ -306,4 +219,15 @@ public class DeviceChannel extends CommonGBChannel {
break;
}
}
public static DeviceChannel decode(Element element) throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
return XmlUtil.elementDecode(element, DeviceChannel.class);
}
public static DeviceChannel decodeWithOnlyDeviceId(Element element) {
Element deviceElement = element.element("DeviceID");
DeviceChannel deviceChannel = new DeviceChannel();
deviceChannel.setDeviceId(deviceElement.getText());
return deviceChannel;
}
}