From a3bc34209c07ed85867262c3c53e98e2da300a0b Mon Sep 17 00:00:00 2001
From: phpcjl <phpcjl@gmail.com>
Date: 星期一, 09 十二月 2024 18:23:18 +0800
Subject: [PATCH] 1.

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 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 a7e2962..987abec 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
@@ -5,8 +5,10 @@
 import com.ruoyi.account.api.feignClient.AppUserClient;
 import com.ruoyi.account.api.model.AppUser;
 import com.ruoyi.common.core.domain.R;
+import com.ruoyi.other.api.domain.Goods;
 import com.ruoyi.other.api.domain.GoodsEvaluate;
 import com.ruoyi.other.service.GoodsEvaluateService;
+import com.ruoyi.other.service.GoodsService;
 import com.ruoyi.other.vo.GoodsEvaluateVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -15,6 +17,7 @@
 
 import javax.annotation.Resource;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -32,6 +35,8 @@
     private GoodsEvaluateService goodsEvaluateService;
     @Resource
     private AppUserClient appUserClient;
+    @Resource
+    private GoodsService goodsService;
 
     @GetMapping("/goodsList")
     @ApiOperation(value = "获取商品评价", tags = {"小程序-获取商品评价"})
@@ -41,6 +46,7 @@
             AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId());
             goodsEvaluate.setUserName(appUserById.getName());
             goodsEvaluate.setAvatar(appUserById.getAvatar());
+            goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId()));
         }
         return R.ok(list);
     }
@@ -64,6 +70,11 @@
         List<GoodsEvaluate> list = goodsEvaluateService.list(new LambdaQueryWrapper<GoodsEvaluate>()
                 .eq(GoodsEvaluate::getStatus, 2)
                 .eq(GoodsEvaluate::getOrderId, orderId));
+        for (GoodsEvaluate goodsEvaluate : list) {
+            Goods goods = goodsService.getById(goodsEvaluate.getGoodsId());
+            goodsEvaluate.setGoodsName(goods.getName());
+            goodsEvaluate.setGoodsImg(goods.getHomePagePicture());
+        }
         return R.ok(list);
     }
 

--
Gitblit v1.7.1