【新增】 1、交互接口,学生端定时与后台交互,获取交互时间存入缓存;2、更换PC答题,使用交互时间进行判断
This commit is contained in:
@@ -135,7 +135,6 @@ public class EducationPaperPersonController {
|
||||
} else {
|
||||
return CommonResult.error(DEMO03_PAPER_STUDENT_EXISTS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -81,4 +81,9 @@ public class MonitorDO extends BaseDO {
|
||||
*/
|
||||
private String startTime;
|
||||
|
||||
/**
|
||||
* 交互时间
|
||||
*/
|
||||
private String interactiveTime;
|
||||
|
||||
}
|
||||
|
@@ -21,8 +21,7 @@ import pc.exam.pp.module.exam.dal.dataobject.EducationPaperScheme;
|
||||
* @date 2025-04-15
|
||||
*/
|
||||
@Mapper
|
||||
public interface EducationPaperMapper extends BaseMapperX<EducationPaper>
|
||||
{
|
||||
public interface EducationPaperMapper extends BaseMapperX<EducationPaper> {
|
||||
/**
|
||||
* 查询试卷
|
||||
*
|
||||
@@ -31,22 +30,27 @@ public interface EducationPaperMapper extends BaseMapperX<EducationPaper>
|
||||
*/
|
||||
public EducationPaper selectEducationPaperByPaperId(String paperId);
|
||||
|
||||
/**
|
||||
* 根据试卷编号查询试卷
|
||||
* @param paperNum 试卷编号
|
||||
* @return 试卷ID
|
||||
*/
|
||||
String selectPaperByPaperNum(String paperNum);
|
||||
|
||||
/**
|
||||
* 查询试卷列表
|
||||
*
|
||||
|
||||
* @return 试卷集合
|
||||
*/
|
||||
// public List<EducationPaper> selectEducationPaperList(EducationPaper educationPaper);
|
||||
|
||||
default PageResult<EducationPaper> selectEducationPaperList(PaperPageVo paperPageVo) {
|
||||
return selectPage(paperPageVo, new LambdaQueryWrapperX<EducationPaper>()
|
||||
.likeIfPresent(EducationPaper::getTaskId, paperPageVo.getTaskId())
|
||||
.likeIfPresent(EducationPaper::getIsAb , paperPageVo.getIsAb())
|
||||
.likeIfPresent(EducationPaper::getPaperId , paperPageVo.getPaperId())
|
||||
.likeIfPresent(EducationPaper::getCounts , paperPageVo.getCounts())
|
||||
.likeIfPresent(EducationPaper::getRollUp , paperPageVo.getRollUp())
|
||||
.likeIfPresent(EducationPaper::getStatus , paperPageVo.getStatus())
|
||||
.likeIfPresent(EducationPaper::getIsAb, paperPageVo.getIsAb())
|
||||
.likeIfPresent(EducationPaper::getPaperId, paperPageVo.getPaperId())
|
||||
.likeIfPresent(EducationPaper::getCounts, paperPageVo.getCounts())
|
||||
.likeIfPresent(EducationPaper::getRollUp, paperPageVo.getRollUp())
|
||||
.likeIfPresent(EducationPaper::getStatus, paperPageVo.getStatus())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -83,36 +87,40 @@ public interface EducationPaperMapper extends BaseMapperX<EducationPaper>
|
||||
public int deleteEducationPaperByPaperIds(@Param("paperIds") String[] paperIds);
|
||||
|
||||
|
||||
|
||||
List<String> selectQuByPaperScheme(@Param("pointName") List<String> pointName
|
||||
,@Param("keywordList") List<String> keywordList
|
||||
,@Param("educationPaperScheme") EducationPaperScheme educationPaperScheme
|
||||
,@Param("taskSpecialty") String taskSpecialty
|
||||
,@Param("tId") Long tId );
|
||||
, @Param("keywordList") List<String> keywordList
|
||||
, @Param("educationPaperScheme") EducationPaperScheme educationPaperScheme
|
||||
, @Param("taskSpecialty") String taskSpecialty
|
||||
, @Param("tId") Long tId);
|
||||
|
||||
String selectTaskIdByPaperId(String paperId);
|
||||
|
||||
String selectTaskIdByPaperId(String paperId);
|
||||
//查找方案下所有试卷id
|
||||
List<String> selectPaperByTaskId(String taskId);
|
||||
List<String> selectPaperByTaskId(String taskId);
|
||||
|
||||
//根据试卷id,批量设置试卷格式
|
||||
public int updateEducationByids(@Param("strings")List<String> strings);
|
||||
public int updateEducationByids(@Param("strings") List<String> strings);
|
||||
|
||||
List<String> selectPaperRandomByTaskId(String taskId);
|
||||
|
||||
int updateRandomByids(@Param("strings")List<String> strings);
|
||||
int updateRandomByids(@Param("strings") List<String> strings);
|
||||
|
||||
void updatePaperGuByRollup(String taskId);
|
||||
|
||||
/**
|
||||
* 根据试卷任务id查找试卷id集合
|
||||
*
|
||||
* @param taskId
|
||||
* @return
|
||||
*/
|
||||
List<String> selectPaperByTaskIdAndRoll(@Param("taskId")String taskId);
|
||||
List<String> selectPaperByTaskIdAndRoll(@Param("taskId") String taskId);
|
||||
|
||||
//查找该方案所有的试卷
|
||||
List<EducationPaper> getPaperByTaskIdByType(String taskId);
|
||||
|
||||
/**
|
||||
* 查找选中方案下已分配的试卷
|
||||
*
|
||||
* @param row
|
||||
* @return
|
||||
*/
|
||||
@@ -120,13 +128,15 @@ public interface EducationPaperMapper extends BaseMapperX<EducationPaper>
|
||||
|
||||
/**
|
||||
* 批量设置试卷抽卷方式(自选)
|
||||
*
|
||||
* @param strings
|
||||
* @return
|
||||
*/
|
||||
int updateEducationByidsThree(@Param("strings")List<String> strings);
|
||||
int updateEducationByidsThree(@Param("strings") List<String> strings);
|
||||
|
||||
/**
|
||||
* 分局任务id查找任务下的 试卷
|
||||
*
|
||||
* @param taskId
|
||||
* @return
|
||||
*/
|
||||
@@ -134,27 +144,31 @@ public interface EducationPaperMapper extends BaseMapperX<EducationPaper>
|
||||
|
||||
/**
|
||||
* 批量插入试卷
|
||||
*
|
||||
* @param educationPapers
|
||||
*/
|
||||
void insertEducationPaperList(List<EducationPaper> educationPapers);
|
||||
|
||||
/**
|
||||
* 改变试卷状态
|
||||
*
|
||||
* @param paperId
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
int changeStatus(@Param("paperId") String paperId
|
||||
,@Param("status") String status);
|
||||
, @Param("status") String status);
|
||||
|
||||
/**
|
||||
* 查找试卷个数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int selectCountPaperList();
|
||||
|
||||
/**
|
||||
* 查找试卷列表
|
||||
*
|
||||
* @param paperPageVo
|
||||
* @return
|
||||
*/
|
||||
@@ -165,21 +179,22 @@ public interface EducationPaperMapper extends BaseMapperX<EducationPaper>
|
||||
.eq(EducationPaper::getStatus, 0)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据方案获取试卷下拉
|
||||
*/
|
||||
List<PaperIdAndNum> selectPaperIdAndNumByTaskId(String taskId);
|
||||
List<PaperIdAndNum> selectPaperIdAndNumByTaskId(String taskId);
|
||||
|
||||
int countPapersByTaskId(String taskId);
|
||||
|
||||
List<String> selectTaskNumByids(@Param("cannotDeleteTaskIds")List<String> cannotDeleteTaskIds);
|
||||
List<String> selectTaskNumByids(@Param("cannotDeleteTaskIds") List<String> cannotDeleteTaskIds);
|
||||
|
||||
// 查询所有正在考试的 试卷id
|
||||
@TenantIgnore
|
||||
List<String> selectSpecilayCounts(Long loginTenantId);
|
||||
|
||||
//查询学生的考试分数
|
||||
double selctStuScoreByStuIdAndPaperId(@Param("stuId") String stuId
|
||||
, @Param("paperId") String paperId);
|
||||
double selctStuScoreByStuIdAndPaperId(@Param("stuId") String stuId
|
||||
, @Param("paperId") String paperId);
|
||||
}
|
||||
|
||||
|
@@ -194,7 +194,6 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
for (SpecialtyVo specialtyVo : taskInVo) {
|
||||
String specialtyId = specialtyVo.getSpecialtyId();
|
||||
if (!authSpecialtyIds.contains(specialtyId)) continue;
|
||||
|
||||
String specialtyName = specialtyVo.getSpecialtyName();
|
||||
Integer currentCount = specialtyVo.getCounts();
|
||||
Integer authCount = authMap.getOrDefault(specialtyId, 0);
|
||||
@@ -238,13 +237,10 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(stuMonitorPaperVo.getPaperId())) {
|
||||
EducationPaper educationPaper = educationPaperMapper.selectEducationPaperByPaperId(stuMonitorPaperVo.getPaperId());
|
||||
String counts = educationPaper.getCounts();
|
||||
|
||||
int count = 0;
|
||||
|
||||
try {
|
||||
count = Integer.parseInt(counts);
|
||||
} catch (NumberFormatException | NullPointerException e) {
|
||||
@@ -255,14 +251,14 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
educationPaperMapper.updateById(educationPaper);
|
||||
info.setPaperNum(educationPaper.getNum());
|
||||
}
|
||||
|
||||
info.setExamStatus("1");
|
||||
LocalDateTime nowTime = LocalDateTime.now();
|
||||
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
info.setStartTime(nowTime.format(formatter1));
|
||||
DateTimeFormatter formatterNow = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
info.setStartTime(nowTime.format(formatterNow));
|
||||
// 考试考试的时候初始化交互时间为当前时间
|
||||
info.setInteractiveTime(nowTime.format(formatterNow));
|
||||
info.setTemporaryId(stuMonitorPaperVo.getTemporaryId());
|
||||
info.setIp(stuMonitorPaperVo.getIp());
|
||||
|
||||
if (info.getRemainingTime() == null) {
|
||||
stringRedisTemplate.opsForValue().set("userCache:" + stuMonitorPaperVo.getTaskId() + ":" + stuMonitorPaperVo.getStuId(), JsonUtils.toJsonString(info));
|
||||
monitorMapper.updateById(info);
|
||||
@@ -271,15 +267,12 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(stuMonitorPaperVo.getTaskId());
|
||||
//测评时长
|
||||
Time examTime = educationPaperParam.getExamTime();
|
||||
|
||||
//判断是否开启测评时长限制
|
||||
//开启测评时长限制 开启场次 判断场次时间 ,,,,没开启测评时长限制 开启场次 -判断场次时间
|
||||
if ("0".equals(educationPaperParam.getIsSession())) {
|
||||
//获得场次开始时间, 结束时间 判断是否在 时间范围内
|
||||
|
||||
EducationPaperPerson educationPaperPerson = educationPaperPersonMapper.selectByTaskIdAndPersonId(stuMonitorPaperVo.getTaskId(), stuMonitorPaperVo.getStuId());
|
||||
EducationPaperSession educationPaperSession = educationPaperSessionMapper.selectEducationPaperSessionBySessionId(educationPaperPerson.getSessionId());
|
||||
|
||||
if (educationPaperSession == null) {
|
||||
throw new MonitorSpecialtyException("未分配考场,请联系教师!");
|
||||
}
|
||||
@@ -291,17 +284,14 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
String allowEntry = educationPaperSession.getAllowEntry();
|
||||
//开始考试后分钟,禁止入场
|
||||
String endAllowEntry = educationPaperSession.getEndAllowEntry();
|
||||
|
||||
// 开始转换时间
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
LocalDateTime start = DateUtil.toLocalDateTime(startTime);
|
||||
LocalDateTime end = DateUtil.toLocalDateTime(endTime);
|
||||
|
||||
// 考试开始前允许入场时间(分钟)
|
||||
int allowEntryMin = Integer.parseInt(allowEntry);
|
||||
|
||||
// 考试开始后允许入场时间(分钟)
|
||||
int endAllowEntryMin = Integer.parseInt(endAllowEntry);
|
||||
|
||||
// 入场允许范围: [start-allowEntryMin , end + endAllowEntryMin]
|
||||
LocalDateTime entryStart = start.minusMinutes(allowEntryMin);
|
||||
LocalDateTime entryEnd = end.plusMinutes(endAllowEntryMin);
|
||||
@@ -331,9 +321,7 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
info.setRemainingTime((long) examTime.toLocalTime().toSecondOfDay());
|
||||
stringRedisTemplate.opsForValue().set("userCache:" + stuMonitorPaperVo.getTaskId() + ":" + stuMonitorPaperVo.getStuId(), JsonUtils.toJsonString(info));
|
||||
monitorMapper.updateById(info);
|
||||
|
||||
return (long) examTime.toLocalTime().toSecondOfDay();
|
||||
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
@@ -350,9 +338,6 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
return false;
|
||||
}
|
||||
stringRedisTemplate.opsForValue().set(keychoice, JsonUtils.toJsonString(stuMonitorQuVo));
|
||||
// 更新缓存
|
||||
// redisTemplate.opsForValue().set(key, info);
|
||||
// monitorMapper.updateById(info);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -364,11 +349,9 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
String taskId = educationPaper.getTaskId();
|
||||
String key = "userCache:" + taskId + ":" + stuMonitorPaperEndVo.getStuId();
|
||||
// 获取学生分数
|
||||
StuScoreVo stuScoreVo = stuPaperScoreService.getStuScore(Long.valueOf(stuMonitorPaperEndVo.getStuId()),
|
||||
stuMonitorPaperEndVo.getPaperId(),
|
||||
stuMonitorPaperEndVo.getTemporaryId());
|
||||
StuScoreVo stuScoreVo = stuPaperScoreService.getStuScore(Long.valueOf(stuMonitorPaperEndVo.getStuId()), stuMonitorPaperEndVo.getPaperId(), stuMonitorPaperEndVo.getTemporaryId());
|
||||
BigDecimal score = stuScoreVo.getScore();
|
||||
|
||||
// 获取缓存
|
||||
MonitorDO info = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(key), MonitorDO.class);
|
||||
if (info != null) {
|
||||
long usedTime = info.getRemainingTime();
|
||||
@@ -382,15 +365,15 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
long remainingTime = duration.getSeconds() < 0 ? 0 : duration.getSeconds();
|
||||
info.setRemainingTime(usedTime - remainingTime);
|
||||
}
|
||||
// 重置开始时间
|
||||
// 重置开始时间&交互时间
|
||||
if (info != null) {
|
||||
info.setStartTime(null);
|
||||
info.setInteractiveTime(null);
|
||||
}
|
||||
MonitorDO monitorDOs = null;
|
||||
if (info != null) {
|
||||
monitorDOs = getMonitor(info.getMonitorId());
|
||||
}
|
||||
|
||||
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(taskId);
|
||||
EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectEducationPaperTaskByTaskId(taskId);
|
||||
if ("1".equals(educationPaperParam.getSaveGrades())) {
|
||||
|
@@ -222,9 +222,9 @@ public class EducationPaperPersonServiceImpl implements IEducationPaperPersonSer
|
||||
info.setPaperNum("");
|
||||
info.setTaskName(name);
|
||||
info.setTaskType(educationPaperTask.getTaskType());
|
||||
info.setInteractiveTime(null);
|
||||
stringRedisTemplate.opsForValue().set(key, JsonUtils.toJsonString(info));
|
||||
monitorMapper.insert(info);
|
||||
|
||||
educationPaperPerson.setPersonId(studentId);
|
||||
educationPaperPerson.setSessionId(sessionId);
|
||||
educationPaperPerson.setBatch(batch);
|
||||
|
@@ -62,12 +62,10 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
private EducationPaperSchemeMapper educationPaperSchemeMapper;
|
||||
@Autowired
|
||||
private EducationPaperTaskMapper educationPaperTaskMapper;
|
||||
|
||||
@Autowired
|
||||
private EducationPaperSessionMapper educationPaperSessionMapper;
|
||||
@Autowired
|
||||
private EducationPaperQuMapper educationPaperQuMapper;
|
||||
|
||||
@Autowired
|
||||
private EducationPaperPersonMapper educationPaperPersonMapper;
|
||||
|
||||
@@ -967,5 +965,10 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectPaperByPaperNum(String paperNum) {
|
||||
return educationPaperMapper.selectPaperByPaperNum(paperNum);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -130,5 +130,7 @@ public interface IEducationPaperService
|
||||
|
||||
void addPaperBypaper(PaperSubmitDTO dto);
|
||||
|
||||
String selectPaperByPaperNum(String paperNum);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -5,56 +5,69 @@
|
||||
<mapper namespace="pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperMapper">
|
||||
|
||||
<resultMap type="EducationPaper" id="EducationPaperResult">
|
||||
<result property="paperId" column="paper_id" />
|
||||
<result property="taskId" column="task_id" />
|
||||
<result property="num" column="num" />
|
||||
<result property="counts" column="counts" />
|
||||
<result property="paperScore" column="paper_score" />
|
||||
<result property="rollUp" column="roll_up" />
|
||||
<result property="isAb" column="is_ab" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="creator" column="creator" />
|
||||
<result property="updater" column="updater" />
|
||||
<result property="deleted" column="deleted" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="paperId" column="paper_id"/>
|
||||
<result property="taskId" column="task_id"/>
|
||||
<result property="num" column="num"/>
|
||||
<result property="counts" column="counts"/>
|
||||
<result property="paperScore" column="paper_score"/>
|
||||
<result property="rollUp" column="roll_up"/>
|
||||
<result property="isAb" column="is_ab"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="creator" column="creator"/>
|
||||
<result property="updater" column="updater"/>
|
||||
<result property="deleted" column="deleted"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="EducationPaper" id="PaperIdAndNumResult">
|
||||
<result property="paperId" column="paper_id" />
|
||||
<result property="num" column="num" />
|
||||
<result property="paperId" column="paper_id"/>
|
||||
<result property="num" column="num"/>
|
||||
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="ExamQuestion" id="ExamQuestionResult">
|
||||
<result property="quId" column="qu_id" />
|
||||
<result property="quBankId" column="qu_bank_id" />
|
||||
<result property="quBankName" column="qu_bank_name" />
|
||||
<result property="chapteridDictText" column="chapterId_dict_text" />
|
||||
<result property="subjectName" column="subject_name" />
|
||||
<result property="quLevel" column="qu_level" />
|
||||
<result property="content" column="content" />
|
||||
<result property="contentText" column="content_text" />
|
||||
<result property="analysis" column="analysis" />
|
||||
<result property="pointNames" column="point_names" />
|
||||
<result property="keywords" column="keywords" />
|
||||
<result property="manual" column="manual" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="creator" column="creator" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updater" column="updater" />
|
||||
<result property="deleted" column="deleted" />
|
||||
<result property="status" column="status" />
|
||||
<result property="audit" column="audit" />
|
||||
<result property="courseName" column="course_name" />
|
||||
<result property="specialtyName" column="specialty_name" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="quId" column="qu_id"/>
|
||||
<result property="quBankId" column="qu_bank_id"/>
|
||||
<result property="quBankName" column="qu_bank_name"/>
|
||||
<result property="chapteridDictText" column="chapterId_dict_text"/>
|
||||
<result property="subjectName" column="subject_name"/>
|
||||
<result property="quLevel" column="qu_level"/>
|
||||
<result property="content" column="content"/>
|
||||
<result property="contentText" column="content_text"/>
|
||||
<result property="analysis" column="analysis"/>
|
||||
<result property="pointNames" column="point_names"/>
|
||||
<result property="keywords" column="keywords"/>
|
||||
<result property="manual" column="manual"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="creator" column="creator"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updater" column="updater"/>
|
||||
<result property="deleted" column="deleted"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="audit" column="audit"/>
|
||||
<result property="courseName" column="course_name"/>
|
||||
<result property="specialtyName" column="specialty_name"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectEducationPaperVo">
|
||||
select paper_id, task_id, num,counts, paper_score,roll_up, is_ab, status ,create_time,update_time,creator,updater ,deleted from education_paper
|
||||
select paper_id,
|
||||
task_id,
|
||||
num,
|
||||
counts,
|
||||
paper_score,
|
||||
roll_up,
|
||||
is_ab,
|
||||
status,
|
||||
create_time,
|
||||
update_time,
|
||||
creator,
|
||||
updater,
|
||||
deleted
|
||||
from education_paper
|
||||
</sql>
|
||||
|
||||
|
||||
@@ -62,59 +75,84 @@
|
||||
<include refid="selectEducationPaperVo"/>
|
||||
where paper_id = #{paperId}
|
||||
</select>
|
||||
|
||||
<select id="selectPaperByPaperNum" resultType="java.lang.String">
|
||||
SELECT paper_id
|
||||
FROM education_paper
|
||||
WHERE num = #{paperNum}
|
||||
</select>
|
||||
|
||||
<select id="selectQuByPaperScheme" resultType="java.lang.String">
|
||||
|
||||
SELECT qu_id
|
||||
FROM exam_question
|
||||
WHERE
|
||||
specialty_name = #{taskSpecialty}
|
||||
AND subject_name = #{educationPaperScheme.spName}
|
||||
AND tenant_id =#{tId}
|
||||
and audit = '0'
|
||||
and status = '0'
|
||||
and deleted ='0'
|
||||
SELECT qu_id
|
||||
FROM exam_question
|
||||
WHERE
|
||||
specialty_name = #{taskSpecialty}
|
||||
AND subject_name = #{educationPaperScheme.spName}
|
||||
AND tenant_id =#{tId}
|
||||
and audit = '0'
|
||||
and status = '0'
|
||||
and deleted ='0'
|
||||
<if test="educationPaperScheme.quLevel != null and educationPaperScheme.quLevel != ''">
|
||||
AND qu_level = #{educationPaperScheme.quLevel}
|
||||
AND qu_level = #{educationPaperScheme.quLevel}
|
||||
</if>
|
||||
<if test="keywordList != null and keywordList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="keywordList" item="kw" separator=" OR ">
|
||||
keywords LIKE CONCAT('%', #{kw}, '%')
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="keywordList != null and keywordList.size() > 0">
|
||||
AND (
|
||||
<foreach collection="keywordList" item="kw" separator=" OR ">
|
||||
keywords LIKE CONCAT('%', #{kw}, '%')
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="pointName != null and pointName.size() > 0">
|
||||
AND (
|
||||
<foreach collection="pointName" item="pt" separator=" OR ">
|
||||
point_names LIKE CONCAT('%', #{pt}, '%')
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
ORDER BY RAND()
|
||||
LIMIT #{educationPaperScheme.quNumbers}
|
||||
<if test="pointName != null and pointName.size() > 0">
|
||||
AND (
|
||||
<foreach collection="pointName" item="pt" separator=" OR ">
|
||||
point_names LIKE CONCAT('%', #{pt}, '%')
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
ORDER BY RAND()
|
||||
LIMIT #{educationPaperScheme.quNumbers}
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectTaskIdByPaperId" resultType="java.lang.String">
|
||||
select task_id from education_paper where paper_id=#{paperId}
|
||||
select task_id
|
||||
from education_paper
|
||||
where paper_id = #{paperId}
|
||||
</select>
|
||||
<select id="selectPaperByTaskId" resultType="java.lang.String">
|
||||
select paper_id from education_paper where task_id=#{taskId} and deleted ='0'
|
||||
select paper_id
|
||||
from education_paper
|
||||
where task_id = #{taskId}
|
||||
and deleted = '0'
|
||||
</select>
|
||||
<select id="selectPaperRandomByTaskId" resultType="java.lang.String">
|
||||
select paper_id from education_paper where task_id=#{taskId} and roll_up ='2'
|
||||
select paper_id
|
||||
from education_paper
|
||||
where task_id = #{taskId}
|
||||
and roll_up = '2'
|
||||
|
||||
</select>
|
||||
<select id="selectPaperByTaskIdAndRoll" resultType="java.lang.String">
|
||||
select paper_id from education_paper where task_id=#{taskId} and deleted ='0'
|
||||
select paper_id
|
||||
from education_paper
|
||||
where task_id = #{taskId}
|
||||
and deleted = '0'
|
||||
</select>
|
||||
<select id="getPaperByTaskIdByType" resultMap="EducationPaperResult">
|
||||
select * from education_paper where task_id=#{taskId} and status ='0' and deleted ='0' and roll_up IS NOT NULL
|
||||
select *
|
||||
from education_paper
|
||||
where task_id = #{taskId}
|
||||
and status = '0'
|
||||
and deleted = '0'
|
||||
and roll_up IS NOT NULL
|
||||
|
||||
</select>
|
||||
<select id="getSelectPaperIdBySchemeIds" resultType="java.lang.String">
|
||||
select paper_id from education_paper_session where session_id =#{row}
|
||||
select paper_id
|
||||
from education_paper_session
|
||||
where session_id = #{row}
|
||||
|
||||
</select>
|
||||
<select id="selectPaperListByTaskId" resultMap="EducationPaperResult">
|
||||
@@ -122,16 +160,23 @@ select task_id from education_paper where paper_id=#{paperId}
|
||||
where task_id =#{taskId} and deleted ='0' and status ='0'
|
||||
</select>
|
||||
<select id="selectCountPaperList" resultType="java.lang.Integer">
|
||||
select count(*) from education_paper
|
||||
</select>
|
||||
select count(*)
|
||||
from education_paper
|
||||
</select>
|
||||
<select id="selectPaperIdAndNumByTaskId" resultMap="PaperIdAndNumResult">
|
||||
select paper_id ,num from education_paper where task_id=#{taskId} and deleted ='0'
|
||||
select paper_id, num
|
||||
from education_paper
|
||||
where task_id = #{taskId}
|
||||
and deleted = '0'
|
||||
</select>
|
||||
<select id="countPapersByTaskId" resultType="java.lang.Integer">
|
||||
select count(*) from education_paper where task_id =#{taskId} and deleted ='0'
|
||||
select count(*)
|
||||
from education_paper
|
||||
where task_id = #{taskId}
|
||||
and deleted = '0'
|
||||
</select>
|
||||
<select id="selectTaskNumByids" resultType="java.lang.String">
|
||||
select task_num from education_paper_task
|
||||
select task_num from education_paper_task
|
||||
WHERE task_id IN
|
||||
<foreach collection="cannotDeleteTaskIds" item="taskId" open="(" separator="," close=")">
|
||||
#{taskId}
|
||||
@@ -148,7 +193,8 @@ select task_id from education_paper where paper_id=#{paperId}
|
||||
<select id="selctStuScoreByStuIdAndPaperId" resultType="java.lang.Double">
|
||||
SELECT COALESCE(SUM(score), 0.0)
|
||||
FROM exam_stu_paper_score
|
||||
WHERE stu_id = #{stuId} AND paper_id = #{paperId}
|
||||
WHERE stu_id = #{stuId}
|
||||
AND paper_id = #{paperId}
|
||||
</select>
|
||||
|
||||
|
||||
@@ -191,7 +237,8 @@ select task_id from education_paper where paper_id=#{paperId}
|
||||
INSERT INTO education_paper (paper_id, task_id,num ,counts,paper_score, roll_up, is_ab, status ) VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.paperId}, #{item.taskId}, #{item.num},#{item.counts},#{item.paperScore}, #{item.rollUp}, #{item.isAb}, #{item.status}
|
||||
#{item.paperId}, #{item.taskId}, #{item.num},#{item.counts},#{item.paperScore}, #{item.rollUp},
|
||||
#{item.isAb}, #{item.status}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
@@ -216,12 +263,12 @@ select task_id from education_paper where paper_id=#{paperId}
|
||||
</update>
|
||||
<update id="updateEducationByids">
|
||||
|
||||
UPDATE education_paper
|
||||
SET roll_up = '2', is_ab = null
|
||||
WHERE paper_id IN
|
||||
<foreach collection="strings" item="paperId" open="(" separator="," close=")">
|
||||
#{paperId}
|
||||
</foreach>
|
||||
UPDATE education_paper
|
||||
SET roll_up = '2', is_ab = null
|
||||
WHERE paper_id IN
|
||||
<foreach collection="strings" item="paperId" open="(" separator="," close=")">
|
||||
#{paperId}
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="updateRandomByids">
|
||||
UPDATE education_paper
|
||||
@@ -233,8 +280,10 @@ select task_id from education_paper where paper_id=#{paperId}
|
||||
</update>
|
||||
<update id="updatePaperGuByRollup">
|
||||
UPDATE education_paper
|
||||
SET roll_up = null, is_ab = null
|
||||
where task_id=#{taskId} and roll_up ='1'
|
||||
SET roll_up = null,
|
||||
is_ab = null
|
||||
where task_id = #{taskId}
|
||||
and roll_up = '1'
|
||||
</update>
|
||||
<update id="updateEducationByidsThree">
|
||||
UPDATE education_paper
|
||||
@@ -247,12 +296,14 @@ select task_id from education_paper where paper_id=#{paperId}
|
||||
<update id="changeStatus">
|
||||
UPDATE education_paper
|
||||
SET status = #{status}
|
||||
where paper_id =#{paperId}
|
||||
where paper_id = #{paperId}
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="deleteEducationPaperByPaperId" parameterType="String">
|
||||
delete from education_paper where paper_id = #{paperId}
|
||||
delete
|
||||
from education_paper
|
||||
where paper_id = #{paperId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEducationPaperByPaperIds" parameterType="String">
|
||||
@@ -265,7 +316,4 @@ select task_id from education_paper where paper_id=#{paperId}
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
@@ -28,20 +28,17 @@ import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.student.StuScoreVo;
|
||||
import pc.exam.pp.module.exam.service.paper.IEducationPaperParamService;
|
||||
import pc.exam.pp.module.exam.service.paper.IEducationPaperQuService;
|
||||
import pc.exam.pp.module.exam.service.paper.IEducationPaperService;
|
||||
import pc.exam.pp.module.exam.service.stuPaperScore.StuPaperScoreService;
|
||||
import pc.exam.pp.module.exam.service.stu_paper_file.StuPaperFileService;
|
||||
import pc.exam.pp.module.judgement.controller.admin.autoTools.vo.*;
|
||||
import pc.exam.pp.module.judgement.service.TaskManager;
|
||||
import pc.exam.pp.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -76,6 +73,8 @@ public class AutoToolsController {
|
||||
IEducationPaperQuService educationPaperQuService;
|
||||
@Resource
|
||||
StuPaperFileService stuPaperFileService;
|
||||
@Resource
|
||||
IEducationPaperService educationPaperService;
|
||||
|
||||
@GetMapping("/getStuScoreInfo")
|
||||
@Operation(summary = "通过学生ID、试卷ID获取")
|
||||
@@ -109,6 +108,34 @@ public class AutoToolsController {
|
||||
return CommonResult.success(stuPaperScoreInfoVos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 学生端进行交互
|
||||
* @param taskId 方案ID
|
||||
* @return 是否完成
|
||||
*/
|
||||
@GetMapping("/getStuSideStatus")
|
||||
public CommonResult<Boolean> getStuSideStatus(@RequestParam("taskId") String taskId) {
|
||||
// 获取登录用户
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
// 获取ID
|
||||
long userId = loginUser.getId();
|
||||
// 通过方案ID获取学生考试状态
|
||||
String key = "userCache:" + taskId + ":" + userId;
|
||||
MonitorDO info = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(key), MonitorDO.class);
|
||||
if (info != null) {
|
||||
// 更新交互时间
|
||||
LocalDateTime nowTime = LocalDateTime.now();
|
||||
DateTimeFormatter formatterNow = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
// 考试考试的时候初始化交互时间为当前时间
|
||||
info.setInteractiveTime(nowTime.format(formatterNow));
|
||||
// 更新缓存
|
||||
stringRedisTemplate.opsForValue().set(key, JsonUtils.toJsonString(info));
|
||||
}
|
||||
}
|
||||
return CommonResult.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始考试 通过websocket进行传输时间
|
||||
*
|
||||
@@ -186,16 +213,33 @@ public class AutoToolsController {
|
||||
// 学生端重新登录,判断是否上一次考试没有结束就退出了
|
||||
@GetMapping("/reStartExamStatus")
|
||||
public CommonResult<String> reStartExamStatus() {
|
||||
HttpServletRequest request = ServletUtils.getRequest();
|
||||
// 获取学生ID
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
long userId = loginUser.getId();
|
||||
String key = taskManager.getTaskById(String.valueOf(userId));
|
||||
if (key == null) {
|
||||
return CommonResult.success("0");
|
||||
long userId = loginUser.getId();
|
||||
Set<String> userCaches = stringRedisTemplate.keys("userCache:*");
|
||||
for (String userCache : userCaches) {
|
||||
// 获取所有试卷的数据
|
||||
Set<String> userCacheInfos = stringRedisTemplate.keys(userCache);
|
||||
for (String userCacheInfo : userCacheInfos) {
|
||||
MonitorDO monitorDO = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(userCacheInfo), MonitorDO.class);
|
||||
if (monitorDO.getStuId().equals(String.valueOf(userId))) {
|
||||
if (monitorDO.getExamStatus().equals("1")) {
|
||||
// 说明考试没有结束
|
||||
String key = taskManager.getTaskById(String.valueOf(userId));
|
||||
if (key != null) {
|
||||
return CommonResult.success(key);
|
||||
} else {
|
||||
// 通过试卷number查找试卷ID
|
||||
String paperNum = monitorDO.getPaperNum();
|
||||
String paperId = educationPaperService.selectPaperByPaperNum(paperNum);
|
||||
key = loginUser.getId() + "_" + monitorDO.getTaskId() + "_" + paperId;
|
||||
return CommonResult.success(key);
|
||||
}
|
||||
} else {
|
||||
return CommonResult.success("0");
|
||||
}
|
||||
}
|
||||
}
|
||||
return CommonResult.success(key);
|
||||
}
|
||||
return CommonResult.success("0");
|
||||
}
|
||||
@@ -270,6 +314,7 @@ public class AutoToolsController {
|
||||
}
|
||||
return CommonResult.error(1_0001_002,"没有找到对应的学生信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止考试
|
||||
*
|
||||
|
@@ -0,0 +1,13 @@
|
||||
package pc.exam.pp.module.judgement.controller.admin.autoTools.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StuSideReqVo {
|
||||
|
||||
@Schema(description = "试卷号")
|
||||
private String taskId;
|
||||
|
||||
}
|
Reference in New Issue
Block a user