Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop
# Conflicts: # framework/src/main/java/cn/lili/modules/order/cart/render/impl/SkuPromotionRender.java
This commit is contained in:
commit
7634801f7c
@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -122,4 +123,11 @@ public class CartSkuVO extends CartBase implements Serializable {
|
||||
this.promotionMap = promotionMap;
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, Object> getPromotionMap() {
|
||||
if (this.promotionMap == null) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
return promotionMap;
|
||||
}
|
||||
}
|
||||
|
@ -114,6 +114,7 @@ public class CheckDataRender implements CartRenderStep {
|
||||
cartSkuVO.setErrorMessage("商品库存不足,现有库存数量[" + dataSku.getQuantity() + "]");
|
||||
}
|
||||
//移除无效促销活动
|
||||
if (cartSkuVO.getPromotionMap() != null && !cartSkuVO.getPromotionMap().isEmpty()) {
|
||||
cartSkuVO.setPromotionMap(cartSkuVO.getPromotionMap().entrySet().stream().filter(i -> {
|
||||
BasePromotions basePromotions = (BasePromotions) i.getValue();
|
||||
if (basePromotions.getStartTime() != null && basePromotions.getEndTime() != null) {
|
||||
@ -123,6 +124,7 @@ public class CheckDataRender implements CartRenderStep {
|
||||
}).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺分组
|
||||
@ -170,6 +172,7 @@ public class CheckDataRender implements CartRenderStep {
|
||||
}
|
||||
}
|
||||
//判断拼团商品的限购数量
|
||||
if (tradeDTO.getSkuList().get(0).getPromotionMap() != null && !tradeDTO.getSkuList().get(0).getPromotionMap().isEmpty()) {
|
||||
Optional<Map.Entry<String, Object>> pintuanPromotions = tradeDTO.getSkuList().get(0).getPromotionMap().entrySet().stream().filter(i -> i.getKey().contains(PromotionTypeEnum.PINTUAN.name())).findFirst();
|
||||
if (pintuanPromotions.isPresent()) {
|
||||
Pintuan pintuan = (Pintuan) pintuanPromotions.get().getValue();
|
||||
@ -180,8 +183,9 @@ public class CheckDataRender implements CartRenderStep {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//积分商品,判断用户积分是否满足
|
||||
} else if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.POINTS)) {
|
||||
} else if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.POINTS) && tradeDTO.getSkuList().get(0).getPromotionMap() != null && !tradeDTO.getSkuList().get(0).getPromotionMap().isEmpty()) {
|
||||
//获取积分商品VO
|
||||
Optional<Map.Entry<String, Object>> pointsPromotions = tradeDTO.getSkuList().get(0).getPromotionMap().entrySet().stream().filter(i -> i.getKey().contains(PromotionTypeEnum.POINTS_GOODS.name())).findFirst();
|
||||
if (pointsPromotions.isPresent()) {
|
||||
|
@ -69,7 +69,7 @@ public class CommissionRender implements CartRenderStep {
|
||||
}
|
||||
|
||||
//如果积分订单 积分订单,单独操作订单结算金额和商家结算字段
|
||||
if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.POINTS)) {
|
||||
if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.POINTS) && tradeDTO.getSkuList().get(0).getPromotionMap() != null && !tradeDTO.getSkuList().get(0).getPromotionMap().isEmpty()) {
|
||||
Optional<Map.Entry<String, Object>> pointsPromotions = tradeDTO.getSkuList().get(0).getPromotionMap().entrySet().stream().filter(i -> i.getKey().contains(PromotionTypeEnum.POINTS_GOODS.name())).findFirst();
|
||||
if (pointsPromotions.isPresent()) {
|
||||
PointsGoods pointsGoods = (PointsGoods) pointsPromotions.get().getValue();
|
||||
@ -77,7 +77,7 @@ public class CommissionRender implements CartRenderStep {
|
||||
}
|
||||
}
|
||||
//如果砍价订单 计算金额,单独操作订单结算金额和商家结算字段
|
||||
else if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.KANJIA)) {
|
||||
else if (tradeDTO.getCartTypeEnum().equals(CartTypeEnum.KANJIA) && tradeDTO.getSkuList().get(0).getPromotionMap() != null && !tradeDTO.getSkuList().get(0).getPromotionMap().isEmpty()) {
|
||||
Optional<Map.Entry<String, Object>> kanjiaPromotions = tradeDTO.getSkuList().get(0).getPromotionMap().entrySet().stream().filter(i -> i.getKey().contains(PromotionTypeEnum.KANJIA.name())).findFirst();
|
||||
if (kanjiaPromotions.isPresent()) {
|
||||
KanjiaActivityGoods kanjiaActivityGoods = (KanjiaActivityGoods) kanjiaPromotions.get().getValue();
|
||||
|
@ -48,7 +48,7 @@ public class FullDiscountRender implements CartRenderStep {
|
||||
//循环店铺购物车
|
||||
for (CartVO cart : cartList) {
|
||||
List<CartSkuVO> fullDiscountSkuList = cart.getSkuList().stream()
|
||||
.filter(i -> i.getPromotionMap().keySet().stream().anyMatch(j -> j.contains(PromotionTypeEnum.FULL_DISCOUNT.name())))
|
||||
.filter(i -> i.getPromotionMap() != null && !i.getPromotionMap().isEmpty() && i.getPromotionMap().keySet().stream().anyMatch(j -> j.contains(PromotionTypeEnum.FULL_DISCOUNT.name())))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!fullDiscountSkuList.isEmpty()) {
|
||||
|
@ -367,7 +367,7 @@ public class CartServiceImpl implements CartService {
|
||||
|
||||
List<EsGoodsIndex> esGoodsList = esGoodsSearchService.getEsGoodsBySkuIds(ids);
|
||||
for (EsGoodsIndex esGoodsIndex : esGoodsList) {
|
||||
if (esGoodsIndex != null && esGoodsIndex.getPromotionMap() != null) {
|
||||
if (esGoodsIndex != null && esGoodsIndex.getPromotionMap() != null && !esGoodsIndex.getPromotionMap().isEmpty()) {
|
||||
List<String> couponIds = esGoodsIndex.getPromotionMap().keySet().stream().filter(i -> i.contains(PromotionTypeEnum.COUPON.name())).map(i -> i.substring(i.lastIndexOf("-") + 1)).collect(Collectors.toList());
|
||||
if (!couponIds.isEmpty()) {
|
||||
List<MemberCoupon> currentGoodsCanUse = memberCouponService.getCurrentGoodsCanUse(tradeDTO.getMemberId(), couponIds, totalPrice);
|
||||
@ -614,6 +614,7 @@ public class CartServiceImpl implements CartService {
|
||||
continue;
|
||||
}
|
||||
//有促销金额则用促销金额,否则用商品原价
|
||||
if (cartSkuVO.getPromotionMap() != null && !cartSkuVO.getPromotionMap().isEmpty()) {
|
||||
if (cartSkuVO.getPromotionMap().keySet().stream().anyMatch(i -> i.contains(PromotionTypeEnum.PINTUAN.name()) || i.contains(PromotionTypeEnum.SECKILL.name()))) {
|
||||
cartPrice = CurrencyUtil.add(cartPrice, CurrencyUtil.mul(cartSkuVO.getPurchasePrice(), cartSkuVO.getNum()));
|
||||
skuPrice.put(cartSkuVO.getGoodsSku().getId(), CurrencyUtil.mul(cartSkuVO.getPurchasePrice(), cartSkuVO.getNum()));
|
||||
@ -622,6 +623,7 @@ public class CartServiceImpl implements CartService {
|
||||
skuPrice.put(cartSkuVO.getGoodsSku().getId(), CurrencyUtil.mul(cartSkuVO.getGoodsSku().getPrice(), cartSkuVO.getNum()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//如果购物车金额大于消费门槛则使用
|
||||
@ -702,6 +704,7 @@ public class CartServiceImpl implements CartService {
|
||||
private void checkPintuan(CartSkuVO cartSkuVO) {
|
||||
//拼团活动,需要对限购数量进行判定
|
||||
//获取拼团信息
|
||||
if (cartSkuVO.getPromotionMap() != null && !cartSkuVO.getPromotionMap().isEmpty()) {
|
||||
Optional<Map.Entry<String, Object>> pintuanPromotions = cartSkuVO.getPromotionMap().entrySet().stream().filter(i -> i.getKey().contains(PromotionTypeEnum.PINTUAN.name())).findFirst();
|
||||
if (pintuanPromotions.isPresent()) {
|
||||
Pintuan pintuan = (Pintuan) pintuanPromotions.get().getValue();
|
||||
@ -714,6 +717,7 @@ public class CartServiceImpl implements CartService {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验砍价信息
|
||||
@ -721,7 +725,7 @@ public class CartServiceImpl implements CartService {
|
||||
* @param cartSkuVO 购物车信息
|
||||
*/
|
||||
private void checkKanjia(CartSkuVO cartSkuVO) {
|
||||
|
||||
if (cartSkuVO.getPromotionMap() != null && !cartSkuVO.getPromotionMap().isEmpty()) {
|
||||
Optional<Map.Entry<String, Object>> kanjiaPromotions = cartSkuVO.getPromotionMap().entrySet().stream().filter(i -> i.getKey().contains(PromotionTypeEnum.KANJIA.name())).findFirst();
|
||||
if (kanjiaPromotions.isPresent()) {
|
||||
KanjiaActivityGoods kanjiaActivityGoods = (KanjiaActivityGoods) kanjiaPromotions.get().getValue();
|
||||
@ -746,8 +750,7 @@ public class CartServiceImpl implements CartService {
|
||||
cartSkuVO.setKanjiaId(kanjiaActivity.getId());
|
||||
cartSkuVO.setNum(1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -272,7 +272,7 @@ public class Order extends BaseEntity {
|
||||
this.setOrderPromotionType(tradeDTO.getCartTypeEnum().name());
|
||||
|
||||
//判断是否为拼团订单,如果为拼团订单获取拼团ID,判断是否为主订单
|
||||
if (tradeDTO.getCartTypeEnum().name().equals(PromotionTypeEnum.PINTUAN.name())) {
|
||||
if (tradeDTO.getCartTypeEnum().name().equals(PromotionTypeEnum.PINTUAN.name()) && cartVO.getCheckedSkuList().get(0).getPromotionMap() != null && !cartVO.getCheckedSkuList().get(0).getPromotionMap().isEmpty()) {
|
||||
Optional<String> pintuanPromotions = cartVO.getCheckedSkuList().get(0).getPromotionMap().keySet().stream().filter(i -> i.contains(PromotionTypeEnum.PINTUAN.name())).findFirst();
|
||||
pintuanPromotions.ifPresent(s -> promotionId = s.split("-")[1]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user