From caf38fb12050d677052087f3391adcc64a6959c9 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期一, 13 一月 2025 18:04:32 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 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 e0665fb..b431e08 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
@@ -9,6 +9,8 @@
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.security.service.TokenService;
+import com.ruoyi.order.feignClient.OrderClient;
+import com.ruoyi.order.model.Order;
 import com.ruoyi.other.api.domain.Goods;
 import com.ruoyi.other.api.domain.GoodsEvaluate;
 import com.ruoyi.other.service.GoodsEvaluateService;
@@ -46,6 +48,8 @@
     private GoodsService goodsService;
     @Resource
     private TokenService tokenService;
+    @Resource
+    private OrderClient orderClient;
 
 
 
@@ -53,7 +57,8 @@
     @GetMapping("/goodsList")
     @ApiOperation(value = "获取商品评价", tags = {"小程序-获取商品评价"})
     public R<List<GoodsEvaluate>> goodsList(@ApiParam("商品id") Integer goodsId){
-        List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).eq(GoodsEvaluate::getDelFlag, 0).eq(GoodsEvaluate::getStatus, 2).list();
+        List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).eq(GoodsEvaluate::getDelFlag, 0)
+                .eq(GoodsEvaluate::getStatus, 2).isNotNull(GoodsEvaluate::getComment).ne(GoodsEvaluate::getComment, "").orderByDesc(GoodsEvaluate::getCreateTime).list();
         for (GoodsEvaluate goodsEvaluate : list) {
             AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId());
             if(null != appUserById){
@@ -101,7 +106,13 @@
     @DeleteMapping("/delete/{id}")
     @ApiOperation(value = "删除评论", tags = {"管理后台-商品管理-评价管理"})
     public R<Void> delete(@PathVariable("id") Long id){
-        goodsEvaluateService.removeById(id);
+        GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(id);
+        goodsEvaluate.setDelFlag(1);
+        goodsEvaluateService.updateById(goodsEvaluate);
+        //修改订单为待评价
+        Order data = orderClient.getOrderById(goodsEvaluate.getOrderId()).getData();
+        data.setOrderStatus(4);
+        orderClient.editOrder(data);
         return R.ok();
     }
 

--
Gitblit v1.7.1