Commit 3facf4fe by 杨林龙

优化分批获取省市区的方法

1 parent 0f012eea
...@@ -129,6 +129,14 @@ public class OrganizationApiService { ...@@ -129,6 +129,14 @@ public class OrganizationApiService {
List<Long> userIds = list.stream().map(ReportOrgDto::getCreatedBy).collect(Collectors.toList()); List<Long> userIds = list.stream().map(ReportOrgDto::getCreatedBy).collect(Collectors.toList());
List<Organization> orgList = new ArrayList<>(); List<Organization> orgList = new ArrayList<>();
// 当集合大小大于 500 条的时候 分批次获取结果
if (userIds.size() < BATCH_COUNT) {
OrganizationSearch organizationSearch = new OrganizationSearch();
organizationSearch.setUserIds(userIds);
R<List<Organization>> orgsR = organizationService.getTenantPathsByUserIds(organizationSearch);
orgList = orgsR.getDataList(new TypeToken<List<Organization>>() {
}.getType());
} else {
int length = userIds.size() / BATCH_COUNT; int length = userIds.size() / BATCH_COUNT;
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
List<Long> searchList; List<Long> searchList;
...@@ -150,6 +158,8 @@ public class OrganizationApiService { ...@@ -150,6 +158,8 @@ public class OrganizationApiService {
orgList.addAll(orgListSplit); orgList.addAll(orgListSplit);
} }
} }
}
if (CollectionUtils.isNotEmpty(orgList)) { if (CollectionUtils.isNotEmpty(orgList)) {
list.forEach(efd -> { list.forEach(efd -> {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!