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 | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 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 47f74b0..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 @@ -205,7 +205,6 @@ area.setProvinceCode(goodsArea.getProvinceCode()); area.setCityCode(goodsArea.getCityCode()); area.setDistrictsCode(goodsArea.getDistrictsCode()); - goodsAreaList1.add(area); } goodsAreaService.saveBatch(goodsAreaList1); } @@ -251,6 +250,9 @@ @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)); @@ -267,6 +269,19 @@ // 指定用户 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