Commit 27752ba3 by 查志伟

Merge branch 'feature/20210913_促销会员价三期_wuping'

parents e9dd488f 4d4a1e28
......@@ -360,6 +360,11 @@ public class ActivityCalculationDiscountResponseDto {
//活动覆盖商品数量,比如第二件实际优惠一件,但是两件商品都算活动叠加数量
private Integer addOnQuantity = 0;
/**
* 当前用户的会员等级(目前只有会员价活动使用)
*/
private String currentMembershipLevel;
}
/**
......
......@@ -316,6 +316,11 @@ public class CartGoods {
private String taxId;
/**
* 当前用户的会员等级(目前只有会员价活动使用)
*/
private String currentMemberLevel;
/**
* 套餐固定商品
*/
private List<ComboxGoods> productComboList;
......
......@@ -78,12 +78,12 @@ public class MemberDiscountServiceImpl implements IPromotionService {
if (calculationDiscountResult == null || CollectionUtils.isEmpty(calculationDiscountResult.getDiscounts())) {
return;
}
Map<String, Long> result = new HashMap<>();
Map<String, ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount> result = new HashMap<>();
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods goods : calculationDiscountResult.getGoods()) {
if (!CollectionUtils.isEmpty(goods.getDiscounts())) {
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount goodsDiscount : goods.getDiscounts()) {
if (ActivityTypeEnum.TYPE_27.getCode().equals(goodsDiscount.getType())) {
result.putIfAbsent(goods.getCartGoodsUid(), goodsDiscount.getDiscount());
result.putIfAbsent(goods.getCartGoodsUid(), goodsDiscount);
}
}
}
......@@ -95,11 +95,12 @@ public class MemberDiscountServiceImpl implements IPromotionService {
for (CartGoods cartGoods : cartGoodsList) {
//优惠总价
Long discountPrice = result.get(cartGoods.getCartGoodsUid());
ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount goodsDiscount = result.get(cartGoods.getCartGoodsUid());
//老促销计算价格接口套餐价购物车内部计算价格,已在套餐实现类计算好价格,这里无需再扣减
if (discountPrice != null && discountPrice > 0 && CollectionUtils.isEmpty(cartGoods.getProductComboList())
if (goodsDiscount != null && goodsDiscount.getDiscount() > 0 && CollectionUtils.isEmpty(cartGoods.getProductComboList())
&& CollectionUtils.isEmpty(cartGoods.getProductGroupList())) {
cartGoods.setAmount(cartGoods.getAmount() - discountPrice);
cartGoods.setAmount(cartGoods.getAmount() - goodsDiscount.getDiscount());
cartGoods.setCurrentMemberLevel(goodsDiscount.getCurrentMembershipLevel());
}
}
}
......
......@@ -134,10 +134,17 @@ public class CalculationCommonService {
cartGoods.setCurrentCouponDiscount(0);
cartGoods.setFinalPrice(find.getNowPrice());
if (CollectionUtils.isNotEmpty(find.getDiscounts())){
ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount goodsDiscount = find.getDiscounts().stream()
.filter(p -> p.getActivityCode().equals(couponCode)).findFirst().orElse(null);
if (goodsDiscount != null){
cartGoods.setCurrentCouponDiscount(goodsDiscount.getDiscount() == null ? 0 : goodsDiscount.getDiscount().intValue());
// ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount goodsDiscount = find.getDiscounts().stream()
// .filter(p -> p.getActivityCode().equals(couponCode)).findFirst().orElse(null);
// if (goodsDiscount != null){
// }
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount goodsDiscount : find.getDiscounts()){
if(goodsDiscount.getActivityCode().equals(couponCode)){
cartGoods.setCurrentCouponDiscount(goodsDiscount.getDiscount() == null ? 0 : goodsDiscount.getDiscount().intValue());
}
if(StringUtils.isNotEmpty(goodsDiscount.getCurrentMembershipLevel())){
cartGoods.setCurrentMemberLevel(goodsDiscount.getCurrentMembershipLevel());
}
}
}
//cartGoods.setOriginalAmount(find.getOriginalPrice());
......
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