|
@@ -538,21 +538,36 @@ public class CartClubServiceImpl implements CartClubService {
|
|
|
List<Integer> promotionsIds = new ArrayList<>();
|
|
|
// 用户身份
|
|
|
Integer userIdentity = baseMapper.getIdentityByUserId(userId);
|
|
|
+ // 会员机构类型:1医美,2生美
|
|
|
+ Integer userClubType = 0;
|
|
|
+ if (null != userIdentity && userIdentity == 2) {
|
|
|
+ userClubType = cartClubMapper.getClubTypeById(userId);
|
|
|
+ userClubType = null == userClubType ? 0 : userClubType;
|
|
|
+ }
|
|
|
// 超级会员标识
|
|
|
Integer svipUserId = baseMapper.getSvipUserIdByUserId(userId);
|
|
|
boolean svipUserFlag = null != svipUserId;
|
|
|
// 获取购物车商品列表(不区分供应商)
|
|
|
cartList = cartClubMapper.getCartProductList(userId);
|
|
|
if (null != cartList && cartList.size() > 0) {
|
|
|
- // 移除价格不可见商品
|
|
|
- cartList.removeIf(cartItemVo -> !(cartItemVo.getPriceFlag() == 0 || (cartItemVo.getPriceFlag() == 2 && (userIdentity == 2 || svipUserFlag))));
|
|
|
+ // 移除不可见商品,价格不可见商品,无库存
|
|
|
+ Integer finalUserClubType = userClubType;
|
|
|
+ Integer finalUserIdentity = userIdentity;
|
|
|
+ cartList.removeIf(cartItemVo -> !(
|
|
|
+ // visibility商品可见度: 3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
|
|
|
+ (cartItemVo.getVisibility() == 3 || cartItemVo.getVisibility()==2 || (cartItemVo.getVisibility() == 1 && finalUserIdentity == 2) || (cartItemVo.getVisibility() == 4 && finalUserClubType == 1))
|
|
|
+ // 价格可见度: 0公开价格,1不公开价格,2仅对会员机构公开,3仅对医美机构公开
|
|
|
+ || (cartItemVo.getPriceFlag() == 0 || (cartItemVo.getPriceFlag() == 2 && (finalUserIdentity == 2 || svipUserFlag)) || (cartItemVo.getPriceFlag() == 3 && finalUserClubType == 1))
|
|
|
+ // 是否库存充足
|
|
|
+ || (cartItemVo.getStock() != null && cartItemVo.getStock() > 0 && cartItemVo.getStock() >= cartItemVo.getMin() && cartItemVo.getStock() >= cartItemVo.getNumber())
|
|
|
+ ));
|
|
|
cartList.forEach(cartItemVo -> {
|
|
|
// 设置商品图片及税费
|
|
|
boolean taxFlag = productService.setCartItemImgAndTax(cartItemVo);
|
|
|
// 获取商品促销信息
|
|
|
PromotionsVo promotions = baseMapper.getPromotionByProductId(cartItemVo.getProductId());
|
|
|
// 如果促销活动协销不可见,移除促销
|
|
|
- if (promotions != null && promotions.getSeen() != null && promotions.getSeen() == 2 && userIdentity == 1) {
|
|
|
+ if (promotions != null && promotions.getSeen() != null && promotions.getSeen() == 2 && finalUserIdentity == 1) {
|
|
|
promotions = null;
|
|
|
}
|
|
|
/*
|