From 045b55722b25ccc77d88671c5d6df309edb8a66d Mon Sep 17 00:00:00 2001
From: 钟日健 <5689795+arsn@user.noreply.gitee.com>
Date: Tue, 22 Feb 2022 16:00:34 +0800
Subject: [PATCH] 1. 保安员新增异步推送数据至群访用户表 2. 会员标记接口新增,会员标记成功,则创建会员记录和会员题库记录(包含120道题目) 3. web 端考试开始,查询题目判断用户是否为会员,如果为会员则从会员题库获取当前人员的考试题目(从120道题中随机抽取60道)

---
 src/main/java/org/springblade/modules/exam/service/impl/ExamSubjectChoicesServiceImpl.java |   33 ++++++++++++++++++++++++++++-----
 1 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/springblade/modules/exam/service/impl/ExamSubjectChoicesServiceImpl.java b/src/main/java/org/springblade/modules/exam/service/impl/ExamSubjectChoicesServiceImpl.java
index 5048244..f94719f 100644
--- a/src/main/java/org/springblade/modules/exam/service/impl/ExamSubjectChoicesServiceImpl.java
+++ b/src/main/java/org/springblade/modules/exam/service/impl/ExamSubjectChoicesServiceImpl.java
@@ -5,6 +5,7 @@
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.AllArgsConstructor;
 import org.springblade.common.utils.arg;
+import org.springblade.modules.FTP.FtpUtil;
 import org.springblade.modules.exam.entity.ExamAnswerRecord;
 import org.springblade.modules.exam.entity.ExamSubjectChoices;
 import org.springblade.modules.exam.entity.ExamSubjectOption;
@@ -18,6 +19,7 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.text.SimpleDateFormat;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
@@ -350,11 +352,11 @@
 
 	/**
 	 * 新增答题记录
-	 * @param choices
-	 * @param preSubJectId
-	 * @param preResult
-	 * @param scoreId
-	 * @param result
+	 * @param choices 题目
+	 * @param preSubJectId 上一题题目id
+	 * @param preResult 上一题答题结果
+	 * @param scoreId 成绩 id
+	 * @param result 答题是否正确
 	 */
 	private void saveExamAns(ExamSubjectChoices choices, Long preSubJectId, String preResult, Long scoreId,boolean result) {
 		ExamAnswerRecord examAnswerRecord = new ExamAnswerRecord();
@@ -378,5 +380,26 @@
 		examAnswerRecordService.save(examAnswerRecord);
 
 		//内网数据同步...
+		String s = "insert into exam_answer_record(id,subject_choices_id,subject_choices_type,answer_option,answer" +
+			",answer_time,answer_score,answer_result,score_id) " +
+			"values(" + "'" + examAnswerRecord.getId() + "'" +
+			"," + "'" + examAnswerRecord.getSubjectChoicesId() + "'" +
+			"," + "'" + examAnswerRecord.getSubjectChoicesType() + "'" +
+			"," + "'" + examAnswerRecord.getAnswerOption() + "'" +
+			"," + "'" + examAnswerRecord.getAnswer() + "'" +
+			"," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examAnswerRecord.getAnswerTime()) + "'" +
+			"," + "'" + examAnswerRecord.getAnswerScore() + "'" +
+			"," + "'" + examAnswerRecord.getAnswerResult() + "'" +
+			"," + "'" + examAnswerRecord.getScoreId() + "'" + ")";
+		FtpUtil.sqlFileUpload(s);
+	}
+
+	/**
+	 * 随机查询题库120道
+	 * @return
+	 */
+	@Override
+	public List<String> getExamSubjectChoicesList() {
+		return baseMapper.getExamSubjectChoicesList();
 	}
 }

--
Gitblit v1.9.3