Commit d4acd63c by yu.sun

sunyu::update::fix bug about specialAttribute copyOrder

parent ba4c77a2
...@@ -821,12 +821,18 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -821,12 +821,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();
specialExtra.setAttributeId(extJson.containsKey("attributeId") ? extJson.getString("attributeId") : ""); JSONArray specialAttrs = JSONArray.parseArray(extJson.getString("specialAttrs"));
specialExtra.setAttributeName(extJson.containsKey("attributeName") ? extJson.getString("attributeName") : ""); for (Object specialAttr : specialAttrs) {
specialExtra.setAttributeId(extJson.containsKey("specialCode") ? extJson.getString("specialCode") : ""); JSONObject object = JSONObject.parseObject(specialAttr.toString());
specialExtra.setAttributeId(object.containsKey("attributeId") ? object.getString("attributeId") : "");
specialExtra.setAttributeName(object.containsKey("attributeName") ? object.getString("attributeName") : "");
specialExtra.setAttributeId(object.containsKey("specialCode") ? object.getString("specialCode") : "");
}
cartGoods.setSpecialExtra(Arrays.asList(specialExtra)); cartGoods.setSpecialExtra(Arrays.asList(specialExtra));
} }
}
if (ObjectUtils.equals(88, orderItem.getProductType())) { if (ObjectUtils.equals(88, orderItem.getProductType())) {
// 获取套餐子商品列表 // 获取套餐子商品列表
...@@ -861,17 +867,24 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -861,17 +867,24 @@ 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());
if (extJson.containsKey("specialAttrs")) {
CartGoods.SpecialExtra specialExtra = new CartGoods.SpecialExtra(); CartGoods.SpecialExtra specialExtra = new CartGoods.SpecialExtra();
specialExtra.setAttributeId(extJson.containsKey("attributeId") ? extJson.getString("attributeId") : ""); JSONArray specialAttrs = JSONArray.parseArray(extJson.getString("specialAttrs"));
specialExtra.setAttributeName(extJson.containsKey("attributeName") ? extJson.getString("attributeName") : ""); for (Object specialAttr : specialAttrs) {
specialExtra.setAttributeId(extJson.containsKey("specialCode") ? extJson.getString("specialCode") : ""); JSONObject object = JSONObject.parseObject(specialAttr.toString());
specialExtra.setAttributeId(object.containsKey("attributeId") ? extJson.getString("attributeId") : "");
specialExtra.setAttributeName(object.containsKey("attributeName") ? extJson.getString("attributeName") : "");
specialExtra.setAttributeId(object.containsKey("specialCode") ? extJson.getString("specialCode") : "");
}
comboxGoods.setSpecialExtra(Arrays.asList(specialExtra)); comboxGoods.setSpecialExtra(Arrays.asList(specialExtra));
} }
} }
}
Map<String, Object> map = JSONObject.parseObject(orderItemResp.getExtInfo(), Map.class); Map<String, Object> map = JSONObject.parseObject(orderItemResp.getExtInfo(), Map.class);
if (map.containsKey("isFixedProduct") && (boolean) map.get("isFixedProduct")) { if (map.containsKey("isFixedProduct") && (boolean) map.get("isFixedProduct")) {
......
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