package cn.ibizlab.sample.logic.ibizorderdetaillogic.getunitandprice;
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.IBIZUNIProduct ibizorderdetailgetunitandpriceproduct;
global cn.ibizlab.core.sample.domain.IBIZOrderDetail ibizorderdetailgetunitandpricedefault;
global cn.ibizlab.core.sample.service.IIBIZUNIProductService ibizuniproductservice;
global cn.ibizlab.core.sample.service.IIBIZOrderDetailService iBzSysIbizorderdetailDefaultService;
global cn.ibizlab.util.security.AuthenticationUser curuser;


no-loop

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

//逻辑处理节点[填充单位和单价]
rule "prepareparam2"
ruleflow-group "ibizorderdetailgetunitandpriceprepareparam2"
    when
    then
    ibizorderdetailgetunitandpricedefault.set("unitprice",ibizorderdetailgetunitandpriceproduct.get("unitprice"));
    ibizorderdetailgetunitandpricedefault.set("unit",ibizorderdetailgetunitandpriceproduct.get("unit"));
    update(ibizorderdetailgetunitandpriceproduct);//更新fact中变量值
    update(ibizorderdetailgetunitandpricedefault);//更新fact中变量值
    end

//逻辑处理节点[获取商品信息]
rule "deaction1"
ruleflow-group "ibizorderdetailgetunitandpricedeaction1"
    when
    then
    cn.ibizlab.util.helper.CachedBeanCopier.copy(ibizuniproductservice.get(ibizorderdetailgetunitandpriceproduct.getIbizuniproductid()),ibizorderdetailgetunitandpriceproduct);
    update(ibizorderdetailgetunitandpriceproduct);//更新fact中变量值
    update(ibizorderdetailgetunitandpricedefault);//更新fact中变量值
    end

//逻辑处理节点[获取商品id]
rule "prepareparam1"
ruleflow-group "ibizorderdetailgetunitandpriceprepareparam1"
    when
    then
    ibizorderdetailgetunitandpriceproduct.set("ibizuniproductid",ibizorderdetailgetunitandpricedefault.get("ibizuniproductid"));
    update(ibizorderdetailgetunitandpriceproduct);//更新fact中变量值
    update(ibizorderdetailgetunitandpricedefault);//更新fact中变量值
    end