|
@@ -18,6 +18,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
+import cn.com.qmth.scancentral.enums.ScanStatus;
|
|
import cn.com.qmth.scancentral.vo.*;
|
|
import cn.com.qmth.scancentral.vo.*;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.io.IOUtils;
|
|
import org.apache.commons.io.IOUtils;
|
|
@@ -231,41 +232,36 @@ public class SubjectServiceImpl extends MppServiceImpl<SubjectDao, SubjectEntity
|
|
}
|
|
}
|
|
|
|
|
|
ret.setSubjects(subjects);
|
|
ret.setSubjects(subjects);
|
|
- ret.setTotal(new SubjectScanProgressVo());
|
|
|
|
|
|
+ Calendar now = Calendar.getInstance();
|
|
|
|
+ long endTime = now.getTimeInMillis();
|
|
|
|
+ now.add(Calendar.HOUR_OF_DAY, -1);
|
|
|
|
+ long startTime = now.getTimeInMillis();
|
|
|
|
+ Integer inTimeScannedCount = batchPaperService.getScanStudentCount(examId, null, startTime, endTime);
|
|
if (CollectionUtils.isNotEmpty(subjects)) {
|
|
if (CollectionUtils.isNotEmpty(subjects)) {
|
|
- int totalScanned = 0;
|
|
|
|
- int totalCount = 0;
|
|
|
|
- double totalEstimation = 0.0;
|
|
|
|
- Calendar now = Calendar.getInstance();
|
|
|
|
- long endTime = now.getTimeInMillis();
|
|
|
|
- now.add(Calendar.HOUR_OF_DAY, -1);
|
|
|
|
- long startTime = now.getTimeInMillis();
|
|
|
|
- Integer inTimeScannedCount = batchPaperService.getScanStudentCount(examId, null, startTime, endTime);
|
|
|
|
for (SubjectScanProgressVo vo : subjects) {
|
|
for (SubjectScanProgressVo vo : subjects) {
|
|
- totalCount = totalCount + vo.getStudentCount();
|
|
|
|
vo.setScannedCount(vo.getStudentCount() - vo.getUnexistCount());
|
|
vo.setScannedCount(vo.getStudentCount() - vo.getUnexistCount());
|
|
- totalScanned = totalScanned + vo.getScannedCount();
|
|
|
|
vo.setProgress(Calculator.percentage(vo.getScannedCount(), vo.getStudentCount(), 2));
|
|
vo.setProgress(Calculator.percentage(vo.getScannedCount(), vo.getStudentCount(), 2));
|
|
if (inTimeScannedCount == null || inTimeScannedCount == 0) {
|
|
if (inTimeScannedCount == null || inTimeScannedCount == 0) {
|
|
vo.setEstimation("-");
|
|
vo.setEstimation("-");
|
|
} else {
|
|
} else {
|
|
double speed = Calculator.divide(endTime - startTime, inTimeScannedCount, 6);
|
|
double speed = Calculator.divide(endTime - startTime, inTimeScannedCount, 6);
|
|
double es = Calculator.divide(Calculator.multiply(speed, vo.getUnexistCount()), 3600000, 2);
|
|
double es = Calculator.divide(Calculator.multiply(speed, vo.getUnexistCount()), 3600000, 2);
|
|
- totalEstimation = Calculator.add(totalEstimation, es);
|
|
|
|
vo.setEstimation(es + "h");
|
|
vo.setEstimation(es + "h");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- ret.getTotal().setStudentCount(totalCount);
|
|
|
|
- ret.getTotal().setScannedCount(totalScanned);
|
|
|
|
- ret.getTotal().setUnexistCount(totalCount - totalScanned);
|
|
|
|
- ret.getTotal().setProgress(
|
|
|
|
- Calculator.percentage(ret.getTotal().getScannedCount(), ret.getTotal().getStudentCount(), 2));
|
|
|
|
- if (totalScanned == 0) {
|
|
|
|
- ret.getTotal().setEstimation("-");
|
|
|
|
- } else {
|
|
|
|
- ret.getTotal().setEstimation(totalEstimation + "h");
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ ret.setTotal(new SubjectScanProgressVo());
|
|
|
|
+ ret.getTotal().setStudentCount(studentService.getCountByExam(examId));
|
|
|
|
+ ret.getTotal().setScannedCount(studentService.getCountByExamAndScanStatus(examId, ScanStatus.SCANNED));
|
|
|
|
+ ret.getTotal().setUnexistCount(ret.getTotal().getStudentCount() - ret.getTotal().getScannedCount());
|
|
|
|
+ ret.getTotal().setProgress(
|
|
|
|
+ Calculator.percentage(ret.getTotal().getScannedCount(), ret.getTotal().getStudentCount(), 2));
|
|
|
|
+ if (ret.getTotal().getStudentCount() == 0) {
|
|
|
|
+ ret.getTotal().setEstimation("-");
|
|
|
|
+ } else {
|
|
|
|
+ double speed = Calculator.divide(endTime - startTime, inTimeScannedCount, 6);
|
|
|
|
+ double es = Calculator.divide(Calculator.multiply(speed, ret.getTotal().getUnexistCount()), 3600000, 2);
|
|
|
|
+ ret.getTotal().setEstimation(es + "h");
|
|
}
|
|
}
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|