Browse Source

调试bug fix

lideyin 5 years ago
parent
commit
2eaaf8cfb2

+ 4 - 0
examcloud-core-oe-student-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/student/api/provider/ExamRecordDataCloudServiceProvider.java

@@ -150,6 +150,10 @@ public class ExamRecordDataCloudServiceProvider extends ControllerSupport implem
 
         FaceBiopsyEntity entity = faceBiopsyRepo.findByExamRecordDataId(req.getExamRecordDataId());
 
+        if (null == entity) {
+            return new GetFaceBiopsyResp();
+        }
+
         List<FaceBiopsyItemEntity> itemEntityList = faceBiopsyItemRepo.findByFaceBiopsyIdOrderByIdAsc(entity.getId());
 
         List<FaceBiopsyItemBean> itemBeanList = new ArrayList<>();

+ 1 - 0
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamControlServiceImpl.java

@@ -472,6 +472,7 @@ public class ExamControlServiceImpl implements ExamControlService {
         SequenceLockHelper.getLock(sequenceLockKey);
 
         ExamRecordData examRecordData = examRecordDataService.getExamRecordDataCache(examRecordDataId);
+        examRecordData.setHandInExamType(handInExamType);
 
         Long studentId = examRecordData.getStudentId();
         if (handInExamType == HandInExamType.MANUAL) {

+ 17 - 2
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamRecordDataServiceImpl.java

@@ -322,10 +322,25 @@ public class ExamRecordDataServiceImpl implements ExamRecordDataService {
      * @param examQuestion
      */
     private void updateCorrectAnswer(Long examRecordDataId, ExamQuestion examQuestion) {
+        //更新客观题答案
         QuestionAnswerCacheBean questionAnswerCache = CacheHelper.getQuestionAnswer(examQuestion.getQuestionId());
         List<String> rightAnswerList = questionAnswerCache.getRightAnswers();
-        examQuestion.setCorrectAnswer(rightAnswerList.get(examQuestion.getOrder() - 1));
 
-        examRecordQuestionsService.saveExamQuestion(examRecordDataId, examQuestion.getOrder(), examQuestion);
+        ExamRecordQuestions examRecordQuestions = examRecordQuestionsService.getExamRecordQuestions(examRecordDataId);
+        List<ExamQuestion> examQuestionList = examRecordQuestions.getExamQuestions();
+
+
+        //最小维度的小题单元集合
+        List<ExamQuestion> questionUnitList = examQuestionList.stream().
+                filter(p -> p.getQuestionId().equals(examQuestion.getQuestionId())).
+                sorted((o1, o2) -> o1.getOrder().intValue() - o2.getOrder().intValue()).collect(Collectors.toList());
+
+        //循环保存所有小题单元
+        for (int i = 0; i < questionUnitList.size(); i++) {
+            ExamQuestion curUnitQuestion = questionUnitList.get(i);
+            curUnitQuestion.setCorrectAnswer(rightAnswerList.get(i));
+            examRecordQuestionsService.saveExamQuestion(examRecordDataId, curUnitQuestion.getOrder(), curUnitQuestion);
+        }
+
     }
 }