Commit f1bd5692 by ping.wu

定制属性不一致商品非同一个商品

parent 7135b453
...@@ -345,6 +345,9 @@ public class CartGoods { ...@@ -345,6 +345,9 @@ public class CartGoods {
if (CollectionUtils.isNotEmpty(extra)) { if (CollectionUtils.isNotEmpty(extra)) {
extra.stream().sorted(Comparator.comparing(CartGoodsExtra::getAttributeId)).forEach(e -> sb.append(e.getAttributeId())); extra.stream().sorted(Comparator.comparing(CartGoodsExtra::getAttributeId)).forEach(e -> sb.append(e.getAttributeId()));
} }
if (CollectionUtils.isNotEmpty(specialExtra)) {
specialExtra.stream().sorted(Comparator.comparing(SpecialExtra::getAttributeId)).forEach(e -> sb.append(e.getAttributeId()));
}
return sb.toString(); return sb.toString();
} }
} }
...@@ -366,6 +369,9 @@ public class CartGoods { ...@@ -366,6 +369,9 @@ public class CartGoods {
if (CollectionUtils.isNotEmpty(productComboList)) { if (CollectionUtils.isNotEmpty(productComboList)) {
for (ComboxGoods goods : productComboList) { for (ComboxGoods goods : productComboList) {
originalString.append(goods.toString()); originalString.append(goods.toString());
if (CollectionUtils.isNotEmpty(goods.getSpecialExtra())) {
goods.getSpecialExtra().stream().sorted(Comparator.comparing(SpecialExtra::getAttributeId)).forEach(e -> originalString.append(e.getAttributeId()));
}
} }
} }
if (CollectionUtils.isNotEmpty(productGroupList)) { if (CollectionUtils.isNotEmpty(productGroupList)) {
...@@ -376,6 +382,9 @@ public class CartGoods { ...@@ -376,6 +382,9 @@ public class CartGoods {
if (CollectionUtils.isNotEmpty(productMaterialList)) { if (CollectionUtils.isNotEmpty(productMaterialList)) {
productMaterialList.stream().sorted(Comparator.comparing(MaterialGoods::getSpuId)).forEach(e -> originalString.append(e.getSpuId())); productMaterialList.stream().sorted(Comparator.comparing(MaterialGoods::getSpuId)).forEach(e -> originalString.append(e.getSpuId()));
} }
if (CollectionUtils.isNotEmpty(specialExtra)) {
specialExtra.stream().sorted(Comparator.comparing(SpecialExtra::getAttributeId)).forEach(e -> originalString.append(e.getAttributeId()));
}
//当前字符串 //当前字符串
CartGoods cartGoods = (CartGoods) o; CartGoods cartGoods = (CartGoods) o;
...@@ -388,6 +397,9 @@ public class CartGoods { ...@@ -388,6 +397,9 @@ public class CartGoods {
if (CollectionUtils.isNotEmpty(cartGoods.getProductComboList())) { if (CollectionUtils.isNotEmpty(cartGoods.getProductComboList())) {
for (ComboxGoods goods : cartGoods.getProductComboList()) { for (ComboxGoods goods : cartGoods.getProductComboList()) {
currentString.append(goods.toString()); currentString.append(goods.toString());
if (CollectionUtils.isNotEmpty(goods.getSpecialExtra())) {
goods.getSpecialExtra().stream().sorted(Comparator.comparing(SpecialExtra::getAttributeId)).forEach(e -> currentString.append(e.getAttributeId()));
}
} }
} }
if (CollectionUtils.isNotEmpty(cartGoods.getProductGroupList())) { if (CollectionUtils.isNotEmpty(cartGoods.getProductGroupList())) {
...@@ -398,6 +410,9 @@ public class CartGoods { ...@@ -398,6 +410,9 @@ public class CartGoods {
if (CollectionUtils.isNotEmpty(cartGoods.getProductMaterialList())) { if (CollectionUtils.isNotEmpty(cartGoods.getProductMaterialList())) {
cartGoods.getProductMaterialList().stream().sorted(Comparator.comparing(MaterialGoods::getSpuId)).forEach(e -> currentString.append(e.getSpuId())); cartGoods.getProductMaterialList().stream().sorted(Comparator.comparing(MaterialGoods::getSpuId)).forEach(e -> currentString.append(e.getSpuId()));
} }
if (CollectionUtils.isNotEmpty(cartGoods.getSpecialExtra())) {
cartGoods.getSpecialExtra().stream().sorted(Comparator.comparing(SpecialExtra::getAttributeId)).forEach(e -> currentString.append(e.getAttributeId()));
}
return StringUtils.equals(originalString.toString(), currentString.toString()); return StringUtils.equals(originalString.toString(), currentString.toString());
} }
......
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