From 19df67e19f23cd2a04d1c7f355e1e656f4140af4 Mon Sep 17 00:00:00 2001 From: huliguo <2023611923@qq.com> Date: 星期四, 17 四月 2025 20:04:14 +0800 Subject: [PATCH] 后台:首页统计、系统管理、广告管理、用户管理、商品分类管理 --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java | 30 ++++++++++++++++++++++++++---- 1 files changed, 26 insertions(+), 4 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 cfe1bac..947109e 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 @@ -14,6 +14,7 @@ import com.ruoyi.order.model.Order; import com.ruoyi.other.api.domain.Goods; import com.ruoyi.other.api.domain.GoodsEvaluate; +import com.ruoyi.other.mapper.GoodsEvaluateMapper; import com.ruoyi.other.service.GoodsEvaluateService; import com.ruoyi.other.service.GoodsService; import com.ruoyi.other.vo.GoodsEvaluateVO; @@ -43,6 +44,8 @@ @Resource private GoodsEvaluateService goodsEvaluateService; @Resource + private GoodsEvaluateMapper goodsEvaluateMapper; + @Resource private AppUserClient appUserClient; @Resource private GoodsService goodsService; @@ -52,7 +55,19 @@ private OrderClient orderClient; + /** + * 通过订单id查询评价id + */ + @GetMapping("/getEvaluateIdByOrderId") + public R<Long> getEvaluateIdByOrderId( @RequestParam("orderId") Long orderId) { + GoodsEvaluate evaluate = goodsEvaluateMapper.selectOne(new LambdaQueryWrapper<GoodsEvaluate>() + .eq(GoodsEvaluate::getOrderId, orderId).eq(GoodsEvaluate::getDelFlag,0).eq(GoodsEvaluate::getStatus,2)); + if (evaluate != null) { + return R.ok(evaluate.getId()); + } + return R.ok(null); + } @GetMapping("/goodsList") @ApiOperation(value = "获取商品评价", tags = {"小程序-获取商品评价"}) @@ -77,9 +92,9 @@ */ @PostMapping("/addGoodsEvaluate") @ApiOperation(value = "发布商品评价", tags = {"小程序-个人中心-我的订单"}) - public R<Void> addGoodsEvaluate(@RequestBody GoodsEvaluate goodsEvaluate){ - goodsEvaluateService.addGoodsEvaluate(goodsEvaluate); - return R.ok(); + public R addGoodsEvaluate(@RequestBody GoodsEvaluate goodsEvaluate){ + + return goodsEvaluateService.addGoodsEvaluate(goodsEvaluate); } /** @@ -92,6 +107,9 @@ .eq(GoodsEvaluate::getStatus, 2) .eq(GoodsEvaluate::getDelFlag, 0) .eq(GoodsEvaluate::getOrderId, orderId)); + if(evaluate==null){ + return R.fail("未评价"); + } Goods goods = goodsService.getById(evaluate.getGoodsId()); evaluate.setGoodsName(goods.getName()); evaluate.setGoodsImg(goods.getHomePagePicture()); @@ -180,6 +198,7 @@ Goods goods = goodsService.getById(item.getGoodsId()); if(null != goods){ item.setGoodsName(goods.getName()); + item.setGoodsImg(goods.getHomePagePicture()); } } @@ -187,9 +206,12 @@ * 评论详情 */ @GetMapping("/{id}") - @ApiOperation(value = "评论详情", tags = {"管理后台-商品管理-评价管理"}) + @ApiOperation(value = "评论详情", tags = {"管理后台-商品管理-评价管理","门店后台-订单-查看用户评价详情"}) public R<GoodsEvaluate> getDetail(@PathVariable("id") Long id){ GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(id); + if (null==goodsEvaluate){ + return R.fail("未找到该评论"); + } buildDetail(goodsEvaluate); return R.ok(goodsEvaluate); } -- Gitblit v1.7.1