Browse Source

update 千卷抽卷

deason 2 years ago
parent
commit
ea3c0a9ce1

+ 2 - 1
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/ExamRecordDataService.java

@@ -30,7 +30,8 @@ public interface ExamRecordDataService {
                                         boolean isFullyObjective,
                                         Long examStageId,
                                         Integer examStageOrder,
-                                        boolean randomPaper);
+                                        boolean randomPaper,
+                                        double paperScore);
 
     /**
      * @param examRecordDataId

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

@@ -208,6 +208,16 @@ public class ExamControlServiceImpl implements ExamControlService {
         return defaultPaper;
     }
 
+    private double parsePaperScore(DefaultPaper defaultPaper) {
+        double paperScore = 0d;
+        if (CollectionUtils.isNotEmpty(defaultPaper.getQuestionGroupList())) {
+            for (DefaultQuestionGroup group : defaultPaper.getQuestionGroupList()) {
+                paperScore += group.getGroupScore();
+            }
+        }
+        return paperScore;
+    }
+
     /**
      * 开始考试
      *
@@ -250,12 +260,13 @@ public class ExamControlServiceImpl implements ExamControlService {
         // 是否采用千人千卷规则
         boolean randomPaper = CallType.RANDOM_PAPER.name().equals(examBean.getCallType());
         DefaultPaper defaultPaper = this.buildPaper(extractConfig, examingSession.getPaperType(), randomPaper);
+        double paperScore = this.parsePaperScore(defaultPaper);
 
         // 生成考试记录
         ExamStudentCacheBean examStudent = CacheHelper.getExamStudent(examStudentId);
         ExamRecordData examRecordData = examRecordDataService.createExamRecordData(examingSession,
                 examBean, courseBean, defaultPaper.getId(), defaultPaper.getFullyObjective(),
-                examStudent.getExamStageId(), examStudent.getExamStageOrder(), randomPaper);
+                examStudent.getExamStageId(), examStudent.getExamStageOrder(), randomPaper, paperScore);
 
         // 如果开启人脸比对,将同步人脸比对结果存储到抓后结果表中
         Long rootOrgId = examRecordData.getRootOrgId();

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

@@ -105,7 +105,8 @@ public class ExamRecordDataServiceImpl implements ExamRecordDataService {
                                                boolean isFullyObjective,
                                                Long examStageId,
                                                Integer examStageOrder,
-                                               boolean randomPaper) {
+                                               boolean randomPaper,
+                                               double paperScore) {
         ExamRecordDataEntity examRecordData = new ExamRecordDataEntity();
         examRecordData.setExamId(examBean.getId());
         examRecordData.setExamType(ExamType.valueOf(examBean.getExamType()));
@@ -116,11 +117,14 @@ public class ExamRecordDataServiceImpl implements ExamRecordDataService {
         examRecordData.setRootOrgId(examingSession.getRootOrgId());
 
         examRecordData.setCourseId(courseBean.getId());
-        examRecordData.setBasePaperId(basePaperId);
         examRecordData.setPaperType(examingSession.getPaperType());
 
-        examRecordData.setRandomPaper(randomPaper);// 是否采用千人千卷规则
-        examRecordData.setPaperScore(0d);//todo 试卷总分
+        // 采用千人千卷规则时,ID实际为randomPaperId
+        examRecordData.setBasePaperId(basePaperId);
+        // 是否采用千人千卷规则
+        examRecordData.setRandomPaper(randomPaper);
+        // 试卷总分
+        examRecordData.setPaperScore(paperScore);
 
         examRecordData.setEnterExamTime(new Date());
         examRecordData.setIsContinued(false);