| | |
| | | @Override |
| | | public UserPointStatistics getStatistics(UserPoint userPoint) { |
| | | |
| | | List<Long> userIds = new ArrayList<>(); |
| | | if (StringUtils.isNotEmpty(userPoint.getUserName())) { |
| | | userIds = appUserService.listObjs(new LambdaQueryWrapper<AppUser>() |
| | | if (StringUtils.isNotEmpty(userPoint.getUserName()) || StringUtils.isNotEmpty(userPoint.getPhone())) { |
| | | List<Long> userIds = appUserService.listObjs(new LambdaQueryWrapper<AppUser>() |
| | | .select(AppUser::getId) |
| | | .like(AppUser::getName, userPoint.getUserName())) |
| | | .like(StringUtils.isNotEmpty(userPoint.getUserName()),AppUser::getName, userPoint.getUserName()) |
| | | .like(StringUtils.isNotEmpty(userPoint.getPhone()),AppUser::getPhone, userPoint.getPhone())) |
| | | .stream() |
| | | .map(appUserId -> (Long) appUserId) |
| | | .collect(Collectors.toList()); |
| | | userPoint.setUserIds(userIds); |
| | | } |
| | | |
| | | List<UserPoint> userPointList = userPointMapper.findLatestChangeByType(userPoint); |
| | | Map<Integer, Integer> userBalanceMap = userPointList.stream() |
| | | .collect(Collectors.toMap(UserPoint::getType, UserPoint::getBalance)); |
| | | |
| | | |
| | | |
| | | Integer consumePoint = Optional.ofNullable(userBalanceMap.get(PointChangeType.CONSUME.getCode())).orElse(0); |