【修改】试题编号,学生进入考试参数返回增加试卷编号

This commit is contained in:
YOHO\20373
2025-05-30 17:36:29 +08:00
parent 1f1417ab44
commit bc92ff23e4
11 changed files with 59 additions and 22 deletions

View File

@@ -132,13 +132,13 @@
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
<version>5.2.3</version>
</dependency>
<dependency>
@@ -146,6 +146,11 @@
<artifactId>xmlbeans</artifactId>
<version>5.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-lite</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>

View File

@@ -10,6 +10,7 @@ import java.util.List;
@Data
public class ExamPaperVo {
String paperId;
String paperNum;
List<ExamQuestion> examQuestionList;
List<EducationPaperScheme> educationPaperSchemeList;
EducationPaperParam educationPaperParam;

View File

@@ -29,4 +29,6 @@ public class QuestionVo extends PageParam {
private String status;
private String quNum;
}

View File

@@ -37,6 +37,8 @@ public class ExamQuestion extends TenantBaseDO {
// @Excel(name = "题库名称")
private String quBankName;
private String quNum;
/** 章节名称 */
// @Excel(name = "章节名称")
private String chapteridDictText;

View File

@@ -40,6 +40,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
*/
default PageResult<ExamQuestion> selectExamQuestionList(QuestionVo questionVo) {
return selectPage(questionVo, new LambdaQueryWrapperX<ExamQuestion>()
.likeIfPresent(ExamQuestion::getQuNum, questionVo.getQuNum())
.likeIfPresent(ExamQuestion::getQuId,questionVo.getQuId())
.likeIfPresent(ExamQuestion::getQuLevel, questionVo.getQuLevel())
.likeIfPresent(ExamQuestion::getCourseName , questionVo.getCourseName())
@@ -142,4 +143,5 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
boolean changeStatus(@Param("quId") String quId
,@Param("status") String status);
int selectCountQu();
}

View File

@@ -1,5 +1,6 @@
package pc.exam.pp.module.exam.service.paper;
import com.alibaba.excel.util.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -187,7 +188,9 @@ public class EducationPaperQuServiceImpl implements IEducationPaperQuService
examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList);
examPaperVo.setEducationPaperParam(educationPaperParam);
examPaperVo.setStuInfoPaper(stuInfoPaper);
if (StringUtils.isNotBlank(educationPaper.getNum())){
examPaperVo.setPaperNum(educationPaper.getNum());
}
return examPaperVo;
}

View File

@@ -203,7 +203,7 @@ public class EducationPaperServiceImpl implements IEducationPaperService
int number=educationPaperMapper.selectCountPaperList();
// 格式化为8位不足前面补0
String formattedNumber = String.format("%08d", number);
String formattedNumber = String.format("%08d", ++number);
@@ -406,7 +406,7 @@ public class EducationPaperServiceImpl implements IEducationPaperService
int number=educationPaperMapper.selectCountPaperList();
// 格式化为8位不足前面补0
String formattedNumber = String.format("%08d", number);
String formattedNumber = String.format("%08d", ++number);
@@ -495,7 +495,7 @@ public class EducationPaperServiceImpl implements IEducationPaperService
String schoolName= examQuestionMapper.selectSchoolnameBytId(loginTenantId);
stuInfoPaper.setSchoolName(schoolName);
stuInfoPaper.setSex(SecurityFrameworkUtils.getLoginUserSEX());
examPaperVo.setPaperNum(formattedNumber);
examPaperVo.setExamQuestionList(examQuestionList);
examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList);
examPaperVo.setEducationPaperParam(educationPaperParam);

View File

@@ -130,7 +130,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
educationPaperParam.setParamId(IdUtils.simpleUUID());
educationPaperParam.setTaskId(uuid);
educationPaperParam.setIsExamPassword("1");
educationPaperParam.setUsb("0");
educationPaperParam.setUsb("1");
educationPaperParam.setSaveGrades("0");
educationPaperParam.setDriver("C");
educationPaperParam.setIsNumber("1");
@@ -144,6 +144,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
educationPaperParam.setIsFile("1");
educationPaperParam.setIsNet("1");
educationPaperParam.setIsScreen("1");
educationPaperParam.setWarn("<p style=\"line-height: 3;\"><span style=\"font-size: 22px;\">&gt;&gt;请仔细核对考试信息,并认真阅读本注意事项确认无误后点【开始考试】按钮进入考试系统。</span></p><p style=\"line-height: 3;\"><span style=\"font-size: 22px;\">&gt;&gt;进入考试系统后系统自动计时考试结束前5分钟系统将提示您存盘请根据系统的提示交卷或存盘。</span></p><p style=\"line-height: 3;\"><span style=\"font-size: 22px;\">&gt;&gt;进入考试系统后,须根据系统提示进行操作,任何因为与考试无关的操作造成的成绩错误由考生自行负责。</span></p><p style=\"line-height: 3;\"><span style=\"font-size: 22px;\">&gt;&gt;单选试题操作完后系统会自动保存。</span></p><p style=\"line-height: 3;\"><span style=\"font-size: 22px;\">&gt;&gt;所有操作类科目的试题,必须在相对应的操作环境中完成操作,并在该环境中直接保存文件,不要更改文件保存路径。</span></p><p style=\"line-height: 3;\"><span style=\"font-size: 22px;\">&gt;&gt;Windows和网络操作题考生按照系统提示完成相应的操作即可。</span></p><p style=\"line-height: 3;\"><span style=\"font-size: 22px;\">&gt;&gt;考试时间结束后,系统会自动提交考生答卷到考试服务器。提前完成的考生,选择【交卷】按钮提交试卷,出现【交卷成功】提示后方可离开,不要关闭交卷成功窗口,否则后果自负。</span></p><p style=\"line-height: 3;\"><span style=\"font-size: 22px;\">&gt;&gt;如在考试过程中有任何疑问请举手与监考老师联系。</span></p><p><br></p>");
educationPaperParam.setIsContent("1");
if ("1".equals(educationPaperTask.getTaskType())){
educationPaperParam.setIsRepeat("1");
@@ -479,7 +480,9 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
examPaperVo.setPaperId(paperId);
examPaperVo.setEducationPaperParam(educationPaperParam);
examPaperVo.setStuInfoPaper(stuInfoPaper);
if (StringUtils.isNotBlank(educationPaper.getNum())){
examPaperVo.setPaperNum(educationPaper.getNum());
}
return examPaperVo;
}

View File

@@ -147,7 +147,7 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
if (fileUploads!=null&&fileUploads.size()>0){
fileUploads.replaceAll(fileUpload -> {
// 设置文件名(如果文件名为空)
if (!StringUtils.isNotBlank(fileUpload.getFileName())) {
if (StringUtils.isBlank(fileUpload.getFileName())) {
switch (fileUpload.getFileType()) {
case "0":
fileUpload.setFileName("素材");
@@ -163,9 +163,7 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
break;
}
}
if (StringUtils.isNotBlank(fileUpload.getFileName())) {
fileUpload.setFileName(null);
}
// 设置 fileId 和 quId
fileUpload.setFileId(IdUtils.simpleUUID());
fileUpload.setQuId(uuid);
@@ -190,6 +188,13 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
examQuestionKeywordMapper.insertExamQuestionKeywordList(examQuestionKeywords);
}
// return examQuestionMapper.insert(examQuestion);
Long loginTenantId = SecurityFrameworkUtils.getLoginTenantId();
int count= examQuestionMapper.selectCountQu();
// 格式化为8位不足前面补0
String formattedNumber = String.format("%08d", ++count);
String quNum =loginTenantId +"-"+formattedNumber;
examQuestion.setQuNum(quNum);
return examQuestionMapper.insertExamQuestion(examQuestion);
}
@@ -233,7 +238,7 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
//赋值
fileUploads.replaceAll(fileUpload -> {
// 设置文件名(如果文件名为空)
if (!StringUtils.isNotBlank(fileUpload.getFileName())) {
if (StringUtils.isBlank(fileUpload.getFileName())) {
switch (fileUpload.getFileType()) {
case "0":
fileUpload.setFileName("素材");
@@ -249,9 +254,7 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
break;
}
}
if (StringUtils.isNotBlank(fileUpload.getFileName())) {
fileUpload.setFileName(null);
}
// 设置 fileId 和 quId
fileUpload.setFileId(IdUtils.simpleUUID());
fileUpload.setQuId(examQuestion.getQuId());
@@ -693,6 +696,15 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
if ("选择题".equals(importUser.getSubjectName())){
String quId = IdUtils.simpleUUID();
ExamQuestion examQuestion = new ExamQuestion();
Long loginTenantId = SecurityFrameworkUtils.getLoginTenantId();
int count= examQuestionMapper.selectCountQu();
// 格式化为8位不足前面补0
String formattedNumber = String.format("%08d", ++count);
String quNum =loginTenantId +"-"+formattedNumber;
examQuestion.setQuNum(quNum);
examQuestion.setChapteridDictText(importUser.getChapteridDictText());
examQuestion.setSpecialtyName(importUser.getSpecialtyName());
examQuestion.setCourseName(importUser.getCourseName());

View File

@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ExamQuestion" id="ExamQuestionResult">
<result property="quId" column="qu_id" />
<result property="quBankId" column="qu_bank_id" />
<result property="quNum" column="qu_num" />
<result property="quBankName" column="qu_bank_name" />
<result property="chapteridDictText" column="chapterId_dict_text" />
<result property="subjectName" column="subject_name" />
@@ -47,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="ququeName" column="queue_name" />
</resultMap>
<sql id="selectExamQuestionVo">
select qu_id, qu_bank_id, qu_bank_name, chapterId_dict_text,subject_name, qu_level,
select qu_id, qu_bank_id, qu_num,qu_bank_name, chapterId_dict_text,subject_name, qu_level,
content, content_text, analysis, point_names, keywords, manual, create_time, creator, update_time, updater, deleted ,status,audit ,course_name, specialty_name from exam_question
</sql>
@@ -128,6 +129,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSchoolnameBytId" resultType="java.lang.String">
select name from system_tenant where id =#{loginTenantId}
</select>
<select id="selectCountQu" resultType="java.lang.Integer">
select count(*) from exam_question
</select>
<insert id="insertExamQuestion" parameterType="ExamQuestion">
@@ -135,6 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="quId != null">qu_id,</if>
<if test="quBankId != null">qu_bank_id,</if>
<if test="quNum != null">qu_num,</if>
<if test="quBankName != null">qu_bank_name,</if>
<if test="chapteridDictText != null">chapterId_dict_text,</if>
<if test="subjectName != null">subject_name,</if>
@@ -159,6 +164,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="quId != null">#{quId},</if>
<if test="quBankId != null">#{quBankId},</if>
<if test="quNum != null">#{quNum},</if>
<if test="quBankName != null">#{quBankName},</if>
<if test="chapteridDictText != null">#{chapteridDictText},</if>
<if test="subjectName != null">#{subjectName},</if>