Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
287b6ed3e4
@ -1,7 +1,10 @@
|
||||
package com.das.modules.node.command;
|
||||
|
||||
import com.das.common.constant.EquipmentTypeIds;
|
||||
import com.das.common.utils.AdminRedisTemplate;
|
||||
import com.das.common.utils.StringUtils;
|
||||
import com.das.modules.cache.domain.DeviceInfoCache;
|
||||
import com.das.modules.cache.service.CacheService;
|
||||
import com.das.modules.node.constant.NodeConstant;
|
||||
import com.das.modules.node.domain.bo.TerminalMessage;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@ -17,6 +20,9 @@ public class HeartbeatCommand implements BaseCommand{
|
||||
|
||||
@Autowired
|
||||
AdminRedisTemplate adminRedisTemplate;
|
||||
|
||||
@Autowired
|
||||
CacheService cacheService;
|
||||
@Override
|
||||
public void doCommand(TerminalMessage data) {
|
||||
JsonNode dataInfo = data.getData();
|
||||
@ -39,6 +45,27 @@ public class HeartbeatCommand implements BaseCommand{
|
||||
adminRedisTemplate.expire(key, 300L);
|
||||
}
|
||||
}
|
||||
JsonNode devices = data.getData().get("devices");
|
||||
if (devices != null && devices.isArray()) {
|
||||
for (JsonNode device : devices) {
|
||||
Long deviceId = device.get("deviceId").asLong();
|
||||
Boolean online = device.get("online").asBoolean();
|
||||
DeviceInfoCache deviceInfoCacheById = cacheService.getEquipmentCache().getDeviceInfoCacheById(deviceId);
|
||||
if (deviceInfoCacheById == null || !deviceInfoCacheById.getObjectType().equals(EquipmentTypeIds.EQUIPMENT_TYPE_STATION_WTG)) {
|
||||
continue;
|
||||
}
|
||||
//判断是不是风机
|
||||
String keyPLCDeviceStatus = String.format("RT:%d:iturbineoperationmode", deviceId);
|
||||
String keyDeviceStatus = String.format("RT:%d:commfaultstate");
|
||||
Integer plcDeviceStatus = adminRedisTemplate.get(keyPLCDeviceStatus);
|
||||
if (plcDeviceStatus == null){
|
||||
adminRedisTemplate.set(keyDeviceStatus, online ? 1 : 0);
|
||||
}
|
||||
else{
|
||||
adminRedisTemplate.set(keyDeviceStatus, online && plcDeviceStatus == 1 ? 1 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -349,7 +349,15 @@ PS: 同一节点只允许建立一条连接。
|
||||
"linkId": "123",
|
||||
"online": false
|
||||
}
|
||||
]
|
||||
],
|
||||
//设备监控信息
|
||||
"devices": [
|
||||
{
|
||||
//设备ID
|
||||
"deviceId": "1123451235464",
|
||||
//设备状态
|
||||
"online": true
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -118,12 +118,15 @@
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="生产厂家:">
|
||||
<el-input v-model="editDeviceData.madeinFactory" placeholder="请输入生产厂家" clearable />
|
||||
<el-input disabled v-model="editDeviceData.madeinFactory" placeholder="请选择规格型号" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="规格型号:">
|
||||
<el-input v-model="editDeviceData.model" style="width: 200px" placeholder="请输入规格型号" clearable />
|
||||
<!-- <el-input v-model="editDeviceData.model" style="width: 200px" placeholder="请输入规格型号" clearable /> -->
|
||||
<el-select v-model="editDeviceData.model" placeholder="请选择规格型号" style="width: 200px" @change="selectEditModel">
|
||||
<el-option v-for="item in modelList" :key="item.model" :value="item.model"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -241,7 +244,7 @@
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="saveData">保存</el-button>
|
||||
<el-button @click="editDeviceDialog = false">取消</el-button>
|
||||
<el-button @click="editDeviceDialog = false">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@ -284,12 +287,14 @@
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="生产厂家:">
|
||||
<el-input v-model="editAddDeviceData.madeinFactory" placeholder="请输入生产厂家" clearable />
|
||||
<el-input disabled v-model="editAddDeviceData.madeinFactory" placeholder="请选择规格型号" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="规格型号:">
|
||||
<el-input v-model="editAddDeviceData.model" style="width: 200px" placeholder="请输入规格型号" clearable />
|
||||
<el-select v-model="editAddDeviceData.model" placeholder="请选择规格型号" style="width: 200px" @change="selectAddModel">
|
||||
<el-option v-for="item in modelList" :key="item.model" :value="item.model"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -412,7 +417,7 @@
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="saveAddData">保存</el-button>
|
||||
<el-button @click="editAddDeviceDialog = false">取消</el-button>
|
||||
<el-button @click="editAddDeviceDialog = false">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@ -486,6 +491,7 @@ import { encrypt_aes, generateRandomNumber } from '/@/utils/crypto'
|
||||
import ControlPage from './control.vue'
|
||||
import MeasurementPage from './measurement.vue'
|
||||
import { ModelAttributeType } from '/@/views/backend/auth/model/type'
|
||||
import { theoreticalpowerCurveList } from '/@/api/backend/theoreticalpowerCurve/request'
|
||||
|
||||
const adminInfo = useAdminInfo()
|
||||
interface Tree {
|
||||
@ -728,6 +734,28 @@ const editDeviceData = reactive({
|
||||
nominalCapacity: null,
|
||||
})
|
||||
|
||||
const modelList = ref<{ model: string; madeinFactory: string }[]>([])
|
||||
|
||||
const getModelList = () => {
|
||||
theoreticalpowerCurveList().then((res) => {
|
||||
if (res.rows) {
|
||||
console.log(res);
|
||||
|
||||
modelList.value = (res.rows as any[]).map((item: any) => {
|
||||
return {
|
||||
model: item.model,
|
||||
madeinFactory: item.madeinfactory,
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
const selectEditModel = (value:string)=>{
|
||||
editDeviceData.madeinFactory = modelList.value.find((item) => item.model == value)?.madeinFactory || ''
|
||||
}
|
||||
const selectAddModel = (value:string)=>{
|
||||
editAddDeviceData.madeinFactory = modelList.value.find((item) => item.model == value)?.madeinFactory || ''
|
||||
}
|
||||
const size = ref<'default' | 'large' | 'small'>('default')
|
||||
|
||||
const handleCloseEditDevice = () => {
|
||||
@ -1026,6 +1054,8 @@ const openMeasure = (data: any) => {
|
||||
watch(showMeasure, (newVal: boolean) => {
|
||||
!newVal && (measureData.autoUpdate = false)
|
||||
})
|
||||
|
||||
getModelList()
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
Loading…
Reference in New Issue
Block a user