Commit 42fe76fb by yu.sun

sunyu::update::fix bug about iteator

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