From 942897faa6b558e65343db3075d7bbe3c2cb411a Mon Sep 17 00:00:00 2001
From: liuy <37787198+LiuyCodes@users.noreply.github.com>
Date: Wed, 20 Nov 2024 17:03:38 +0800
Subject: [PATCH] =?UTF-8?q?feat(plugin):=20=E6=96=B0=E5=A2=9E=20TOC?=
=?UTF-8?q?=E9=80=80=E8=B4=A7=E8=AE=A1=E7=AE=97=E5=85=AC=E5=BC=8F=E5=8F=8A?=
=?UTF-8?q?=E4=BC=98=E6=83=A0=E9=87=91=E9=A2=9D=E4=BF=9D=E5=AD=98=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在 TocofsReturngoodsDetailedEntity 中添加计算应收、计算公式等字段
- 修改批量插入或更新 SQL,支持新字段- 优化销售出库插件初始化器,增加计算公式和优惠金额保存逻辑
- 更新测试用例,验证新功能
---
.../TocofsReturngoodsDetailedEntity.xml | 24 ++++--
.../sales/SoSaleOutPluginInitializerToC.java | 2 +-
.../SoSaleReturnPluginInitializerToC.java | 74 ++++++++++++++-----
.../lets/u8cdto/GoodsRertunSonDetailsDto.java | 14 ++++
.../SoSaleOutPluginInitializerToBTest.java | 4 +-
5 files changed, 91 insertions(+), 27 deletions(-)
diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml
index 404a5b36..d19c124c 100644
--- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml
+++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsReturngoodsDetailedEntity.xml
@@ -879,10 +879,10 @@
- insert into tocofs_returngoods_detailed(id,newPushDate3,newTransmitInfo3,newState3,newSystemNumber3,newSystemPrimary3)
+ insert into tocofs_returngoods_detailed(id,newPushDate3,newTransmitInfo3,newState3,newSystemNumber3,newSystemPrimary3,def7,def8,def9,def10,def11,def12)
values
- (#{entity.id},#{entity.newpushdate3},#{entity.newtransmitinfo3},#{entity.newstate3},#{entity.newsystemnumber3},#{entity.newsystemprimary3})
+ (#{entity.id},#{entity.newpushdate3},#{entity.newtransmitinfo3},#{entity.newstate3},#{entity.newsystemnumber3},#{entity.newsystemprimary3},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12})
on duplicate key update
id = values(id),
@@ -890,15 +890,21 @@
newTransmitInfo3 = values(newTransmitInfo3),
newState3 = values(newState3),
newSystemNumber3 = values(newSystemNumber3),
- newSystemPrimary3 = values(newSystemPrimary3)
+ newSystemPrimary3 = values(newSystemPrimary3),
+ def7 = values(def7),
+ def8 = values(def8),
+ def9 = values(def9),
+ def10 = values(def10),
+ def11 = values(def11),
+ def12 = values(def12)
- insert into tocofs_returngoods_detailed(id,newPushDate4,newTransmitInfo4,newState4,newSystemNumber4,newSystemPrimary4)
+ insert into tocofs_returngoods_detailed(id,newPushDate4,newTransmitInfo4,newState4,newSystemNumber4,newSystemPrimary4,def7,def8,def9,def10,def11,def12)
values
- (#{entity.id},#{entity.newpushdate4},#{entity.newtransmitinfo4},#{entity.newstate4},#{entity.newsystemnumber4},#{entity.newsystemprimary4})
+ (#{entity.id},#{entity.newpushdate4},#{entity.newtransmitinfo4},#{entity.newstate4},#{entity.newsystemnumber4},#{entity.newsystemprimary4},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12})
on duplicate key update
id = values(id),
@@ -906,7 +912,13 @@
newTransmitInfo4 = values(newTransmitInfo4),
newState4 = values(newState4),
newSystemNumber4 = values(newSystemNumber4),
- newSystemPrimary4 = values(newSystemPrimary4)
+ newSystemPrimary4 = values(newSystemPrimary4),
+ def7 = values(def7),
+ def8 = values(def8),
+ def9 = values(def9),
+ def10 = values(def10),
+ def11 = values(def11),
+ def12 = values(def12)
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 730c4717..0f800cd6 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
@@ -3165,7 +3165,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity {
if (poOrderBEntity != null) {
String norgtaxprice = poOrderBEntity.getNorgtaxprice();
Assert.notNull(norgtaxprice, "U8C采购订单明细行存在「原币含税单价」为空");
- if (!"0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString())) {
+ if (norgtaxprice != null && !"0".equals(new BigDecimal(norgtaxprice).stripTrailingZeros().toPlainString())) {
String format = StrUtil.format("{}*{}", norgtaxprice, sonDetailsDto.getShipQty());
calculationFormulaStr.append(format);
BigDecimal totalPayAmountBigDecimal = new BigDecimal(norgtaxprice).multiply(new BigDecimal(sonDetailsDto.getShipQty())).setScale(2, BigDecimal.ROUND_HALF_UP);
diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java
index 7f662cc5..8bc10a31 100644
--- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java
+++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java
@@ -133,10 +133,9 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
if (ProfilesActiveConstant.LETS_PROFILES_ACTIVE.equals(PROD_FILED)) {
//默认被定时器执行,每天晚上凌晨0点5分
//暂定先同步TOC销售库存、再推送TOC销售确认收入
- //TODO 暂时注释掉
-// List startAndEndVos = calculateCalculateEntireDayPeriod(null);
-// startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time());
-// startImplementByTradeTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time());
+ List startAndEndVos = calculateCalculateEntireDayPeriod(null);
+ startImplementStockByTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time());
+ startImplementByTradeTime(startAndEndVos.get(0).getStart_time(), startAndEndVos.get(0).getEnd_time());
}
}
} catch (Exception e) {
@@ -1500,30 +1499,43 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
BigDecimal groupShipQty = new BigDecimal("0");
for (int i = 0; i < sonDetailsDtoList.size(); i++) {
- GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = sonDetailsDtoList.get(i);
+ GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = sonDetailsDtoList.get(i);//O售后入库单明细行
StockinOrderSearchResponse.StockinOrder.StockinH header = goodsRertunSonDetailsDto.getHeader();//O售后入库单表头
+
RerturnGoodsOrderSearchData rerturnGoodsOrderSearchData = header.getRerturnGoodsOrderSearchData();//OFS售后订单
+ RerturnGoodsOrderSearchHeader header1 = rerturnGoodsOrderSearchData.getHeader();//OFS售后订单表头对象
+ List details = rerturnGoodsOrderSearchData.getDetails();//OFS售后订单表体对象
//存货管理档案
BdInvmandocEntity bdInvmandocEntity = goodsRertunSonDetailsDto.getBdInvmandocEntity();
+ //根据OFS售后入库单明细行,查找匹配OFS售后订单明细行
+ RerturnGoodsOrderSearchDetails ofsOrderDetail = findOfsOrderDetail(details, goodsRertunSonDetailsDto);
//取对应的售后订单明细,主要是取这个价格
- String totalAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, goodsRertunSonDetailsDto, mapList);
+ StringBuffer calculationFormulaStr = new StringBuffer();
+ String totalAmount = getFloorPrice(isCheckShopChoose, bdInvmandocEntity, header, goodsRertunSonDetailsDto, mapList, calculationFormulaStr);
if (totalAmount == null) {
+ calculationFormulaStr.append("取O实退金额:");
//取O实退金额
// RerturnGoodsOrderSearchDetails afterSalesOrder = findAfterSalesOrderV2(goodsRertunSonDetailsDto, rerturnGoodsOrderSearchData);
// totalAmount = afterSalesOrder.getTotalAmount();
- totalAmount = accumulatedDiscounts(goodsRertunSonDetailsDto, rerturnGoodsOrderSearchData);
+ totalAmount = accumulatedDiscounts(goodsRertunSonDetailsDto, rerturnGoodsOrderSearchData, calculationFormulaStr);
}
-
- //实付金额/实发数量
Assert.notNull(totalAmount, "实退金额不能为空 明细行主键:{}", goodsRertunSonDetailsDto.getId());
Assert.notNull(goodsRertunSonDetailsDto.getReceivedQty(), "实收数量不能为空 明细行主键:{}", goodsRertunSonDetailsDto.getId());
+
BigDecimal totalPayAmountBigDecimal = new BigDecimal(totalAmount);
BigDecimal shipQtyBigDecimal = new BigDecimal(goodsRertunSonDetailsDto.getReceivedQty());
groupTotalPayAmount = groupTotalPayAmount.add(totalPayAmountBigDecimal);
groupShipQty = groupShipQty.add(shipQtyBigDecimal);
+
+ goodsRertunSonDetailsDto.setCalculateAccountsReceivable(totalAmount);
+ goodsRertunSonDetailsDto.setCalculationFormula(calculationFormulaStr.toString());
+ goodsRertunSonDetailsDto.setPlatformDiscounts(ofsOrderDetail.getPlatformDiscounts());
+ goodsRertunSonDetailsDto.setMerchantDiscounts(ofsOrderDetail.getMerchantDiscounts());
+ goodsRertunSonDetailsDto.setExpertDiscounts(ofsOrderDetail.getExpertDiscounts());
+ goodsRertunSonDetailsDto.setPayDiscounts(ofsOrderDetail.getPayDiscounts());
}
GoodsRertunSonDetailsDto goodsRertunSonDetailsDto = sonDetailsDtoList.get(0);
goodsRertunSonDetailsDto.setGroupShipQty(groupShipQty);
@@ -2064,6 +2076,12 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
tocofsReturngoodsDetailedEntity.setNewpushdate3(getNewDateStr());
tocofsReturngoodsDetailedEntity.setNewtransmitinfo3(finalNewTransmitInfo);
tocofsReturngoodsDetailedEntity.setNewstate3(newstate);
+ tocofsReturngoodsDetailedEntity.setDef7(goodsRertunSonDetailsDto.getCalculateAccountsReceivable());
+ tocofsReturngoodsDetailedEntity.setDef8(goodsRertunSonDetailsDto.getCalculationFormula());
+ tocofsReturngoodsDetailedEntity.setDef9(goodsRertunSonDetailsDto.getPlatformDiscounts());
+ tocofsReturngoodsDetailedEntity.setDef10(goodsRertunSonDetailsDto.getPayDiscounts());
+ tocofsReturngoodsDetailedEntity.setDef11(goodsRertunSonDetailsDto.getExpertDiscounts());
+ tocofsReturngoodsDetailedEntity.setDef12(goodsRertunSonDetailsDto.getMerchantDiscounts());
if (successY.equals(newstate)) {
tocofsReturngoodsDetailedEntity.setNewsystemnumber3(newsystemnumber);
tocofsReturngoodsDetailedEntity.setNewsystemprimary3(newsystemprimary);
@@ -2119,6 +2137,12 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
tocofsReturngoodsDetailedEntity.setNewpushdate4(getNewDateStr());
tocofsReturngoodsDetailedEntity.setNewtransmitinfo4(finalNewTransmitInfo);
tocofsReturngoodsDetailedEntity.setNewstate4(newstate);
+ tocofsReturngoodsDetailedEntity.setDef7(goodsRertunSonDetailsDto.getCalculateAccountsReceivable());
+ tocofsReturngoodsDetailedEntity.setDef8(goodsRertunSonDetailsDto.getCalculationFormula());
+ tocofsReturngoodsDetailedEntity.setDef9(goodsRertunSonDetailsDto.getPlatformDiscounts());
+ tocofsReturngoodsDetailedEntity.setDef10(goodsRertunSonDetailsDto.getPayDiscounts());
+ tocofsReturngoodsDetailedEntity.setDef11(goodsRertunSonDetailsDto.getExpertDiscounts());
+ tocofsReturngoodsDetailedEntity.setDef12(goodsRertunSonDetailsDto.getMerchantDiscounts());
if (successY.equals(newstate)) {
tocofsReturngoodsDetailedEntity.setNewsystemnumber4(newsystemnumber);
tocofsReturngoodsDetailedEntity.setNewsystemprimary4(newsystemprimary);
@@ -2128,7 +2152,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
//以50行为一个批次,推送到Mysql
if (tocofsReturngoodsDetailedEntityArrayList.size() > 0) {
- List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsReturngoodsDetailedEntityArrayList, 50);
+ List> splitListByCount = SplitListByCountUtil.splitListByCount(tocofsReturngoodsDetailedEntityArrayList, 200);
for (int i = 0; i < splitListByCount.size(); i++) {
List tocofsReturngoodsDetailedEntities = splitListByCount.get(i);
iTocofsReturngoodsDetailedDao.entityInsertOrUpdateBatchByTocRerturnTran(tocofsReturngoodsDetailedEntities);
@@ -2519,13 +2543,15 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity {
* @param mapList 索引为0结存价为1采购价
* @author liuyang
*/
- private String getFloorPrice(Boolean isCheckShopChoose, BdInvmandocEntity bdInvmandocEntity, StockinOrderSearchResponse.StockinOrder.StockinH header, GoodsRertunSonDetailsDto sonDetailsDto, List