|
|
@@ -3,10 +3,13 @@ package com.ruoyi.web.controller.learn;
|
|
|
import cn.hutool.core.lang.Dict;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.google.common.collect.Sets;
|
|
|
import com.ruoyi.common.annotation.Anonymous;
|
|
|
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.core.domain.entity.SysUser;
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
import com.ruoyi.common.enums.ExamType;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.dz.domain.DzControl;
|
|
|
@@ -14,6 +17,7 @@ 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.enums.QuestionType;
|
|
|
import com.ruoyi.learn.domain.LearnPaper;
|
|
|
import com.ruoyi.learn.domain.LearnTestPaper;
|
|
|
import com.ruoyi.learn.domain.TestPaperVO;
|
|
|
@@ -29,10 +33,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@RestController
|
|
|
@@ -55,32 +56,6 @@ public class LearnTeacherController extends BaseController {
|
|
|
this.paperQuestionService = paperQuestionService;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- -- 1. 查询考试批次(假设每个老师自已控制)
|
|
|
- -- 2. 查询班老师班级列表
|
|
|
- -- 3. 查询定向院校列表
|
|
|
- -- 5. 查询定向院校专业组
|
|
|
- -- 6. 查询科目(分是否定向)
|
|
|
- -- 7. 查询知识点(分是否定向)
|
|
|
- -- 8. 查询单个定向时知识点树
|
|
|
- -- 9. 设置题型数量(预置题型要求,或人工指定,不指定时平均分配, 题型是针对院校的)
|
|
|
- */
|
|
|
-
|
|
|
-
|
|
|
- @GetMapping(value = "provinces")
|
|
|
- @Anonymous
|
|
|
- @ApiOperation("省份列表")
|
|
|
- public AjaxResult provinces()
|
|
|
- {
|
|
|
- DzControl cond = new DzControl();
|
|
|
- cond.setIsValid(1);
|
|
|
- return AjaxResult.success(dzControlService.selectDzControlList(cond).stream().map(t -> {
|
|
|
- JSONObject o = new JSONObject();
|
|
|
- o.put("dictValue", t.getLocation());
|
|
|
- o.put("dictLabel", t.getLocation());
|
|
|
- return o;
|
|
|
- }).collect(Collectors.toList()));
|
|
|
- }
|
|
|
|
|
|
@GetMapping(value = "examTypes")
|
|
|
@Anonymous
|
|
|
@@ -103,20 +78,42 @@ public class LearnTeacherController extends BaseController {
|
|
|
}).collect(Collectors.toList()));
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/classes")
|
|
|
- @ApiOperation("2. 班级列表")
|
|
|
- public AjaxResult classes()
|
|
|
+ @GetMapping("/subjects")
|
|
|
+ @ApiOperation("科目列表")
|
|
|
+ public AjaxResult2<List<DzSubject>> subjects(@RequestParam @ApiParam("考生类型") ExamType examType)
|
|
|
{
|
|
|
- return AjaxResult.success(learnTeacherService.getClasses(getUserId()));
|
|
|
+ DzSubject sCond = new DzSubject();
|
|
|
+ sCond.setExamTypes(examType.name());
|
|
|
+ Set<Long> validSubjectIdSet = Sets.newHashSet(1L, 2L, 3L, 100L);
|
|
|
+ List<DzSubject> list = dzSubjectService.selectDzSubjectList(sCond).stream().filter(t -> validSubjectIdSet.contains(t.getSubjectId())).collect(Collectors.toList());
|
|
|
+ return AjaxResult2.success(list);
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/students")
|
|
|
- @ApiOperation("学生列表")
|
|
|
- public AjaxResult students(@ApiParam("批次ID") Long batchId)
|
|
|
+ @GetMapping("/knowledges")
|
|
|
+ @ApiOperation("知识点列表")
|
|
|
+ public AjaxResult knowledges(@ApiParam("类型 ExactIntelligent/FullIntelligent/ExactHand/FullHand") @RequestParam String buildType,
|
|
|
+ @ApiParam("科目ID") @RequestParam(required = false) Long subjectId,
|
|
|
+ @ApiParam("专业计划ID") @RequestParam(required = false) Long majorPlanId)
|
|
|
{
|
|
|
- return AjaxResult.success(learnTeacherService.getStudents(batchId, getUserId()));
|
|
|
+ Set<Long> knowledgeIdSet = null;
|
|
|
+ if("FullHand".equals(buildType)) {
|
|
|
+ knowledgeIdSet = learnTeacherService.getKnowledgeIdSet(majorPlanId);
|
|
|
+ }
|
|
|
+ return AjaxResult.success(learnTeacherService.getKnowledgeTree(null, subjectId, knowledgeIdSet, null));
|
|
|
}
|
|
|
|
|
|
+ @GetMapping(value = "classStatistic")
|
|
|
+ @ApiOperation("班级生成统计")
|
|
|
+ public AjaxResult classStatistic(@ApiParam("类型 ExactIntelligent/FullIntelligent/ExactHand/FullHand") @RequestParam String buildType,
|
|
|
+ @ApiParam("批次ID") @RequestParam Long batchId,
|
|
|
+ @ApiParam("考生类型") @RequestParam(required = false) ExamType examType,
|
|
|
+ @ApiParam("科目") @RequestParam(required = false) Long subjectId,
|
|
|
+ @ApiParam("计划专业") @RequestParam(required = false) Long planId)
|
|
|
+ {
|
|
|
+ return AjaxResult.success(learnTeacherService.getClassesBuildStats(buildType, SecurityUtils.getUserId(), batchId, examType, subjectId, planId));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@GetMapping("/universities")
|
|
|
@ApiOperation("院校列表")
|
|
|
public AjaxResult universities(@ApiParam("批次ID") Long batchId)
|
|
|
@@ -126,81 +123,103 @@ public class LearnTeacherController extends BaseController {
|
|
|
|
|
|
@GetMapping("/majors")
|
|
|
@ApiOperation("专业列表")
|
|
|
- public AjaxResult majors(@ApiParam("省份") String location, @ApiParam("考生类型") ExamType examType, @ApiParam("批次ID") Long batchId, @RequestParam(required = false) @ApiParam("院校列表") Long universityId)
|
|
|
+ public AjaxResult majors(@ApiParam("批次ID") Long batchId, @RequestParam(required = false) @ApiParam("院校列表") Long universityId)
|
|
|
{
|
|
|
- DzControl control = dzControlService.selectDzControl(location, examType);
|
|
|
+ SysUser sysUser = SecurityUtils.getLoginUser().getUser();
|
|
|
+ DzControl control = dzControlService.selectDzControl(sysUser.getLocation(), sysUser.getExamType());
|
|
|
return AjaxResult.success(learnTeacherService.selectMajorList(universityId, control.getPlanYear(), batchId));
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/subjects")
|
|
|
- @ApiOperation("科目列表")
|
|
|
- public AjaxResult2<List<DzSubject>> subjects(@RequestParam(required = false) @ApiParam("院校列表") Long universityId)
|
|
|
+
|
|
|
+ /**
|
|
|
+ -- 1. 查询考试批次(假设每个老师自已控制)
|
|
|
+ -- 2. 查询班老师班级列表
|
|
|
+ -- 3. 查询定向院校列表
|
|
|
+ -- 5. 查询定向院校专业组
|
|
|
+ -- 6. 查询科目(分是否定向)
|
|
|
+ -- 7. 查询知识点(分是否定向)
|
|
|
+ -- 8. 查询单个定向时知识点树
|
|
|
+ -- 9. 设置题型数量(预置题型要求,或人工指定,不指定时平均分配, 题型是针对院校的)
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping(value = "provinces")
|
|
|
+ @Anonymous
|
|
|
+ @ApiOperation("省份列表")
|
|
|
+ public AjaxResult provinces()
|
|
|
{
|
|
|
- DzSubject sCond = new DzSubject();
|
|
|
- List<DzSubject> list = dzSubjectService.selectDzSubjectList(sCond);
|
|
|
- return AjaxResult2.success(list);
|
|
|
+ DzControl cond = new DzControl();
|
|
|
+ cond.setIsValid(1);
|
|
|
+ return AjaxResult.success(dzControlService.selectDzControlList(cond).stream().map(t -> {
|
|
|
+ JSONObject o = new JSONObject();
|
|
|
+ o.put("dictValue", t.getLocation());
|
|
|
+ o.put("dictLabel", t.getLocation());
|
|
|
+ return o;
|
|
|
+ }).collect(Collectors.toList()));
|
|
|
}
|
|
|
|
|
|
- @GetMapping("/knowledges")
|
|
|
- @ApiOperation("知识点列表")
|
|
|
- public AjaxResult knowledges(@ApiParam("科目ID") Long subjectId, @RequestParam(required = false) @ApiParam("专业计划ID") Long[] majorPlanIds)
|
|
|
+ @GetMapping("/classes")
|
|
|
+ @ApiOperation("2. 班级列表")
|
|
|
+ public AjaxResult classes()
|
|
|
{
|
|
|
- Set<Long> knowledgeIdSet = learnTeacherService.getKnowledgeIdSet(majorPlanIds);
|
|
|
- return AjaxResult.success(learnTeacherService.getKnowledgeTree(subjectId, knowledgeIdSet, false));
|
|
|
+ return AjaxResult.success(learnTeacherService.getClasses(getUserId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/students")
|
|
|
+ @ApiOperation("学生列表")
|
|
|
+ public AjaxResult students(@ApiParam("批次ID") Long batchId)
|
|
|
+ {
|
|
|
+ return AjaxResult.success(learnTeacherService.getStudents(batchId, getUserId()));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/questionTypes")
|
|
|
@ApiOperation("题型列表")
|
|
|
- public AjaxResult questionTypes(@ApiParam("科目ID") Long subjectId, @RequestParam(required = false) @ApiParam("专业计划ID") Long[] knowledgeIds)
|
|
|
+ public AjaxResult questionTypes(@ApiParam("科目ID") Long subjectId, @RequestParam(required = false) @ApiParam("知识点") Collection<Long> knowledgeIds)
|
|
|
{
|
|
|
- List<Dict> dictList = Lists.newArrayList();
|
|
|
- dictList.add(Dict.create().set("dictLabel", "单选题").set("dictValue", "1"));
|
|
|
- dictList.add(Dict.create().set("dictLabel", "多选题").set("dictValue", "2"));
|
|
|
- dictList.add(Dict.create().set("dictLabel", "判断题").set("dictValue", "3"));
|
|
|
- dictList.add(Dict.create().set("dictLabel", "分析题").set("dictValue", "4"));
|
|
|
+ List<Dict> dictList = learnTeacherService.getQuestionTypes(subjectId, knowledgeIds).stream().map(t -> {
|
|
|
+ QuestionType qt = QuestionType.of(t.getQtpye());
|
|
|
+ return Dict.create().set("dictLabel", qt.getTitle()).set("dictValue", qt.getVal());
|
|
|
+ }).sorted(new Comparator<Dict>() {
|
|
|
+ @Override
|
|
|
+ public int compare(Dict o1, Dict o2) {
|
|
|
+ return o1.getInt("dictValue").compareTo(o2.getInt("dictValue"));
|
|
|
+ }
|
|
|
+ }).collect(Collectors.toList());
|
|
|
return AjaxResult.success(dictList);
|
|
|
}
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('learn:test_paper:add')")
|
|
|
- @PostMapping("/build/auto")
|
|
|
- @ApiOperation("批量自动组卷")
|
|
|
- public AjaxResult batchBuildAuto(@RequestBody TestPaperVO.TestPapersBuildAutoReq req)
|
|
|
+ @PostMapping("/build/exactIntelligent")
|
|
|
+ @ApiOperation("定向智能")
|
|
|
+ public AjaxResult buildExactIntelligent(@RequestBody TestPaperVO.TestPapersAutoReq req)
|
|
|
{
|
|
|
- req.setBuildType(TestPaperVO.PaperBuildType.Auto);
|
|
|
+ req.setBuildType("ExactIntelligent");
|
|
|
return AjaxResult.success(learnTeacherService.buildPapersAuto(req));
|
|
|
}
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('learn:test_paper:add')")
|
|
|
- @PostMapping("/build/manual")
|
|
|
- @ApiOperation("批量手动组卷")
|
|
|
- public AjaxResult batchBuildManual(@RequestBody TestPaperVO.TestPapersBuildManualReq req)
|
|
|
+ @PostMapping("/build/fullIntelligent")
|
|
|
+ @ApiOperation("全量智能")
|
|
|
+ public AjaxResult buildFullIntelligent(@RequestBody TestPaperVO.TestPapersAutoReq req)
|
|
|
{
|
|
|
- req.setBuildType(TestPaperVO.PaperBuildType.Manual);
|
|
|
- return AjaxResult.success(learnTeacherService.buildPapersManual(req));
|
|
|
- }
|
|
|
-
|
|
|
- @PreAuthorize("@ss.hasPermi('learn:test_paper:query')")
|
|
|
- @GetMapping("/publish")
|
|
|
- @ApiOperation("批量发布查询")
|
|
|
- public AjaxResult batchQuery(@RequestBody TestPaperVO.TestPapersQueryReq req)
|
|
|
- {
|
|
|
- return AjaxResult.success(true);
|
|
|
+ req.setBuildType("ExactIntelligent");
|
|
|
+ return AjaxResult.success(learnTeacherService.buildPapersAuto(req));
|
|
|
}
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('learn:test_paper:add')")
|
|
|
- @PostMapping("/publish/papers")
|
|
|
- @ApiOperation("批量发布生成")
|
|
|
- public AjaxResult publishBatch(@RequestBody TestPaperVO.TestPapersPublishReq req)
|
|
|
+ @PostMapping("/build/exactHand")
|
|
|
+ @ApiOperation("定向手动")
|
|
|
+ public AjaxResult buildExactHand(@RequestBody TestPaperVO.TestPapersHandReq req)
|
|
|
{
|
|
|
- return toAjax(true);
|
|
|
+ return AjaxResult.success(learnTeacherService.buildPapersManual(req));
|
|
|
}
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('learn:test_paper:add')")
|
|
|
- @PostMapping("/publish/paper")
|
|
|
- @ApiOperation("批量发布生成")
|
|
|
- public AjaxResult publishSingle(@RequestBody TestPaperVO.TestPaperPublishReq req)
|
|
|
+ @PostMapping("/build/fullHand")
|
|
|
+ @ApiOperation("全量手动")
|
|
|
+ public AjaxResult buildFullHand(@RequestBody TestPaperVO.TestPapersHandReq req)
|
|
|
{
|
|
|
- return toAjax(true);
|
|
|
+ return AjaxResult.success(learnTeacherService.buildPapersManual(req));
|
|
|
}
|
|
|
|
|
|
|