Lius
昨天 7852fd6313032a18ff44deb005f0bbc344d41d17
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/JexlFormulaCalculator.java
@@ -50,12 +50,14 @@
                throw new RuntimeException("公式计算结果不是数字");
            }
        } catch (JexlException e) {
            // 关键:不依赖内部类,直接通过异常消息判断除数为0
            if (e.getMessage() != null && e.getMessage().contains("division by zero")) {
                return BigDecimal.ZERO; // 除数为0返回0
            }
            // 其他JEXL异常正常抛出
            throw new RuntimeException("公式计算失败: " + formula, e);
            return BigDecimal.ZERO; // 除数为0返回0
//            // 关键:不依赖内部类,直接通过异常消息判断除数为0
//            if (e.getMessage() != null && e.getMessage().contains("division by zero")) {
//
//            }
//            // 其他JEXL异常正常抛出
//            throw new RuntimeException("公式计算失败: " + formula, e);
        } catch (Exception e) {
            throw new RuntimeException("公式计算失败: " + formula, e);
        }