【修改】 ws连接方式,新增自动判断剩余时间

This commit is contained in:
dlaren
2025-08-14 15:14:28 +08:00
parent 33f561b444
commit 7de8565e8e
6 changed files with 142 additions and 91 deletions

View File

@@ -1,9 +1,12 @@
package pc.exam.pp.module.exam.dal.dataobject.monitor;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import pc.exam.pp.framework.mybatis.core.dataobject.BaseDO;
@@ -22,49 +25,49 @@ import pc.exam.pp.framework.mybatis.core.dataobject.BaseDO;
@AllArgsConstructor
public class MonitorDO extends BaseDO {
/**
* 主键id
*/
@TableId(type = IdType.INPUT)
private String monitorId;
/**
* 主键id
*/
@TableId(type = IdType.INPUT)
private String monitorId;
private String stuId;
/**
* 用户账号
*/
private String username;
/**
* 用户姓名
*/
private String nickname;
/**
* 班级
*/
private String className;
/**
* 考试状态
*/
private String examStatus;
/**
* 成绩
*/
private String score;
/**
* 试卷编号
*/
private String paperNum;
private String stuId;
/**
* 用户账号
*/
private String username;
/**
* 用户姓名
*/
private String nickname;
/**
* 班级
*/
private String className;
/**
* 考试状态
*/
private String examStatus;
/**
* 成绩
*/
private String score;
/**
* 试卷编号
*/
private String paperNum;
private String taskId;
private String taskName;
private String taskId;
private String taskName;
private String taskType;
/**
* 机器ip
*/
private String ip;
/**
* 剩余时间
*/
private Long remainingTime;
private String taskType;
/**
* 机器ip
*/
private String ip;
/**
* 剩余时间
*/
private Long remainingTime;
}

View File

@@ -68,12 +68,6 @@ public class QuestionDownJob implements JobHandler {
System.out.println("不走定时任务测试==========================");
}
return null;
}
}

View File

@@ -265,7 +265,7 @@ public class MonitorServiceImpl implements MonitorService {
EducationPaperSession educationPaperSession = educationPaperSessionMapper.selectEducationPaperSessionBySessionId(educationPaperPerson.getSessionId());
if (educationPaperSession == null) {
throw new MonitorSpecialtyException("未分配考场,请练习教师!");
throw new MonitorSpecialtyException("未分配考场,请联系教师!");
}
//结束时间
Date endTime = educationPaperSession.getEndTime();

View File

@@ -598,7 +598,6 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
// TODO 1、拉取数据保存至数据库 2、回调服务器是否拉取成功中心服务器
// 1、获取上传的rabbit的试题数组
List<ExamQuestion> examQuestions = null;
List<ExamQuestion> insertExam = new ArrayList<>();
try {
examQuestions = rabbitMqService.receiveAllMessages(queueName);
} catch (Exception e) {
@@ -614,19 +613,21 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
// 判断试题归属于中心服务器还是考点服务器
if (examQuestion.getSchoolId() == null || examQuestion.getSchoolId().isEmpty()) {
examQuestion.setSchoolId("1");
examQuestion.setAudit(String.valueOf(0));
} else {
examQuestion.setSchoolId(examQuestion.getSchoolId());
examQuestion.setAudit(String.valueOf(1));
}
examQuestion.setCreator(examQuestion.getCreator());
examQuestion.setCreateTime(LocalDateTime.now());
examQuestion.setUpdateTime(LocalDateTime.now());
// 判断上传的试题类型是需要审核还是不需要审核的
if (queueName.split("_")[0].equals("1")) {
// 中心服務器推送到考點服務器,默認審核是通過的
examQuestion.setAudit(String.valueOf(0));
} else {
examQuestion.setAudit(String.valueOf(1));
}
// 判断上传的试题类型是需要审核还是不需要审核的 TODO
// if (queueName.split("_")[0].equals("1")) {
// // 中心服務器推送到考點服務器,默認審核是通過的
// examQuestion.setAudit(String.valueOf(0));
// } else {
// examQuestion.setAudit(String.valueOf(1));
// }
Long loginTenantId = SecurityFrameworkUtils.getLoginTenantId();
int count = examQuestionMapper.selectCountQu();
// 读取系统创建试题位数设置
@@ -640,7 +641,6 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
List<ExamQuestionFile> fileUploads = examQuestion.getFileUploads();
ExamQuestionScore questionScores = examQuestion.getQuestionScores();
List<ExamQuestionKeyword> questionKeywords = examQuestion.getQuestionKeywords();
if (answerList != null && answerList.size() > 0) {
answerList.replaceAll(answer -> {
answer.setAnswerId(IdUtils.simpleUUID());
@@ -650,7 +650,6 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
//examQuestionAnswerMapper.insert(answerList);
examQuestionAnswerMapper.insertExamQuestionAnswerList(answerList);
}
if (fileUploads != null && fileUploads.size() > 0) {
fileUploads.replaceAll(fileUpload -> {
// 设置 fileId 和 quId
@@ -660,9 +659,7 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
return fileUpload;
});
sysFileMapper.insertSysFileList(fileUploads);
}
if (questionScores != null) {
questionScores.setScoreId(IdUtils.simpleUUID());
questionScores.setQuId(quId);
@@ -676,7 +673,7 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
});
examQuestionKeywordMapper.insertExamQuestionKeywordList(questionKeywords);
}
examQuestionMapper.insert(insertExam);
examQuestionMapper.insert(examQuestion);
}
//有就是覆盖
else {