فهرست منبع

组卷条件对接调整

mingfu 2 هفته پیش
والد
کامیت
d01b638d10

+ 3 - 2
ie-admin/src/main/java/com/ruoyi/web/controller/front/FrontPaperController.java

@@ -71,14 +71,15 @@ public class FrontPaperController {
     @ApiOperation("03 知识点树")
     @GetMapping(value = "knowledge")
     public AjaxResult getKnowledge(@ApiParam("定向") @RequestParam(defaultValue = "false") boolean directed, @ApiParam("科目ID") Long subjectId) {
+        SysUser sysUser = SecurityUtils.getLoginUser().getUser();
         Set<Long> knowledgeIdSet = null;
         if(directed) {
             LearnStudent learnStudent = learnStudentService.selectLearnStudentByStudentId(SecurityUtils.getUserId());
             if(null != learnStudent) {
-                knowledgeIdSet = learnTeacherService.getKnowledgeIdSet(new Long[] { learnStudent.getMajorPlanId() });
+                knowledgeIdSet = learnTeacherService.getKnowledgeIdSet(learnStudent.getMajorPlanId());
             }
         }
-        List<LearnTeacherService.TreeNode> nodeList = learnTeacherService.getKnowledgeTree(subjectId, knowledgeIdSet, true);
+        List<LearnTeacherService.TreeNode> nodeList = learnTeacherService.getKnowledgeTree(sysUser.getExamType().title(), subjectId, knowledgeIdSet, sysUser.getUserId());
         if(CollectionUtils.isEmpty(knowledgeIdSet)) {
             return AjaxResult.success(nodeList);
         }

+ 101 - 82
ie-admin/src/main/java/com/ruoyi/web/controller/learn/LearnTeacherController.java

@@ -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));
     }
 
 

+ 1 - 1
ie-admin/src/main/java/com/ruoyi/web/service/LearnStatService.java

@@ -63,7 +63,7 @@ public class LearnStatService {
 
     public List<JSONObject> getRecordKnowledge(Long studentId) {
         LearnStudent learnStudent = learnStudentService.selectLearnStudentByStudentId(studentId);
-        Set<Long> knowledgeIdSet = null != learnStudent ? learnTeacherService.getKnowledgeIdSet(new Long[] { learnStudent.getMajorPlanId() }) : Sets.newHashSet();
+        Set<Long> knowledgeIdSet = null != learnStudent ? learnTeacherService.getKnowledgeIdSet(learnStudent.getMajorPlanId()) : Sets.newHashSet();
         knowledgeIdSet.add(0L);
         List<JSONObject> list = answerMapper.selectKnowledgeStats(Dict.create().set("studentId", studentId).set("knowIds", knowledgeIdSet));
         list.forEach(o -> {

+ 51 - 24
ie-admin/src/main/java/com/ruoyi/web/service/LearnTeacherService.java

@@ -1,10 +1,13 @@
 package com.ruoyi.web.service;
 
 import cn.hutool.core.lang.Dict;
+import com.alibaba.fastjson2.JSONObject;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.enums.ExamType;
+import com.ruoyi.common.utils.NumberUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.dz.domain.DzClasses;
 import com.ruoyi.dz.mapper.DzClassesMapper;
@@ -54,6 +57,19 @@ public class LearnTeacherService {
         this.learnQuestionsMapper = learnQuestionsMapper;
     }
 
+    public List<LearnQuestions> getQuestionTypes(Long subjectId, Collection<Long> knowledgeIds) {
+        return learnQuestionsMapper.statQuestionTypes(subjectId, knowledgeIds);
+    }
+
+    public List<JSONObject> getClassesBuildStats(String buildType, Long teacherId, Long batchId, ExamType examType, Long subjectId, Long planId) {
+        if("ExactIntelligent".equals(buildType)){
+            return dzClassesMapper.selectClassesDirectedBuildStats(buildType, teacherId, batchId, subjectId, null);
+        } else if("ExactHand".equals(buildType)){
+            return dzClassesMapper.selectClassesDirectedBuildStats(buildType, teacherId, batchId, subjectId, planId);
+        }
+        return dzClassesMapper.selectClassesBuildStats(buildType, teacherId, batchId, subjectId, examType.name());
+    }
+
     public List<DzClasses> getClasses(Long teacherId)
     {
         return dzClassesMapper.selectClassesForTeacher(teacherId);
@@ -68,12 +84,16 @@ public class LearnTeacherService {
     }
 
     public List<Dict> selectMajorList(Long universityId, Integer year, Long batchId) {
+        // TODO 由于未区分考生类型,好些会重复,暂取最小计划,使用这个去匹配相关的类型
         return marjorPlanMapper.selectMajorForUniversity(universityId, year, batchId).stream().map(t -> Dict.create().set("id", t.getId()).set("majorGroup", t.getMajorGroup())
                 .set("majorName", t.getMajorName()).set("count", t.getXuefei()).set("total", t.getPlanTotal())).collect(Collectors.toList());
     }
 
     @Transactional(rollbackFor = Exception.class)
-    public String buildPapersAuto(TestPaperVO.TestPapersBuildAutoReq req) {
+    public String buildPapersAuto(TestPaperVO.TestPapersAutoReq req) {
+        if(null != req) {
+            return "";
+        }
         // 查询 院校,专业组,专业计划范围, 明细一级时只有一个,否则就是批量
         List<LearnStudent> studentList = learnStudentMapper.selectLearnStudentsByMap(req.toMap());
         if(CollectionUtils.isEmpty(studentList)) {
@@ -181,7 +201,10 @@ public class LearnTeacherService {
     }
 
     @Transactional(rollbackFor = Exception.class)
-    public String buildPapersManual(TestPaperVO.TestPapersBuildManualReq req) {
+    public String buildPapersManual(TestPaperVO.TestPapersHandReq req) {
+        if(null != req) {
+            return "";
+        }
         if(null == req.getSubjectId()) {
             throw new ValidationException("未选择科目");
         }
@@ -270,14 +293,15 @@ public class LearnTeacherService {
         return "";
     }
 
-    public List<TreeNode> getKnowledgeTree(Long subjectId, Set<Long> knowledgeIdSet, boolean count) {
+    public List<TreeNode> getKnowledgeTree(String examineeType, Long subjectId, Set<Long> knowledgeIdSet, Long studentId) {
         LearnKnowledgeTree ktCond = new LearnKnowledgeTree();
         ktCond.setSubjectId(subjectId);
+        ktCond.setExamineeTypes(examineeType);
         List<LearnKnowledgeTree> ktList = learnKnowledgeTreeMapper.selectLearnKnowledgeTreeList(ktCond);
         Map<Long, Integer[]> knowCountMap = null;
-        if(count) {
+        if(NumberUtils.isPositive(studentId) && !CollectionUtils.isEmpty(ktList)) {
             Map cond = Maps.newHashMap();
-            cond.put("studentId", SecurityUtils.getUserId());
+            cond.put("studentId", studentId);
             cond.put("knowIds", ktList.stream().map(LearnKnowledgeTree::getId).collect(Collectors.toList()));
             cond.put("types", Lists.newArrayList("单选题", "判断题"));
             knowCountMap = Maps.newHashMap();
@@ -358,27 +382,30 @@ public class LearnTeacherService {
         return subjectIdSet;
     }
 
-    public Set<Long> getKnowledgeIdSet(Long[] planIds) {
-        Set<Long> knowledgeIdSet = Sets.newHashSet();
-        if(ArrayUtils.isNotEmpty(planIds) && null != planIds[0]) {
-            List<AMarjorPlan> planList = marjorPlanMapper.selectAMarjorPlanByIds(planIds);
-            if(CollectionUtils.isEmpty(planList)) {
-                return knowledgeIdSet;
-            }
-            AMarjorPlan curr = planList.get(0);
-            LearnDirectedKnowledge dkCond = new LearnDirectedKnowledge();
-            dkCond.setUniversityId(curr.getUniversityId());
-            dkCond.setYear(curr.getYear());
+    public Set<Long> getKnowledgeIdSet(Long planId) {
+        if(NumberUtils.isPositive(planId)) {
             SysUser sysUser = SecurityUtils.getLoginUser().getUser();
-            dkCond.setLocations(sysUser.getLocation());
-            dkCond.setExamineeTypes(sysUser.getExamType().name());
-            Map<String, LearnDirectedKnowledge> directedKnowledgeMap = learnDirectedKnowledgeMapper.selectLearnDirectedKnowledgeList(dkCond).stream().collect(Collectors.toMap(LearnDirectedKnowledge::getDirectKey, t -> t));
-            LearnDirectedKnowledge directedKnowledge = null;
-            for(AMarjorPlan plan : planList) {
-                if(null != (directedKnowledge = getBestLearnDirectedKnowledge(plan, directedKnowledgeMap))) {
-                    knowledgeIdSet.addAll(Stream.of(directedKnowledge.getKnowledges().split(",")).map(t -> Long.parseLong(t.trim())).collect(Collectors.toList()));
-                }
+            List<AMarjorPlan> planList = marjorPlanMapper.selectAMarjorPlanByIds(new Long[] { planId });
+            if(CollectionUtils.isEmpty(planList)) {
+                return Sets.newHashSet();
             }
+            return getStudentKnowledgeIdSet(planList.get(0), sysUser.getLocation(), sysUser.getExamType().name());
+        }
+        return Sets.newHashSet();
+    }
+
+    public Set<Long> getStudentKnowledgeIdSet(AMarjorPlan curr, String location, String examType) {
+        Set<Long> knowledgeIdSet = Sets.newHashSet();
+        LearnDirectedKnowledge dkCond = new LearnDirectedKnowledge();
+        dkCond.setUniversityId(curr.getUniversityId());
+        dkCond.setYear(curr.getYear());
+
+        dkCond.setLocations(location);
+        dkCond.setExamineeTypes(examType);
+        Map<String, LearnDirectedKnowledge> directedKnowledgeMap = learnDirectedKnowledgeMapper.selectLearnDirectedKnowledgeList(dkCond).stream().collect(Collectors.toMap(LearnDirectedKnowledge::getDirectKey, t -> t));
+        LearnDirectedKnowledge directedKnowledge = null;
+        if(null != (directedKnowledge = getBestLearnDirectedKnowledge(curr, directedKnowledgeMap))) {
+            knowledgeIdSet.addAll(Stream.of(directedKnowledge.getKnowledges().split(",")).map(t -> Long.parseLong(t.trim())).collect(Collectors.toList()));
         }
         return knowledgeIdSet;
     }

+ 5 - 0
ie-system/src/main/java/com/ruoyi/dz/mapper/DzClassesMapper.java

@@ -2,6 +2,8 @@ package com.ruoyi.dz.mapper;
 
 import java.util.Collection;
 import java.util.List;
+
+import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.dz.domain.DzClasses;
 import org.apache.ibatis.annotations.Param;
 
@@ -13,6 +15,9 @@ import org.apache.ibatis.annotations.Param;
  */
 public interface DzClassesMapper
 {
+    List<JSONObject> selectClassesDirectedBuildStats(@Param("buildType") String buildType, @Param("teacherId") Long teacherId, @Param("batchId") Long batchId, @Param("subjectId") Long subjectId, @Param("planId") Long planId);
+    List<JSONObject> selectClassesBuildStats(@Param("buildType") String buildType, @Param("teacherId") Long teacherId, @Param("batchId") Long batchId, @Param("subjectId") Long subjectId, @Param("examType") String examType);
+
     public List<DzClasses> selectClassesByIds(@Param("ids") Collection<Long> ids);
     public List<DzClasses> selectClassesForTeacher(@Param("teacherId") Long teacherId);
     public List<DzClasses> selectDzClassesListBySchoolId(@Param("schoolId") Long schoolId);

+ 6 - 62
ie-system/src/main/java/com/ruoyi/learn/domain/TestPaperVO.java

@@ -11,10 +11,6 @@ import java.util.List;
 import java.util.Map;
 
 public class TestPaperVO {
-    public static enum PaperBuildType {
-        Manual, Auto
-    }
-
     @ApiModel("基本组卷请求")
     @Data
     public static class TestPapersBuildReq {
@@ -28,7 +24,7 @@ public class TestPaperVO {
         @ApiModelProperty("省份")
         String location;
         @ApiModelProperty("组卷方式")
-        PaperBuildType buildType;
+        String buildType;
         @ApiModelProperty("是否定向")
         Boolean directType;
 
@@ -59,72 +55,20 @@ public class TestPaperVO {
         }
     }
 
-    @ApiModel("手动组卷请求")
+    @ApiModel("手动")
     @Data
-    public static class TestPapersBuildManualReq extends TestPapersBuildReq {
+    public static class TestPapersHandReq extends TestPapersBuildReq {
         @ApiModelProperty("试题列表")
         List<LearnPaperQuestion> questions;
     }
-    @ApiModel("智能组卷请求")
+
+    @ApiModel("智能")
     @Data
-    public static class TestPapersBuildAutoReq extends TestPapersBuildReq {
+    public static class TestPapersAutoReq extends TestPapersBuildReq {
         @ApiModelProperty("试卷要求")
         PaperDef paperDef;
     }
 
-    @ApiModel("批量查询请求")
-    @Data
-    public static class TestPapersQueryReq {
-        @ApiModelProperty("测试卷批次")
-        Long batchId;
-        @ApiModelProperty("考生类型")
-        List<String> examTypes;
-        @ApiModelProperty("组卷类型")
-        PaperBuildType buildType;
-        @ApiModelProperty("发送情况")
-        Boolean publicType;
-
-        @ApiModelProperty("班级")
-        List<Long> classIds;
-        @ApiModelProperty("学生")
-        List<Long> studentIds;
-    }
-
-    @ApiModel("批量发布请求")
-    @Data
-    public static class TestPapersPublishReq {
-        @ApiModelProperty("测试卷批次")
-        Long batchId;
-        @ApiModelProperty("考生类型")
-        List<String> examTypes;
-        @ApiModelProperty("组卷类型")
-        PaperBuildType buildType;
-        @ApiModelProperty("定向类型 null是全部")
-        Boolean directType;
-        @ApiModelProperty("试卷ID")
-        Long paperId;
-
-        @ApiModelProperty("班级")
-        List<Long> classIds;
-        @ApiModelProperty("学生")
-        List<Long> studentIds;
-    }
-
-
-    @ApiModel("试卷发布请求")
-    @Data
-    public static class TestPaperPublishReq {
-        @ApiModelProperty("测试卷批次")
-        Long batchId;
-        @ApiModelProperty("试卷ID")
-        Long paperId;
-        @ApiModelProperty("班级")
-        List<Long> classIds;
-        @ApiModelProperty("学生")
-        List<Long> studentIds;
-    }
-
-
     @Data
     public static class PaperDef {
         Long total;

+ 4 - 0
ie-system/src/main/java/com/ruoyi/learn/mapper/LearnQuestionsMapper.java

@@ -1,9 +1,11 @@
 package com.ruoyi.learn.mapper;
 
+import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
 import com.ruoyi.learn.domain.LearnQuestions;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 试题Mapper接口
@@ -13,6 +15,8 @@ import com.ruoyi.learn.domain.LearnQuestions;
  */
 public interface LearnQuestionsMapper
 {
+    public List<LearnQuestions> statQuestionTypes(@Param("subjectId") Long subjectId, @Param("knowledgeIds") Collection<Long> knowledgeIds);
+
     /**
      * 查询试题
      *

+ 27 - 0
ie-system/src/main/resources/mapper/dz/DzClassesMapper.xml

@@ -29,6 +29,33 @@
         <result property="area"    column="area"    />
     </resultMap>
 
+    <select id="selectClassesDirectedBuildStats" resultType="com.alibaba.fastjson2.JSONObject">
+        SELECT c.`class_id` classId, c.`name` className, count(*) `total`, SUM(if(ls.`major_plan_id` IS NULL, 1, 0)) unexact,
+               SUM(IF(ls.`major_plan_id` IS not NULL and ts.`student_id` IS NULL, 1, 0)) unsend,
+               SUM(IF(ls.`major_plan_id` IS not NULL and ts.`student_id` IS NOT NULL and ts.`status` != 4 , 1, 0)) unfinish,
+               sum(if(ls.`major_plan_id` IS NOT NULL and ts.`student_id` is not null AND ts.`status` = 4 , 1, 0)) send
+        FROM `dz_teacher_class` tc
+        join `learn_student` ls on tc.`class_id` = ls.`class_id` <if test="planId != null"> and ls.`major_plan_id` = #{planId}</if>
+        join `dz_classes` c on ls.`class_id` = c.`class_id`
+        LEFT JOIN `learn_test_student` ts ON ts.`student_id` = ls.`student_id` and ts.`batch_id` =  #{batchId} AND ts.`build_type` = #{buildType} and ts.`subject_id` = #{subjectId}
+        where tc.`teacher_id` = #{teacherId}
+        group by c.`class_id`, c.`name`
+    </select>
+
+    <select id="selectClassesBuildStats" resultType="com.alibaba.fastjson2.JSONObject">
+        SELECT c.`class_id` classId, c.`name` className, count(*) `total`,
+               SUM(IF(ts.`student_id` IS NULL, 1, 0)) unsend,
+               SUM(IF(ts.`student_id` IS NOT NULL and ts.`status` != 4 , 1, 0)) unfinish,
+               sum(if(ts.`student_id` is not null AND ts.`status` = 4 , 1, 0)) send
+         FROM `dz_teacher_class` tc
+         join `learn_student` ls on tc.`class_id` = ls.`class_id`
+         JOIN sys_user u ON ls.`student_id` = u.`user_id` AND u.`exam_type` = #{examType}
+         join `dz_classes` c on ls.`class_id` = c.`class_id`
+         LEFT JOIN `learn_test_student` ts ON ts.`student_id` = ls.`student_id` and ts.`batch_id` =  #{batchId} AND ts.`build_type` = #{buildType} and ts.`subject_id` = #{subjectId}
+        where tc.`teacher_id` = #{teacherId}
+        group by c.`class_id`, c.`name`
+    </select>
+
     <sql id="selectDzClassesVo">
         select t1.class_id, t1.dept_id, t1.school_id, t1.year, t1.name, t1.online, t1.status, t1.stats, t1.create_time, t1.update_time,t1.is_default,
         t2.id, t2.name school_name, t2.dept_id, t2.pro, t2.city, t2.area

+ 7 - 7
ie-system/src/main/resources/mapper/ie/AMarjorPlanMapper.xml

@@ -39,13 +39,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     <select id="selectMajorForUniversity" parameterType="Map" resultMap="AMarjorPlanResult">
-        SELECT mp.id, mp.`majorGroup`, mp.`majorName`, COUNT(DISTINCT sl.`student_id`) planTotal, COUNT(DISTINCT ts.`id`) xuefei
-        FROM `learn_student` sl
-         LEFT JOIN `learn_test_student` ts ON ts.`batch_id` = #{batchId} and ts.`student_id` = sl.`student_id`
-         JOIN `a_marjor_plan` mp ON sl.`major_plan_id` = mp.`id`
-        WHERE sl.`university_id` = #{universityId} and mp.year = #{year}
-        GROUP BY mp.id, mp.`majorGroup`, mp.`majorName`
-        ORDER BY mp.`majorGroup`, mp.`majorName`
+        SELECT MIN(mp.id) id, mp.`majorGroup`, mp.`majorName`, COUNT(DISTINCT sl.`student_id`) planTotal, COUNT(DISTINCT ts.`id`) xuefei
+          FROM `learn_student` sl
+          LEFT JOIN `learn_test_student` ts ON ts.`batch_id` = #{batchId} and ts.`student_id` = sl.`student_id`
+          JOIN `a_marjor_plan` mp ON sl.`major_plan_id` = mp.`id`
+         WHERE sl.`university_id` = #{universityId} and mp.year = #{year}
+         GROUP BY mp.`majorGroup`, mp.`majorName`
+         ORDER BY mp.`majorGroup`, mp.`majorName`
     </select>
 
     <select id="selectListByRuleCond" parameterType="Map" resultMap="AMarjorPlanResult">

+ 9 - 0
ie-system/src/main/resources/mapper/learn/LearnQuestionsMapper.xml

@@ -343,4 +343,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </select>
 
+    <select id="statQuestionTypes" resultMap="LearnQuestionsResult">
+        SELECT q.`qtpye`, COUNT(*) number FROM `learn_questions` q
+         WHERE q.`subjectId` = #{subjectId}
+           <if test="null != knowledgeIds"> AND q.`knowledgeId` IN <foreach item="id" collection="knowledgeIds" open="(" separator="," close=")">#{id}</foreach></if>
+         GROUP BY q.`qtpye`
+    </select>
+
+
+
 </mapper>

+ 4 - 4
ie-system/src/main/resources/mapper/syzy/BBusiWishUniversitiesMapper.xml

@@ -73,10 +73,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
   <select id="selectUniversityListForTeacher" resultMap="BBusiWishUniversitiesResult">
     SELECT u.`id`, u.`name`, COUNT(*) collect, SUM(IF(ts.`id` IS NULL, 0, 1)) hits
-    FROM `dz_teacher_class` tc
-           JOIN `learn_student` sl ON tc.`class_id` = sl.`class_id`
-           LEFT JOIN `learn_test_student` ts ON ts.`batch_id` = #{batchId} AND ts.`student_id` = sl.`student_id`
-           JOIN `b_busi_wish_universities` u ON sl.`university_id` = u.`id`
+      FROM `dz_teacher_class` tc
+      JOIN `learn_student` sl ON tc.`class_id` = sl.`class_id`
+      LEFT JOIN `learn_test_student` ts ON ts.`batch_id` = #{batchId} AND ts.`build_type` = 'FullHand' AND ts.`student_id` = sl.`student_id`
+      JOIN `b_busi_wish_universities` u ON sl.`university_id` = u.`id`
     WHERE tc.`teacher_id` = #{teacherId} AND NOW() &lt; tc.`out_date`
     GROUP BY sl.`university_id`, u.`name`
   </select>