zhijiezhao 3 rokov pred
rodič
commit
1550b52270

+ 15 - 14
src/main/java/com/caimei365/order/service/impl/CartClubServiceImpl.java

@@ -88,7 +88,7 @@ public class CartClubServiceImpl implements CartClubService {
         // 超级会员标识
         Integer svipUserId = baseMapper.getSvipUserIdByUserId(userId);
         boolean svipUserFlag = null != svipUserId;
-        if (null != shopInfoList && shopInfoList.size()>0) {
+        if (null != shopInfoList && shopInfoList.size() > 0) {
             // 删除空数据
             shopInfoList.removeIf(Objects::isNull);
             // 遍历供应商列表
@@ -255,7 +255,7 @@ public class CartClubServiceImpl implements CartClubService {
                             // 设置该优惠下的商品列表
                             List<PromotionPriceVo> promotionPriceList = new ArrayList<>();
                             productList.forEach(item -> {
-                                if (!(1 == item.getSvipProductFlag() && svipUserFlag)){
+                                if (!(1 == item.getSvipProductFlag() && svipUserFlag)) {
                                     // 超级会员购买svip商品不享受店铺促销优惠
                                     PromotionPriceVo promotionPrice = new PromotionPriceVo();
                                     promotionPrice.setProductId(item.getProductId());
@@ -321,7 +321,7 @@ public class CartClubServiceImpl implements CartClubService {
         filterCoupon(source, cartAllProducts, couponList);
         //超级会员优惠券剔除
         List<Integer> vipCoupon = cartClubMapper.findVipCoupon();
-        if (couponList.size() > 0 && couponList != null) {
+        if (couponList != null && couponList.size() > 0) {
             for (CouponVo couponVo : couponList) {
                 if (vipCoupon.contains(couponVo.getCouponId())) {
                     couponList.remove(couponVo);
@@ -398,7 +398,7 @@ public class CartClubServiceImpl implements CartClubService {
     /**
      * 优惠券标识是否显示
      */
-    public Boolean setCouponsLogo(Integer shopId, Integer source, List<CartItemVo> cartItems,  List<CouponVo> couponList) {
+    public Boolean setCouponsLogo(Integer shopId, Integer source, List<CartItemVo> cartItems, List<CouponVo> couponList) {
         boolean couponsLogo = false;
         if (couponList != null && couponList.size() > 0) {
             A:
@@ -474,7 +474,7 @@ public class CartClubServiceImpl implements CartClubService {
         boolean svipUserFlag = null != svipUserId;
         // 获取购物车商品列表(不区分供应商)
         cartList = cartClubMapper.getCartProductList(userId);
-        if (null != cartList && cartList.size()>0) {
+        if (null != cartList && cartList.size() > 0) {
             // 移除价格不可见商品
             cartList.removeIf(cartItemVo -> !(cartItemVo.getPriceFlag() == 0 || (cartItemVo.getPriceFlag() == 2 && (userIdentity == 2 || svipUserFlag))));
             cartList.forEach(cartItemVo -> {
@@ -633,16 +633,17 @@ public class CartClubServiceImpl implements CartClubService {
 
     /**
      * 获取机构购物车数量(商品种类数)
+     *
      * @param userId 用户ID
      * @return int
      */
-    private int getCartCount(Integer userId){
+    private int getCartCount(Integer userId) {
         if (null == userId) {
             return 0;
         }
         // 获取购物车商品列表(不区分供应商)
         List<CartItemVo> cartList = cartClubMapper.getCartProductList(userId);
-        if (null != cartList && cartList.size()>0) {
+        if (null != cartList && cartList.size() > 0) {
             // 用户身份
             Integer userIdentity = baseMapper.getIdentityByUserId(userId);
             // 超级会员标识
@@ -705,7 +706,7 @@ public class CartClubServiceImpl implements CartClubService {
 
         // 供应商列表
         List<CartShopVo> shopList = cartClubMapper.getCartShopsByProductIds(userId, productIdList);
-        if (null != shopList && shopList.size()>0) {
+        if (null != shopList && shopList.size() > 0) {
             // 遍历供应商列表
             List<String> finalIdList = productIdList;
             shopList.forEach(shop -> {
@@ -726,7 +727,7 @@ public class CartClubServiceImpl implements CartClubService {
                     PromotionsVo shopPromotion = baseMapper.getPromotionByShopId(shop.getShopId());
                     // 供应商下商品列表
                     List<CartItemVo> productList = cartClubMapper.getCartProductsByShopIdAndProductIds(userId, shop.getShopId(), finalIdList);
-                    if (null != productList && productList.size()>0) {
+                    if (null != productList && productList.size() > 0) {
                         // 去除价格不可见商品
                         productList.removeIf(cartItemVo -> !(cartItemVo.getPriceFlag() == 0 || (cartItemVo.getPriceFlag() == 2 && (userIdentity == 2 || svipUserFlag))));
                         // 去除库存不足商品
@@ -826,7 +827,7 @@ public class CartClubServiceImpl implements CartClubService {
                                     // 设置该优惠下的商品列表
                                     List<PromotionPriceVo> promotionPriceList = new ArrayList<>();
                                     productList.forEach(item -> {
-                                        if (!(1 == item.getSvipProductFlag() && svipUserFlag)){
+                                        if (!(1 == item.getSvipProductFlag() && svipUserFlag)) {
                                             // 超级会员购买svip商品不享受店铺促销优惠
                                             PromotionPriceVo promotionPrice = new PromotionPriceVo();
                                             promotionPrice.setProductId(item.getProductId());
@@ -975,7 +976,7 @@ public class CartClubServiceImpl implements CartClubService {
         }
         cartItemVo.setNumber(cartDto.getProductCount());
         // 库存不足商品
-        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);
         }
         // 供应商Id集合,用户判断赠品供应商是否在当前供应商中
@@ -1260,8 +1261,8 @@ public class CartClubServiceImpl implements CartClubService {
         // 未领取的优惠券
         List<CouponVo> preCouponList = orderCommonMapper.getPrevCouponList(userId);
         //剔除超级会员优惠券
-        List<Integer> vipCoupon =cartClubMapper.findVipCoupon();
-        if (preCouponList.size() > 0 && preCouponList != null) {
+        List<Integer> vipCoupon = cartClubMapper.findVipCoupon();
+        if (preCouponList != null && preCouponList.size() > 0) {
             for (CouponVo couponVo : preCouponList) {
                 if (vipCoupon.contains(couponVo.getCouponId())) {
                     preCouponList.remove(couponVo);
@@ -1273,7 +1274,7 @@ public class CartClubServiceImpl implements CartClubService {
         // 用户可用优惠券(已领取)
         List<CouponVo> couponList = orderCommonMapper.getClubCouponList(userId);
         //剔除超级会员优惠券
-        if (couponList.size() > 0 && couponList != null) {
+        if (couponList != null && couponList.size() > 0) {
             for (CouponVo couponVo : couponList) {
                 if (vipCoupon.contains(couponVo.getCouponId())) {
                     couponList.remove(couponVo);