|
@@ -13,16 +13,21 @@ import com.ruoyi.dz.service.IDzControlService;
|
|
|
import com.ruoyi.dz.service.IDzSubjectService;
|
|
import com.ruoyi.dz.service.IDzSubjectService;
|
|
|
import com.ruoyi.enums.PaperType;
|
|
import com.ruoyi.enums.PaperType;
|
|
|
import com.ruoyi.learn.domain.LearnPaper;
|
|
import com.ruoyi.learn.domain.LearnPaper;
|
|
|
|
|
+import com.ruoyi.learn.domain.LearnStudent;
|
|
|
import com.ruoyi.learn.domain.LearnTest;
|
|
import com.ruoyi.learn.domain.LearnTest;
|
|
|
import com.ruoyi.learn.service.ILearnPaperQuestionService;
|
|
import com.ruoyi.learn.service.ILearnPaperQuestionService;
|
|
|
import com.ruoyi.learn.service.ILearnPaperService;
|
|
import com.ruoyi.learn.service.ILearnPaperService;
|
|
|
|
|
+import com.ruoyi.learn.service.ILearnStudentService;
|
|
|
import com.ruoyi.learn.service.ILearnTestService;
|
|
import com.ruoyi.learn.service.ILearnTestService;
|
|
|
import com.ruoyi.web.service.ExamService;
|
|
import com.ruoyi.web.service.ExamService;
|
|
|
import com.ruoyi.web.service.LearnTeacherService;
|
|
import com.ruoyi.web.service.LearnTeacherService;
|
|
|
import com.ruoyi.web.service.PaperService;
|
|
import com.ruoyi.web.service.PaperService;
|
|
|
|
|
+import com.ruoyi.web.service.StudentService;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
|
+import org.apache.commons.compress.utils.Lists;
|
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
@@ -30,6 +35,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
+import java.util.Set;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping("/front/paper")
|
|
@RequestMapping("/front/paper")
|
|
@@ -39,14 +46,18 @@ public class FrontPaperController {
|
|
|
private final IDzSubjectService dzSubjectService;
|
|
private final IDzSubjectService dzSubjectService;
|
|
|
private final PaperService paperService;
|
|
private final PaperService paperService;
|
|
|
private final ILearnTestService testService;
|
|
private final ILearnTestService testService;
|
|
|
|
|
+ private final ILearnStudentService learnStudentService;
|
|
|
private final LearnTeacherService learnTeacherService;
|
|
private final LearnTeacherService learnTeacherService;
|
|
|
|
|
+ private final StudentService studentService;
|
|
|
|
|
|
|
|
- public FrontPaperController(IDzControlService dzControlService, IDzSubjectService dzSubjectService, PaperService paperService, ILearnTestService testService, LearnTeacherService learnTeacherService) {
|
|
|
|
|
|
|
+ public FrontPaperController(IDzControlService dzControlService, IDzSubjectService dzSubjectService, PaperService paperService, ILearnTestService testService, ILearnStudentService learnStudentService, LearnTeacherService learnTeacherService, StudentService studentService) {
|
|
|
this.dzControlService = dzControlService;
|
|
this.dzControlService = dzControlService;
|
|
|
this.dzSubjectService = dzSubjectService;
|
|
this.dzSubjectService = dzSubjectService;
|
|
|
this.paperService = paperService;
|
|
this.paperService = paperService;
|
|
|
this.testService = testService;
|
|
this.testService = testService;
|
|
|
|
|
+ this.learnStudentService = learnStudentService;
|
|
|
this.learnTeacherService = learnTeacherService;
|
|
this.learnTeacherService = learnTeacherService;
|
|
|
|
|
+ this.studentService = studentService;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation("01 考试批次")
|
|
@ApiOperation("01 考试批次")
|
|
@@ -66,13 +77,23 @@ public class FrontPaperController {
|
|
|
sCond.setLocations(sysUser.getLocation());
|
|
sCond.setLocations(sysUser.getLocation());
|
|
|
sCond.setExamTypes(sysUser.getExamType().name());
|
|
sCond.setExamTypes(sysUser.getExamType().name());
|
|
|
List<DzSubject> list = dzSubjectService.selectDzSubjectList(sCond);
|
|
List<DzSubject> list = dzSubjectService.selectDzSubjectList(sCond);
|
|
|
- return AjaxResult2.success(list);
|
|
|
|
|
|
|
+ if(!directed) {
|
|
|
|
|
+ return AjaxResult2.success(list);
|
|
|
|
|
+ }
|
|
|
|
|
+ LearnStudent learnStudent = learnStudentService.selectLearnStudentByStudentId(SecurityUtils.getUserId());
|
|
|
|
|
+ Set<Long> subjectIdSet;
|
|
|
|
|
+ if(null == learnStudent || CollectionUtils.isEmpty((subjectIdSet = learnTeacherService.getSubjectIdSet(new Long[] {learnStudent.getMajorPlanId()})))) {
|
|
|
|
|
+ return AjaxResult2.success(list);
|
|
|
|
|
+ }
|
|
|
|
|
+ return AjaxResult2.success(list.stream().filter(t -> subjectIdSet.contains(t.getSubjectId())).collect(Collectors.toList()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation("03 知识点树")
|
|
@ApiOperation("03 知识点树")
|
|
|
@GetMapping(value = "knowledge")
|
|
@GetMapping(value = "knowledge")
|
|
|
public AjaxResult getKnowledge(@ApiParam("定向") @RequestParam(defaultValue = "false") boolean directed, @ApiParam("科目ID") Long subjectId) {
|
|
public AjaxResult getKnowledge(@ApiParam("定向") @RequestParam(defaultValue = "false") boolean directed, @ApiParam("科目ID") Long subjectId) {
|
|
|
- return AjaxResult.success(learnTeacherService.getKnowledgeTree(subjectId, null, true));
|
|
|
|
|
|
|
+ LearnStudent learnStudent = learnStudentService.selectLearnStudentByStudentId(SecurityUtils.getUserId());
|
|
|
|
|
+ Long[] planIds = null != learnStudent ? new Long[] { learnStudent.getMajorPlanId() } : null;
|
|
|
|
|
+ return AjaxResult.success(learnTeacherService.getKnowledgeTree(subjectId, planIds, true));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation("04 取试卷")
|
|
@ApiOperation("04 取试卷")
|