【修改】判分层级、监控管理进入考试redis、返回试卷增加试卷id

This commit is contained in:
YOHO\20373
2025-05-08 12:07:09 +08:00
parent b04ad2858c
commit c93b6be468
12 changed files with 142 additions and 443 deletions

View File

@@ -1,14 +1,15 @@
package pc.exam.pp.module.exam.controller.admin.paper.vo;
import lombok.Data;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperScheme;
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
import java.util.List;
@Data
public class ExamPaperVo {
List<ExamQuestion> questionList;
List<EducationPaperScheme> educationPaperSchemeList;
String paperId;
public ExamPaperVo() {
}

View File

@@ -289,23 +289,26 @@ public class MonitorServiceImpl implements MonitorService {
if (info==null){
MonitorDO monitorDO1=new MonitorDO();
PersonRepDto personRepDto = educationPaperPersonMapper.selectUserById(stuId);
String name= educationPaperTaskMapper.selectEducationPaperTaskNameByid(taskId);
EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectEducationPaperTaskByTaskId(taskId);
info.setScore("0");
info.setTaskId(taskId);
info.setTaskType(educationPaperTask.getTaskType());
info.setExamStatus(status);
info.setPaperNum("");
info.setStuId(stuId);
info.setUsername(personRepDto.getUsername());
info.setNickname(personRepDto.getNickname());
monitorDO1.setScore("0");
monitorDO1.setTaskId(taskId);
monitorDO1.setTaskType(educationPaperTask.getTaskType());
monitorDO1.setExamStatus(status);
monitorDO1.setPaperNum("");
monitorDO1.setStuId(stuId);
monitorDO1.setUsername(personRepDto.getUsername());
monitorDO1.setNickname(personRepDto.getNickname());
stringRedisTemplate.opsForValue().set(key, JsonUtils.toJsonString(monitorDO1));
}else {
info.setExamStatus(status);
stringRedisTemplate.opsForValue().set(key, JsonUtils.toJsonString(info));
}
stringRedisTemplate.opsForValue().set(key, JsonUtils.toJsonString(info));
}
@@ -318,10 +321,19 @@ public class MonitorServiceImpl implements MonitorService {
String taskId = monitorDO.getTaskId();
String stuId = monitorDO.getStuId();
String key = "userCache:" + taskId+":" +stuId;
monitorDO.setExamStatus(status);
if ("0".equals(monitorDO.getTaskType())){
monitorDO.setExamStatus("0");
stringRedisTemplate.opsForValue().set(key, JsonUtils.toJsonString(monitorDO));
}else {
monitorDO.setExamStatus(status);
redisTemplate.delete(key);
}
monitorMapper.updateById(monitorDO);
redisTemplate.delete(key);
}
}

View File

@@ -124,6 +124,7 @@ public class EducationPaperQuServiceImpl implements IEducationPaperQuService
List<EducationPaperScheme> educationPaperSchemeList= educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskid);
ExamPaperVo examPaperVo=new ExamPaperVo();
examPaperVo.setPaperId(paperId);
examPaperVo.setExamQuestionList(examQuestionList);
examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList);
return examPaperVo;

View File

@@ -394,7 +394,7 @@ public class EducationPaperServiceImpl implements IEducationPaperService
ExamPaperVo examPaperVo=new ExamPaperVo();
examPaperVo.setExamQuestionList(examQuestionList);
examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList);
examPaperVo.setPaperId(uuid);
return examPaperVo;

View File

@@ -232,12 +232,12 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
//题型
String spName = param.getSpName();
Long requiredTenantId = TenantContextHolder.getRequiredTenantId();
System.out.println(requiredTenantId+"requiredTenantIdrequiredTenantId");
System.out.println(taskSpecialty+"taskSpecialty");
System.out.println(pointNames+"pointNames");
System.out.println(keywords+"keywords");
System.out.println(quLevel+"quLevel");
System.out.println(spName+"spName");
// System.out.println(requiredTenantId+"requiredTenantIdrequiredTenantId");
// System.out.println(taskSpecialty+"taskSpecialty");
// System.out.println(pointNames+"pointNames");
// System.out.println(keywords+"keywords");
// System.out.println(quLevel+"quLevel");
// System.out.println(spName+"spName");
return educationPaperTaskMapper.getQuCount(taskSpecialty, spName, quLevel, pointNames, keywords,requiredTenantId);
}
@@ -320,11 +320,15 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
if (options.contains("4") && !(options.contains("2"))) {
//复制考场设置
List<EducationPaperSession> educationPaperSessions = educationPaperSessionMapper.selectEducationPaperSessionByTaskId(taskId);
educationPaperSessions.forEach(session -> session.setSessionId(IdUtils.simpleUUID()));
educationPaperSessions.forEach(session -> session.setPaperId(null));
educationPaperSessions.forEach(session -> session.setTaskId(newtaskId));
//批量插入
educationPaperSessionMapper.insertEducationPaperSessionList(educationPaperSessions);
if (educationPaperSessions!=null&&educationPaperSessions.size()>0){
educationPaperSessions.forEach(session -> session.setSessionId(IdUtils.simpleUUID()));
educationPaperSessions.forEach(session -> session.setPaperId(null));
educationPaperSessions.forEach(session -> session.setTaskId(newtaskId));
//批量插入
educationPaperSessionMapper.insertEducationPaperSessionList(educationPaperSessions);
}
}
if (options.contains("4") && options.contains("2")) {
@@ -335,37 +339,39 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
// 2. 复制所有试卷建立新旧ID映射
Map<String, String> paperIdMapping = new HashMap<>();
for (EducationPaper paper : educationPapers) {
String newPaperId = IdUtils.simpleUUID();
paperIdMapping.put(paper.getPaperId(), newPaperId);
if (educationPapers!=null&&educationPapers.size()>0){
for (EducationPaper paper : educationPapers) {
String newPaperId = IdUtils.simpleUUID();
paperIdMapping.put(paper.getPaperId(), newPaperId);
// 复制试卷试题
List<EducationPaperQu> questions = educationPaperQuMapper.selectPaperQuListByPaperId(paper.getPaperId());
questions.forEach(qu -> qu.setPaperId(newPaperId));
educationPaperQuMapper.insertEducationPaperQuList(questions);
// 复制试卷试题
List<EducationPaperQu> questions = educationPaperQuMapper.selectPaperQuListByPaperId(paper.getPaperId());
questions.forEach(qu -> qu.setPaperId(newPaperId));
educationPaperQuMapper.insertEducationPaperQuList(questions);
paper.setPaperId(newPaperId);
paper.setTaskId(newtaskId);
educationPaperMapper.insertEducationPaper(paper);
paper.setPaperId(newPaperId);
paper.setTaskId(newtaskId);
educationPaperMapper.insertEducationPaper(paper);
}
// 3. 处理考场分配
for (EducationPaperSession session : educationPaperSessions) {
session.setSessionId(IdUtils.simpleUUID());
session.setTaskId(newtaskId);
if (session.getPaperId() != null) {
String newPaperIds = Arrays.stream(session.getPaperId().split(","))
.map(paperIdMapping::get)
.collect(Collectors.joining(","));
session.setPaperId(newPaperIds);
}
}
if (educationPaperSessions!=null&&educationPaperSessions.size()>0){
// 3. 处理考场分配
for (EducationPaperSession session : educationPaperSessions) {
session.setSessionId(IdUtils.simpleUUID());
session.setTaskId(newtaskId);
if (session.getPaperId() != null) {
String newPaperIds = Arrays.stream(session.getPaperId().split(","))
.map(paperIdMapping::get)
.collect(Collectors.joining(","));
session.setPaperId(newPaperIds);
}
}
// 4. 批量插入考场
educationPaperSessionMapper.insertEducationPaperSessionList(educationPaperSessions);
// 4. 批量插入考场
educationPaperSessionMapper.insertEducationPaperSessionList(educationPaperSessions);
}
}
if (options.contains("5")) {
@@ -402,7 +408,7 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
ExamPaperVo examPaperVo=new ExamPaperVo();
examPaperVo.setExamQuestionList(examQuestionList);
examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList);
examPaperVo.setPaperId(paperId);
return examPaperVo;
}
}

View File

@@ -56,18 +56,21 @@ public class ExamQuestionServiceImpl implements IExamQuestionService
List<ExamQuestionKeyword> examQuestionKeywords = examQuestionKeywordMapper.selectExamQuestionKeywordByQuId(quId);
ExamQuestion examQuestion = examQuestionMapper.selectExamQuestionByQuId(quId);
if (examQuestionAnswers!=null&&examQuestionAnswers.size()>0){
examQuestion.setAnswerList(examQuestionAnswers);
}
if (sysFileUploads!=null&&sysFileUploads.size()>0){
examQuestion.setFileUploads(sysFileUploads);
}
if (examQuestionScore!=null){
examQuestion.setQuestionScores(examQuestionScore);
}
if (examQuestionKeywords!=null&&examQuestionKeywords.size()>0){
examQuestion.setQuestionKeywords(examQuestionKeywords);
if (examQuestion!=null){
if (examQuestionAnswers!=null&&examQuestionAnswers.size()>0){
examQuestion.setAnswerList(examQuestionAnswers);
}
if (sysFileUploads!=null&&sysFileUploads.size()>0){
examQuestion.setFileUploads(sysFileUploads);
}
if (examQuestionScore!=null){
examQuestion.setQuestionScores(examQuestionScore);
}
if (examQuestionKeywords!=null&&examQuestionKeywords.size()>0){
examQuestion.setQuestionKeywords(examQuestionKeywords);
}
}
return examQuestion;
}