【修改】 错题集相关优化
This commit is contained in:
@@ -59,7 +59,11 @@
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId> <!-- 代码生成器,使用它解析表结构 -->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.17.1</version> <!-- 请使用最新版本 -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pc.exam.gg</groupId>
|
||||
<artifactId>exam-spring-boot-starter-redis</artifactId>
|
||||
|
@@ -23,10 +23,15 @@ public class ErrorQuestionListVo {
|
||||
*/
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 任务名称
|
||||
*/
|
||||
private String taskName;
|
||||
|
||||
/**
|
||||
* 错误次数
|
||||
*/
|
||||
private String errorNumber;
|
||||
|
||||
/**
|
||||
* 章节名称
|
||||
*/
|
||||
@@ -36,40 +41,17 @@ public class ErrorQuestionListVo {
|
||||
*/
|
||||
private String subjectName;
|
||||
|
||||
/**
|
||||
* 题型难度(0:简单,1:一般,2:困难)
|
||||
*/
|
||||
private Integer quLevel;
|
||||
|
||||
/**
|
||||
* 试题内容(带样式:<p>下列表格123</p>\n<table style=\"border-collapse: collapse; width: 100%;\" border=\"1\">\n<tbody>\n<tr>\n<td style=\"width: 31.4907%;\">1</td>\)
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 试题内容(纯文本)
|
||||
*/
|
||||
private String contentText;
|
||||
|
||||
/**
|
||||
* 解析(带样式)
|
||||
*/
|
||||
private String analysis;
|
||||
|
||||
/**
|
||||
* c语言参考答案
|
||||
*/
|
||||
private String answer;
|
||||
|
||||
|
||||
/**
|
||||
* 知识点
|
||||
*/
|
||||
private String pointNames;
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
private String keywords;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
@@ -80,10 +62,7 @@ public class ErrorQuestionListVo {
|
||||
* 专业分类
|
||||
*/
|
||||
private String specialtyName;
|
||||
/**
|
||||
* 数据库名
|
||||
*/
|
||||
private String tname;
|
||||
|
||||
|
||||
/**
|
||||
* 试题答案
|
||||
@@ -96,15 +75,12 @@ public class ErrorQuestionListVo {
|
||||
private List<ExamQuestionFile> fileUploads;
|
||||
|
||||
/**
|
||||
* 试题判分
|
||||
* 答案
|
||||
*/
|
||||
private ExamQuestionScore questionScores;
|
||||
|
||||
private String answer;
|
||||
/**
|
||||
* 试题关键字
|
||||
* 创建时间
|
||||
*/
|
||||
private List<ExamQuestionKeyword> questionKeywords;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private String creator;
|
||||
|
@@ -37,89 +37,14 @@ public class ExamErrorQuestion {
|
||||
private String taskId;
|
||||
|
||||
/**
|
||||
* 章节名称
|
||||
* 创建时间
|
||||
*/
|
||||
private String chapteridDictText;
|
||||
/**
|
||||
* 题型名称
|
||||
*/
|
||||
private String subjectName;
|
||||
|
||||
/**
|
||||
* 题型难度(0:简单,1:一般,2:困难)
|
||||
*/
|
||||
private Integer quLevel;
|
||||
|
||||
/**
|
||||
* 试题内容(带样式:<p>下列表格123</p>\n<table style=\"border-collapse: collapse; width: 100%;\" border=\"1\">\n<tbody>\n<tr>\n<td style=\"width: 31.4907%;\">1</td>\)
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 试题内容(纯文本)
|
||||
*/
|
||||
private String contentText;
|
||||
|
||||
/**
|
||||
* 解析(带样式)
|
||||
*/
|
||||
private String analysis;
|
||||
|
||||
/**
|
||||
* c语言参考答案
|
||||
*/
|
||||
private String answer;
|
||||
|
||||
|
||||
/**
|
||||
* 知识点
|
||||
*/
|
||||
private String pointNames;
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
private String keywords;
|
||||
|
||||
/**
|
||||
* 课程类别
|
||||
*/
|
||||
private String courseName;
|
||||
|
||||
/**
|
||||
* 专业分类
|
||||
*/
|
||||
private String specialtyName;
|
||||
/**
|
||||
* 数据库名
|
||||
*/
|
||||
private String tname;
|
||||
|
||||
/**
|
||||
* 试题答案
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<ExamQuestionAnswer> answerList;
|
||||
|
||||
/**
|
||||
* 试题文件
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<ExamQuestionFile> fileUploads;
|
||||
|
||||
/**
|
||||
* 试题判分
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private ExamQuestionScore questionScores;
|
||||
|
||||
/**
|
||||
* 试题关键字
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<ExamQuestionKeyword> questionKeywords;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
|
||||
private String creator;
|
||||
/**
|
||||
* 租户id
|
||||
|
@@ -1,26 +1,63 @@
|
||||
package pc.exam.pp.module.exam.service.error;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.springframework.stereotype.Service;
|
||||
import pc.exam.pp.module.exam.controller.admin.error.vo.ErrorQuestionListVo;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
|
||||
import pc.exam.pp.module.exam.dal.mysql.error.ExamErrorQuestionInfoMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.error.ExamErrorQuestionMapper;
|
||||
import pc.exam.pp.module.exam.service.question.IExamQuestionService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ExamErrorQuestionServiceImpl implements ExamErrorQuestionService{
|
||||
public class ExamErrorQuestionServiceImpl implements ExamErrorQuestionService {
|
||||
|
||||
@Resource
|
||||
ExamErrorQuestionMapper examErrorQuestionMapper;
|
||||
@Resource
|
||||
ExamErrorQuestionInfoMapper examErrorQuestionInfoMapper;
|
||||
@Resource
|
||||
IExamQuestionService examQuestionService;
|
||||
|
||||
@Override
|
||||
public List<ErrorQuestionListVo> selectByUserId(String userId) {
|
||||
List<ErrorQuestionListVo> errorQuestionListVos = examErrorQuestionMapper.selectByUserId(userId);
|
||||
errorQuestionListVos.forEach(item->{
|
||||
errorQuestionListVos.forEach(item -> {
|
||||
// 通过试题ID查询对应所有的内容
|
||||
ExamQuestion examQuestion = examQuestionService.selectExamQuestionByQuId(item.getQuId());
|
||||
item.setErrorNumber(examErrorQuestionInfoMapper.selectByQuId(item.getQuId()));
|
||||
item.setChapteridDictText(examQuestion.getChapteridDictTextVo());
|
||||
item.setSubjectName(examQuestion.getSubjectName());
|
||||
item.setPointNames(examQuestion.getPointNamesVo());
|
||||
item.setCourseName(examQuestion.getCourseName());
|
||||
item.setSpecialtyName(examQuestion.getSpecialtyName());
|
||||
item.setAnswerList(examQuestion.getAnswerList());
|
||||
item.setContent(examQuestion.getContent());
|
||||
item.setFileUploads(examQuestion.getFileUploads());
|
||||
item.setContentText(Jsoup.parse(item.getContent()).text());
|
||||
if (examQuestion.getFileUploads() != null) {
|
||||
// 说明是有文件的
|
||||
// 答案就是URL,文件路径,直接下载到本地查看
|
||||
examQuestion.getFileUploads().forEach(fileUpload -> {
|
||||
if (fileUpload.getFileType().equals("2")) {
|
||||
item.setAnswer(fileUpload.getUrl());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 说明没有文件
|
||||
// 选择题 选择题答案
|
||||
examQuestion.getAnswerList().forEach(answer -> {
|
||||
if (answer.getIsRight() != null) {
|
||||
if (answer.getIsRight().equals("0")) {
|
||||
item.setAnswer(answer.getContent());
|
||||
}
|
||||
} else {
|
||||
item.setAnswer(item.getAnswer() + answer.getContentIn() + "<br>");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return errorQuestionListVos;
|
||||
}
|
||||
|
Reference in New Issue
Block a user