Explorar o código

套题答案不正确的bug修复

lideyin %!s(int64=5) %!d(string=hai) anos
pai
achega
a7f6ba21e7

+ 9 - 4
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/ExamRecordCloudServiceProvider.java

@@ -380,6 +380,10 @@ public class ExamRecordCloudServiceProvider extends ControllerSupport implements
      */
     private List<PagedToBeMarkSubjectiveAnswerBean> getSubjectiveAnswerList(Long examRecordDataId,
                                                                             Long examId, String courseCode, String paperType) {
+        //全部作答集合
+        ExamRecordQuestionsEntity allEqList =
+                examRecordQuestionsService.getExamRecordQuestionsAndFixExamRecordDataIfNecessary(examRecordDataId);
+        //主观题作答集合
         List<ExamQuestionEntity> eqList = examRecordQuestionsService.querySubjectiveAnswerList(examRecordDataId);
 
         List<PagedToBeMarkSubjectiveAnswerBean> resultList = new ArrayList<>();
@@ -395,7 +399,7 @@ public class ExamRecordCloudServiceProvider extends ControllerSupport implements
             //获取指定小题的题干相关信息
             QuestionCacheBean cachedQues = CacheHelper.getQuestion(examId, courseCode, paperType, eq.getQuestionId());
 
-            bean.setAnswer(getCorrectAnswer(eq.getOrder(), eq.getQuestionId(), cachedQues, eqList));
+            bean.setAnswer(getCorrectAnswer(eq.getOrder(), eq.getQuestionId(), cachedQues, allEqList.getExamQuestionEntities()));
 
             bean.setParentBody(getParentBody(cachedQues));
             bean.setBody(getBody(eq.getOrder(), eq.getQuestionId(), cachedQues, eqList));
@@ -463,11 +467,11 @@ public class ExamRecordCloudServiceProvider extends ControllerSupport implements
      * @param curSubNumber       当前小题号
      * @param questionId         原小题id
      * @param cachedQues         带题干的试卷结构
-     * @param subjectiveQuesList 主观题集合
+     * @param allEqList 所有作答集合
      * @return
      */
     private String getCorrectAnswer(Integer curSubNumber, String questionId,
-                                    QuestionCacheBean cachedQues, List<ExamQuestionEntity> subjectiveQuesList) {
+                                    QuestionCacheBean cachedQues, List<ExamQuestionEntity> allEqList) {
         QuestionAnswerCacheBean questionAnswerCache = CacheHelper.getQuestionAnswer(questionId);
         List<String> rightAnswerList = questionAnswerCache.getRightAnswers();
         DefaultQuestionStructure questionStructure = cachedQues.getDefaultQuestion().getMasterVersion();
@@ -478,8 +482,9 @@ public class ExamRecordCloudServiceProvider extends ControllerSupport implements
             return rightAnswerList.get(0);
         }
 
+
         //同一questionId的主观题集合(不带题干,有小题号)
-        List<ExamQuestionEntity> noBodySubjectiveQuesList = subjectiveQuesList.stream().
+        List<ExamQuestionEntity> noBodySubjectiveQuesList = allEqList.stream().
                 filter(p -> p.getQuestionId().equals(questionId)).collect(Collectors.toList());
 
         for (int i = 0; i < noBodySubjectiveQuesList.size(); i++) {