This commit is contained in:
高云鹏 2024-10-21 10:31:42 +08:00
commit 573df6322e
3 changed files with 105 additions and 15 deletions

View File

@ -41,9 +41,6 @@ public class SysMenusController {
if(!hasPermission){
return R.fail("没有系统管理权限");
}
if (StringUtils.isAllEnglishLetters(sysMenuDto.getMenuName())){
return R.fail("菜单名称,必须为英文");
}
return R.success(sysMenuService.createMenu(sysMenuDto));
}

View File

@ -288,7 +288,7 @@ public class DataServiceImpl implements DataService {
keyValueMap.put(fieldName, values.get(fieldName));
}
Long dataTime = data.getTime();
Long dataTime = jsonNode.get("dataTime").asLong();
List<RTData> highList = new ArrayList<>();
RTData rtHighData = RTData.builder()
.dataTime(dataTime)
@ -315,7 +315,7 @@ public class DataServiceImpl implements DataService {
keyValueMap.put(fieldName, values.get(fieldName));
}
Long dataTime = data.getTime();
Long dataTime = jsonNode.get("dataTime").asLong();
List<RTData> highList = new ArrayList<>();
RTData rtHighData = RTData.builder()
.dataTime(dataTime)

View File

@ -21,10 +21,18 @@ POST 请求接口
```json
[
{
"deviceId":"129476828342323",
"attributes":["power","windSpeed","dailyUsageHours","monthlyUsageHours"]
},
{
"deviceId":"129476828342324",
"attributes":["power","windSpeed","dailyUsageHours","monthlyUsageHours"]
}
......
]
```
入参描述
@ -33,6 +41,8 @@ POST 请求接口
| deviceId | String | no | 设备ID |
| attributes | StringArray | no | 要查询实时数据的设备属性列表 |
> PS: 当attributes为空时返回所有属性。
返回报文
```json
@ -41,14 +51,97 @@ POST 请求接口
"msg": "操作成功",
"success": true,
"data": {
"129476828342323":{
"power": 56.2,
"windSpeed": 45.3,
"dailyUsageHours": 20,
"monthlyUsageHours": 78,
....
},
"129476828342324":{
"power": 53.2,
"windSpeed": 35.3,
"dailyUsageHours": 10,
"monthlyUsageHours": 48,
....
}
}
}
```
返参描述
data 中以字典的方式,返回查询的属性的实时值。
data 中以字典的方式,返回查询的每个设备的属性的实时值。
### 历史区间数据查询
根据提供的开始时间及结束时间,查询指定设备在指定时间段内的历史数据。
POST 请求接口
> /api/data/history
请求参数
```json
{
//开始时间
"startTime": "123452435324242",
//结束时间
"endTime": "123452435924242",
//查询设备列表
"devices": [
{
//设备ID
"deviceId":"129476828342323",
//要查询的属性列表
"attributes":["power","windSpeed"]
},
{
"deviceId":"129476828342324",
"attributes":["power","dailyUsageHours"]
}
],
"interval": "1h"
}
```
入参描述
| 参数名 | 参数类型 | 可选 | 描述 |
| ------------ | -------- | ---- |------|
| startTime | String | no | 开始时间戳 |
| endTime | String | no | 结束时间戳 |
| devices.deviceId | String | no | 设备ID |
| devices.attributes | StringArray | no | 要查询实时数据的设备属性列表 |
| interval | String | yes | 抽样间隔,1a(毫秒),1s(秒),1m(分),1h(小时),1d(天),1w(周)。 忽略或者值为空时,返回原始数据(不抽样) |
| endTime | String | no | 结束时间戳 |
返回报文
```json
{
"code": 200,
"msg": "操作成功",
"success": true,
"data": {
//设备ID
"129476828342323":{
//属性名
"power": {
//时间戳列表
"times": [123452435924242,123452435924342,123452435924442,123452435924542],
//值列表
"values": [123.23,35.21,34.56,67]
} ,
//属性名
"windSpeed": {
"times": [123452435924242,123452435924342,123452435924442,123452435924542],
"values": [123.23,35.21,34.56,67]
}
},
.......
}
}
```