|
@@ -87,6 +87,7 @@ public class CartSellerServiceImpl implements CartSellerService {
|
|
|
// 协销购物车供应商列表
|
|
|
List<CartShopVo> shopInfoList = cartSellerMapper.getSellerCartShops(serviceProviderId, clubId);
|
|
|
if (null != shopInfoList && shopInfoList.size()>0) {
|
|
|
+ shopInfoList.removeIf(Objects::isNull);
|
|
|
// 遍历供应商列表
|
|
|
shopInfoList.forEach(shop -> {
|
|
|
// 默认未选中状态(前端要求)
|
|
@@ -219,10 +220,10 @@ public class CartSellerServiceImpl implements CartSellerService {
|
|
|
// 删除空数据
|
|
|
shopInfoList.removeIf(shop -> (null == shop || shop.getCount() == 0));
|
|
|
}
|
|
|
- PageInfo<CartShopVo> pageInfo = null;
|
|
|
- if (null != shopInfoList && shopInfoList.size()>0){
|
|
|
- pageInfo = new PageInfo(shopInfoList);
|
|
|
+ if (null == shopInfoList){
|
|
|
+ shopInfoList = new ArrayList<>();
|
|
|
}
|
|
|
+ PageInfo<CartShopVo> pageInfo = new PageInfo(shopInfoList);
|
|
|
/*
|
|
|
* 返回结果
|
|
|
*/
|
|
@@ -292,6 +293,7 @@ public class CartSellerServiceImpl implements CartSellerService {
|
|
|
*/
|
|
|
private void addSellerCart(SellerCartDto sellerCartDto) {
|
|
|
SellerCartPo cart = cartSellerMapper.getSellerCart(sellerCartDto);
|
|
|
+
|
|
|
if (cart != null) {
|
|
|
// 购物车已存在该商品,更新数量
|
|
|
cart.setNum(cart.getNum() + sellerCartDto.getProductCount());
|
|
@@ -299,8 +301,10 @@ public class CartSellerServiceImpl implements CartSellerService {
|
|
|
cartSellerMapper.updateSellerCart(cart);
|
|
|
} else {
|
|
|
// 添加新购物车
|
|
|
+ Integer shopId = baseMapper.getShopIdByproductId(sellerCartDto.getProductId());
|
|
|
cart = new SellerCartPo();
|
|
|
cart.setServiceProviderId(sellerCartDto.getServiceProviderId());
|
|
|
+ cart.setShopId(shopId);
|
|
|
cart.setClubId(sellerCartDto.getClubId());
|
|
|
cart.setProductId(sellerCartDto.getProductId());
|
|
|
cart.setNum(sellerCartDto.getProductCount());
|
|
@@ -324,7 +328,7 @@ public class CartSellerServiceImpl implements CartSellerService {
|
|
|
if (!sellerCartDto.getServiceProviderId().equals(cart.getServiceProviderId())) {
|
|
|
return ResponseJson.error("协销Id不正确!",null);
|
|
|
}
|
|
|
- cart.setNum(cart.getNum() + sellerCartDto.getProductCount());
|
|
|
+ cart.setNum(sellerCartDto.getProductCount());
|
|
|
cart.setAddTime(new Date());
|
|
|
cartSellerMapper.updateSellerCart(cart);
|
|
|
return ResponseJson.success(0);
|
|
@@ -703,10 +707,12 @@ public class CartSellerServiceImpl implements CartSellerService {
|
|
|
return ResponseJson.error("订单异常或不存在!", null);
|
|
|
}
|
|
|
List<CartItemVo> productList = cartSellerMapper.getOrderProductNum(againBuyDto.getOrderId());
|
|
|
+ // 移除运费商品
|
|
|
+ productList.removeIf(cartItemVo -> (null == cartItemVo || null == cartItemVo.getValidFlag() || cartItemVo.getProductId() == 999));
|
|
|
// 总商品种类数量
|
|
|
int total = productList.size();
|
|
|
// 移除失效商品
|
|
|
- productList.removeIf(cartItemVo -> (null == cartItemVo || null == cartItemVo.getValidFlag() || (cartItemVo.getValidFlag() != 2 && cartItemVo.getValidFlag() != 3 && cartItemVo.getValidFlag() != 9)));
|
|
|
+ productList.removeIf(cartItemVo -> (cartItemVo.getValidFlag() != 2 && cartItemVo.getValidFlag() != 3 && cartItemVo.getValidFlag() != 9));
|
|
|
// 失效商品数量
|
|
|
int invalid = total - productList.size();
|
|
|
if (productList.size() == 0) {
|