From 03087dc9b9a1e3a74bf74ba06446e72a44b96e07 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期一, 09 十二月 2024 15:58:46 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java | 56 +++++++++++++++++++++----------------------------------- 1 files changed, 21 insertions(+), 35 deletions(-) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java index 257935e..68bae5a 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/VipCenterServiceImpl.java @@ -6,13 +6,14 @@ import com.ruoyi.account.api.model.AppUser; import com.ruoyi.account.service.AppUserService; import com.ruoyi.account.service.VipCenterService; +import com.ruoyi.account.service.VipSettingService; import com.ruoyi.common.core.domain.R; import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; import com.ruoyi.order.model.Order; import com.ruoyi.other.api.domain.Goods; import com.ruoyi.other.api.domain.VipGood; +import com.ruoyi.other.api.domain.VipSetting; import com.ruoyi.other.api.feignClient.VipGoodClient; -import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -27,46 +28,31 @@ private RemoteOrderGoodsClient remoteOrderGoodsClient; @Resource private VipGoodClient vipGoodClient; + @Resource + private VipSettingService vipSettingService; @Override - public Boolean checkReadyToBeProxy(Long userId) { + public Boolean checkReadyToBeProxy(Long userId,Integer vipId) { AppUser appUser = appUserService.getById(userId); - if (appUser.getShopPoint() >= 500){ + // 消费积分 + Integer shopPoint = appUser.getShopPoint(); + // 返佣积分 + Integer sharePoint = appUser.getSharePoint(); + // 准代理会员设置 + VipSetting vipSetting = vipSettingService.getVipSettingById(4); + // 消费积分阈值 + Integer vipLevelUpShop = vipSetting.getVipLevelUpShop(); + // 返佣积分阈值 + Integer vipLevelUpShare = vipSetting.getVipLevelUpShare(); + if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare){ return true; } - if (appUser.getSharePoint() >= 400){ - return true; - } - - // 当前用户的直推用户 - List<AppUser> bottomUsers = appUserService.list(new LambdaQueryWrapper<AppUser>() + // 直推钻石用户数阈值 + Integer vipDirectNum = vipSetting.getVipDirectNum(); + // 获取用户直推钻石用户数量 + long userDiamondsCount = appUserService.count(new LambdaQueryWrapper<AppUser>() .eq(AppUser::getInviteUserId, userId) - .eq(AppUser::getVipId,3)); - if (bottomUsers.size() >= 5){ - return true; - } - - // 是否购买指定商品 - R<List<VipGood>> vipGoodsByVipId = vipGoodClient.getVipGoodsByVipId(4); - if (R.isError(vipGoodsByVipId)){ - throw new RuntimeException("根据会员id获取会员购买商品失败:" + vipGoodsByVipId.getMsg()); - } - List<VipGood> vipGoodList = vipGoodsByVipId.getData(); - if (CollectionUtil.isNotEmpty(vipGoodList)){ - List<String> goodJsonList = vipGoodList.stream().map(VipGood::getGoodJson).collect(Collectors.toList()); - for (String goodJson : goodJsonList) { - Goods goods = JSONObject.parseObject(goodJson, Goods.class); - R<List<Order>> orderR = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId()); - if (R.isError(orderR)){ - throw new RuntimeException("根据用户id和商品id获取订单失败:" + orderR.getMsg()); - } - if (CollectionUtil.isEmpty(orderR.getData())){ - return false; - } - } - return true; - } - + .eq(AppUser::getVipId, 3)); return false; } -- Gitblit v1.7.1