caozixuan 4 лет назад
Родитель
Сommit
f731bd1cf5
17 измененных файлов с 585 добавлено и 40 удалено
  1. 26 1
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/dto/AnswerDetailBean.java
  2. 141 0
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/TrialCalculationResult.java
  3. 26 0
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/entity/TAExamCourseDifficult.java
  4. 25 0
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/entity/TAExamCourseRecordDio.java
  5. 25 0
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/entity/TAExamCourseTeacherDifficult.java
  6. 11 1
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/mapper/TAExamCourseTeacherDioMapper.java
  7. 17 1
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/AnalyzeForReportService.java
  8. 22 11
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/TAExamCourseService.java
  9. 6 1
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/TAExamCourseTeacherDioService.java
  10. 133 15
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/AnalyzeForReportServiceImpl.java
  11. 81 3
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamCourseServiceImpl.java
  12. 27 0
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamCourseTeacherDioServiceImpl.java
  13. 24 0
      teachcloud-report-business/src/main/resources/mapper/TAExamCourseTeacherDioMapper.xml
  14. 4 1
      teachcloud-report-business/src/main/resources/mapper/TBAnswerMapper.xml
  15. 4 4
      teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/BasicDatasourceController.java
  16. 2 0
      teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/DataAnalyzeController.java
  17. 11 2
      teachcloud-report/src/test/java/com/qmth/teachcloud/report/AnalyzeForStudentServiceTest.java

+ 26 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/dto/AnswerDetailBean.java

@@ -12,6 +12,13 @@ import java.io.Serializable;
  * @Date: 2021/1/14
  */
 public class AnswerDetailBean implements Serializable {
+
+    @ApiModelProperty(value = "教师id")
+    private Long teacherId;
+
+    @ApiModelProperty(value = "教师名称")
+    private String teacherName;
+
     @ApiModelProperty(value = "试卷id")
     private Long paperId;
 
@@ -30,7 +37,9 @@ public class AnswerDetailBean implements Serializable {
     @ApiModelProperty(value = "学院id")
     private Long collegeId;
 
-    public AnswerDetailBean(Long paperId, String paperType, Double scoreRate, String difficult, String collegeName, Long collegeId) {
+    public AnswerDetailBean(Long teacherId, String teacherName, Long paperId, String paperType, Double scoreRate, String difficult, String collegeName, Long collegeId) {
+        this.teacherId = teacherId;
+        this.teacherName = teacherName;
         this.paperId = paperId;
         this.paperType = paperType;
         this.scoreRate = scoreRate;
@@ -42,6 +51,22 @@ public class AnswerDetailBean implements Serializable {
     public AnswerDetailBean() {
     }
 
+    public Long getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Long teacherId) {
+        this.teacherId = teacherId;
+    }
+
+    public String getTeacherName() {
+        return teacherName;
+    }
+
+    public void setTeacherName(String teacherName) {
+        this.teacherName = teacherName;
+    }
+
     public Long getPaperId() {
         return paperId;
     }

+ 141 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/TrialCalculationResult.java

@@ -0,0 +1,141 @@
+package com.qmth.teachcloud.report.business.bean.result;
+
+import java.math.BigDecimal;
+
+/**
+ * @Description: 试算结果
+ * @Author: CaoZixuan
+ * @Date: 2021-06-16
+ */
+public class TrialCalculationResult {
+    private int totalCount;
+    private int currentCount;
+    // 赋分前-总体
+    private BigDecimal avgScore;
+    private BigDecimal failRate;
+    private BigDecimal failCount;
+    // 赋分前-应届
+    private BigDecimal currentAvgScore;
+    private BigDecimal currentFailRate;
+    private BigDecimal currentFailCount;
+    // 赋分后-总体
+    private BigDecimal avgScoreAssign;
+    private BigDecimal failRateAssign;
+    private BigDecimal failCountAssign;
+    // 赋分后-应届
+    private BigDecimal currentAvgScoreAssign;
+    private BigDecimal currentFailRateAssign;
+    private BigDecimal currentFailCountAssign;
+
+    public int getTotalCount() {
+        return totalCount;
+    }
+
+    public void setTotalCount(int totalCount) {
+        this.totalCount = totalCount;
+    }
+
+    public int getCurrentCount() {
+        return currentCount;
+    }
+
+    public void setCurrentCount(int currentCount) {
+        this.currentCount = currentCount;
+    }
+
+    public BigDecimal getAvgScore() {
+        return avgScore;
+    }
+
+    public void setAvgScore(BigDecimal avgScore) {
+        this.avgScore = avgScore;
+    }
+
+    public BigDecimal getFailRate() {
+        return failRate;
+    }
+
+    public void setFailRate(BigDecimal failRate) {
+        this.failRate = failRate;
+    }
+
+    public BigDecimal getFailCount() {
+        return failCount;
+    }
+
+    public void setFailCount(BigDecimal failCount) {
+        this.failCount = failCount;
+    }
+
+    public BigDecimal getCurrentAvgScore() {
+        return currentAvgScore;
+    }
+
+    public void setCurrentAvgScore(BigDecimal currentAvgScore) {
+        this.currentAvgScore = currentAvgScore;
+    }
+
+    public BigDecimal getCurrentFailRate() {
+        return currentFailRate;
+    }
+
+    public void setCurrentFailRate(BigDecimal currentFailRate) {
+        this.currentFailRate = currentFailRate;
+    }
+
+    public BigDecimal getCurrentFailCount() {
+        return currentFailCount;
+    }
+
+    public void setCurrentFailCount(BigDecimal currentFailCount) {
+        this.currentFailCount = currentFailCount;
+    }
+
+    public BigDecimal getAvgScoreAssign() {
+        return avgScoreAssign;
+    }
+
+    public void setAvgScoreAssign(BigDecimal avgScoreAssign) {
+        this.avgScoreAssign = avgScoreAssign;
+    }
+
+    public BigDecimal getFailRateAssign() {
+        return failRateAssign;
+    }
+
+    public void setFailRateAssign(BigDecimal failRateAssign) {
+        this.failRateAssign = failRateAssign;
+    }
+
+    public BigDecimal getFailCountAssign() {
+        return failCountAssign;
+    }
+
+    public void setFailCountAssign(BigDecimal failCountAssign) {
+        this.failCountAssign = failCountAssign;
+    }
+
+    public BigDecimal getCurrentAvgScoreAssign() {
+        return currentAvgScoreAssign;
+    }
+
+    public void setCurrentAvgScoreAssign(BigDecimal currentAvgScoreAssign) {
+        this.currentAvgScoreAssign = currentAvgScoreAssign;
+    }
+
+    public BigDecimal getCurrentFailRateAssign() {
+        return currentFailRateAssign;
+    }
+
+    public void setCurrentFailRateAssign(BigDecimal currentFailRateAssign) {
+        this.currentFailRateAssign = currentFailRateAssign;
+    }
+
+    public BigDecimal getCurrentFailCountAssign() {
+        return currentFailCountAssign;
+    }
+
+    public void setCurrentFailCountAssign(BigDecimal currentFailCountAssign) {
+        this.currentFailCountAssign = currentFailCountAssign;
+    }
+}

+ 26 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/entity/TAExamCourseDifficult.java

@@ -50,6 +50,16 @@ public class TAExamCourseDifficult implements Serializable {
     @TableField(value = "course_name")
     private String courseName;
 
+    @ApiModelProperty(value = "试卷id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    @TableField(value = "paper_id")
+    private Long paperId;
+
+    @ApiModelProperty(value = "试卷类型")
+    @TableField(value = "paper_type")
+    private String paperType;
+
+
     @ApiModelProperty(value = "学院id")
     @JsonSerialize(using = ToStringSerializer.class)
     @TableField(value = "college_id")
@@ -187,4 +197,20 @@ public class TAExamCourseDifficult implements Serializable {
     public void setColAvgScoreRate(BigDecimal colAvgScoreRate) {
         this.colAvgScoreRate = colAvgScoreRate;
     }
+
+    public Long getPaperId() {
+        return paperId;
+    }
+
+    public void setPaperId(Long paperId) {
+        this.paperId = paperId;
+    }
+
+    public String getPaperType() {
+        return paperType;
+    }
+
+    public void setPaperType(String paperType) {
+        this.paperType = paperType;
+    }
 }

+ 25 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/entity/TAExamCourseRecordDio.java

@@ -94,6 +94,15 @@ public class TAExamCourseRecordDio implements Serializable {
     @TableField(value = "inspect_college_name")
     private String inspectCollegeName;
 
+    @ApiModelProperty(value = "所属考查学院id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    @TableField(value = "teacher_id")
+    private Long teacherId;
+
+    @ApiModelProperty(value = "所属考查学院名称")
+    @TableField(value = "teacher_name")
+    private String teacherName;
+
     public static long getSerialVersionUID() {
         return serialVersionUID;
     }
@@ -225,4 +234,20 @@ public class TAExamCourseRecordDio implements Serializable {
     public void setStudentId(Long studentId) {
         this.studentId = studentId;
     }
+
+    public Long getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Long teacherId) {
+        this.teacherId = teacherId;
+    }
+
+    public String getTeacherName() {
+        return teacherName;
+    }
+
+    public void setTeacherName(String teacherName) {
+        this.teacherName = teacherName;
+    }
 }

+ 25 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/entity/TAExamCourseTeacherDifficult.java

@@ -55,6 +55,15 @@ public class TAExamCourseTeacherDifficult implements Serializable {
     @TableField(value = "course_name")
     private String courseName;
 
+    @ApiModelProperty(value = "试卷id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    @TableField(value = "paper_id")
+    private Long paperId;
+
+    @ApiModelProperty(value = "试卷类型")
+    @TableField(value = "paper_type")
+    private String paperType;
+
     @ApiModelProperty(value = "教师id")
     @JsonSerialize(using = ToStringSerializer.class)
     @TableField(value = "teacher_id")
@@ -199,4 +208,20 @@ public class TAExamCourseTeacherDifficult implements Serializable {
     public void setTeaAvgScoreRate(BigDecimal teaAvgScoreRate) {
         this.teaAvgScoreRate = teaAvgScoreRate;
     }
+
+    public Long getPaperId() {
+        return paperId;
+    }
+
+    public void setPaperId(Long paperId) {
+        this.paperId = paperId;
+    }
+
+    public String getPaperType() {
+        return paperType;
+    }
+
+    public void setPaperType(String paperType) {
+        this.paperType = paperType;
+    }
 }

+ 11 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/mapper/TAExamCourseTeacherDioMapper.java

@@ -1,7 +1,11 @@
 package com.qmth.teachcloud.report.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.teachcloud.report.business.entity.TAExamCourseCollegeInspectDio;
 import com.qmth.teachcloud.report.business.entity.TAExamCourseTeacherDio;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,5 +16,11 @@ import com.qmth.teachcloud.report.business.entity.TAExamCourseTeacherDio;
  * @since 2021-06-16
  */
 public interface TAExamCourseTeacherDioMapper extends BaseMapper<TAExamCourseTeacherDio> {
-
+    /**
+     * 根据考试编号和课程编号和‘t_a_exam_course_record_dio’表向‘t_a_exam_course_teacher_dio’表插入数据
+     * @param examId 考试id
+     * @param courseCode 课程编号
+     * @return 从资源表查出的结果集
+     */
+    List<TAExamCourseTeacherDio> findByTAExamCourseRecordDio(@Param("examId") Long examId, @Param("courseCode") String courseCode);
 }

+ 17 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/AnalyzeForReportService.java

@@ -79,6 +79,14 @@ public interface AnalyzeForReportService {
      */
     String buildAnalyzeExamCourseCollegeInspectDio(Long examId, String courseCode);
 
+    /**
+     * 构建考试课程教师维度分析表
+     * @param examId 考试id
+     * @param courseCode 课程编号
+     * @return 结果
+     */
+    String buildAnalyzeExamCourseTeacherDio(Long examId,String courseCode);
+
     /**
      * 构建分析试卷结构表 't_a_paper_struct'表
      *
@@ -89,7 +97,7 @@ public interface AnalyzeForReportService {
     String buildAnalyzePaperStruct(Long examId, String courseCode);
 
     /**
-     * 构建科目题目难度分类得分率表
+     * 构建科目题目难度分类得分率表 - 学院与学校
      *
      * @param examId     考试id
      * @param courseCode 课程编号
@@ -97,6 +105,14 @@ public interface AnalyzeForReportService {
      */
     String buildExamPaperDifficult(Long examId, String courseCode);
 
+    /**
+     * 构建科目题目难度分类得分率表 - 教师与学校
+     * @param examId 考试id
+     * @param courseCode 课程编号
+     * @return 结果
+     */
+    String buildExamPaperTeacherDifficult(Long examId,String courseCode);
+
     /**
      * 构建表 ‘t_a_exam_total’
      *

+ 22 - 11
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/TAExamCourseService.java

@@ -81,17 +81,20 @@ public interface TAExamCourseService extends IService<TAExamCourse> {
      */
     IPage<TAExamCourseCollegeTeacherResult> surveyTeacherTeacherView(IPage<Map> iPage, Long schoolId, SemesterEnum semester, Long examId, String courseCode);
 
-    /**
-     * 开课课程考试总览-试题难度得分情况分析接口
-     *
-     * @param schoolId
-     * @param semester
-     * @param examId
-     * @param courseCode
-     * @param collegeId
-     * @param teacherId
-     * @return
-     */
+//    /**
+//     * 开课课程考试总览-试题难度得分情况分析接口
+//     *
+//     * @param schoolId
+//     * @param semester
+//     * @param examId
+//     * @param courseCode
+//     * @param collegeId
+//     * @param teacherId
+//     * @return
+//     */
+//    Object surveyTeacherQuestionView(Long schoolId, SemesterEnum semester, Long examId, String courseCode, Long collegeId, Long teacherId);
+
+
     DimensionAnalyzeResult surveyTeacherQuestionView(Long schoolId, SemesterEnum semester, Long examId, String courseCode, Long collegeId, Long teacherId);
 
     /**
@@ -106,4 +109,12 @@ public interface TAExamCourseService extends IService<TAExamCourse> {
      * @return
      */
     Object surveyTeacherQuestionAnswerView(Long schoolId, SemesterEnum semester, Long examId, String courseCode, Long collegeId, Long teacherId);
+
+    /**
+     * 赋分试算
+     * @param examId 考试id
+     * @param courseCode 课程编号
+     * @return 快速试算结果
+     */
+    TrialCalculationResult trialCalculate(Long examId,String courseCode);
 }

+ 6 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/TAExamCourseTeacherDioService.java

@@ -12,5 +12,10 @@ import com.qmth.teachcloud.report.business.entity.TAExamCourseTeacherDio;
  * @since 2021-06-16
  */
 public interface TAExamCourseTeacherDioService extends IService<TAExamCourseTeacherDio> {
-
+    /**
+     * 根据考试编号和课程编号和‘t_a_exam_course_record_dio’表向‘t_a_exam_course_teacher_dio’表插入数据
+     * @param examId 考试id
+     * @param courseCode 课程编号
+     */
+    void insertByTAExamCourseRecordDio(Long examId,String courseCode);
 }

+ 133 - 15
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/AnalyzeForReportServiceImpl.java

@@ -91,6 +91,10 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
     private SysUserService sysUserService;
     @Resource
     private TAExamCourseDifficultService taExamCourseDifficultService;
+    @Resource
+    private TAExamCourseTeacherDifficultService taExamCourseTeacherDifficultService;
+    @Resource
+    private TAExamCourseTeacherDioService taExamCourseTeacherDioService;
 
 
     @Transactional(rollbackFor = Exception.class)
@@ -140,14 +144,14 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
             DoubleSummaryStatistics totalStatistics = totalScoreList.stream().collect(Collectors.summarizingDouble(e -> e));
             double avgScore = totalStatistics.getAverage();
             long passCount = totalScoreList.stream().filter(e -> e >= passScore.doubleValue()).count();
-            BigDecimal passRate = BigDecimal.valueOf(passCount).divide(BigDecimal.valueOf(realityCount), 4, BigDecimal.ROUND_HALF_DOWN);
+            BigDecimal passRate = BigDecimal.valueOf(passCount).divide(BigDecimal.valueOf(realityCount), 4, BigDecimal.ROUND_HALF_UP);
 
             // -------------------卷面分------------------------
             List<Double> paperTotalScoreList = totalDatasource.stream().filter(e -> !e.getAbsent()).map(e -> e.getTotalScore().doubleValue()).collect(Collectors.toList());
             DoubleSummaryStatistics paperTotalStatistics = paperTotalScoreList.stream().collect(Collectors.summarizingDouble(e -> e));
             double paperAvgScore = paperTotalStatistics.getAverage();
             long paperPassCount = paperTotalScoreList.stream().filter(e -> e >= passScore.doubleValue()).count();
-            BigDecimal paperPassRate = BigDecimal.valueOf(paperPassCount).divide(BigDecimal.valueOf(realityCount), 4, BigDecimal.ROUND_HALF_DOWN);
+            BigDecimal paperPassRate = BigDecimal.valueOf(paperPassCount).divide(BigDecimal.valueOf(realityCount), 4, BigDecimal.ROUND_HALF_UP);
 
 
 
@@ -163,7 +167,7 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
             if (pastTotalCount != pastRealityCount + pastAbsentCount) {
                 throw ExceptionResultEnum.ERROR.exception("考试往届生人数数据异常");
             }
-            BigDecimal pastRealityRate = BigDecimal.valueOf(pastRealityCount).divide(BigDecimal.valueOf(realityCount), 4, BigDecimal.ROUND_HALF_DOWN);
+            BigDecimal pastRealityRate = BigDecimal.valueOf(pastRealityCount).divide(BigDecimal.valueOf(realityCount), 4, BigDecimal.ROUND_HALF_UP);
 
             /*
                 该课程应届生成绩分析
@@ -178,13 +182,13 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
             if (currentTotalCount != currentRealityCount + currentAbsentCount) {
                 throw ExceptionResultEnum.ERROR.exception("考试应届生人数数据异常");
             }
-            BigDecimal currentRealityRate = BigDecimal.valueOf(currentRealityCount).divide(BigDecimal.valueOf(realityCount), 4, BigDecimal.ROUND_HALF_DOWN);
+            BigDecimal currentRealityRate = BigDecimal.valueOf(currentRealityCount).divide(BigDecimal.valueOf(realityCount), 4, BigDecimal.ROUND_HALF_UP);
 
             // 通过率统计
             List<Double> currentScoreList = currentDatasource.stream().filter(e -> !e.getAbsent()).map(e -> e.getAssignedScore().doubleValue()).collect(Collectors.toList());
             DoubleSummaryStatistics currentStatistics = currentScoreList.stream().collect(Collectors.summarizingDouble(e -> e));
             long currentPassCount = currentScoreList.stream().filter(e -> e >= passScore.doubleValue()).count();
-            BigDecimal currentPassRate = BigDecimal.valueOf(currentPassCount).divide(BigDecimal.valueOf(currentRealityCount), 4, BigDecimal.ROUND_HALF_DOWN);
+            BigDecimal currentPassRate = BigDecimal.valueOf(currentPassCount).divide(BigDecimal.valueOf(currentRealityCount), 4, BigDecimal.ROUND_HALF_UP);
 
             // 描述统计
             double currentMinScore = currentStatistics.getMin();
@@ -214,19 +218,19 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
             BigDecimal scoreRate;
             double standardAvgScore = currentDatasource.stream().collect(Collectors.summarizingDouble(e -> e.getTotalScore().doubleValue())).getAverage();
             if (standardAvgScore != 0 && totalScore.compareTo(BigDecimal.ZERO) > 0) {
-                scoreRate = BigDecimal.valueOf(standardAvgScore).divide(totalScore, 4, BigDecimal.ROUND_HALF_DOWN);
+                scoreRate = BigDecimal.valueOf(standardAvgScore).divide(totalScore, 4, BigDecimal.ROUND_HALF_UP);
             } else {
                 scoreRate = BigDecimal.ZERO;
             }
             // 难度系数保留1位数
-            scoreRate = scoreRate.setScale(1, BigDecimal.ROUND_HALF_DOWN); // 难度系数保留1位有效数字
+            scoreRate = scoreRate.setScale(1, BigDecimal.ROUND_HALF_UP); // 难度系数保留1位有效数字
             String difficulty = this.handleLevel(examId, effectiveCourseCode, "难度等级", scoreRate.doubleValue());
             //--------------------------应届-卷面成绩-----------------------
             List<Double> paperCurrentScoreList = currentDatasource.stream().filter(e -> !e.getAbsent()).map(e -> e.getTotalScore().doubleValue()).collect(Collectors.toList());
             DoubleSummaryStatistics paperCurrentStatistics = paperCurrentScoreList.stream().collect(Collectors.summarizingDouble(e -> e));
             double paperCurrentAvgScore = paperCurrentStatistics.getAverage();
             long paperCurrentPassCount = paperCurrentScoreList.stream().filter(e -> e >= passScore.doubleValue()).count();
-            BigDecimal paperCurrentPassRate = BigDecimal.valueOf(paperCurrentPassCount).divide(BigDecimal.valueOf(currentRealityCount), 4, BigDecimal.ROUND_HALF_DOWN);
+            BigDecimal paperCurrentPassRate = BigDecimal.valueOf(paperCurrentPassCount).divide(BigDecimal.valueOf(currentRealityCount), 4, BigDecimal.ROUND_HALF_UP);
 
             /*
                 学院信息
@@ -331,7 +335,7 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
                 long sameCount = dataSource.stream().filter(e -> e.getTotalScore().compareTo(totalScore) == 0).count(); // 和我相同的人数
                 int totalCount = dataSource.size(); //总人数
                 // 标准回归系数
-                BigDecimal standardizedCoefficients = (taExamCourseRecord.getAssignedScore().subtract(avgScore)).divide(standardDeviation, 4, BigDecimal.ROUND_HALF_DOWN);
+                BigDecimal standardizedCoefficients = (taExamCourseRecord.getAssignedScore().subtract(avgScore)).divide(standardDeviation, 4, BigDecimal.ROUND_HALF_UP);
 
                 int percentGrade = this.handlePercentGrade(BigDecimal.valueOf(lowCount), BigDecimal.valueOf(sameCount), BigDecimal.valueOf(totalCount));
                 taExamCourseRecord.setPercentGrade(percentGrade);
@@ -587,6 +591,8 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
                 for (TAExamCourseRecord taExamCourseRecord : effectiveDatasource) {
                     Long inspectCollegeId = taExamCourseRecord.getInspectCollegeId();
                     String inspectCollegeName = sysOrgService.getById(inspectCollegeId).getName();
+                    Long teacherId = taExamCourseRecord.getTeacherId();
+                    String teacherName = sysUserService.getById(teacherId).getRealName();
                     List<BasicAnswerDto> oneStudentAnswerDetailDataSource = answerDtoList.stream()
                             .filter(e -> taExamCourseRecord.getExamRecordId().equals(e.getExamRecordId()))
                             .collect(Collectors.toList());
@@ -645,6 +651,8 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
                         taExamCourseRecordDio.setProficiency(this.handleModuleProficiency(examId, effectiveCourseCode, dimensionType, rate));
                         taExamCourseRecordDio.setInspectCollegeId(inspectCollegeId);
                         taExamCourseRecordDio.setInspectCollegeName(inspectCollegeName);
+                        taExamCourseRecordDio.setTeacherId(teacherId);
+                        taExamCourseRecordDio.setTeacherName(teacherName);
                         taExamCourseRecordDioList.add(taExamCourseRecordDio);
                     }
                     // 考查模块得分率
@@ -808,6 +816,22 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
         return "'t_a_exam_course_college_inspect_dio'表构建完成 ";
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public String buildAnalyzeExamCourseTeacherDio(Long examId, String courseCode) {
+        // 可分析有效课程信息
+        List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId, courseCode);
+        for (String effectiveCourseCode : effectiveCourseCodeList) {
+            // 删除原有数据
+            taExamCourseTeacherDioService.remove(new QueryWrapper<TAExamCourseTeacherDio>().lambda()
+                    .eq(TAExamCourseTeacherDio::getExamId,examId)
+                    .eq(TAExamCourseTeacherDio::getCourseCode,effectiveCourseCode));
+
+            taExamCourseTeacherDioService.insertByTAExamCourseRecordDio(examId, effectiveCourseCode);
+        }
+        return "'t_a_exam_course_teacher_dio'表构建完成 ";
+    }
+
     @Transactional(rollbackFor = Exception.class)
     @Override
     public String buildAnalyzePaperStruct(Long examId, String courseCode) {
@@ -849,8 +873,8 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
                             .collect(Collectors.summarizingDouble(e -> e.getScore().doubleValue()));
                     BigDecimal fullScore = paperStruct.getFullScore();
                     double scoreAvg = descriptiveStatistics.getAverage();
-                    BigDecimal scoreRate = BigDecimal.valueOf(scoreAvg).divide(fullScore, 4, BigDecimal.ROUND_HALF_DOWN);
-                    scoreRate = scoreRate.setScale(1, BigDecimal.ROUND_HALF_DOWN);
+                    BigDecimal scoreRate = BigDecimal.valueOf(scoreAvg).divide(fullScore, 4, BigDecimal.ROUND_HALF_UP);
+                    scoreRate = scoreRate.setScale(1, BigDecimal.ROUND_HALF_UP);
                     String difficult = this.analyzeDifficult(examId, effectiveCourseCode, scoreRate.doubleValue());
 
                     double validity = this.calculateValidity(oneQuestionAnswerDetailList, fullScore.doubleValue());
@@ -901,7 +925,9 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
             List<TAExamCourseDifficult> taExamCourseDifficultList = new ArrayList<>();
 
             List<TBCommonLevelConfig> configLevelDatasource = tbCommonLevelConfigService.list(new QueryWrapper<TBCommonLevelConfig>().lambda()
-                    .eq(TBCommonLevelConfig::getExamId, examId).eq(TBCommonLevelConfig::getCourseCode, effectiveCourseCode));// 该科目试题难度情况数据源
+                    .eq(TBCommonLevelConfig::getExamId, examId)
+                    .eq(TBCommonLevelConfig::getCourseCode, effectiveCourseCode)
+                    .eq(TBCommonLevelConfig::getLevelType,"难度等级"));// 该科目试题难度情况数据源
 
             List<TAPaperStruct> questionDatasource = taPaperStructService.list(new QueryWrapper<TAPaperStruct>().lambda()
                     .eq(TAPaperStruct::getExamId, examId).eq(TAPaperStruct::getCourseCode, effectiveCourseCode));// 该科目试题情况数据源
@@ -953,6 +979,8 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
                         taExamCourseDifficult.setExamId(examId);
                         taExamCourseDifficult.setCourseCode(effectiveCourseCode);
                         taExamCourseDifficult.setCourseName(basicCourseService.findByCourseCode(effectiveCourseCode).getName());
+                        taExamCourseDifficult.setPaperId(paperId);
+                        taExamCourseDifficult.setPaperType(tbPaperService.getById(paperId).getPaperType());
                         taExamCourseDifficult.setCollegeId(collegeId);
                         taExamCourseDifficult.setSchoolId(tbExamService.getById(examId).getSchoolId());
                         taExamCourseDifficult.setInterpret(interpret);
@@ -972,6 +1000,96 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
         return "'t_a_exam_course_difficult' 表构建完成";
     }
 
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public String buildExamPaperTeacherDifficult(Long examId, String courseCode) {
+        // 可分析有效课程信息
+        List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId, courseCode);
+
+        for (String effectiveCourseCode : effectiveCourseCodeList) {
+            taExamCourseTeacherDifficultService.remove(new QueryWrapper<TAExamCourseTeacherDifficult>().lambda()
+                    .eq(TAExamCourseTeacherDifficult::getExamId, examId)
+                    .eq(TAExamCourseTeacherDifficult::getCourseCode, effectiveCourseCode));
+
+            List<TAExamCourseTeacherDifficult> taExamCourseTeacherDifficultList = new ArrayList<>();
+
+            List<TBCommonLevelConfig> configLevelDatasource = tbCommonLevelConfigService.list(new QueryWrapper<TBCommonLevelConfig>().lambda()
+                    .eq(TBCommonLevelConfig::getExamId, examId)
+                    .eq(TBCommonLevelConfig::getCourseCode, effectiveCourseCode)
+                    .eq(TBCommonLevelConfig::getLevelType,"难度等级"));// 该科目试题难度情况数据源
+
+            List<TAPaperStruct> questionDatasource = taPaperStructService.list(new QueryWrapper<TAPaperStruct>().lambda()
+                    .eq(TAPaperStruct::getExamId, examId).eq(TAPaperStruct::getCourseCode, effectiveCourseCode));// 该科目试题情况数据源
+
+            LinkedList<AnswerDetailBean> answerDetailDatasource = tbAnswerService.findValidAnswerDetailWithPap(examId, effectiveCourseCode);
+            Set<Long> paperTypeList = questionDatasource.stream().map(TAPaperStruct::getPaperId).collect(Collectors.toSet());
+
+            for (Long paperId : paperTypeList) {
+                for (TBCommonLevelConfig levelTemp : configLevelDatasource) {
+                    String interpret = levelTemp.getInterpret();
+                    String scope = levelTemp.getScope();
+
+                    List<TAPaperStruct> questionList = questionDatasource.stream()
+                            .filter(e -> paperId.equals(e.getPaperId()) && interpret.equals(e.getDifficult()))
+                            .collect(Collectors.toList()); // 题目信息
+
+                    List<AnswerDetailBean> answerDetailForSch = answerDetailDatasource.stream()
+                            .filter(e -> paperId.equals(e.getPaperId()) && interpret.equals(e.getDifficult()))
+                            .collect(Collectors.toList());
+
+                    double schAvgScoreRate = answerDetailForSch.stream()
+                            .collect(Collectors.summarizingDouble(AnswerDetailBean::getScoreRate))
+                            .getAverage();
+
+                    // 教师id集合
+                    List<Long> teacherIdList = taExamCourseRecordService.list(new QueryWrapper<TAExamCourseRecord>().lambda()
+                            .eq(TAExamCourseRecord::getExamId, examId)
+                            .eq(TAExamCourseRecord::getCourseCode, effectiveCourseCode)
+                            .eq(TAExamCourseRecord::getPaperId, paperId)
+                            .eq(TAExamCourseRecord::getAbsent, false)
+                            .eq(TAExamCourseRecord::getStudentCurrent, true))
+                            .stream()
+                            .map(TAExamCourseRecord::getTeacherId).distinct()
+                            .collect(Collectors.toList());
+
+                    for (Long teacherId : teacherIdList) {
+                        List<AnswerDetailBean> answerDetailForTea = answerDetailForSch.stream()
+                                .filter(e -> teacherId.equals(e.getTeacherId())).collect(Collectors.toList());
+
+                        double teaAvgScoreRate = answerDetailForTea.stream()
+                                .collect(Collectors.summarizingDouble(AnswerDetailBean::getScoreRate))
+                                .getAverage();
+
+                        // 得分率保留2位小数处理
+                        Integer count = questionList.size();
+
+                        TAExamCourseTeacherDifficult taExamCourseTeacherDifficult = new TAExamCourseTeacherDifficult();
+                        taExamCourseTeacherDifficult.setId(SystemConstant.getDbUuid());
+                        taExamCourseTeacherDifficult.setExamId(examId);
+                        taExamCourseTeacherDifficult.setPaperId(paperId);
+                        taExamCourseTeacherDifficult.setPaperType(tbPaperService.getById(paperId).getPaperType());
+                        taExamCourseTeacherDifficult.setCourseCode(effectiveCourseCode);
+                        taExamCourseTeacherDifficult.setCourseName(basicCourseService.findByCourseCode(effectiveCourseCode).getName());
+                        taExamCourseTeacherDifficult.setTeacherId(teacherId);
+                        taExamCourseTeacherDifficult.setTeacherName(sysUserService.getById(teacherId).getRealName());
+                        taExamCourseTeacherDifficult.setSchoolId(tbExamService.getById(examId).getSchoolId());
+                        taExamCourseTeacherDifficult.setInterpret(interpret);
+                        taExamCourseTeacherDifficult.setCount(count);
+                        taExamCourseTeacherDifficult.setScope(scope);
+                        taExamCourseTeacherDifficult.setSchAvgScoreRate(BigDecimal.valueOf(schAvgScoreRate));
+                        taExamCourseTeacherDifficult.setTeaAvgScoreRate(BigDecimal.valueOf(teaAvgScoreRate));
+
+                        taExamCourseTeacherDifficultList.add(taExamCourseTeacherDifficult);
+                    }
+                }
+            }
+
+            taExamCourseTeacherDifficultService.saveBatch(taExamCourseTeacherDifficultList);
+        }
+
+        return "'t_a_exam_course_teacher_difficult' 表构建完成";
+    }
+
     @Transactional(rollbackFor = Exception.class)
     @Override
     public String buildAnalyzeExamTotal(Long examId) {
@@ -1291,8 +1409,8 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
     private int handlePercentGrade(BigDecimal lowCount, BigDecimal sameCount, BigDecimal totalCount) {
         // ((lowCount + sameCount * 0.5) / totalCount) * 100
         BigDecimal percentGrade = (lowCount.add(sameCount.multiply(new BigDecimal("0.5"))))
-                .divide(totalCount, 4, BigDecimal.ROUND_HALF_DOWN).multiply(new BigDecimal("100"));
-        int result = percentGrade.setScale(0, BigDecimal.ROUND_HALF_DOWN).intValue();
+                .divide(totalCount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
+        int result = percentGrade.setScale(0, BigDecimal.ROUND_HALF_UP).intValue();
         if (result == 100) {
             result = 99;
         }
@@ -1361,7 +1479,7 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
         double lowCount = examRecordSameCol.stream().filter(e -> e.getAssignedScore().compareTo(taExamCourseRecord.getAssignedScore()) < 0).count();
         BigDecimal overCollegeRate;
         if (examRecordSameCol.size() > 1) {
-            overCollegeRate = BigDecimal.valueOf(lowCount).divide(BigDecimal.valueOf(examRecordSameCol.size() - 1), 4, BigDecimal.ROUND_HALF_DOWN);
+            overCollegeRate = BigDecimal.valueOf(lowCount).divide(BigDecimal.valueOf(examRecordSameCol.size() - 1), 4, BigDecimal.ROUND_HALF_UP);
         } else {
             overCollegeRate = BigDecimal.ONE;
         }

+ 81 - 3
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamCourseServiceImpl.java

@@ -6,23 +6,25 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.common.service.BasicCourseService;
 import com.qmth.teachcloud.common.util.ServletUtil;
+import com.qmth.teachcloud.report.business.bean.dto.query.BasicExamRecordDto;
 import com.qmth.teachcloud.report.business.bean.result.*;
 import com.qmth.teachcloud.report.business.entity.TAExamCourse;
 import com.qmth.teachcloud.report.business.entity.TAExamCourseRecord;
+import com.qmth.teachcloud.report.business.entity.TBPaper;
 import com.qmth.teachcloud.report.business.enums.PublishStatusEnum;
 import com.qmth.teachcloud.report.business.enums.SemesterEnum;
 import com.qmth.teachcloud.report.business.mapper.TAExamCourseMapper;
 import com.qmth.teachcloud.report.business.mapper.TAExamCourseRecordMapper;
-import com.qmth.teachcloud.report.business.service.ReportCommonService;
-import com.qmth.teachcloud.report.business.service.TAExamCourseService;
-import com.qmth.teachcloud.report.business.service.TBPaperStructService;
+import com.qmth.teachcloud.report.business.service.*;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -47,6 +49,18 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
     @Resource
     ReportCommonService reportCommonService;
 
+    @Resource
+    TBExamRecordService tbExamRecordService;
+
+    @Resource
+    TBExamCourseService tbExamCourseService;
+
+    @Resource
+    TBExamService tbExamService;
+
+    @Resource
+    BasicCourseService basicCourseService;
+
     /**
      * 开课课程考试总览列表接口
      *
@@ -244,4 +258,68 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
         QuestionInfoResult questionInfoResult = reportCommonService.findSituationOfQuestions(examId, courseCode, collegeId, questionDatasource);
         return questionInfoResult;
     }
+
+    @Override
+    public TrialCalculationResult trialCalculate(Long examId, String courseCode) {
+        List<String> courseCodeList = new ArrayList<>();
+        courseCodeList.add(courseCode);
+
+//        // 数据同步操作
+//        // 获取当前课程下所有学生考试成绩记录
+//        List<BasicExamRecordDto> basicExamRecordDtoDatasource = tbExamRecordService.findByExamIdAndCourseCodeS(examId, courseCodeList);
+//        for (String s : courseCodeList) {
+//            if (tbExamCourseService.verifyExamCourseCantRun(examId, tbExamService.getById(examId).getSchoolId(), s, basicCourseService.findByCourseCode(s).getName())) {
+//                throw ExceptionResultEnum.ERROR.exception("课程编号[" + s + "]的课程分析数据已测试或发布,不能变更基础数据");
+//            }
+//            List<BasicExamRecordDto> basicExamRecordDtoList = basicExamRecordDtoDatasource.stream()
+//                    .filter(e -> s.equals(e.getCourseCode())).collect(Collectors.toList());
+//            if (basicExamRecordDtoList.size() > 0) {
+//                // 迁移数据至't_a_exam_course_record'
+//                List<TAExamCourseRecord> taExamCourseRecordList = new ArrayList<>();
+//                for (BasicExamRecordDto basicExamRecordDto : basicExamRecordDtoList) {
+//                    boolean absent = basicExamRecordDto.getAbsent();
+//                    // 正常公式赋分操作
+//                    Long paperId = basicExamRecordDto.getPaperId();
+//                    TBPaper tbPaper = tbPaperService.getById(paperId);
+//                    if (Objects.isNull(tbPaper)) {
+//                        throw ExceptionResultEnum.ERROR.exception("试卷信息数据异常");
+//                    }
+//                    BigDecimal fullScore = tbPaper.getTotalScore();
+//                    BigDecimal myScore = basicExamRecordDto.getTotalScore();
+//                    BigDecimal coefficient = tbPaper.getCoefficient();
+//                    BigDecimal assignScore;
+//                    // 当该试卷的赋分系数不为0时赋分
+//                    if (coefficient != null && coefficient.compareTo(BigDecimal.ZERO) > 0 && !absent) {
+//                        assignScore = myScore.add((fullScore.subtract(myScore)).divide(coefficient, 0, BigDecimal.ROUND_HALF_UP));
+//                    } else {
+//                        assignScore = myScore;
+//                    }
+//
+//                    TAExamCourseRecord taExamCourseRecord = new TAExamCourseRecord();
+//                    taExamCourseRecord.setId(SystemConstant.getDbUuid());
+//                    taExamCourseRecord.setExamRecordId(basicExamRecordDto.getTbExamRecordId());
+//                    // 数据同步默认赋分成绩为卷面成绩
+//                    taExamCourseRecord.setSchoolId(tbExamService.getById(examId).getSchoolId());
+//                    taExamCourseRecord.setAssignedScore(assignScore);
+//                    taExamCourseRecord.setExamId(examId);
+//                    taExamCourseRecord.setCourseCode(basicExamRecordDto.getCourseCode());
+//                    taExamCourseRecord.setPaperId(basicExamRecordDto.getPaperId());
+//                    taExamCourseRecord.setPaperType(basicExamRecordDto.getPaperType());
+//                    taExamCourseRecord.setStudentId(basicExamRecordDto.getStudentId());
+//                    taExamCourseRecord.setStudentCode(basicExamRecordDto.getStudentCode());
+//                    taExamCourseRecord.setTeacherId(basicExamRecordDto.getTeacherId());
+//                    taExamCourseRecord.setClazzId(basicExamRecordDto.getClazzId());
+//                    taExamCourseRecord.setTeachCollegeId(basicExamRecordDto.getTeachCollegeId());
+//                    taExamCourseRecord.setInspectCollegeId(basicExamRecordDto.getInspectCollegeId());
+//                    taExamCourseRecord.setMajorId(basicExamRecordDto.getMajorId());
+//                    taExamCourseRecord.setTotalScore(myScore);
+//                    taExamCourseRecord.setAbsent(absent);
+//                    taExamCourseRecord.setStudentCurrent(basicExamRecordDto.getStudentCurrent());
+//                    taExamCourseRecordList.add(taExamCourseRecord);
+//                }
+//                taExamCourseRecordService.saveBatch(taExamCourseRecordList);
+//            }
+//        }
+        return null;
+    }
 }

+ 27 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamCourseTeacherDioServiceImpl.java

@@ -1,10 +1,19 @@
 package com.qmth.teachcloud.report.business.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.report.business.entity.TAExamCourseCollegeInspectDio;
 import com.qmth.teachcloud.report.business.entity.TAExamCourseTeacherDio;
+import com.qmth.teachcloud.report.business.mapper.TAExamCourseCollegeInspectDioMapper;
 import com.qmth.teachcloud.report.business.mapper.TAExamCourseTeacherDioMapper;
 import com.qmth.teachcloud.report.business.service.TAExamCourseTeacherDioService;
+import com.qmth.teachcloud.report.business.service.TBExamService;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
 
 /**
  * <p>
@@ -16,5 +25,23 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class TAExamCourseTeacherDioServiceImpl extends ServiceImpl<TAExamCourseTeacherDioMapper, TAExamCourseTeacherDio> implements TAExamCourseTeacherDioService {
+    @Resource
+    private TAExamCourseTeacherDioMapper taExamCourseTeacherDioMapper;
+    @Resource
+    private TBExamService tbExamService;
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void insertByTAExamCourseRecordDio(Long examId, String courseCode) {
+        if (examId == 0 || courseCode == null || courseCode.length() == 0) {
+            throw ExceptionResultEnum.ERROR.exception("参数异常");
+        }
+        List<TAExamCourseTeacherDio> taExamCourseTeacherDioList = taExamCourseTeacherDioMapper.findByTAExamCourseRecordDio(examId, courseCode);
+        for (TAExamCourseTeacherDio taExamCourseTeacherDio : taExamCourseTeacherDioList) {
+            taExamCourseTeacherDio.setSchoolId(tbExamService.getById(taExamCourseTeacherDio.getExamId()).getSchoolId());
+            taExamCourseTeacherDio.setId(SystemConstant.getDbUuid());
+        }
+        this.saveBatch(taExamCourseTeacherDioList);
+    }
 
 }

+ 24 - 0
teachcloud-report-business/src/main/resources/mapper/TAExamCourseTeacherDioMapper.xml

@@ -2,4 +2,28 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.teachcloud.report.business.mapper.TAExamCourseTeacherDioMapper">
 
+    <select id="findByTAExamCourseRecordDio"
+            resultType="com.qmth.teachcloud.report.business.entity.TAExamCourseTeacherDio">
+        SELECT
+            exam_id AS examId,
+            course_code AS courseCode,
+            MAX(course_name) AS courseName,
+            teacher_id AS teacherId,
+            MAX(teacher_name) AS teacherName,
+            dimension_type AS dimensionType,
+            dimension_code AS dimensionCode,
+            AVG(student_score) AS avgScore,
+            AVG(score_rate) AS scoreRate
+        FROM
+            t_a_exam_course_record_dio
+        <where>
+            <if test="examId > 0">
+                and exam_id = #{examId}
+            </if>
+            <if test="courseCode != null and courseCode.length > 0">
+                and course_code = #{courseCode}
+            </if>
+        </where>
+        GROUP BY exam_id , course_code , teacher_id , dimension_type , dimension_code;
+    </select>
 </mapper>

+ 4 - 1
teachcloud-report-business/src/main/resources/mapper/TBAnswerMapper.xml

@@ -82,6 +82,8 @@
     <select id="findValidAnswerDetailWithPap"
             resultType="com.qmth.teachcloud.report.business.bean.dto.AnswerDetailBean">
         SELECT
+            user.id AS teacherId,
+            user.real_name AS teacherName,
             college.id AS collegeId,
             struct.paper_id AS paperId,
             record.paper_type AS paperType,
@@ -91,8 +93,9 @@
         FROM
             t_b_answer answer
                 INNER JOIN t_a_exam_course_record record ON answer.exam_record_id = record.exam_record_id
-                INNER JOIN t_a_paper_struct struct ON record.paper_id = struct.paper_id
+                INNER JOIN sys_user user ON record.teacher_id = user.id
                 INNER JOIN sys_org college ON record.inspect_college_id = college.id
+                INNER JOIN t_a_paper_struct struct ON record.paper_id = struct.paper_id
                 AND answer.number_type = struct.number_type
                 AND answer.main_number = struct.big_question_number
                 AND answer.sub_number = struct.small_question_number

+ 4 - 4
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/BasicDatasourceController.java

@@ -728,11 +728,11 @@ public class BasicDatasourceController {
                     BigDecimal assignScore;
                     // 当该试卷的赋分系数不为0时赋分
                     if (coefficient != null && coefficient.compareTo(BigDecimal.ZERO) > 0 && !absent) {
-                        assignScore = myScore.add(fullScore.subtract(myScore).divide(coefficient, 0, BigDecimal.ROUND_HALF_DOWN));
+                        assignScore = myScore.add((fullScore.subtract(myScore)).divide(coefficient, 4, BigDecimal.ROUND_HALF_UP));
                     } else {
                         assignScore = myScore;
                     }
-
+                    assignScore = assignScore.setScale(0,BigDecimal.ROUND_HALF_UP);
                     TAExamCourseRecord taExamCourseRecord = new TAExamCourseRecord();
                     taExamCourseRecord.setId(SystemConstant.getDbUuid());
                     taExamCourseRecord.setExamRecordId(basicExamRecordDto.getTbExamRecordId());
@@ -797,11 +797,11 @@ public class BasicDatasourceController {
                     BigDecimal coefficient = tbPaper.getCoefficient();
                     BigDecimal assignScore;
                     if (coefficient != null && coefficient.compareTo(BigDecimal.ZERO) > 0 && !basicExamRecordDto.getAbsent()) {
-                        assignScore = myScore.add(fullScore.subtract(myScore).divide(coefficient, 0, BigDecimal.ROUND_HALF_DOWN));
+                        assignScore = myScore.add(fullScore.subtract(myScore).divide(coefficient, 4, BigDecimal.ROUND_HALF_UP));
                     } else {
                         assignScore = myScore;
                     }
-
+                    assignScore = assignScore.setScale(0,BigDecimal.ROUND_HALF_UP);
                     TAExamCourseRecord taExamCourseRecord = new TAExamCourseRecord();
                     taExamCourseRecord.setId(SystemConstant.getDbUuid());
                     taExamCourseRecord.setExamRecordId(basicExamRecordDto.getTbExamRecordId());

+ 2 - 0
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/DataAnalyzeController.java

@@ -41,8 +41,10 @@ public class DataAnalyzeController {
         analyzeForReportService.buildAnalyzeExamCourseClazz(examId, courseCode);
         analyzeForReportService.AnalyzePointScoreRate(examId, courseCode);
         analyzeForReportService.buildAnalyzeExamCourseCollegeInspectDio(examId, courseCode);
+        analyzeForReportService.buildAnalyzeExamCourseTeacherDio(examId, courseCode);
         analyzeForReportService.buildAnalyzePaperStruct(examId, courseCode);
         analyzeForReportService.buildExamPaperDifficult(examId, courseCode);
+        analyzeForReportService.buildExamPaperTeacherDifficult(examId, courseCode);
         analyzeForReportService.buildAnalyzeExamTotal(examId);
         analyzeForReportService.buildAnalyzeExamCourseCollegeTeacher(examId, courseCode);
         analyzeForReportService.buildAnalyzeExamCourseTeacher(examId, courseCode);

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

@@ -71,8 +71,7 @@ public class AnalyzeForStudentServiceTest {
     @Test
     public void buildExamPaperDifficult(){
         Long examId = 1L;
-        String courseCode = "1013";
-        System.out.println(analyzeForReportService.buildExamPaperDifficult(examId,courseCode));
+        System.out.println(analyzeForReportService.buildExamPaperDifficult(examId,null));
     }
 
     @Test
@@ -95,6 +94,16 @@ public class AnalyzeForStudentServiceTest {
         System.out.println(analyzeForReportService.buildAnalyzeExamCourseTeacher(examId,courseCode));
     }
 
+    @Test
+    public void temp(){
+        Long examId = 1L;
+        analyzeForReportService.buildAnalyzeExamCourseTeacherDio(examId,null);
+        analyzeForReportService.buildExamPaperTeacherDifficult(examId,null);
+    }
+
+
+
+
     @Test
     public void finishCalculate(){
         Long examId = 1L;