Commit eaa5c377 by xiaoer.li@freemud.com

对接促销算价Alpha->fix

parent d34c33b6
......@@ -93,29 +93,50 @@ public class CalculationCommonService {
if (find == null) return;
cartGoods.setAmount(find.getRealAmount());
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()))
.collect(Collectors.toMap(CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.SmallMaterial::getGoodsId, Function.identity(), (k1, k2) -> k1));
long amount = 0L;
long original = 0L;
//
for (CartGoods.ComboxGoods choice : cartGoods.getProductGroupList()) {
/**
* 可选搭配
*/
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));
long amount = 0L;
long original = 0L;
//可选搭配
CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.SmallMaterial mt = choices.get(choice.getGoodsId());
if (mt == null) {
amount += choice.getAmount() * cartGoods.getQty();
original += choice.getOriginalPrice() * cartGoods.getQty();
} else {
amount += mt.getRealAmount();
original += mt.getOriginalPrice() * cartGoods.getQty();
choice.setAmount(mt.getRealAmount().longValue());
choice.setOriginalAmount(original);
for (CartGoods.ComboxGoods choice : cartGoods.getProductGroupList()) {
CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.SmallMaterial mt = gChoices.get(choice.getGoodsId());
if (mt == null) {
amount += choice.getAmount() * cartGoods.getQty();
original += choice.getOriginalPrice() * cartGoods.getQty();
} else {
amount += mt.getRealAmount();
original += mt.getOriginalPrice() * cartGoods.getQty();
choice.setAmount(mt.getRealAmount().longValue());
choice.setOriginalAmount(original);
}
}
cartGoods.setAmount(cartGoods.getAmount() + amount);
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());
}
}
}
cartGoods.setAmount(cartGoods.getAmount() + amount);
cartGoods.setOriginalAmount(cartGoods.getOriginalMaterialAmount() + original);
}
/**
......
......@@ -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