修复结算时促销为空的问题
This commit is contained in:
parent
3fb4e488bb
commit
787617f504
@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -122,4 +123,11 @@ public class CartSkuVO extends CartBase implements Serializable {
|
|||||||
this.promotionMap = promotionMap;
|
this.promotionMap = promotionMap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> getPromotionMap() {
|
||||||
|
if (this.promotionMap == null) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
return promotionMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,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();
|
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()) {
|
if (pintuanPromotions.isPresent()) {
|
||||||
Pintuan pintuan = (Pintuan) pintuanPromotions.get().getValue();
|
Pintuan pintuan = (Pintuan) pintuanPromotions.get().getValue();
|
||||||
@ -182,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
|
//获取积分商品VO
|
||||||
Optional<Map.Entry<String, Object>> pointsPromotions = tradeDTO.getSkuList().get(0).getPromotionMap().entrySet().stream().filter(i -> i.getKey().contains(PromotionTypeEnum.POINTS_GOODS.name())).findFirst();
|
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()) {
|
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();
|
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()) {
|
if (pointsPromotions.isPresent()) {
|
||||||
PointsGoods pointsGoods = (PointsGoods) pointsPromotions.get().getValue();
|
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();
|
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()) {
|
if (kanjiaPromotions.isPresent()) {
|
||||||
KanjiaActivityGoods kanjiaActivityGoods = (KanjiaActivityGoods) kanjiaPromotions.get().getValue();
|
KanjiaActivityGoods kanjiaActivityGoods = (KanjiaActivityGoods) kanjiaPromotions.get().getValue();
|
||||||
|
@ -48,7 +48,7 @@ public class FullDiscountRender implements CartRenderStep {
|
|||||||
//循环店铺购物车
|
//循环店铺购物车
|
||||||
for (CartVO cart : cartList) {
|
for (CartVO cart : cartList) {
|
||||||
List<CartSkuVO> fullDiscountSkuList = cart.getSkuList().stream()
|
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());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (!fullDiscountSkuList.isEmpty()) {
|
if (!fullDiscountSkuList.isEmpty()) {
|
||||||
|
@ -9,7 +9,6 @@ import cn.lili.modules.order.cart.entity.vo.CartSkuVO;
|
|||||||
import cn.lili.modules.order.cart.entity.vo.CartVO;
|
import cn.lili.modules.order.cart.entity.vo.CartVO;
|
||||||
import cn.lili.modules.order.cart.render.CartRenderStep;
|
import cn.lili.modules.order.cart.render.CartRenderStep;
|
||||||
import cn.lili.modules.order.order.entity.dto.PriceDetailDTO;
|
import cn.lili.modules.order.order.entity.dto.PriceDetailDTO;
|
||||||
import cn.lili.modules.promotion.entity.dto.BasePromotions;
|
|
||||||
import cn.lili.modules.promotion.entity.enums.KanJiaStatusEnum;
|
import cn.lili.modules.promotion.entity.enums.KanJiaStatusEnum;
|
||||||
import cn.lili.modules.promotion.entity.vos.PromotionSkuVO;
|
import cn.lili.modules.promotion.entity.vos.PromotionSkuVO;
|
||||||
import cn.lili.modules.promotion.entity.vos.kanjia.KanjiaActivitySearchParams;
|
import cn.lili.modules.promotion.entity.vos.kanjia.KanjiaActivitySearchParams;
|
||||||
@ -122,18 +121,19 @@ public class SkuPromotionRender implements CartRenderStep {
|
|||||||
for (CartVO cartVO : tradeDTO.getCartList()) {
|
for (CartVO cartVO : tradeDTO.getCartList()) {
|
||||||
//循环sku
|
//循环sku
|
||||||
for (CartSkuVO cartSkuVO : cartVO.getCheckedSkuList()) {
|
for (CartSkuVO cartSkuVO : cartVO.getCheckedSkuList()) {
|
||||||
|
if (cartSkuVO.getPromotionMap() != null && !cartSkuVO.getPromotionMap().isEmpty()) {
|
||||||
//赋予商品促销信息
|
//赋予商品促销信息
|
||||||
for (Map.Entry<String, Object> entry : cartSkuVO.getPromotionMap().entrySet()) {
|
for (Map.Entry<String, Object> entry : cartSkuVO.getPromotionMap().entrySet()) {
|
||||||
// 忽略拼团活动
|
// 忽略拼团活动
|
||||||
if (entry.getKey().contains(PromotionTypeEnum.PINTUAN.name())) {
|
if (entry.getKey().contains(PromotionTypeEnum.PINTUAN.name())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
BasePromotions basePromotions = (BasePromotions) entry.getValue();
|
// BasePromotions basePromotions = (BasePromotions) entry.getValue();
|
||||||
PromotionSkuVO promotionSkuVO = new PromotionSkuVO(entry.getKey().split("-")[0], basePromotions.getId());
|
// PromotionSkuVO promotionSkuVO = new PromotionSkuVO(entry.getKey().split("-")[0], basePromotions.getId());
|
||||||
cartSkuVO.setSubTotal(CurrencyUtil.mul(cartSkuVO.getPurchasePrice(), cartSkuVO.getNum()));
|
cartSkuVO.setSubTotal(CurrencyUtil.mul(cartSkuVO.getPurchasePrice(), cartSkuVO.getNum()));
|
||||||
cartSkuVO.getPriceDetailDTO().setGoodsPrice(cartSkuVO.getSubTotal());
|
cartSkuVO.getPriceDetailDTO().setGoodsPrice(cartSkuVO.getSubTotal());
|
||||||
|
// cartSkuVO.getPriceDetailDTO().getJoinPromotion().add(promotionSkuVO);
|
||||||
cartSkuVO.getPriceDetailDTO().getJoinPromotion().add(promotionSkuVO);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -367,7 +367,7 @@ public class CartServiceImpl implements CartService {
|
|||||||
|
|
||||||
List<EsGoodsIndex> esGoodsList = esGoodsSearchService.getEsGoodsBySkuIds(ids);
|
List<EsGoodsIndex> esGoodsList = esGoodsSearchService.getEsGoodsBySkuIds(ids);
|
||||||
for (EsGoodsIndex esGoodsIndex : esGoodsList) {
|
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());
|
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()) {
|
if (!couponIds.isEmpty()) {
|
||||||
List<MemberCoupon> currentGoodsCanUse = memberCouponService.getCurrentGoodsCanUse(tradeDTO.getMemberId(), couponIds, totalPrice);
|
List<MemberCoupon> currentGoodsCanUse = memberCouponService.getCurrentGoodsCanUse(tradeDTO.getMemberId(), couponIds, totalPrice);
|
||||||
@ -614,6 +614,7 @@ public class CartServiceImpl implements CartService {
|
|||||||
continue;
|
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()))) {
|
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()));
|
cartPrice = CurrencyUtil.add(cartPrice, CurrencyUtil.mul(cartSkuVO.getPurchasePrice(), cartSkuVO.getNum()));
|
||||||
skuPrice.put(cartSkuVO.getGoodsSku().getId(), 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()));
|
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) {
|
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();
|
Optional<Map.Entry<String, Object>> pintuanPromotions = cartSkuVO.getPromotionMap().entrySet().stream().filter(i -> i.getKey().contains(PromotionTypeEnum.PINTUAN.name())).findFirst();
|
||||||
if (pintuanPromotions.isPresent()) {
|
if (pintuanPromotions.isPresent()) {
|
||||||
Pintuan pintuan = (Pintuan) pintuanPromotions.get().getValue();
|
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 购物车信息
|
* @param cartSkuVO 购物车信息
|
||||||
*/
|
*/
|
||||||
private void checkKanjia(CartSkuVO 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();
|
Optional<Map.Entry<String, Object>> kanjiaPromotions = cartSkuVO.getPromotionMap().entrySet().stream().filter(i -> i.getKey().contains(PromotionTypeEnum.KANJIA.name())).findFirst();
|
||||||
if (kanjiaPromotions.isPresent()) {
|
if (kanjiaPromotions.isPresent()) {
|
||||||
KanjiaActivityGoods kanjiaActivityGoods = (KanjiaActivityGoods) kanjiaPromotions.get().getValue();
|
KanjiaActivityGoods kanjiaActivityGoods = (KanjiaActivityGoods) kanjiaPromotions.get().getValue();
|
||||||
@ -746,8 +750,7 @@ public class CartServiceImpl implements CartService {
|
|||||||
cartSkuVO.setKanjiaId(kanjiaActivity.getId());
|
cartSkuVO.setKanjiaId(kanjiaActivity.getId());
|
||||||
cartSkuVO.setNum(1);
|
cartSkuVO.setNum(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -272,7 +272,7 @@ public class Order extends BaseEntity {
|
|||||||
this.setOrderPromotionType(tradeDTO.getCartTypeEnum().name());
|
this.setOrderPromotionType(tradeDTO.getCartTypeEnum().name());
|
||||||
|
|
||||||
//判断是否为拼团订单,如果为拼团订单获取拼团ID,判断是否为主订单
|
//判断是否为拼团订单,如果为拼团订单获取拼团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();
|
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]);
|
pintuanPromotions.ifPresent(s -> promotionId = s.split("-")[1]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user