物模型中增加一个计算量属性,

This commit is contained in:
houwei 2024-10-28 14:02:39 +08:00
parent 53b95f748f
commit 931bb1a685
3 changed files with 32 additions and 5 deletions

View File

@ -30,5 +30,10 @@ public interface MeasType {
/**
* 遥调量
*/
int TYPE_PSR_SETPOINT = 146;
int TYPE_PSR_SET_POINT = 146;
/**
* 计算量
*/
int TYPE_PSR_CALCULATED_VALUE = 199;
}

View File

@ -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) {

View File

@ -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<SysIotModelFieldVo> 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<SysIotModelServiceVo> 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());