From b4068fbd3b2bdc450672357b41e4707fefe05a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Fri, 31 Oct 2025 17:08:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ShopConfigServiceImpl.java | 19 ++++++++++++------- .../impl/TbMemberConfigServiceImpl.java | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/ShopConfigServiceImpl.java b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/ShopConfigServiceImpl.java index 1687bf1d..e8a60c8c 100644 --- a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/ShopConfigServiceImpl.java +++ b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/ShopConfigServiceImpl.java @@ -18,6 +18,7 @@ import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; /** @@ -48,36 +49,40 @@ public class ShopConfigServiceImpl extends ServiceImpl shopIdList) { - ShopConfig shopConfig = getOne(new QueryWrapper().eq(ShopConfig::getId, mainShopId)); + ShopConfig shopConfig = getById(mainShopId); if (shopConfig == null) { shopConfig = new ShopConfig(); shopConfig.setId(mainShopId); save(shopConfig); } - List extistList = list(new QueryWrapper().in(ShopConfig::getId, shopIdList).select(ShopConfig::getId)).stream().map(ShopConfig::getId).toList(); - + // 防止报错 + shopIdList.add(-9999L); + List extistList; if (!shopIdList.isEmpty()) { + extistList = list(new QueryWrapper().in(ShopConfig::getId, shopIdList).select(ShopConfig::getId)).stream().map(ShopConfig::getId).toList(); shopIdList.stream().filter(id -> !extistList.contains(id)).forEach(id -> { - save(new ShopConfig().setId(id).setMainId(mainShopId)); + save(new ShopConfig().setId(id).setMainId(mainShopId).setIsEnableDiscount(0).setIsProductSuggest(0)); }); + } else { + extistList = new ArrayList<>(); } if (isEnable == 0 && !onyUpValid) { updateChain().or(or -> { - or.eq(ShopConfig::getMainId, mainShopId); + or.eq(ShopConfig::getId, mainShopId); }).or(or -> { or.in(ShopConfig::getId, shopIdList); }).set(property, 0).update(); }else { if ("all".equals(useShopType)) { updateChain().or(or -> { - or.eq(ShopConfig::getMainId, mainShopId); + or.eq(ShopConfig::getId, mainShopId); }).or(or -> { or.in(ShopConfig::getId, shopIdList); }).set(property, 1).update(); }else { if (shopIdList.isEmpty()) { - updateChain().eq(ShopConfig::getMainId, mainShopId).set(property, 1).update(); + updateChain().eq(ShopConfig::getId, mainShopId).set(property, 1).update(); }else { if (!onyUpValid) { updateChain().notIn(ShopConfig::getId, shopIdList).set(property, 0).update(); diff --git a/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/TbMemberConfigServiceImpl.java b/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/TbMemberConfigServiceImpl.java index d299b56a..20b6a11d 100644 --- a/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/TbMemberConfigServiceImpl.java +++ b/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/TbMemberConfigServiceImpl.java @@ -192,7 +192,7 @@ public class TbMemberConfigServiceImpl extends ServiceImpl());