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