Browse Source

fixbug,单次复核时获取任务失败后会执行批量复核代码

xiatian 1 year ago
parent
commit
0d69092af7

+ 31 - 30
stmms-web/src/main/java/cn/com/qmth/stmms/admin/exam/InspectedController.java

@@ -218,36 +218,37 @@ public class InspectedController extends BaseExamController {
             if (inspectedService.applyStudent(ExamStudentVo.of(student), wu.getId())) {
                 task = taskService.build(student);
             }
-        }
-        int retry = 1;
-        while (task == null) {
-            List<ExamStudentVo> list = new ArrayList<>();
-            // 需要判断评卷员是否绑定了班级
-            query.setExamId(examId);
-            query.setPageNumber(retry);
-            query.setPageSize(20);
-            List<ExamSubject> subjectList = getExamSubject(examId, wu);
-            if (StringUtils.isBlank(query.getSubjectCode()) && !subjectList.isEmpty()) {
-                query.setSubjectCode(subjectList.get(0).getCode());
-            }
-            query.setInspected(false);
-            query.setInspectUnrepeated(exam.getInspectUnrepeated());
-            query.setInspectorId(wu.getId());
-            list = inspectedService.findByQuery(query, SubjectiveStatus.MARKED, mainNumber, mainStartScore,
-                    mainEndScore, selectiveStatus);
-            if (list.isEmpty()) {
-                break;
-            }
-            for (ExamStudentVo student : list) {
-                if (inspectedService.applyStudent(student, wu.getId())) {
-                    task = taskService.build(ExamStudent.of(student));
-                    break;
-                }
-            }
-            if (task == null) {
-                retry++;
-            }
-        }
+        }else {
+	        int retry = 1;
+	        while (task == null) {
+	            List<ExamStudentVo> list = new ArrayList<>();
+	            // 需要判断评卷员是否绑定了班级
+	            query.setExamId(examId);
+	            query.setPageNumber(retry);
+	            query.setPageSize(20);
+	            List<ExamSubject> subjectList = getExamSubject(examId, wu);
+	            if (StringUtils.isBlank(query.getSubjectCode()) && !subjectList.isEmpty()) {
+	                query.setSubjectCode(subjectList.get(0).getCode());
+	            }
+	            query.setInspected(false);
+	            query.setInspectUnrepeated(exam.getInspectUnrepeated());
+	            query.setInspectorId(wu.getId());
+	            list = inspectedService.findByQuery(query, SubjectiveStatus.MARKED, mainNumber, mainStartScore,
+	                    mainEndScore, selectiveStatus);
+	            if (list.isEmpty()) {
+	                break;
+	            }
+	            for (ExamStudentVo student : list) {
+	                if (inspectedService.applyStudent(student, wu.getId())) {
+	                    task = taskService.build(ExamStudent.of(student));
+	                    break;
+	                }
+	            }
+	            if (task == null) {
+	                retry++;
+	            }
+	        }
+	    }
         return task;
     }