Commit 6ee047d8 by 孙昱

Merge branch 'feature/20201112_套餐价格计算_yu.sun' into develop

# Conflicts:
#	shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
parents 87d4b340 50068762
......@@ -62,5 +62,9 @@ public class ShoppingCartConstant {
public static final int PRODUCT_GROUP_EMPTY= 109;
public static final String CART_PRODUCT_GROUP_EMPTY_STATE = "您选择的【$spuName】商品有未选商品";
/**
* 可选商品价格校验失败
*/
public static final int PRODUCT_GROUP_PRICE_CHANGE = 113;
}
......@@ -694,7 +694,8 @@ public class ShoppingCartConvertAdapter {
}
// 若是固定商品则取商品详情的FinalPrice,若是可选商品则取MarkUpPrice
Long finalPrice = isComboxGoods ? productComboType.getFinalPrice().longValue() : groupDetailType.getMarkUpPrice().longValue();
Long finalPrice = isComboxGoods ? (null != productComboType.getFinalPrice() ? productComboType.getFinalPrice().longValue() : 0L)
: (null != groupDetailType.getMarkUpPrice() ? groupDetailType.getMarkUpPrice().longValue() : 0L);
// 设置商品详情
Map<String, String> attributes = getAttributesNew(comboxGoods.getExtra());
comboxGoods.setSpuId(comboxGoods.getSpuId());
......@@ -703,16 +704,22 @@ public class ShoppingCartConvertAdapter {
comboxGoods.setSpecProductId(attributes.get(ATTRIBUTEID));
comboxGoods.setSubName(attributes.get(ATTRIBUTENAME));
comboxGoods.setPic(isComboxGoods ? productComboType.getPicture() : groupDetailType.getPicture());
comboxGoods.setOriginalPrice(isComboxGoods ? productComboType.getFinalPrice().longValue() : groupDetailType.getProductFinalPrice().longValue());
comboxGoods.setOriginalPrice(isComboxGoods ? (null != productComboType.getFinalPrice() ? productComboType.getFinalPrice().longValue() : 0L)
: (null != groupDetailType.getProductFinalPrice() ? groupDetailType.getProductFinalPrice().longValue() : 0L));
comboxGoods.setOriginalAmount(comboxGoods.getOriginalPrice() * comboxGoods.getQty());
comboxGoods.setAmount(finalPrice * comboxGoods.getQty());
comboxGoods.setCustomerCode(isComboxGoods ? productComboType.getCustomerCode() : groupDetailType.getCustomerCode());
comboxGoods.setCustomerCode(isComboxGoods ? (StringUtils.isNotEmpty(productComboType.getCustomerCode()) ? productComboType.getCustomerCode() : "")
: (StringUtils.isNotEmpty(groupDetailType.getCustomerCode()) ? groupDetailType.getCustomerCode() : ""));
comboxGoods.setFinalPrice(finalPrice);
comboxGoods.setWeightType(isComboxGoods ? CommonsConstant.WEIGHT_PRODUCT.equals(productComboType.getWeightType()) : CommonsConstant.WEIGHT_PRODUCT.equals(groupDetailType.getWeightType()));
comboxGoods.setUnit(isComboxGoods ? productComboType.getUnit() : groupDetailType.getUnit());
comboxGoods.setWeight(isComboxGoods ? productComboType.getWeight() : groupDetailType.getWeight());
comboxGoods.setTax(isComboxGoods ? productComboType.getTax() : groupDetailType.getTax());
comboxGoods.setTaxId(isComboxGoods ? productComboType.getTaxId() : groupDetailType.getTaxId());
comboxGoods.setUnit(isComboxGoods ? (StringUtils.isNotEmpty(productComboType.getUnit()) ? productComboType.getUnit() :"") :
(StringUtils.isNotEmpty(groupDetailType.getUnit()) ? groupDetailType.getUnit() : ""));
comboxGoods.setWeight(isComboxGoods ? (null == productComboType.getWeight() ? 0 : productComboType.getWeight()) :
(null == groupDetailType.getWeight() ? 0:groupDetailType.getWeight()));
comboxGoods.setTax(isComboxGoods ? (null == productComboType.getTax() ? 0 : productComboType.getTax())
: (null == groupDetailType.getTax() ? 0 : groupDetailType.getTax()));
comboxGoods.setTaxId(isComboxGoods ? (StringUtils.isNotEmpty(productComboType.getTaxId()) ? productComboType.getTaxId() : "") :
(StringUtils.isNotEmpty(groupDetailType.getTaxId()) ? groupDetailType.getTaxId() : ""));
// TODO: 2020/10/22 套餐内可选商品加料,暂无
if(CollectionUtils.isNotEmpty(comboxGoods.getProductMaterialList())){
......@@ -1042,4 +1049,5 @@ public class ShoppingCartConvertAdapter {
);
}
}
}
}
\ No newline at end of file
......@@ -448,7 +448,7 @@ public class CalculationServiceImpl {
}
//加料
if (cartGoods != null && CollectionUtils.isNotEmpty(cartGoods.getProductMaterialList())) {
if (null != cartGoods && CollectionUtils.isNotEmpty(cartGoods.getProductMaterialList())) {
for (CartGoods.MaterialGoods materialGoods : cartGoods.getProductMaterialList()) {
ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material material = new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material();
material.setType(1);
......@@ -456,7 +456,7 @@ public class CalculationServiceImpl {
material.setGoodsQuantity(1);
material.setOriginalPrice(null != materialGoods.getOriginalPrice() ?
materialGoods.getOriginalPrice() : 0);
material.setNowPrice(materialGoods.getFinalPrice().intValue());
material.setNowPrice(null != materialGoods.getFinalPrice() ? materialGoods.getFinalPrice().intValue():0);
materials.add(material);
}
}
......
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