From bd02bce2ce2c492862787e7c6590fbd4d9e714e7 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 17 十二月 2024 11:42:12 +0800
Subject: [PATCH] 合并代码

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
index 6df63a3..ee7d503 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -250,14 +250,36 @@
     @Override
     public Goods getManageGoodsDetail(Long goodsId) {
         Goods goods = getById(goodsId);
+        if (goods == null){
+            return null;
+        }
         // 指定门店
         List<GoodsShop> goodsShops = goodsShopService.list(new LambdaQueryWrapper<GoodsShop>()
                 .eq(GoodsShop::getGoodsId, goodsId));
+
+        for (GoodsShop goodsShop : goodsShops) {
+            Shop shop = shopMapper.selectById(goodsShop.getShopId());
+            goodsShop.setShopName(shop.getName());
+            goodsShop.setOwnerName(shop.getShopManager());
+            goodsShop.setPhone(shop.getPhone());
+            goodsShop.setAddress(shop.getAddress());
+        }
         goods.setGoodsShopList(goodsShops);
 
         // 指定用户
         List<GoodsAppUser> goodsAppUserList = goodsAppUserService.list(new LambdaQueryWrapper<GoodsAppUser>()
                 .eq(GoodsAppUser::getGoodsId, goodsId));
+        List<Long> userIds = goodsAppUserList.stream().map(GoodsAppUser::getAppUserId).collect(Collectors.toList());
+        List<AppUser> appUsers = appUserClient.listByIds(userIds);
+        for (GoodsAppUser goodsAppUser : goodsAppUserList) {
+            appUsers.stream().filter(u -> u.getId().equals(goodsAppUser.getAppUserId())).findFirst().ifPresent( u -> {
+                goodsAppUser.setUserName(u.getName());
+                goodsAppUser.setPhone(u.getPhone());
+                VipSetting vipSetting = vipSettingService.getById(u.getVipId());
+                goodsAppUser.setVipName(vipSetting.getVipName());
+            });
+        }
+
         goods.setGoodsAppUserList(goodsAppUserList);
 
         // 会员价格

--
Gitblit v1.7.1