章节绑定练习详情
This commit is contained in:
parent
53f6de63ce
commit
181c267219
@ -225,6 +225,10 @@ public class AiolExamController extends JeecgController<AiolExam, IAiolExamServi
|
|||||||
private IAiolQuestionOptionService questionOptionService;
|
private IAiolQuestionOptionService questionOptionService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IAiolQuestionAnswerService questionAnswerService;
|
private IAiolQuestionAnswerService questionAnswerService;
|
||||||
|
@Autowired
|
||||||
|
private IAiolEntityLinkService entityLinkService;
|
||||||
|
@Autowired
|
||||||
|
private AiolPaperQuestionController paperQuestionController;
|
||||||
|
|
||||||
//获取考试试题
|
//获取考试试题
|
||||||
@RequestMapping("/getExamQuestions/{examId}")
|
@RequestMapping("/getExamQuestions/{examId}")
|
||||||
@ -317,6 +321,31 @@ public class AiolExamController extends JeecgController<AiolExam, IAiolExamServi
|
|||||||
return examAnswerService.update(updateWrapper) ? Result.OK() : Result.error("提交答案失败");
|
return examAnswerService.update(updateWrapper) ? Result.OK() : Result.error("提交答案失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//查看章节绑定的练习
|
||||||
|
@GetMapping("/getExamQuestionsByChapter/{sourceId}")
|
||||||
|
@Operation(summary = "获取章节绑定的练习")
|
||||||
|
public Result<?> getExamQuestionsByChapter(@PathVariable String sourceId) {
|
||||||
|
List<AiolEntityLink> list = entityLinkService.
|
||||||
|
list(new LambdaQueryWrapper<AiolEntityLink>().
|
||||||
|
eq(AiolEntityLink::getSourceId, sourceId).
|
||||||
|
eq(AiolEntityLink::getTargetType, "exam")
|
||||||
|
);
|
||||||
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
|
return Result.error("该章节没有绑定练习");
|
||||||
|
}
|
||||||
|
List<String> examIds = list.stream().map(AiolEntityLink::getTargetId).collect(Collectors.toList());
|
||||||
|
List<AiolExam> exams = examService.listByIds(examIds);
|
||||||
|
List<String> paperIds = exams.stream().map(AiolExam::getPaperId).collect(Collectors.toList());
|
||||||
|
ArrayList<Object> objects = new ArrayList<>();
|
||||||
|
for (String paperId : paperIds) {
|
||||||
|
Result<?> result = paperQuestionController.paperDetail(paperId);
|
||||||
|
if (result.getCode() == 200) {
|
||||||
|
objects.add(result.getResult());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.OK(objects);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/submitExam")
|
@PostMapping("/submitExam")
|
||||||
@Operation(summary = "提交考试")
|
@Operation(summary = "提交考试")
|
||||||
@Transactional
|
@Transactional
|
||||||
|
Loading…
x
Reference in New Issue
Block a user