Commit af20b456 by 张跃

加价购优化

parent 914c42a5
......@@ -72,11 +72,15 @@ public class ShoppingBaseServiceImpl implements ShoppingCartService {
@Override
public void updateForPopupWindow(BaseListCartGoodsVO baseListCartGoodsVO, Integer showType, List<PremiumExchangeResponseVo.PremiumExchangeProduct> chooseSendGoodList, List<ListCartGoodsBO.SendGoods> sendGoods) {
if(Integer.valueOf("5").equals(showType) && !org.springframework.util.CollectionUtils.isEmpty(chooseSendGoodList)){
chooseSendGoodList.forEach(good->{
ListCartGoodsBO.SendGoods first =null;
if(sendGoods !=null) {
first = sendGoods.stream().filter(a -> a.getGoodsId().equals(good.getPid())).findFirst().orElseGet(null);
if (Integer.valueOf("5").equals(showType) && !org.springframework.util.CollectionUtils.isEmpty(chooseSendGoodList)) {
chooseSendGoodList.forEach(good -> {
ListCartGoodsBO.SendGoods first = null;
if (sendGoods != null) {
if (sendGoods.stream().filter(a -> a.getGoodsId().equals(good.getPid())).findFirst().isPresent()) {
first = sendGoods.stream().filter(a -> a.getGoodsId().equals(good.getPid())).findFirst().get();
} else {
return;
}
}
CartGoods cartGoods = new CartGoods();
cartGoods.setSpuId(good.getSpuId());
......@@ -90,10 +94,9 @@ public class ShoppingBaseServiceImpl implements ShoppingCartService {
cartGoods.setGoodsId(good.getPid());
cartGoods.setName(good.getName());
cartGoods.setSpuName(good.getSpuName());
cartGoods.setQty(first==null ? 1:first.getQty());
if(first != null) {
cartGoods.setQty(first == null ? 1 : first.getQty());
cartGoods.setActivityCode(first.getActivityCode());
if(!CollectionUtils.isEmpty(first.getAttributes())){
if (!CollectionUtils.isEmpty(first.getAttributes())) {
List<CartGoods.CartGoodsExtra> extra = new ArrayList();
first.getAttributes().forEach(attribute -> {
CartGoods.CartGoodsExtra goodsExtra = new CartGoods.CartGoodsExtra();
......@@ -103,7 +106,6 @@ public class ShoppingBaseServiceImpl implements ShoppingCartService {
});
cartGoods.setExtra(extra);
}
}
baseListCartGoodsVO.getProducts().add(cartGoods);
});
}
......
......@@ -786,9 +786,11 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
List<ShoppingCartInfoRequestVo.SendGoods> sendGoods) {
if(Integer.valueOf("5").equals(showType) && !org.springframework.util.CollectionUtils.isEmpty(chooseSendGoodList)){
chooseSendGoodList.forEach(good->{
ShoppingCartInfoRequestVo.SendGoods first =null;
if (sendGoods != null) {
first = sendGoods.stream().filter(a -> a.getGoodsId().equals(good.getPid())).findFirst().orElseGet(null);
ShoppingCartInfoRequestVo.SendGoods first = null;
if (sendGoods.stream().filter(a -> a.getGoodsId().equals(good.getPid())).findFirst().isPresent()) {
first = sendGoods.stream().filter(a -> a.getGoodsId().equals(good.getPid())).findFirst().get();
} else {
return;
}
CartGoods cartGoods = new CartGoods();
cartGoods.setSpuId(good.getSpuId());
......@@ -802,10 +804,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
cartGoods.setGoodsId(good.getPid());
cartGoods.setName(good.getName());
cartGoods.setSpuName(good.getSpuName());
cartGoods.setQty(first==null ? 1:first.getQty());
if(first != null) {
cartGoods.setQty(first == null ? 1 : first.getQty());
cartGoods.setActivityCode(first.getActivityCode());
if(!CollectionUtils.isEmpty(first.getAttributes())){
if (!CollectionUtils.isEmpty(first.getAttributes())) {
List<CartGoods.CartGoodsExtra> extra = new ArrayList();
first.getAttributes().forEach(attribute -> {
CartGoods.CartGoodsExtra goodsExtra = new CartGoods.CartGoodsExtra();
......@@ -815,7 +816,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
});
cartGoods.setExtra(extra);
}
}
shoppingCartGoodsResponseVo.getProducts().add(cartGoods);
});
}
......
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