| | |
| | | import com.ruoyi.account.api.model.UserAddress; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.order.mapper.OrderGoodMapper; |
| | | import com.ruoyi.order.mapper.OrderMapper; |
| | | import com.ruoyi.order.service.OrderService; |
| | | import com.ruoyi.order.vo.OrderDetailVO; |
| | | import com.ruoyi.order.vo.OrderGoodsVO; |
| | | import com.ruoyi.order.vo.OrderVO; |
| | | import com.ruoyi.other.api.domain.CouponInfo; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.OrderActivityInfo; |
| | | import model.Order; |
| | | import model.OrderGood; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService { |
| | | @Resource |
| | | private OrderMapper orderMapper; |
| | | private OrderGoodMapper orderGoodMapper; |
| | | |
| | | @Override |
| | | public List<OrderVO> selectOrderListByUserId(Integer status, Long userId) { |
| | |
| | | if (order == null){ |
| | | throw new ServiceException("订单不存在"); |
| | | } |
| | | // 商品 |
| | | List<OrderGood> orderGoods = orderGoodMapper.selectList(new LambdaQueryWrapper<OrderGood>() |
| | | .eq(OrderGood::getOrderId, orderId)); |
| | | |
| | | List<OrderGoodsVO> goodsList = new ArrayList<>(); |
| | | for (OrderGood orderGood : orderGoods) { |
| | | String goodJson = orderGood.getGoodJson(); |
| | | Goods goods = JSONObject.parseObject(goodJson, Goods.class); |
| | | |
| | | OrderGoodsVO orderGoodsVO = new OrderGoodsVO(); |
| | | orderGoodsVO.setGoodsId(orderGood.getGoodsId()); |
| | | orderGoodsVO.setGoodsName(goods.getName()); |
| | | orderGoodsVO.setType(goods.getType()); |
| | | orderGoodsVO.setNum(orderGood.getNum()); |
| | | orderGoodsVO.setGoodsPic(goods.getHomePagePicture()); |
| | | orderGoodsVO.setSellingPrice(goods.getSellingPrice()); |
| | | orderGoodsVO.setOriginalPrice(goods.getOriginalPrice()); |
| | | goodsList.add(orderGoodsVO); |
| | | } |
| | | |
| | | |
| | | // 收货地址 |
| | | String addressJson = order.getAddressJson(); |
| | | UserAddress userAddress = new UserAddress(); |
| | |
| | | orderDetailVO.setExpressAmount(order.getExpressAmount()); |
| | | orderDetailVO.setPointAmount(order.getGetPoint()); |
| | | orderDetailVO.setPaymentAmount(order.getPaymentAmount()); |
| | | orderDetailVO.setGoodsList(goodsList); |
| | | return orderDetailVO; |
| | | } |
| | | |