From a93f4bd41c3e0a810feaefef0af5aa23c224319f Mon Sep 17 00:00:00 2001 From: liuy <37787198+LiuyCodes@users.noreply.github.com> Date: Wed, 4 Dec 2024 14:57:50 +0800 Subject: [PATCH] =?UTF-8?q?refactor(sales):=20=E4=BC=98=E5=8C=96=20TOC=20?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA=E5=B9=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E9=87=91=E9=A2=9D=E8=AE=A1=E7=AE=97=E9=80=BB=E8=BE=91?= =?UTF-8?q?-=20=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=EF=BC=8C=E5=A2=9E=E5=8A=A0=20TOC=20=E5=87=BA?= =?UTF-8?q?=E5=BA=93=E5=89=8D=E7=BC=80-=20=E6=B3=A8=E9=87=8A=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=BB=A3=E7=A0=81=E6=AE=B5=20-=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E4=BC=98=E6=83=A0=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E8=AE=A1=E7=AE=97=EF=BC=8C=E4=BD=BF=E7=94=A8=E8=B4=9F?= =?UTF-8?q?=E5=80=BC=E5=A4=84=E7=90=86=20-=E8=B0=83=E6=95=B4=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=96=B9=E6=B3=95=E4=B8=AD=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sales/SoSaleOutPluginInitializerToC.java | 42 ++++++++++--------- .../OfsOrderSalePostageFeeAllocationUtil.java | 4 +- .../SoSaleOutPluginInitializerToCTest.java | 2 +- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java index 1b9420b7..c9db9a6b 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java @@ -1160,7 +1160,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { pk_corp = soSaleResultRootDto.getParentvo().getPk_corp(); csaleid = soSaleResultRootDto.getParentvo().getCsaleid(); } - logger.info("销售订单编号:{} 主键:{} 销售公司:{}", vreceiptcode, csaleid, pk_corp); + logger.info("TOC出库-销售订单编号:{} 主键:{} 销售公司:{}", vreceiptcode, csaleid, pk_corp); //记录成功 //日志推送的详情,两种方法,是推送U8C成功之后记录,还是整理推送完毕后再记录? //护童项目之前是整体推送之前记录,后来抛出链接失效的异常,而且只有程序执行完毕后,才能体现结果,执行过程中无法发现结果 @@ -1272,19 +1272,19 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { //查询对应的OFS销售订单 List headerDetailsDtos = queryOfsOrder(headerDetailsDtoList); findMatchingOfsOrder(headerDetailsDtos, headerDetailsDtoList); - - //TODO 测试 - for (int i = 0; i < headerDetailsDtos.size(); i++) { - com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = headerDetailsDtos.get(i); - List details = headerDetailsDto.getDetails(); - for (int j = 0; j < details.size(); j++) { - com.hzya.frame.ttxofs.dto.ofssalesordersearch.DetailsDto detailsDto = details.get(j); - detailsDto.setPlatformDiscounts("1"); - detailsDto.setPayDiscounts("1"); - detailsDto.setExpertDiscounts("1"); - detailsDto.setMerchantDiscounts("1"); - } - } + + //测试 +// for (int i = 0; i < headerDetailsDtos.size(); i++) { +// com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto headerDetailsDto = headerDetailsDtos.get(i); +// List details = headerDetailsDto.getDetails(); +// for (int j = 0; j < details.size(); j++) { +// com.hzya.frame.ttxofs.dto.ofssalesordersearch.DetailsDto detailsDto = details.get(j); +// detailsDto.setPlatformDiscounts("1"); +// detailsDto.setPayDiscounts("1"); +// detailsDto.setExpertDiscounts("1"); +// detailsDto.setMerchantDiscounts("1"); +// } +// } //计算OFS销售订单优惠金额分摊到明细行 // ofsOrderSaleAmountAllocationUtil.batchTocSalesAmountAllocation(headerDetailsDtos); @@ -2264,7 +2264,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { //补充:平台运费-存货 //accumulatedPostage应该是负数 BigDecimal absAccumulatedPostage = accumulatedPostage.abs(); - additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, absAccumulatedPostage, "-1", bdTaxitemsEntity); + BigDecimal negativeValue = absAccumulatedPostage.negate(); + additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity); } //平台优惠 if (sonDetailsDto.getVdef4() != null && !"".equals(sonDetailsDto.getVdef4())) { @@ -2278,7 +2279,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY01"); //补充:平台优惠-存货 BigDecimal absBigDecimalVdef4 = bigDecimalVdef4.abs(); - additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, absBigDecimalVdef4, "-1", bdTaxitemsEntity); + BigDecimal negativeValue = absBigDecimalVdef4.negate(); + additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity); } } //达人优惠 @@ -2293,7 +2295,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY02"); //补充:达人优惠-存货 BigDecimal absBigDecimalVdef6 = bigDecimalVdef6.abs(); - additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, absBigDecimalVdef6, "-1", bdTaxitemsEntity); + BigDecimal negativeValue = absBigDecimalVdef6.negate(); + additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity); } } //支付优惠 @@ -2308,7 +2311,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { BdTaxitemsEntity bdTaxitemsEntity = stringBdTaxitemsEntityMap.get("FY04"); //补充:支付优惠-存货 BigDecimal absBigDecimalVdef5 = bigDecimalVdef5.abs(); - additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, absBigDecimalVdef5, "-1", bdTaxitemsEntity); + BigDecimal negativeValue = absBigDecimalVdef5.negate(); + additional(saleorderRequestChildrenDtoList, bdInvmandocEntity1, bdInvbasdocEntity1, negativeValue, "-1", bdTaxitemsEntity); } } @@ -3861,7 +3865,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { saleorderRequestChildrenDto1.setVdef5("0"); saleorderRequestChildrenDto1.setVdef6("0"); saleorderRequestChildrenDto1.setVdef7("0"); - + //是否赠品 saleorderRequestChildrenDto1.setBlargessflag(false); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsOrderSalePostageFeeAllocationUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsOrderSalePostageFeeAllocationUtil.java index c2b4aefe..d5ba85f8 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsOrderSalePostageFeeAllocationUtil.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/OfsOrderSalePostageFeeAllocationUtil.java @@ -73,8 +73,8 @@ public class OfsOrderSalePostageFeeAllocationUtil { //销售订单运费 String postageAmount = header.getPostageAmount(); - // TODO 测试 - postageAmount = "10"; + //测试 +// postageAmount = "10"; //运费可能没有,也有可能为0! BigDecimal postageAmountDiscounts = null; diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToCTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToCTest.java index 184f5106..2e2dff85 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToCTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToCTest.java @@ -120,7 +120,7 @@ class SoSaleOutPluginInitializerToCTest { // soSaleOutPluginInitializerToC.sendU8CTOCOrder("123446"); try { - soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024120300016549", "stock"); + soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024120300016549", "tran"); // soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024110500013375", "tran"); // soSaleOutPluginInitializerToC.startImplementStockByCode("LETS-SH2024111700013756", "tran");