From 24e4121c11a64737abcea6a20f4b939511929106 Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Wed, 29 Oct 2025 18:56:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=85=B1=E5=AF=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/order/HardCarServiceImpl.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 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 530c531c5..6ba685927 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 @@ -426,12 +426,19 @@ public class HardCarServiceImpl extends ServiceImpl spuList = remoteMallProductService.getSkusWithSpuBySkuIds(productIds).getData(); for (HardCreateCarDto v : productList) { HardCarEntity item = HardCarEntity.builder().parentCarId(parentCarId).build(); - spuList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> { + spu: + for (MallProductDetailAppVo spu : spuList) { + if (ObjectUtil.isEmpty(spu) || ObjectUtil.isEmpty(spu.getSkuList())) { + continue spu; + } + MallProductSkuAppVo sku = spu.getSkuList().stream().filter(_item -> ObjectUtil.equals(_item.getId(), v.getProductId())).findFirst().orElse(null); + if (ObjectUtil.isEmpty(sku)) { + continue spu; + } if (ObjectUtil.isEmpty(spu.getSkuList())) { throw new RuntimeException("共富商城商品无SKU信息商品名字:" + spu.getTitle() + "商品ID:" + spu.getId() + "请联系管理员"); } - MallProductSkuAppVo skuDetail = spu.getSkuList().get(0); - Integer price = skuDetail.getPrice(); + Integer price = sku.getPrice(); int totalPrice = 0; if (ObjectUtil.isNotEmpty(v.getProductCount()) && !ObjectUtil.equals(v.getProductCount(), 0)) { // 按数量 @@ -440,7 +447,7 @@ public class HardCarServiceImpl extends ServiceImpl