Commit f6e7e5fb by 徐康

校验保存的券是否可用

parent 0f46f80e
......@@ -348,7 +348,7 @@ public class ShoppingCartMCoffeeServiceImpl {
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons = getCoupon(couponCode, null, cartGoodsList);
// 促销活动的优惠金额计算
calculationService.updateShoppingCartGoodsDiscount(partnerId, storeId, userId, appId, orderType, assortmentCustomerInfoVo.isMemberPaid(), menuType, receiveId, null,
ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult = calculationService.updateShoppingCartGoodsDiscount(partnerId, storeId, userId, appId, orderType, assortmentCustomerInfoVo.isMemberPaid(), menuType, receiveId, null,
cartGoodsList, coupons, new ArrayList<>(), shoppingCartGoodsResponseVo);
//设置更新响应信息
setAddAndUpdateResponse(shoppingCartGoodsResponseVo, cartGoodsList, shoppingCartGoodsResponseVo.getToastMsg(), ShoppingCartConstant.QUERY_INFO, shoppingCartInfoRequestVo);
......@@ -359,14 +359,16 @@ public class ShoppingCartMCoffeeServiceImpl {
if(StringUtils.isNotEmpty(couponCode) || StringUtils.isNotEmpty(freightCouponCode)) {
String finalCouponCode = couponCode;
String finalFreightCouponCode = freightCouponCode;
shoppingCartGoodsResponseVo.getAvailableCoupon().getUsableCoupons().stream().forEach(o -> {
if(o.getCouponCode().equals(finalCouponCode)) {
shoppingCartGoodsResponseVo.setCouponCode(finalCouponCode);
}
if(o.getCouponCode().equals(finalFreightCouponCode)) {
shoppingCartGoodsResponseVo.setFreightCouponCode(finalFreightCouponCode);
}
});
if(null != calculationDiscountResult && CollectionUtils.isNotEmpty(calculationDiscountResult.getDiscounts())) {
calculationDiscountResult.getDiscounts().stream().forEach(o -> {
if(o.getActivityCode().equals(finalCouponCode)) {
shoppingCartGoodsResponseVo.setCouponCode(finalCouponCode);
}
if(o.getActivityCode().equals(finalFreightCouponCode)) {
shoppingCartGoodsResponseVo.setFreightCouponCode(finalFreightCouponCode);
}
});
}
}
return ResponseUtil.success(shoppingCartGoodsResponseVo);
}
......
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