xiatian 8 ヶ月 前
コミット
e16f97ac3d

+ 4 - 5
src/main/java/cn/com/qmth/scancentral/service/impl/SubjectServiceImpl.java

@@ -218,18 +218,17 @@ public class SubjectServiceImpl extends MppServiceImpl<SubjectDao, SubjectEntity
             long endTime = now.getTimeInMillis();
             now.add(Calendar.HOUR_OF_DAY, -1);
             long startTime = now.getTimeInMillis();
+            Integer inTimeScanedCount = batchPaperService.getScanStudentCount(examId, null, startTime, endTime);
             for (SubjectScanProgressVo vo : subjects) {
                 totalCount = totalCount + vo.getStudentCount();
                 vo.setScannedCount(vo.getStudentCount() - vo.getUnexistCount());
                 totalScanned = totalScanned + vo.getScannedCount();
                 vo.setProgress(Calculator.percentage(vo.getScannedCount(), vo.getStudentCount(), 2));
-                Integer count = batchPaperService.getScanStudentCount(examId, vo.getSubjectCode(), startTime, endTime);
-                if (count == null || count == 0) {
+                double speed = Calculator.divide(endTime - startTime, inTimeScanedCount, 6);
+                if (inTimeScanedCount == null || inTimeScanedCount == 0) {
                     vo.setEstimation("-");
                 } else {
-                    double es = Calculator.divide(
-                            Calculator.multiply(Calculator.divide(endTime - startTime, count, 6), vo.getUnexistCount()),
-                            3600000, 2);
+                    double es = Calculator.divide(Calculator.multiply(speed, vo.getUnexistCount()), 3600000, 2);
                     totalEstimation = Calculator.add(totalEstimation, es);
                     vo.setEstimation(es + "h");
                 }