使用時(shí)參考網(wǎng)址:https://gitee.com/cuibo119/QLExpress
ExpressRunner runner = new ExpressRunner();
DefaultContext<String, Object> context = new DefaultContext<String, Object>();
context.put("a", 1);
context.put("b", 2);
context.put("c", 3);
String express = "a + b * c";
Object r = runner.execute(express, context, null, true, false);
System.out.println(r);
1.如果應(yīng)用有讓終端用戶(hù)輸入與執(zhí)行 QLExpress 的功能满败,務(wù)必關(guān)注 多級(jí)別安全控制娇斑,將 QLExpress 的安全級(jí)別配置在 2 或以上。
2.高精度計(jì)算在會(huì)計(jì)財(cái)務(wù)中非常重要脯爪,財(cái)務(wù)等計(jì)算需要開(kāi)啟
/**
* 是否需要高精度計(jì)算
*/
private boolean isPrecise = true;