caozixuan 4 жил өмнө
parent
commit
2396943b14

+ 144 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/entity/TAExamCourseCollegeTeacher.java

@@ -135,6 +135,46 @@ public class TAExamCourseCollegeTeacher implements Serializable {
     @TableField(value = "teacher_count")
     private Integer teacherCount;
 
+    @ApiModelProperty(value = "其他学院授课学生最低分(赋分)")
+    @TableField(value = "other_college_min_score_assign")
+    private BigDecimal otherCollegeMinScoreAssign;
+
+    @ApiModelProperty(value = "其他学院授课学生最高分(赋分)")
+    @TableField(value = "other_college_max_score_assign")
+    private BigDecimal otherCollegeMaxScoreAssign;
+
+    @ApiModelProperty(value = "其他学院授课学生平均分(赋分)")
+    @TableField(value = "other_college_avg_score_assign")
+    private BigDecimal otherCollegeAvgScoreAssign;
+
+    @ApiModelProperty(value = "其他学院授课学生分数上四分位数")
+    @TableField(value = "other_college_upper_quartile")
+    private BigDecimal otherCollegeUpperQuartile;
+
+    @ApiModelProperty(value = "其他学院授课学生中位数")
+    @TableField(value = "other_college_median")
+    private BigDecimal otherCollegeMedian;
+
+    @ApiModelProperty(value = "其他学院授课学生分数下四分位数")
+    @TableField(value = "other_college_lower_quartile")
+    private BigDecimal otherCollegeLowerQuartile;
+
+    @ApiModelProperty(value = "其他学院授课学生分数众数")
+    @TableField(value = "other_college_mode")
+    private String otherCollegeMode;
+
+    @ApiModelProperty(value = "其他学院授课学生实际参考人数")
+    @TableField(value = "other_college_reality_count")
+    private Integer otherCollegeRealityCount;
+
+    @ApiModelProperty(value = "其他学院授课学生缺考人数")
+    @TableField(value = "other_college_absent_count")
+    private Integer otherCollegeAbsentCount;
+
+    @ApiModelProperty(value = "其他学院总人数")
+    @TableField(value = "other_college_total_count")
+    private Integer otherCollegeTotalCount;
+
     public static long getSerialVersionUID() {
         return serialVersionUID;
     }
@@ -382,4 +422,108 @@ public class TAExamCourseCollegeTeacher implements Serializable {
     public void setSchoolId(Long schoolId) {
         this.schoolId = schoolId;
     }
+
+    public BigDecimal getOtherCollegeMinScoreAssign() {
+        if (Objects.nonNull(otherCollegeMinScoreAssign)) {
+            return otherCollegeMinScoreAssign.setScale(SystemConstant.CALCULATE_SCALE, BigDecimal.ROUND_HALF_UP);
+        } else {
+            return otherCollegeMinScoreAssign;
+        }
+    }
+
+    public void setOtherCollegeMinScoreAssign(BigDecimal otherCollegeMinScoreAssign) {
+        this.otherCollegeMinScoreAssign = otherCollegeMinScoreAssign;
+    }
+
+    public BigDecimal getOtherCollegeMaxScoreAssign() {
+        if (Objects.nonNull(otherCollegeMaxScoreAssign)) {
+            return otherCollegeMaxScoreAssign.setScale(SystemConstant.CALCULATE_SCALE, BigDecimal.ROUND_HALF_UP);
+        } else {
+            return otherCollegeMaxScoreAssign;
+        }
+    }
+
+    public void setOtherCollegeMaxScoreAssign(BigDecimal otherCollegeMaxScoreAssign) {
+        this.otherCollegeMaxScoreAssign = otherCollegeMaxScoreAssign;
+    }
+
+    public BigDecimal getOtherCollegeAvgScoreAssign() {
+        if (Objects.nonNull(otherCollegeAvgScoreAssign)) {
+            return otherCollegeAvgScoreAssign.setScale(SystemConstant.CALCULATE_SCALE, BigDecimal.ROUND_HALF_UP);
+        } else {
+            return otherCollegeAvgScoreAssign;
+        }
+    }
+
+    public void setOtherCollegeAvgScoreAssign(BigDecimal otherCollegeAvgScoreAssign) {
+        this.otherCollegeAvgScoreAssign = otherCollegeAvgScoreAssign;
+    }
+
+    public BigDecimal getOtherCollegeUpperQuartile() {
+        if (Objects.nonNull(otherCollegeUpperQuartile)) {
+            return otherCollegeUpperQuartile.setScale(SystemConstant.CALCULATE_SCALE, BigDecimal.ROUND_HALF_UP);
+        } else {
+            return otherCollegeUpperQuartile;
+        }
+    }
+
+    public void setOtherCollegeUpperQuartile(BigDecimal otherCollegeUpperQuartile) {
+        this.otherCollegeUpperQuartile = otherCollegeUpperQuartile;
+    }
+
+    public BigDecimal getOtherCollegeMedian() {
+        if (Objects.nonNull(otherCollegeMedian)) {
+            return otherCollegeMedian.setScale(SystemConstant.CALCULATE_SCALE, BigDecimal.ROUND_HALF_UP);
+        } else {
+            return otherCollegeMedian;
+        }
+    }
+
+    public void setOtherCollegeMedian(BigDecimal otherCollegeMedian) {
+        this.otherCollegeMedian = otherCollegeMedian;
+    }
+
+    public BigDecimal getOtherCollegeLowerQuartile() {
+        if (Objects.nonNull(otherCollegeLowerQuartile)) {
+            return otherCollegeLowerQuartile.setScale(SystemConstant.CALCULATE_SCALE, BigDecimal.ROUND_HALF_UP);
+        } else {
+            return otherCollegeLowerQuartile;
+        }
+    }
+
+    public void setOtherCollegeLowerQuartile(BigDecimal otherCollegeLowerQuartile) {
+        this.otherCollegeLowerQuartile = otherCollegeLowerQuartile;
+    }
+
+    public String getOtherCollegeMode() {
+        return otherCollegeMode;
+    }
+
+    public void setOtherCollegeMode(String otherCollegeMode) {
+        this.otherCollegeMode = otherCollegeMode;
+    }
+
+    public Integer getOtherCollegeRealityCount() {
+        return otherCollegeRealityCount;
+    }
+
+    public void setOtherCollegeRealityCount(Integer otherCollegeRealityCount) {
+        this.otherCollegeRealityCount = otherCollegeRealityCount;
+    }
+
+    public Integer getOtherCollegeAbsentCount() {
+        return otherCollegeAbsentCount;
+    }
+
+    public void setOtherCollegeAbsentCount(Integer otherCollegeAbsentCount) {
+        this.otherCollegeAbsentCount = otherCollegeAbsentCount;
+    }
+
+    public Integer getOtherCollegeTotalCount() {
+        return otherCollegeTotalCount;
+    }
+
+    public void setOtherCollegeTotalCount(Integer otherCollegeTotalCount) {
+        this.otherCollegeTotalCount = otherCollegeTotalCount;
+    }
 }

+ 57 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/AnalyzeForReportServiceImpl.java

@@ -1211,6 +1211,7 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
                 int teacherCount = teacherIdSet.size();
                 for (Long teacherId : teacherIdSet) {
                     // 该教师数据
+                    // ----- 教师在本院学生数据 ------
                     List<TAExamCourseRecord> teacherRecordList = dataSource.stream()
                             .filter(e -> inspectCollegeId.equals(e.getInspectCollegeId()) && teacherId.equals(e.getTeacherId()) && e.getStudentCurrent())
                             .collect(Collectors.toList());
@@ -1256,6 +1257,50 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
                     double relativePosition = teacherEffectiveList.stream()
                             .collect(Collectors.summarizingDouble(e -> e.getStandardizedCoefficients().doubleValue())).getAverage(); // 相对位置
 
+
+                    // ----- 教师在其他学院学生数据 -----
+                    List<TAExamCourseRecord> teacherRecordOtherCollegeList = dataSource.stream()
+                            .filter(e -> !inspectCollegeId.equals(e.getInspectCollegeId()) && teacherId.equals(e.getTeacherId()) && e.getStudentCurrent())
+                            .collect(Collectors.toList());
+
+                    // 学生人数
+                    int otherCollegeTotalCount = teacherRecordOtherCollegeList.size();
+                    List<TAExamCourseRecord> teacherEffectiveOtherCollegeList = teacherRecordOtherCollegeList.stream().filter(e -> !e.getAbsent()).collect(Collectors.toList());
+                    int otherCollegeRealityCount = teacherEffectiveOtherCollegeList.size();
+                    if (otherCollegeRealityCount == 0) {
+                        continue;
+                    }
+                    int otherCollegeAbsentCount = otherCollegeTotalCount - otherCollegeRealityCount;
+
+                    // 成绩统计
+                    DoubleSummaryStatistics otherCollegeDescribeStatistic = teacherEffectiveOtherCollegeList.stream()
+                            .collect(Collectors.summarizingDouble(e -> e.getAssignedScore().doubleValue())); // 学生赋分的描述统计
+                    double otherCollegeMinScoreAssign = otherCollegeDescribeStatistic.getMin();
+                    double otherCollegeMaxScoreAssign = otherCollegeDescribeStatistic.getMax();
+                    double otherCollegeAvgScoreAssign = otherCollegeDescribeStatistic.getAverage();
+                    double otherCollegeAvgScore = teacherEffectiveOtherCollegeList.stream()
+                            .collect(Collectors.summarizingDouble(e -> e.getTotalScore().doubleValue())).getAverage();
+                    List<Double> otherCollegeAssignedScore = teacherEffectiveOtherCollegeList.stream().map(e -> e.getAssignedScore().doubleValue()).collect(Collectors.toList());
+                    // 计算上四分位数
+                    double otherCollegeUpperQuartile = MathUtil.calculateQuantile(otherCollegeAssignedScore, QuantileEnum.UPPER_QUARTILE.getValue());
+
+                    // 计算中位数
+                    double otherCollegeMedian = MathUtil.calculateQuantile(otherCollegeAssignedScore, QuantileEnum.MEDIAN.getValue());
+
+                    // 计算下四分位数
+                    double otherCollegeLowerQuartile = MathUtil.calculateQuantile(otherCollegeAssignedScore, QuantileEnum.LOWER_QUARTILE.getValue());
+
+                    // 极端情况下分位数值处理
+                    if (otherCollegeUpperQuartile == 0) {
+                        otherCollegeUpperQuartile = otherCollegeMedian;
+                    }
+                    if (otherCollegeLowerQuartile == 0) {
+                        otherCollegeLowerQuartile = otherCollegeMedian;
+                    }
+
+                    String otherCollegeMode = MathUtil.calculateMode(otherCollegeAssignedScore); // 众数
+
+
                     // 开课学院数据
                     List<Long> teachCollegeIdList = teacherEffectiveList.stream().map(TAExamCourseRecord::getTeachCollegeId).distinct().collect(Collectors.toList());
                     if (teachCollegeIdList.size() > 1) {
@@ -1293,6 +1338,18 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
                     taExamCourseCollegeTeacher.setTeacherCount(teacherCount);
                     taExamCourseCollegeTeacher.setTeachCollegeId(teachCollegeId);
                     taExamCourseCollegeTeacher.setTeachCollegeName(teachCollegeName);
+                    taExamCourseCollegeTeacher.setOtherCollegeMinScoreAssign(BigDecimal.valueOf(otherCollegeMinScoreAssign));
+                    taExamCourseCollegeTeacher.setOtherCollegeMaxScoreAssign(BigDecimal.valueOf(otherCollegeMaxScoreAssign));
+                    taExamCourseCollegeTeacher.setOtherCollegeAvgScoreAssign(BigDecimal.valueOf(otherCollegeAvgScoreAssign));
+                    taExamCourseCollegeTeacher.setOtherCollegeUpperQuartile(BigDecimal.valueOf(otherCollegeUpperQuartile));
+                    taExamCourseCollegeTeacher.setOtherCollegeMedian(BigDecimal.valueOf(otherCollegeMedian));
+                    taExamCourseCollegeTeacher.setOtherCollegeLowerQuartile(BigDecimal.valueOf(otherCollegeLowerQuartile));
+                    taExamCourseCollegeTeacher.setOtherCollegeMode(otherCollegeMode);
+                    taExamCourseCollegeTeacher.setOtherCollegeRealityCount(otherCollegeRealityCount);
+                    taExamCourseCollegeTeacher.setOtherCollegeAbsentCount(otherCollegeAbsentCount);
+                    taExamCourseCollegeTeacher.setOtherCollegeTotalCount(otherCollegeTotalCount);
+
+
                     rankTempList.add(taExamCourseCollegeTeacher);
                 }
                 // 计算教师排名

+ 27 - 33
teachcloud-report-business/src/main/resources/mapper/TAExamCourseCollegeTeacherMapper.xml

@@ -124,46 +124,40 @@
 
     <select id="findTeacherInfo" resultType="com.qmth.teachcloud.report.business.bean.result.TAExamCourseTeacherResult">
         SELECT
-            col.teacher_name AS teacherName,
-            col.reality_count AS colRealityCount,
-            col.total_count AS colTotalCount,
-            col.absent_count AS colAbsentCount,
-            round(convert(col.min_score_assign , decimal(10, 4)), 2) AS colMinScore,
-            round(convert(col.max_score_assign , decimal(10, 4)), 2) AS colMaxScore,
-            round(convert(col.avg_score_assign , decimal(10, 4)), 2) AS colAvgScore,
-            round(convert(col.upper_quartile, decimal(10, 4)), 2) AS colUpperQuartile,
-            round(convert(col.median, decimal(10, 4)), 2) AS colMedian,
-            round(convert(col.lower_quartile, decimal(10, 4)), 2) AS colLowerQuartile,
-            col.mode AS colMode,
-            round(convert(col.standard_deviation, decimal(10, 4)), 2) AS colStandardDeviation,
-            round(convert(col.relative_position, decimal(10, 4)), 2) AS colRelativePosition,
-            sch.reality_count AS schRealityCount,
-            sch.total_count AS schTotalCount,
-            sch.absent_count AS schAbsentCount,
-            round(convert(sch.min_score, decimal(10, 4)), 2) AS schMinScore,
-            round(convert(sch.max_score, decimal(10, 4)), 2) AS schMaxScore,
-            round(convert(sch.avg_score, decimal(10, 4)), 2) AS schAvgScore,
-            round(convert(sch.upper_quartile, decimal(10, 4)), 2) AS schUpperQuartile,
-            round(convert(sch.median, decimal(10, 4)), 2) AS schMedian,
-            round(convert(sch.lower_quartile, decimal(10, 4)), 2) AS schLowerQuartile,
-            sch.mode AS schMode,
-            round(convert(sch.standard_deviation, decimal(10, 4)), 2) AS schStandardDeviation,
-            round(convert(sch.relative_position, decimal(10, 4)), 2) AS schRelativePosition
+            teacher_name AS teacherName,
+            reality_count AS colRealityCount,
+            total_count AS colTotalCount,
+            absent_count AS colAbsentCount,
+            ROUND(CONVERT( min_score_assign , DECIMAL (10 , 4 )),2) AS colMinScore,
+            ROUND(CONVERT( max_score_assign , DECIMAL (10 , 4 )),2) AS colMaxScore,
+            ROUND(CONVERT( avg_score_assign , DECIMAL (10 , 4 )),2) AS colAvgScore,
+            ROUND(CONVERT( upper_quartile , DECIMAL (10 , 4 )),2) AS colUpperQuartile,
+            ROUND(CONVERT( median , DECIMAL (10 , 4 )), 2) AS colMedian,
+            ROUND(CONVERT( lower_quartile , DECIMAL (10 , 4 )),2) AS colLowerQuartile,
+            mode AS colMode,
+            ROUND(CONVERT( standard_deviation , DECIMAL (10 , 4 )),2) AS colStandardDeviation,
+            ROUND(CONVERT( relative_position , DECIMAL (10 , 4 )),2) AS colRelativePosition,
+            other_college_reality_count AS schRealityCount,
+            other_college_total_count AS schTotalCount,
+            other_college_absent_count AS schAbsentCount,
+            ROUND(CONVERT( other_college_min_score_assign , DECIMAL (10 , 4 )),2) AS schMinScore,
+            ROUND(CONVERT( other_college_max_score_assign , DECIMAL (10 , 4 )),2) AS schMaxScore,
+            ROUND(CONVERT( other_college_avg_score_assign , DECIMAL (10 , 4 )),2) AS schAvgScore,
+            ROUND(CONVERT( other_college_upper_quartile , DECIMAL (10 , 4 )),2) AS schUpperQuartile,
+            ROUND(CONVERT( other_college_median , DECIMAL (10 , 4 )),2) AS schMedian,
+            ROUND(CONVERT( other_college_lower_quartile , DECIMAL (10 , 4 )),2) AS schLowerQuartile,
+            other_college_mode AS schMode
         FROM
-             t_a_exam_course_college_teacher col
-        INNER JOIN  t_a_exam_course_teacher sch ON
-            col.exam_id = sch.exam_id
-            AND col.course_code = sch.course_code
-            AND col.teacher_name = sch.teacher_name
+            t_a_exam_course_college_teacher
         <where>
             <if test="examId != null and examId != ''">
-                and col.exam_id = #{examId}
+                and exam_id = #{examId}
             </if>
             <if test="courseCode != null and courseCode != ''">
-                and col.course_code = #{courseCode}
+                and course_code = #{courseCode}
             </if>
             <if test="collegeId != null and collegeId != ''">
-                and col.inspect_college_id = #{collegeId}
+                and inspect_college_id = #{collegeId}
             </if>
         </where>
     </select>

+ 1 - 1
teachcloud-report/src/test/java/com/qmth/teachcloud/report/AnalyzeForStudentServiceTest.java

@@ -84,7 +84,7 @@ public class AnalyzeForStudentServiceTest {
     @Test
     public void buildAnalyzeExamCourseCollegeTeacher() {
         Long examId = 1L;
-        String courseCode = "1013";
+        String courseCode = null;
         System.out.println(analyzeForReportService.buildAnalyzeExamCourseCollegeTeacher(examId,courseCode));
     }