diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataDriverArteryServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataDriverArteryServiceImpl.java index d356d0695..cce94388c 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataDriverArteryServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataDriverArteryServiceImpl.java @@ -143,6 +143,9 @@ public class BasicdataDriverArteryServiceImpl extends BaseServiceImpl list = baseMapper.selectListByWarehouseId(warehouseId); log.info("################getDriverList list:{}", list); + if(list.isEmpty()){ + return basicdataDriverArteryVOS; + } List ids =list.stream() // 创建一个流 .map(BasicdataDriverArteryEntity::getId) // 使用map方法获取每个对象的ID 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 72210a724..870d02087 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 @@ -162,6 +162,9 @@ public class BusinessPreOrderDataQueueHandler { // 更新删除状态 distributionBusinessPreOrderService.deleteLogic(temsp); } + for (DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : dataResult) { + distributionBusinessPreOrderEntity.setTenantId(tenant.getTenantId()); + } // 执行保存操作 distributionBusinessPreOrderService.saveBatch(dataResult); @@ -172,71 +175,71 @@ public class BusinessPreOrderDataQueueHandler { } - public void saveOtherDataBase(List dataResult, String maillName) { - String method = "########################saveOtherDataBase"; - R tenantByName = sysClient.getTenantByName(maillName); - if (tenantByName.isSuccess()) { - Tenant tenant = tenantByName.getData(); - if (ObjectUtil.isEmpty(tenant)) { - log.info(">>>>>>>>>>>>> BusinessPreOrderDataQueueHandler 租户不存在"); - return; - } - if (dataResult.isEmpty()) { - log.info(method + "dataResult 参数错误"); - } - DynamicDataSourceContextHolder.push(tenant.getTenantId()); - Map> map = dataResult.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getInWarehouse)); - if (Func.isNotEmpty(map.get(1))) { - //存在需要进行删除的数据 - List deleteList = map.get(0); - if (!deleteList.isEmpty()) { - Map> deletedMap = deleteList.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getReservationCode)); - deletedMap.forEach((k, v) -> { - List deletedPackageList = v.stream().map(DistributionBusinessPreOrderEntity::getOrderPackageCode).collect(Collectors.toList()); - log.info("删除商家端数据>>>>reservationCode:{}", deletedPackageList); - if (!deletedPackageList.isEmpty()) { - //进行删除 - Integer row = distributionBusinessPreOrderService.deleteBusinessPreOrder(k, deletedPackageList); - log.info("删除商家端数据>>>>row:{}", row); - } - }); - } - } - if (Func.isNotEmpty(map.get(0))) { - //存在可能变更的数据 - List mapList = map.get(0); - Map> saveData = mapList.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getReservationCode)); - List existData = new ArrayList<>(); - if (!saveData.isEmpty()) { - //查询是否存在重复 - saveData.forEach((k, v) -> { - List list = distributionBusinessPreOrderService.list(Wrappers.query().lambda() - .eq(DistributionBusinessPreOrderEntity::getReservationCode, k) - .in(DistributionBusinessPreOrderEntity::getOrderPackageCode, v.stream().map(DistributionBusinessPreOrderEntity::getOrderPackageCode).collect(Collectors.toList())) - ); - if (!list.isEmpty()) { - //已经存在数据 - existData.addAll(list); - } - }); - } - if (!existData.isEmpty()) { - //二者比较取差集 - mapList = mapList.stream().filter(m -> !existData.stream().map(DistributionBusinessPreOrderEntity::getOrderPackageCode).collect(Collectors.toList()).contains(m.getOrderPackageCode())).collect(Collectors.toList()); - } - if (!mapList.isEmpty()) { - for (DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : mapList) { - distributionBusinessPreOrderEntity.setTenantId(tenant.getTenantId()); - } - distributionBusinessPreOrderService.saveBatch(mapList); - } - } - DynamicDataSourceContextHolder.poll(); - - } - - - } +// public void saveOtherDataBase(List dataResult, String maillName) { +// String method = "########################saveOtherDataBase"; +// R tenantByName = sysClient.getTenantByName(maillName); +// if (tenantByName.isSuccess()) { +// Tenant tenant = tenantByName.getData(); +// if (ObjectUtil.isEmpty(tenant)) { +// log.info(">>>>>>>>>>>>> BusinessPreOrderDataQueueHandler 租户不存在"); +// return; +// } +// if (dataResult.isEmpty()) { +// log.info(method + "dataResult 参数错误"); +// } +// DynamicDataSourceContextHolder.push(tenant.getTenantId()); +// Map> map = dataResult.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getInWarehouse)); +// if (Func.isNotEmpty(map.get(1))) { +// //存在需要进行删除的数据 +// List deleteList = map.get(0); +// if (!deleteList.isEmpty()) { +// Map> deletedMap = deleteList.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getReservationCode)); +// deletedMap.forEach((k, v) -> { +// List deletedPackageList = v.stream().map(DistributionBusinessPreOrderEntity::getOrderPackageCode).collect(Collectors.toList()); +// log.info("删除商家端数据>>>>reservationCode:{}", deletedPackageList); +// if (!deletedPackageList.isEmpty()) { +// //进行删除 +// Integer row = distributionBusinessPreOrderService.deleteBusinessPreOrder(k, deletedPackageList); +// log.info("删除商家端数据>>>>row:{}", row); +// } +// }); +// } +// } +// if (Func.isNotEmpty(map.get(0))) { +// //存在可能变更的数据 +// List mapList = map.get(0); +// Map> saveData = mapList.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getReservationCode)); +// List existData = new ArrayList<>(); +// if (!saveData.isEmpty()) { +// //查询是否存在重复 +// saveData.forEach((k, v) -> { +// List list = distributionBusinessPreOrderService.list(Wrappers.query().lambda() +// .eq(DistributionBusinessPreOrderEntity::getReservationCode, k) +// .in(DistributionBusinessPreOrderEntity::getOrderPackageCode, v.stream().map(DistributionBusinessPreOrderEntity::getOrderPackageCode).collect(Collectors.toList())) +// ); +// if (!list.isEmpty()) { +// //已经存在数据 +// existData.addAll(list); +// } +// }); +// } +// if (!existData.isEmpty()) { +// //二者比较取差集 +// mapList = mapList.stream().filter(m -> !existData.stream().map(DistributionBusinessPreOrderEntity::getOrderPackageCode).collect(Collectors.toList()).contains(m.getOrderPackageCode())).collect(Collectors.toList()); +// } +// if (!mapList.isEmpty()) { +// for (DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : mapList) { +// distributionBusinessPreOrderEntity.setTenantId(tenant.getTenantId()); +// } +// distributionBusinessPreOrderService.saveBatch(mapList); +// } +// } +// DynamicDataSourceContextHolder.poll(); +// +// } +// +// +// } } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java index f4b84f0b8..09296e577 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java @@ -71,6 +71,8 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl