Appearance
智能电表
| 序号 | 版本 | 作者 | 日期 | 说明 |
|---|---|---|---|---|
| 1 | V1.0.0 | 蒋新建 | 2024-04-19 | 初始文档 |
| 2 | V1.0.1 | 蒋新建 | 2024-04-25 | 增加每日用电量的查询 |
| 3 | v1.0.2 | 蒋新建 | 2024-05-11 | 增加查询操作状态的接口 |
状态码说明
| 状态码 | 说明 |
|---|---|
| 200 | 操作成功 |
| -1 | 未知错误 |
| 10001 | 授权账号无效 |
| 10002 | 设备不存在 |
| 10003 | 设备已被注册 |
| 10004 | 设备已过有效使用期 |
| 10005 | 无此设备操作权限 |
| 10009 | 设备未激活或未初始化 |
| 10011 | 参数缺失 |
| 10012 | 参数无效 |
| 10021 | 数据不存在 |
| 10031 | 不支持此操作 |
| 10032 | 设备连接超时 |
| 10032 | 处理中,请稍候再试 |
API列表
1. 获取电表列表信息
- URI:/openapi/v1/electric_meter/list_page
- Method:
post- 需要鉴权: 是
- 是否同步: 同步
请求参数
字段名 类型 是否必填 字段说明 name String 否 表名 sn String 否 sn码 installAddress String 否 安装地址 size long 是 每页返回的记录数量,最大支持100,默认20 current long 是 当前页数 响应参数
字段名 类型 字段说明 current long 当前页 size long 每页显示条数 total long 总数 records List 数据结果集 > meterId String 电表id > name String 名称 > sn String 设备序列号 > installAddress String 安装地址 > meterType int 电表类型:1,主表,2,子表
2.电表信息
- URI:/openapi/v1/electric_meter/get_info
- Method:
post- 需要鉴权: 是
- 是否同步: 同步
请求参数
字段名 类型 是否必填 字段说明 meterId String 否 电表id(优先使用meterId) sn String 否 设备sn(当meterId为空时,sn必填) 响应参数
字段名 类型 字段说明 meterId String 电表id paymentMode Int 付费模式(1:预付费;2:后付费;) priceRule Object 单价(缺省价,尖峰平谷+时间范围)详情见PriceRuleDTO currentReading BigDecimal 当前读数 overdraft BigDecimal 透支额度 apportionConsumption BigDecimal 分摊读数 voltage BigDecimal 电压 electricCurrent BigDecimal 电流 samplingPower BigDecimal 采样功率 samplingTime Date 采样时间 installAddress String 安装地址 isCheckin Int 是否入住0,否,1是 meterType Int 电表类型:1,主表,2,子表 sn String 序列号 macAddr String 网卡地址 bluetoothAddr String 蓝牙地址 surplusConsumption BigDecimal 剩余电量 extraFee List 加收费用,详情见PriceTimeIntervalDTO onlineStatus Integer 在线状态(1:在线;2:离线) valveStatus Integer 阀门状态(0:未知 1:开阀/合闸 2:关阀/断闸)
3.抄表
- URI:/openapi/v1/electric_meter/reading
- Method:
post- 需要鉴权: 是
- 是否同步: 异步
请求参数
字段名 类型 是否必填 字段说明 meterId String 否 电表id(优先使用meterId) sn String 否 设备sn(当meterId为空时,sn必填) 响应参数
4.电表设置付费模式
- URI:/openapi/v1/electric_meter/payment_mode_edit
- Method:
post- 需要鉴权: 是
- 是否同步: 异步
请求参数
字段名 类型 是否必填 字段说明 meterId String 是 电表id paymentMode int 是 付费模式(1:预付费;2:后付费;) overdraft BigDecimal 否(预付费必填) 透支额度 响应参数
5.电表充值
- URI:/openapi/v1/electric_meter/charging
- Method:
post- 需要鉴权: 是
- 是否同步: 异步
请求参数
字段名 类型 是否必填 字段说明 meterId String 是 电表id chargingMethod Integer 是 充电方式(0,充读数,1,充钱数) chargingValue BigDecimal 是 充的值 remarks String 否 备注 响应参数
6.电表清零
- URI:/openapi/v1/electric_meter/clear
- Method:
post- 需要鉴权: 是
- 是否同步: 异步
请求参数
字段名 类型 是否必填 字段说明 meterId String 否 电表id(优先使用meterId) sn String 否 设备sn(当meterId为空时,sn必填) 响应参数
7.电表断电/供电
- URI:/openapi/v1/electric_meter/power_on_off
- Method:
post- 需要鉴权: 是
- 是否同步: 异步
请求参数
字段名 类型 是否必填 字段说明 meterId String 是 电表id opType Integer 是 操作类型:0,供电,1,断电 响应参数
8.电表设置费用价格
- URI:/openapi/v1/electric_meter/set_fee
- Method:
post- 需要鉴权: 是
- 是否同步: 同步
请求参数
字段名 类型 是否必填 字段说明 meterId String 是 电表id editValue Object 是 电表修改的对象,详情见ElectricFee remarks String 是 备注 ElectricFee
字段名 类型 是否必填 字段说明 priceRule Object 是 电费的电价规则,详情见PriceRuleDTO extraFee List 否 电费的额外价格,详情见PriceTimeIntervalDTO PriceRuleDTO
字段名 类型 是否必填 字段说明 defaultUnitPrice BigDecimal 是 电费单价:缺省价 peakPriceRule Object 否 尖峰电价规则,详情见PriceTimeIntervalDTO peakValleyPriceRule Object 否 峰谷电价规则,详情见PriceTimeIntervalDTO flatSectionPriceRule Object 否 平段电价规则,详情见PriceTimeIntervalDTO valleyPriceRule Object 否 谷段电价规则,详情见PriceTimeIntervalDTO PriceTimeIntervalDTO
字段名 类型 是否必填 字段说明 enable boolean 是 是否启用 unitPrice BigDecimal 是 单价 feeName String 是 费用名称 feeCode String 是 费用代码 startTime String 否(尖峰平谷价必填) 开始时间(格式00:00) endTime String 否(尖峰平谷价必填) 结束时间(格式00:00) 响应参数
9.电表设置透支余额
- URI:/openapi/v1/electric_meter/set_overdraft
- Method:
post- 需要鉴权: 是
- 是否同步: 异步
请求参数
字段名 类型 是否必填 字段说明 meterId String 是 电表id overdraft BigDecimal 是 透支额度 remarks String 否 备注 响应参数
10.查询每日用电量
- URI:/openapi/v1/electric_meter/day_usage_list
- Method:
post- 需要鉴权: 是
- 是否同步: 同步
请求参数
字段名 类型 是否必填 字段说明 meterId String 是 电表id startTime LongString 是是 开始时间名称 endTime LongString 是是 结束时间手机号 size long 是 每页返回的记录数量,最大支持100,默认20 current long 是 当前页数 响应参数
字段名 类型 字段说明 current long 当前页 size long 每页显示条数 total long 总数 records List 数据结果集 > meterId String 电表id > day String 用电所在天(yyyy-MM-dd) > startReading BigDecimal 开始读数 > endReading BigDecimal 结束读数 > totalUsage BigDecimal 总用量 > apportionConsumption BigDecimal 分摊读数
11.查询操作记录
- URI:/openapi/v1/electric_meter/get_operation_status
- Method:
post- 需要鉴权: 是
- 是否同步: 同步
请求参数
字段名 类型 是否必填 字段说明 meterId String 是 电表id requestId String 是 请求id 响应参数
字段名 类型 字段说明 status Int 状态(-1,失败,0,请求中,1,成功) errorMsg String 错误信息
事件通知
事件通知类型:
- EM01->抄表事件
- EM02->电表设置付费模式事件
- EM03->电表充值事件
- EM04->电表清零事件
- EM05->电表断电/供电事件
- EM06->电表设置透支余额事件
- EM07->电表上报事件
- EM08->报警事件
抄表事件
json{ "data": { "sn": "123456",//设备号 "meterId":"123456",//设备id "currentReading": "0.00",//当前读数 "readingRefTime": "2024-04-19T00:00:00",//当前读数刷新时间 "voltage": "220",//电压 "electricCurrent": "11",//电流 "samplingPower": "111",//采样功率 "samplingTime": "2024-04-19T00:00:00",//采样时间 "surplusConsumption": "10.00",//剩余电量 "requestId": "0KLRm9DVcJjTVE3O", "isSeccess": true//是否成功 }, "eventType": "EM01" }电表设置付费模式事件
json{ "data": { "sn": "123456",//设备号 "meterId":"123456",//设备id "paymentMode":"1",//付费模式(1:预付费;2:后付费;) "priceRule":"{\"defaultUnitPrice\":1}",//单价(缺省价,尖峰平谷+时间范围)详情见PriceRuleDTO "extraFee":"[{\"enable\":1,\"unitPrice\":1,\"feeName\":\"测试费用\",\"feeCode\":\"test_fee\"}]",//电费的额外价格,详情见PriceTimeIntervalDTO "overdraft":"1.90",//透支额度 "requestId": "0KLRm9DVcJjTVE3O", "isSeccess": true//是否成功 }, "eventType": "EM02" }电表充值事件
json{ "data": { "sn": "123456",//设备号 "meterId":"123456",//设备id "chargingValue":2.7,//充值的度数 "surplusConsumption":8.9,//剩余用电量 "requestId": "0KLRm9DVcJjTVE3O", "isSeccess": true//是否成功 }, "eventType": "EM03" }电表清零
json{ "data": { "sn": "123456",//设备号 "meterId":"123456",//设备id "requestId": "0KLRm9DVcJjTVE3O", "isSeccess": true//是否成功 }, "eventType": "EM04" }电表断电/供电事件
java{ "data": { "sn": "123456",//设备号 "meterId":"123456",//设备id "valveStatus":1,//阀门状态(0,未知,1,合闸,2,断闸) "requestId": "0KLRm9DVcJjTVE3O", "isSeccess": true//是否成功 }, "eventType": "EM05" }电表设置透支余额事件
json{ "data": { "sn": "123456",//设备号 "meterId":"123456",//设备id "overdraft":"1.90",//透支额度 "requestId": "0KLRm9DVcJjTVE3O", "isSeccess": true//是否成功 }, "eventType": "EM06" }电表上报事件
json{ "data": { "sn": "123456",//设备号 "meterId":"123456",//设备id "currentReading": "0.00",//当前读数 "readingRefTime": "2024-04-19T00:00:00",//当前读数刷新时间 "voltage": "220",//电压 "electricCurrent": "11",//电流 "samplingPower": "111",//采样功率 "samplingTime": "2024-04-19T00:00:00",//采样时间 "surplusConsumption": "10.00",//剩余电量 "requestId": "0KLRm9DVcJjTVE3O" }, "eventType": "EM07" }报警事件
json{ "data": { "sn": "123456",//设备号 "meterId":"123456",//设备id "alarmList": [1,2,3,4],//1,"电压越限报警",2,"功率越限报警,3,"剩余电量报警",4,"透支量报警 "requestId": "0KLRm9DVcJjTVE3O" }, "eventType": "EM08" }