Ver Fonte

增加数据检查试卷结构和考生结构不符的错误提示

ting.yin há 3 anos atrás
pai
commit
69bbcf3d60

+ 10 - 21
stmms-web/src/main/java/cn/com/qmth/stmms/admin/exam/AnswerCheckController.java

@@ -144,31 +144,20 @@ public class AnswerCheckController extends BaseExamController {
         List<ExamQuestion> questions = questionService.findByExamAndSubjectAndObjectiveAndPaperType(
                 student.getExamId(), student.getSubjectCode(), true, student.getPaperType());
         List<String> answers = student.getAnswerList();
-        if (questions.isEmpty()) {
-            // 未设置客观题或无客观题
-            // int count = answers.size();
-            // for (int i = 0; i < count; i++) {
-            // JSONObject obj = new JSONObject();
-            // obj.accumulate("mainNumber", 1);
-            // obj.accumulate("subNumber", i + 1);
-            // obj.accumulate("answer", answers.get(i));
-            // obj.accumulate("exist", true);
-            // obj.accumulate("multi", questions.get(i).getAnswer().length() >
-            // 1);
-            // array.add(obj);
-            // }
-            // titles.put(1, "客观题");
+        int questionCount = questions.size();
+        int answerCount = answers.size();
+        if (questionCount < answerCount) {
+            result.accumulate("success", false);
+            result.accumulate("message", student.getSubjectCode() + "-" + student.getSubjectName() + "试卷结构有误,获取考生错误");
         } else {
             // 已设置客观题
-            int questionCount = questions.size();
-            int answerCount = answers.size();
             int maxCount = Math.max(questionCount, answerCount);
             for (int i = 0; i < maxCount; i++) {
                 ExamQuestion q = questionCount > i ? questions.get(i) : null;
                 String answer = answerCount > i ? answers.get(i) : "#";
                 JSONObject obj = new JSONObject();
-                obj.accumulate("mainNumber", q != null ? q.getMainNumber() : 0);
-                obj.accumulate("subNumber", q != null ? q.getSubNumber() : 0);
+                obj.accumulate("mainNumber", q.getMainNumber());
+                obj.accumulate("subNumber", q.getSubNumber());
                 obj.accumulate("answer", answer);
                 // obj.accumulate("exist", q != null && q.getTotalScore() > 0);
                 // obj.accumulate("multi",
@@ -179,10 +168,10 @@ public class AnswerCheckController extends BaseExamController {
                     titles.put(q.getMainNumber(), q.getMainTitle());
                 }
             }
+            result.accumulate("answers", array);
+            result.accumulate("titles", titles);
+            result.accumulate("success", true);
         }
-        result.accumulate("answers", array);
-        result.accumulate("titles", titles);
         return result;
     }
-
 }

+ 1 - 1
stmms-web/src/main/webapp/WEB-INF/views/modules/mark/subjectSelect.jsp

@@ -70,7 +70,7 @@
                     }
                     parent.val(first).trigger('change');
                 });
-                $('.point').hide();
+              //  $('.point').hide();
             });
             
             $(document).ajaxError(function (evt, req, settings) {