From ed8fc5f674544d3af63c6f68093ffc038385c493 Mon Sep 17 00:00:00 2001 From: dongyukun <1208714201@qq.com> Date: 星期一, 16 十二月 2024 09:30:04 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/MeasureHandle.java | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/MeasureHandle.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/MeasureHandle.java index 4d781a1..c97aa8b 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/MeasureHandle.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/MeasureHandle.java @@ -83,7 +83,9 @@ kioTagIds.add(new String[]{item.getSourceId(), item.getTagNo()}); } else if (DataSourceType.HTTP.getCode().equals(item.getSourceType())) { if (SourceApiEnum.iHyperDB.getCode().equals(item.getSourceName())) { - httpTagIhd.add(new Object[]{item.getSourceId(), item.getTagNo(), item.getDimension(), item.getValueType()}); + if (item.getTagNo() != null && item.getDimension() != null && item.getValueType() != null) { + httpTagIhd.add(new Object[]{item.getSourceId(), item.getTagNo(), item.getDimension(), item.getValueType()}); + } } } }); @@ -133,12 +135,17 @@ private Object handleData(DaPointDTO dto, Object value) { Object result = value; try { + if (value == null) { + return CommonConstant.BAD_VALUE; + } if (DataTypeEnum.FLOAT.getCode().equals(dto.getDataType()) || DataTypeEnum.INT.getCode().equals(dto.getDataType())) { BigDecimal rawValue = new BigDecimal(value.toString()); - + if(CommonConstant.BAD_VALUE.compareTo(rawValue) == 0) { + return CommonConstant.BAD_VALUE; + } // 异常值处理 if (rawValue.compareTo(maxValue) > 0 || rawValue.compareTo(minValue) < 0) { - rawValue = CommonConstant.BAD_VALUE; + return CommonConstant.BAD_VALUE; } BigDecimal coefficient = dto.getUnittransfactor() == null ? BigDecimal.ONE : dto.getUnittransfactor(); BigDecimal calValue = rawValue.multiply(coefficient); @@ -157,7 +164,6 @@ } else if (DataTypeEnum.BOOLEAN.getCode().equals(dto.getDataType())) { result = Boolean.parseBoolean(value.toString()); } - } catch (Exception ex) { log.warn("handleData异常,PointNo=" + dto.getPointNo()); ex.printStackTrace(); -- Gitblit v1.9.3