|
|
@@ -8,11 +8,18 @@ import com.ruoyi.common.core.controller.BaseController;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult2;
|
|
|
import com.ruoyi.common.enums.ExamType;
|
|
|
+import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.dz.domain.DzControl;
|
|
|
import com.ruoyi.dz.domain.DzSubject;
|
|
|
import com.ruoyi.dz.service.IDzControlService;
|
|
|
import com.ruoyi.dz.service.IDzSubjectService;
|
|
|
+import com.ruoyi.enums.PaperType;
|
|
|
+import com.ruoyi.learn.domain.LearnPaper;
|
|
|
+import com.ruoyi.learn.domain.LearnTestPaper;
|
|
|
import com.ruoyi.learn.domain.TestPaperVO;
|
|
|
+import com.ruoyi.learn.service.ILearnPaperQuestionService;
|
|
|
+import com.ruoyi.learn.service.ILearnPaperService;
|
|
|
+import com.ruoyi.learn.service.ILearnTestPaperService;
|
|
|
import com.ruoyi.web.service.LearnTeacherService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
@@ -34,11 +41,17 @@ public class LearnTeacherController extends BaseController {
|
|
|
private final IDzControlService dzControlService;
|
|
|
private final IDzSubjectService dzSubjectService;
|
|
|
private final LearnTeacherService learnTeacherService;
|
|
|
+ private final ILearnPaperService paperService;
|
|
|
+ private final ILearnTestPaperService testPaperService;
|
|
|
+ private final ILearnPaperQuestionService paperQuestionService;
|
|
|
|
|
|
- public LearnTeacherController(IDzControlService dzControlService, IDzSubjectService dzSubjectService, LearnTeacherService learnTeacherService) {
|
|
|
+ public LearnTeacherController(IDzControlService dzControlService, IDzSubjectService dzSubjectService, LearnTeacherService learnTeacherService, ILearnPaperService paperService, ILearnTestPaperService testPaperService, ILearnPaperQuestionService paperQuestionService) {
|
|
|
this.dzControlService = dzControlService;
|
|
|
this.dzSubjectService = dzSubjectService;
|
|
|
this.learnTeacherService = learnTeacherService;
|
|
|
+ this.paperService = paperService;
|
|
|
+ this.testPaperService = testPaperService;
|
|
|
+ this.paperQuestionService = paperQuestionService;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -187,4 +200,32 @@ public class LearnTeacherController extends BaseController {
|
|
|
{
|
|
|
return toAjax(true);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @PreAuthorize("@ss.hasPermi('learn:test_paper:add')")
|
|
|
+ @ApiOperation("04 取试卷列表")
|
|
|
+ @GetMapping(value = "papers")
|
|
|
+ public AjaxResult papers(@ApiParam("批次") @RequestParam(required = false) Integer batchId) {
|
|
|
+ LearnTestPaper tpCond = new LearnTestPaper();
|
|
|
+ tpCond.setCreatorId(SecurityUtils.getUserId());
|
|
|
+ tpCond.setBatchId(batchId);
|
|
|
+ List<LearnTestPaper> testPaperList = testPaperService.selectLearnTestPaperList(tpCond);
|
|
|
+ List<JSONObject> paperList = Lists.newArrayList();
|
|
|
+ for(LearnTestPaper tp : testPaperList) {
|
|
|
+ JSONObject root = JSONObject.from(tp);
|
|
|
+ root.put("paper", paperService.selectLearnPaperById(tp.getPaperId()));
|
|
|
+ paperList.add(root);
|
|
|
+ }
|
|
|
+ return AjaxResult.success(paperList);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PreAuthorize("@ss.hasPermi('learn:test_paper:add')")
|
|
|
+ @ApiOperation("04 取试卷详情")
|
|
|
+ @GetMapping(value = "paper")
|
|
|
+ public AjaxResult loadPaper(@ApiParam("考卷类型PaperType") PaperType type, @ApiParam("考卷标识") Long id) {
|
|
|
+ LearnPaper paper = paperService.selectLearnPaperById(id);
|
|
|
+ JSONObject root = JSONObject.from(paper);
|
|
|
+ root.put("questions", paperQuestionService.selectLearnPaperQuestionById(id));
|
|
|
+ return AjaxResult.success(root);
|
|
|
+ }
|
|
|
}
|