Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    baoxingjie
    @baoxingjie
    大家好,这个是QLExpress 的 gitter,有问题欢迎大家提问
    Xin Wang
    @lovepoem
    @baoxingjie 合并一下那个pr,在首页显示这个logo
    baoxingjie
    @baoxingjie
    具体怎么操作?
    Garfield
    @jackkiexu
    @baoxingjie 哪些产品底层是用 QLExpress 的, 能否介绍一下
    Star
    @gsdgsd2991
    这个框架在阿里是用在业务方面还是安全方面呢?
    zhihuchenl
    @zhihuchenl
    请问一下,我用addMacro添加宏定义替换成一个函数,执行时报在Runner的操作符定义和自定义函数中都没有找到"sum"的定义,请教是什么问题

    String sum = "function sum(int a,int b){\n" +
    " return a+b;\n" +
    "};\n";

        runner.addMacro("bbb", sum);
        runner.addFunctionOfServiceMethod("add", new BindObjectMethod(), "add",
                new Class[] { Integer.class, Integer.class }, null);
    
        DefaultContext<String, Object> context = new DefaultContext<String, Object>();

    // context.put("a", 1);
    // context.put("b", 2);

        String express = "add(1,2);bbb;sum(1,22)";
        Object r = runner.execute(express, context, null, true, false);
        System.out.println(r);
    代码是这样子的
    @baoxingjie
    huishu
    @linkqu
    如何对例表求和?
    列表
    如果context中的对象中包含对象能不能用 obj.xxx 方式获取?
    huishu
    @linkqu
    No people?
    ningyu
    @zhanlv
    android平台 怎么使用呢
    huishu
    @linkqu
    引入包就可以用啊
    Paul Chan
    @rongmin
    public static void main(String[] args) throws Exception {
    ExpressRunner runner = new ExpressRunner();
    runner.addOperatorWithAlias("和", "&&", "addOperatorWithAlias fail!");
    runner.addOperatorWithAlias("大于", ">", "addOperatorWithAlias fail!");
    runner.addOperatorWithAlias("减去", "-", "addOperatorWithAlias fail!");
    DefaultContext<String, Object> context = new DefaultContext<String, Object>();
    context.put("订单状态", "未审核");
    context.put("当前系统时间", new Date().getTime());
    context.put("订单最后修改时间", new Date().getTime());//2018-12-03 17:16:51
    context.put("三个小时", 36060*1000);//毫秒
    String express1 = "(订单状态 in (未审核, 待业务认领单据) 和 (当前系统时间 减去 订单最后修改时间) 大于 三个小时) 则 {return 1;} 否则 {return 0;}";
    Object object = runner.execute(express1, context, null, true, true);
    System.err.println(object);
    }
    Exception in thread "main" java.lang.Exception: 程序错误,不满足语法规范,没有匹配到合适的语法,最大匹配致[0:4]
    at com.ql.util.express.match.QLPattern.findMatchStatement(QLPattern.java:21)
    at com.ql.util.express.parse.ExpressParse.parse(ExpressParse.java:343)
    at com.ql.util.express.parse.ExpressParse.parse(ExpressParse.java:310)
    at com.ql.util.express.ExpressRunner.parseInstructionSet(ExpressRunner.java:656)
    at com.ql.util.express.ExpressRunner.execute(ExpressRunner.java:561)
    at com.ql.util.express.ExpressRunner.execute(ExpressRunner.java:538)
    at com.koyoo.monitor.service.nc.esoc.order.NCEsocOrderServiceImpl.main(NCEsocOrderServiceImpl.java:148)
    这个表达式报错如何排查?
    Paul Chan
    @rongmin
    抱歉 眼瞎 找到问题了
    Pauling
    @PaulingZhou
    @Test
    public void testFunction2() throws Exception {
        ExpressRunner runner = new ExpressRunner();
        String[] args = {"123","456"};
        String exp = "String a = args[0];";
        DefaultContext<String, Object> context = new DefaultContext<String, Object>();
        context.put("args", args);
        Object result = runner.execute(exp,context,null,false,true);
        System.out.println(result);
    }
    这段代码跑不通。。。
    1302岁的龙猫
    @ORACLE128G
    改成这样:\n
    @Test
        public void testFunction2() throws Exception {
            ExpressRunner runner = new ExpressRunner();
            String[] args = {"123","456"};
            String exp = "a = args[0];";
            DefaultContext<String, Object> context = new DefaultContext<String, Object>();
            context.put("args", args);
            Object result = runner.execute(exp,context,null,false,true);
            System.out.println(result);
        }
    @PaulingZhou
    Pauling
    @PaulingZhou
    这样的话其实是把a当成Object类型的对象吧?如果希望a是String类型的话该怎么处理呢? @ORACLE128G
    zhming-hub
    @zhming-hub
    请教下:如何在内存动态的删除之前定义好的全局宏