Parcourir la source

获取乱序后的试卷bugfix

wangliang il y a 3 ans
Parent
commit
d4d1f11d84

+ 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 - 3
themis-business/src/main/java/com/qmth/themis/business/service/impl/TOeExamRecordServiceImpl.java

@@ -16,7 +16,6 @@ import com.qmth.themis.business.cache.bean.*;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dao.TOeExamRecordMapper;
 import com.qmth.themis.business.dto.MqDto;
-import com.qmth.themis.business.dto.cache.TEStudentCacheDto;
 import com.qmth.themis.business.dto.response.MarkResultDto;
 import com.qmth.themis.business.dto.response.TEExamUnFinishDto;
 import com.qmth.themis.business.entity.TOeExamAnswer;
@@ -1444,7 +1443,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
@@ -1454,6 +1453,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())
@@ -1475,7 +1478,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);
     }
 
     /**