Pārlūkot izejas kodu

修复考生考试完成状态未更新的bug

lideyin 5 gadi atpakaļ
vecāks
revīzija
86566ade46

+ 5 - 3
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/SyncExamDataCloudServiceProvider.java

@@ -109,7 +109,7 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
 
         //必须先更新考生的考试次数,同步考试记录会用
         Long examStudentId = transitionExamRecordData.getExamStudentId();
-        increaseUsedExamTimes(examStudentId);
+        updateExamStudent(examStudentId);
 
         //同步考试记录,并返回真实的考试记录id
         Long realExamRecordDataId = syncExamRecordData(transitionExamRecordData);
@@ -189,11 +189,12 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
     }
 
     /**
-     * 增加考试次数
+     * 更新考生相关信息
+     * 增加考试次数,修改考试状态为已完成
      *
      * @param examStudentId
      */
-    private void increaseUsedExamTimes(Long examStudentId) {
+    private void updateExamStudent(Long examStudentId) {
         //更新数据库中的已考次数
         ExamStudentEntity examStudentEntity = examStudentRepo.findByExamStudentId(examStudentId);
         if (null == examStudentEntity) {
@@ -205,6 +206,7 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
                 : examStudentEntity.getUsedNum();
 
         examStudentEntity.setUsedNum(usedTimes + 1);
+        examStudentEntity.setFinished(true);
 
         examStudentRepo.saveAndFlush(examStudentEntity);
     }