| | |
| | | // 转换为输出对象 |
| | | List<UserAccountOut> allSubordinateOuts = ConverterUtil.convertToList(allSubordinates, UserAccountOut.class); |
| | | |
| | | // === 新增:为下级用户设置激活状态 === |
| | | setActivateStatusForUsers(allSubordinateOuts); |
| | | // ================================= |
| | | |
| | | // 收集所有需要设置 KYC 的用户(当前层级 + 下级) |
| | | List<UserAccountOut> allUsers = new ArrayList<>(); |
| | | allUsers.addAll(userAccountOuts); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 为用户列表设置激活状态 |
| | | */ |
| | | private void setActivateStatusForUsers(List<UserAccountOut> users) { |
| | | if (ObjectUtil.isEmpty(users)) { |
| | | return; |
| | | } |
| | | |
| | | // 收集用户ID |
| | | List<Integer> idList = users.stream() |
| | | .map(UserAccountOut::getId) |
| | | .filter(ObjectUtil::isNotEmpty) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (idList.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | // 批量查询激活状态 |
| | | LambdaQueryWrapper<UserPolicy> userPolicyWrapper = new LambdaQueryWrapper<>(); |
| | | userPolicyWrapper.in(UserPolicy::getUserId, idList) |
| | | .eq(UserPolicy::getApprovalStatus, 1) |
| | | .select(UserPolicy::getUserId); |
| | | |
| | | List<UserPolicy> policyList = userPolicyService.list(userPolicyWrapper); |
| | | Set<Integer> activatedUserIds = policyList.stream() |
| | | .map(UserPolicy::getUserId) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | // 设置激活状态 |
| | | users.forEach(user -> { |
| | | user.setActivate(activatedUserIds.contains(user.getId())); |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 为用户列表设置 KYC 信息 |
| | | */ |
| | | private void setKycInfoForUsers(List<UserAccountOut> users) { |