From e0623f1a914ecbc99d5926c0df3cf26032c02499 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 01 一月 2025 17:11:50 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/qijisheng --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java index b1374df..8ff1004 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java @@ -50,9 +50,11 @@ List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).list(); for (GoodsEvaluate goodsEvaluate : list) { AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId()); - goodsEvaluate.setUserName(appUserById.getName()); - goodsEvaluate.setAvatar(appUserById.getAvatar()); - goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId())); + if(null != appUserById){ + goodsEvaluate.setUserName(appUserById.getName()); + goodsEvaluate.setAvatar(appUserById.getAvatar()); + goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId())); + } } return R.ok(list); } @@ -120,13 +122,12 @@ private void buildDetail(GoodsEvaluate item) { AppUser appUser = appUserClient.getAppUserById(item.getAppUserId()); - if (appUser == null){ - throw new RuntimeException("获取用户信息失败"); + if (appUser != null){ + item.setPhone(appUser.getPhone()); + item.setUserName(appUser.getName()); } Goods goods = goodsService.getById(item.getGoodsId()); item.setGoodsName(goods.getName()); - item.setPhone(appUser.getPhone()); - item.setUserName(appUser.getName()); } /** -- Gitblit v1.7.1