Commit 88cab690 by 徐康

加料再来一单

parent 068385c7
......@@ -805,13 +805,23 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoods.setSkuName(orderItem.getProductSpecName());
cartGoods.setSpuName(orderItem.getProductName());
}
if (ObjectUtils.equals(ProductTypeEnum.SETMEAL_PRODUCT.getCode(), orderItem.getProductType()) || ObjectUtils.equals(ProductTypeEnum.SETMEAL_UPPRICE_PRODUCT.getCode(), orderItem.getProductType())) {
if (ObjectUtils.equals(ProductTypeEnum.SETMEAL_PRODUCT.getCode(), orderItem.getProductType())
|| ObjectUtils.equals(ProductTypeEnum.SETMEAL_UPPRICE_PRODUCT.getCode(), orderItem.getProductType())) {
// 获取套餐子商品列表
cartGoods.setProductComboList(new ArrayList<>());
cartGoods.setProductGroupList(new ArrayList<>());
String partnerProductId = orderItem.getProductId() + "_" + orderItem.getProductSeq();
List<OrderItemResp> comboProducts = orderItemList.stream().filter(item -> ObjectUtils.equals(partnerProductId, item.getParentProductId())).collect(Collectors.toList());
comboProducts.forEach(combo -> getComboxGoods(cartGoods, combo));
comboProducts.forEach(combo -> {
getComboxGoods(cartGoods, combo, orderItemList);
});
}
if (ObjectUtils.equals(88, orderItem.getProductType())) {
// 获取套餐子商品列表
cartGoods.setProductMaterialList(new ArrayList<>());
String partnerProductId = orderItem.getProductId() + "_" + orderItem.getProductSeq();
List<OrderItemResp> materialProducts = orderItemList.stream().filter(item -> ObjectUtils.equals(partnerProductId, item.getParentProductId())).collect(Collectors.toList());
materialProducts.forEach(material -> getMaterialGoods(cartGoods, material));
}
cartGoodsList.add(cartGoods);
}
......@@ -820,7 +830,7 @@ public class ShoppingCartMCoffeeServiceImpl {
}
private CartGoods.ComboxGoods getComboxGoods(CartGoods cartGoods, OrderItemResp orderItemResp) {
private CartGoods.ComboxGoods getComboxGoods(CartGoods cartGoods, OrderItemResp orderItemResp, List<OrderItemResp> orderItemList) {
CartGoods.ComboxGoods comboxGoods = new CartGoods.ComboxGoods();
comboxGoods.setSkuId(orderItemResp.getProductSpec());
comboxGoods.setGoodsId(orderItemResp.getProductId());
......@@ -844,10 +854,40 @@ public class ShoppingCartMCoffeeServiceImpl {
if (map.containsKey("isFixedProduct") && !(boolean) map.get("isFixedProduct")) {
cartGoods.getProductGroupList().add(comboxGoods);
}
if (ObjectUtils.equals(88, orderItemResp.getProductType())) {
comboxGoods.setProductMaterialList(new ArrayList<>());
String partnerProductId = orderItemResp.getProductId() + "_" + orderItemResp.getProductSeq();
List<OrderItemResp> materialProducts = orderItemList.stream().filter(item -> ObjectUtils.equals(partnerProductId, item.getParentProductId())).collect(Collectors.toList());
materialProducts.forEach(material -> getMaterialGoods(comboxGoods, material));
}
return comboxGoods;
}
private CartGoods.MaterialGoods getMaterialGoods(CartGoods cartGoods, OrderItemResp orderItemResp) {
CartGoods.MaterialGoods materialGoods = new CartGoods.MaterialGoods();
materialGoods.setSpuId(orderItemResp.getProductId());
materialGoods.setCustomerCode(orderItemResp.getThirdProductId());
materialGoods.setFinalPrice(orderItemResp.getSalePrice().longValue());
materialGoods.setOriginalPrice(orderItemResp.getProductPrice().longValue());
materialGoods.setSpuName(orderItemResp.getProductName());
cartGoods.getProductMaterialList().add(materialGoods);
return materialGoods;
}
private CartGoods.MaterialGoods getMaterialGoods(CartGoods.ComboxGoods comboGoods, OrderItemResp orderItemResp) {
CartGoods.MaterialGoods materialGoods = new CartGoods.MaterialGoods();
materialGoods.setSpuId(orderItemResp.getProductId());
materialGoods.setCustomerCode(orderItemResp.getThirdProductId());
materialGoods.setFinalPrice(orderItemResp.getSalePrice().longValue());
materialGoods.setOriginalPrice(orderItemResp.getProductPrice().longValue());
materialGoods.setSpuName(orderItemResp.getProductName());
comboGoods.getProductMaterialList().add(materialGoods);
return materialGoods;
}
private void packgeAdditional(ShoppingCartInfoRequestVo shoppingCartInfoRequestVo, CreateOrderVo.PremiumExchangeActivity premiumExchangeActivity) {
ArrayList<ShoppingCartInfoRequestVo.SendGoods> senGoods = new ArrayList<>();
......
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