xiatian 1 жил өмнө
parent
commit
d73d54a763

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

@@ -2,6 +2,7 @@ package cn.com.qmth.examcloud.core.oe.admin.api.provider;
 
 import cn.com.qmth.examcloud.api.commons.enums.ExamType;
 import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.util.StringUtil;
 import cn.com.qmth.examcloud.core.oe.admin.api.SyncExamDataCloudService;
 import cn.com.qmth.examcloud.core.oe.admin.api.bean.*;
 import cn.com.qmth.examcloud.core.oe.admin.api.request.SyncExamDataReq;
@@ -15,7 +16,9 @@ import cn.com.qmth.examcloud.question.commons.core.question.AnswerType;
 import cn.com.qmth.examcloud.support.CacheConstants;
 import cn.com.qmth.examcloud.support.cache.CacheHelper;
 import cn.com.qmth.examcloud.support.cache.bean.CourseCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.ExamPropertyCacheBean;
 import cn.com.qmth.examcloud.support.cache.bean.ExamSettingsCacheBean;
+import cn.com.qmth.examcloud.support.enums.ExamProperties;
 import cn.com.qmth.examcloud.support.helper.ExamCacheTransferHelper;
 import cn.com.qmth.examcloud.support.helper.FaceBiopsyHelper;
 import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
@@ -40,6 +43,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 /**
  * @Description 同步考试相关数据接口
@@ -269,6 +273,9 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
         }
 
         startTime = this.debugCost("13 如果开启了活检,计算违纪自动审核结果", transitionExamRecordDataId, startTime);
+        
+        //若开启审核全通过
+        auditPassExamRecordData(transitionExamRecordData.getExamId(), realExamRecordDataId);
 
         //同步后续处理
         processAfterSyncExamData(realExamRecordDataId, examScoreId, transitionExamRecordData.getObjectiveScore(),
@@ -280,6 +287,20 @@ public class SyncExamDataCloudServiceProvider extends ControllerSupport implemen
 
         return new SyncExamDataResp();
     }
+    
+    private void auditPassExamRecordData(Long examId,Long realExamRecordDataId) {
+    	//开启审核全通过
+    	ExamPropertyCacheBean ep = CacheHelper.getExamProperty(examId, ExamProperties.AUDIT_ALL_PASS.name());
+        if (ep != null && StringUtil.isTrue(ep.getValue())) {
+	        Optional<ExamRecordDataEntity> optional = examRecordDataRepo.findById(realExamRecordDataId);
+	        if (optional.isPresent()) {
+	            // 修改考试记录为已审
+	            ExamRecordDataEntity entity = optional.get();
+	            entity.setIsAudit(true);
+	            examRecordDataRepo.save(entity);
+	        }
+        }
+    }
 
 
     private void syncExamContinuedRecords(List<ExamContinuedRecordBean> examContinuedRecords, Long realExamRecordDataId) {