From e4eaabefaaa2ca95f809c47a11712c3bee56e1b5 Mon Sep 17 00:00:00 2001 From: luofl <1442745593@qq.com> Date: 星期四, 20 二月 2025 15:07:09 +0800 Subject: [PATCH] 修改物流信息导入模板 --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java | 31 +++++++++++++++---------------- 1 files changed, 15 insertions(+), 16 deletions(-) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java index 1be9a3f..2320d8a 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/VipCenterController.java @@ -12,6 +12,7 @@ import com.ruoyi.account.vo.vip.VipLevel; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.exception.ServiceException; +import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.bean.BeanUtils; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.other.api.domain.*; @@ -87,29 +88,27 @@ VipLevel vipLevel = new VipLevel(); List<Level> levelList = new ArrayList<>(); - // 批量获取 goodsVip 和 vipGoods - List<Integer> vipIds = vipSettingList.stream().map(VipSetting::getId).collect(Collectors.toList()); - Map<Integer, R<List<VipGood>>> vipGoodsMap = getVipGoods(vipIds); - vipSettingList.forEach(vipSetting -> { Level level = new Level(); level.setName(vipSetting.getVipName()); BeanUtils.copyBeanProp(level, vipSetting); level.setVipDesc(baseSetting.getContent()); - R<List<VipGood>> vipGoodR = vipGoodsMap.get(vipSetting.getId()); - if (R.isError(vipGoodR)) { - throw new ServiceException("会员商品获取失败"); + + List<String> goodsNames = new ArrayList<>(); + if (StringUtils.isNotEmpty(vipSetting.getGoodIds())){ + String[] goodsIds = vipSetting.getGoodIds().split(","); + List<Goods> goodsList = goodsClient.getGoodsById(goodsIds).getData(); + if (goodsList != null) { + for (Goods goods : goodsList) { + if (goods.getDelFlag().equals(0)){ + goodsNames.add(goods.getName()); + } + } + } } - List<VipGood> vipGoodList = vipGoodR.getData(); - if (vipGoodList != null && !vipGoodList.isEmpty()) { - List<String> goodsNames = new ArrayList<>(); - vipGoodList.forEach(vipGood -> { - Goods goods = JSON.parseObject(vipGood.getGood_json(), Goods.class); - goodsNames.add(goods.getName()); - }); - level.setGoodsNames(goodsNames); - } + + level.setGoodsNames(goodsNames); levelList.add(level); }); -- Gitblit v1.7.1