|
@@ -211,36 +211,39 @@ public class SubjectServiceImpl extends MppServiceImpl<SubjectDao, SubjectEntity
|
|
ret.setSubjects(subjects);
|
|
ret.setSubjects(subjects);
|
|
ret.setTotal(new SubjectScanProgressVo());
|
|
ret.setTotal(new SubjectScanProgressVo());
|
|
if (CollectionUtils.isNotEmpty(subjects)) {
|
|
if (CollectionUtils.isNotEmpty(subjects)) {
|
|
|
|
+ int totalScanned = 0;
|
|
|
|
+ int totalCount = 0;
|
|
|
|
+ double totalEstimation = 0.0;
|
|
Calendar now = Calendar.getInstance();
|
|
Calendar now = Calendar.getInstance();
|
|
long endTime = now.getTimeInMillis();
|
|
long endTime = now.getTimeInMillis();
|
|
now.add(Calendar.HOUR_OF_DAY, -1);
|
|
now.add(Calendar.HOUR_OF_DAY, -1);
|
|
long startTime = now.getTimeInMillis();
|
|
long startTime = now.getTimeInMillis();
|
|
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));
|
|
- Integer count = batchPaperService.getScanStudentCount(examId, subjectCode, startTime, endTime);
|
|
|
|
|
|
+ Integer count = batchPaperService.getScanStudentCount(examId, vo.getSubjectCode(), startTime, endTime);
|
|
if (count == null || count == 0) {
|
|
if (count == null || count == 0) {
|
|
vo.setEstimation("-");
|
|
vo.setEstimation("-");
|
|
} else {
|
|
} else {
|
|
- vo.setEstimation(Calculator.divide(
|
|
|
|
|
|
+ double es = Calculator.divide(
|
|
Calculator.multiply(Calculator.divide(endTime - startTime, count, 6), vo.getUnexistCount()),
|
|
Calculator.multiply(Calculator.divide(endTime - startTime, count, 6), vo.getUnexistCount()),
|
|
- 3600000, 2) + "h");
|
|
|
|
|
|
+ 3600000, 2);
|
|
|
|
+ totalEstimation = Calculator.add(totalEstimation, es);
|
|
|
|
+ vo.setEstimation(es + "h");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- int totalUnScanned = studentService.getUnscannedCountByExam(examId);
|
|
|
|
- int totalCount = studentService.getCountByExam(examId);
|
|
|
|
|
|
+
|
|
ret.getTotal().setStudentCount(totalCount);
|
|
ret.getTotal().setStudentCount(totalCount);
|
|
- ret.getTotal().setScannedCount(totalCount - totalUnScanned);
|
|
|
|
- ret.getTotal().setUnexistCount(totalUnScanned);
|
|
|
|
|
|
+ ret.getTotal().setScannedCount(totalScanned);
|
|
|
|
+ ret.getTotal().setUnexistCount(totalCount - totalScanned);
|
|
ret.getTotal().setProgress(
|
|
ret.getTotal().setProgress(
|
|
Calculator.percentage(ret.getTotal().getScannedCount(), ret.getTotal().getStudentCount(), 2));
|
|
Calculator.percentage(ret.getTotal().getScannedCount(), ret.getTotal().getStudentCount(), 2));
|
|
- Integer count = batchPaperService.getScanStudentCount(examId, null, startTime, endTime);
|
|
|
|
- if (count == null || count == 0) {
|
|
|
|
|
|
+ if (totalScanned == 0) {
|
|
ret.getTotal().setEstimation("-");
|
|
ret.getTotal().setEstimation("-");
|
|
} else {
|
|
} else {
|
|
- ret.getTotal().setEstimation(
|
|
|
|
- Calculator.divide(Calculator.multiply(Calculator.divide(endTime - startTime, count, 6),
|
|
|
|
- ret.getTotal().getUnexistCount()), 3600000, 2) + "h");
|
|
|
|
|
|
+ ret.getTotal().setEstimation(totalEstimation + "h");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return ret;
|
|
return ret;
|