| | |
| | | |
| | | @Override |
| | | public Boolean checkReadyToBeProxy(Long userId,Integer vipId) { |
| | | AppUser appUser = appUserService.getById(userId); |
| | | VipSetting vipSetting = vipSettingService.getVipSettingById(vipId); |
| | | if (vipSetting.getVipLevelUpShopRole() == 0){ |
| | | return false; |
| | | } |
| | | Integer vipLevelUpShop = vipSetting.getVipLevelUpShop(); |
| | | if (appUser.getShopPoint() >= vipLevelUpShop){ |
| | | return true; |
| | | } |
| | | Integer vipLevelUpShare = vipSetting.getVipLevelUpShare(); |
| | | if (appUser.getSharePoint() >= vipLevelUpShare){ |
| | | return true; |
| | | } |
| | | |
| | | // 当前用户的直推用户 |
| | | List<AppUser> bottomUsers = appUserService.list(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; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |