From bab43330bf6f48bdb7bfb258611f51bb05ef56fe Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期一, 06 一月 2025 09:02:21 +0800
Subject: [PATCH] 动态数据长度

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/CalculateHandle.java |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/CalculateHandle.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/CalculateHandle.java
index 699ea60..f140509 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/CalculateHandle.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/CalculateHandle.java
@@ -1,5 +1,6 @@
 package com.iailab.module.data.point.collection.handler;
 
+import com.iailab.framework.common.util.string.StrUtils;
 import com.iailab.module.data.common.enums.CommonConstant;
 import com.iailab.module.data.common.enums.DataTypeEnum;
 import com.iailab.module.data.common.enums.JsErrorCode;
@@ -143,7 +144,14 @@
             pointNos.add(s);
             dataMap.putAll(measureHandle.getCurrent(pointNos));
             dataMap.putAll(constantHandle.getCurrent(pointNos));
-            expression = expression.replace(s, dataMap.get(s).toString());
+            String valueStr =  dataMap.get(s).toString();
+            if (StrUtils.isNumeric(valueStr) && new BigDecimal(valueStr).compareTo(CommonConstant.BAD_VALUE) == 0) {
+                log.info("BAD_VALUE:" + s);
+            }
+            if (StrUtils.isNumeric(valueStr) && new BigDecimal(valueStr).compareTo(BigDecimal.ZERO) < 0) {
+                valueStr = "(" + valueStr + ")";
+            }
+            expression = expression.replace(s, valueStr);
         }
         expression = expression.replace("&", "&&");
         expression = expression.replace("|", "||");

--
Gitblit v1.9.3