Commit 1e589a0f by yu.sun

sunyu::update::fix bug about specialAttribute copyOrder

parent 5ab3f7a2
...@@ -61,6 +61,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -61,6 +61,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.json.JSONString;
import org.springframework.beans.factory.annotation.Autowired; 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;
...@@ -860,12 +861,18 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -860,12 +861,18 @@ public class ShoppingCartMCoffeeServiceImpl {
//特制 //特制
if (StringUtils.isNotEmpty(orderItem.getExtInfo())){ if (StringUtils.isNotEmpty(orderItem.getExtInfo())){
JSONObject extJson = JSONObject.parseObject(orderItem.getExtInfo()); JSONObject extJson = JSONObject.parseObject(orderItem.getExtInfo());
if (extJson.containsKey("specialAttrs")) {
CartGoods.SpecialExtra specialExtra = new CartGoods.SpecialExtra(); CartGoods.SpecialExtra specialExtra = new CartGoods.SpecialExtra();
JSONArray specialAttrs = JSONArray.parseArray(extJson.getString("specialAttrs"));
for (Object specialAttr : specialAttrs) {
JSONObject object = JSONObject.parseObject(specialAttr.toString());
specialExtra.setAttributeId(extJson.containsKey("attributeId") ? extJson.getString("attributeId") : ""); specialExtra.setAttributeId(extJson.containsKey("attributeId") ? extJson.getString("attributeId") : "");
specialExtra.setAttributeName(extJson.containsKey("attributeName") ? extJson.getString("attributeName") : ""); specialExtra.setAttributeName(extJson.containsKey("attributeName") ? extJson.getString("attributeName") : "");
specialExtra.setAttributeId(extJson.containsKey("specialCode") ? extJson.getString("specialCode") : ""); specialExtra.setAttributeId(extJson.containsKey("specialCode") ? extJson.getString("specialCode") : "");
}
cartGoods.setSpecialExtra(Arrays.asList(specialExtra)); cartGoods.setSpecialExtra(Arrays.asList(specialExtra));
} }
}
if (ObjectUtils.equals(88, orderItem.getProductType())) { if (ObjectUtils.equals(88, orderItem.getProductType())) {
// 获取套餐子商品列表 // 获取套餐子商品列表
...@@ -909,11 +916,17 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -909,11 +916,17 @@ public class ShoppingCartMCoffeeServiceImpl {
//特制 //特制
if (StringUtils.isNotEmpty(itemResp.getExtInfo())){ if (StringUtils.isNotEmpty(itemResp.getExtInfo())){
JSONObject extJson = JSONObject.parseObject(itemResp.getExtInfo()); JSONObject extJson = JSONObject.parseObject(itemResp.getExtInfo());
if (extJson.containsKey("specialAttrs")) {
CartGoods.SpecialExtra specialExtra = new CartGoods.SpecialExtra(); CartGoods.SpecialExtra specialExtra = new CartGoods.SpecialExtra();
JSONArray specialAttrs = JSONArray.parseArray(extJson.getString("specialAttrs"));
for (Object specialAttr : specialAttrs) {
JSONObject object = JSONObject.parseObject(specialAttr.toString());
specialExtra.setAttributeId(extJson.containsKey("attributeId") ? extJson.getString("attributeId") : ""); specialExtra.setAttributeId(extJson.containsKey("attributeId") ? extJson.getString("attributeId") : "");
specialExtra.setAttributeName(extJson.containsKey("attributeName") ? extJson.getString("attributeName") : ""); specialExtra.setAttributeName(extJson.containsKey("attributeName") ? extJson.getString("attributeName") : "");
specialExtra.setAttributeId(extJson.containsKey("specialCode") ? extJson.getString("specialCode") : ""); specialExtra.setAttributeId(extJson.containsKey("specialCode") ? extJson.getString("specialCode") : "");
comboxGoods.setSpecialExtra(Arrays.asList(specialExtra)); }
cartGoods.setSpecialExtra(Arrays.asList(specialExtra));
}
} }
} }
......
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