|
@@ -144,31 +144,20 @@ public class AnswerCheckController extends BaseExamController {
|
|
List<ExamQuestion> questions = questionService.findByExamAndSubjectAndObjectiveAndPaperType(
|
|
List<ExamQuestion> questions = questionService.findByExamAndSubjectAndObjectiveAndPaperType(
|
|
student.getExamId(), student.getSubjectCode(), true, student.getPaperType());
|
|
student.getExamId(), student.getSubjectCode(), true, student.getPaperType());
|
|
List<String> answers = student.getAnswerList();
|
|
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 {
|
|
} else {
|
|
// 已设置客观题
|
|
// 已设置客观题
|
|
- int questionCount = questions.size();
|
|
|
|
- int answerCount = answers.size();
|
|
|
|
int maxCount = Math.max(questionCount, answerCount);
|
|
int maxCount = Math.max(questionCount, answerCount);
|
|
for (int i = 0; i < maxCount; i++) {
|
|
for (int i = 0; i < maxCount; i++) {
|
|
ExamQuestion q = questionCount > i ? questions.get(i) : null;
|
|
ExamQuestion q = questionCount > i ? questions.get(i) : null;
|
|
String answer = answerCount > i ? answers.get(i) : "#";
|
|
String answer = answerCount > i ? answers.get(i) : "#";
|
|
JSONObject obj = new JSONObject();
|
|
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("answer", answer);
|
|
// obj.accumulate("exist", q != null && q.getTotalScore() > 0);
|
|
// obj.accumulate("exist", q != null && q.getTotalScore() > 0);
|
|
// obj.accumulate("multi",
|
|
// obj.accumulate("multi",
|
|
@@ -179,10 +168,10 @@ public class AnswerCheckController extends BaseExamController {
|
|
titles.put(q.getMainNumber(), q.getMainTitle());
|
|
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;
|
|
return result;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|