浏览代码

修改公式校验

xujiaheng 3 年之前
父节点
当前提交
3cd7722a33

+ 1 - 1
src/main/java/com/persagy/apm/alarmservice/project/alarmcondition/service/impl/AlarmConditionServiceImpl.java

@@ -507,7 +507,7 @@ public class AlarmConditionServiceImpl extends ServiceImpl<AlarmConditionMapper,
         //            return ResultHelper.failure(ResponseCode.C0134.getCode(), "内置变量为空");
         //        }
         // 去空格
-        expression = expression.replaceAll(" ", "");
+        expression = expression.replaceAll(" ", "").replaceAll("÷","/").replaceAll("x","*");
         // 连续运算符处理
         if (expression.split("[\\+\\-\\*\\/]{2,}").length > 1) {
             return ResultHelper.failure(ResponseCode.C0134.getCode(), "公式不合法");