From e7c4f82cebe617703b434e4aafeefa1e20aff094 Mon Sep 17 00:00:00 2001
From: phpcjl <phpcjl@gmail.com>
Date: 星期二, 17 十二月 2024 13:46:05 +0800
Subject: [PATCH] 1

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java |   24 ++++++++++++++++++++++++
 1 files changed, 24 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..1f25104 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,38 @@
     @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());
+                if (vipSetting != null){
+                    goodsAppUser.setVipName(vipSetting.getVipName());
+                }
+            });
+        }
+
         goods.setGoodsAppUserList(goodsAppUserList);
 
         // 会员价格

--
Gitblit v1.7.1