Commit b5c54f71 by 徐康

Merge branch 'feature/xukang_20210609_麦咖啡p7v2' into qa

# Conflicts:
#	shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
parents c9db8dc8 c479dfa0
...@@ -51,7 +51,7 @@ public class BatchOperateCartGoodsRequestVo extends BaseRequestVo{ ...@@ -51,7 +51,7 @@ public class BatchOperateCartGoodsRequestVo extends BaseRequestVo{
/** /**
* 根据券号清除当前购物车中月卡及商品信息 * 根据券号清除当前购物车中月卡及商品信息
*/ */
private String redundancyB3S1CouponCode; private List<String> redundancyB3S1CouponCode;
/** /**
* 是否使用月享卡2.0 * 是否使用月享卡2.0
......
...@@ -544,15 +544,18 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -544,15 +544,18 @@ public class ShoppingCartMCoffeeServiceImpl {
clearCouponCodeRequestVo.setIsUseMonthCard(requestVo.getIsUseMonthCard()); clearCouponCodeRequestVo.setIsUseMonthCard(requestVo.getIsUseMonthCard());
baseResponse = clearCouponInfoByCode(clearCouponCodeRequestVo); baseResponse = clearCouponInfoByCode(clearCouponCodeRequestVo);
} }
if (StringUtils.isNotEmpty(requestVo.getRedundancyB3S1CouponCode())){ if (CollectionUtils.isNotEmpty(requestVo.getRedundancyB3S1CouponCode())){
MCoffeeAddGoodsRequestVo clearCouponCodeRequestVo = new MCoffeeAddGoodsRequestVo(); MCoffeeAddGoodsRequestVo clearCouponCodeRequestVo = new MCoffeeAddGoodsRequestVo();
clearCouponCodeRequestVo.setCouponCode(requestVo.getRedundancyB3S1CouponCode()); clearCouponCodeRequestVo.setCouponCodeList(requestVo.getRedundancyB3S1CouponCode());
clearCouponCodeRequestVo.setSessionId(requestVo.getSessionId()); clearCouponCodeRequestVo.setSessionId(requestVo.getSessionId());
clearCouponCodeRequestVo.setPartnerId(requestVo.getPartnerId()); clearCouponCodeRequestVo.setPartnerId(requestVo.getPartnerId());
clearCouponCodeRequestVo.setShopId(requestVo.getShopId()); clearCouponCodeRequestVo.setShopId(requestVo.getShopId());
clearCouponCodeRequestVo.setOrderType(requestVo.getOrderType()); clearCouponCodeRequestVo.setOrderType(requestVo.getOrderType());
clearCouponCodeRequestVo.setChannelType(requestVo.getChannelType()); clearCouponCodeRequestVo.setChannelType(requestVo.getChannelType());
baseResponse = removeB3S1Coupon(clearCouponCodeRequestVo); baseResponse = removeB3S1Coupon(clearCouponCodeRequestVo);
if (!Objects.equals(ResponseResult.SUCCESS.getCode(), baseResponse.getCode())) {
return baseResponse;
}
} }
if (CollectionUtils.isNotEmpty(requestVo.getQtyInfoList())) { if (CollectionUtils.isNotEmpty(requestVo.getQtyInfoList())) {
...@@ -635,7 +638,7 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -635,7 +638,7 @@ public class ShoppingCartMCoffeeServiceImpl {
throw new ServiceException(ResponseResult.SHOPPING_CART_SHOP_ID_NOT_EMPTY); throw new ServiceException(ResponseResult.SHOPPING_CART_SHOP_ID_NOT_EMPTY);
} }
if (StringUtils.isEmpty(addShoppingCartGoodsRequestVo.getCouponCode())){ if (CollectionUtils.isEmpty(addShoppingCartGoodsRequestVo.getCouponCodeList())){
return ResponseUtil.error(ResponseResult.SHOPPING_CART_UPDATE_ERROR, "买3赠1券号不能为空"); return ResponseUtil.error(ResponseResult.SHOPPING_CART_UPDATE_ERROR, "买3赠1券号不能为空");
} }
...@@ -656,7 +659,6 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -656,7 +659,6 @@ public class ShoppingCartMCoffeeServiceImpl {
Integer orderType = addShoppingCartGoodsRequestVo.getOrderType(); Integer orderType = addShoppingCartGoodsRequestVo.getOrderType();
String receiveId = addShoppingCartGoodsRequestVo.getReceiveId(); String receiveId = addShoppingCartGoodsRequestVo.getReceiveId();
Integer operationType = addShoppingCartGoodsRequestVo.getOperationType(); Integer operationType = addShoppingCartGoodsRequestVo.getOperationType();
String couponCode = addShoppingCartGoodsRequestVo.getCouponCode();
// 查询购物车缓存 // 查询购物车缓存
List<CartGoods> cartGoodsList = assortmentSdkService.getShoppingCart(partnerId, storeId, userId, null, null, shoppingCartBaseService); List<CartGoods> cartGoodsList = assortmentSdkService.getShoppingCart(partnerId, storeId, userId, null, null, shoppingCartBaseService);
...@@ -664,14 +666,13 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -664,14 +666,13 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoodsList = new ArrayList<>(); cartGoodsList = new ArrayList<>();
} }
cartGoodsList = clearB3S1CouponInfo(cartGoodsList, couponCode); cartGoodsList = clearB3S1CouponInfo(cartGoodsList, addShoppingCartGoodsRequestVo.getCouponCodeList());
Optional<CartGoods> cartGoods9998 = cartGoodsList.stream().filter(o -> "9998".equals(skuId) && o.getIsB3S1Coupon() == 1).findFirst(); Optional<CartGoods> cartGoods9998 = cartGoodsList.stream().filter(o -> "9998".equals(skuId) && o.getIsB3S1Coupon() == 1).findFirst();
if(cartGoods9998.isPresent()) { if(cartGoods9998.isPresent()) {
cartGoods9998.get().getB3S1CouponGoodsInfo().getCardCodeSet().remove(couponCode); cartGoods9998.get().getB3S1CouponGoodsInfo().getCardCodeSet().removeAll(addShoppingCartGoodsRequestVo.getCouponCodeList());
} }
CartGoods monthCardProduct = null; CartGoods monthCardProduct = null;
CartGoods B3S1CouponProduct = null;
// 如果购物车商品不为空, 则check购物车中所有商品 // 如果购物车商品不为空, 则check购物车中所有商品
if (CollectionUtils.isNotEmpty(cartGoodsList)) { if (CollectionUtils.isNotEmpty(cartGoodsList)) {
// check购物车中所有商品 // check购物车中所有商品
...@@ -681,19 +682,12 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -681,19 +682,12 @@ public class ShoppingCartMCoffeeServiceImpl {
monthCardProduct = goods; monthCardProduct = goods;
continue; continue;
} }
if (StringUtils.equals(goods.getSkuId(),"9998")){
B3S1CouponProduct = goods;
continue;
}
temList.add(goods); temList.add(goods);
} }
cartGoodsList = checkCartGoods(partnerId, storeId, orderType, menuType, shoppingCartGoodsResponseVo, temList, sessionId); cartGoodsList = checkCartGoods(partnerId, storeId, orderType, menuType, shoppingCartGoodsResponseVo, temList, sessionId);
if (null != monthCardProduct) { if (null != monthCardProduct) {
cartGoodsList.add(monthCardProduct); cartGoodsList.add(monthCardProduct);
} }
if (null != B3S1CouponProduct) {
cartGoodsList.add(B3S1CouponProduct);
}
if (CollectionUtils.isNotEmpty(cartGoodsList)) { if (CollectionUtils.isNotEmpty(cartGoodsList)) {
int size = cartGoodsList.size(); int size = cartGoodsList.size();
...@@ -741,7 +735,7 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -741,7 +735,7 @@ public class ShoppingCartMCoffeeServiceImpl {
// 当couponCode不为空时,需参与价格计算 // 当couponCode不为空时,需参与价格计算
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons = getCoupon(productCouponCode, null, cartGoodsList,freightCouponCode,null); List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons = getCoupon(productCouponCode, null, cartGoodsList,freightCouponCode,null);
// 促销活动的优惠金额计算 // 促销活动的优惠金额计算
calculationService.updateShoppingCartGoodsDiscount(partnerId, storeId, userId, appId, orderType, assortmentCustomerInfoVo.isMemberPaid(), menuType, receiveId, couponCode, calculationService.updateShoppingCartGoodsDiscount(partnerId, storeId, userId, appId, orderType, assortmentCustomerInfoVo.isMemberPaid(), menuType, receiveId, addShoppingCartGoodsRequestVo.getCouponCode(),
cartGoodsList, coupons, new ArrayList<>(), shoppingCartGoodsResponseVo,null, null); cartGoodsList, coupons, new ArrayList<>(), shoppingCartGoodsResponseVo,null, null);
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, null, tableNumber, this.shoppingCartBaseService); assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, null, tableNumber, this.shoppingCartBaseService);
...@@ -2704,4 +2698,12 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -2704,4 +2698,12 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoodsList.removeIf(o -> couponCode.equals(o.getCouponCode())); cartGoodsList.removeIf(o -> couponCode.equals(o.getCouponCode()));
return cartGoodsList; return cartGoodsList;
} }
/**
* 清除购物车商品使用买3赠1券信息
* @param couponCodeList
*/
private List<CartGoods> clearB3S1CouponInfo(List<CartGoods> cartGoodsList,List<String> couponCodeList){
cartGoodsList.removeIf(o -> couponCodeList.contains(o.getCouponCode()));
return cartGoodsList;
}
} }
...@@ -134,6 +134,10 @@ public class MCoffeeAddGoodsRequestVo { ...@@ -134,6 +134,10 @@ public class MCoffeeAddGoodsRequestVo {
* 优惠券号 * 优惠券号
*/ */
private String couponCode; private String couponCode;
/**
* 优惠券号
*/
private List<String> couponCodeList;
/** /**
* 套餐名称 * 套餐名称
......
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