فهرست منبع

组卷记录增加老师隔离

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

+ 1 - 0
ie-admin/src/main/java/com/ruoyi/web/controller/learn/LearnTeacherController.java

@@ -120,6 +120,7 @@ public class LearnTeacherController extends BaseController {
     @GetMapping("build/getBuiltPaper")
     @ApiOperation("获取已组卷详情")
     public AjaxResult getBuiltPaper(TestPaperVO.TestPaperBuildReq req) {
+        req.setTeacherId(getTeacherId());
         List<LearnTestPaper> testPaperList = learnTeacherService.getBuiltTestPaper(req);
         if (CollectionUtils.isEmpty(testPaperList)) {
             return AjaxResult.success(Collections.emptyList());

+ 4 - 2
ie-admin/src/main/java/com/ruoyi/web/service/LearnTeacherService.java

@@ -187,7 +187,7 @@ public class LearnTeacherService {
         Map<Long, Map<String, List<LearnStudent>>> universityDirectStudentMap = studentList.stream()
                 .collect(Collectors.groupingBy(LearnStudent::getUniversityId, Collectors.groupingBy(this::buildDirectKey, Collectors.toList())));
         // 查询已经生成的
-        Map<Long, Map<String, LearnTestPaper>> universityDirectPaperMap = learnTestPaperMapper.selectByBatchAndUniversityIds(req.getBuildType(), req.getBatchId(), req.getSubjectId(), universityDirectStudentMap.keySet()).stream()
+        Map<Long, Map<String, LearnTestPaper>> universityDirectPaperMap = learnTestPaperMapper.selectByBatchAndUniversityIds(req.getBuildType(), req.getBatchId(), req.getSubjectId(), req.getTeacherId(), universityDirectStudentMap.keySet()).stream()
                 .collect(Collectors.groupingBy(LearnTestPaper::getUniversityId, Collectors.toMap(t -> StringUtils.trimToEmpty(t.getDirectKey()), a -> a)));
         // 补充发卷
         if("ExactHand".equals(req.getBuildType())) { // 肯定只有一个计划
@@ -282,6 +282,7 @@ public class LearnTeacherService {
                     testPaper.setPaperId(paper.getId());
                     testPaper.setConditions(JSONObject.toJSONString(req));
                     testPaper.setCreatorId(SecurityUtils.getUserId());
+                    testPaper.setTeacherId(req.getTeacherId());
                     learnTestPaperMapper.insertLearnTestPaper(testPaper);
                     directPaperMap.put(directedKey, testPaper);
                     learnTestPaper = testPaper;
@@ -319,7 +320,7 @@ public class LearnTeacherService {
         DzSubject dzSubject = dzSubjectService.selectDzSubjectBySubjectId(req.getSubjectId());
         LearnTest learnTest = learnTestService.selectLearnTestByBatchId(req.getBatchId());
         // 查询已经生成的
-        List<LearnTestPaper> learnTestPaperList = learnTestPaperMapper.selectByBatchAndUniversityIds(req.getBuildType(), req.getBatchId(), req.getSubjectId(),null);
+        List<LearnTestPaper> learnTestPaperList = learnTestPaperMapper.selectByBatchAndUniversityIds(req.getBuildType(), req.getBatchId(), req.getSubjectId(),req.getTeacherId(), null);
         LearnTestPaper learnTestPaper;
         if(CollectionUtils.isEmpty(learnTestPaperList)) {
             LearnPaper paper = new LearnPaper();
@@ -347,6 +348,7 @@ public class LearnTeacherService {
             testPaper.setPaperId(paper.getId());
             testPaper.setConditions(JSONObject.toJSONString(req));
             testPaper.setCreatorId(SecurityUtils.getUserId());
+            testPaper.setTeacherId(req.getTeacherId());
             learnTestPaperMapper.insertLearnTestPaper(testPaper);
             learnTestPaper = testPaper;
         } else {

+ 12 - 0
ie-system/src/main/java/com/ruoyi/learn/domain/LearnTestPaper.java

@@ -34,6 +34,10 @@ public class LearnTestPaper extends BaseEntity
     @Excel(name = "考生类型")
     private String examType;
 
+    /** 老师id */
+    @Excel(name = "老师id")
+    private Long teacherId;
+
     /** 院校id */
     @Excel(name = "院校id")
     private Long universityId;
@@ -144,6 +148,14 @@ public class LearnTestPaper extends BaseEntity
         return creatorId;
     }
 
+    public Long getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Long teacherId) {
+        this.teacherId = teacherId;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 1 - 1
ie-system/src/main/java/com/ruoyi/learn/mapper/LearnTestPaperMapper.java

@@ -13,7 +13,7 @@ import org.apache.ibatis.annotations.Param;
  */
 public interface LearnTestPaperMapper 
 {
-    public List<LearnTestPaper> selectByBatchAndUniversityIds(@Param("buildType") String buildType, @Param("batchId") Integer batchId, @Param("subjectId") Long subjectId, @Param("universityIds") Collection<Long> universityIds);
+    public List<LearnTestPaper> selectByBatchAndUniversityIds(@Param("buildType") String buildType, @Param("batchId") Integer batchId, @Param("subjectId") Long subjectId, @Param("teacherId") Long teacherId, @Param("universityIds") Collection<Long> universityIds);
 
     /**
      * 查询批次测试卷

+ 5 - 6
ie-system/src/main/resources/mapper/dz/DzClassesMapper.xml

@@ -79,18 +79,17 @@
     </select>
 
     <select id="getPaperStudentRecords" resultType="com.alibaba.fastjson2.JSONObject">
-        SELECT ts.examinee_id examineeId, ls.`student_id` studentId, u.`nick_name` studentName, dc.`name` className, 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,
+      SELECT ts.examinee_id examineeId, ls.`student_id` studentId, u.`nick_name` studentName, dc.`name` className, 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_classes` dc on dc.`class_id` = ls.`class_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>
+        JOIN `dz_classes` dc ON dc.`class_id` = ls.`class_id`
+        JOIN `learn_test` lt ON lt.`year` = #{year} <if test="batchId != null"> and lt.`batch_id` =  #{batchId} </if>
+        LEFT JOIN `learn_test_student` ts ON ts.`student_id` = ls.`student_id` and ts.`batch_id` = lt.`batch_id`
         <if test="buildType != null"> AND ts.`build_type` = #{buildType} </if>
         <if test="subjectId != null"> and ts.`subject_id` = #{subjectId} </if>
+        LEFT JOIN `dz_subject` ds ON ds.`subject_id` = ts.`subject_id`
         LEFT JOIN `learn_examinee` le ON le.examinee_id = ts.examinee_id
         LEFT JOIN `learn_paper` lp ON ts.`paper_id` = lp.`id`
         <where> ls.`class_id` = #{classId}

+ 7 - 1
ie-system/src/main/resources/mapper/learn/LearnTestPaperMapper.xml

@@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="buildType"    column="build_type"    />
         <result property="subjectId"    column="subject_id"    />
         <result property="examType"    column="exam_type"    />
+        <result property="teacherId"    column="teacher_id"    />
         <result property="universityId"    column="university_id"    />
         <result property="directKey"    column="direct_key"    />
         <result property="paperId"    column="paper_id"    />
@@ -19,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectLearnTestPaperVo">
-        select id, batch_id, build_type, subject_id, exam_type, university_id, direct_key, paper_id, conditions, creator_id, create_time from learn_test_paper
+        select id, batch_id, build_type, subject_id, exam_type, teacher_id, university_id, direct_key, paper_id, conditions, creator_id, create_time from learn_test_paper
     </sql>
 
     <select id="selectLearnTestPaperList" parameterType="LearnTestPaper" resultMap="LearnTestPaperResult">
@@ -29,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="buildType != null "> and build_type = #{buildType}</if>
             <if test="subjectId != null "> and subject_id = #{subjectId}</if>
             <if test="examType != null "> and exam_type = #{examType}</if>
+            <if test="teacherId != null "> and teacher_id = #{teacherId}</if>
             <if test="universityId != null "> and university_id = #{universityId}</if>
             <if test="directKey != null  and directKey != ''"> and direct_key = #{directKey}</if>
             <if test="paperId != null "> and paper_id = #{paperId}</if>
@@ -40,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectByBatchAndUniversityIds" resultMap="LearnTestPaperResult">
         <include refid="selectLearnTestPaperVo"/>
         <where> batch_id = #{batchId} and build_type = #{buildType} and subject_id = #{subjectId}
+         <if test="null != teacherId">and teacher_id = #{teacherId}</if>
          <if test="null != universityIds">and university_id in <foreach item="id" collection="universityIds" open="(" separator="," close=")">#{id}</foreach></if>
         </where>
     </select>
@@ -56,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="buildType != null">build_type,</if>
             <if test="subjectId != null">subject_id,</if>
             <if test="examType != null">exam_type,</if>
+            <if test="teacherId != null">teacher_id,</if>
             <if test="universityId != null">university_id,</if>
             <if test="directKey != null ">direct_key,</if>
             <if test="paperId != null">paper_id,</if>
@@ -68,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="buildType != null">#{buildType},</if>
             <if test="subjectId != null">#{subjectId},</if>
             <if test="examType != null">#{examType},</if>
+            <if test="teacherId != null">#{teacherId},</if>
             <if test="universityId != null">#{universityId},</if>
             <if test="directKey != null">#{directKey},</if>
             <if test="paperId != null">#{paperId},</if>
@@ -84,6 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="buildType != null">build_type = #{buildType},</if>
             <if test="subjectId != null">subject_id = #{subjectId},</if>
             <if test="examType != null">exam_type = #{examType},</if>
+            <if test="teacherId != null">teacher_id = #{teacherId},</if>
             <if test="universityId != null">university_id = #{universityId},</if>
             <if test="directKey != null">direct_key = #{directKey},</if>
             <if test="paperId != null">paper_id = #{paperId},</if>