查询考试进度
This commit is contained in:
parent
69d2a464cb
commit
58ea4b3071
@ -196,6 +196,32 @@ public class ExamBizController {
|
|||||||
return examRecordService.update(updateWrapper) ? Result.OK() : Result.error("提交考试失败");
|
return examRecordService.update(updateWrapper) ? Result.OK() : Result.error("提交考试失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/queryExamProgress")
|
||||||
|
@Operation(summary = "查询考试进度")
|
||||||
|
public Result<?> queryExamProgress(@RequestParam String examId, @RequestParam String userId) {
|
||||||
|
Exam byId = examService.getById(examId);
|
||||||
|
if(byId == null){
|
||||||
|
return Result.error("考试不存在");
|
||||||
|
}
|
||||||
|
//判断考试结束时间
|
||||||
|
if(byId.getEndTime().before(new Date())){
|
||||||
|
return Result.error("考试已结束");
|
||||||
|
}
|
||||||
|
ExamRecord one = examRecordService.getOne(
|
||||||
|
new LambdaQueryWrapper<ExamRecord>()
|
||||||
|
.eq(ExamRecord::getExamId, examId)
|
||||||
|
.eq(ExamRecord::getUserId, userId)
|
||||||
|
);
|
||||||
|
if(one == null){
|
||||||
|
return Result.error("用户暂未考试,可获取考试题目");
|
||||||
|
}
|
||||||
|
return Result.OK(examAnswerService.
|
||||||
|
list(new LambdaQueryWrapper<ExamAnswer>().
|
||||||
|
eq(ExamAnswer::getExamId, examId).
|
||||||
|
eq(ExamAnswer::getUserId, userId))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//根据考试规则随机组卷
|
//根据考试规则随机组卷
|
||||||
public List<String> random(List<QuestionRepo> list, String rules) {
|
public List<String> random(List<QuestionRepo> list, String rules) {
|
||||||
JSONObject ruleJson = JSON.parseObject(rules);
|
JSONObject ruleJson = JSON.parseObject(rules);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user