This commit is contained in:
wangliwen 2022-06-13 15:26:34 +08:00
parent cc21e26ab6
commit 8af8d1282f
1 changed files with 3 additions and 3 deletions

View File

@ -586,7 +586,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
jdbcTemplate.queryForList("SELECT note1 FROM tb_data_resource WHERE type ='知识库';", String.class) jdbcTemplate.queryForList("SELECT note1 FROM tb_data_resource WHERE type ='知识库';", String.class)
.stream().distinct().collect(Collectors.toList()); .stream().distinct().collect(Collectors.toList());
final int pageSize = 100; final int pageSize = 100;
final long timestamp = LocalDateTime.now().toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
final OkHttpClient client = new OkHttpClient(); final OkHttpClient client = new OkHttpClient();
Arrays.stream(catalogIds).map(index -> { Arrays.stream(catalogIds).map(index -> {
logger.info("处理:" + index); logger.info("处理:" + index);
@ -595,6 +594,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
AtomicInteger pageIndex = new AtomicInteger(1); AtomicInteger pageIndex = new AtomicInteger(1);
AtomicInteger maxPage = new AtomicInteger(100); // 防止死循环 AtomicInteger maxPage = new AtomicInteger(100); // 防止死循环
do { do {
final long timestamp = LocalDateTime.now().toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
int page = pageIndex.getAndIncrement(); int page = pageIndex.getAndIncrement();
logger.info("处理:" + index + " 分页{}", page); logger.info("处理:" + index + " 分页{}", page);
task.add(CompletableFuture.supplyAsync(() -> { task.add(CompletableFuture.supplyAsync(() -> {
@ -651,7 +651,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
if (!infos.isEmpty()) { // 不为空则数据分页还没传输结束 if (!infos.isEmpty()) { // 不为空则数据分页还没传输结束
logger.info("--继续分页--"); logger.info("--继续分页--");
end.set(true); // TODO end.set(true);
} else { } else {
end.set(false); end.set(false);
} }
@ -716,7 +716,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}); });
})); }));
try { try {
Thread.sleep(500L); Thread.sleep(300L);
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }