puzhibing
2025-01-13 6461fd7ef5ff8a2b3239b0c9bccd936ab15732ab
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();
    }