diff --git a/src/main/java/com/celnet/datadump/service/impl/DataImportBatchServiceImpl.java b/src/main/java/com/celnet/datadump/service/impl/DataImportBatchServiceImpl.java index 9bbb00a..19ea615 100644 --- a/src/main/java/com/celnet/datadump/service/impl/DataImportBatchServiceImpl.java +++ b/src/main/java/com/celnet/datadump/service/impl/DataImportBatchServiceImpl.java @@ -200,13 +200,13 @@ public class DataImportBatchServiceImpl implements DataImportBatchService { if (count == 0) { return; } - //批量插入2000一次 - int page = count%2000 == 0 ? count/2000 : (count/2000) + 1; + //批量插入10000一次 + int page = count%10000 == 0 ? count/10000 : (count/10000) + 1; //总插入数 int sfNum = 0; for (int i = 0; i < page; i++) { - List data = customMapper.listJsonObject("*", api, "new_id is null and CreatedDate >= '" + beginDateStr + "' and CreatedDate < '" + endDateStr + "' limit 2000"); + List data = customMapper.listJsonObject("*", api, "new_id is null and CreatedDate >= '" + beginDateStr + "' and CreatedDate < '" + endDateStr + "' limit 10000"); int size = data.size(); log.info("执行api:{}, 执行page:{}, 执行size:{}", api, i+1, size); @@ -262,7 +262,7 @@ public class DataImportBatchServiceImpl implements DataImportBatchService { // 转换为UTC时间并格式化 LocalDateTime localDateTime = LocalDateTime.parse(String.valueOf(data.get(j - 1).get("CreatedDate")), inputFormatter); - ZonedDateTime utcDateTime = localDateTime.atZone(ZoneId.of("UTC")); + ZonedDateTime utcDateTime = localDateTime.atZone(ZoneId.of("UTC")).minusHours(8) ; String convertedTime = utcDateTime.format(outputFormatter); @@ -276,7 +276,7 @@ public class DataImportBatchServiceImpl implements DataImportBatchService { ids[j-1] = data.get(j-1).get("Id").toString(); insertList.add(account); - if (i*2000+j == count){ + if (i*10000+j == count){ break; } } @@ -497,10 +497,10 @@ public class DataImportBatchServiceImpl implements DataImportBatchService { } // 总更新数 int sfNum = 0; - // 批量更新2000一次 - int page = count%2000 == 0 ? count/2000 : (count/2000) + 1; + // 批量更新10000一次 + int page = count%10000 == 0 ? count/10000 : (count/10000) + 1; for (int i = 0; i < page; i++) { - List> mapList = customMapper.list("*", api, "new_id is not null and CreatedDate >= '" + beginDateStr + "' and CreatedDate < '" + endDateStr + "' order by Id asc limit " + i * 2000 + ",2000"); + List> mapList = customMapper.list("*", api, "new_id is not null and CreatedDate >= '" + beginDateStr + "' and CreatedDate < '" + endDateStr + "' order by Id asc limit " + i * 10000 + ",10000"); List updateList = new ArrayList<>();