| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; |
| | | import com.ruoyi.order.model.Order; |
| | | import com.ruoyi.other.mapper.GoodsEvaluateMapper; |
| | | import com.ruoyi.other.api.domain.GoodsEvaluate; |
| | | import com.ruoyi.other.service.GoodsEvaluateService; |
| | | import com.ruoyi.other.vo.GoodsEvaluateVO; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class GoodsEvaluateServiceImpl extends ServiceImpl<GoodsEvaluateMapper, GoodsEvaluate> implements GoodsEvaluateService { |
| | | @Resource |
| | | private RemoteOrderGoodsClient remoteOrderGoodsClient; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void addGoodsEvaluate(GoodsEvaluateVO goodsEvaluateVO) { |
| | | List<GoodsEvaluate> evaluates = goodsEvaluateVO.getEvaluates(); |
| | | for (GoodsEvaluate goodsEvaluate : evaluates) { |
| | | goodsEvaluate.setStatus(2); |
| | | } |
| | | this.saveBatch(evaluates); |
| | | if (CollectionUtil.isNotEmpty(evaluates)){ |
| | | Order order = new Order(); |
| | | order.setId(goodsEvaluateVO.getEvaluates().get(0).getOrderId()); |
| | | order.setOrderStatus(8); |
| | | R<Void> r = remoteOrderGoodsClient.updateOrderStatus(order); |
| | | if (R.isError(r)){ |
| | | throw new RuntimeException("修改订单状态失败"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |