|
@@ -13,6 +13,8 @@ import com.ynfy.buss.exam.paperrulegroup.service.IPaperRuleGroupService;
|
|
|
import com.ynfy.buss.exam.question.enums.QuestionType;
|
|
|
import com.ynfy.buss.exam.userexam.entity.UserExam;
|
|
|
import com.ynfy.buss.exam.userexam.service.IUserExamService;
|
|
|
+import com.ynfy.buss.exam.userexamresult.entity.vo.UserExamScoreVO;
|
|
|
+import com.ynfy.buss.exam.userexamresult.service.IUserExamResultService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -52,6 +54,9 @@ public class ExamController extends JeecgController<Exam, IExamService> {
|
|
|
@Autowired
|
|
|
private IPaperRuleGroupService paperRuleGroupService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IUserExamResultService userExamResultService;
|
|
|
+
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
*
|
|
@@ -147,7 +152,7 @@ public class ExamController extends JeecgController<Exam, IExamService> {
|
|
|
*/
|
|
|
@ApiOperation(value = "考试-通过id查询", notes = "考试-通过id查询")
|
|
|
@GetMapping(value = "/queryById")
|
|
|
- public Result<Exam> queryById(@RequestParam(name = "id", required = true) String id) {
|
|
|
+ public Result<Exam> queryById(@RequestParam String id) {
|
|
|
Exam exam = examService.detail(id);
|
|
|
if (Objects.isNull(exam)) {
|
|
|
return Result.error("考试不存在");
|
|
@@ -161,6 +166,13 @@ public class ExamController extends JeecgController<Exam, IExamService> {
|
|
|
dtoList.stream().forEach(dto -> dto.setQuestionTypeName(QuestionType.getByCode(dto.getQuestionType()).getValue()));
|
|
|
exam.setQuestionTypeCountList(dtoList);
|
|
|
}
|
|
|
+
|
|
|
+ //获取考试次数
|
|
|
+ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ UserExamScoreVO userExamScoreVO = userExamResultService.examScore(user.getId(), id);
|
|
|
+ if (!Objects.isNull(userExamScoreVO)) {
|
|
|
+ exam.setTryCount(userExamScoreVO.getTryCount());
|
|
|
+ }
|
|
|
return Result.OK(exam);
|
|
|
}
|
|
|
|