Commit 0edab09e by 徐康

数量校验

parent 46c060fb
...@@ -1582,7 +1582,10 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -1582,7 +1582,10 @@ public class ShoppingCartMCoffeeServiceImpl {
.collect(Collectors.toMap(ProductBeanDTO.ProductComboType::getProductId, ProductBeanDTO.ProductComboType::getQuantity, (k1,k2) -> k1+k2)); .collect(Collectors.toMap(ProductBeanDTO.ProductComboType::getProductId, ProductBeanDTO.ProductComboType::getQuantity, (k1,k2) -> k1+k2));
Map<String, Integer> cartGoodsMap = cartGoods.getProductComboList().stream() Map<String, Integer> cartGoodsMap = cartGoods.getProductComboList().stream()
.collect(Collectors.toMap(CartGoods.ComboxGoods::getSpuId, CartGoods.ComboxGoods::getQty, (k1, k2) -> k1+k2)); .collect(Collectors.toMap(
o -> (StringUtils.isBlank(o.getSpuId()) || "0".equals(o.getSpuId()))?o.getSkuId():o.getSpuId(),
CartGoods.ComboxGoods::getQty,
(k1, k2) -> k1+k2));
if(productMap.entrySet().stream().filter(o -> !o.getValue().equals(cartGoodsMap.get(o.getKey()))).findFirst().isPresent()) { if(productMap.entrySet().stream().filter(o -> !o.getValue().equals(cartGoodsMap.get(o.getKey()))).findFirst().isPresent()) {
throw new ServiceException(ResponseResult.SHOPPING_CART_VERSION_ERROR, "加购套餐子商品数量异常"); throw new ServiceException(ResponseResult.SHOPPING_CART_VERSION_ERROR, "加购套餐子商品数量异常");
......
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