IBIZOrderDetailCountMoneyRule.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
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 ibizorderdetailcountmoneydefault;
global cn.ibizlab.core.sample.service.IIBIZOrderDetailService iBzSysIbizorderdetailDefaultService;
global cn.ibizlab.util.security.AuthenticationUser curuser;


no-loop

//逻辑处理节点[开始]
rule "begin"
ruleflow-group "ibizorderdetailcountmoneybegin"
    when
    then
    end

//逻辑处理节点[统计金额]
rule "rawsqlcall1"
ruleflow-group "ibizorderdetailcountmoneyrawsqlcall1"
    when
    then
    Map param =new HashMap();
    param.put("param0",ibizorderdetailcountmoneydefault.get("quantity"));
    param.put("param1",ibizorderdetailcountmoneydefault.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){
        JSONObject entity=entities.get(0);
        for (Map.Entry entry : entity.entrySet()) {
            ibizorderdetailcountmoneydefault.set(String.valueOf(entry.getKey()),entry.getValue());
        }
    }
    update(ibizorderdetailcountmoneydefault);//更新fact中变量值
    end