设备历史数据接口

1. 根据传入的equipmentId,fieldName,分页显示设备单一属性历史值

  • 请求语法
POST http://your-ip:9812/data/equipment/field-values
  • 请求参数

Body:

{
  "end": "2023-08-14T15:35:30+08:00",
  "equipmentId": "7007878938387025920",
  "fieldName": "v_RMS_Freq",
  "isDesc": true,
  "limit": 10,
  "offset": 0,
  "start": "2023-08-14T15:30:30+08:00"
}

Body结构:

参数名称 类型 是否必选 描述
equipmentId string 设备id
fieldName string 属性名称
limit integer 查询数据量上限
offset integer 数据偏移量,默认0
isDesc boolean 是否倒序,默认倒序true
start ZonedDateTime 开始时间
end ZonedDateTime 结束时间

响应:

{
  "data": {
    "total": null,
    "content": [
      {
        "id": "7007878938387025920",
        "tag": "v_RMS_Freq",
        "value": "0.71",
        "time": "2023-06-01T11:03:29.997+08:00"
      },
      {
        "id": "7007878938387025920",
        "tag": "v_RMS_Freq",
        "value": "0.71",
        "time": "2023-06-01T11:03:28.997+08:00"
      }
    ]
  },
  "code": 200,
  "message": null
}

响应结构:

字段名称 字段类型 字段描述
total integer 结果总数,目前没统计
content List<TagInfoDTO> 点位信息分页内容
tagInfoDTO.id string 设备id
tagInfoDTO.tag string 属性
tagInfoDTO.value string 属性值
tagInfoDTO.time string 时间
tagInfoDTO.state boolean 属性状态
tagInfoDTO.code string 属性错误码
tagInfoDTO.detail string 属性错误详情
tagInfoDTO.respFailCategory string 属性错误类型

示例:

请求:

curl -X POST "http://192.168.10.12:9812/data/equipment/field-values" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"end\": \"2023-08-14T15:35:30+08:00\", \"equipmentId\": \"7007878938387025920\", \"fieldName\": \"v_RMS_Freq\", \"isDesc\": true, \"limit\": 2, \"offset\": 0, \"start\": \"2023-08-14T15:30:30+08:00\"}"

响应:

{
  "data": {
    "total": null,
    "content": [
      {
        "id": "7007878938387025920",
        "tag": "v_RMS_Freq",
        "value": "0.71",
        "time": "2023-06-01T11:03:29.997+08:00"
      },
      {
        "id": "7007878938387025920",
        "tag": "v_RMS_Freq",
        "value": "0.71",
        "time": "2023-06-01T11:03:28.997+08:00"
      }
    ]
  },
  "code": 200,
  "message": null
}

2. 根据传入的fieldName获取设备属性历史值

  • 请求语法
POST http://your-ip:9812/data/equipment/api
  • 请求参数

Body:

{
  "end": "2023-08-14T15:35:30+08:00",
  "equipmentId": "7094859427517304832",
  "fieldName": "Autoincrement",
  "isDesc": true,
  "limit": 10,
  "offset": 0,
  "start": "2023-08-14T15:30:30+08:00"
}

Body结构:

参数名称 类型 是否必选 描述
equipmentId string 设备id
fieldName string 属性名称
limit integer 返回数据的最大数量
offset integer 返回数据的位置偏移
isDesc boolean 是否按照时间逆序排列
start ZonedDateTime 查询开始时间
end ZonedDateTime 查询结束时间

响应:

{
	"data": [
		{
			"id": "7094859427517304832",
			"tag": "Autoincrement",
			"value": 255199,
			"time": "2023-08-14T15:35:22.085+08:00"
		},
		{
			"id": "7094859427517304832",
			"tag": "Autoincrement",
			"value": 255198,
			"time": "2023-08-14T15:35:20.095+08:00"
		}
	],
	"code": 200,
	"message": null
}

响应结构:

字段名称 字段类型 字段描述
data.id string 设备id
data.tag string 属性
data.value string 属性值
data.time string 时间

示例:

curl --request POST \
  --url http://10.10.32.200:9812/data/equipment/field-values/list \
  --header 'Content-Type: application/json' \
  --header 'accept: */*' \
  --header 'content-type: application/json' \
  --data '{
    "end": "2023-08-14T15:35:30+08:00",
    "equipmentId": "7094859427517304832",
    "fieldName": "Autoincrement",
    "isDesc": true,
    "limit": 10,
    "offset": 0,
    "start": "2023-08-14T15:30:30+08:00"
}'

请求:

{
    "end": "2023-08-14T15:35:30+08:00",
    "equipmentId": "7094859427517304832",
    "fieldName": "Autoincrement",
    "isDesc": true,
    "limit": 10,
    "offset": 0,
    "start": "2023-08-14T15:30:30+08:00"
}

响应:

{
	"data": [
		{
			"id": "7094859427517304832",
			"tag": "Autoincrement",
			"value": 255202,
			"time": "2023-08-14T15:35:28.098+08:00"
		},
		{
			"id": "7094859427517304832",
			"tag": "Autoincrement",
			"value": 255201,
			"time": "2023-08-14T15:35:26.115+08:00"
		}
	],
	"code": 200,
	"message": null
}

3. 根据传入的fieldNames,获取设备多个属性值历史记录

请求语法

Path: http://your-ip:9812/data/equipment/getMultiFieldsValues/list

Method: POST

请求体

Request Body:

name type desc
equipmentId string 设备id
fieldNames List<String> 属性名称列表
limit integer 返回数据的最大数量
offset integer 返回数据的位置偏移
isDesc boolean 是否按照时间逆序排列
start ZonedDateTime 查询开始时间
end ZonedDateTime 查询结束时间

Request Demo:

curl -X POST "http://192.168.10.12:9812/data/equipment/getMultiFieldsValues/list" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"end\": \"2023-06-01T03:03:30.111Z\", \"equipmentId\": \"7007878938387025920\", \"fieldNames\": [ \"v_RMS_Freq\",\"a_RMS_Freq\" ], \"fillType\": \"NULL\", \"isDesc\": true, \"limit\": 2, \"offset\": 0, \"start\": \"2023-06-01T02:03:30.111Z\"}"
{
  "end": "2023-06-01T03:03:30.111Z",
  "equipmentId": "7007878938387025920",
  "fieldNames": [
    "v_RMS_Freq","a_RMS_Freq"
  ],
  "fillType": "NULL",
  "isDesc": true,
  "limit": 2,
  "offset": 0,
  "start": "2023-06-01T02:03:30.111Z"
}

响应体

Headers:

name value required desc
content-type application/json;charset=UTF-8 NO

Body:

name type desc
arrayNode Json json数组

Response Demo:

{
  "data": [
    {
      "time": "2023-06-01T11:03:29.997+08:00",
      "a_RMS_Freq": 3.6,
      "v_RMS_Freq": 0.71
    },
    {
      "time": "2023-06-01T11:03:28.997+08:00",
      "a_RMS_Freq": 3.6,
      "v_RMS_Freq": 0.71
    }
  ],
  "code": 200,
  "message": null
}

4. 根据fieldName获取设备单一属性聚合值,支持根据时间段进行聚合

请求语法

Path: /data/equipment/agg/field-values

Method: POST

请求体

Headers:

name value required desc
Content-Type application/json YES

Request Body:

name type desc
equipmentId string 设备id
fieldName string 属性名称
fieldId integer 属性id
aggType string MINUTE
HOUR
DAY
interval integer 时间间隔
fillType string VALUE :填充给定的值,值为value定义的值
NULL :填充空值
NONE :不填充值,在给定的时间间隔上无返回结果
LINEAR :填充线性值
PREVIOUS :填充上一个值
NEXT :填充下一个值,td特有
aggFunction string MIN :最小值
MAX :最大值
AVG :平均值
SUM :总和
COUNT :总数量
DISTINCT :去重
FIRST :最先值
LAST :最后值
limit integer 返回数据的最大数量
offset integer 返回数据的位置偏移
isDesc boolean 是否按照时间逆序排列
start ZonedDateTime 查询开始时间
end ZonedDateTime 查询结束时间

Request Demo:

curl -X POST "http://192.168.10.12:9812/data/equipment/agg/field-values" -H "accept: */*" -H "Content-Type: application/json" -d "{\t\"limit\": 2,\t\"start\": \"2023-06-01T02:17:47.419Z\",\t\"end\": \"2023-06-01T03:17:47.419Z\",\t\"fieldName\": \"field64\",\t\"name\": \"field64\",\t\"equipmentId\": \"7067365179163414528\",\t\"aggType\": \"MINUTE\",\t\"offset\": 0,\t\"fieldId\": 62063,\t\"fillType\": null}"
{
	"limit": 2,
	"start": "2023-06-01T02:17:47.419Z",
	"end": "2023-06-01T03:17:47.419Z",
	"fieldName": "field64",
	"name": "field64",
	"equipmentId": "7067365179163414528",
	"aggType": "MINUTE",
	"offset": 0,
	"fieldId": 62063,
	"fillType": null
}

响应体

Headers:

name value required desc
content-type application/json;charset=UTF-8 NO

Body:

name type desc
List<TagInfoAggDTO> tag聚合 信息
TagInfoAggDTO.id string 设备id
TagInfoAggDTO.mean string 平均值
TagInfoAggDTO.max string 最大值
TagInfoAggDTO.min string 最小值
TagInfoAggDTO.count string 数量
TagInfoAggDTO.tag string 属性
TagInfoAggDTO.time string 时间

Response Demo:

{
  "data": [
    {
      "id": "7067365179163414528",
      "tag": "field64",
      "time": "2023-06-01T10:18:00+08:00",
      "mean": "0.0",
      "max": "0.0",
      "min": "0.0"
    },
    {
      "id": "7067365179163414528",
      "tag": "field64",
      "time": "2023-06-01T10:17:00+08:00",
      "mean": "0.0",
      "max": "0.0",
      "min": "0.0"
    }
  ],
  "code": 200,
  "message": null
}

5. 根据fieldName获取设备属性值,针对布尔,时间等无法求极值

请求语法

Path: http://your-ip:9812/data/equipment/7094859427517304832/agg

Method: POST

请求体

Headers:

name value required desc
Content-Type application/json YES

Request Body:

name type desc
equipmentId string 设备id
fieldName string 属性名称
fieldId integer 属性id
aggType string MINUTE
HOUR
DAY
interval integer 时间间隔
fillType string VALUE :填充给定的值,值为value定义的值
NULL :填充空值
NONE :不填充值,在给定的时间间隔上无返回结果
LINEAR :填充线性值
PREVIOUS :填充上一个值
NEXT :填充下一个值,td特有
limit integer 返回数据的最大数量
offset integer 返回数据的位置偏移
isDesc boolean 是否按照时间逆序排列
start ZonedDateTime 查询开始时间
end ZonedDateTime 查询结束时间

Request Demo:

curl -X POST "http://192.168.10.12:9812/data/equipment/sample/field-values" -H "accept: */*" -H "Content-Type: application/json" -d "{\t\"limit\": 2,\t\"start\": \"2023-06-01T02:17:47.419Z\",\t\"end\": \"2023-06-01T03:17:47.419Z\",\t\"fieldName\": \"field64\",\t\"name\": \"field64\",\t\"equipmentId\": \"7067365179163414528\",\t\"aggType\": \"MINUTE\",\t\"offset\": 0,\t\"fieldId\": 62063,\t\"fillType\": null}"
{
  "aggFunction": "MIN",
  "aggType": "SECOND",
  "end": "2023-08-14T15:35:30+08:00",
  "fieldNames": [
    "Autoincrement","AutoincrementMulWaveCal"
  ],
  "fillType": "VALUE",
  "interval": 0,
  "isDesc": true,
  "limit": 10,
  "offset": 0,
  "orderBy": "string",
  "start": "2023-08-14T15:30:30+08:00"
}

响应体

Headers:

name value required desc
content-type application/json;charset=UTF-8 NO

Body:

name type desc
data.name string 设备id
data.label string 属性标识
data.type string 属性类型
data.value string 聚合值

Response Demo:

{
  "data": [
    {
      "name": "Autoincrement",
      "label": "自增",
      "type": "FLOAT",
      "value": 255053,
      "function": null
    },
    {
      "name": "AutoincrementMulWaveCal",
      "label": "自增*波形图计算",
      "type": "FLOAT",
      "value": 96279292018688,
      "function": null
    }
  ],
  "code": 200,
  "message": null
}
2024-10-16
1