From 443878cad8c61365a7e5a42d502e232cff9d54c5 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期一, 13 一月 2025 20:38:17 +0800 Subject: [PATCH] 修改bug --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java | 17 +++++++++++++++-- 1 files changed, 15 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..93872c1 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){ @@ -85,6 +90,7 @@ List<GoodsEvaluate> list = goodsEvaluateService.list(new LambdaQueryWrapper<GoodsEvaluate>() .eq(GoodsEvaluate::getStatus, 2) .eq(GoodsEvaluate::getAppUserId,loginUserApplet.getUserid()) + .eq(GoodsEvaluate::getDelFlag, 0) .eq(GoodsEvaluate::getOrderId, orderId)); for (GoodsEvaluate goodsEvaluate : list) { Goods goods = goodsService.getById(goodsEvaluate.getGoodsId()); @@ -101,7 +107,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(data.getOldOrderStatus()); + orderClient.editOrder(data); return R.ok(); } @@ -145,6 +157,7 @@ .in(!goodsIds.isEmpty(), GoodsEvaluate::getGoodsId, goodsIds) .in(!usersNameList.isEmpty(), GoodsEvaluate::getAppUserId, usersNameList) .eq(goodsEvaluate.getStatus() != null, GoodsEvaluate::getStatus, goodsEvaluate.getStatus()) + .eq(GoodsEvaluate::getDelFlag, 0) .orderByDesc(GoodsEvaluate::getCreateTime)); -- Gitblit v1.7.1