wangliang 4 gadi atpakaļ
vecāks
revīzija
f8c9f0b8b7

+ 83 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/CellResult.java

@@ -0,0 +1,83 @@
+package com.qmth.teachcloud.report.business.bean.result;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @Description: CellResult
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/6/11
+ */
+public class CellResult implements Serializable {
+
+    @ApiModelProperty(value = "简介")
+    private String interpret;
+
+    @ApiModelProperty(value = "分数")
+    private String scope;
+
+    @ApiModelProperty(value = "学院平均分得分率")
+    private Double colAvgScoreRate;
+
+    @ApiModelProperty(value = "学校平均分得分率")
+    private Double schAvgScoreRate;
+
+    @ApiModelProperty(value = "计数")
+    private Integer count;
+
+    public CellResult() {
+
+    }
+
+    public CellResult(String interpret, String scope, Double colAvgScoreRate, Double schAvgScoreRate, Integer count) {
+        this.interpret = interpret;
+        this.scope = scope;
+        this.colAvgScoreRate = colAvgScoreRate;
+        this.schAvgScoreRate = schAvgScoreRate;
+        this.count = count;
+    }
+
+    public String getInterpret() {
+        return interpret;
+    }
+
+    public void setInterpret(String interpret) {
+        this.interpret = interpret;
+    }
+
+    public String getScope() {
+        return scope;
+    }
+
+    public void setScope(String scope) {
+        this.scope = scope;
+    }
+
+    public Double getColAvgScoreRate() {
+        return colAvgScoreRate;
+    }
+
+    public void setColAvgScoreRate(Double colAvgScoreRate) {
+        this.colAvgScoreRate = colAvgScoreRate;
+    }
+
+    public Double getSchAvgScoreRate() {
+        return schAvgScoreRate;
+    }
+
+    public void setSchAvgScoreRate(Double schAvgScoreRate) {
+        this.schAvgScoreRate = schAvgScoreRate;
+    }
+
+    public Integer getCount() {
+        return count;
+    }
+
+    public void setCount(Integer count) {
+        this.count = count;
+    }
+}

+ 47 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/PaperTypeResult.java

@@ -0,0 +1,47 @@
+package com.qmth.teachcloud.report.business.bean.result;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @Description: PaperTypeResult
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/6/11
+ */
+public class PaperTypeResult implements Serializable {
+
+    @ApiModelProperty(value = "卷型")
+    private String paperType;
+
+    @ApiModelProperty(value = "cellList")
+    private List<CellResult> cellList;
+
+    public PaperTypeResult() {
+
+    }
+
+    public PaperTypeResult(String paperType, List<CellResult> cellList) {
+        this.paperType = paperType;
+        this.cellList = cellList;
+    }
+
+    public String getPaperType() {
+        return paperType;
+    }
+
+    public void setPaperType(String paperType) {
+        this.paperType = paperType;
+    }
+
+    public List<CellResult> getCellList() {
+        return cellList;
+    }
+
+    public void setCellList(List<CellResult> cellList) {
+        this.cellList = cellList;
+    }
+}

+ 35 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/QuestionInfoResult.java

@@ -0,0 +1,35 @@
+package com.qmth.teachcloud.report.business.bean.result;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @Description: QuestionInfoResult
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/6/11
+ */
+public class QuestionInfoResult implements Serializable {
+
+    @ApiModelProperty(value = "questionInfoList")
+    private List<PaperTypeResult> questionInfoList;
+
+    public QuestionInfoResult() {
+
+    }
+
+    public QuestionInfoResult(List<PaperTypeResult> questionInfoList) {
+        this.questionInfoList = questionInfoList;
+    }
+
+    public List<PaperTypeResult> getQuestionInfoList() {
+        return questionInfoList;
+    }
+
+    public void setQuestionInfoList(List<PaperTypeResult> questionInfoList) {
+        this.questionInfoList = questionInfoList;
+    }
+}

+ 17 - 3
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/TBAnswerResult.java

@@ -1,5 +1,7 @@
 package com.qmth.teachcloud.report.business.bean.result;
 package com.qmth.teachcloud.report.business.bean.result;
 
 
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
@@ -18,7 +20,7 @@ public class TBAnswerResult implements Serializable {
     private String paperType;
     private String paperType;
 
 
     @ApiModelProperty(value = "得分率")
     @ApiModelProperty(value = "得分率")
-    private BigDecimal scoreRate;
+    private Double scoreRate;
 
 
     @ApiModelProperty(value = "难度")
     @ApiModelProperty(value = "难度")
     private String difficult;
     private String difficult;
@@ -26,6 +28,18 @@ public class TBAnswerResult implements Serializable {
     @ApiModelProperty(value = "学院名称")
     @ApiModelProperty(value = "学院名称")
     private String collegeName;
     private String collegeName;
 
 
+    @ApiModelProperty(value = "学院名称")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long collegeId;
+
+    public Long getCollegeId() {
+        return collegeId;
+    }
+
+    public void setCollegeId(Long collegeId) {
+        this.collegeId = collegeId;
+    }
+
     public String getPaperType() {
     public String getPaperType() {
         return paperType;
         return paperType;
     }
     }
@@ -34,11 +48,11 @@ public class TBAnswerResult implements Serializable {
         this.paperType = paperType;
         this.paperType = paperType;
     }
     }
 
 
-    public BigDecimal getScoreRate() {
+    public Double getScoreRate() {
         return scoreRate;
         return scoreRate;
     }
     }
 
 
-    public void setScoreRate(BigDecimal scoreRate) {
+    public void setScoreRate(Double scoreRate) {
         this.scoreRate = scoreRate;
         this.scoreRate = scoreRate;
     }
     }
 
 

+ 21 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/ReportCommonService.java

@@ -3,6 +3,7 @@ package com.qmth.teachcloud.report.business.service;
 import com.qmth.teachcloud.report.business.bean.result.CollegeAndSchoolGradeDistributionResult;
 import com.qmth.teachcloud.report.business.bean.result.CollegeAndSchoolGradeDistributionResult;
 import com.qmth.teachcloud.report.business.bean.result.CourseInfoResult;
 import com.qmth.teachcloud.report.business.bean.result.CourseInfoResult;
 import com.qmth.teachcloud.report.business.bean.result.DimensionAnalyzeResult;
 import com.qmth.teachcloud.report.business.bean.result.DimensionAnalyzeResult;
+import com.qmth.teachcloud.report.business.bean.result.QuestionInfoResult;
 
 
 /**
 /**
  * @Description: 教研公共服务
  * @Description: 教研公共服务
@@ -42,4 +43,24 @@ public interface ReportCommonService {
      * @return
      * @return
      */
      */
     DimensionAnalyzeResult findDimensionInfo(Long examId, String courseCode, Long collegeId);
     DimensionAnalyzeResult findDimensionInfo(Long examId, String courseCode, Long collegeId);
+
+    /**
+     * 查找题目相关
+     *
+     * @param examId
+     * @param courseCode
+     * @param collegeId
+     * @return
+     */
+    QuestionInfoResult findSituationOfQuestions(Long examId, String courseCode, Long collegeId);
+
+    /**
+     * 查找老师信息
+     *
+     * @param examId
+     * @param courseCode
+     * @param collegeId
+     * @return
+     */
+    Object findTeacherInfo(Long examId, String courseCode, Long collegeId);
 }
 }

+ 77 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/ReportCommonServiceImpl.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.gson.Gson;
 import com.google.gson.Gson;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.report.business.bean.result.*;
 import com.qmth.teachcloud.report.business.bean.result.*;
+import com.qmth.teachcloud.report.business.entity.TBCommonLevelConfig;
 import com.qmth.teachcloud.report.business.entity.TBPaper;
 import com.qmth.teachcloud.report.business.entity.TBPaper;
 import com.qmth.teachcloud.report.business.enums.GradeScopeEnum;
 import com.qmth.teachcloud.report.business.enums.GradeScopeEnum;
 import com.qmth.teachcloud.report.business.enums.PiecewiseScopeEnum;
 import com.qmth.teachcloud.report.business.enums.PiecewiseScopeEnum;
@@ -15,7 +16,10 @@ import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 /**
 /**
@@ -41,6 +45,15 @@ public class ReportCommonServiceImpl implements ReportCommonService {
     @Resource
     @Resource
     TBDimensionService tbDimensionService;
     TBDimensionService tbDimensionService;
 
 
+    @Resource
+    TBCommonLevelConfigService tbCommonLevelConfigService;
+
+    @Resource
+    TBPaperStructService tbPaperStructService;
+
+    @Resource
+    TBAnswerService tbAnswerService;
+
     /**
     /**
      * 学院学科报表查询科目信息
      * 学院学科报表查询科目信息
      *
      *
@@ -235,4 +248,67 @@ public class ReportCommonServiceImpl implements ReportCommonService {
         }
         }
         return new DimensionAnalyzeResult(dimensionAnalyzeList);
         return new DimensionAnalyzeResult(dimensionAnalyzeList);
     }
     }
+
+    /**
+     * 查找题目相关
+     *
+     * @param examId
+     * @param courseCode
+     * @param collegeId
+     * @return
+     */
+    @Override
+    public QuestionInfoResult findSituationOfQuestions(Long examId, String courseCode, Long collegeId) {
+        //查找难易度
+        QueryWrapper<TBCommonLevelConfig> tbCommonLevelConfigQueryWrapper = new QueryWrapper<>();
+        tbCommonLevelConfigQueryWrapper.lambda().eq(TBCommonLevelConfig::getExamId, examId)
+                .eq(TBCommonLevelConfig::getCourseCode, courseCode)
+                .eq(TBCommonLevelConfig::getLevelType, "难度等级");
+        List<TBCommonLevelConfig> configLevelDatasource = tbCommonLevelConfigService.list(tbCommonLevelConfigQueryWrapper);
+        //查找试卷结构
+        List<TBPaperStructResult> questionDatasource = tbPaperStructService.findQuestionInfo(examId, courseCode);
+        //查找答题记录
+        List<TBAnswerResult> answerDetailDatasource = tbAnswerService.findValidAnswerDetail(examId, courseCode);
+        Set<String> paperTypeList = questionDatasource.stream().map(e -> e.getPaperType()).collect(Collectors.toSet());
+        List<PaperTypeResult> questionInfoList = new ArrayList<>();
+        for (String paperType : paperTypeList) {
+            List<CellResult> cellList = new ArrayList<>();
+            for (TBCommonLevelConfig tbCommonLevelConfig : configLevelDatasource) {
+                String interpret = tbCommonLevelConfig.getInterpret();
+                String scope = tbCommonLevelConfig.getScope();
+
+                Integer count = questionDatasource.parallelStream()
+                        .filter(e -> paperType.equals(e.getPaperType()) && interpret.equals(e.getDifficult()))
+                        .collect(Collectors.toList()).size(); // 题目信息
+                List<TBAnswerResult> answerDetailForSch = answerDetailDatasource.parallelStream()
+                        .filter(e -> paperType.equals(e.getPaperType()) && interpret.equals(e.getDifficult()))
+                        .collect(Collectors.toList());
+                double colAvgScoreRate = answerDetailForSch.parallelStream()
+                        .filter(e -> collegeId.longValue() == e.getCollegeId()).collect(Collectors.toList())
+                        .parallelStream().collect(Collectors.averagingDouble(s -> s.getScoreRate()));
+                double schAvgScoreRate = answerDetailForSch.parallelStream()
+                        .collect(Collectors.averagingDouble(e -> e.getScoreRate()));
+
+                // 得分率保留2位小数处理
+                colAvgScoreRate = MathUtil.formatDouble2(colAvgScoreRate * 100);
+                schAvgScoreRate = MathUtil.formatDouble2(schAvgScoreRate * 100);
+                cellList.add(new CellResult(interpret, scope, colAvgScoreRate, schAvgScoreRate, count));
+            }
+            questionInfoList.add(new PaperTypeResult(paperType, cellList));
+        }
+        return new QuestionInfoResult(questionInfoList);
+    }
+
+    /**
+     * 查找老师信息
+     *
+     * @param examId
+     * @param courseCode
+     * @param collegeId
+     * @return
+     */
+    @Override
+    public Object findTeacherInfo(Long examId, String courseCode, Long collegeId) {
+        return null;
+    }
 }
 }

+ 17 - 14
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamCourseServiceImpl.java

@@ -167,25 +167,28 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
         CourseInfoResult courseInfoResult = reportCommonService.findCourseInfo(examId, courseCode, sysUser.getOrgId());
         CourseInfoResult courseInfoResult = reportCommonService.findCourseInfo(examId, courseCode, sysUser.getOrgId());
         //学院学科报表科目描述
         //学院学科报表科目描述
         CollegeAndSchoolGradeDistributionResult collegeAndSchoolGradeDistributionResult = reportCommonService.findCourseDistribution(examId, courseCode, sysUser.getOrgId());
         CollegeAndSchoolGradeDistributionResult collegeAndSchoolGradeDistributionResult = reportCommonService.findCourseDistribution(examId, courseCode, sysUser.getOrgId());
+        //学院学科报表维度查询
         DimensionAnalyzeResult dimensionAnalyzeResult = reportCommonService.findDimensionInfo(examId, courseCode, sysUser.getOrgId());
         DimensionAnalyzeResult dimensionAnalyzeResult = reportCommonService.findDimensionInfo(examId, courseCode, sysUser.getOrgId());
 //        //查找维度
 //        //查找维度
 //        List<CourseDimensionResult> courseDimensionResultList = tbDimensionService.findDimensionInfo(examId, courseCode, sysUser.getOrgId());
 //        List<CourseDimensionResult> courseDimensionResultList = tbDimensionService.findDimensionInfo(examId, courseCode, sysUser.getOrgId());
 
 
-        //查找难易度
-        QueryWrapper<TBCommonLevelConfig> tbCommonLevelConfigQueryWrapper = new QueryWrapper<>();
-        tbCommonLevelConfigQueryWrapper.lambda().eq(TBCommonLevelConfig::getExamId, examId)
-                .eq(TBCommonLevelConfig::getCourseCode, courseCode)
-                .eq(TBCommonLevelConfig::getLevelType, "难度等级");
-        List<TBCommonLevelConfig> tbCommonLevelConfigList = tbCommonLevelConfigService.list(tbCommonLevelConfigQueryWrapper);
-
-        //查找试卷结构
-        List<TBPaperStructResult> tbPaperStructList = tbPaperStructService.findQuestionInfo(examId, courseCode);
-
-        //查找答题记录
-        List<TBAnswerResult> tbAnswerResultList = tbAnswerService.findValidAnswerDetail(examId, courseCode);
+//        //查找难易度
+//        QueryWrapper<TBCommonLevelConfig> tbCommonLevelConfigQueryWrapper = new QueryWrapper<>();
+//        tbCommonLevelConfigQueryWrapper.lambda().eq(TBCommonLevelConfig::getExamId, examId)
+//                .eq(TBCommonLevelConfig::getCourseCode, courseCode)
+//                .eq(TBCommonLevelConfig::getLevelType, "难度等级");
+//        List<TBCommonLevelConfig> tbCommonLevelConfigList = tbCommonLevelConfigService.list(tbCommonLevelConfigQueryWrapper);
+//
+//        //查找试卷结构
+//        List<TBPaperStructResult> tbPaperStructList = tbPaperStructService.findQuestionInfo(examId, courseCode);
+//
+//        //查找答题记录
+//        List<TBAnswerResult> tbAnswerResultList = tbAnswerService.findValidAnswerDetail(examId, courseCode);
+        //查找题目信息
+        QuestionInfoResult questionInfoResult = reportCommonService.findSituationOfQuestions(examId, courseCode, sysUser.getOrgId());
 
 
-        //查找老师得分
-        List<TAExamCourseTeacherResult> taExamCourseTeacherResultList = taExamCourseCollegeTeacherService.findTeacherInfo(examId, courseCode, sysUser.getOrgId());
+//        查找老师得分
+//        List<TAExamCourseTeacherResult> taExamCourseTeacherResultList = taExamCourseCollegeTeacherService.findTeacherInfo(examId, courseCode, sysUser.getOrgId());
 
 
         //查找维度
         //查找维度
         QueryWrapper<TBDimension> tbDimensionQueryWrapper = new QueryWrapper<>();
         QueryWrapper<TBDimension> tbDimensionQueryWrapper = new QueryWrapper<>();

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

@@ -56,7 +56,8 @@
             tik.paper_type AS paperType,
             tik.paper_type AS paperType,
             det.score / tbps.full_score AS scoreRate,
             det.score / tbps.full_score AS scoreRate,
             pap.difficult AS difficult,
             pap.difficult AS difficult,
-            (select so.name from sys_org so where so.id = tik.inspect_college_id) AS collegeName
+            (select so.name from sys_org so where so.id = tik.inspect_college_id) AS collegeName,
+            tik.inspect_college_id AS collegeId
         FROM
         FROM
             t_b_answer det
             t_b_answer det
         INNER JOIN t_a_exam_course_record tik ON
         INNER JOIN t_a_exam_course_record tik ON