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;
}
Aggregations