Commit 3bb35743 by 周晓航

Merge branch 'ka-商品技术需求购物车不校验商品库存' into qa

parents 899ffd0f 9c1fb75a
......@@ -2339,11 +2339,14 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
requestDto.setStoreId(addShoppingCartGoodsRequestVo.getShopId());
requestDto.setProductIds(productIds);
GetProductStockResponseDto availableStocks = stockClient.getAvailableStocks(requestDto);
if (availableStocks == null || !ResponseCodeConstant.RESPONSE_SUCCESS_STR.equals(availableStocks.getCode())) {
// 商品服务 返回null 或者 qty=null 表示不限制库存
if (Objects.isNull(availableStocks) || Objects.isNull(availableStocks.getResult().get(0).getQty())) {
return;
}
if (!ResponseCodeConstant.RESPONSE_SUCCESS_STR.equals(availableStocks.getCode())) {
throw new ServiceException(ResponseResult.SHOPPING_CART_STOCK_NOT_HAVE);
}
int stock = CollectionUtils.isEmpty(availableStocks.getResult()) || availableStocks.getResult().get(0).getQty() == null ? 0 :
availableStocks.getResult().get(0).getQty();
int stock = availableStocks.getResult().get(0).getQty();
if (stock <= 0) {
throw new ServiceException(ResponseResult.SHOPPING_CART_STOCK_NOT_HAVE);
} else if (stock < qty) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment