Commit 1da9d9d8 by 周晓航

Merge branch 'feature/20210609-v2.0.34-购物车支持配送券ID1030707-周晓航' into qa

parents 0ec08f17 b4bc2d76
......@@ -21,4 +21,5 @@ public class ApplicationConstant {
public final static String DELIVERY_DISCOUNT_DESC1="订单满%s元减%s元配送费";
public final static String DELIVERY_DISCOUNT_DESC2="订单满%s元免配送费";
public final static String DELIVERY_DISCOUNT_DESC3="另需配送费%s元";
public final static String DELIVERY_DISCOUNT_DESC4=" 选择了配送券";
}
......@@ -1705,11 +1705,11 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if (couponPromotionVO !=null) {
couponPromotionVO.setDeliveryAmount(deliveryAmount);
}
//默认计算优惠
//默认计算优惠 设置包装费 原价 现价 优惠金额
DefaultPromotionService defaultPromotionService = (DefaultPromotionService) PromotionFactory.getPromotionService(ShoppingCartPromotionEnum.DEFAULT_PROMOTION);
defaultPromotionService.updateShoppingCartGoodsDiscount(couponPromotionVO, activityQueryDto, calculationDiscountResult, cartGoodsList, shoppingCartGoodsResponseVo, userLoginInfoDto, shoppingCartInfoRequestVo);
// 优惠券
// 优惠券 这里设置了优惠券的优惠金额 setCouponDiscount(couponDiscount);
CouponPromotionService couponPromotionService = (CouponPromotionService) PromotionFactory.getPromotionService(ShoppingCartPromotionEnum.COUPON_DISCOUNT);
couponPromotionService.updateShoppingCartGoodsDiscount(couponPromotionVO, activityQueryDto, calculationDiscountResult, cartGoodsList, shoppingCartGoodsResponseVo, userLoginInfoDto, shoppingCartInfoRequestVo);
......@@ -1781,7 +1781,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
memberDiscountService.updateShoppingCartGoodsDiscount(couponPromotionVO, activityQueryDto, calculationDiscountResult, cartGoodsList, shoppingCartGoodsResponseVo, userLoginInfoDto, shoppingCartInfoRequestVo);
/**
* 满额减配送费
* 满额减配送费 优选活动 再配送券
*/
if(BusinessTypeEnum.SAAS_DELIVERY.getCode().equals(menuType)) {
DecimalFormat df = new DecimalFormat("###.##");
......@@ -1815,10 +1815,17 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
String desc = DELIVERY_DISCOUNT_DESC1;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, df.format(beanDto.getThresholdAmount().doubleValue() /100) ,df.format(beanDto.getDiscountAmount().doubleValue() / 100)));
}
boolean isType34 = verifyActivity(calculationDiscountResult);
if (isType34) {
String desc = shoppingCartGoodsResponseVo.getDeliveryDiscountDesc();
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(desc+ ","+ DELIVERY_DISCOUNT_DESC4);
}
shoppingCartGoodsResponseVo.setDeliveryAmount(calculationDiscountResult.getDeliveryAmount());
shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult.getDistributionFee());
shoppingCartGoodsResponseVo.setThresholdAmount(discount.getThresholdAmount());
shoppingCartGoodsResponseVo.setIsDiscountDelivery(true);
// fisherman 促销优惠先 剩余的 配送费 怎么处理的? 需要沟通问一下
}else{
if (activityResponse!=null) {
......@@ -1833,11 +1840,18 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
shoppingCartGoodsResponseVo.setDeliveryAmount(deliveryAmount);
shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(deliveryAmount);
// 增加配送券之后的逻辑
// shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult==null?deliveryAmount:calculationDiscountResult.getDistributionFee());
shoppingCartGoodsResponseVo.setIsDiscountDelivery(false);
// fisherman 有活动 并且使用了优惠券
boolean isType34 = verifyActivity(calculationDiscountResult);
if (isType34) {
// 使用了优惠券
shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult.getDistributionFee());
String deliveryDiscountDesc = shoppingCartGoodsResponseVo.getDeliveryDiscountDesc();
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(deliveryDiscountDesc+ ","+ DELIVERY_DISCOUNT_DESC4);
}
} else {
// 这里需要看看 选择了 配送券 calculationDiscountResult.getDistributionFee() 这个值是多少
String desc = DELIVERY_DISCOUNT_DESC3;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, df.format(deliveryAmount.doubleValue() / 100)));
shoppingCartGoodsResponseVo.setDeliveryAmount(deliveryAmount);
......@@ -1845,6 +1859,14 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 增加配送券之后的逻辑
// shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult==null?deliveryAmount:calculationDiscountResult.getDistributionFee());
shoppingCartGoodsResponseVo.setIsDiscountDelivery(false);
// fisherman 确认是否 使用了优惠券
boolean isType34 = verifyActivity(calculationDiscountResult);
if (isType34) {
// 使用了优惠券
shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult.getDistributionFee());
String deliveryDiscountDesc = shoppingCartGoodsResponseVo.getDeliveryDiscountDesc();
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(deliveryDiscountDesc+ ","+ DELIVERY_DISCOUNT_DESC4);
}
}
}
LogUtil.info("fisherman 满额减配送算价格",discount,shoppingCartGoodsResponseVo);
......@@ -1860,6 +1882,20 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
/**
* 检验是否使用的 配送券
* @param calculationDiscountResult
* @return
*/
private boolean verifyActivity(ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult) {
if (calculationDiscountResult!=null && CollectionUtils.isNotEmpty(calculationDiscountResult.getCouponDiscounts())) {
ActivityCalculationDiscountResponseDto.CalculationDiscountResult.CouponResults type34 = calculationDiscountResult.getCouponDiscounts().stream().filter(couponResults -> couponResults.getActivityType() != null &&
couponResults.getActivityType().compareTo(ActivityTypeEnum.TYPE_34.getCode()) == 0).findFirst().orElse(null);
return type34 != null;
}
return false;
}
/**
* 促销均摊计算
*
* @param 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