Commit 46215986 by 孙昱

sunyu::update::月享卡2.0清除券信息逻辑

parent 3251655e
...@@ -473,25 +473,10 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -473,25 +473,10 @@ public class ShoppingCartMCoffeeServiceImpl {
String skuId = ""; String skuId = "";
Integer finalQty = qty; Integer finalQty = qty;
for (CartGoods cartGoods_ : cartGoodsList) { for (CartGoods cartGoods_ : cartGoodsList) {
//如果菜单购月卡数量大于10,则不作数量修改,直接算价并返回之前购物车信息
if (Objects.equals(1,cartGoods_.getIsMonthCard())
&& cartGoods_.getCartGoodsUid().equals(updateShoppingCartGoodsQtyRequestVo.getCartGoodsUid())
&& updateShoppingCartGoodsQtyRequestVo.getQty()>10) {
shoppingCartGoodsResponseVo.setChanged(true);
shoppingCartGoodsResponseVo.setToastMsg(ResponseResult.SHOPPING_CART_QTY_LIMIT_ERR.getMessage());
setAddAndUpdateResponse(shoppingCartGoodsResponseVo,cartGoodsList,
ResponseResult.SHOPPING_CART_QTY_LIMIT_ERR.getMessage(),
ShoppingCartConstant.ADD_AND_UPDATE,null);
String freightCouponCode = assortmentSdkService.getShoppingCartCoupon(partnerId, storeId, userId, shoppingCartBaseService, SaveCouponType.FREIGHT_COUPON.getCode());
String couponCode = assortmentSdkService.getShoppingCartCoupon(partnerId, storeId, userId, shoppingCartBaseService, SaveCouponType.COUPON.getCode());
// 当couponCode不为空时,需参与价格计算
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons = getCoupon(couponCode, null, cartGoodsList,freightCouponCode,null);
// 促销活动的优惠金额计算
calculationService.updateShoppingCartGoodsDiscount(partnerId, storeId, userId, appId, orderType, assortmentCustomerInfoVo.isMemberPaid(), menuType, receiveId, couponCode,
cartGoodsList, coupons, new ArrayList<>(), shoppingCartGoodsResponseVo,null);
return ResponseUtil.success(shoppingCartGoodsResponseVo);
}
if (cartGoodsUid.equals(cartGoods_.getCartGoodsUid())) { if (cartGoodsUid.equals(cartGoods_.getCartGoodsUid())) {
if (StringUtils.equals(cartGoods_.getSkuId(),"9999") && StringUtils.equals(cartGoods_.getSpuId(),"9999") && qty == 0){
clearMonthCouponInfo(cartGoodsList,cartGoods_.getCouponCode());
}
cartGoods = cartGoods_; cartGoods = cartGoods_;
cartGoods_.setQty(qty); cartGoods_.setQty(qty);
skuId = cartGoods_.getSkuId(); skuId = cartGoods_.getSkuId();
...@@ -2280,27 +2265,24 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -2280,27 +2265,24 @@ public class ShoppingCartMCoffeeServiceImpl {
if (CollectionUtils.isEmpty(oldCartGoodsList)) { if (CollectionUtils.isEmpty(oldCartGoodsList)) {
throw new ServiceException(ResponseResult.SHOPPING_CART_SEED_COUPON_VALID); throw new ServiceException(ResponseResult.SHOPPING_CART_SEED_COUPON_VALID);
} }
// int seedCouponCount = 0;
// int seedCouponGoodsCount = 0;
for (CartGoods cartGoods : oldCartGoodsList) { for (CartGoods cartGoods : oldCartGoodsList) {
//1.种子券商品券信息与月卡信息一致 //1.种子券商品券信息与月卡信息一致
if (null != cartGoods.getMonthCardInfo() && !addShoppingCartGoodsRequestVo.getCouponCode().equals(cartGoods.getMonthCardInfo().getCardCode())){ if (null != cartGoods.getMonthCardInfo() && !addShoppingCartGoodsRequestVo.getCouponCode().equals(cartGoods.getMonthCardInfo().getCardCode())) {
throw new ServiceException(ResponseResult.SHOPPING_CART_COUPON_NOT_EXIST); throw new ServiceException(ResponseResult.SHOPPING_CART_COUPON_NOT_EXIST);
} }
//@Date 2021-03-15 月享卡2.0需求不再校验月享卡商品购买次数限制
// if (cartGoods.getIsMonthCard()>0){
// seedCouponCount = seedCouponCount + cartGoods.getQty();
// }
// if (cartGoods.getIsSeedCouponGoods()>0 && cartGoods.getIsMonthCard()<1){
// seedCouponGoodsCount = seedCouponGoodsCount + cartGoods.getQty();
// }
} }
}
//2.种子券商品数量不可大于种子券数量 /**
// if ((seedCouponGoodsCount+addShoppingCartGoodsRequestVo.getQty()) > seedCouponCount){ * 清除购物车商品使用月卡信息
// throw new ServiceException(ResponseResult.SHOPPING_CART_SEED_COUPON_VALID); * @param cartGoods
// } * @param couponCode
*/
private void clearMonthCouponInfo(List<CartGoods> cartGoods,String couponCode){
for (CartGoods cartGood : cartGoods) {
if (StringUtils.equals(cartGood.getCouponCode(),couponCode)){
cartGood.setCouponCode("");
}
}
} }
} }
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