From 0fd7d8ca8d9cb58b0929e239880cc05eb5eb8362 Mon Sep 17 00:00:00 2001 From: Jack <46790855@qq.com> Date: Fri, 10 Jan 2025 08:54:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=9D=E8=BF=85=E5=95=86=E5=93=81=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ShopProductBaseServiceImpl.java | 86 +++++++++---------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/product/service/impl/ShopProductBaseServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/product/service/impl/ShopProductBaseServiceImpl.java index bbb50220..cb20626a 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/product/service/impl/ShopProductBaseServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/product/service/impl/ShopProductBaseServiceImpl.java @@ -682,12 +682,13 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl saveProduct(ShopProductBase shopProductBase, ShopProductIndex shopProductIndex, ShopProductData shopProductData, ShopProductDetail shopProductDetail, ShopProductInfo shopProductInfo, List shopProductItemList, List shopProductImageList, ShopProductValidPeriod shopProductValidPeriod, List shopProductAssistIndexList) { Integer store_id = shopProductBase.getStore_id(); - ShopStoreBase storeBase = null; if (store_id == null) { return Pair.of(false, I18nUtil._("缺少店铺ID!")); } - storeBase = shopStoreBaseService.get(store_id); + ShopStoreBase storeBase = shopStoreBaseService.get(store_id); + if (storeBase == null) return Pair.of(false, I18nUtil._("缺少店铺信息!")); + Integer store_type = storeBase.getStore_type(); // 判断是否为供应商店铺 if (store_type == 2) { @@ -712,7 +713,7 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl assistItemList = new ArrayList<>(); if (CollUtil.isNotEmpty(shopProductAssistIndexList)) { for (ShopProductAssistIndex assistIndex : shopProductAssistIndexList) { - if (StringUtils.isNotBlank(assistIndex.getAssist_item_id())) { - assistItemList.add(assistIndex.getAssist_item_id()); - String product_assist_index_id = productId + "-" + assistIndex.getAssist_id(); - assistIndex.setProduct_assist_index_id(product_assist_index_id); - assistIndex.setProduct_id(productId); + if (StringUtils.isBlank(assistIndex.getAssist_item_id())) continue; - if (!assistIndexService.saveOrUpdate(assistIndex)) { - return Pair.of(false, I18nUtil._("保存 ShopProductAssistIndex 商品附加属性出错!")); - } - } + assistItemList.add(assistIndex.getAssist_item_id()); + String product_assist_index_id = productId + "-" + assistIndex.getAssist_id(); + assistIndex.setProduct_assist_index_id(product_assist_index_id); + assistIndex.setProduct_id(productId); + + if (!assistIndexService.saveOrUpdate(assistIndex)) + return Pair.of(false, I18nUtil._("保存 ShopProductAssistIndex 商品附加属性出错!")); } } - if (CollectionUtil.isNotEmpty(assistItemList)) { + // 商品es索引 shopProductIndex + if (CollectionUtil.isNotEmpty(assistItemList)) shopProductIndex.setProduct_assist_data(StrUtil.join(",", assistItemList)); - } shopProductIndex.setProduct_id(productId); shopProductIndex.setProduct_unit_price(item_unit_price); @@ -840,9 +840,6 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl sku_uniqid_list = Arrays.asList(item_id, item_unit_price, "", item_enable); product_uniqid.put(sku_uniqid, sku_uniqid_list); + // 教育课程类订单 if (kind_id == StateCode.PRODUCT_KIND_EDU) { Optional imageOptional = shopProductImageList.stream().filter(s -> ObjectUtil.equal(s.getColor_id(), item_row.getColor_id())).findFirst(); ShopProductImage image = imageOptional.orElseGet(ShopProductImage::new); @@ -1058,20 +1060,20 @@ public class ShopProductBaseServiceImpl extends BaseServiceImpl