|
@@ -14,6 +14,7 @@ import com.zbkj.common.constants.ProductConstants;
|
|
|
import com.zbkj.common.constants.RedisConstants;
|
|
|
import com.zbkj.common.exception.CrmebException;
|
|
|
import com.zbkj.common.model.cat.Cart;
|
|
|
+import com.zbkj.common.model.cat.CartShare;
|
|
|
import com.zbkj.common.model.merchant.Merchant;
|
|
|
import com.zbkj.common.model.product.Product;
|
|
|
import com.zbkj.common.model.product.ProductAttrValue;
|
|
@@ -25,6 +26,7 @@ import com.zbkj.common.response.CartInfoResponse;
|
|
|
import com.zbkj.common.response.CartMerchantResponse;
|
|
|
import com.zbkj.common.utils.RedisUtil;
|
|
|
import com.zbkj.service.dao.CartDao;
|
|
|
+import com.zbkj.service.dao.CartShareDao;
|
|
|
import com.zbkj.service.service.*;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -47,6 +49,8 @@ public class CartServiceImpl extends ServiceImpl<CartDao, Cart> implements CartS
|
|
|
|
|
|
@Resource
|
|
|
private CartDao dao;
|
|
|
+ @Autowired
|
|
|
+ private CartShareDao cartShareDao;
|
|
|
|
|
|
@Autowired
|
|
|
private ProductService productService;
|
|
@@ -129,24 +133,24 @@ public class CartServiceImpl extends ServiceImpl<CartDao, Cart> implements CartS
|
|
|
public List<CartMerchantResponse> getList2(List<Integer> ids) {
|
|
|
Integer userId = userService.getUserIdException();
|
|
|
//带 StoreCart 类的多条件查询
|
|
|
- LambdaQueryWrapper<Cart> lqw = new LambdaQueryWrapper<>();
|
|
|
+ LambdaQueryWrapper<CartShare> lqw = new LambdaQueryWrapper<>();
|
|
|
// lqw.eq(Cart::getUid, userId);
|
|
|
// lqw.eq(Cart::getStatus, isValid);
|
|
|
- lqw.in(Cart::getId, ids);
|
|
|
- lqw.orderByDesc(Cart::getId);
|
|
|
- List<Cart> cartList = dao.selectList(lqw);
|
|
|
+ lqw.in(CartShare::getId, ids);
|
|
|
+ lqw.orderByDesc(CartShare::getId);
|
|
|
+ List<CartShare> cartList = cartShareDao.selectList(lqw);
|
|
|
if (CollUtil.isEmpty(cartList)) {
|
|
|
return CollUtil.newArrayList();
|
|
|
}
|
|
|
|
|
|
- List<Integer> merIdList = cartList.stream().map(Cart::getMerId).distinct().collect(Collectors.toList());
|
|
|
+ List<Integer> merIdList = cartList.stream().map(CartShare::getMerId).distinct().collect(Collectors.toList());
|
|
|
Map<Integer, Merchant> merchantMap = merchantService.getMerIdMapByIdList(merIdList);
|
|
|
List<CartMerchantResponse> responseList = CollUtil.newArrayList();
|
|
|
merIdList.forEach(merId -> {
|
|
|
CartMerchantResponse merchantResponse = new CartMerchantResponse();
|
|
|
merchantResponse.setMerId(merId);
|
|
|
merchantResponse.setMerName(merchantMap.get(merId).getName());
|
|
|
- List<Cart> merCartList = cartList.stream().filter(e -> e.getMerId().equals(merId)).collect(Collectors.toList());
|
|
|
+ List<CartShare> merCartList = cartList.stream().filter(e -> e.getMerId().equals(merId)).collect(Collectors.toList());
|
|
|
List<CartInfoResponse> infoResponseList = merCartList.stream().map(storeCart -> {
|
|
|
CartInfoResponse cartInfoResponse = new CartInfoResponse();
|
|
|
BeanUtils.copyProperties(storeCart, cartInfoResponse);
|