Commit 76b74062 by yu.sun

Merge branch 'feature-yu.sun-material-20201030'

parents fca7721c 2567effe
...@@ -687,6 +687,7 @@ public class ShoppingCartConvertAdapter { ...@@ -687,6 +687,7 @@ public class ShoppingCartConvertAdapter {
Long finalPrice = isComboxGoods ? productComboType.getFinalPrice().longValue() : groupDetailType.getMarkUpPrice().longValue(); Long finalPrice = isComboxGoods ? productComboType.getFinalPrice().longValue() : groupDetailType.getMarkUpPrice().longValue();
// 设置商品详情 // 设置商品详情
Map<String, String> attributes = getAttributesNew(comboxGoods.getExtra()); Map<String, String> attributes = getAttributesNew(comboxGoods.getExtra());
comboxGoods.setSpuId(comboxGoods.getSpuId());
comboxGoods.setName(isComboxGoods ? productComboType.getProductName() : groupDetailType.getProductName()); comboxGoods.setName(isComboxGoods ? productComboType.getProductName() : groupDetailType.getProductName());
comboxGoods.setSpuName(comboxGoods.getName()); comboxGoods.setSpuName(comboxGoods.getName());
comboxGoods.setSpecProductId(attributes.get(ATTRIBUTEID)); comboxGoods.setSpecProductId(attributes.get(ATTRIBUTEID));
......
...@@ -65,6 +65,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -65,6 +65,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -780,7 +781,9 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -780,7 +781,9 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoodsList, new ArrayList<>(), new ArrayList<>(), shoppingCartGoodsResponseVo,null); cartGoodsList, new ArrayList<>(), new ArrayList<>(), shoppingCartGoodsResponseVo,null);
//设置更新响应信息 //设置更新响应信息
setAddAndUpdateResponse(shoppingCartGoodsResponseVo, cartGoodsList, shoppingCartGoodsResponseVo.getToastMsg(), ShoppingCartConstant.ADD_AND_UPDATE, null); setAddAndUpdateResponse(shoppingCartGoodsResponseVo, cartGoodsList, shoppingCartGoodsResponseVo.getToastMsg(), ShoppingCartConstant.ADD_AND_UPDATE, null);
//再来一单清除配送费
shoppingCartGoodsResponseVo.setDeliveryAmount(0L);
shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(0L);
return ResponseUtil.success(shoppingCartGoodsResponseVo); return ResponseUtil.success(shoppingCartGoodsResponseVo);
} }
...@@ -861,15 +864,24 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -861,15 +864,24 @@ public class ShoppingCartMCoffeeServiceImpl {
comboProducts.forEach(combo -> { comboProducts.forEach(combo -> {
getComboxGoods(cartGoods, combo, orderItemList); getComboxGoods(cartGoods, combo, orderItemList);
}); });
//取所有固定套餐的价格计算套餐总价
Long originalPrice = comboProducts.stream().filter(orderItemResp -> null != orderItemResp.getProductPrice()).mapToLong(orderItemResp ->orderItemResp.getProductPrice().longValue()).sum();
cartGoods.setOriginalPrice(originalPrice);
} }
//特制 //特制
if (StringUtils.isNotEmpty(orderItem.getExtInfo())){ if (StringUtils.isNotEmpty(orderItem.getExtInfo())){
JSONObject extJson = JSONObject.parseObject(orderItem.getExtInfo()); JSONObject extJson = JSONObject.parseObject(orderItem.getExtInfo());
CartGoods.SpecialExtra specialExtra = new CartGoods.SpecialExtra(); if (extJson.containsKey("specialAttrs")) {
specialExtra.setAttributeId(extJson.containsKey("attributeId") ? extJson.getString("attributeId") : ""); CartGoods.SpecialExtra specialExtra = new CartGoods.SpecialExtra();
specialExtra.setAttributeName(extJson.containsKey("attributeName") ? extJson.getString("attributeName") : ""); JSONArray specialAttrs = JSONArray.parseArray(extJson.getString("specialAttrs"));
specialExtra.setAttributeId(extJson.containsKey("specialCode") ? extJson.getString("specialCode") : ""); for (Object specialAttr : specialAttrs) {
cartGoods.setSpecialExtra(Arrays.asList(specialExtra)); JSONObject object = JSONObject.parseObject(specialAttr.toString());
specialExtra.setAttributeId(object.containsKey("attributeId") ? object.getString("attributeId") : "");
specialExtra.setAttributeName(object.containsKey("attributeName") ? object.getString("attributeName") : "");
specialExtra.setSpecialCode(object.containsKey("specialCode") ? object.getString("specialCode") : "");
}
cartGoods.setSpecialExtra(Arrays.asList(specialExtra));
}
} }
if (ObjectUtils.equals(88, orderItem.getProductType())) { if (ObjectUtils.equals(88, orderItem.getProductType())) {
...@@ -910,15 +922,22 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -910,15 +922,22 @@ public class ShoppingCartMCoffeeServiceImpl {
} }
comboxGoods.setExtra(extra); comboxGoods.setExtra(extra);
} }
for (OrderItemResp itemResp : orderItemList) { for (OrderItemResp itemResp : orderItemList) {
//特制 //特制
if (StringUtils.isNotEmpty(itemResp.getExtInfo())){ if (StringUtils.isNotEmpty(itemResp.getExtInfo())){
JSONObject extJson = JSONObject.parseObject(itemResp.getExtInfo()); JSONObject extJson = JSONObject.parseObject(itemResp.getExtInfo());
CartGoods.SpecialExtra specialExtra = new CartGoods.SpecialExtra(); if (extJson.containsKey("specialAttrs")) {
specialExtra.setAttributeId(extJson.containsKey("attributeId") ? extJson.getString("attributeId") : ""); CartGoods.SpecialExtra specialExtra = new CartGoods.SpecialExtra();
specialExtra.setAttributeName(extJson.containsKey("attributeName") ? extJson.getString("attributeName") : ""); JSONArray specialAttrs = JSONArray.parseArray(extJson.getString("specialAttrs"));
specialExtra.setAttributeId(extJson.containsKey("specialCode") ? extJson.getString("specialCode") : ""); for (Object specialAttr : specialAttrs) {
comboxGoods.setSpecialExtra(Arrays.asList(specialExtra)); JSONObject object = JSONObject.parseObject(specialAttr.toString());
specialExtra.setAttributeId(object.containsKey("attributeId") ? object.getString("attributeId") : "");
specialExtra.setAttributeName(object.containsKey("attributeName") ? object.getString("attributeName") : "");
specialExtra.setSpecialCode(object.containsKey("specialCode") ? object.getString("specialCode") : "");
}
comboxGoods.setSpecialExtra(Arrays.asList(specialExtra));
}
} }
} }
......
...@@ -423,6 +423,9 @@ public class CalculationServiceImpl { ...@@ -423,6 +423,9 @@ public class CalculationServiceImpl {
//加料 //加料
if (CollectionUtils.isNotEmpty(materialGoods.getProductMaterialList())) { if (CollectionUtils.isNotEmpty(materialGoods.getProductMaterialList())) {
for (CartGoods.MaterialGoods materialGoods2 : materialGoods.getProductMaterialList()) { for (CartGoods.MaterialGoods materialGoods2 : materialGoods.getProductMaterialList()) {
if (StringUtils.isEmpty(materialGoods2.getSpuId())) {
continue;
}
ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material material = new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material(); ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material material = new ActivityCalculationDiscountRequestDto.CalculationDiscountGoods.Material();
material.setType(1); material.setType(1);
material.setGoodsId(materialGoods2.getSpuId()); material.setGoodsId(materialGoods2.getSpuId());
......
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