提交 7f9f7ad1 编写于 作者: ibizdev's avatar ibizdev

xignzi006 发布系统代码 [Spring Boot]

上级 91775188
......@@ -94,6 +94,10 @@ public class Purchase_order_lineServiceImpl extends EBSServiceImpl<Purchase_orde
@Lazy
protected cn.ibizlab.businesscentral.core.odoo_uom.service.IUom_uomService uomUomService;
@Autowired
@Lazy
protected cn.ibizlab.businesscentral.core.odoo_purchase.service.logic.IPurchase_order_linecalc_priceLogic calc_priceLogic;
@Autowired
@Lazy
protected cn.ibizlab.businesscentral.core.odoo_purchase.service.logic.IPurchase_order_linecalc_amountLogic calc_amountLogic;
......@@ -119,6 +123,7 @@ public class Purchase_order_lineServiceImpl extends EBSServiceImpl<Purchase_orde
boolean mail_create_nolog = et.get("mail_create_nolog") != null;
boolean mail_notrack = et.get("mail_notrack") != null;
fillParentData(et);
calc_priceLogic.execute(et);
if(!this.retBool(this.baseMapper.insert(et)))
return false;
CachedBeanCopier.copy((AopContext.currentProxy() != null ? (IPurchase_order_lineService)AopContext.currentProxy() : this).get(et.getId()),et);
......@@ -164,6 +169,7 @@ public class Purchase_order_lineServiceImpl extends EBSServiceImpl<Purchase_orde
CachedBeanCopier.copy((AopContext.currentProxy() != null ? (IPurchase_order_lineService)AopContext.currentProxy() : this).get(et.getId()), old);
boolean mail_notrack = et.get("mail_notrack") != null;
fillParentData(et);
calc_priceLogic.execute(et);
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("id",et.getId())))
return false;
CachedBeanCopier.copy((AopContext.currentProxy() != null ? (IPurchase_order_lineService)AopContext.currentProxy() : this).get(et.getId()),et);
......
package cn.ibizlab.businesscentral.core.odoo_purchase.service.logic;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import cn.ibizlab.businesscentral.core.odoo_purchase.domain.Purchase_order_line;
/**
* 关系型数据实体[calc_price] 对象
*/
public interface IPurchase_order_linecalc_priceLogic {
void execute(Purchase_order_line et) ;
}
package cn.ibizlab.businesscentral.core.odoo_purchase.service.logic.impl;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.KieContainer;
import cn.ibizlab.businesscentral.core.odoo_purchase.service.logic.IPurchase_order_linecalc_priceLogic;
import cn.ibizlab.businesscentral.core.odoo_purchase.domain.Purchase_order_line;
/**
* 关系型数据实体[calc_price] 对象
*/
@Slf4j
@Service
public class Purchase_order_linecalc_priceLogicImpl implements IPurchase_order_linecalc_priceLogic{
@Autowired
private KieContainer kieContainer;
@Autowired
private cn.ibizlab.businesscentral.core.odoo_purchase.service.IPurchase_order_lineService purchase_order_lineservice;
public cn.ibizlab.businesscentral.core.odoo_purchase.service.IPurchase_order_lineService getPurchase_order_lineService() {
return this.purchase_order_lineservice;
}
@Autowired
private cn.ibizlab.businesscentral.core.odoo_purchase.service.IPurchase_order_lineService iBzSysDefaultService;
public cn.ibizlab.businesscentral.core.odoo_purchase.service.IPurchase_order_lineService getIBzSysDefaultService() {
return this.iBzSysDefaultService;
}
public void execute(Purchase_order_line et){
KieSession kieSession = null;
try{
kieSession=kieContainer.newKieSession();
kieSession.insert(et);
kieSession.setGlobal("purchase_order_linecalc_pricedefault",et);
kieSession.setGlobal("purchase_order_lineservice",purchase_order_lineservice);
kieSession.setGlobal("iBzSysPurchase_order_lineDefaultService",iBzSysDefaultService);
kieSession.setGlobal("curuser", cn.ibizlab.businesscentral.util.security.AuthenticationUser.getAuthenticationUser());
kieSession.startProcess("cn.ibizlab.businesscentral.core.odoo_purchase.service.logic.purchase_order_linecalc_price");
}catch(Exception e){
throw new RuntimeException("执行[计算行金额]处理逻辑发生异常"+e);
}finally {
if(kieSession!=null)
kieSession.destroy();
}
}
}
package cn.ibizlab.businesscentral.odoo_purchase.logic.purchase_order_linelogic.calc_price;
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.businesscentral.util.errors.BadRequestAlertException;
global cn.ibizlab.businesscentral.core.odoo_purchase.domain.Purchase_order_line purchase_order_linecalc_pricedefault;
global cn.ibizlab.businesscentral.core.odoo_purchase.service.IPurchase_order_lineService purchase_order_lineservice;
global cn.ibizlab.businesscentral.core.odoo_purchase.service.IPurchase_order_lineService iBzSysPurchase_order_lineDefaultService;
global cn.ibizlab.businesscentral.util.security.AuthenticationUser curuser;
no-loop
//逻辑处理节点[开始]
rule "begin"
ruleflow-group "purchase_order_linecalc_pricebegin"
when
then
end
//逻辑处理节点[calc_price]
rule "deaction1"
ruleflow-group "purchase_order_linecalc_pricedeaction1"
when
then
purchase_order_lineservice.calc_price(purchase_order_linecalc_pricedefault);
update(purchase_order_linecalc_pricedefault);//更新fact中变量值
end
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:g="http://www.jboss.org/drools/flow/gpd" xmlns:tns="http://www.jboss.org/drools" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.mvel.org/2.0" id="Definition" name="" targetNamespace="http://www.jboss.org/drools" typeLanguage="http://www.java.com/javaTypes">
<process id="cn.ibizlab.businesscentral.core.odoo_purchase.service.logic.purchase_order_linecalc_price" isClosed="false" isExecutable="true" name="ScoreRule" processType="Private" tns:packageName="cn.ibizlab.businesscentral.core.odoo_purchase.service.logic.purchase_order_linecalc_price">
<extensionElements>
<tns:import name="java.util.Map" />
<tns:import name="org.springframework.util.StringUtils"/>
<tns:import name="cn.ibizlab.businesscentral.util.helper.RuleUtils"/>
<tns:global identifier="purchase_order_linecalc_pricedefault" type="cn.ibizlab.businesscentral.core.odoo_purchase.domain.Purchase_order_line" />
</extensionElements>
<startEvent id="begin" isInterrupting="true"/>
<businessRuleTask activiti:exclusive="true" g:ruleFlowGroup="purchase_order_linecalc_pricedeaction1" id="deaction1" implementation="http://www.jboss.org/drools/rule" name="calc_price"/>
<endEvent id="deaction1_end" name="end"/>
<sequenceFlow id="deaction1_end_line" sourceRef="deaction1" targetRef="deaction1_end"/>
<sequenceFlow id="begin_deaction1" sourceRef="begin" targetRef="deaction1">
</sequenceFlow>
</process>
</definitions>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册