diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/impl/UserFreightBalanceRestServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/impl/UserFreightBalanceRestServiceImpl.java index 17b84f02..72df16f2 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/impl/UserFreightBalanceRestServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/impl/UserFreightBalanceRestServiceImpl.java @@ -71,10 +71,15 @@ public class UserFreightBalanceRestServiceImpl implements UserFreightBalanceRest } // 根据国家编码过滤数据 - List filteredRecords = freightPageResult.getRecords().stream() + List records = freightPageResult.getRecords().stream() .filter(dto -> isCountrySupported(userProfile.getId(), dto.getUserId())) - .collect(Collectors.toList()); - + .toList(); + List userProfiles = userProfileGateway.listByUserIds(records.stream().map(UserFreightBalanceDTO::getUserId).collect(Collectors.toSet())); + Set countryCodeSet = userProfiles.stream().map(UserProfile::getCountryCode).collect(Collectors.toSet()); + List filteredRecords = records.stream() + .filter(e -> countryCodeSet.contains(userProfile.getCountryCode())) + .collect(Collectors.toList()); + if (filteredRecords.isEmpty()) { return PageResult.newPageResult(20); }