| | |
| | | //获取绑定上级 |
| | | if (user.getInviteUserId() != null) { |
| | | AppUser byId = appUserService.getById(user.getInviteUserId()); |
| | | user.setTopUser(byId); |
| | | if(null != byId){ |
| | | user.setTopUser(byId); |
| | | }else{ |
| | | user.setTopUser(new AppUser()); |
| | | } |
| | | }else { |
| | | AppUser topUser = new AppUser(); |
| | | user.setTopUser(topUser); |
| | |
| | | .eq(AppUser::getDelFlag, 0) |
| | | .ne(AppUser::getStatus, 3) |
| | | .count(); |
| | | vip1Count1 += count1; |
| | | |
| | | Long count2 = appUserService.lambdaQuery() |
| | | .eq(AppUser::getVipId, 2) |
| | |
| | | .eq(AppUser::getDelFlag, 0) |
| | | .ne(AppUser::getStatus, 3) |
| | | .count(); |
| | | vip1Count2 += count2; |
| | | Long count3 = appUserService.lambdaQuery() |
| | | .eq(AppUser::getVipId, 3) |
| | | .eq(AppUser::getInviteUserId, appUser.getId()) |
| | | .eq(AppUser::getDelFlag, 0) |
| | | .ne(AppUser::getStatus, 3) |
| | | .count(); |
| | | vip1Count3 += count3; |
| | | Long count4 = appUserService.lambdaQuery() |
| | | .eq(AppUser::getVipId, 4) |
| | | .eq(AppUser::getInviteUserId, appUser.getId()) |
| | | .eq(AppUser::getDelFlag, 0) |
| | | .ne(AppUser::getStatus, 3) |
| | | .count(); |
| | | vip1Count4 += count4; |
| | | Long count5 = appUserService.lambdaQuery() |
| | | .eq(AppUser::getVipId, 5) |
| | | .eq(AppUser::getInviteUserId, appUser.getId()) |
| | | .eq(AppUser::getDelFlag, 0) |
| | | .ne(AppUser::getStatus, 3) |
| | | .count(); |
| | | vip1Count5 += count5; |
| | | Long count6 = appUserService.lambdaQuery() |
| | | .eq(AppUser::getVipId, 6) |
| | | .eq(AppUser::getInviteUserId, appUser.getId()) |
| | | .eq(AppUser::getDelFlag, 0) |
| | | .ne(AppUser::getStatus, 3) |
| | | .count(); |
| | | vip1Count6 += count6; |
| | | Long count7 = appUserService.lambdaQuery() |
| | | .eq(AppUser::getVipId, 7) |
| | | .eq(AppUser::getInviteUserId, appUser.getId()) |
| | | .eq(AppUser::getDelFlag, 0) |
| | | .ne(AppUser::getStatus, 3) |
| | | .count(); |
| | | vip1Count7 += count7; |
| | | appUser.setCount1(count1); |
| | | appUser.setCount2(count2); |
| | | appUser.setCount3(count3); |
| | |
| | | appUser.setCount6(count6); |
| | | appUser.setCount7(count7); |
| | | } |
| | | |
| | | user.setBottomUsers(list); |
| | | user.setCount1(vip1Count1); |
| | | user.setCount2(vip1Count2); |
| | |
| | | ArrayList<Long> userIds = new ArrayList<>(); |
| | | userIds.add(userId); |
| | | // 获取当前用户的所有下级 |
| | | List<AppUser> allSubordinates = getAllSubordinates(userId); |
| | | // 统计下级中每种会员类型的人数 |
| | | Map<Integer, Long> countMap = allSubordinates.stream() |
| | | .collect(Collectors.groupingBy(AppUser::getVipId, Collectors.counting())); |
| | | countMap.forEach((vipId, count) -> { |
| | | switch (vipId) { |
| | | case 1: |
| | | Long count1 = user.getCount1() == null ? 0 : user.getCount1(); |
| | | user.setCount1(count1 + count); |
| | | break; |
| | | case 2: |
| | | Long count2 = user.getCount2() == null ? 0 : user.getCount2(); |
| | | user.setCount2(count2 + count); |
| | | break; |
| | | case 3: |
| | | Long count3 = user.getCount3() == null ? 0 : user.getCount3(); |
| | | user.setCount3(count3 + count); |
| | | break; |
| | | case 4: |
| | | Long count4 = user.getCount4() == null ? 0 : user.getCount4(); |
| | | user.setCount4(count4 + count); |
| | | break; |
| | | case 5: |
| | | Long count5 = user.getCount5() == null ? 0 : user.getCount5(); |
| | | user.setCount5(count5 + count); |
| | | break; |
| | | case 6: |
| | | Long count6 = user.getCount6() == null ? 0 : user.getCount6(); |
| | | user.setCount6(count6 + count); |
| | | break; |
| | | case 7: |
| | | Long count7 = user.getCount7() == null ? 0 : user.getCount7(); |
| | | user.setCount7(count7 + count); |
| | | break; |
| | | } |
| | | }); |
| | | List<AppUser> allSubordinates = appUserService.list(new LambdaQueryWrapper<AppUser>() |
| | | .eq(AppUser::getInviteUserId, user.getId()).eq(AppUser::getDelFlag, 0) |
| | | .ne(AppUser::getStatus, 3)); |
| | | Long count1 = allSubordinates.stream().filter(s->s.getVipId() == 1).count(); |
| | | user.setCount1(count1); |
| | | Long count2 = allSubordinates.stream().filter(s->s.getVipId() == 2).count(); |
| | | user.setCount2(count2); |
| | | Long count3 = allSubordinates.stream().filter(s->s.getVipId() == 3).count(); |
| | | user.setCount3(count3); |
| | | Long count4 = allSubordinates.stream().filter(s->s.getVipId() == 4).count(); |
| | | user.setCount4(count4); |
| | | Long count5 = allSubordinates.stream().filter(s->s.getVipId() == 5).count(); |
| | | user.setCount5(count5); |
| | | Long count6 = allSubordinates.stream().filter(s->s.getVipId() == 6).count(); |
| | | user.setCount6(count6); |
| | | Long count7 = allSubordinates.stream().filter(s->s.getVipId() == 7).count(); |
| | | user.setCount7(count7); |
| | | List<UserSignRecord> list = userSignRecordService.lambdaQuery().eq(UserSignRecord::getSignDay, LocalDate.now()) |
| | | .eq(UserSignRecord::getAppUserId,userId).list(); |
| | | if (!list.isEmpty()) { |
| | |
| | | record.setInviteUserName(byId1.getName()); |
| | | } |
| | | } |
| | | if (record.getShopId()!=null){ |
| | | R<Shop> shopById = shopClient.getShopById(record.getShopId()); |
| | | if (shopById.getData()!=null){ |
| | | record.setShopName(shopById.getData().getName()); |
| | | } |
| | | Shop shop1 = shopClient.getServiceProvider(record.getId()).getData(); |
| | | if(null != shop1){ |
| | | record.setShopName(shop1.getName()); |
| | | record.setShopId(shop1.getId()); |
| | | } |
| | | record.setTotalPoint(record.getUserTotalPoint()); |
| | | } |
| | |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserClient.getSysUser(userid).getData(); |
| | | AppUser byId = appUserService.getById(id); |
| | | Shop shop1 = shopClient.getServiceProvider(id).getData(); |
| | | Shop shop1 = shopClient.getServiceProvider(byId.getId()).getData(); |
| | | if(null != shop1){ |
| | | byId.setShopName(shop1.getName()); |
| | | byId.setShopId(shop1.getId()); |
| | | } |
| | | R<List<Shop>> shopByUserId = shopClient.getShopByUserId(id); |
| | | if (shopByUserId.getData() != null) { |