use of com.whoiszxl.cqrs.response.CartItemVO in project shopzz by whoiszxl.
the class OrderServiceImpl method buildOrderItems.
private List<OrderItem> buildOrderItems(long orderId, String orderNo) {
// 获取当前选中的购物车item列表
CartDetailApiResponse cartDetail = cartService.getCartDetail();
List<CartItemVO> cartItemVOList = cartDetail.getCartItemVOList();
List<OrderItem> result = new ArrayList<>();
for (CartItemVO item : cartItemVOList) {
if (item.getChecked() == 1) {
OrderItem orderItem = buildOrderItem(item);
orderItem.setOrderId(orderId);
orderItem.setOrderNo(orderNo);
result.add(orderItem);
}
}
return result;
}
use of com.whoiszxl.cqrs.response.CartItemVO in project shopzz by whoiszxl.
the class CartServiceImpl method getCartDetail.
@Override
public CartDetailApiResponse getCartDetail() {
String memberId = AuthUtils.getStrMemberId();
CartDetailApiResponse response = new CartDetailApiResponse();
Map<Object, Object> cartItems = redisUtils.hGetAll(RedisKeyPrefixConstants.MEMBER_CART_PREFIX + memberId);
if (ObjectUtils.isEmpty(cartItems)) {
return response;
}
List<CartItemVO> cartItemVOList = cartItems.values().stream().map(obj -> {
String jsonValue = (String) obj;
return JsonUtil.fromJson(jsonValue, CartItemVO.class);
}).collect(Collectors.toList());
response.setCartItemVOList(cartItemVOList);
return response;
}
Aggregations