|
@@ -899,6 +899,9 @@ public class CartClubServiceImpl implements CartClubService {
|
|
if(!(cartItemVo.getStock() != null && cartItemVo.getStock() > 0 && cartItemVo.getStock() >= cartItemVo.getMin() && cartItemVo.getStock() >= cartItemVo.getNumber())){
|
|
if(!(cartItemVo.getStock() != null && cartItemVo.getStock() > 0 && cartItemVo.getStock() >= cartItemVo.getMin() && cartItemVo.getStock() >= cartItemVo.getNumber())){
|
|
return ResponseJson.error("商品库存不足!", null);
|
|
return ResponseJson.error("商品库存不足!", null);
|
|
}
|
|
}
|
|
|
|
+ // 供应商Id集合,用户判断赠品供应商是否在当前供应商中
|
|
|
|
+ List<Integer> shopIds = new ArrayList<>();
|
|
|
|
+ shopIds.add(shop.getShopId());
|
|
List<CartShopVo> shopList = new ArrayList<>();
|
|
List<CartShopVo> shopList = new ArrayList<>();
|
|
// 设置商品图片及税费
|
|
// 设置商品图片及税费
|
|
boolean taxFlag = productService.setCartItemImgAndTax(cartItemVo);
|
|
boolean taxFlag = productService.setCartItemImgAndTax(cartItemVo);
|
|
@@ -939,14 +942,17 @@ public class CartClubServiceImpl implements CartClubService {
|
|
// 满赠
|
|
// 满赠
|
|
List<CartItemVo> giftList = baseMapper.getPromotionGifts(promotions.getId());
|
|
List<CartItemVo> giftList = baseMapper.getPromotionGifts(promotions.getId());
|
|
giftList.forEach(gift -> {
|
|
giftList.forEach(gift -> {
|
|
- if (shop.getShopId().equals(gift.getShopId())) {
|
|
|
|
|
|
+ if (shopIds.contains(gift.getShopId())) {
|
|
// 赠品在当前订单内的供应商下
|
|
// 赠品在当前订单内的供应商下
|
|
- if (shop.getShopId().equals(gift.getShopId())) {
|
|
|
|
- shop.getCartList().add(gift);
|
|
|
|
- }
|
|
|
|
|
|
+ shopList.forEach(s -> {
|
|
|
|
+ if (s.getShopId().equals(gift.getShopId())) {
|
|
|
|
+ s.getCartList().add(gift);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
} else {
|
|
} else {
|
|
// 获取赠品供应商
|
|
// 获取赠品供应商
|
|
CartShopVo giftShop = baseMapper.getShopByProductId(gift.getProductId());
|
|
CartShopVo giftShop = baseMapper.getShopByProductId(gift.getProductId());
|
|
|
|
+ shopIds.add(giftShop.getShopId());
|
|
giftShop.setCartList(new ArrayList<>());
|
|
giftShop.setCartList(new ArrayList<>());
|
|
giftShop.getCartList().add(gift);
|
|
giftShop.getCartList().add(gift);
|
|
shopList.add(giftShop);
|
|
shopList.add(giftShop);
|