提交 9f05ad0a 编写于 作者: ibizdev's avatar ibizdev

xignzi006 发布系统代码,后台体系[Spring Boot]

上级 3af9428a
......@@ -21,6 +21,16 @@ public class Purchase_order_lineExService extends Purchase_order_lineServiceImpl
return com.baomidou.mybatisplus.core.toolkit.ReflectionKit.getSuperClassGenericType(this.getClass().getSuperclass(), 1);
}
/**
* 自定义行为[Calc_amount]用户扩展
* @param et
* @return
*/
@Override
@Transactional
public Purchase_order_line calc_amount(Purchase_order_line et) {
return super.calc_amount(et);
}
/**
* 自定义行为[Product_change]用户扩展
* @param et
......
......@@ -64,6 +64,14 @@ public class purchase_order_lineFallback implements purchase_order_lineFeignClie
public Purchase_order_line calc_amount( Long id, Purchase_order_line purchase_order_line){
return null;
}
public Purchase_order_line calc_price( Long id, Purchase_order_line purchase_order_line){
return null;
}
public Boolean checkKey(Purchase_order_line purchase_order_line){
return false;
}
......
......@@ -60,6 +60,14 @@ public interface purchase_order_lineFeignClient {
Purchase_order_line getDraft();
@RequestMapping(method = RequestMethod.POST, value = "/purchase_order_lines/{id}/calc_amount")
Purchase_order_line calc_amount(@PathVariable("id") Long id,@RequestBody Purchase_order_line purchase_order_line);
@RequestMapping(method = RequestMethod.POST, value = "/purchase_order_lines/{id}/calc_price")
Purchase_order_line calc_price(@PathVariable("id") Long id,@RequestBody Purchase_order_line purchase_order_line);
@RequestMapping(method = RequestMethod.POST, value = "/purchase_order_lines/checkkey")
Boolean checkKey(@RequestBody Purchase_order_line purchase_order_line);
......
......@@ -34,6 +34,8 @@ public interface IPurchase_order_lineService extends IService<Purchase_order_lin
void removeBatch(Collection<Long> idList) ;
Purchase_order_line get(Long key) ;
Purchase_order_line getDraft(Purchase_order_line et) ;
Purchase_order_line calc_amount(Purchase_order_line et) ;
Purchase_order_line calc_price(Purchase_order_line et) ;
boolean checkKey(Purchase_order_line et) ;
Purchase_order_line product_change(Purchase_order_line et) ;
boolean save(Purchase_order_line et) ;
......
......@@ -93,6 +93,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_amountLogic calc_amountLogic;
protected int batchSize = 500;
public String getIrModel(){
......@@ -115,6 +119,7 @@ public class Purchase_order_lineServiceImpl extends EBSServiceImpl<Purchase_orde
if(!this.retBool(this.baseMapper.insert(et)))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
calc_amountLogic.execute(et);
if (messageinfo && !mail_create_nosubscribe) {
cn.ibizlab.businesscentral.util.security.SpringContextHolder.getBean(cn.ibizlab.businesscentral.core.extensions.service.Mail_followersExService.class).add_default_followers(this,et);
......@@ -148,6 +153,7 @@ public class Purchase_order_lineServiceImpl extends EBSServiceImpl<Purchase_orde
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("id",et.getId())))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
calc_amountLogic.execute(et);
if (messageinfo && !mail_notrack) {
cn.ibizlab.businesscentral.util.security.SpringContextHolder.getBean(cn.ibizlab.businesscentral.core.extensions.service.Mail_tracking_valueExService.class).message_track(this,old,et);
}
......@@ -164,7 +170,10 @@ public class Purchase_order_lineServiceImpl extends EBSServiceImpl<Purchase_orde
@Override
@Transactional
public boolean remove(Long key) {
Purchase_order_line et=new Purchase_order_line();
et.set("id",key);
boolean result=removeById(key);
calc_amountLogic.execute(et);
return result ;
}
......@@ -193,6 +202,20 @@ public class Purchase_order_lineServiceImpl extends EBSServiceImpl<Purchase_orde
return et;
}
@Override
@Transactional
public Purchase_order_line calc_amount(Purchase_order_line et) {
//自定义代码
return et;
}
@Override
@Transactional
public Purchase_order_line calc_price(Purchase_order_line et) {
calc_amountLogic.execute(et);
return et ;
}
@Override
public boolean checkKey(Purchase_order_line et) {
return (!ObjectUtils.isEmpty(et.getId()))&&(!Objects.isNull(this.getById(et.getId())));
......
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_amount] 对象
*/
public interface IPurchase_order_linecalc_amountLogic {
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_amountLogic;
import cn.ibizlab.businesscentral.core.odoo_purchase.domain.Purchase_order_line;
/**
* 关系型数据实体[calc_amount] 对象
*/
@Slf4j
@Service
public class Purchase_order_linecalc_amountLogicImpl implements IPurchase_order_linecalc_amountLogic{
@Autowired
private KieContainer kieContainer;
@Autowired
private cn.ibizlab.businesscentral.core.odoo_purchase.service.IPurchase_orderService purchase_orderservice;
public cn.ibizlab.businesscentral.core.odoo_purchase.service.IPurchase_orderService getPurchase_orderService() {
return this.purchase_orderservice;
}
@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();
cn.ibizlab.businesscentral.core.odoo_purchase.domain.Purchase_order purchase_order_linecalc_amountorder =new cn.ibizlab.businesscentral.core.odoo_purchase.domain.Purchase_order();
kieSession.insert(purchase_order_linecalc_amountorder);
kieSession.setGlobal("purchase_order_linecalc_amountorder",purchase_order_linecalc_amountorder);
kieSession.insert(et);
kieSession.setGlobal("purchase_order_linecalc_amountdefault",et);
kieSession.setGlobal("purchase_orderservice",purchase_orderservice);
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_amount");
}catch(Exception e){
throw new RuntimeException("执行[计算订单金额]处理逻辑发生异常"+e);
}finally {
if(kieSession!=null)
kieSession.destroy();
}
}
}
package cn.ibizlab.businesscentral.odoo_purchase.logic.purchase_order_linelogic.calc_amount;
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 purchase_order_linecalc_amountorder;
global cn.ibizlab.businesscentral.core.odoo_purchase.domain.Purchase_order_line purchase_order_linecalc_amountdefault;
global cn.ibizlab.businesscentral.core.odoo_purchase.service.IPurchase_orderService purchase_orderservice;
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
//逻辑处理节点[calc_amount]
rule "deaction1"
ruleflow-group "purchase_order_linecalc_amountdeaction1"
when
then
purchase_orderservice.calc_amount(purchase_order_linecalc_amountdefault);
update(purchase_order_linecalc_amountorder);//更新fact中变量值
update(purchase_order_linecalc_amountdefault);//更新fact中变量值
end
//逻辑处理节点[准备订单参数]
rule "prepareparam1"
ruleflow-group "purchase_order_linecalc_amountprepareparam1"
when
then
purchase_order_linecalc_amountorder.set("id",purchase_order_linecalc_amountdefault.get("orderid"));
update(purchase_order_linecalc_amountorder);//更新fact中变量值
update(purchase_order_linecalc_amountdefault);//更新fact中变量值
end
//逻辑处理节点[get_line]
rule "deaction2"
ruleflow-group "purchase_order_linecalc_amountdeaction2"
when
then
cn.ibizlab.businesscentral.util.helper.CachedBeanCopier.copy(purchase_order_lineservice.get(purchase_order_linecalc_amountdefault.getId()),purchase_order_linecalc_amountdefault);
update(purchase_order_linecalc_amountorder);//更新fact中变量值
update(purchase_order_linecalc_amountdefault);//更新fact中变量值
end
//逻辑处理节点[开始]
rule "begin"
ruleflow-group "purchase_order_linecalc_amountbegin"
when
then
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_amount" isClosed="false" isExecutable="true" name="ScoreRule" processType="Private" tns:packageName="cn.ibizlab.businesscentral.core.odoo_purchase.service.logic.purchase_order_linecalc_amount">
<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_amountorder" type="cn.ibizlab.businesscentral.core.odoo_purchase.domain.Purchase_order" />
<tns:global identifier="purchase_order_linecalc_amountdefault" type="cn.ibizlab.businesscentral.core.odoo_purchase.domain.Purchase_order_line" />
</extensionElements>
<businessRuleTask activiti:exclusive="true" g:ruleFlowGroup="purchase_order_linecalc_amountdeaction1" id="deaction1" implementation="http://www.jboss.org/drools/rule" name="calc_amount"/>
<endEvent id="deaction1_end" name="end"/>
<sequenceFlow id="deaction1_end_line" sourceRef="deaction1" targetRef="deaction1_end"/>
<businessRuleTask activiti:exclusive="true" g:ruleFlowGroup="purchase_order_linecalc_amountprepareparam1" id="prepareparam1" implementation="http://www.jboss.org/drools/rule" name="准备订单参数"/>
<businessRuleTask activiti:exclusive="true" g:ruleFlowGroup="purchase_order_linecalc_amountdeaction2" id="deaction2" implementation="http://www.jboss.org/drools/rule" name="get_line"/>
<startEvent id="begin" isInterrupting="true"/>
<sequenceFlow id="begin_deaction2" sourceRef="begin" targetRef="deaction2">
</sequenceFlow>
<sequenceFlow id="deaction2_prepareparam1" sourceRef="deaction2" targetRef="prepareparam1">
</sequenceFlow>
<sequenceFlow id="prepareparam1_deaction1" sourceRef="prepareparam1" targetRef="deaction1">
</sequenceFlow>
</process>
</definitions>
......@@ -171,7 +171,7 @@ public class Purchase_orderResource {
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Purchase_order-Calc_amount-all')")
@ApiOperation(value = "calc_amount", tags = {"采购订单" }, notes = "calc_amount")
@ApiOperation(value = "计算订单金额", tags = {"采购订单" }, notes = "计算订单金额")
@RequestMapping(method = RequestMethod.POST, value = "/purchase_orders/{purchase_order_id}/calc_amount")
public ResponseEntity<Purchase_orderDTO> calc_amount(@PathVariable("purchase_order_id") Long purchase_order_id, @RequestBody Purchase_orderDTO purchase_orderdto) {
Purchase_order domain = purchase_orderMapping.toDomain(purchase_orderdto);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册