Sfoglia il codice sorgente

组卷记录基本完成

mingfu 1 giorno fa
parent
commit
9fdaeba137

+ 39 - 8
ie-admin/src/main/java/com/ruoyi/web/controller/learn/LearnTeacherController.java

@@ -8,6 +8,7 @@ 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;
@@ -118,15 +119,45 @@ public class LearnTeacherController extends BaseController {
         if (CollectionUtils.isEmpty(testPaperList)) {
             return AjaxResult.success(new JSONObject());
         }
-        LearnTestPaper learnTestPaper = testPaperList.get(0);
-        if(null == learnTestPaper || null == learnTestPaper.getPaperId()){
-            return AjaxResult.success(new JSONObject());
+        List<JSONObject> resultList = new ArrayList<>();
+        for(LearnTestPaper learnTestPaper : testPaperList) {
+            PaperVO paperVO = paperService.loadPaper(learnTestPaper.getPaperId());
+            JSONObject root = JSONObject.from(paperVO);
+            root.remove("id");
+            root.put("paperId", learnTestPaper.getPaperId());
+            resultList.add(root);
         }
-        PaperVO paperVO = paperService.loadPaper(learnTestPaper.getPaperId());
-        JSONObject root = JSONObject.from(paperVO);
-        root.remove("id");
-        root.put("paperId", learnTestPaper.getPaperId());
-        return AjaxResult.success(root);
+
+        return AjaxResult.success(resultList);
+    }
+
+    @GetMapping("/getPaperClassRecords")
+    @ApiOperation("组卷记录")
+    public TableDataInfo getPaperClassRecords(TestPaperVO.TestPaperBuildReq req)
+    {
+        startPage();
+        return getDataTable(learnTeacherService.getPaperClassRecords(req, SecurityUtils.getUserId()));
+    }
+
+    @GetMapping("/getPaperStudentRecords")
+    @ApiOperation("班级详情")
+    public AjaxResult getPaperStudentRecords(TestPaperVO.TestPaperBuildReq req)
+    {
+        return AjaxResult.success(learnTeacherService.getPaperStudentRecords(req));
+    }
+
+    @GetMapping("/getPaperStudentDetail")
+    @ApiOperation("学生详情")
+    public AjaxResult getPaperStudentDetail(@ApiParam("学生ID") Long studentId)
+    {
+        return AjaxResult.success(learnTeacherService.getPaperStudentDetail(studentId));
+    }
+
+    @PostMapping("/postUnfinishAlarm")
+    @ApiOperation("学生提醒")
+    public AjaxResult postUnfinishAlarm(@ApiParam("组卷类型") String buildType, @ApiParam("批次") Long batchId, @ApiParam("班级") Long classId)
+    {
+        return AjaxResult.success();
     }
 
 

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

@@ -9,6 +9,7 @@ import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.enums.ExamType;
 import com.ruoyi.common.enums.SubjectType;
+import com.ruoyi.common.utils.CommonUtils;
 import com.ruoyi.common.utils.NumberUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.dz.domain.DzClasses;
@@ -54,8 +55,9 @@ public class LearnTeacherService {
     private final LearnTestStudentMapper learnTestStudentMapper;
     private final IDzSubjectService dzSubjectService;
     private final ILearnTestService learnTestService;
+    private final LearnAnswerMapper learnAnswerMapper;
 
-    public LearnTeacherService(DzClassesMapper dzClassesMapper, LearnKnowledgeTreeMapper learnKnowledgeTreeMapper, LearnStudentMapper learnStudentMapper, AMarjorPlanMapper marjorPlanMapper, BBusiWishUniversitiesMapper busiWishUniversitiesMapper, LearnDirectedKnowledgeMapper learnDirectedKnowledgeMapper, PaperService paperService, CommService commService, LearnTestPaperMapper learnTestPaperMapper, LearnQuestionsMapper learnQuestionsMapper, LearnKnowledgeCourseMapper learnKnowledgeCourseMapper, LearnTestStudentMapper learnTestStudentMapper, IDzSubjectService dzSubjectService, ILearnTestService learnTestService) {
+    public LearnTeacherService(DzClassesMapper dzClassesMapper, LearnKnowledgeTreeMapper learnKnowledgeTreeMapper, LearnStudentMapper learnStudentMapper, AMarjorPlanMapper marjorPlanMapper, BBusiWishUniversitiesMapper busiWishUniversitiesMapper, LearnDirectedKnowledgeMapper learnDirectedKnowledgeMapper, PaperService paperService, CommService commService, LearnTestPaperMapper learnTestPaperMapper, LearnQuestionsMapper learnQuestionsMapper, LearnKnowledgeCourseMapper learnKnowledgeCourseMapper, LearnTestStudentMapper learnTestStudentMapper, IDzSubjectService dzSubjectService, ILearnTestService learnTestService, LearnAnswerMapper learnAnswerMapper) {
         this.dzClassesMapper = dzClassesMapper;
         this.learnKnowledgeTreeMapper = learnKnowledgeTreeMapper;
         this.learnStudentMapper = learnStudentMapper;
@@ -70,6 +72,7 @@ public class LearnTeacherService {
         this.learnTestStudentMapper = learnTestStudentMapper;
         this.dzSubjectService = dzSubjectService;
         this.learnTestService = learnTestService;
+        this.learnAnswerMapper = learnAnswerMapper;
     }
 
     public List<LearnQuestions> getQuestionTypes(Long subjectId, Collection<Long> knowledgeIds) {
@@ -90,6 +93,33 @@ public class LearnTeacherService {
         return dzClassesMapper.selectClassesBuildStats(req.toMap());
     }
 
+    public List<JSONObject> getPaperClassRecords(TestPaperVO.TestPaperBuildReq req, Long teacherId) {
+        req.setTeacherId(teacherId);
+        String buildType = req.getBuildType();
+        if(buildType.startsWith("Exact")) {
+            req.setSubjectId(11L);
+        }
+        if("ExactIntelligent".equals(buildType)){
+            return dzClassesMapper.selectClassesDirectedBuildStats(req.toMap());
+        } else if("ExactHand".equals(buildType)){
+            return dzClassesMapper.selectClassesDirectedBuildStats(req.toMap());
+        }
+        return dzClassesMapper.selectClassesBuildStats(req.toMap());
+    }
+
+    public List<JSONObject> getPaperStudentRecords(TestPaperVO.TestPaperBuildReq req) {
+        return dzClassesMapper.getPaperStudentRecords(req.toMap());
+    }
+
+    public List<JSONObject> getPaperStudentDetail(Long studentId) {
+        List<JSONObject> list = learnAnswerMapper.selectKnowledgeStats(Dict.create().set("studentId", studentId).set("knowIds", Sets.newHashSet()));
+        list.forEach(o -> {
+            CommonUtils.normalRate(o);
+            o.put("directed", "1".equals(o.get("directed")));
+        });
+        return list;
+    }
+
     public List<DzClasses> getClasses(Long teacherId)
     {
         return dzClassesMapper.selectClassesForTeacher(teacherId);

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

@@ -280,6 +280,7 @@ public class PaperService {
             QuestionType qt = QuestionType.of(lqs.getQtpye());
             qs.setTypeId(qt.getVal());
             qs.setType(qt.getTitle());
+            qs.setQtpye(qt.getTitle()); // TODO 兼容
             if (!chooseTypes.contains(qt)) {
                 qs.setOptions(Lists.newArrayList("会", "不会"));
             } else {

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

@@ -18,6 +18,7 @@ public interface DzClassesMapper
 {
     List<JSONObject> selectClassesDirectedBuildStats(Map cond);
     List<JSONObject> selectClassesBuildStats(Map cond);
+    List<JSONObject> getPaperStudentRecords(Map cond);
 
     public List<DzClasses> selectClassesByIds(@Param("ids") Collection<Long> ids);
     public List<DzClasses> selectClassesForTeacher(@Param("teacherId") Long teacherId);

+ 36 - 0
ie-system/src/main/java/com/ruoyi/enums/PaperBuildStatus.java

@@ -0,0 +1,36 @@
+package com.ruoyi.enums;
+
+import com.google.common.collect.Maps;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.Arrays;
+import java.util.Map;
+
+@AllArgsConstructor
+@Getter
+public enum PaperBuildStatus {
+    Init(10, "未定向"), Build(20, "未组卷"), Exam(30, "未完成"), Finish(40, "已完成");
+
+    private final Integer val;
+    private final String title;
+
+    private static final Map<String, PaperBuildStatus> valMap = Maps.newHashMap();
+
+    public static PaperBuildStatus of(Integer vol) {
+        return valMap.get(vol.toString());
+    }
+
+    public static PaperBuildStatus of(String vol) {
+        PaperBuildStatus type = valMap.get(vol);
+        return null == type ? PaperBuildStatus.Init : type;
+    }
+
+    static {
+        Arrays.stream(PaperBuildStatus.values()).forEach(t -> {
+            valMap.put(t.val.toString(), t);
+            valMap.put(t.title, t);
+            valMap.put(t.name(), t);
+        });
+    }
+}

+ 4 - 0
ie-system/src/main/java/com/ruoyi/learn/domain/PaperVO.java

@@ -40,6 +40,10 @@ public class PaperVO {
         Integer typeId;
         @ApiModelProperty("考题类型名称")
         String type;
+        @ApiModelProperty("考题类型名称")
+        String qtpye;
+        @ApiModelProperty("分数")
+        Integer score;
         @ApiModelProperty("选项数组")
         List<String> options;
 

+ 4 - 1
ie-system/src/main/java/com/ruoyi/learn/domain/TestPaperVO.java

@@ -33,8 +33,10 @@ public class TestPaperVO {
         String buildType;
         @ApiModelProperty("批次")
         Integer batchId;
-        @ApiModelProperty("班级")
+        @ApiModelProperty("班级")
         List<Long> classIds;
+        @ApiModelProperty("班级")
+        Long classId;
 
         // 全量智能+全量手动
         @ApiModelProperty("考生类型")
@@ -98,6 +100,7 @@ public class TestPaperVO {
             map.put("majorGroup", majorGroup);
             map.put("majorPlanId", majorPlanId);
             map.put("teacherId", teacherId);
+            map.put("classId", classId);
             return map;
         }
     }

+ 34 - 4
ie-system/src/main/resources/mapper/dz/DzClassesMapper.xml

@@ -38,13 +38,17 @@
         join `learn_student` ls on tc.`class_id` = ls.`class_id`
         join `dz_classes` c on ls.`class_id` = c.`class_id`
         JOIN `sys_user` u ON ls.`student_id` = u.`user_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}
+        LEFT JOIN `learn_test_student` ts ON ts.`student_id` = ls.`student_id`
+            <if test="batchId != null"> and ts.`batch_id` =  #{batchId} </if>
+            <if test="buildType != null"> AND ts.`build_type` = #{buildType} </if>
+            <if test="subjectId != null"> and ts.`subject_id` = #{subjectId} </if>
         <where>tc.`teacher_id` = #{teacherId}
+            <if test="classId != null"> AND ls.`class_id` = #{classId}</if>
             <if test="buildType != null and buildType = 'ExactIntelligent'"> AND ls.`university_id` is not null</if>
             <if test="universityId != null"> AND ls.`university_id` = #{universityId}</if>
             <if test="majorGroup != null"> AND ls.`major_group` = #{majorGroup}</if>
             <if test="majorPlanId != null"> AND ls.`major_plan_id` = #{majorPlanId}</if>
-            <if test="examType != null  and examType != ''"> AND u.`exam_type` = #{examType}</if>
+            <if test="examType != null and examType != ''"> AND u.`exam_type` = #{examType}</if>
         </where>
         group by c.`class_id`, c.`name`
     </select>
@@ -56,9 +60,12 @@
                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 sys_user u ON ls.`student_id` = u.`user_id`
          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}
+         LEFT JOIN `learn_test_student` ts ON ts.`student_id` = ls.`student_id`
+            <if test="batchId != null"> and ts.`batch_id` =  #{batchId} </if>
+            <if test="buildType != null"> AND ts.`build_type` = #{buildType} </if>
+            <if test="subjectId != null"> and ts.`subject_id` = #{subjectId} </if>
         <where>tc.`teacher_id` = #{teacherId}
             <if test="universityId != null"> AND ls.`university_id` = #{universityId}</if>
             <if test="majorGroup != null"> AND ls.`major_group` = #{majorGroup}</if>
@@ -68,6 +75,29 @@
         group by c.`class_id`, c.`name`
     </select>
 
+    <select id="getPaperStudentRecords" resultType="com.alibaba.fastjson2.JSONObject">
+        SELECT ls.`student_id` studentId, u.`nick_name` studentName, u.`phonenumber` mobile, ts.`batch_id` batchId, ts.`subject_id` subjectId, ts.`paper_id` paperId, lp.`paperName`, lp.`fenshu` total, le.`score`, le.`score_rate` rate,
+              lt.`name` batchName, ds.`subject_name` subjectName,
+              CASE WHEN ls.`major_plan_id` IS NULL AND #{buildType} IN ('ExactHand', 'ExactIntelligent') THEN '10' WHEN ts.`student_id` IS NULL THEN '20' WHEN ts.`status` != 4 THEN '30' ELSE '40' END state
+        FROM `learn_student` ls
+        JOIN `sys_user` u ON ls.`student_id` = u.`user_id`
+        JOIN `learn_test_student` ts ON ts.`student_id` = ls.`student_id`
+        JOIN `dz_subject` ds on ds.`subject_id` = ts.`subject_id`
+        join `learn_test` lt on lt.`batch_id` = ts.`batch_id`
+        <if test="batchId != null"> and ts.`batch_id` =  #{batchId} </if>
+        <if test="buildType != null"> AND ts.`build_type` = #{buildType} </if>
+        <if test="subjectId != null"> and ts.`subject_id` = #{subjectId} </if>
+        LEFT JOIN `learn_examinee` le ON le.`paper_id` = ts.`paper_id` AND le.`student_id` = ts.`student_id`
+        LEFT JOIN `learn_paper` lp ON ts.`paper_id` = lp.`id`
+        <where> ls.`class_id` = #{classId}
+            <if test="universityId != null"> AND ls.`university_id` = #{universityId}</if>
+            <if test="majorGroup != null"> AND ls.`major_group` = #{majorGroup}</if>
+            <if test="majorPlanId != null"> AND ls.`major_plan_id` = #{majorPlanId}</if>
+            <if test="examType != null  and examType != ''"> AND u.`exam_type` = #{examType}</if>
+        </where>
+    </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