|
@@ -1,5 +1,13 @@
|
|
|
package cn.com.qmth.examcloud.tool.task.oe;
|
|
|
|
|
|
+import cn.com.qmth.examcloud.api.commons.enums.ExamType;
|
|
|
+import cn.com.qmth.examcloud.question.commons.core.question.AnswerType;
|
|
|
+import cn.com.qmth.examcloud.question.commons.core.question.QuestionType;
|
|
|
+import cn.com.qmth.examcloud.support.enums.ExamRecordStatus;
|
|
|
+import cn.com.qmth.examcloud.support.enums.HandInExamType;
|
|
|
+import cn.com.qmth.examcloud.support.enums.SyncStatus;
|
|
|
+import cn.com.qmth.examcloud.support.examing.ExamQuestion;
|
|
|
+import cn.com.qmth.examcloud.support.examing.ExamRecordData;
|
|
|
import cn.com.qmth.examcloud.tool.config.RedisClient;
|
|
|
import cn.com.qmth.examcloud.tool.task.Task;
|
|
|
import org.slf4j.Logger;
|
|
@@ -7,6 +15,8 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
/**
|
|
|
* 初始化考试环境检测数据
|
|
|
*/
|
|
@@ -21,8 +31,71 @@ public class InitExamEnvData implements Task {
|
|
|
@Override
|
|
|
public void start(String params) {
|
|
|
log.info("task start... " + params);
|
|
|
- // todo
|
|
|
+
|
|
|
+ /* select * from ec_oe_exam_record_data where root_org_id=0 and exam_type = 'ONLINE' limit 1; */
|
|
|
+
|
|
|
+ Long examRecordDataId = 1L; // dev
|
|
|
+ // Long examRecordDataId = 219245L; // test
|
|
|
+ // Long examRecordDataId = 4818250L; // prod
|
|
|
+
|
|
|
+ this.initExamRecordData(examRecordDataId);
|
|
|
+ this.initExamQuestion(examRecordDataId);
|
|
|
+
|
|
|
log.info("task end...");
|
|
|
}
|
|
|
|
|
|
+ private void initExamRecordData(Long examRecordDataId) {
|
|
|
+ ExamRecordData examRecordData = new ExamRecordData();
|
|
|
+ examRecordData.setId(examRecordDataId);
|
|
|
+ examRecordData.setExamStudentId(0L);
|
|
|
+ examRecordData.setStudentId(0L);
|
|
|
+
|
|
|
+ examRecordData.setBasePaperId("0");
|
|
|
+ examRecordData.setPaperType("X");
|
|
|
+ examRecordData.setQuestionCount(1);
|
|
|
+
|
|
|
+ examRecordData.setRootOrgId(0L);
|
|
|
+ examRecordData.setOrgId(0L);
|
|
|
+ examRecordData.setCourseId(0L);
|
|
|
+ examRecordData.setExamId(0L);
|
|
|
+ examRecordData.setExamType(ExamType.ONLINE);
|
|
|
+ examRecordData.setExamRecordStatus(ExamRecordStatus.EXAM_END);
|
|
|
+ examRecordData.setHandInExamType(HandInExamType.MANUAL);
|
|
|
+ examRecordData.setSyncStatus(SyncStatus.SYNCED);
|
|
|
+
|
|
|
+ examRecordData.setIsAllObjectivePaper(false);
|
|
|
+ examRecordData.setIsWarn(false);
|
|
|
+ examRecordData.setIsAudit(false);
|
|
|
+ examRecordData.setIsIllegality(false);
|
|
|
+ examRecordData.setIsContinued(false);
|
|
|
+ examRecordData.setContinuedCount(0);
|
|
|
+ examRecordData.setUsedExamTime(0L);
|
|
|
+
|
|
|
+ examRecordData.setStartTime(new Date());
|
|
|
+ examRecordData.setLastActiveTime(new Date());
|
|
|
+ examRecordData.setEnterExamTime(new Date());
|
|
|
+ examRecordData.setEndTime(new Date());
|
|
|
+
|
|
|
+ String key = "OE_ERD:" + examRecordData.getId();
|
|
|
+ redisClient.set(key, examRecordData);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initExamQuestion(Long examRecordDataId) {
|
|
|
+ ExamQuestion examQuestion = new ExamQuestion();
|
|
|
+ examQuestion.setExamRecordDataId(examRecordDataId);
|
|
|
+ examQuestion.setOrder(1);
|
|
|
+ examQuestion.setIsInMongo(false);
|
|
|
+
|
|
|
+ examQuestion.setMainNumber(1);
|
|
|
+ examQuestion.setQuestionType(QuestionType.ESSAY);
|
|
|
+ examQuestion.setQuestionScore(1.0);
|
|
|
+ examQuestion.setAnswerType(AnswerType.SINGLE_AUDIO);
|
|
|
+ examQuestion.setIsAnswer(false);
|
|
|
+ examQuestion.setExamQuestionTempId("1");
|
|
|
+ examQuestion.setQuestionId("1");
|
|
|
+
|
|
|
+ String key = "OE_ANSWER:" + examQuestion.getExamRecordDataId() + "_" + examQuestion.getOrder();
|
|
|
+ redisClient.set(key, examQuestion);
|
|
|
+ }
|
|
|
+
|
|
|
}
|