From 13580eac7a63ab9b6c38e18ee39b23251803d0fd Mon Sep 17 00:00:00 2001 From: liuy <37787198+LiuyCodes@users.noreply.github.com> Date: Thu, 26 Dec 2024 16:02:07 +0800 Subject: [PATCH] =?UTF-8?q?refactor(sales):=20=E4=BC=98=E5=8C=96=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 SoSaleOutPluginInitializerToC 和 SoSaleReturnPluginInitializerToC 类中,增加了对时间格式的判断和处理- 当时间格式为 yyyy-MM-dd 时,自动补全时分秒,确保时间查询的准确性- 修复了因时间格式不统一导致的查询问题,提高了系统的健壮性和准确性 --- .../sales/SoSaleOutPluginInitializerToC.java | 24 +++++++++++++--- .../SoSaleReturnPluginInitializerToC.java | 28 +++++++++++++++---- .../SoSaleReturnPluginInitializerToCTest.java | 2 +- 3 files changed, 43 insertions(+), 11 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 96137bfe..b1f115f8 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 @@ -257,8 +257,16 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { //满足以下两个场景时:触发Mysql还原O销售出库的对象 //1:中台->u8c TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = new TocofsSaleoutDetailedEntity(); - tocofsSaleoutDetailedEntity.setBusinessDateStart(startTime); - tocofsSaleoutDetailedEntity.setBusinessDateEnd(endTime); + if (startTime.length() == 19) { + tocofsSaleoutDetailedEntity.setBusinessDateStart(startTime); + } else { + tocofsSaleoutDetailedEntity.setBusinessDateStart(startTime + " 00:00:00"); + } + if (endTime.length() == 19) { + tocofsSaleoutDetailedEntity.setBusinessDateEnd(endTime); + } else { + tocofsSaleoutDetailedEntity.setBusinessDateEnd(endTime + " 23:59:59"); + } tocofsSaleoutDetailedEntity.setBusinesstype("TOC_ORDER"); headerDetailsDtoList = queryTocOfsSaleoutDetailed(tocofsSaleoutDetailedEntity); } else { @@ -449,8 +457,16 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { //满足以下两个场景时:触发Mysql还原O销售出库的对象 //1:中台->u8c TocofsSaleoutDetailedEntity tocofsSaleoutDetailedEntity = new TocofsSaleoutDetailedEntity(); - tocofsSaleoutDetailedEntity.setSuccessfultradedateStart(startTime); - tocofsSaleoutDetailedEntity.setSuccessfultradedateEnd(endTime); + if (startTime.length() == 19) { + tocofsSaleoutDetailedEntity.setSuccessfultradedateStart(startTime); + } else { + tocofsSaleoutDetailedEntity.setSuccessfultradedateStart(startTime + " 00:00:00"); + } + if (endTime.length() == 19) { + tocofsSaleoutDetailedEntity.setSuccessfultradedateEnd(endTime); + } else { + tocofsSaleoutDetailedEntity.setSuccessfultradedateEnd(endTime + " 23:59:59"); + } tocofsSaleoutDetailedEntity.setBusinesstype("TOC_ORDER"); headerDetailsDtoList = queryTocOfsSaleoutDetailed(tocofsSaleoutDetailedEntity); } else { 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 68156dcc..3b62c98b 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 @@ -235,8 +235,16 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); } else if (ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType)) { TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity(); - tocofsReturngoodsDetailedEntity.setBusinessDateStart(startTime); - tocofsReturngoodsDetailedEntity.setBusinessDateEnd(endTime); + if (startTime.length() == 19) { + tocofsReturngoodsDetailedEntity.setBusinessDateStart(startTime); + } else { + tocofsReturngoodsDetailedEntity.setBusinessDateStart(startTime + " 00:00:00"); + } + if (endTime.length() == 19) { + tocofsReturngoodsDetailedEntity.setBusinessDateEnd(endTime); + } else { + tocofsReturngoodsDetailedEntity.setBusinessDateEnd(endTime + " 23:59:59"); + } tocofsReturngoodsDetailedEntity.setBusinesstype("TOC_RETURN"); returnGoodHeaderDetailsDataDtoArrayList = queryTocofsReturngoodsDetailed(tocofsReturngoodsDetailedEntity); } else { @@ -356,8 +364,16 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); } else if (ProfilesActiveConstant.PUSH_SCENE_TYPE_1.equals(pushScenarioType)) { TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity = new TocofsReturngoodsDetailedEntity(); - tocofsReturngoodsDetailedEntity.setRefundedAtStart(startTime); - tocofsReturngoodsDetailedEntity.setRefundedAtEnd(endTime); + if (startTime.length() == 19) { + tocofsReturngoodsDetailedEntity.setRefundedAtStart(startTime); + } else { + tocofsReturngoodsDetailedEntity.setRefundedAtStart(startTime + " 00:00:00"); + } + if (endTime.length() == 19) { + tocofsReturngoodsDetailedEntity.setRefundedAtEnd(endTime); + } else { + tocofsReturngoodsDetailedEntity.setRefundedAtEnd(endTime + " 23:59:59"); + } tocofsReturngoodsDetailedEntity.setBusinesstype("TOC_RETURN"); returnGoodHeaderDetailsDataDtoArrayList = queryTocofsReturngoodsDetailed(tocofsReturngoodsDetailedEntity); } else { @@ -2903,7 +2919,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { //测试 // goodsRertunSonDetailsDto.setReceivedQty("1"); - + String receivedQty = goodsRertunSonDetailsDto.getReceivedQty(); Assert.notNull(receivedQty, "售后订单:{} 存货明细行:{} 请求数量不能为空!", header1.getCode(), goodsRertunSonDetailsDto.getId()); Assert.state(!"".equals(receivedQty), header1.getCode(), goodsRertunSonDetailsDto.getId()); @@ -3083,7 +3099,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { List tocofsReturngoodsDetailedEntityList1 = new ArrayList<>(); for (int j = 0; j < tocofsReturngoodsDetailedEntityList.size(); j++) { TocofsReturngoodsDetailedEntity tocofsReturngoodsDetailedEntity1 = tocofsReturngoodsDetailedEntityList.get(j); - if (tocofsReturngoodsDetailedEntity.getMaintableid().equals(tocofsReturngoodsEntity.getId())) { + if (tocofsReturngoodsDetailedEntity1.getMaintableid().equals(tocofsReturngoodsEntity.getId())) { tocofsReturngoodsDetailedEntityList1.add(tocofsReturngoodsDetailedEntity1); } } diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToCTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToCTest.java index d80245aa..1fff08c5 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToCTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToCTest.java @@ -46,7 +46,7 @@ public class SoSaleReturnPluginInitializerToCTest { try { - soSaleReturnPluginInitializerToC.startImplementStockByTime("2024-12-24 16:02:17", "2024-12-24 16:02:17","0"); + soSaleReturnPluginInitializerToC.startImplementStockByTime("2024-12-24 16:02:17", "2024-12-24 16:02:17", "2"); // JSONObject jsonObject = new JSONObject(); // soSaleReturnPluginInitializerToC.executeBusiness(jsonObject);