From 96ad8b2e0ae96c52d5336b38da608da01c4d5cd6 Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Sat, 25 May 2024 22:48:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A8=A1=E5=9D=97=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/constant/ModuleNameConstant.java | 2 +- .../BusinessPreOrderDataQueueHandler.java | 20 ++++- .../impl/DistributionAsyncServiceImpl.java | 89 +++++++++++++++++-- 3 files changed, 100 insertions(+), 11 deletions(-) diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java b/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java index 71fc125ac..c3cc1b12c 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java @@ -9,7 +9,7 @@ public interface ModuleNameConstant { /** * 如果不需要 "" */ - public static final String DEVAUTH ="-pref"; + public static final String DEVAUTH =""; /** * 工厂对接服务名称 diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java index 38d608560..b9e8ca8c3 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java @@ -73,11 +73,26 @@ public class BusinessPreOrderDataQueueHandler { private final IDistributionAsyncService distributionAsyncService; @RabbitHandler public void businessPreOrderDataHandler(Map map, Message message, Channel channel) { +// plantA(map); + R> tenantList = sysClient.getTenantList(); + if(tenantList.isSuccess()){ + List data = tenantList.getData(); + data.forEach(tenant -> { + if(!ObjectUtil.isEmpty(tenant.getTenantType())){ + if(2==tenant.getTenantType()){ + String mallName = tenant.getTenantName(); + extracted(map, mallName); + } + } + }); + } -// plantA(map); - String mallName = "仁寿欧派大家居"; + } + + + private void extracted(Map map, String mallName) { // 查询推送包件 List distributionParcelListEntities = allList(map, mallName); if (ObjectUtil.isEmpty(distributionParcelListEntities)) { @@ -118,7 +133,6 @@ public class BusinessPreOrderDataQueueHandler { distributionAsyncService.saveOtherData(tenant.getTenantId(),waybillBilllByWaybillNos, trunklineAdvanceDetailEntities, trunklineAdvanceEntities, trunklineWaybillPackageEntities, trunklineWaybillOrderEntities, warehouseWayBillDetails, distributionParcelListEntities, mallName); return null; }); - } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java index fe1d051e5..40c12dece 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java @@ -2842,16 +2842,41 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { waybillBilllByWaybillNo.setTenantId(tenant.getTenantId()); - Long l = warehouseWaybillClient.addEnntity(waybillBilllByWaybillNo); - waybillBilllByWaybillNo.setId(l); + + WarehouseWaybillEntity byWaybillNo = warehouseWaybillClient.findByWaybillNo(waybillBilllByWaybillNo.getWaybillNo()); + if(byWaybillNo==null){ + Long l = warehouseWaybillClient.addEnntity(waybillBilllByWaybillNo); + waybillBilllByWaybillNo.setId(l); + }else{ + waybillBilllByWaybillNo.setId(byWaybillNo.getId()); + } + + + List byWaybillId = warehouseWaybillDetailClient.findByWaybillId(waybillBilllByWaybillNo.getId()); for (WarehouseWayBillDetail warehouseWayBillDetail : t) { warehouseWayBillDetail.setId(null); - warehouseWayBillDetail.setWaybillId(waybillBilllByWaybillNo.getId()); - warehouseWaybillDetailClient.addEntity(warehouseWayBillDetail); + for (WarehouseWayBillDetail wayBillDetail : byWaybillId) { + + if(wayBillDetail.getProductName().equals(warehouseWayBillDetail.getProductName())){ + // 不执行 + warehouseWayBillDetail.setId(wayBillDetail.getId()); + break; + } + } + + if(warehouseWayBillDetail.getId()==null){ + warehouseWayBillDetail.setWaybillId(waybillBilllByWaybillNo.getId()); + warehouseWaybillDetailClient.addEntity(warehouseWayBillDetail); + } + + } + List listByWaybillNo = trunklineWaybillOrderClient.findListByWaybillNo(waybillBilllByWaybillNo.getWaybillNo()); + + for (TrunklineWaybillOrderEntity trunklineWaybillOrderEntity : collect1) { trunklineWaybillOrderEntity.setId(null); @@ -2872,8 +2897,26 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { trunklineWaybillOrderEntity.setAdvanceId(foundEntity.getId()); } - Long l1 = trunklineWaybillOrderClient.addEntityReturnId(trunklineWaybillOrderEntity); - trunklineWaybillOrderEntity.setId(l1); + + + for (TrunklineWaybillOrderEntity waybillOrderEntity : listByWaybillNo) { + + if(waybillOrderEntity.getOrderCode().equals(trunklineWaybillOrderEntity.getOrderCode())){ + trunklineWaybillOrderEntity.setId(waybillOrderEntity.getId()); + } + + } + if(trunklineWaybillOrderEntity.getId()==null){ + + Long l1 = trunklineWaybillOrderClient.addEntityReturnId(trunklineWaybillOrderEntity); + + trunklineWaybillOrderEntity.setId(l1); + } + + + + List ids = Arrays.asList(waybillBilllByWaybillNo.getId()); + List listByWaybillIds = trunklineWaybillPackageClient.findListByWaybillIds(ids); for (TrunklineWaybillPackageEntity trunklineWaybillPackageEntity : collect3) { trunklineWaybillPackageEntity.setId(null); @@ -2892,8 +2935,21 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { } } + for (TrunklineWaybillPackageEntity listByWaybillId : listByWaybillIds) { + + if(listByWaybillId.getWaybillId().equals(trunklineWaybillPackageEntity.getWaybillId())){ + if(listByWaybillId.getOrderPackageCode().equals(trunklineWaybillPackageEntity.getOrderPackageCode())){ + trunklineWaybillPackageEntity.setId(listByWaybillId.getId()); + break; + } + } + + } + if(trunklineWaybillPackageEntity.getId()==null){ + trunklineWaybillPackageClient.addEntity(trunklineWaybillPackageEntity); + } + - trunklineWaybillPackageClient.addEntity(trunklineWaybillPackageEntity); } } @@ -2912,7 +2968,26 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService { private void saveTrunklineAdvanceDetailEntity(List t, TrunklineAdvanceEntity trunklineAdvanceEntity, String mallName) { Tenant tenant = changeDataBase(mallName); + + + + List ids = Arrays.asList(trunklineAdvanceEntity.getId()); + + List listByAdvanceIds = trunklineAdvanceDetailClient.findListByAdvanceIds(ids); + + for (TrunklineAdvanceDetailEntity trunklineAdvanceDetailEntity : t) { + + + // 检测 保存的对象是否已经存在 + for (TrunklineAdvanceDetailVO listByAdvanceId : listByAdvanceIds) { + if(listByAdvanceId.getOrderPackageCode().equals(trunklineAdvanceDetailEntity.getOrderPackageCode())){ + trunklineAdvanceDetailEntity.setId(listByAdvanceId.getId()); + break; + } + + } + trunklineAdvanceDetailEntity.setPackageStatus("0"); trunklineAdvanceDetailEntity.setAdvanceId(trunklineAdvanceEntity.getId()); trunklineAdvanceDetailEntity.setTenantId(tenant.getTenantId());