Commit 76b74062 by yu.sun

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

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