Commit 4d4a1e28 by ping.wu

促销会员价新增等级规则,返回用户等级

parent 0d90e86b
...@@ -360,6 +360,11 @@ public class ActivityCalculationDiscountResponseDto { ...@@ -360,6 +360,11 @@ public class ActivityCalculationDiscountResponseDto {
//活动覆盖商品数量,比如第二件实际优惠一件,但是两件商品都算活动叠加数量 //活动覆盖商品数量,比如第二件实际优惠一件,但是两件商品都算活动叠加数量
private Integer addOnQuantity = 0; private Integer addOnQuantity = 0;
/**
* 当前用户的会员等级(目前只有会员价活动使用)
*/
private String currentMembershipLevel;
} }
/** /**
......
...@@ -316,6 +316,11 @@ public class CartGoods { ...@@ -316,6 +316,11 @@ public class CartGoods {
private String taxId; private String taxId;
/** /**
* 当前用户的会员等级(目前只有会员价活动使用)
*/
private String currentMemberLevel;
/**
* 套餐固定商品 * 套餐固定商品
*/ */
private List<ComboxGoods> productComboList; private List<ComboxGoods> productComboList;
......
...@@ -78,12 +78,12 @@ public class MemberDiscountServiceImpl implements IPromotionService { ...@@ -78,12 +78,12 @@ public class MemberDiscountServiceImpl implements IPromotionService {
if (calculationDiscountResult == null || CollectionUtils.isEmpty(calculationDiscountResult.getDiscounts())) { if (calculationDiscountResult == null || CollectionUtils.isEmpty(calculationDiscountResult.getDiscounts())) {
return; return;
} }
Map<String, Long> result = new HashMap<>(); Map<String, ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount> result = new HashMap<>();
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods goods : calculationDiscountResult.getGoods()) { for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods goods : calculationDiscountResult.getGoods()) {
if (!CollectionUtils.isEmpty(goods.getDiscounts())) { if (!CollectionUtils.isEmpty(goods.getDiscounts())) {
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount goodsDiscount : goods.getDiscounts()) { for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount goodsDiscount : goods.getDiscounts()) {
if (ActivityTypeEnum.TYPE_27.getCode().equals(goodsDiscount.getType())) { 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 { ...@@ -95,11 +95,12 @@ public class MemberDiscountServiceImpl implements IPromotionService {
for (CartGoods cartGoods : cartGoodsList) { 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())) { && 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 { ...@@ -134,10 +134,17 @@ public class CalculationCommonService {
cartGoods.setCurrentCouponDiscount(0); cartGoods.setCurrentCouponDiscount(0);
cartGoods.setFinalPrice(find.getNowPrice()); cartGoods.setFinalPrice(find.getNowPrice());
if (CollectionUtils.isNotEmpty(find.getDiscounts())){ if (CollectionUtils.isNotEmpty(find.getDiscounts())){
ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount goodsDiscount = find.getDiscounts().stream() // ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount goodsDiscount = find.getDiscounts().stream()
.filter(p -> p.getActivityCode().equals(couponCode)).findFirst().orElse(null); // .filter(p -> p.getActivityCode().equals(couponCode)).findFirst().orElse(null);
if (goodsDiscount != null){ // if (goodsDiscount != null){
cartGoods.setCurrentCouponDiscount(goodsDiscount.getDiscount() == null ? 0 : goodsDiscount.getDiscount().intValue()); // }
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()); //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