Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
befc5d29e5
@ -267,24 +267,24 @@ public class DataServiceImpl implements DataService {
|
|||||||
keyValueMap.put(key, high.get(fieldName).asDouble());
|
keyValueMap.put(key, high.get(fieldName).asDouble());
|
||||||
}
|
}
|
||||||
adminRedisTemplate.mSet(keyValueMap);
|
adminRedisTemplate.mSet(keyValueMap);
|
||||||
Long dataTime = data.getTime();
|
// Long dataTime = data.getTime();
|
||||||
|
//
|
||||||
// 存入td库
|
// // 存入td库
|
||||||
List<RTData> highList = new ArrayList<>();
|
// List<RTData> highList = new ArrayList<>();
|
||||||
List<RTData> lowList = new ArrayList<>();
|
// List<RTData> lowList = new ArrayList<>();
|
||||||
RTData rtHighData = RTData.builder()
|
// RTData rtHighData = RTData.builder()
|
||||||
.dataTime(dataTime)
|
// .dataTime(dataTime)
|
||||||
.deviceId(Long.valueOf(deviceId))
|
// .deviceId(Long.valueOf(deviceId))
|
||||||
.values(highFieldMap)
|
// .values(highFieldMap)
|
||||||
.build();
|
// .build();
|
||||||
RTData rtLowData = RTData.builder()
|
// RTData rtLowData = RTData.builder()
|
||||||
.dataTime(dataTime)
|
// .dataTime(dataTime)
|
||||||
.deviceId(Long.valueOf(deviceId))
|
// .deviceId(Long.valueOf(deviceId))
|
||||||
.values(highFieldMap)
|
// .values(highFieldMap)
|
||||||
.build();
|
// .build();
|
||||||
highList.add(rtHighData);
|
// highList.add(rtHighData);
|
||||||
lowList.add(rtLowData);
|
// lowList.add(rtLowData);
|
||||||
tdEngineService.updateYCHighValues(highList, iotModelCode);
|
// tdEngineService.updateYCHighValues(highList, iotModelCode);
|
||||||
tdEngineService.updateYCLowValues(lowList, iotModelCode);
|
// tdEngineService.updateYCLowValues(lowList, iotModelCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
- [首页](/)
|
- [首页](/)
|
||||||
- [API说明](api/)
|
- [API说明](api/)
|
||||||
|
- [系统管理接口](api/systemmgr.md)
|
||||||
|
- [设备管理接口](api/equipment.md)
|
||||||
|
- [节点管理接口](api/node.md)
|
||||||
|
- [数据访问接口](api/data.md)
|
||||||
- [数据采集](datacollect/)
|
- [数据采集](datacollect/)
|
@ -1,4 +1 @@
|
|||||||
* [返回首页](/)
|
* [返回首页](/)
|
||||||
* [设备模块](equipment.md)
|
|
||||||
* [节点模块](node.md)
|
|
||||||
* [系统管理模块](systemmgr.md)
|
|
54
docs/api/data.md
Normal file
54
docs/api/data.md
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# 数据访问接口
|
||||||
|
|
||||||
|
## API接口一览表
|
||||||
|
|
||||||
|
| 接口分类 | 接口描述 | API接口 | 权限 |
|
||||||
|
|--------|-------------|------------------------------| ---------------------------- |
|
||||||
|
| 数据查询 | 实时数据查询 | /api/data/snapshot | |
|
||||||
|
| | 历史区间数据查询 | /api/data/history | |
|
||||||
|
| | 历史断面数据查询 | /api/data/history/snapshot | |
|
||||||
|
|
||||||
|
|
||||||
|
## 数据查询接口
|
||||||
|
|
||||||
|
### 实时数据查询
|
||||||
|
|
||||||
|
POST 请求接口
|
||||||
|
|
||||||
|
> /api/data/snapshot
|
||||||
|
|
||||||
|
请求参数
|
||||||
|
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"deviceId":"129476828342323",
|
||||||
|
"attributes":["power","windSpeed","dailyUsageHours","monthlyUsageHours"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
入参描述
|
||||||
|
|
||||||
|
| 参数名 | 参数类型 | 可选 | 描述 |
|
||||||
|
| ------------ | -------- | ---- |------|
|
||||||
|
| deviceId | String | no | 设备ID |
|
||||||
|
| attributes | StringArray | no | 要查询实时数据的设备属性列表 |
|
||||||
|
|
||||||
|
返回报文
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"code": 200,
|
||||||
|
"msg": "操作成功",
|
||||||
|
"success": true,
|
||||||
|
"data": {
|
||||||
|
"power": 56.2,
|
||||||
|
"windSpeed": 45.3,
|
||||||
|
"dailyUsageHours": 20,
|
||||||
|
"monthlyUsageHours": 78,
|
||||||
|
....
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
返参描述
|
||||||
|
|
||||||
|
data 中以字典的方式,返回查询的属性的实时值。
|
@ -6,9 +6,10 @@ VITE_BASE_PATH = './'
|
|||||||
|
|
||||||
# 代理配置(开发使用),必须在一行中
|
# 代理配置(开发使用),必须在一行中
|
||||||
# 本地
|
# 本地
|
||||||
# VITE_APP_PROXY=[["/api","http://10.65.57.55:8080/api"]]
|
# VITE_APP_PROXY=[["/api","http://192.168.130.12:8080/api"]]
|
||||||
# 线上
|
# 线上
|
||||||
VITE_APP_PROXY=[["/api","https://test.jsspisoft.com/api"]]
|
VITE_APP_PROXY=[["/api","https://test.jsspisoft.com/api"]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -185,13 +185,28 @@
|
|||||||
<el-form-item :label="ModelAttributeFieldsEnums['attributeCode']" prop="attributeCode">
|
<el-form-item :label="ModelAttributeFieldsEnums['attributeCode']" prop="attributeCode">
|
||||||
<el-input v-model="attributeForm.attributeCode" :placeholder="'请输入' + ModelAttributeFieldsEnums['attributeCode']"></el-input>
|
<el-input v-model="attributeForm.attributeCode" :placeholder="'请输入' + ModelAttributeFieldsEnums['attributeCode']"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="ModelAttributeFieldsEnums['attributeTypeName']" prop="attributeType">
|
<div class="formRowStyle">
|
||||||
<el-select v-model="attributeForm.attributeType" :placeholder="'请选择' + ModelAttributeFieldsEnums['attributeTypeName']">
|
<el-form-item :label="ModelAttributeFieldsEnums['attributeTypeName']" prop="attributeType">
|
||||||
<el-option label="模拟量" :value="138"></el-option>
|
<el-select
|
||||||
<el-option label="累积量" :value="139"></el-option>
|
v-model="attributeForm.attributeType"
|
||||||
<el-option label="离散量" :value="140"></el-option>
|
:placeholder="'请选择' + ModelAttributeFieldsEnums['attributeTypeName']"
|
||||||
</el-select>
|
@change="attributeTypeChange"
|
||||||
</el-form-item>
|
>
|
||||||
|
<el-option label="模拟量" :value="138"></el-option>
|
||||||
|
<el-option label="累积量" :value="139"></el-option>
|
||||||
|
<el-option label="离散量" :value="140"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="ModelAttributeFieldsEnums['dataType']" prop="dataType">
|
||||||
|
<el-select
|
||||||
|
:disabled="!attributeForm.attributeType || attributeForm.attributeType === 140"
|
||||||
|
v-model="attributeForm.dataType"
|
||||||
|
:placeholder="'请选择' + ModelAttributeFieldsEnums['dataType']"
|
||||||
|
>
|
||||||
|
<el-option v-for="v in attributeFormDataTypeOptions" :key="v.value" :label="v.value" :value="v.value"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
<el-form-item :label="ModelAttributeFieldsEnums['porder']" prop="porder">
|
<el-form-item :label="ModelAttributeFieldsEnums['porder']" prop="porder">
|
||||||
<el-input v-model="attributeForm.porder" :placeholder="'请输入' + ModelAttributeFieldsEnums['porder']"></el-input>
|
<el-input v-model="attributeForm.porder" :placeholder="'请输入' + ModelAttributeFieldsEnums['porder']"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -201,6 +216,9 @@
|
|||||||
<el-form-item :label="ModelAttributeFieldsEnums['highSpeed']" prop="highSpeed">
|
<el-form-item :label="ModelAttributeFieldsEnums['highSpeed']" prop="highSpeed">
|
||||||
<el-checkbox v-model="attributeForm.highSpeed"></el-checkbox>
|
<el-checkbox v-model="attributeForm.highSpeed"></el-checkbox>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item :label="ModelAttributeFieldsEnums['visible']" prop="visible">
|
||||||
|
<el-checkbox v-model="attributeForm.visible"></el-checkbox>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button type="primary" @click="submitAttributeForm">提交</el-button>
|
<el-button type="primary" @click="submitAttributeForm">提交</el-button>
|
||||||
@ -278,7 +296,9 @@ import {
|
|||||||
ModelAttributeTableType,
|
ModelAttributeTableType,
|
||||||
ModelServiceTableType,
|
ModelServiceTableType,
|
||||||
ModelServiceFieldsEnums,
|
ModelServiceFieldsEnums,
|
||||||
|
ModelAttributeType,
|
||||||
AttributeDialogTitleStateType,
|
AttributeDialogTitleStateType,
|
||||||
|
attributeTypeDataType,
|
||||||
serviceDialogTitleStateType,
|
serviceDialogTitleStateType,
|
||||||
GetModelServiceType,
|
GetModelServiceType,
|
||||||
GetModelAttributeType,
|
GetModelAttributeType,
|
||||||
@ -533,6 +553,7 @@ const getAttributeList = (type?: radioGroupType, value?: string) => {
|
|||||||
? '离散量'
|
? '离散量'
|
||||||
: item.attributeType!,
|
: item.attributeType!,
|
||||||
highSpeed: item.highSpeed === 1,
|
highSpeed: item.highSpeed === 1,
|
||||||
|
visible: item.visible === 1,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
pageTotal.value = res.total
|
pageTotal.value = res.total
|
||||||
@ -607,6 +628,12 @@ const delServiceForm = (data: AddModelServiceType & UpdateModelServiceType) => {
|
|||||||
|
|
||||||
const attributeVisible = ref(false)
|
const attributeVisible = ref(false)
|
||||||
const attributeFormTitle = ref(AttributeDialogTitleStateType['add'])
|
const attributeFormTitle = ref(AttributeDialogTitleStateType['add'])
|
||||||
|
const attributeFormDataTypeOptions: { value: attributeTypeDataType }[] = [
|
||||||
|
{ value: 'int4' },
|
||||||
|
{ value: 'int8' },
|
||||||
|
{ value: 'float4' },
|
||||||
|
{ value: 'float8' },
|
||||||
|
]
|
||||||
const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = {
|
const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = {
|
||||||
id: null,
|
id: null,
|
||||||
iotModelId: '',
|
iotModelId: '',
|
||||||
@ -615,7 +642,9 @@ const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = {
|
|||||||
attributeType: null,
|
attributeType: null,
|
||||||
porder: null,
|
porder: null,
|
||||||
highSpeed: false,
|
highSpeed: false,
|
||||||
subsystem:'',
|
subsystem: '',
|
||||||
|
dataType: '',
|
||||||
|
visible: true,
|
||||||
revision: 1,
|
revision: 1,
|
||||||
createdBy: undefined,
|
createdBy: undefined,
|
||||||
createdTime: undefined,
|
createdTime: undefined,
|
||||||
@ -625,6 +654,12 @@ const originAttributeForm: AddModelAttributeType & UpdateModelAttributeType = {
|
|||||||
const attributeFormRef = ref<FormInstance>()
|
const attributeFormRef = ref<FormInstance>()
|
||||||
const attributeForm = ref<AddModelAttributeType & UpdateModelAttributeType>(JSON.parse(JSON.stringify(originAttributeForm)))
|
const attributeForm = ref<AddModelAttributeType & UpdateModelAttributeType>(JSON.parse(JSON.stringify(originAttributeForm)))
|
||||||
|
|
||||||
|
const attributeTypeChange = (value: ModelAttributeType) => {
|
||||||
|
if (value === 140) {
|
||||||
|
attributeForm.value.dataType = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const closeAttributeForm = () => {
|
const closeAttributeForm = () => {
|
||||||
attributeVisible.value = false
|
attributeVisible.value = false
|
||||||
attributeForm.value = JSON.parse(JSON.stringify(originAttributeForm))
|
attributeForm.value = JSON.parse(JSON.stringify(originAttributeForm))
|
||||||
@ -633,11 +668,12 @@ const closeAttributeForm = () => {
|
|||||||
const submitAttributeForm = () => {
|
const submitAttributeForm = () => {
|
||||||
attributeFormRef.value?.validate((valid: boolean) => {
|
attributeFormRef.value?.validate((valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
const copyFormData = JSON.parse(JSON.stringify(attributeForm.value))
|
||||||
|
copyFormData.highSpeed = copyFormData.highSpeed ? 1 : 0
|
||||||
|
copyFormData.visible = copyFormData.visible ? 1 : 0
|
||||||
if (attributeFormTitle.value === AttributeDialogTitleStateType['add']) {
|
if (attributeFormTitle.value === AttributeDialogTitleStateType['add']) {
|
||||||
const addFormData = JSON.parse(JSON.stringify(attributeForm.value))
|
copyFormData.iotModelId = curContextMenuTreeData.value!.id!
|
||||||
addFormData.iotModelId = curContextMenuTreeData.value!.id!
|
addModelAttributeReq(copyFormData)
|
||||||
addFormData.highSpeed = addFormData.highSpeed ? 1 : 0
|
|
||||||
addModelAttributeReq(addFormData)
|
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
ElMessage.success('新增物模型属性成功')
|
ElMessage.success('新增物模型属性成功')
|
||||||
@ -651,9 +687,7 @@ const submitAttributeForm = () => {
|
|||||||
ElMessage.error(err?.response?.data?.msg ?? '新增失败')
|
ElMessage.error(err?.response?.data?.msg ?? '新增失败')
|
||||||
})
|
})
|
||||||
} else if (attributeFormTitle.value === AttributeDialogTitleStateType['edit']) {
|
} else if (attributeFormTitle.value === AttributeDialogTitleStateType['edit']) {
|
||||||
const updateForm = JSON.parse(JSON.stringify(attributeForm.value))
|
updateModelAttributeReq(copyFormData)
|
||||||
updateForm.highSpeed = updateForm.highSpeed ? 1 : 0
|
|
||||||
updateModelAttributeReq(updateForm)
|
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
ElMessage.success('修改物模型属性成功')
|
ElMessage.success('修改物模型属性成功')
|
||||||
@ -964,4 +998,10 @@ $paginationHeight: 32px;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.formRowStyle {
|
||||||
|
display: flex;
|
||||||
|
.el-select {
|
||||||
|
width: 184px;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -62,8 +62,10 @@ export enum ModelAttributeFieldsEnums {
|
|||||||
'attributeType' = '属性类型value',
|
'attributeType' = '属性类型value',
|
||||||
'attributeTypeName' = '属性类型',
|
'attributeTypeName' = '属性类型',
|
||||||
'porder' = '序号',
|
'porder' = '序号',
|
||||||
'highSpeed'='是否高频',
|
'highSpeed' = '是否高频',
|
||||||
'subsystem'='子系统',
|
'subsystem' = '子系统',
|
||||||
|
'dataType' = '数据类型',
|
||||||
|
'visible'='是否可见',
|
||||||
'revision' = '乐观锁',
|
'revision' = '乐观锁',
|
||||||
'createdBy' = '创建人',
|
'createdBy' = '创建人',
|
||||||
'createdTime' = '创建时间',
|
'createdTime' = '创建时间',
|
||||||
@ -94,14 +96,17 @@ export type GetModelAttributeType = {
|
|||||||
pageNum: number
|
pageNum: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type attributeTypeDataType = 'int4' | 'int8' | 'float4' | 'float8'
|
||||||
export type AddModelAttributeType = {
|
export type AddModelAttributeType = {
|
||||||
iotModelId: string
|
iotModelId: string
|
||||||
attributeCode: string
|
attributeCode: string
|
||||||
attributeName: string
|
attributeName: string
|
||||||
attributeType: ModelAttributeType | null
|
attributeType: ModelAttributeType | null
|
||||||
porder: number | null
|
porder: number | null
|
||||||
highSpeed:0|1|boolean
|
highSpeed: 0 | 1 | boolean
|
||||||
subsystem:string
|
subsystem: string
|
||||||
|
dataType: ''
|
||||||
|
visible: 0 | 1 | boolean
|
||||||
revision: number
|
revision: number
|
||||||
createdBy?: string
|
createdBy?: string
|
||||||
createdTime?: string
|
createdTime?: string
|
||||||
|
Loading…
Reference in New Issue
Block a user