From 3fd5d5355ab9a2a8dfb53b1b81cbd2fee0453549 Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Mon, 22 Sep 2025 09:51:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E9=A2=84=E7=BA=A6=E9=80=80=E6=AC=BE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/order/HardCarServiceImpl.java | 54 +++++++++++++------ 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/order/HardCarServiceImpl.java b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/order/HardCarServiceImpl.java index 94c6e3754..35fc6f96d 100644 --- a/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/order/HardCarServiceImpl.java +++ b/pjcloud-hardware/pjcloud-hardware-biz/src/main/java/com/bsd/pjcloud/hard/service/impl/order/HardCarServiceImpl.java @@ -171,24 +171,46 @@ public class HardCarServiceImpl extends ServiceImpl { - // 查询超市商品 AtomicInteger supermarketTotalPrice = new AtomicInteger(); - List supList = supermarketUnitSkuService.getSupermarketUnits(productIds).getData(); - for (HardCreateCarDto v : list) { - supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> { - Integer price = getSupermarket(spu); - if (ObjectUtil.isNotEmpty(v.getProductCount()) && !ObjectUtil.equals(v.getProductCount(), 0)) { - // 按数量 - int itemTotalPrice = v.getProductCount() * price; - supermarketTotalPrice.addAndGet(itemTotalPrice); - } else if (ObjectUtil.isNotEmpty(v.getProductWeight()) && v.getProductWeight().compareTo(BigDecimal.valueOf(0)) != 0) { - // 按重量 - // 向上取整 - int itemTotalPrice = v.getProductWeight().multiply(BigDecimal.valueOf(price)).setScale(0, RoundingMode.CEILING).intValue(); - supermarketTotalPrice.addAndGet(itemTotalPrice); - } - }); + // 线上 + if (ObjectUtil.equals(HardOrderTypeEnum.RESERVE, orderType)) { + List skuList = remoteShopSkuService.getSelectListAll(productIds).getData(); + for (HardCreateCarDto v : list) { + skuList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(sku -> { + Integer price = getSupermarket(sku); + if (ObjectUtil.isNotEmpty(v.getProductCount()) && !ObjectUtil.equals(v.getProductCount(), 0)) { + // 按数量 + int itemTotalPrice = v.getProductCount() * price; + supermarketTotalPrice.addAndGet(itemTotalPrice); + } else if (ObjectUtil.isNotEmpty(v.getProductWeight()) && v.getProductWeight().compareTo(BigDecimal.valueOf(0)) != 0) { + // 按重量 + // 向上取整 + int itemTotalPrice = v.getProductWeight().multiply(BigDecimal.valueOf(price)).setScale(0, RoundingMode.CEILING).intValue(); + supermarketTotalPrice.addAndGet(itemTotalPrice); + } + }); + } + } + // 线下 + else { + List supList = supermarketUnitSkuService.getSupermarketUnits(productIds).getData(); + for (HardCreateCarDto v : list) { + supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> { + Integer price = getSupermarket(spu); + if (ObjectUtil.isNotEmpty(v.getProductCount()) && !ObjectUtil.equals(v.getProductCount(), 0)) { + // 按数量 + int itemTotalPrice = v.getProductCount() * price; + supermarketTotalPrice.addAndGet(itemTotalPrice); + } else if (ObjectUtil.isNotEmpty(v.getProductWeight()) && v.getProductWeight().compareTo(BigDecimal.valueOf(0)) != 0) { + // 按重量 + // 向上取整 + int itemTotalPrice = v.getProductWeight().multiply(BigDecimal.valueOf(price)).setScale(0, RoundingMode.CEILING).intValue(); + supermarketTotalPrice.addAndGet(itemTotalPrice); + } + }); + } } yield supermarketTotalPrice.get(); }