Przeglądaj źródła

fix:学生报告查询(mark)优化

caozixuan 3 lat temu
rodzic
commit
e40b038dab

+ 12 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/mapper/TAExamCourseRecordDioMapper.java

@@ -7,6 +7,8 @@ import com.qmth.teachcloud.report.business.entity.TAExamCourseRecordDio;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * <p>
@@ -21,4 +23,14 @@ public interface TAExamCourseRecordDioMapper extends BaseMapper<TAExamCourseReco
     List<ModuleDetailResult> listDiosBySchoolIdAndExamIdAndCourseCodeAndModuleName(@Param("schoolId") Long schoolId, @Param("examId") String examId, @Param("courseCode") String courseCode, @Param("moduleName") String moduleName, @Param("studentCode") String studentCode);
 
     List<DimensionDetailResult> listSubDiosBySchoolIdAndExamIdAndStudentCodeAndCourseCodeAndModuleName(@Param("schoolId") Long schoolId, @Param("examId") String examId, @Param("studentCode") String studentCode, @Param("courseCode") String courseCode, @Param("moduleName") String moduleName);
+
+    /**
+     * 查询每个人的每个考察点情况
+     *
+     * @param schoolId   学校id
+     * @param examId     考试id
+     * @param courseCode 课程编号
+     * @return 结果
+     */
+    Set<String> findDimensionTypesByCourseCode(@Param("schoolId") Long schoolId, @Param("examId") Long examId, @Param("courseCode") String courseCode);
 }

+ 12 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/TAExamCourseRecordDioService.java

@@ -3,6 +3,10 @@ package com.qmth.teachcloud.report.business.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.teachcloud.report.business.entity.TAExamCourseRecordDio;
 
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * <p>
  * 参考课程考生各考查点维度分析表 服务类
@@ -13,4 +17,12 @@ import com.qmth.teachcloud.report.business.entity.TAExamCourseRecordDio;
  */
 public interface TAExamCourseRecordDioService extends IService<TAExamCourseRecordDio> {
 
+    /**
+     * 优化查询每个学生每个知识点得分
+     * @param schoolId 学校id
+     * @param examId 考试id
+     * @param courseCode 课程编号
+     * @return 大集合
+     */
+    Set<String> findDimensionTypesByCourseCode(Long schoolId, Long examId, String courseCode);
 }

+ 9 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamCourseRecordDioServiceImpl.java

@@ -4,8 +4,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.teachcloud.report.business.entity.TAExamCourseRecordDio;
 import com.qmth.teachcloud.report.business.mapper.TAExamCourseRecordDioMapper;
 import com.qmth.teachcloud.report.business.service.TAExamCourseRecordDioService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
+import java.util.Set;
+
 /**
  * <p>
  * 参考课程考生各考查点维度分析表 服务实现类
@@ -16,5 +20,10 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class TAExamCourseRecordDioServiceImpl extends ServiceImpl<TAExamCourseRecordDioMapper, TAExamCourseRecordDio> implements TAExamCourseRecordDioService {
+    private final Logger log = LoggerFactory.getLogger(TAExamCourseRecordDioServiceImpl.class);
 
+    @Override
+    public Set<String> findDimensionTypesByCourseCode(Long schoolId, Long examId, String courseCode) {
+        return this.baseMapper.findDimensionTypesByCourseCode(schoolId, examId, courseCode);
+    }
 }

+ 2 - 4
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TBExamStudentServiceImpl.java

@@ -413,14 +413,12 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
         diagnosisResult.setResult(result);
 
         // 模块
-        QueryWrapper<TAExamCourseRecordDio> examCourseRecordDioQueryWrapper = new QueryWrapper<>();
-        examCourseRecordDioQueryWrapper.lambda().eq(TAExamCourseRecordDio::getSchoolId, schoolId).eq(TAExamCourseRecordDio::getExamId, examId).eq(TAExamCourseRecordDio::getCourseCode, courseCode);
 
         long s3 = System.currentTimeMillis();
-        List<TAExamCourseRecordDio> examCourseRecordDios = taExamCourseRecordDioService.list(examCourseRecordDioQueryWrapper);
+        Set<String> moduleNames = taExamCourseRecordDioService.findDimensionTypesByCourseCode(schoolId,SystemConstant.convertIdToLong(examId),courseCode);
         log.info("s3查询耗时{}",System.currentTimeMillis() - s3);
 
-        Set<String> moduleNames = examCourseRecordDios.stream().map(TAExamCourseRecordDio::getDimensionType).collect(Collectors.toSet());
+
         List<DiagnosisDetailResult> diagnosisDetailResults = new ArrayList<>();
         for (String moduleName : moduleNames) {
             DiagnosisDetailResult diagnosisDetailResult = new DiagnosisDetailResult();

+ 19 - 1
teachcloud-report-business/src/main/resources/mapper/TAExamCourseRecordDioMapper.xml

@@ -79,9 +79,27 @@
         <where>
             and a.school_id = #{schoolId}
             and a.exam_id = #{examId}
-            and a.student_code = #{studentCode}
             and a.course_code = #{courseCode}
             and a.dimension_type = #{moduleName}
+            and a.student_code = #{studentCode}
+        </where>
+    </select>
+    <select id="findDimensionTypesByCourseCode"
+            resultType="java.lang.String">
+        SELECT
+            distinct (dimension_type)
+        FROM
+            t_a_exam_course_record_dio
+        <where>
+            <if test="schoolId != null and schoolId != ''">
+                AND school_id = #{schoolId}
+            </if>
+            <if test="examId != null and examId != ''">
+                AND exam_id = #{examId}
+            </if>
+            <if test="courseCode != null and courseCode != ''">
+                AND course_code = #{courseCode}
+            </if>
         </where>
     </select>
 </mapper>

+ 0 - 1
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/TBExamStudentController.java

@@ -23,7 +23,6 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
-import javax.servlet.http.HttpServletResponse;
 import java.util.Objects;
 
 /**