|
|
@ -8,114 +8,130 @@ package lsgwr.exam.controller;
|
|
|
|
|
|
|
|
|
|
|
|
import lsgwr.exam.entity.Exam;
|
|
|
|
import lsgwr.exam.entity.Exam;
|
|
|
|
import lsgwr.exam.entity.ExamRecord;
|
|
|
|
import lsgwr.exam.entity.ExamRecord;
|
|
|
|
import lsgwr.exam.service.ExamService;
|
|
|
|
import lsgwr.exam.service.ExamService;//导入考试的一些包
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;//Swagger注解
|
|
|
|
import lsgwr.exam.vo.*;
|
|
|
|
import lsgwr.exam.vo.*;// 引入所有视图对象(VO)
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;// Bean 属性拷贝工具类
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;//添加注解
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletRequest;// HTTP 请求对象
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
// 控制器注解,表示这是一个 RESTful 控制器
|
|
|
|
@RestController
|
|
|
|
@RestController
|
|
|
|
@Api(tags = "Exam APIs")
|
|
|
|
@Api(tags = "Exam APIs")// 为 Swagger 文档定义标签,用于分组API接口
|
|
|
|
@RequestMapping("/api/exam")
|
|
|
|
@RequestMapping("/api/exam")// 定义基础路径为 /api/exam 的请求映射
|
|
|
|
public class ExamController {
|
|
|
|
public class ExamController {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private ExamService examService;
|
|
|
|
private ExamService examService;// 自动注入 ExamService 服务
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 获取所有问题的列表。
|
|
|
|
|
|
|
|
*/
|
|
|
|
@GetMapping("/question/all")
|
|
|
|
@GetMapping("/question/all")
|
|
|
|
@ApiOperation("获取所有问题的列表")
|
|
|
|
@ApiOperation("获取所有问题的列表")
|
|
|
|
ResultVO<List<QuestionVo>> getQuestionAll() {
|
|
|
|
ResultVO<List<QuestionVo>> getQuestionAll() {
|
|
|
|
ResultVO<List<QuestionVo>> resultVO;
|
|
|
|
ResultVO<List<QuestionVo>> resultVO;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
List<QuestionVo> questionAll = examService.getQuestionAll();
|
|
|
|
List<QuestionVo> questionAll = examService.getQuestionAll();// 调用服务层获取所有问题
|
|
|
|
resultVO = new ResultVO<>(0, "获取全部问题列表成功", questionAll);
|
|
|
|
resultVO = new ResultVO<>(0, "获取全部问题列表成功", questionAll);// 返回成功结果
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
resultVO = new ResultVO<>(-1, "获取全部问题列表失败", null);
|
|
|
|
resultVO = new ResultVO<>(-1, "获取全部问题列表失败", null);// 返回失败结果
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resultVO;
|
|
|
|
return resultVO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 更新指定的问题。
|
|
|
|
|
|
|
|
*/
|
|
|
|
@PostMapping("/question/update")
|
|
|
|
@PostMapping("/question/update")
|
|
|
|
@ApiOperation("更新问题")
|
|
|
|
@ApiOperation("更新问题")
|
|
|
|
ResultVO<QuestionVo> questionUpdate(@RequestBody QuestionVo questionVo) {
|
|
|
|
ResultVO<QuestionVo> questionUpdate(@RequestBody QuestionVo questionVo) {
|
|
|
|
// 完成问题的更新
|
|
|
|
// 完成问题的更新
|
|
|
|
System.out.println(questionVo);
|
|
|
|
System.out.println(questionVo);// 打印接收到的问题信息以供调试
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
QuestionVo questionVoResult = examService.updateQuestion(questionVo);
|
|
|
|
QuestionVo questionVoResult = examService.updateQuestion(questionVo);// 调用服务层更新问题
|
|
|
|
return new ResultVO<>(0, "更新问题成功", questionVoResult);
|
|
|
|
return new ResultVO<>(0, "更新问题成功", questionVoResult);// 返回成功结果
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
return new ResultVO<>(-1, "更新问题失败", null);
|
|
|
|
return new ResultVO<>(-1, "更新问题失败", null);// 返回失败结果
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 创建新问题。
|
|
|
|
|
|
|
|
*/
|
|
|
|
@PostMapping("/question/create")
|
|
|
|
@PostMapping("/question/create")
|
|
|
|
@ApiOperation("创建问题")
|
|
|
|
@ApiOperation("创建问题")
|
|
|
|
ResultVO<String> questionCreate(@RequestBody QuestionCreateSimplifyVo questionCreateSimplifyVo, HttpServletRequest request) {
|
|
|
|
ResultVO<String> questionCreate(@RequestBody QuestionCreateSimplifyVo questionCreateSimplifyVo, HttpServletRequest request) {
|
|
|
|
QuestionCreateVo questionCreateVo = new QuestionCreateVo();
|
|
|
|
QuestionCreateVo questionCreateVo = new QuestionCreateVo();
|
|
|
|
// 把能拷贝过来的属性都拷贝过来
|
|
|
|
// 把能拷贝过来的属性都拷贝过来
|
|
|
|
BeanUtils.copyProperties(questionCreateSimplifyVo, questionCreateVo);
|
|
|
|
BeanUtils.copyProperties(questionCreateSimplifyVo, questionCreateVo);// 拷贝属性到新的对象
|
|
|
|
// 设置创建者信息
|
|
|
|
// 设置创建者信息
|
|
|
|
String userId = (String) request.getAttribute("user_id");
|
|
|
|
String userId = (String) request.getAttribute("user_id");// 从请求中获取用户ID
|
|
|
|
questionCreateVo.setQuestionCreatorId(userId);
|
|
|
|
questionCreateVo.setQuestionCreatorId(userId);// 设置创建者ID
|
|
|
|
System.out.println(questionCreateVo);
|
|
|
|
System.out.println(questionCreateVo);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
examService.questionCreate(questionCreateVo);
|
|
|
|
examService.questionCreate(questionCreateVo);// 调用服务层创建新问题
|
|
|
|
return new ResultVO<>(0, "问题创建成功", null);
|
|
|
|
return new ResultVO<>(0, "问题创建成功", null);// 返回成功结果
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
return new ResultVO<>(-1, "创建问题失败", null);
|
|
|
|
return new ResultVO<>(-1, "创建问题失败", null);// 返回失败结果
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 获取分类选项。
|
|
|
|
|
|
|
|
*/
|
|
|
|
@GetMapping("/question/selection")
|
|
|
|
@GetMapping("/question/selection")
|
|
|
|
@ApiOperation("获取问题分类的相关选项")
|
|
|
|
@ApiOperation("获取问题分类的相关选项")
|
|
|
|
ResultVO<QuestionSelectionVo> getSelections() {
|
|
|
|
ResultVO<QuestionSelectionVo> getSelections() {
|
|
|
|
QuestionSelectionVo questionSelectionVo = examService.getSelections();
|
|
|
|
QuestionSelectionVo questionSelectionVo = examService.getSelections();
|
|
|
|
if (questionSelectionVo != null) {
|
|
|
|
if (questionSelectionVo != null) {
|
|
|
|
return new ResultVO<>(0, "获取问题分类选项成功", questionSelectionVo);
|
|
|
|
return new ResultVO<>(0, "获取问题分类选项成功", questionSelectionVo);// 成功返回分类选项
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return new ResultVO<>(-1, "获取问题分类选项失败", null);
|
|
|
|
return new ResultVO<>(-1, "获取问题分类选项失败", null);// 分类选项为空时返回失败信息
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 根据 ID 获取具体题目详情。
|
|
|
|
|
|
|
|
*/
|
|
|
|
@GetMapping("/question/detail/{id}")
|
|
|
|
@GetMapping("/question/detail/{id}")
|
|
|
|
@ApiOperation("根据问题的id获取问题的详细信息")
|
|
|
|
@ApiOperation("根据问题的id获取问题的详细信息")
|
|
|
|
ResultVO<QuestionDetailVo> getQuestionDetail(@PathVariable String id) {
|
|
|
|
ResultVO<QuestionDetailVo> getQuestionDetail(@PathVariable String id) {
|
|
|
|
// 根据问题id获取问题的详细信息
|
|
|
|
// 根据问题id获取问题的详细信息
|
|
|
|
System.out.println(id);
|
|
|
|
System.out.println(id);// 打印出请求的问题ID,便于调试和日志记录
|
|
|
|
ResultVO<QuestionDetailVo> resultVO;
|
|
|
|
ResultVO<QuestionDetailVo> resultVO;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
QuestionDetailVo questionDetailVo = examService.getQuestionDetail(id);
|
|
|
|
QuestionDetailVo questionDetailVo = examService.getQuestionDetail(id);
|
|
|
|
resultVO = new ResultVO<>(0, "获取问题详情成功", questionDetailVo);
|
|
|
|
resultVO = new ResultVO<>(0, "获取问题详情成功", questionDetailVo);// 构造成功响应对象,状态码为0表示成功
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();// 打印异常堆栈以供调试
|
|
|
|
resultVO = new ResultVO<>(-1, "获取问题详情失败", null);
|
|
|
|
resultVO = new ResultVO<>(-1, "获取问题详情失败", null);// 构造失败响应对象,状态码为-1表示失败
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resultVO;
|
|
|
|
return resultVO;// 返回结果对象
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 获取所有考试的信息。
|
|
|
|
|
|
|
|
*/
|
|
|
|
@GetMapping("/all")
|
|
|
|
@GetMapping("/all")
|
|
|
|
@ApiOperation("获取全部考试的列表")
|
|
|
|
@ApiOperation("获取全部考试的列表")
|
|
|
|
ResultVO<List<ExamVo>> getExamAll() {
|
|
|
|
ResultVO<List<ExamVo>> getExamAll() {
|
|
|
|
// 需要拼接前端需要的考试列表对象
|
|
|
|
// 需要拼接前端需要的考试列表对象s
|
|
|
|
ResultVO<List<ExamVo>> resultVO;
|
|
|
|
ResultVO<List<ExamVo>> resultVO;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
List<ExamVo> examVos = examService.getExamAll();
|
|
|
|
List<ExamVo> examVos = examService.getExamAll(); // 调用服务层获取所有考试信息
|
|
|
|
resultVO = new ResultVO<>(0, "获取全部考试的列表成功", examVos);
|
|
|
|
resultVO = new ResultVO<>(0, "获取全部考试的列表成功", examVos);// 构造成功响应对象,状态码为0表示成功
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();// 打印异常堆栈以供调试
|
|
|
|
resultVO = new ResultVO<>(-1, "获取全部考试的列表失败", null);
|
|
|
|
resultVO = new ResultVO<>(-1, "获取全部考试的列表失败", null);// 构造失败响应对象,状态码为-1表示失败
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resultVO;
|
|
|
|
return resultVO;// 返回结果对象
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 获取问题列表,按照单选、多选和判断题分类返回。
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return 返回包含分类后的问题列表的ResultVO对象。
|
|
|
|
|
|
|
|
*/
|
|
|
|
@GetMapping("/question/type/list")
|
|
|
|
@GetMapping("/question/type/list")
|
|
|
|
@ApiOperation("获取问题列表,按照单选、多选和判断题分类返回")
|
|
|
|
@ApiOperation("获取问题列表,按照单选、多选和判断题分类返回")
|
|
|
|
ResultVO<ExamQuestionTypeVo> getExamQuestionTypeList() {
|
|
|
|
ResultVO<ExamQuestionTypeVo> getExamQuestionTypeList() {
|
|
|
@ -130,7 +146,13 @@ public class ExamController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resultVO;
|
|
|
|
return resultVO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 创建新的考试记录。
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param examCreateVo 包含创建新考试所需数据的视图对象。
|
|
|
|
|
|
|
|
* @param request HTTP 请求,用于提取用户 ID。
|
|
|
|
|
|
|
|
* @return 返回包含新创建考试信息的Result VO 对象。
|
|
|
|
|
|
|
|
*/
|
|
|
|
@PostMapping("/create")
|
|
|
|
@PostMapping("/create")
|
|
|
|
@ApiOperation("创建考试")
|
|
|
|
@ApiOperation("创建考试")
|
|
|
|
ResultVO<Exam> createExam(@RequestBody ExamCreateVo examCreateVo, HttpServletRequest request) {
|
|
|
|
ResultVO<Exam> createExam(@RequestBody ExamCreateVo examCreateVo, HttpServletRequest request) {
|
|
|
@ -146,7 +168,13 @@ public class ExamController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resultVO;
|
|
|
|
return resultVO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 更新已有考试的信息。
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param examVo 包含更新后数据的新视图对象。
|
|
|
|
|
|
|
|
* @param request HTTP 请求,用于提取用户 ID。
|
|
|
|
|
|
|
|
* @return 返回更新后的结果,包括最新版本的信息或错误消息。
|
|
|
|
|
|
|
|
*/
|
|
|
|
@PostMapping("/update")
|
|
|
|
@PostMapping("/update")
|
|
|
|
@ApiOperation("更新考试")
|
|
|
|
@ApiOperation("更新考试")
|
|
|
|
ResultVO<Exam> updateExam(@RequestBody ExamVo examVo, HttpServletRequest request) {
|
|
|
|
ResultVO<Exam> updateExam(@RequestBody ExamVo examVo, HttpServletRequest request) {
|
|
|
@ -162,7 +190,11 @@ public class ExamController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resultVO;
|
|
|
|
return resultVO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 获取适配前端卡片展示形式 的 考试 列表 。
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return返回包含卡片形式 的 考试 列表 的Resultsvo 对象 ;
|
|
|
|
|
|
|
|
*/
|
|
|
|
@GetMapping("/card/list")
|
|
|
|
@GetMapping("/card/list")
|
|
|
|
@ApiOperation("获取考试列表,适配前端卡片列表")
|
|
|
|
@ApiOperation("获取考试列表,适配前端卡片列表")
|
|
|
|
ResultVO<List<ExamCardVo>> getExamCardList() {
|
|
|
|
ResultVO<List<ExamCardVo>> getExamCardList() {
|
|
|
@ -177,7 +209,12 @@ public class ExamController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resultVO;
|
|
|
|
return resultVO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 根据给定ID检索特定考卷的信息。
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param id 考卷唯一标识符。
|
|
|
|
|
|
|
|
* @return 包含考卷详情信息 的 Resultsvo 对象。
|
|
|
|
|
|
|
|
*/
|
|
|
|
@GetMapping("/detail/{id}")
|
|
|
|
@GetMapping("/detail/{id}")
|
|
|
|
@ApiOperation("根据考试的id,获取考试详情")
|
|
|
|
@ApiOperation("根据考试的id,获取考试详情")
|
|
|
|
ResultVO<ExamDetailVo> getExamDetail(@PathVariable String id) {
|
|
|
|
ResultVO<ExamDetailVo> getExamDetail(@PathVariable String id) {
|
|
|
@ -191,52 +228,71 @@ public class ExamController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resultVO;
|
|
|
|
return resultVO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 提交用户答案,并进行评分处理。此过程将返回得分情况。 *
|
|
|
|
|
|
|
|
* @param examId 要评分 的 考试 唯一 标识符。 *
|
|
|
|
|
|
|
|
* @param answersMap 用户提交 答案 集合(可能包括多个答案)。 *
|
|
|
|
|
|
|
|
* @param request 用于提取当前用户 ID 的 HTTP 请求。 *
|
|
|
|
|
|
|
|
* @return 一个结果封装了评分后的成绩记录(包括分数等)与相应消息; *
|
|
|
|
|
|
|
|
*/
|
|
|
|
@PostMapping("/finish/{examId}")
|
|
|
|
@PostMapping("/finish/{examId}")
|
|
|
|
@ApiOperation("根据用户提交的答案对指定id的考试判分")
|
|
|
|
@ApiOperation("根据用户提交的答案对指定id的考试判分")
|
|
|
|
ResultVO<ExamRecord> finishExam(@PathVariable String examId, @RequestBody HashMap<String, List<String>> answersMap, HttpServletRequest request) {
|
|
|
|
ResultVO<ExamRecord> finishExam(@PathVariable String examId, @RequestBody HashMap<String, List<String>> answersMap, HttpServletRequest request) {
|
|
|
|
ResultVO<ExamRecord> resultVO;
|
|
|
|
ResultVO<ExamRecord> resultVO;// 定义一个用于存放结果的数据结构
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
// 拦截器里设置上的用户id
|
|
|
|
// 拦截器里设置上的用户id
|
|
|
|
String userId = (String) request.getAttribute("user_id");
|
|
|
|
String userId = (String) request.getAttribute("user_id");
|
|
|
|
// 下面根据用户提交的信息进行判分,返回用户的得分情况
|
|
|
|
// 下面根据用户提交的信息进行判分,返回用户的得分情况
|
|
|
|
ExamRecord examRecord = examService.judge(userId, examId, answersMap);
|
|
|
|
ExamRecord examRecord = examService.judge(userId, examId, answersMap);
|
|
|
|
resultVO = new ResultVO<>(0, "考卷提交成功", examRecord);
|
|
|
|
resultVO = new ResultVO<>(0, "考卷提交成功", examRecord);// 封装成绩记录到最终结果中
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
resultVO = new ResultVO<>(-1, "考卷提交失败", null);
|
|
|
|
resultVO = new ResultVO<>(-1, "考卷提交失败", null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resultVO;
|
|
|
|
return resultVO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 获取当前用户已参加过所有测验记录; *
|
|
|
|
|
|
|
|
* *@ param request 用于提取当前用户ID; *
|
|
|
|
|
|
|
|
* *@ return 包含该用户所有测验历史记录 (如时间、得分等)的Resultsvo 对象; *
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
@GetMapping("/record/list")
|
|
|
|
@GetMapping("/record/list")
|
|
|
|
@ApiOperation("获取当前用户的考试记录")
|
|
|
|
@ApiOperation("获取当前用户的考试记录")
|
|
|
|
ResultVO<List<ExamRecordVo>> getExamRecordList(HttpServletRequest request) {
|
|
|
|
ResultVO<List<ExamRecordVo>> getExamRecordList(HttpServletRequest request) {
|
|
|
|
ResultVO<List<ExamRecordVo>> resultVO;
|
|
|
|
ResultVO<List<ExamRecordVo>> resultVO;//定义一个用于存放结果的数据结构
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
// 拦截器里设置上的用户id
|
|
|
|
// 拦截器里设置上的用户id
|
|
|
|
String userId = (String) request.getAttribute("user_id");
|
|
|
|
String userId = (String) request.getAttribute("user_id");
|
|
|
|
// 下面根据用户账号拿到他(她所有的考试信息),注意要用VO封装下
|
|
|
|
// 下面根据用户账号拿到他(她所有的考试信息),注意要用VO封装下
|
|
|
|
List<ExamRecordVo> examRecordVoList = examService.getExamRecordList(userId);
|
|
|
|
List<ExamRecordVo> examRecordVoList = examService.getExamRecordList(userId);
|
|
|
|
resultVO = new ResultVO<>(0, "获取考试记录成功", examRecordVoList);
|
|
|
|
resultVO = new ResultVO<>(0, "获取考试记录成功", examRecordVoList);//封装查询得到的信息到最终结果中;
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
resultVO = new ResultVO<>(-1, "获取考试记录失败", null);
|
|
|
|
resultVO = new ResultVO<>(-1, "获取考试记录失败", null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resultVO;
|
|
|
|
return resultVO;//返回封装好的 数据结构
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
根据指定 recordId 查询某次测验详细情况;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*@ param recordId 要查询测验具体内容对应唯一标识符;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*@ return 封装了该条目详尽数据与反馈消息内容 的Resulsvolumne 对象。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
@GetMapping("/record/detail/{recordId}")
|
|
|
|
@GetMapping("/record/detail/{recordId}")
|
|
|
|
@ApiOperation("根据考试记录id获取考试记录详情")
|
|
|
|
@ApiOperation("根据考试记录id获取考试记录详情")
|
|
|
|
ResultVO<RecordDetailVo> getExamRecordDetail(@PathVariable String recordId) {
|
|
|
|
ResultVO<RecordDetailVo> getExamRecordDetail(@PathVariable String recordId) {
|
|
|
|
ResultVO<RecordDetailVo> resultVO;
|
|
|
|
ResultVO<RecordDetailVo> resultVO;//定义一个用于存放结果的数据结构;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
RecordDetailVo recordDetailVo = examService.getRecordDetail(recordId);
|
|
|
|
RecordDetailVo recordDetailVo = examService.getRecordDetail(recordId);
|
|
|
|
resultVO = new ResultVO<>(0, "获取考试记录详情成功", recordDetailVo);
|
|
|
|
resultVO = new ResultVO<>(0, "获取考试记录详情成功", recordDetailVo);//封装查询得到的信息到最终结果中;
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
resultVO = new ResultVO<>(-1, "获取考试记录详情失败", null);
|
|
|
|
resultVO = new ResultVO<>(-1, "获取考试记录详情失败", null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resultVO;
|
|
|
|
return resultVO;//返回封装好的 数据结构
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|