Bläddra i källkod

获取乱序后的试卷bugfix

wangliang 3 år sedan
förälder
incheckning
93c6e37022

+ 14 - 1
themis-business/src/main/java/com/qmth/themis/business/cache/bean/ExamRecordPaperViewBean.java

@@ -56,6 +56,9 @@ public class ExamRecordPaperViewBean implements Serializable {
     @ApiModelProperty(value = "答题记录json")
     private String examStudentAnswerJson;
 
+    @ApiModelProperty(value = "乱序后的试卷结构json,没有则为null")
+    private String randomPaperStructPath;
+
     public ExamRecordPaperViewBean() {
 
     }
@@ -70,7 +73,8 @@ public class ExamRecordPaperViewBean implements Serializable {
                                    FinishTypeEnum finishType,
                                    String paperStructJson,
                                    String answerJson,
-                                   String examStudentAnswerJson) {
+                                   String examStudentAnswerJson,
+                                   String randomPaperStructPath) {
         this.examRecordId = examRecordId;
         this.examStudentName = examStudentName;
         this.identity = identity;
@@ -82,6 +86,15 @@ public class ExamRecordPaperViewBean implements Serializable {
         this.paperStructJson = paperStructJson;
         this.answerJson = answerJson;
         this.examStudentAnswerJson = examStudentAnswerJson;
+        this.randomPaperStructPath = randomPaperStructPath;
+    }
+
+    public String getRandomPaperStructPath() {
+        return randomPaperStructPath;
+    }
+
+    public void setRandomPaperStructPath(String randomPaperStructPath) {
+        this.randomPaperStructPath = randomPaperStructPath;
     }
 
     public String getPaperStructJson() {

+ 7 - 2
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeExamRecordServiceImpl.java

@@ -1435,7 +1435,7 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
         ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(tOeExamRecord.getExamStudentId());
         Optional.ofNullable(examStudentCacheBean).orElseThrow(() -> new BusinessException(ExceptionResultEnum.NOT_FOUND_EXAM_STUDENT));
 
-        JSONObject paperStructJson = null, answerJson = null;
+        JSONObject paperStructJson = null, answerJson = null, randomPaperStructJson = null;
         String examStudentAnswerJson = null;
         if (Objects.nonNull(teExamPaper.getPaperViewPath())) {
             //获取试卷结构json
@@ -1445,6 +1445,10 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
             //获取答案结构json
             answerJson = JSONObject.parseObject(new String(ossUtil.download(false, teExamPaper.getAnswerPath()), StandardCharsets.UTF_8));
         }
+        if (Objects.nonNull(tOeExamRecord.getPaperStructPath())) {
+            //获取乱序后的试卷结构json
+            randomPaperStructJson = JSONObject.parseObject(new String(ossUtil.download(false, tOeExamRecord.getPaperStructPath()), StandardCharsets.UTF_8));
+        }
 
         QueryWrapper<TOeExamAnswer> tOeExamAnswerQueryWrapper = new QueryWrapper<>();
         tOeExamAnswerQueryWrapper.lambda().eq(TOeExamAnswer::getExamRecordId, tOeExamRecord.getId())
@@ -1466,7 +1470,8 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
                 tOeExamRecord.getFinishType(),
                 Objects.nonNull(paperStructJson) ? paperStructJson.toJSONString() : null,
                 Objects.nonNull(answerJson) ? answerJson.toJSONString() : null,
-                examStudentAnswerJson);
+                examStudentAnswerJson,
+                Objects.nonNull(randomPaperStructJson) ? randomPaperStructJson.toJSONString() : null);
     }
 
     /**