|
@@ -146,7 +146,7 @@ public class CartClubServiceImpl implements CartClubService {
|
|
|
boolean taxFlag = productService.setCartItemImgAndTax(cartItemVo);
|
|
|
// 商品可见度: 3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
|
|
|
Integer visibility = cartItemVo.getVisibility();
|
|
|
- boolean visibleFlag = visibility == 3 || visibility==2 || (visibility == 1 && (finalUserIdentity == 2 || svipUserFlag)) || (visibility == 4 && finalUserClubType == 1);
|
|
|
+ boolean visibleFlag = visibility == 3 || visibility == 2 || (visibility == 1 && (finalUserIdentity == 2 || svipUserFlag)) || (visibility == 4 && finalUserClubType == 1);
|
|
|
if (!visibleFlag) {
|
|
|
//不可见商品 不加入失效商品,直接去除
|
|
|
productIterator.remove();
|
|
@@ -554,12 +554,12 @@ public class CartClubServiceImpl implements CartClubService {
|
|
|
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 || svipUserFlag)) || (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())
|
|
|
+ // visibility商品可见度: 3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
|
|
|
+ (cartItemVo.getVisibility() == 3 || cartItemVo.getVisibility() == 2 || (cartItemVo.getVisibility() == 1 && (finalUserIdentity == 2 || svipUserFlag)) || (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 -> {
|
|
|
// 设置商品图片及税费
|
|
@@ -695,9 +695,9 @@ public class CartClubServiceImpl implements CartClubService {
|
|
|
* @param cartDto {
|
|
|
* userId 用户ID
|
|
|
* productInfo 商品及数量信息:[ // 商品id,数量
|
|
|
- * {"productId": 2789, "productCount": 1},
|
|
|
- * {"productId": 2790, "productCount": 1}
|
|
|
- * ]
|
|
|
+ * {"productId": 2789, "productCount": 1},
|
|
|
+ * {"productId": 2790, "productCount": 1}
|
|
|
+ * ]
|
|
|
* }
|
|
|
*/
|
|
|
@Override
|
|
@@ -709,10 +709,10 @@ public class CartClubServiceImpl implements CartClubService {
|
|
|
log.error("批量添加购物车参数解析异常try-catch:", e);
|
|
|
return ResponseJson.error("商品及数量信息参数解析异常!", null);
|
|
|
}
|
|
|
- if (null == productInfo || productInfo.isEmpty()){
|
|
|
+ if (null == productInfo || productInfo.isEmpty()) {
|
|
|
return ResponseJson.error("商品及数量信息参数异常!", null);
|
|
|
}
|
|
|
- for (Object infoObject: productInfo) {
|
|
|
+ for (Object infoObject : productInfo) {
|
|
|
JSONObject tempObj = (JSONObject) infoObject;
|
|
|
Integer productId = (Integer) tempObj.get("productId");
|
|
|
Integer productCount = (Integer) tempObj.get("productCount");
|
|
@@ -812,12 +812,12 @@ public class CartClubServiceImpl implements CartClubService {
|
|
|
int finalUserIdentity = userIdentity;
|
|
|
int finalUserClubType = userClubType;
|
|
|
cartList.removeIf(cartItemVo -> !(
|
|
|
- // visibility商品可见度: 3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
|
|
|
- (cartItemVo.getVisibility() == 3 || cartItemVo.getVisibility()==2 || (cartItemVo.getVisibility() == 1 && (finalUserIdentity == 2 || svipUserFlag)) || (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())
|
|
|
+ // visibility商品可见度: 3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
|
|
|
+ (cartItemVo.getVisibility() == 3 || cartItemVo.getVisibility() == 2 || (cartItemVo.getVisibility() == 1 && (finalUserIdentity == 2 || svipUserFlag)) || (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())
|
|
|
));
|
|
|
return cartList.size();
|
|
|
} else {
|
|
@@ -860,12 +860,16 @@ public class CartClubServiceImpl implements CartClubService {
|
|
|
List<Integer> shopIds = new ArrayList<>();
|
|
|
// 用户身份
|
|
|
Integer userIdentity = baseMapper.getIdentityByUserId(userId);
|
|
|
- if (null == userIdentity) {userIdentity = 0;}
|
|
|
+ if (null == userIdentity) {
|
|
|
+ userIdentity = 0;
|
|
|
+ }
|
|
|
// 会员机构类型:1医美,2生美
|
|
|
Integer userClubType = 0;
|
|
|
if (userIdentity == 2) {
|
|
|
userClubType = cartClubMapper.getClubTypeById(userId);
|
|
|
- if (null == userClubType) {userClubType = 0;}
|
|
|
+ if (null == userClubType) {
|
|
|
+ userClubType = 0;
|
|
|
+ }
|
|
|
}
|
|
|
// 超级会员标识
|
|
|
Integer svipUserId = baseMapper.getSvipUserIdByUserId(userId);
|
|
@@ -911,7 +915,7 @@ public class CartClubServiceImpl implements CartClubService {
|
|
|
List<CartItemVo> productList = cartClubMapper.getCartProductsByShopIdAndProductIds(userId, shop.getShopId(), finalIdList);
|
|
|
if (null != productList && productList.size() > 0) {
|
|
|
// 去除不可见商品,visibility商品可见度: 3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
|
|
|
- productList.removeIf(cartItemVo -> !(cartItemVo.getVisibility() == 3 || cartItemVo.getVisibility()==2 || (cartItemVo.getVisibility() == 1 && (finalUserIdentity == 2 || svipUserFlag)) || (cartItemVo.getVisibility() == 4 && finalUserClubType == 1)));
|
|
|
+ productList.removeIf(cartItemVo -> !(cartItemVo.getVisibility() == 3 || cartItemVo.getVisibility() == 2 || (cartItemVo.getVisibility() == 1 && (finalUserIdentity == 2 || svipUserFlag)) || (cartItemVo.getVisibility() == 4 && finalUserClubType == 1)));
|
|
|
// 去除价格不可见商品,价格可见度: 0公开价格,1不公开价格,2仅对会员机构公开,3仅对医美机构公开
|
|
|
productList.removeIf(cartItemVo -> !(cartItemVo.getPriceFlag() == 0 || (cartItemVo.getPriceFlag() == 2 && (finalUserIdentity == 2 || svipUserFlag)) || (cartItemVo.getPriceFlag() == 3 && finalUserClubType == 1)));
|
|
|
// 去除库存不足商品
|
|
@@ -1212,12 +1216,16 @@ public class CartClubServiceImpl implements CartClubService {
|
|
|
List<String> productIdList = new ArrayList<>();
|
|
|
// 用户身份
|
|
|
Integer userIdentity = baseMapper.getIdentityByUserId(userId);
|
|
|
- if (null == userIdentity) {userIdentity = 0;}
|
|
|
+ if (null == userIdentity) {
|
|
|
+ userIdentity = 0;
|
|
|
+ }
|
|
|
// 会员机构类型:1医美,2生美
|
|
|
Integer userClubType = 0;
|
|
|
if (userIdentity == 2) {
|
|
|
userClubType = cartClubMapper.getClubTypeById(userId);
|
|
|
- if (null == userClubType) {userClubType = 0;}
|
|
|
+ if (null == userClubType) {
|
|
|
+ userClubType = 0;
|
|
|
+ }
|
|
|
}
|
|
|
// 超级会员标识
|
|
|
Integer svipUserId = baseMapper.getSvipUserIdByUserId(userId);
|
|
@@ -1271,7 +1279,7 @@ public class CartClubServiceImpl implements CartClubService {
|
|
|
productList.forEach(p -> p.setNumber(productInfos.get(p.getProductId().toString())));
|
|
|
if (null != productList && productList.size() > 0) {
|
|
|
// 去除不可见商品,visibility商品可见度: 3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
|
|
|
- productList.removeIf(cartItemVo -> !(cartItemVo.getVisibility() == 3 || cartItemVo.getVisibility()==2 || (cartItemVo.getVisibility() == 1 && (finalUserIdentity == 2 || svipUserFlag)) || (cartItemVo.getVisibility() == 4 && finalUserClubType == 1)));
|
|
|
+ productList.removeIf(cartItemVo -> !(cartItemVo.getVisibility() == 3 || cartItemVo.getVisibility() == 2 || (cartItemVo.getVisibility() == 1 && (finalUserIdentity == 2 || svipUserFlag)) || (cartItemVo.getVisibility() == 4 && finalUserClubType == 1)));
|
|
|
// 去除价格不可见商品,价格可见度: 0公开价格,1不公开价格,2仅对会员机构公开,3仅对医美机构公开
|
|
|
productList.removeIf(cartItemVo -> !(cartItemVo.getPriceFlag() == 0 || (cartItemVo.getPriceFlag() == 2 && (finalUserIdentity == 2 || svipUserFlag)) || (cartItemVo.getPriceFlag() == 3 && finalUserClubType == 1)));
|
|
|
// 去除库存不足商品
|
|
@@ -1557,22 +1565,26 @@ public class CartClubServiceImpl implements CartClubService {
|
|
|
}
|
|
|
// 用户身份
|
|
|
Integer userIdentity = baseMapper.getIdentityByUserId(cartDto.getUserId());
|
|
|
- if (null == userIdentity) {userIdentity = 0;}
|
|
|
+ if (null == userIdentity) {
|
|
|
+ userIdentity = 0;
|
|
|
+ }
|
|
|
// 会员机构类型:1医美,2生美
|
|
|
Integer userClubType = 0;
|
|
|
if (userIdentity == 2) {
|
|
|
userClubType = cartClubMapper.getClubTypeById(cartDto.getUserId());
|
|
|
- if (null == userClubType) {userClubType = 0;}
|
|
|
+ if (null == userClubType) {
|
|
|
+ userClubType = 0;
|
|
|
+ }
|
|
|
}
|
|
|
// 超级会员标识
|
|
|
Integer svipUserId = baseMapper.getSvipUserIdByUserId(cartDto.getUserId());
|
|
|
boolean svipUserFlag = null != svipUserId;
|
|
|
// visibility商品可见度: 3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
|
|
|
- if (!(cartItemVo.getVisibility() == 3 || cartItemVo.getVisibility()==2 || (cartItemVo.getVisibility() == 1 && (userIdentity == 2 || svipUserFlag)) || (cartItemVo.getVisibility() == 4 && userClubType == 1))){
|
|
|
+ if (!(cartItemVo.getVisibility() == 3 || cartItemVo.getVisibility() == 2 || (cartItemVo.getVisibility() == 1 && (userIdentity == 2 || svipUserFlag)) || (cartItemVo.getVisibility() == 4 && userClubType == 1))) {
|
|
|
return ResponseJson.error("商品不可见!", null);
|
|
|
}
|
|
|
// 价格可见度: 0公开价格,1不公开价格,2仅对会员机构公开,3仅对医美机构公开
|
|
|
- if (!(cartItemVo.getPriceFlag() == 0 || (cartItemVo.getPriceFlag() == 2 && (userIdentity == 2 || svipUserFlag)) || (cartItemVo.getPriceFlag() == 3 && userClubType == 1))){
|
|
|
+ if (!(cartItemVo.getPriceFlag() == 0 || (cartItemVo.getPriceFlag() == 2 && (userIdentity == 2 || svipUserFlag)) || (cartItemVo.getPriceFlag() == 3 && userClubType == 1))) {
|
|
|
return ResponseJson.error("商品价格不可见!", null);
|
|
|
}
|
|
|
cartItemVo.setNumber(cartDto.getProductCount());
|
|
@@ -1892,6 +1904,7 @@ public class CartClubServiceImpl implements CartClubService {
|
|
|
Date registerTime = orderCommonMapper.getUserRegisterTime(userId);
|
|
|
// 未领取的优惠券
|
|
|
List<CouponVo> preCouponList = orderCommonMapper.getPrevCouponList(userId, registerTime);
|
|
|
+ preCouponList.forEach(p -> p.setCouponBtnType(0));
|
|
|
//剔除超级会员优惠券
|
|
|
List<Integer> vipCoupon = cartClubMapper.findVipCoupon();
|
|
|
if (preCouponList != null && preCouponList.size() > 0) {
|
|
@@ -1901,6 +1914,7 @@ public class CartClubServiceImpl implements CartClubService {
|
|
|
filterCoupon(source, productList, preCouponList);
|
|
|
// 用户可用优惠券(已领取)
|
|
|
List<CouponVo> couponList = orderCommonMapper.getClubCouponList(userId);
|
|
|
+ couponList.forEach(c -> c.setCouponBtnType(1));
|
|
|
//剔除超级会员优惠券
|
|
|
if (couponList != null && couponList.size() > 0) {
|
|
|
couponList.removeIf(couponVo -> vipCoupon.contains(couponVo.getCouponId()));
|