能耗预付费系统 API 接口文档
注:127.0.0.1 需替换为服务器 IP
一、登录
接口功能:登录获取 token
URL:http://127.0.0.1/api/system/user/login
支持格式:JSON
HTTP 请求方式:POST
请求参数 Body form-data
| 参数 | 字段类型 | 说明 |
|---|---|---|
| username | String | 用户名,必填 |
| password | string | 密码,必填 |
请求示例

响应示例: token和projectId 在后续接口中会用到
{
"code": 200,
"message": "success",
"data": {
"token": "E2DA8E8BA237C3DDA7FD44Y87FE47B5DE",
"roleId": 39,
"username": "wqazs",
"userId": 96,
"role": [],
"projectId": 130,
"projectName": "智能建筑能源管理系统",
"projectTime": "2025-05-01 00:00:00"
}
}
二、设备信息
接口功能:获取所有设备信息
URL:http://127.0.0.1:8082/api/setting/device/list
支持格式:JSON
HTTP 请求方式:POST
请求参数 Body form-data
| 参数 | 字段类型 | 说明 |
|---|---|---|
| token | String | 必须放在Header里 |
| projectId | Int | 项目 ID,必填 |
| page | Int | 页码 |
| size | Int | 页大小 |
请求示例

响应示例
{
"code": 200,
"message": "success",
"data": {
"list": [
{
"gw": "admin/gw1", //网关编码
"positionName": "园区/2 号楼", //位置
"categorySubName": "商业用电", //能耗分项
"categoryDisplayName": "电表", //设备类型
"status": true, //设备状态
"name": "Device1", //设备编码
"description": "电表 s", //设备描述
"id": 656, //设备id
"pt": 1, //电压变比
"ct": 1, //电流变比
"createTime": "2025-09-23 10:56:12" //创建时间
},
{
"gw": "admin/gw1",
"positionName": "园区/2 号楼",
"categorySubName": "商业用电",
"categoryName": "ELECTRIC",
"categoryDisplayName": "电表",
"status": true,
"name": "Device2",
"id": 657,
"pt": 1,
"ct": 1,
"createTime": "2025-09-23 10:56:12"
}
],
"pageNumber": 1,
"pageSize": 3,
"totalPage": 4,
"totalRow": 12,
"firstPage": true,
"lastPage": false
}
}
三、实时数据
接口功能:获取所有数据点当前最新的数据
URL:http://127.0.0.1:8082/api/monitor/device/monitoringList
支持格式:JSON
HTTP 请求方式:POST
请求参数 Body form-data
| 参数 | 字段类型 | 说明 |
|---|---|---|
| token | String | 必须放在Header里 |
| projectId | Int | 项目 ID,必填 |
| categoryId | Int | 能耗分项 水是 1,电是2,必填 |
| page | Int | 页码 |
| size | Int | 页大小 |
请求示例

响应示例
{
"code": 200,
"message": "success",
"data": {
"tableLabel": [
{
"label": "设备名称",
"prop": "deviceName"
},
{
"label": "设备模型",
"prop": "deviceModle"
},
{
"label": "位置",
"prop": "position"
},
{
"label": "E",
"prop": "E"
},
{
"label": "Switch",
"prop": "Switch"
}
],
"tableData": [
{
"deviceName": "DB123", //设备名称
"deviceModel": "ELECTRIC",//设备类型
"position": null, //位置
"id": 657, //设备id
"E": 195178.00, //采集点数据
"Switch": 0.00 //采集点数据
}
],
"totalRow": 1,
"pageNumber": 1,
"pageSize": 9999,
"totalPage": 1
}
}
四、历史数据
接口功能:获取单个数据点历史数据
URL:http://127.0.0.1:8082/api/monitor/device/monitoringList
支持格式:JSON
HTTP 请求方式:POST
请求参数 Body form-data
| 参数 | 字段类型 | 说明 |
|---|---|---|
| token | String | 必须放在Header里 |
| projectId | Int | 项目 ID,必填 |
| gw | String | 网关编码 必填 |
| dn | String | 设备编码 必填 |
| fieldName | String | 数据点名称 必填 |
| startTime | String | 必填 |
| endTime | String | 必填 |
| page | Int | 页码 |
| size | Int | 页大小 |
请求示例

响应示例
{
"code": 200,
"message": "success",
"data": {
"list": [
{
"time": "2026-05-18 10:49:00",
"value": 195919.0,
"status": "Good"
},
{
"time": "2026-05-18 10:48:00",
"value": 195869.0,
"status": "Good"
},
{
"time": "2026-05-18 10:47:00",
"value": 195819.0,
"status": "Good"
},
{
"time": "2026-05-18 10:46:00",
"value": 195769.0,
"status": "Good"
},
{
"time": "2026-05-18 10:45:00",
"value": 195719.0,
"status": "Good"
},
{
"time": "2026-05-18 10:44:00",
"value": 195670.0,
"status": "Good"
},
{
"time": "2026-05-18 10:43:00",
"value": 195620.0,
"status": "Good"
},
{
"time": "2026-05-18 10:42:00",
"value": 195570.0,
"status": "Good"
},
{
"time": "2026-05-18 10:41:00",
"value": 195520.0,
"status": "Good"
},
{
"time": "2026-05-18 10:40:00",
"value": 195470.0,
"status": "Good"
}
],
"pageNumber": 1,
"pageSize": 10,
"totalPage": 65,
"totalRow": 650,
"firstPage": true,
"lastPage": false
}
}
五、设备报表
接口功能:获取设备报表数据
URL:http://127.0.0.1:8082/api/energy/dailyReport/device
支持格式:JSON
HTTP 请求方式:POST
请求参数 Body form-data
| 参数 | 字段类型 | 说明 |
|---|---|---|
| token | String | 必须放在Header里 |
| projectId | Int | 项目 ID,必填 |
| categoryId | Int | 能耗分项 水是 1,电是2,必填 |
| categoryPropertyId | Int | 分类模型,必填 |
| type | String | 必填,day, month, year |
| startTime | String | 必填,2026-05-18 |
| page | Int | 页码 |
| size | Int | 页大小 |
请求示例

响应示例
{
"code": 200,
"message": "success",
"data": {
"tableData": [
{
"position": null,
"categorySub": null,
"dn": "DB123(电表123)",
"0:00": 2948.00,
"1:00": 2999.00,
"2:00": 2998.00,
"3:00": 2998.00,
"4:00": 2999.00,
"5:00": 2998.00,
"6:00": 2999.00,
"7:00": 2998.00,
"8:00": 2998.00,
"9:00": 2999.00,
"10:00": 2948.00,
"11:00": 2999.00,
"12:00": 2998.00,
"13:00": 2998.00,
"14:00": 2999.00,
"15:00": 2132.00,
"16:00": 0,
"17:00": 0,
"18:00": 0,
"19:00": 0,
"20:00": 0,
"21:00": 0,
"22:00": 0,
"23:00": 0,
"total": 47008.00
}
],
"totalRow": 1,
"totalPage": 1
}
}
六、获取分类模型
接口功能:项目下所有设备模型及分类
URL:http://127.0.0.1:8082/api/energy/dailyReport/device
支持格式:JSON
HTTP 请求方式:POST
请求参数 Body form-data
| 参数 | 字段类型 | 说明 |
|---|---|---|
| token | String | 必须放在Header里 |
| projectId | Int | 项目 ID,必填 |
请求示例

响应示例
{
"code": 200,
"message": "success",
"data": {
"list": [
{
"dosageProperties": [ //计量字段
{
"name": "正向有功总",
"id": 2, //分类模型ID, 参数中需要 categoryPropertyId
"ratio": "1",
"tagId": "E", //数据点名称,历史数据参数需要的 fieldName
"categoryId": 2,
"vtype": "L",
"vstate": null,
"unit": "kWh",
"isDosage": true,
"isCalc": true
}
],
"calcProperties": [
{
"name": "正向有功总",
"id": 2, //参数中需要的分类模型 categoryPropertyId
"ratio": "1",
"tagId": "E", //数据点名称,历史数据参数需要的 fieldName
"categoryId": 2,
"vtype": "L",
"vstate": null,
"unit": "kWh",
"isDosage": true,
"isCalc": true
}
],
"name": "ELECTRIC",
"id": 2, //能耗分项ID 参数中需要的 cateogryId
"displayName": "电表",
"projectId": 130,
"categoryId": 2
},
{
"dosageProperties": [ //计量字段
{
"name": "流量",
"id": 1, //分类模型ID, 参数中需要 categoryPropertyId
"ratio": "1",
"tagId": "MWE", //数据点名称,历史数据参数需要的 fieldName
"categoryId": 1,
"vtype": "L",
"vstate": null,
"unit": "T",
"isDosage": true,
"isCalc": true
}
],
"calcProperties": [ //计费字段
{
"name": "流量",
"id": 1, //分类模型ID, 参数中需要 categoryPropertyId
"ratio": "1",
"tagId": "MWE", //数据点名称,历史数据参数需要的 fieldName
"categoryId": 1,
"vtype": "L",
"vstate": null,
"unit": "T",
"isDosage": true,
"isCalc": true
}
],
"name": "WATER",
"id": 46,
"displayName": "水表",
"projectId": 130,
"categoryId": 1 //能耗分项ID 参数中需要的 cateogryId
},
{
"dosageProperties": [
{
"name": "冷量累积",
"id": 300,
"ratio": "1",
"tagId": "COOL",
"categoryId": 17,
"vtype": "L",
"vstate": null,
"unit": null,
"isDosage": true,
"isCalc": true
},
{
"name": "热量累积",
"id": 301,
"ratio": "1",
"tagId": "HEAT",
"categoryId": 17,
"vtype": "L",
"vstate": null,
"unit": null,
"isDosage": true,
"isCalc": true
}
],
"calcProperties": [
{
"name": "冷量累积",
"id": 300,
"ratio": "1",
"tagId": "COOL",
"categoryId": 17,
"vtype": "L",
"vstate": null,
"unit": null,
"isDosage": true,
"isCalc": true
},
{
"name": "热量累积",
"id": 301,
"ratio": "1",
"tagId": "HEAT",
"categoryId": 17,
"vtype": "L",
"vstate": null,
"unit": null,
"isDosage": true,
"isCalc": true
}
],
"name": "AC Gauge",
"id": 58,
"displayName": "空调表",
"projectId": 130,
"categoryId": 17
}
],
"pageNumber": 1,
"pageSize": 10,
"totalPage": 1,
"totalRow": 5,
"firstPage": true,
"lastPage": true
}
}