|
@@ -181,7 +181,7 @@ public class BatchImportExamStudentTask implements TaskService {
|
|
List<List<ExamStudentInfo>> newList = this.redoList(dataList);
|
|
List<List<ExamStudentInfo>> newList = this.redoList(dataList);
|
|
|
|
|
|
// 数量多,多线程分批执行
|
|
// 数量多,多线程分批执行
|
|
- final int concurrentSize = 10;
|
|
|
|
|
|
+ final int concurrentSize = 20;
|
|
for (List<ExamStudentInfo> list : newList) {
|
|
for (List<ExamStudentInfo> list : newList) {
|
|
int cutTotal = list.size();
|
|
int cutTotal = list.size();
|
|
|
|
|
|
@@ -193,9 +193,9 @@ public class BatchImportExamStudentTask implements TaskService {
|
|
|
|
|
|
long cost = Math.max((System.currentTimeMillis() - startTime) / 1000L, 1);
|
|
long cost = Math.max((System.currentTimeMillis() - startTime) / 1000L, 1);
|
|
int runCount = successCount.get() + failCount.get();
|
|
int runCount = successCount.get() + failCount.get();
|
|
- log.info("总数:{} 成功数:{} 失败数:{} 已执行:{}条 已耗时:{}秒 平均每秒{}条 进度:{}%"
|
|
|
|
- , total, successCount.get(), failCount.get(), runCount, cost
|
|
|
|
- , runCount / cost, runCount * 100f / total);
|
|
|
|
|
|
+ log.info("总数:{} 成功数:{} 失败数:{} 已执行:{}条 已耗时:{}秒 平均每秒{}条 进度:{}% {}"
|
|
|
|
+ , total, successCount.get(), failCount.get(), runCount, cost, runCount / cost,
|
|
|
|
+ runCount * 100f / total, predictTime(total, runCount, cost));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -210,6 +210,15 @@ public class BatchImportExamStudentTask implements TaskService {
|
|
dataList.clear();
|
|
dataList.clear();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private String predictTime(long totalCount, long finishCount, long curCost) {
|
|
|
|
+ if (finishCount == 0 || curCost == 0) {
|
|
|
|
+ return "";
|
|
|
|
+ }
|
|
|
|
+ float nPerSecond = (float) finishCount / curCost;
|
|
|
|
+ float second = (totalCount - finishCount) / nPerSecond;
|
|
|
|
+ return "约剩:" + second / 60f + "分钟";
|
|
|
|
+ }
|
|
|
|
+
|
|
private void normalRun(User loginUser, List<ExamStudentInfo> batchList, AtomicInteger successCount,
|
|
private void normalRun(User loginUser, List<ExamStudentInfo> batchList, AtomicInteger successCount,
|
|
AtomicInteger failCount, Long taskId, List<String> failRecords) {
|
|
AtomicInteger failCount, Long taskId, List<String> failRecords) {
|
|
long startTime = System.currentTimeMillis();
|
|
long startTime = System.currentTimeMillis();
|
|
@@ -316,8 +325,7 @@ public class BatchImportExamStudentTask implements TaskService {
|
|
for (List<ExamStudentInfo> values : map.values()) {
|
|
for (List<ExamStudentInfo> values : map.values()) {
|
|
maxSize = Math.max(maxSize, values.size());
|
|
maxSize = Math.max(maxSize, values.size());
|
|
}
|
|
}
|
|
-
|
|
|
|
- log.info("最大重复次数:{}", maxSize);
|
|
|
|
|
|
+ log.info("单个身份证号重复最多次数:{}", maxSize);
|
|
|
|
|
|
List<List<ExamStudentInfo>> newList = new ArrayList<>();
|
|
List<List<ExamStudentInfo>> newList = new ArrayList<>();
|
|
for (int n = 0; n < maxSize; n++) {
|
|
for (int n = 0; n < maxSize; n++) {
|