Commit 13fd24f5 by xiaoer.li@freemud.com

Merge remote-tracking branch 'remotes/origin/feature/促销算价基于最新master的分支' into qa

parents f7e261d8 eaa5c377
...@@ -93,17 +93,21 @@ public class CalculationCommonService { ...@@ -93,17 +93,21 @@ public class CalculationCommonService {
if (find == null) return; if (find == null) return;
cartGoods.setAmount(find.getRealAmount()); cartGoods.setAmount(find.getRealAmount());
cartGoods.setOriginalAmount(find.getOriginalPrice()); cartGoods.setOriginalAmount(find.getOriginalPrice());
Integer type = 2; /**
if (CollectionUtils.isEmpty(cartGoods.getProductGroupList())) return; * 可选搭配
Map<String, CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.SmallMaterial> choices = find.getSmallMaterial() */
.stream().filter(d -> type.equals(d.getType()))
if (CollectionUtils.isNotEmpty(cartGoods.getProductGroupList())) {
Integer type2 = 2;
Map<String, CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.SmallMaterial> gChoices = find.getSmallMaterial()
.stream().filter(d -> type2.equals(d.getType()))
.collect(Collectors.toMap(CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.SmallMaterial::getGoodsId, Function.identity(), (k1, k2) -> k1)); .collect(Collectors.toMap(CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.SmallMaterial::getGoodsId, Function.identity(), (k1, k2) -> k1));
long amount = 0L; long amount = 0L;
long original = 0L; long original = 0L;
//
for (CartGoods.ComboxGoods choice : cartGoods.getProductGroupList()) {
//可选搭配 //可选搭配
CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.SmallMaterial mt = choices.get(choice.getGoodsId()); for (CartGoods.ComboxGoods choice : cartGoods.getProductGroupList()) {
CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.SmallMaterial mt = gChoices.get(choice.getGoodsId());
if (mt == null) { if (mt == null) {
amount += choice.getAmount() * cartGoods.getQty(); amount += choice.getAmount() * cartGoods.getQty();
original += choice.getOriginalPrice() * cartGoods.getQty(); original += choice.getOriginalPrice() * cartGoods.getQty();
...@@ -117,6 +121,23 @@ public class CalculationCommonService { ...@@ -117,6 +121,23 @@ public class CalculationCommonService {
cartGoods.setAmount(cartGoods.getAmount() + amount); cartGoods.setAmount(cartGoods.getAmount() + amount);
cartGoods.setOriginalAmount(cartGoods.getOriginalMaterialAmount() + original); cartGoods.setOriginalAmount(cartGoods.getOriginalMaterialAmount() + original);
} }
/**
* 小料
*/
if (CollectionUtils.isNotEmpty(cartGoods.getProductMaterialList())) {
Integer type1 = 1;
Map<String, CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.SmallMaterial> sChoices = find.getSmallMaterial()
.stream().filter(d -> type1.equals(d.getType()))
.collect(Collectors.toMap(CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.SmallMaterial::getGoodsId, Function.identity(), (k1, k2) -> k1));
for (CartGoods.MaterialGoods mg : cartGoods.getProductMaterialList()) {
CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.SmallMaterial sm = sChoices.get(mg.getSpuId());
if (sm != null) {
mg.setAmount(sm.getRealAmount().longValue());
}
}
}
}
/** /**
* 设置行记录享受的优惠及总优惠 * 设置行记录享受的优惠及总优惠
......
...@@ -126,18 +126,6 @@ public class FullSharingService { ...@@ -126,18 +126,6 @@ public class FullSharingService {
} }
} }
} }
//固定搭配
//if (CollectionUtils.isNotEmpty(cart.getProductComboList())) {
// List<CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.GroupCombox> groupCom = discountMap.getGroupCombox();
// HashMap<String, Long> gDiscount = drawnFullDiscount(groupCom, typeEnums);
// if (!gDiscount.isEmpty()) continue;
// for (CartGoods.ComboxGoods com : cart.getProductComboList()) {
// Long md = gDiscount.get(com.getGoodsId());
// if (md!=null) {
// com.setAmount(com.getAmount()+md);
// }
// }
//}
} }
/** /**
......
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