Pu Zhibing
2025-01-01 e0623f1a914ecbc99d5926c0df3cf26032c02499
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java
@@ -58,49 +58,44 @@
        VipSetting vipSetting = vipSettingService.getVipSettingById(4);
        // 获取通过消费积分达成会员等级的开关
        Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole();
        if (null != vipLevelUpShopRole && vipLevelUpShopRole == 1){
        // 获取指定购买商品
        boolean b = false;
        String[] split = vipSetting.getGoodIds().split(",");
        for (String s : split) {
            R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, Integer.valueOf(s));
            if (R.isSuccess(orderListByUserIdAndGoodsId)){
                List<Order> orderList = orderListByUserIdAndGoodsId.getData();
                if (orderList.size() > 0){
                    b = true;
                    break;
                }
            }
        }
        if (b && null != vipLevelUpShopRole && vipLevelUpShopRole == 1){
            // 消费积分阈值
            Integer vipLevelUpShop = vipSetting.getVipLevelUpShop();
            // 返佣积分阈值
            Integer vipLevelUpShare = vipSetting.getVipLevelUpShare();
            // 判断是否满足消费积分和返佣积分
            if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){
            if (shopPoint.compareTo(vipLevelUpShop) >= 0 && sharePoint.compareTo(vipLevelUpShare) >= 0){
                return true;
            }
        }
        Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole();
        if (null != vipLevelUpNumRole && vipLevelUpNumRole == 1){
        if (b && null != vipLevelUpNumRole && vipLevelUpNumRole == 1){
            // 直推钻石用户数阈值
            Integer vipDirectNum = vipSetting.getVipDirectNum();
            // 获取用户直推钻石用户数量
            long userDiamondsCount = appUserService.count(new LambdaQueryWrapper<AppUser>()
                    .eq(AppUser::getInviteUserId, userId)
                    .eq(AppUser::getVipId, 3));
                    .eq(AppUser::getDelFlag, 0)
                    .eq(AppUser::getStatus, 1)
                    .gt(AppUser::getVipId, 2));
            // 判断是否满足直推钻石用户数量
            if (userDiamondsCount >= vipDirectNum){
                return true;
            return userDiamondsCount >= vipDirectNum.longValue();
            }
        }
        // 获取指定购买商品
        R<List<VipGood>> vipGoodsByVipId = vipGoodClient.getVipGoodsByVipId(4);
        if (R.isSuccess(vipGoodsByVipId)){
            List<VipGood> vipGoods = vipGoodsByVipId.getData();
            if (CollectionUtil.isNotEmpty(vipGoods)){
                for (VipGood vipGood : vipGoods) {
                    Goods goods = JSON.parseObject(vipGood.getGood_json(), Goods.class);
                    R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId());
                    if (R.isSuccess(orderListByUserIdAndGoodsId)){
                        List<Order> orderList = orderListByUserIdAndGoodsId.getData();
                        if (CollectionUtil.isEmpty(orderList)){
                            return false;
                        }
                    }
                }
                return true;
            }
        }
        return false;
    }
@@ -115,19 +110,32 @@
        VipSetting vipSetting = vipSettingService.getVipSettingById(5);
        // 获取通过消费积分达成会员等级的开关
        Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole();
        if (null != vipLevelUpShopRole && vipLevelUpShopRole == 1){
        boolean b = false;
        String[] split = vipSetting.getGoodIds().split(",");
        for (String s : split) {
            R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, Integer.valueOf(s));
            if (R.isSuccess(orderListByUserIdAndGoodsId)){
                List<Order> orderList = orderListByUserIdAndGoodsId.getData();
                if (orderList.size() > 0){
                    b = true;
                    break;
                }
            }
        }
        if (b && null != vipLevelUpShopRole && vipLevelUpShopRole == 1){
            // 消费积分阈值
            Integer vipLevelUpShop = vipSetting.getVipLevelUpShop();
            // 返佣积分阈值
            Integer vipLevelUpShare = vipSetting.getVipLevelUpShare();
            // 判断是否满足消费积分和返佣积分
            if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){
            if (shopPoint.compareTo(vipLevelUpShop) >= 0 && sharePoint.compareTo(vipLevelUpShare) >= 0){
                return true;
            }
        }
        Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole();
        if (null != vipLevelUpNumRole && vipLevelUpNumRole == 1){
        if (b && null != vipLevelUpNumRole && vipLevelUpNumRole == 1){
            // 直推钻石用户数阈值
            Integer vipDirectNum = vipSetting.getVipDirectNum();
            // 获取用户直推钻石用户数量
@@ -135,29 +143,8 @@
                    .eq(AppUser::getInviteUserId, userId)
                    .eq(AppUser::getVipId, 3));
            // 判断是否满足直推钻石用户数量
            if (userDiamondsCount >= vipDirectNum){
                return true;
            return userDiamondsCount >= vipDirectNum.longValue();
            }
        }
        R<List<VipGood>> vipGoodsByVipId = vipGoodClient.getVipGoodsByVipId(5);
        if (R.isSuccess(vipGoodsByVipId)){
            List<VipGood> vipGoods = vipGoodsByVipId.getData();
            if (CollectionUtil.isNotEmpty(vipGoods)){
                for (VipGood vipGood : vipGoods) {
                    Goods goods = JSON.parseObject(vipGood.getGood_json(), Goods.class);
                    R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId());
                    if (R.isSuccess(orderListByUserIdAndGoodsId)){
                        List<Order> orderList = orderListByUserIdAndGoodsId.getData();
                        if (CollectionUtil.isEmpty(orderList)){
                            return false;
                        }
                    }
                }
                return true;
            }
        }
        return false;
    }
@@ -166,9 +153,24 @@
        AppUser appUser = appUserService.getById(userId);
        // 获取总代会员设置
        VipSetting vipSetting = vipSettingService.getVipSettingById(6);
        // 获取指定购买商品
        boolean b = false;
        String[] split = vipSetting.getGoodIds().split(",");
        for (String s : split) {
            R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, Integer.valueOf(s));
            if (R.isSuccess(orderListByUserIdAndGoodsId)){
                List<Order> orderList = orderListByUserIdAndGoodsId.getData();
                if (orderList.size() > 0){
                    b = true;
                    break;
                }
            }
        }
        // 获取会员等级是否必须达到代理
        Integer vipLevelUpProxyRole = vipSetting.getVipLevelUpProxyRole();
        if (vipLevelUpProxyRole == 1 && appUser.getVipId() == 5){
        if (b && vipLevelUpProxyRole == 1 && appUser.getVipId() == 5){
            return true;
        }
@@ -178,19 +180,19 @@
        Integer sharePoint = appUser.getSharePoint();
        // 获取通过消费积分达成会员等级的开关
        Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole();
        if (null != vipLevelUpShopRole && vipLevelUpShopRole == 1){
        if (b && null != vipLevelUpShopRole && vipLevelUpShopRole == 1){
            // 消费积分阈值
            Integer vipLevelUpShop = vipSetting.getVipLevelUpShop();
            // 返佣积分阈值
            Integer vipLevelUpShare = vipSetting.getVipLevelUpShare();
            // 判断是否满足消费积分和返佣积分
            if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){
            if (shopPoint.compareTo(vipLevelUpShop) >= 0 && sharePoint.compareTo(vipLevelUpShare) >= 0){
                return true;
            }
        }
        Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole();
        if (null != vipLevelUpNumRole && vipLevelUpNumRole == 1){
        if (b && null != vipLevelUpNumRole && vipLevelUpNumRole == 1){
            // 直推代理用户数阈值
            Integer vipDirectNum = vipSetting.getVipDirectNum();
            // 准代理用户数阈值
@@ -207,29 +209,8 @@
                    .eq(AppUser::getVipId, 4));
            // 判断是否满足直推代理用户数量和准代理数量
            if (userAgentList.size() >= vipDirectNum && userQuasiAgentCount >= vipDirectVipNum){
                return true;
            return userAgentList.size() >= vipDirectNum && userQuasiAgentCount >= vipDirectVipNum.longValue();
            }
        }
        // 获取指定购买商品
        R<List<VipGood>> vipGoodsByVipId = vipGoodClient.getVipGoodsByVipId(5);
        if (R.isSuccess(vipGoodsByVipId)){
            List<VipGood> vipGoods = vipGoodsByVipId.getData();
            if (CollectionUtil.isNotEmpty(vipGoods)){
                for (VipGood vipGood : vipGoods) {
                    Goods goods = JSON.parseObject(vipGood.getGood_json(), Goods.class);
                    R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId());
                    if (R.isSuccess(orderListByUserIdAndGoodsId)){
                        List<Order> orderList = orderListByUserIdAndGoodsId.getData();
                        if (CollectionUtil.isEmpty(orderList)){
                            return false;
                        }
                    }
                }
                return true;
            }
        }
        return false;
    }
@@ -242,20 +223,35 @@
        Integer sharePoint = appUser.getSharePoint();
        // 合伙人会员设置
        VipSetting vipSetting = vipSettingService.getVipSettingById(7);
        // 获取指定购买商品
        boolean b = false;
        String[] split = vipSetting.getGoodIds().split(",");
        for (String s : split) {
            R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, Integer.valueOf(s));
            if (R.isSuccess(orderListByUserIdAndGoodsId)){
                List<Order> orderList = orderListByUserIdAndGoodsId.getData();
                if (orderList.size() > 0){
                    b = true;
                    break;
                }
            }
        }
        // 获取通过消费积分达成会员等级的开关
        Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole();
        if (null != vipLevelUpShopRole && vipLevelUpShopRole == 1){
        if (b && null != vipLevelUpShopRole && vipLevelUpShopRole == 1){
            // 消费积分阈值
            Integer vipLevelUpShop = vipSetting.getVipLevelUpShop();
            // 返佣积分阈值
            Integer vipLevelUpShare = vipSetting.getVipLevelUpShare();
            // 判断是否满足消费积分和返佣积分
            if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){
            if (shopPoint.compareTo(vipLevelUpShop) >= 0 && sharePoint.compareTo(vipLevelUpShare) >= 0){
                return true;
            }
            }
            Integer vipLevelUpNumRole = vipSetting.getVipLevelUpNumRole();
            if (null != vipLevelUpNumRole && vipLevelUpNumRole == 1){
        if (b && null != vipLevelUpNumRole && vipLevelUpNumRole == 1){
                // 直推代理用户数阈值
                Integer vipDirectNum = vipSetting.getVipDirectNum();
                // 准代理用户数阈值
@@ -300,8 +296,6 @@
                        // 判断是否满足直推代理用户数量和准代理数量
                        return userTotalAgentList.size() >= vipTeamVipNum && userAgentList.size() >= vipDirectNum &&
                                userQuasiAgentCount >= vipDirectVipNum;
                    }
                }
            }