| | |
| | | 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; |
| | |
| | | private GoodsService goodsService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | |
| | | |
| | | |
| | |
| | | @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){ |
| | |
| | | @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(); |
| | | } |
| | | |