|
@@ -1,24 +1,15 @@
|
|
|
package cn.com.qmth.examcloud.core.oe.admin.api.provider;
|
|
|
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.SyncExamDataCloudService;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.api.bean.ExamStudentBeanConvert;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.bean.*;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.request.SyncExamDataReq;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.response.SyncExamDataResp;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordDataRepo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamStudentRepo;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordDataEntity;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamStudentEntity;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamRecordForMarkingService;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamScoreObtainQueueService;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamScorePushQueueService;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.ExamStudentService;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.bean.examstudent.ExamStudentInfo;
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.service.cache.ExamStudentCache;
|
|
|
-import cn.com.qmth.examcloud.global.api.HandleSyncCloudService;
|
|
|
-import cn.com.qmth.examcloud.global.api.request.*;
|
|
|
-import cn.com.qmth.examcloud.global.api.response.*;
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.service.*;
|
|
|
+import cn.com.qmth.examcloud.support.enums.SyncStatus;
|
|
|
+import cn.com.qmth.examcloud.support.examing.ExamBoss;
|
|
|
+import cn.com.qmth.examcloud.support.examing.ExamRecordData;
|
|
|
import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
|
-import com.google.common.collect.Lists;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -27,8 +18,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
/**
|
|
|
* @Description 同步考试相关数据接口
|
|
|
* @Author lideyin
|
|
@@ -40,41 +29,138 @@ import java.util.List;
|
|
|
@RequestMapping("${$rmp.cloud.oe}/exam/sync")
|
|
|
public class SyncExamDataCloudServiceProvider extends ControllerSupport implements SyncExamDataCloudService {
|
|
|
|
|
|
- private static final long serialVersionUID = -25466948667789119L;
|
|
|
+ private static final long serialVersionUID = -25466948667789119L;
|
|
|
|
|
|
- @Autowired
|
|
|
- private ExamRecordForMarkingService examRecordForMarkingService;
|
|
|
- @Autowired
|
|
|
- private ExamScorePushQueueService examScorePushQueueService;
|
|
|
- @Autowired
|
|
|
- private ExamScoreObtainQueueService examScoreObtainQueueService;
|
|
|
+ @Autowired
|
|
|
+ private ExamRecordForMarkingService examRecordForMarkingService;
|
|
|
+ @Autowired
|
|
|
+ private ExamScorePushQueueService examScorePushQueueService;
|
|
|
+ @Autowired
|
|
|
+ private ExamScoreObtainQueueService examScoreObtainQueueService;
|
|
|
+ @Autowired
|
|
|
+ private ExamBossService examBossService;
|
|
|
+ @Autowired
|
|
|
+ ExamRecordDataCacheService examRecordDataCacheService;
|
|
|
|
|
|
- /**
|
|
|
- * 同步考试记录数据
|
|
|
- *
|
|
|
- * @param req
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "同步考试记录相关数据")
|
|
|
- @PostMapping("/syncExamData")
|
|
|
- @Override
|
|
|
- public SyncExamDataResp syncExamData(@RequestBody SyncExamDataReq req) {
|
|
|
+ /**
|
|
|
+ * 同步考试记录数据
|
|
|
+ *
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "同步考试记录相关数据")
|
|
|
+ @PostMapping("/syncExamData")
|
|
|
+ @Override
|
|
|
+ public SyncExamDataResp syncExamData(@RequestBody SyncExamDataReq req) {
|
|
|
+
|
|
|
+ //同步考试记录
|
|
|
+ ExamRecordDataEntity examRecordData= syncExamRecordData(req.getExamRecordData());
|
|
|
+
|
|
|
+ Long examRecordDataId= examRecordData.getId();
|
|
|
+
|
|
|
+ //同步抓拍照片结果(包括同步抓拍和异步抓拍的数据)
|
|
|
+ syncExamCapture(req.getExamCapture(),examRecordDataId);
|
|
|
+
|
|
|
+ //同步face id活体检测数据
|
|
|
+ syncExamFaceLivenessVerify(req.getExamFaceLivenessVerify(),examRecordDataId);
|
|
|
+
|
|
|
+ //同步新活检
|
|
|
+ syncFaceBiopsy(req.getFaceBiopsy(),examRecordDataId);
|
|
|
+
|
|
|
+ //同步考试记录对应的试卷结构
|
|
|
+ syncExamRecordPaperStruct(req.getExamRecordPaperStruct(),examRecordDataId);
|
|
|
+
|
|
|
+ //同步作答记录
|
|
|
+ syncExamRecordQuestions(req.getExamRecordQuestions(),examRecordDataId);
|
|
|
+
|
|
|
+ //计算违纪自动审核结果(无人脸或活检失败)
|
|
|
+ saveAutoAudit(examRecordDataId);
|
|
|
+
|
|
|
+ //同步后续处理
|
|
|
+ processAfterSyncExamData(examRecordDataId, examRecordData.getExamId());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private ExamRecordDataEntity syncExamRecordData(ExamRecordDataBean examRecordData) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void saveAutoAudit(Long examRecordDataId) {
|
|
|
+ }
|
|
|
+
|
|
|
+ private void syncExamRecordQuestions(ExamRecordQuestionsBean examRecordQuestions, Long examRecordDataId) {
|
|
|
+ }
|
|
|
|
|
|
+ private void syncExamRecordPaperStruct(ExamRecordPaperStructBean examRecordPaperStruct, Long examRecordDataId) {
|
|
|
+ }
|
|
|
|
|
|
+ private void syncFaceBiopsy(FaceBiopsyBean faceBiopsy, Long examRecordDataId) {
|
|
|
+ }
|
|
|
|
|
|
- Long examRecordDataId=0L;//todo 取admin服务中的考试记录id
|
|
|
- processAfterSyncExamData(examRecordDataId);
|
|
|
- return null;
|
|
|
- }
|
|
|
+ private void syncExamFaceLivenessVerify(ExamFaceLivenessVerifyBean examFaceLivenessVerify, Long examRecordDataId) {
|
|
|
+ }
|
|
|
|
|
|
- private void processAfterSyncExamData(Long examRecordDataId) {
|
|
|
- // 保存阅卷相关数据
|
|
|
- examRecordForMarkingService.saveExamRecordForMarking(examRecordDataId);
|
|
|
+ private void syncExamCapture(ExamCaptureBean examCapture, Long examRecordDataId) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 同步后的后续操作
|
|
|
+ *
|
|
|
+ * @param examRecordDataId
|
|
|
+ * @param examId
|
|
|
+ */
|
|
|
+ private void processAfterSyncExamData(Long examRecordDataId, Long examId) {
|
|
|
+ // 保存阅卷相关数据
|
|
|
+ examRecordForMarkingService.saveExamRecordForMarking(examRecordDataId);
|
|
|
+
|
|
|
+ // 保存考试分数数据到推分队列
|
|
|
+ examScorePushQueueService.saveScoreDataInfoToQueue(examRecordDataId);
|
|
|
+
|
|
|
+ // 保存考试分数数据到分数获取队列
|
|
|
+ examScoreObtainQueueService.saveExamScoreObtainQueue(examRecordDataId);
|
|
|
+
|
|
|
+ //清理考试缓存
|
|
|
+ clearExamCache(examId);
|
|
|
+
|
|
|
+ //设置并保存考试记录缓存中数据同步状态
|
|
|
+ setAndSaveExamRecordDataSyncStatus(examRecordDataId);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 考试id
|
|
|
+ *
|
|
|
+ * @param examId
|
|
|
+ */
|
|
|
+ private void clearExamCache(Long examId) {
|
|
|
+ ExamBoss examBoss = examBossService.getExamBoss(examId);
|
|
|
+
|
|
|
+ if (null == examBoss) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //考试完结次数加1
|
|
|
+ examBoss.setEndCount(examBoss.getEndCount() + 1);
|
|
|
+
|
|
|
+ //如果开考次数==考试完结次数,则删除考试基础信息缓存
|
|
|
+ if (examBoss.getStartCount() == examBoss.getEndCount()) {
|
|
|
+ examBossService.deleteExamBoss(examId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置考试记录的同步状态
|
|
|
+ * @param examRecordDataId
|
|
|
+ */
|
|
|
+ private void setAndSaveExamRecordDataSyncStatus(Long examRecordDataId) {
|
|
|
+ ExamRecordData examRecordData = examRecordDataCacheService.getExamRecordDataCache(examRecordDataId);
|
|
|
|
|
|
- // 保存考试分数数据到推分队列
|
|
|
- examScorePushQueueService.saveScoreDataInfoToQueue(examRecordDataId);
|
|
|
+ if (SyncStatus.SYNCED == examRecordData.getSyncStatus()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- // 保存考试分数数据到分数获取队列
|
|
|
- examScoreObtainQueueService.saveExamScoreObtainQueue(examRecordDataId);
|
|
|
- }
|
|
|
+ examRecordData.setSyncStatus(SyncStatus.SYNCED);
|
|
|
+ examRecordDataCacheService.saveExamRecordDataCache(examRecordDataId, examRecordData);
|
|
|
+ }
|
|
|
}
|