diff --git a/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java b/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java index cbafa444..5c13d899 100644 --- a/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java +++ b/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java @@ -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); + } + } + } } } } diff --git a/docs/datacollect/README.md b/docs/datacollect/README.md index 4be4ba9a..591cb3b0 100644 --- a/docs/datacollect/README.md +++ b/docs/datacollect/README.md @@ -349,7 +349,15 @@ PS: 同一节点只允许建立一条连接。 "linkId": "123", "online": false } - ] + ], + //设备监控信息 + "devices": [ + { + //设备ID + "deviceId": "1123451235464", + //设备状态 + "online": true + }] } ``` diff --git a/ui/dasadmin/src/views/backend/equipment/equipmentManagement/index.vue b/ui/dasadmin/src/views/backend/equipment/equipmentManagement/index.vue index e2fe7970..6507eda8 100644 --- a/ui/dasadmin/src/views/backend/equipment/equipmentManagement/index.vue +++ b/ui/dasadmin/src/views/backend/equipment/equipmentManagement/index.vue @@ -118,12 +118,15 @@ - + - + + + + @@ -241,7 +244,7 @@ @@ -284,12 +287,14 @@ - + - + + + @@ -412,7 +417,7 @@ @@ -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()