Commit 052cf548 by yu.sun

sunyu::update::fix bug about iteator

parent 3ad93836
...@@ -359,18 +359,18 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -359,18 +359,18 @@ public class ShoppingCartMCoffeeServiceImpl {
for (CartGoods goods : cartGoodsList) { for (CartGoods goods : cartGoodsList) {
if (Objects.equals(1,goods.getIsMonthCard()) if (Objects.equals(1,goods.getIsMonthCard())
&& goods.getCartGoodsUid().equals(updateShoppingCartGoodsQtyRequestVo.getCartGoodsUid())){ && goods.getCartGoodsUid().equals(updateShoppingCartGoodsQtyRequestVo.getCartGoodsUid())){
if (updateShoppingCartGoodsQtyRequestVo.getQty() == 0 && cartGoodsList.size()>1){ if (updateShoppingCartGoodsQtyRequestVo.getQty() == 0){
Iterator<CartGoods> cartGoodsIterator = cartGoodsList.iterator(); Iterator<CartGoods> cartGoodsIterator = cartGoodsList.iterator();
while (cartGoodsIterator.hasNext()){ while (cartGoodsIterator.hasNext()){
String couponCode = null != cartGoodsIterator.next() ? String couponCode = null != cartGoodsIterator.next() ?
cartGoodsIterator.next().getCouponCode() : ""; cartGoodsIterator.next().getCouponCode() : "";
if (StringUtils.isNotEmpty(couponCode) && couponCode.equals(goods.getMonthCardInfo().getCardCode())){ if (cartGoodsList.size()>1 && StringUtils.isNotEmpty(couponCode) && couponCode.equals(goods.getMonthCardInfo().getCardCode())){
cartGoodsIterator.remove(); cartGoodsIterator.remove();
break; break;
}else{
cartGoodsList = new ArrayList<>();
} }
} }
}else{
cartGoodsList = new ArrayList<>();
} }
if (updateShoppingCartGoodsQtyRequestVo.getQty()>10) { if (updateShoppingCartGoodsQtyRequestVo.getQty()>10) {
throw new ServiceException(ResponseResult.SHOPPING_CART_QTY_LIMIT_ERR); throw new ServiceException(ResponseResult.SHOPPING_CART_QTY_LIMIT_ERR);
......
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