| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取门店作为服务商的所有用户 |
| | | * @param shopId |
| | | * @return |
| | | */ |
| | | public Set<Long> getShopServerUser(Integer shopId){ |
| | | Shop shop = shopClient.getShopById(shopId).getData(); |
| | | List<Shop> shopList = shopClient.getAllShop().getData(); |
| | | List<Long> appUserIds = shopList.stream().map(Shop::getAppUserId).collect(Collectors.toList()); |
| | | Long appUserId = shop.getAppUserId(); |
| | | //所有未开店的用户 |
| | | List<AppUser> list = appUserService.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0) |
| | | .ne(AppUser::getStatus, 3).notIn(AppUser::getId, appUserIds)); |
| | | Set<Long> ids = new HashSet<>(); |
| | | getShopServerUser(appUserId, list, ids); |
| | | return ids; |
| | | } |
| | | |
| | | |
| | | |
| | | public void getShopServerUser(Long appUserId, List<AppUser> appUserList, Set<Long> ids){ |
| | | List<AppUser> collect = appUserList.stream().filter(s->s.getInviteUserId().equals(appUserId)).collect(Collectors.toList()); |
| | | if(collect.size() == 0){ |
| | | return; |
| | | } |
| | | Set<Long> appUserSet = collect.stream().map(AppUser::getId).collect(Collectors.toSet()); |
| | | if(ids.containsAll(appUserSet)){ |
| | | return; |
| | | } |
| | | ids.addAll(appUserSet); |
| | | for (AppUser appUser : collect) { |
| | | getShopServerUser(appUser.getId(), appUserList, ids); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | Integer shopId = data.getObjectId(); |
| | | List<Order> orders = orderClient.getRedeemedOrdersByShop(shopId).getData(); |
| | | List<Long> userIds = orders.stream().map(Order::getAppUserId).collect(Collectors.toList()); |
| | | //门店作为服务商的用户 |
| | | Set<Long> shopServerUser = getShopServerUser(shopId); |
| | | userIds.addAll(shopServerUser); |
| | | queryWrapper.in(!CollectionUtils.isEmpty(userIds), "id", userIds) |
| | | .like(StringUtils.isNotEmpty( appUser.getName()),"name", appUser.getName()); |
| | | } |
| | |
| | | for (Order datum : listR.getData()) { |
| | | userIds.add(datum.getAppUserId()); |
| | | } |
| | | Set<Long> shopServerUser = getShopServerUser(objectId); |
| | | userIds.addAll(shopServerUser); |
| | | } |
| | | IPage<AppUser> appuserPage = appUserService.getAppuserPage1(pageCurr, pageSize, appUser, objectId, userIds); |
| | | IPage<AppUser> appuserPage = appUserService.getAppuserPage1(pageCurr, pageSize, appUser, userIds); |
| | | return R.ok(appuserPage); |
| | | } |
| | | |
| | |
| | | shopId = data.getObjectId(); |
| | | if(null == userId){ |
| | | userIds = orderClient.getAppUserByShoppingShop(shopId).getData(); |
| | | Set<Long> shopServerUser = getShopServerUser(shopId); |
| | | userIds.addAll(shopServerUser); |
| | | }else{ |
| | | userIds = new HashSet<>(); |
| | | userIds.add(userId); |
| | | } |
| | | |
| | | } |
| | | UserStatisticsDetail userStatisticsDetail = appUserMapper.getUserStatisticsDetail(shopId, userIds); |
| | | UserStatisticsDetail userStatisticsDetail = appUserMapper.getUserStatisticsDetail(null, userIds); |
| | | return R.ok(userStatisticsDetail); |
| | | } |
| | | |