Commit a44ee5f2 by 刘鹏飞

Merge remote-tracking branch 'origin/develop' into develop

parents 98a59bea 3c87539e
...@@ -758,7 +758,6 @@ public class ShoppingCartConvertAdapter { ...@@ -758,7 +758,6 @@ public class ShoppingCartConvertAdapter {
productComboType = parentProductBean.getProductComboList().stream().filter(p -> ObjectUtils.equals(comboxGoods.getGoodsId(), p.getProductId())).findFirst().orElse(new ProductTypeBeanDTO.ProductComboType()); productComboType = parentProductBean.getProductComboList().stream().filter(p -> ObjectUtils.equals(comboxGoods.getGoodsId(), p.getProductId())).findFirst().orElse(new ProductTypeBeanDTO.ProductComboType());
} else { } else {
Map<String, ProductTypeBeanDTO.ProductGroupType.GroupDetailType> map = new HashMap<>(); Map<String, ProductTypeBeanDTO.ProductGroupType.GroupDetailType> map = new HashMap<>();
// subProductTypeMap.get(comboxGoods.getSkuId()).getAdditionalGroupList().stream().map(t->t.getGroupDetail()).forEach(group->group.forEach(detailType-> map.put(detailType.getProductId(),detailType)));
parentProductBean.getProductGroupList().stream().map(t -> t.getGroupDetail()).forEach(group -> group.forEach(detailType -> map.put(detailType.getProductId(), detailType))); parentProductBean.getProductGroupList().stream().map(t -> t.getGroupDetail()).forEach(group -> group.forEach(detailType -> map.put(detailType.getProductId(), detailType)));
groupDetailType = map.get(comboxGoods.getGoodsId()); groupDetailType = map.get(comboxGoods.getGoodsId());
} }
...@@ -800,26 +799,26 @@ public class ShoppingCartConvertAdapter { ...@@ -800,26 +799,26 @@ public class ShoppingCartConvertAdapter {
comboxGoods.getProductMaterialList().stream().forEach(materialGood -> materialList.add(materialMap.get(materialGood.getSpuId()))); comboxGoods.getProductMaterialList().stream().forEach(materialGood -> materialList.add(materialMap.get(materialGood.getSpuId())));
List<com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods> productMaterialList = new ArrayList<>(); List<com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods> productMaterialList = new ArrayList<>();
Long materialAmount = 0L;
Long originalMaterAmount = 0L;
if (CollectionUtils.isNotEmpty(materialList)){ if (CollectionUtils.isNotEmpty(materialList)){
for (ProductTypeBeanDTO.ProductGroupType.GroupDetailType detailType : materialList) { for (ProductTypeBeanDTO.ProductGroupType.GroupDetailType detailType : materialList) {
com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods materialGoods = new com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods(); com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods materialGoods = new com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods();
materialGoods.setCustomerCode(StringUtils.isNotEmpty(detailType.getCustomerCode()) ? materialGoods.setCustomerCode(StringUtils.isNotEmpty(detailType.getCustomerCode()) ? detailType.getCustomerCode() : "");
detailType.getCustomerCode() : ""); materialGoods.setAmount(null != detailType.getMarkUpPrice() ? detailType.getMarkUpPrice().longValue() : 0);
materialGoods.setAmount(null != detailType.getMarkUpPrice() ? materialGoods.setFinalPrice(null != detailType.getProductFinalPrice() ? detailType.getProductFinalPrice().longValue() : 0);
detailType.getMarkUpPrice().longValue() : 0); materialGoods.setSpuName(StringUtils.isNotEmpty(detailType.getProductName()) ? detailType.getProductName() : "");
materialGoods.setFinalPrice(null != detailType.getProductFinalPrice() ? materialGoods.setSpuId(StringUtils.isNotEmpty(detailType.getProductId()) ? detailType.getProductId() : "");
detailType.getProductFinalPrice().longValue() : 0); materialGoods.setOriginalPrice(null != detailType.getProductFinalPrice() ? detailType.getProductFinalPrice().longValue() : 0);
materialGoods.setSpuName(StringUtils.isNotEmpty(detailType.getProductName()) ? materialGoods.setOriginalAmount(null != detailType.getProductFinalPrice() ? detailType.getProductFinalPrice().longValue() * comboxGoods.getQty() : 0);
detailType.getProductName() : "");
materialGoods.setSpuId(StringUtils.isNotEmpty(detailType.getProductId()) ?
detailType.getProductId() : "");
materialGoods.setOriginalPrice(null != detailType.getProductFinalPrice() ?
detailType.getProductFinalPrice().longValue() : 0);
materialGoods.setOriginalAmount(null != detailType.getProductFinalPrice() ?
detailType.getProductFinalPrice().longValue() : 0);
productMaterialList.add(materialGoods); productMaterialList.add(materialGoods);
materialAmount += detailType.getProductFinalPrice().longValue() * comboxGoods.getQty();
originalMaterAmount += detailType.getProductFinalPrice().longValue() * comboxGoods.getQty();
} }
} }
comboxGoods.setMaterialAmount(materialAmount);
comboxGoods.setProductMaterialList(productMaterialList); comboxGoods.setProductMaterialList(productMaterialList);
} }
} }
...@@ -839,7 +838,9 @@ public class ShoppingCartConvertAdapter { ...@@ -839,7 +838,9 @@ public class ShoppingCartConvertAdapter {
private void checkMaterialProductForMCoffee(com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods cartGoods, ProductTypeBeanDTO spuProduct) { private void checkMaterialProductForMCoffee(com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods cartGoods, ProductTypeBeanDTO spuProduct) {
if (CollectionUtils.isEmpty(cartGoods.getProductMaterialList())) return; if (CollectionUtils.isEmpty(cartGoods.getProductMaterialList())) {
return;
}
//加料信息为空 //加料信息为空
if (CollectionUtils.isEmpty(spuProduct.getAdditionalGroupList())) { if (CollectionUtils.isEmpty(spuProduct.getAdditionalGroupList())) {
checkSkuMaterialProductForMccafe(cartGoods,spuProduct); checkSkuMaterialProductForMccafe(cartGoods,spuProduct);
...@@ -868,7 +869,9 @@ public class ShoppingCartConvertAdapter { ...@@ -868,7 +869,9 @@ public class ShoppingCartConvertAdapter {
String materialSubName = cartGoods.getSubName(); String materialSubName = cartGoods.getSubName();
for (com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods materialGoods : cartGoods.getProductMaterialList()) { for (com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods materialGoods : cartGoods.getProductMaterialList()) {
ProductTypeBeanDTO.ProductGroupType.GroupDetailType detail = materialHash.get(materialGoods.getSpuId()); ProductTypeBeanDTO.ProductGroupType.GroupDetailType detail = materialHash.get(materialGoods.getSpuId());
if (detail == null) continue; if (detail == null) {
continue;
}
com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods material = new com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods(); com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods material = new com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoods.MaterialGoods();
material.setSpuName(detail.getProductName()); material.setSpuName(detail.getProductName());
material.setSpuId(detail.getProductId()); material.setSpuId(detail.getProductId());
...@@ -960,6 +963,11 @@ public class ShoppingCartConvertAdapter { ...@@ -960,6 +963,11 @@ public class ShoppingCartConvertAdapter {
} }
} }
} }
//可选商品组加料价格加到购物车行记录上
Long materialAmount =
cartGoods.getProductGroupList().stream().mapToLong(group -> (null != group.getMaterialAmount() ? group.getMaterialAmount() : 0)).sum();
cartGoods.setOriginalMaterialAmount(materialAmount);
cartGoods.setMaterialAmount(materialAmount);
} }
} }
//更新当前商品行价格 //更新当前商品行价格
...@@ -987,12 +995,16 @@ public class ShoppingCartConvertAdapter { ...@@ -987,12 +995,16 @@ public class ShoppingCartConvertAdapter {
cartGoods.setWeight(isSkuProduct ? skuProduct.getWeight() : spuProduct.getWeight()); cartGoods.setWeight(isSkuProduct ? skuProduct.getWeight() : spuProduct.getWeight());
cartGoods.setUnit(isSkuProduct ? skuProduct.getUnit() : spuProduct.getUnit()); cartGoods.setUnit(isSkuProduct ? skuProduct.getUnit() : spuProduct.getUnit());
cartGoods.setWeightType(CommonsConstant.WEIGHT_PRODUCT.equals(spuProduct.getWeightType())); cartGoods.setWeightType(CommonsConstant.WEIGHT_PRODUCT.equals(spuProduct.getWeightType()));
cartGoods.setMaterialAmount(0L); if (null == cartGoods.getMaterialAmount()) {
cartGoods.setOriginalMaterialAmount(0L); cartGoods.setMaterialAmount(0L);
}
if (null == cartGoods.getOriginalMaterialAmount()) {
cartGoods.setOriginalMaterialAmount(0L);
}
// todo 设置加料 // todo 设置加料
this.checkMaterialProductForMCoffee(cartGoods, spuProduct); this.checkMaterialProductForMCoffee(cartGoods, spuProduct);
} catch (Exception ex) { } catch (Exception ex) {
System.out.println(ex.getLocalizedMessage());
ErrorLog.infoConvertJson(this.getClass(), "updateCartGoodsInfoForMCoffee_Error", ex); ErrorLog.infoConvertJson(this.getClass(), "updateCartGoodsInfoForMCoffee_Error", ex);
cartGoods.setCartGoodsUid(null); cartGoods.setCartGoodsUid(null);
} }
......
...@@ -118,6 +118,19 @@ public class ShoppingCartMccafeAdapter { ...@@ -118,6 +118,19 @@ public class ShoppingCartMccafeAdapter {
return cartGoodsDetailDtos; return cartGoodsDetailDtos;
} }
/**
* @param cartGoods
* @return
*/
public List<ShoppingCartGoodsDto.CartGoodsDetailDto> convertCartGoods2DetailGoodsList(CartGoods cartGoods, List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.ApportionGoods> apportionGoodsList, Map<String, String> duplicateGoodsMap) {
List<ShoppingCartGoodsDto.CartGoodsDetailDto> cartGoodsDetailDtos = new ArrayList<>();
if (StringUtils.isEmpty(cartGoods.getCouponCode()) && GoodsTypeEnum.SET_MEAL_GOODS.getGoodsType().equals(cartGoods.getGoodsType())) {
return cartGoodsDetailDtos;
} else {
cartGoodsDetailDtos.add(convertCartGoods2DetailGoods(cartGoods, apportionGoodsList, duplicateGoodsMap));
}
return cartGoodsDetailDtos;
}
/** /**
* @param cartGoods * @param cartGoods
...@@ -267,4 +280,4 @@ public class ShoppingCartMccafeAdapter { ...@@ -267,4 +280,4 @@ public class ShoppingCartMccafeAdapter {
} }
cartGoodsDetailDto.setActivityDiscountsDtos(activityDiscountsDtoList); cartGoodsDetailDto.setActivityDiscountsDtos(activityDiscountsDtoList);
} }
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package cn.freemud.service.impl.mcoffee.calculation; ...@@ -2,6 +2,7 @@ package cn.freemud.service.impl.mcoffee.calculation;
import cn.freemud.adapter.ActivityAdapter; import cn.freemud.adapter.ActivityAdapter;
import cn.freemud.adapter.ShoppingCartConvertAdapter; import cn.freemud.adapter.ShoppingCartConvertAdapter;
import cn.freemud.adapter.ShoppingCartMccafeAdapter;
import cn.freemud.base.entity.BaseResponse; import cn.freemud.base.entity.BaseResponse;
import cn.freemud.constant.ResponseCodeConstant; import cn.freemud.constant.ResponseCodeConstant;
import cn.freemud.entities.dto.*; import cn.freemud.entities.dto.*;
...@@ -12,7 +13,6 @@ import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto; ...@@ -12,7 +13,6 @@ import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto;
import cn.freemud.entities.vo.*; import cn.freemud.entities.vo.*;
import cn.freemud.enums.ActivityChannelEnum; import cn.freemud.enums.ActivityChannelEnum;
import cn.freemud.enums.ActivityTypeEnum; import cn.freemud.enums.ActivityTypeEnum;
import cn.freemud.enums.GoodsTypeEnum;
import cn.freemud.enums.ResponseResult; import cn.freemud.enums.ResponseResult;
import cn.freemud.interceptor.ServiceException; import cn.freemud.interceptor.ServiceException;
import cn.freemud.service.CommonService; import cn.freemud.service.CommonService;
...@@ -24,9 +24,7 @@ import com.freemud.application.sdk.api.log.LogThreadLocal; ...@@ -24,9 +24,7 @@ import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.membercenter.request.QueryReceiveAddressRequest; import com.freemud.application.sdk.api.membercenter.request.QueryReceiveAddressRequest;
import com.freemud.application.sdk.api.membercenter.response.QueryReceiveAddressResponse; import com.freemud.application.sdk.api.membercenter.response.QueryReceiveAddressResponse;
import com.freemud.application.sdk.api.membercenter.service.MemberCenterService; import com.freemud.application.sdk.api.membercenter.service.MemberCenterService;
import com.freemud.application.sdk.api.storecenter.request.QueryDeliveryRequest;
import com.freemud.application.sdk.api.storecenter.request.StoreInfoRequest; import com.freemud.application.sdk.api.storecenter.request.StoreInfoRequest;
import com.freemud.application.sdk.api.storecenter.response.QueryDeliverDetailResponse;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse; import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import com.freemud.application.sdk.api.storecenter.service.StoreCenterService; import com.freemud.application.sdk.api.storecenter.service.StoreCenterService;
import com.freemud.sdk.api.assortment.shoppingcart.enums.BusinessTypeEnum; import com.freemud.sdk.api.assortment.shoppingcart.enums.BusinessTypeEnum;
...@@ -81,8 +79,9 @@ public class CalculationServiceImpl { ...@@ -81,8 +79,9 @@ public class CalculationServiceImpl {
@Autowired @Autowired
private MaterialCalculation materialCalculation; private MaterialCalculation materialCalculation;
@Autowired @Autowired
private ShoppingCartConvertAdapter shoppingCartConvertAdapter; private ShoppingCartMccafeAdapter shoppingCartMccafeAdapter;
/** /**
* 更新购物车行优惠信息 * 更新购物车行优惠信息
...@@ -205,7 +204,8 @@ public class CalculationServiceImpl { ...@@ -205,7 +204,8 @@ public class CalculationServiceImpl {
}); });
for (int i = 0, len = cartGoodsList.size(); i < len; i++) { for (int i = 0, len = cartGoodsList.size(); i < len; i++) {
CartGoods cartGoods = cartGoodsList.get(i); CartGoods cartGoods = cartGoodsList.get(i);
List<ShoppingCartGoodsDto.CartGoodsDetailDto> cartGoodsDetailDtos = shoppingCartConvertAdapter.convertCartGoods2DetailGoodsList(cartGoods, apportionGoodsList,duplicateGoodsMap); // List<ShoppingCartGoodsDto.CartGoodsDetailDto> cartGoodsDetailDtos = shoppingCartConvertAdapter.convertCartGoods2DetailGoodsList(cartGoods, apportionGoodsList,duplicateGoodsMap);
List<ShoppingCartGoodsDto.CartGoodsDetailDto> cartGoodsDetailDtos = shoppingCartMccafeAdapter.convertCartGoods2DetailGoodsList(cartGoods, apportionGoodsList,duplicateGoodsMap);
cartGoodsDetailDtoList.addAll(cartGoodsDetailDtos); cartGoodsDetailDtoList.addAll(cartGoodsDetailDtos);
} }
List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount> discounts = calculationDiscountResult == null ? new ArrayList<>() : calculationDiscountResult.getDiscounts(); List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount> discounts = calculationDiscountResult == null ? new ArrayList<>() : calculationDiscountResult.getDiscounts();
...@@ -510,7 +510,7 @@ public class CalculationServiceImpl { ...@@ -510,7 +510,7 @@ public class CalculationServiceImpl {
//单品、多规格加料 //单品、多规格加料
if(CollectionUtils.isNotEmpty(cartGoods.getProductMaterialList())){ if(CollectionUtils.isNotEmpty(cartGoods.getProductMaterialList())){
for (CartGoods.MaterialGoods materialGoods : 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; return materialPrice;
......
...@@ -92,6 +92,21 @@ public class SetMealCalculation { ...@@ -92,6 +92,21 @@ public class SetMealCalculation {
} }
} }
//套餐可选商品加料
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 amount = null != cartGoods.getFinalPrice() ? cartGoods.getFinalPrice()*cartGoods.getQty() + productGroupTotalAmount + materialPrice : Long amount = null != cartGoods.getFinalPrice() ? cartGoods.getFinalPrice()*cartGoods.getQty() + productGroupTotalAmount + materialPrice :
productGroupTotalAmount + productComboTotalAmount + materialPrice; productGroupTotalAmount + productComboTotalAmount + 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