Commit 8cb0244b by yu.sun

Merge branch 'feature/20201217_四个非常搭套餐需求_yu.sun'

# Conflicts:
#	shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartMccafeAdapter.java
#	shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
#	shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/SetMealCalculation.java
parents edbcb7ab 180ae5f7
......@@ -425,6 +425,9 @@ public class CartGoods {
if (CollectionUtils.isNotEmpty(productGroupList)) {
for (ComboxGoods goods : productGroupList) {
originalString.append(goods.toString());
if (CollectionUtils.isNotEmpty(goods.getProductMaterialList())) {
goods.getProductMaterialList().stream().sorted(Comparator.comparing(MaterialGoods::getSpuId)).forEach(e -> originalString.append(e.getSpuId()));
}
}
}
if (CollectionUtils.isNotEmpty(productMaterialList)) {
......
......@@ -1489,6 +1489,7 @@ public class ShoppingCartMCoffeeServiceImpl {
CartGoods.MaterialGoods materialGoods = new CartGoods.MaterialGoods();
materialGoods.setSpuId(materialRequestVo.getSpuId());
materialGoods.setGroupId(materialRequestVo.getGroupId());
materialGoods.setCustomerCode(materialRequestVo.getCustomerCode());
comboxMaterialGoodsList.add(materialGoods);
}
productCombox.setProductMaterialList(comboxMaterialGoodsList);
......
......@@ -82,12 +82,8 @@ public class CalculationServiceImpl {
@Autowired
private MaterialCalculation materialCalculation;
// @Autowired
// private ShoppingCartConvertAdapter shoppingCartConvertAdapter;
@Autowired
private ShoppingCartMccafeAdapter shoppingCartMccafeAdapter;
// @Autowired
// private ItemServiceImpl itemService;
/**
* 更新购物车行优惠信息
......@@ -414,13 +410,26 @@ public class CalculationServiceImpl {
if("0".equals(materialGoods.getGoodsId())){
continue;
}
ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material material = new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material();
material.setType(2);
material.setGoodsId(materialGoods.getGoodsId());
material.setGoodsQuantity(materialGoods.getQty());
material.setOriginalPrice(null != materialGoods.getFinalPrice() ?
ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material productGroup =
new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material();
productGroup.setType(2);
productGroup.setGoodsId(materialGoods.getGoodsId());
productGroup.setGoodsQuantity(materialGoods.getQty());
productGroup.setOriginalPrice(null != materialGoods.getFinalPrice() ?
materialGoods.getFinalPrice() : 0);
materials.add(material);
materials.add(productGroup);
if (CollectionUtils.isNotEmpty(materialGoods.getProductMaterialList())){
for (CartGoods.MaterialGoods goods : materialGoods.getProductMaterialList()) {
ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material material = new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material();
material.setType(1);
material.setGoodsId(goods.getSpuId());
material.setGoodsQuantity(1);
material.setOriginalPrice(null != goods.getFinalPrice() ?
goods.getFinalPrice() : 0);
materials.add(material);
}
}
}
}
......@@ -508,7 +517,7 @@ public class CalculationServiceImpl {
//单品、多规格加料
if(CollectionUtils.isNotEmpty(cartGoods.getProductMaterialList())){
for (CartGoods.MaterialGoods materialGoods : cartGoods.getProductMaterialList()){
materialPrice+= materialGoods.getFinalPrice() * cartGoods.getQty();
materialPrice+= (null != materialGoods.getFinalPrice() ? materialGoods.getFinalPrice() : 0) * (null != cartGoods.getQty() ? cartGoods.getQty() : 0);
}
}
return materialPrice;
......
......@@ -98,6 +98,21 @@ public class SetMealCalculation {
productGroupTotalAmount + productComboTotalAmount + materialPrice;
cartGoods.setAmount(amount);
}
//套餐可选商品加料
if(CollectionUtils.isNotEmpty(cartGoods.getProductGroupList())){
for (CartGoods.ComboxGoods comboxGoods : cartGoods.getProductGroupList()){
Long productGroupmaterialPrice = 0L;
if(CollectionUtils.isNotEmpty(comboxGoods.getProductMaterialList())){
for (CartGoods.MaterialGoods materialGoods : comboxGoods.getProductMaterialList()){
productGroupmaterialPrice+= null != materialGoods.getFinalPrice() ? materialGoods.getFinalPrice() * cartGoods.getQty() : 0;
}
}
comboxGoods.setAmount((null == comboxGoods.getAmount() ? 0 :
comboxGoods.getAmount())+productGroupmaterialPrice);
materialPrice = materialPrice + productGroupmaterialPrice;
}
}
Long comboOriginalPriceAmount = null != cartGoods.getOriginalAmount() ? cartGoods.getOriginalAmount() :
productComboTotalAmount;
cartGoods.setOriginalAmount(productGroupTotalAmount + comboOriginalPriceAmount + materialPrice);
......
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