CountMoneyRule.drl 1.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
package cn.ibizlab.sample.logic.ibizorderdetaillogic.countmoney;

import java.util.Map;
import java.util.HashMap;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.StringUtils;
import org.springframework.util.ObjectUtils;
import cn.ibizlab.util.errors.BadRequestAlertException;

global cn.ibizlab.core.sample.domain.IBIZOrderDetail param_default;
global cn.ibizlab.core.sample.service.IBIZOrderDetailService iBzSysIBIZOrderDetailDefaultService;
global cn.ibizlab.util.security.AuthenticationUser curuser;

no-loop

//逻辑处理节点[开始]
rule "begin"
ruleflow-group "begingroup"
  when
  then
    update(param_default);//更新fact中变量值
  end

//逻辑处理节点[统计金额]
rule "rawsqlcall1"
ruleflow-group "rawsqlcall1group"
  when
  then
    Map param =new HashMap();
    param.put("param0",param_default.get("quantity"));
    param.put("param1",param_default.get("unitprice"));
    String strSql="select (#{et.param0}*#{et.param1}) as AMOUNT from dual";
    java.util.List<JSONObject> entities=iBzSysIBIZOrderDetailDefaultService.select(strSql,param);//SQL调用
        if(entities.size()>0 && !ObjectUtils.isEmpty(entities.get(0))){
            JSONObject entity=entities.get(0);
            for (Map.Entry entry : entity.entrySet()) {
                param_default.set(String.valueOf(entry.getKey()),entry.getValue());
            }
        }
    update(param_default);//更新fact中变量值
  end