移除不必要的收支项目查询
移除了在SO销售和退货流程中不必要的收支项目查询,以优化性能和避免不必要的网络调用。之前,代码会查询BdInvcl和BdCostsubj实体,即使这些实体在当前的业务逻辑中并不需要。此更改简化了流程,移除了这些冗余查询,没有影响现有的功能。
This commit is contained in:
parent
34097c86b1
commit
3f3cf2aded
|
@ -1839,8 +1839,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
//查找来源销售订单明细行
|
||||
SoSaleorderBEntity sourceDocumentsV2 = findSourceDocumentsV2(header, detailsDto, soSaleorderBEntityList, extIntegrationTaskLivingDetailsQueryVos);
|
||||
//查询收支项目
|
||||
BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
||||
BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
||||
// BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
||||
// BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
||||
|
||||
BigDecimal noriginalcurtaxprice = null;//含税单价
|
||||
try {
|
||||
|
@ -1880,8 +1880,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
|
|||
// salesInvoiceBodyDto.setCsaleid("1009A2100000000004WK");//销售主表id
|
||||
// salesInvoiceBodyDto.setCunitid("0001A210000000000EYM");//主计量单位
|
||||
// salesInvoiceBodyDto.setCupsourcebillbodyid("1009A2100000000004R3");//上层来源单据行
|
||||
salesInvoiceBodyDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目
|
||||
salesInvoiceBodyDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj());
|
||||
// salesInvoiceBodyDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目
|
||||
// salesInvoiceBodyDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj());
|
||||
|
||||
salesInvoiceBodyDtoList.add(salesInvoiceBodyDto);
|
||||
}
|
||||
|
|
|
@ -104,17 +104,14 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
long startMillis = System.currentTimeMillis();
|
||||
logger.info("executeBusiness方法调用开始:" + getPluginName() + "-插件");
|
||||
|
||||
// if (ProfilesActiveConstant.TYPE_DETAIL_ERROR.equals(requestJson.get("type"))) {
|
||||
// throw new BaseSystemException("TOC退货业务,无法按单行推送!需要根据天的维度推送");
|
||||
// }
|
||||
|
||||
try {
|
||||
String param = String.valueOf(requestJson.get("param"));
|
||||
String sceneType = String.valueOf(requestJson.get("sceneType"));//sceneType:stock、tran
|
||||
|
@ -1568,8 +1565,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList);
|
||||
|
||||
//查询收支项目
|
||||
BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
||||
BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
||||
// BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
||||
// BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
||||
|
||||
String tax = "0." + new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString();
|
||||
BigDecimal noriginalcurprice = null;//无税单价
|
||||
|
@ -1620,8 +1617,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
|
|||
// saleorderRequestChildrenDto.setCreccalbodyid(bdCalbodyEntity1.getPkCalbody());//收货库存组织:2024年8月7日 16:21:48 和佳妮、道品一起测试,收货库存组织、收货仓库 是不需要传递的
|
||||
// saleorderRequestChildrenDto.setCrecwareid(bdStordocEntity1.getPkStordoc());//收货仓库
|
||||
|
||||
saleorderRequestChildrenDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目
|
||||
saleorderRequestChildrenDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj());
|
||||
// saleorderRequestChildrenDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目
|
||||
// saleorderRequestChildrenDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj());
|
||||
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
|
||||
|
||||
//销售订单单据推送到u8c
|
||||
|
|
|
@ -742,8 +742,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
String tax = "0." + new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString();
|
||||
|
||||
//查询收支项目
|
||||
BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
||||
BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
||||
// BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
||||
// BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
||||
|
||||
// 如果是海外的店铺,则税率为零
|
||||
String exportVaue = ExportConstant.exportConstant.get(header.getStoreCode());
|
||||
|
@ -799,8 +799,8 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {
|
|||
saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
|
||||
saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
|
||||
saleorderRequestChildrenDto.setVdef20(stockinB.getId());//原单明细主键
|
||||
saleorderRequestChildrenDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目
|
||||
saleorderRequestChildrenDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj());
|
||||
// saleorderRequestChildrenDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目
|
||||
// saleorderRequestChildrenDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj());
|
||||
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
|
||||
}
|
||||
//记录成功
|
||||
|
|
|
@ -626,8 +626,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
//根据存货基础档案编码,查询当前存货的税率
|
||||
BdTaxitemsEntity bdTaxitemsEntity1 = oldValue.get(0).getBdTaxitemsEntity();
|
||||
//查询收支项目
|
||||
BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
||||
BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
||||
// BdInvclEntity bdInvclEntity = queryU8CEntityUtil.queryBdInvbasdocByBdInvcl(bdInvbasdocEntity);
|
||||
// BdCostsubjEntity bdCostsubjEntity = queryU8CEntityUtil.queryBdCostsubj(bdInvclEntity);
|
||||
|
||||
String tax = "0." + new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString();
|
||||
BigDecimal noriginalcurprice = null;//无税单价
|
||||
|
@ -674,8 +674,8 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
|
|||
saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价
|
||||
saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
|
||||
saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
|
||||
saleorderRequestChildrenDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目
|
||||
saleorderRequestChildrenDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj());
|
||||
// saleorderRequestChildrenDto.setVdef2(bdCostsubjEntity.getCostname());//收支项目
|
||||
// saleorderRequestChildrenDto.setPk_defdoc2(bdCostsubjEntity.getPkCostsubj());
|
||||
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
|
||||
|
||||
//销售订单单据推送到u8c
|
||||
|
|
|
@ -44,7 +44,8 @@ public class OfsOrderAfterSalesAmountAllocationUtil {
|
|||
List<RerturnGoodsOrderSearchDetails> detailsOld = rerturnGoodsOrderSearchData.getDetails();
|
||||
|
||||
//拷贝一份List集合,并移除没有实付金额的原始
|
||||
//TODO 暂时取零售价作为分类的标准,需要和万万确认一下
|
||||
//暂时取零售价作为分类的标准,需要和万万确认一下
|
||||
//已经和万万确认
|
||||
List<RerturnGoodsOrderSearchDetails> rerturnGoodsOrderSearchDetails = copyDetailsDto(detailsOld);
|
||||
rerturnGoodsOrderSearchDetails.removeIf(dto -> dto.getMsrPrice() == null || !"0".equals(new BigDecimal(dto.getMsrPrice()).stripTrailingZeros().toPlainString()));
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class OfsOrderSaleAmountAllocationUtil {
|
|||
|
||||
//拷贝一份List集合,并移除没有实付金额的原始
|
||||
List<DetailsDto> details = copyDetailsDto(detailsOld);
|
||||
details.removeIf(dto -> dto.getTotalPayAmount() == null || !"0".equals(new BigDecimal(dto.getTotalPayAmount()).stripTrailingZeros().toPlainString()));
|
||||
details.removeIf(dto -> dto.getTotalPayAmount() == null || "0".equals(new BigDecimal(dto.getTotalPayAmount()).stripTrailingZeros().toPlainString()));
|
||||
|
||||
//计算分摊百分比
|
||||
calculatePercentage(headerDetailsDto);
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package com.hzya.frame.plugin.lets.util;
|
||||
|
||||
import com.hzya.frame.WebappApplication;
|
||||
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto;
|
||||
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleOrderMessageDto;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @Author:liuyang
|
||||
* @Package:com.hzya.frame.plugin.lets.util
|
||||
* @Project:kangarooDataCenterV3
|
||||
* @name:OfsOrderSaleAmountAllocationUtilTest
|
||||
* @Date:2024/9/25 18:31
|
||||
* @Filename:OfsOrderSaleAmountAllocationUtilTest
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = WebappApplication.class)
|
||||
public class OfsOrderSaleAmountAllocationUtilTest {
|
||||
|
||||
@Autowired
|
||||
private OfsOrderSaleAmountAllocationUtil ofsOrderSaleAmountAllocationUtil;
|
||||
|
||||
@Autowired
|
||||
private AfterSalesOrderUtil afterSalesOrderUtil;
|
||||
|
||||
@Test
|
||||
public void tocSalesAmountAllocation() {
|
||||
try {
|
||||
SaleOrderMessageDto ofsOrder = afterSalesOrderUtil.getOfsOrder("LETS-SO2024092500000020");
|
||||
List<HeaderDetailsDto> data = ofsOrder.getData();
|
||||
if (data.size() > 0) {
|
||||
ofsOrderSaleAmountAllocationUtil.tocSalesAmountAllocation(data.get(0));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue