Commit 3cfb2396 by yushien

Merge remote-tracking branch 'origin/master'

parents 1b8aff7e b6211781
......@@ -20,12 +20,12 @@ import java.math.BigDecimal;
@TableName("db_test_paper_record_detail")
public class DbTestPaperRecordDetail extends BaseEntity {
private static final long serialVersionUID=1L;
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id",type = IdType.AUTO)
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 记录id
......@@ -39,6 +39,11 @@ public class DbTestPaperRecordDetail extends BaseEntity {
* 答案
*/
private String answer;
/**
* 图片答案
*/
private String answersPic;
/**
* 正确答案
*/
......
......@@ -24,4 +24,9 @@ public class TestPaperAnswerItemBo implements Serializable {
* 学生答题内容
*/
private String answer;
/**
* 学生答题内容(图片)
*/
private String answerPic;
}
......@@ -45,6 +45,11 @@ public class DbTestPaperRecordDetailVo {
*/
@ExcelProperty(value = "答案")
private String answer;
/**
* 图片答案
*/
@ExcelProperty(value = "答案")
private String answerPic;
/**
* 正确答案
......
......@@ -29,6 +29,16 @@ public class TestQuestionItemVo {
private String answer;
/**
* 我的答案(图片)
*/
private String answerPic;
/**
* 题目类型 1填空,2选择,3解答
*/
private Integer species;
/**
* 选择题选项
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
......
......@@ -94,7 +94,7 @@ public class TestPaperServiceImpl implements ITestPaperService {
// 若传入了本题的结果,则先将结果存入Redis中
if (CollUtil.isNotEmpty(request.getAnswers())) {
request.getAnswers().forEach(answer -> {
Objects.requireNonNull(answer.getId(),"题目ID非法");
Objects.requireNonNull(answer.getId(), "题目ID非法");
String key = String.format(TEST_PAPER_ANSWER_KEY_FORMAT, TEST_PAPER_ANSWER_KEY, request.getRecordId(), answer.getId());
RedisUtils.setCacheObject(key, answer);
});
......@@ -108,6 +108,7 @@ public class TestPaperServiceImpl implements ITestPaperService {
TestPaperAnswerItemBo cacheObject = RedisUtils.getCacheObject(key);
Optional.ofNullable(cacheObject).ifPresent(cache -> {
question.setAnswer(cache.getAnswer());
question.setAnswerPic(cache.getAnswerPic());
});
});
return result;
......@@ -139,6 +140,7 @@ public class TestPaperServiceImpl implements ITestPaperService {
TestPaperAnswerItemBo cacheObject = RedisUtils.getCacheObject(key);
Optional.ofNullable(cacheObject).ifPresent(cache -> {
buffer.setAnswer(cache.getAnswer());
buffer.setAnswersPic(cache.getAnswerPic());
});
// 计算选择题分数
DbQuestionBankTestPaperVo bankTestPaperVo = bankTestPaperService.queryById(question.getId());
......
......@@ -28,6 +28,7 @@
<resultMap id="TestPaper" type="com.ruoyi.school.paper.domain.vo.TestQuestionItemVo">
<id property="id" column="id"/>
<result property="topic" column="topic"/>
<result property="species" column="species"/>
<collection property="options" column="id" ofType="com.ruoyi.school.paper.domain.vo.OptionsVo" select="selectOptions">
<result property="optionTag" column="option_tag"/>
<result property="optionContent" column="option_content"/>
......@@ -42,7 +43,8 @@
<select id="selectTestPaperQuestion" resultMap="TestPaper">
select question_bank.id,
question_bank.topic
question_bank.topic,
question_bank.species
from db_test_paper_record as answer_sheet
join db_question_bank_test_paper as question_bank
on answer_sheet.test_paper_id = question_bank.test_paper_id
......
......@@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="com.ruoyi.school.paper.domain.vo.DbTestPaperRecordDetailVo" id="TestPaperRecordDetailResult">
<result property="topic" column="topic"/>
<result property="answer" column="answer"/>
<result property="answerPic" column="answers_pic"/>
<result property="score" column="score"/>
<result property="correctAnswer" column="correctAnswer"/>
<result property="righAnswersPic" column="right_answers_pic"/>
......@@ -40,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dqbatp.right_answers as correctAnswer,
dqbatp.right_answers_pic,
dtprd.answer,
dtprd.answers_pic,
dtprd.score,
d.option_tag,
d.option_content,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment