feat: init iot-util project with OneNET API integration
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package com.yixiong.iot.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备历史数据点响应的 data 字段
|
||||
*/
|
||||
@Data
|
||||
public class DatapointData {
|
||||
|
||||
/** 本次返回的数据点数量 */
|
||||
private Integer count;
|
||||
|
||||
/** 游标,用于分页继续请求 */
|
||||
private String cursor;
|
||||
|
||||
/** 数据流列表 */
|
||||
private List<DatapointStream> datastreams;
|
||||
|
||||
/**
|
||||
* 单个数据流及其数据点
|
||||
*/
|
||||
@Data
|
||||
public static class DatapointStream {
|
||||
/** 数据流名称 */
|
||||
private String id;
|
||||
/** 数据点列表 */
|
||||
private List<DatapointItem> datapoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个数据点
|
||||
*/
|
||||
@Data
|
||||
public static class DatapointItem {
|
||||
/** 数据记录时间 */
|
||||
private String at;
|
||||
/** 数据点的值 */
|
||||
private Object value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.yixiong.iot.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 旧版 API 设备详情数据(对应 api.heclouds.com/devices/{device_id})
|
||||
*/
|
||||
@Data
|
||||
public class DeviceDetailData {
|
||||
|
||||
/** 平台分配的唯一 ID */
|
||||
private String id;
|
||||
|
||||
/** 设备名称 */
|
||||
private String title;
|
||||
|
||||
/** 设备描述 */
|
||||
private String desc;
|
||||
|
||||
/** 设备接入协议 */
|
||||
private String protocol;
|
||||
|
||||
/** 是否在线 */
|
||||
private Boolean online;
|
||||
|
||||
/** 是否自动订阅 */
|
||||
private Boolean obsv;
|
||||
|
||||
/** 订阅状态 */
|
||||
@JsonProperty("obsv_st")
|
||||
private Boolean obsvSt;
|
||||
|
||||
/** 设备私密性 */
|
||||
@JsonProperty("private")
|
||||
private Boolean privateFlag;
|
||||
|
||||
/** 设备创建时间 */
|
||||
@JsonProperty("create_time")
|
||||
private String createTime;
|
||||
|
||||
/** 激活时间(第一次上线时间) */
|
||||
@JsonProperty("act_time")
|
||||
private String actTime;
|
||||
|
||||
/** 最后连接服务器时间 */
|
||||
@JsonProperty("last_ct")
|
||||
private String lastCt;
|
||||
|
||||
/** NB-IoT 设备 endpoint name(IMEI) */
|
||||
@JsonProperty("rg_id")
|
||||
private String rgId;
|
||||
|
||||
/** NB-IoT 设备当前 IMSI */
|
||||
private String imsi;
|
||||
|
||||
/** IMSI 最新修改时间 */
|
||||
@JsonProperty("imsi_mt")
|
||||
private String imsiMt;
|
||||
|
||||
/** IMSI 更改通知状态 */
|
||||
private Boolean ack;
|
||||
|
||||
/** 历史 IMSI 列表 */
|
||||
@JsonProperty("imsi_old")
|
||||
private List<String> imsiOld;
|
||||
|
||||
/** 设备鉴权信息 */
|
||||
@JsonProperty("auth_info")
|
||||
private Map<String, Object> authInfo;
|
||||
|
||||
/** 设备位置坐标 */
|
||||
private Map<String, Object> location;
|
||||
|
||||
/** 设备标签 */
|
||||
private List<String> tags;
|
||||
|
||||
/** 生产厂商名称 */
|
||||
@JsonProperty("manu_id")
|
||||
private String manuId;
|
||||
|
||||
/** 型号名称 */
|
||||
private String model;
|
||||
|
||||
/** 数据流信息列表 */
|
||||
private List<Map<String, Object>> datastreams;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.yixiong.iot.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 设备事件记录单条数据
|
||||
*/
|
||||
@Data
|
||||
public class DeviceEventItem {
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
* 1-信息;2-告警;3-故障
|
||||
*/
|
||||
@JsonProperty("event_type")
|
||||
private Integer eventType;
|
||||
|
||||
/** 设备事件上报时间戳(毫秒) */
|
||||
private Long time;
|
||||
|
||||
/** 事件功能点标识 */
|
||||
private String identifier;
|
||||
|
||||
/** 事件名称 */
|
||||
private String name;
|
||||
|
||||
/** 事件值(JSON 字符串) */
|
||||
private String value;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.yixiong.iot.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备事件记录列表响应的 data 字段
|
||||
*/
|
||||
@Data
|
||||
public class DeviceEventListData {
|
||||
|
||||
/** 事件记录列表 */
|
||||
private List<DeviceEventItem> list;
|
||||
|
||||
/** 本次请求起始位置 */
|
||||
private Integer offset;
|
||||
|
||||
/** 本次请求记录数上限 */
|
||||
private Integer limit;
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.yixiong.iot.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 设备列表中单个设备的数据结构
|
||||
*/
|
||||
@Data
|
||||
public class DeviceItem {
|
||||
|
||||
/** 设备 ID */
|
||||
private String did;
|
||||
|
||||
/** 产品 ID */
|
||||
private String pid;
|
||||
|
||||
/** 接入协议:2-MQTT,4-LwM2M */
|
||||
@JsonProperty("access_pt")
|
||||
private Integer accessPt;
|
||||
|
||||
/** 数据协议 */
|
||||
@JsonProperty("data_pt")
|
||||
private Integer dataPt;
|
||||
|
||||
/** 设备名称 */
|
||||
private String name;
|
||||
|
||||
/** 设备描述 */
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 设备状态
|
||||
* 0-离线;1-在线;2-未激活
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/** 设备创建时间 */
|
||||
@JsonProperty("create_time")
|
||||
private String createTime;
|
||||
|
||||
/** 设备激活时间 */
|
||||
@JsonProperty("activate_time")
|
||||
private String activateTime;
|
||||
|
||||
/** 设备最后一次在线时间 */
|
||||
@JsonProperty("last_time")
|
||||
private String lastTime;
|
||||
|
||||
/** 设备接入鉴权 key */
|
||||
@JsonProperty("sec_key")
|
||||
private String secKey;
|
||||
|
||||
/** LwM2M 设备 IMEI */
|
||||
private String imei;
|
||||
|
||||
/** LwM2M 设备 IMSI */
|
||||
private String imsi;
|
||||
|
||||
/** LwM2M 设备 PSK */
|
||||
private String psk;
|
||||
|
||||
/** LwM2M 设备 auth_code */
|
||||
@JsonProperty("auth_code")
|
||||
private String authCode;
|
||||
|
||||
/**
|
||||
* 产品智能化方式
|
||||
* 1-设备接入;2-产品智能化
|
||||
*/
|
||||
@JsonProperty("intelligent_way")
|
||||
private Integer intelligentWay;
|
||||
|
||||
/** 设备分组 ID */
|
||||
@JsonProperty("group_id")
|
||||
private String groupId;
|
||||
|
||||
/** 设备启用状态 */
|
||||
@JsonProperty("enable_status")
|
||||
private Boolean enableStatus;
|
||||
|
||||
/** 经度 */
|
||||
@JsonProperty("Lon")
|
||||
private String lon;
|
||||
|
||||
/** 纬度 */
|
||||
@JsonProperty("Lat")
|
||||
private String lat;
|
||||
|
||||
/** 设备资源自动订阅是否启用 */
|
||||
private Boolean obsv;
|
||||
|
||||
/** 设备资源自动订阅状态 */
|
||||
@JsonProperty("obsv_st")
|
||||
private Boolean obsvSt;
|
||||
|
||||
/** 设备私密性 */
|
||||
@JsonProperty("private")
|
||||
private Boolean privateFlag;
|
||||
|
||||
/** 设备 IMSI 历史变更记录 */
|
||||
@JsonProperty("imsi_old")
|
||||
private java.util.List<String> imsiOld;
|
||||
|
||||
/** 设备 IMSI 最近一次修改时间 */
|
||||
@JsonProperty("imsi_mt")
|
||||
private String imsiMt;
|
||||
|
||||
/** 移动视联网设备唯一标识 */
|
||||
@JsonProperty("viot_device_sn")
|
||||
private String viotDeviceSn;
|
||||
|
||||
/** 移动视联网设备接入协议 */
|
||||
@JsonProperty("viot_protocol")
|
||||
private Integer viotProtocol;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.yixiong.iot.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备列表响应的 data 字段
|
||||
*/
|
||||
@Data
|
||||
public class DeviceListData {
|
||||
|
||||
/** 设备列表 */
|
||||
private List<DeviceItem> list;
|
||||
|
||||
/** 查询起始下标 */
|
||||
private Integer offset;
|
||||
|
||||
/** 单次查询数量限额 */
|
||||
private Integer limit;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.yixiong.iot.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 设备属性最新数据单条记录
|
||||
*/
|
||||
@Data
|
||||
public class DevicePropertyItem {
|
||||
|
||||
/** 功能点标识 */
|
||||
private String identifier;
|
||||
|
||||
/** 功能点名称 */
|
||||
private String name;
|
||||
|
||||
/** 功能描述 */
|
||||
private String description;
|
||||
|
||||
/** 数据类型 */
|
||||
@JsonProperty("data_type")
|
||||
private String dataType;
|
||||
|
||||
/** 读写类型 */
|
||||
@JsonProperty("access_mode")
|
||||
private String accessMode;
|
||||
|
||||
/** 上报时间(毫秒时间戳字符串) */
|
||||
private String time;
|
||||
|
||||
/** 功能点上报值(JSON 字符串) */
|
||||
private String value;
|
||||
|
||||
/** 期望值(JSON 字符串) */
|
||||
@JsonProperty("expect_value")
|
||||
private String expectValue;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.yixiong.iot.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* IoT 平台接口通用响应包装类
|
||||
*
|
||||
* @param <T> 具体业务数据类型
|
||||
*/
|
||||
@Data
|
||||
public class IotResponse<T> {
|
||||
|
||||
/** 错误码,0 表示成功 */
|
||||
private int code;
|
||||
|
||||
/** 错误描述信息 */
|
||||
private String msg;
|
||||
|
||||
/** API 请求链路 ID */
|
||||
private String requestId;
|
||||
|
||||
/** 具体响应内容 */
|
||||
private T data;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.yixiong.iot.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 旧版 IoT API 通用响应包装类(api.heclouds.com)
|
||||
* 使用 errno/error 而非 code/msg
|
||||
*
|
||||
* @param <T> 具体业务数据类型
|
||||
*/
|
||||
@Data
|
||||
public class OldIotResponse<T> {
|
||||
|
||||
/** 错误码,0 表示成功 */
|
||||
private int errno;
|
||||
|
||||
/** 错误描述,"succ" 表示成功 */
|
||||
private String error;
|
||||
|
||||
/** 具体响应内容 */
|
||||
private T data;
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.yixiong.iot.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 产品详情数据,对应 IoT 平台 /product/detail 接口的 data 字段
|
||||
*/
|
||||
@Data
|
||||
public class ProductDetailData {
|
||||
|
||||
/** 产品 ID */
|
||||
@JsonProperty("product_id")
|
||||
private String productId;
|
||||
|
||||
/** 产品名称 */
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 节点类型
|
||||
* 1-直连设备;2-网关设备;3-子设备
|
||||
*/
|
||||
@JsonProperty("node_type")
|
||||
private Integer nodeType;
|
||||
|
||||
/**
|
||||
* 接入协议
|
||||
* 取值见接入协议取值说明表
|
||||
*/
|
||||
@JsonProperty("access_protocol")
|
||||
private Integer accessProtocol;
|
||||
|
||||
/**
|
||||
* 数据协议
|
||||
* 取值见数据协议取值说明表
|
||||
*/
|
||||
@JsonProperty("data_protocol")
|
||||
private Integer dataProtocol;
|
||||
|
||||
/** 联网方式 */
|
||||
private String network;
|
||||
|
||||
/** 产品厂商 */
|
||||
private String manufacturer;
|
||||
|
||||
/** 产品型号 */
|
||||
private String model;
|
||||
|
||||
/** 产品品牌 */
|
||||
private String brand;
|
||||
|
||||
/** 产品描述 */
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 开发状态
|
||||
* 1-开发中;2-审核中;3-审核未通过;4-已发布;5-已下架
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/** 产品创建时间 */
|
||||
@JsonProperty("create_time")
|
||||
private String createTime;
|
||||
|
||||
/** 最近修改时间 */
|
||||
@JsonProperty("update_time")
|
||||
private String updateTime;
|
||||
|
||||
/** 自有设备总数(缓存时效 5 分钟) */
|
||||
@JsonProperty("own_device_count")
|
||||
private Integer ownDeviceCount;
|
||||
|
||||
/** 在线设备总数(缓存时效 5 分钟) */
|
||||
@JsonProperty("online_device_count")
|
||||
private Integer onlineDeviceCount;
|
||||
|
||||
/** 离线设备数(缓存时效 5 分钟) */
|
||||
@JsonProperty("offline_device_count")
|
||||
private Integer offlineDeviceCount;
|
||||
|
||||
/** 未激活设备数(缓存时效 5 分钟) */
|
||||
@JsonProperty("not_active_device_count")
|
||||
private Integer notActiveDeviceCount;
|
||||
|
||||
/** 查询时间(毫秒时间戳) */
|
||||
@JsonProperty("query_time")
|
||||
private Long queryTime;
|
||||
|
||||
/** 视频类产品返回,用于视频播放器 SDK 集成参数 */
|
||||
@JsonProperty("viot_app_id")
|
||||
private String viotAppId;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yixiong.iot.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备属性历史记录响应的 data 字段
|
||||
* 实际 API 返回 data 为对象,内含 list 数组
|
||||
*/
|
||||
@Data
|
||||
public class PropertyHistoryData {
|
||||
|
||||
/** 属性历史记录列表 */
|
||||
private List<PropertyHistoryItem> list;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yixiong.iot.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 设备属性历史记录单条数据
|
||||
*/
|
||||
@Data
|
||||
public class PropertyHistoryItem {
|
||||
|
||||
/** 属性功能点上报时间(毫秒时间戳字符串) */
|
||||
private String time;
|
||||
|
||||
/** 属性功能点上报值 */
|
||||
private String value;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.yixiong.iot.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 物模型查询响应的 data 字段
|
||||
*/
|
||||
@Data
|
||||
public class ThingModelData {
|
||||
|
||||
/** 属性功能点列表 */
|
||||
private List<ThingModelProperty> properties;
|
||||
|
||||
/** 事件功能点列表 */
|
||||
private List<ThingModelEvent> events;
|
||||
|
||||
/** 服务功能点列表 */
|
||||
private List<ThingModelService> services;
|
||||
|
||||
/** 属性功能点 */
|
||||
@Data
|
||||
public static class ThingModelProperty {
|
||||
private String identifier;
|
||||
private String name;
|
||||
private String desc;
|
||||
private String accessMode;
|
||||
private String functionMode;
|
||||
private String functionType;
|
||||
private Map<String, Object> dataType;
|
||||
}
|
||||
|
||||
/** 事件功能点 */
|
||||
@Data
|
||||
public static class ThingModelEvent {
|
||||
private String identifier;
|
||||
private String name;
|
||||
private String desc;
|
||||
private String functionMode;
|
||||
@JsonProperty("eventType")
|
||||
private String eventType;
|
||||
private String fuctionType;
|
||||
private List<Map<String, Object>> outputData;
|
||||
}
|
||||
|
||||
/** 服务功能点 */
|
||||
@Data
|
||||
public static class ThingModelService {
|
||||
private String identifier;
|
||||
private String name;
|
||||
private String desc;
|
||||
private String callType;
|
||||
private String functionMode;
|
||||
private String fuctionType;
|
||||
private List<Map<String, Object>> input;
|
||||
private List<Map<String, Object>> output;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user