From 931bb1a6858bd3511b116aae9104dba0668d3970 Mon Sep 17 00:00:00 2001 From: houwei Date: Mon, 28 Oct 2024 14:02:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=A8=A1=E5=9E=8B=E4=B8=AD=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=B8=80=E4=B8=AA=E8=AE=A1=E7=AE=97=E9=87=8F=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/das/common/constant/MeasType.java | 7 ++++- .../node/service/impl/DataServiceImpl.java | 4 +-- .../node/service/impl/SysNodeServiceImpl.java | 26 +++++++++++++++++-- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/das/src/main/java/com/das/common/constant/MeasType.java b/das/src/main/java/com/das/common/constant/MeasType.java index e8885248..23479cf6 100644 --- a/das/src/main/java/com/das/common/constant/MeasType.java +++ b/das/src/main/java/com/das/common/constant/MeasType.java @@ -30,5 +30,10 @@ public interface MeasType { /** * 遥调量 */ - int TYPE_PSR_SETPOINT = 146; + int TYPE_PSR_SET_POINT = 146; + + /** + * 计算量 + */ + int TYPE_PSR_CALCULATED_VALUE = 199; } diff --git a/das/src/main/java/com/das/modules/node/service/impl/DataServiceImpl.java b/das/src/main/java/com/das/modules/node/service/impl/DataServiceImpl.java index 63a5e295..a7b27019 100644 --- a/das/src/main/java/com/das/modules/node/service/impl/DataServiceImpl.java +++ b/das/src/main/java/com/das/modules/node/service/impl/DataServiceImpl.java @@ -153,7 +153,7 @@ public class DataServiceImpl implements DataService { if (info.getParams() == null) { newIotModelVo.setParams(equipJsonNode); } else { - newIotModelVo.setParams(JSON_MAPPER.readTree(info.getParams().toString())); + newIotModelVo.setParams(JSON_MAPPER.readTree(info.getParams())); } Integer pointType = info.getMeasPointType(); @@ -170,7 +170,7 @@ public class DataServiceImpl implements DataService { newIotModelVo.setHighSpeed(info.getHighSpeed()); newIotModelVo.setType("yx"); attrs.add(newIotModelVo); - }else if (pointType == MeasType.TYPE_PSR_SETPOINT) { + }else if (pointType == MeasType.TYPE_PSR_SET_POINT) { newIotModelVo.setType("yt"); services.add(newIotModelVo); } else if (pointType == MeasType.TYPE_PSR_CONTROL) { diff --git a/das/src/main/java/com/das/modules/node/service/impl/SysNodeServiceImpl.java b/das/src/main/java/com/das/modules/node/service/impl/SysNodeServiceImpl.java index 661d24d8..32d8de26 100644 --- a/das/src/main/java/com/das/modules/node/service/impl/SysNodeServiceImpl.java +++ b/das/src/main/java/com/das/modules/node/service/impl/SysNodeServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.io.IoUtil; import cn.hutool.core.util.IdUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.das.common.config.SessionUtil; +import com.das.common.constant.MeasType; import com.das.common.exceptions.ServiceException; import com.das.common.utils.BeanCopyUtils; import com.das.common.utils.PageDataInfo; @@ -248,6 +249,17 @@ public class SysNodeServiceImpl implements SysNodeService { List iotModelVoList = iotModelFieldMapper.selectModelFieldListByModelId(modelId); for (SysIotModelFieldVo iotModelVo : iotModelVoList) { + //物模型属性类型必须是 模拟量、累积量、和离散量三种类型之一 + Integer measType = iotModelVo.getAttributeType(); + if (measType == null) { + continue; + } + if(measType != MeasType.TYPE_PSR_ANALOG + && measType != MeasType.TYPE_PSR_ACCUMULATOR + && measType != MeasType.TYPE_PSR_DISCRETE) { + continue; + } + String key = info.getId() + "_" + iotModelVo.getAttributeType() + "_" + iotModelVo.getAttributeCode(); if(mappingVoMap.containsKey(key)){ SysTabMappingVo item = mappingVoMap.get(key); @@ -257,7 +269,7 @@ public class SysNodeServiceImpl implements SysNodeService { mapping.setId(SequenceUtils.generateId()); mapping.setLinkId(linkId); mapping.setEquipmentId(info.getId()); - mapping.setMeasPointType(iotModelVo.getAttributeType()); + mapping.setMeasPointType(measType); mapping.setMeasPointCode(iotModelVo.getAttributeCode()); mapping.setMeasPointName(iotModelVo.getAttributeName()); mapping.setHighSpeed(iotModelVo.getHighSpeed()); @@ -271,6 +283,16 @@ public class SysNodeServiceImpl implements SysNodeService { List iotServiceVoList = iotModelServiceMapper.selectModelServiceListByModelId(modelId); for (SysIotModelServiceVo iotServiceVo : iotServiceVoList) { + //物模型服务类型必须是 遥控或者遥调两种类型之一 + Integer measType = iotServiceVo.getServiceType(); + if (measType == null) { + continue; + } + if(measType != MeasType.TYPE_PSR_ANALOG + && measType != MeasType.TYPE_PSR_CONTROL + && measType != MeasType.TYPE_PSR_SET_POINT) { + continue; + } String key = info.getId() + "_" + iotServiceVo.getServiceType() + "_" + iotServiceVo.getServiceCode(); if(mappingVoMap.containsKey(key)){ SysTabMappingVo item = mappingVoMap.get(key); @@ -280,7 +302,7 @@ public class SysNodeServiceImpl implements SysNodeService { mapping.setId(SequenceUtils.generateId()); mapping.setLinkId(linkId); mapping.setEquipmentId(info.getId()); - mapping.setMeasPointType(iotServiceVo.getServiceType()); + mapping.setMeasPointType(measType); mapping.setMeasPointCode(iotServiceVo.getServiceCode()); mapping.setMeasPointName(iotServiceVo.getServiceName()); mapping.setPorder(iotServiceVo.getPorder());