Search in sources :

Example 1 with CartDetailVO

use of com.whoiszxl.entity.vo.CartDetailVO in project shopzz by whoiszxl.

the class OrderServiceImpl method buildOrderItems.

/**
 * 创建订单详情条目列表
 * @param orderId
 * @return
 */
private List<OrderItem> buildOrderItems(long orderId) {
    // 获取当前选中的购物车item列表
    CartDetailVO cartDetail = cartService.getCartDetail();
    List<CartItemVO> cartItemVOList = cartDetail.getCartItemVOList();
    if (ObjectUtils.isEmpty(cartItemVOList)) {
        ExceptionCatcher.catchValidateEx(ResponseResult.buildError("购物车不存在选中商品"));
    }
    List<OrderItem> result = new ArrayList<>();
    for (CartItemVO item : cartItemVOList) {
        if (item.getChecked() == 1) {
            OrderItem orderItem = buildOrderItem(item);
            orderItem.setOrderId(orderId);
            orderItem.setOrderSn(orderId + "");
            result.add(orderItem);
        }
    }
    return result;
}
Also used : CartDetailVO(com.whoiszxl.entity.vo.CartDetailVO) OrderItem(com.whoiszxl.entity.OrderItem) ArrayList(java.util.ArrayList) CartItemVO(com.whoiszxl.entity.vo.CartItemVO)

Aggregations

OrderItem (com.whoiszxl.entity.OrderItem)1 CartDetailVO (com.whoiszxl.entity.vo.CartDetailVO)1 CartItemVO (com.whoiszxl.entity.vo.CartItemVO)1 ArrayList (java.util.ArrayList)1