Kaynağa Gözat

Merge branch 'dev_v2.1.0' of http://git.qmth.com.cn/wangliang/distributed-print-service into dev_v2.1.0

xiaof 4 yıl önce
ebeveyn
işleme
78086a4aa1
17 değiştirilmiş dosya ile 511 ekleme ve 68 silme
  1. 4 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/ExceptionResultEnum.java
  2. 46 0
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/CourseInfoResult.java
  3. 46 0
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/DescriptiveStatisticsResult.java
  4. 60 0
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/ExamRecordResult.java
  5. 16 0
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/TAExamCourseCollegeInspectResult.java
  6. 29 0
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/TBPaperInfoResult.java
  7. 10 1
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/mapper/TAExamCourseCollegeInspectMapper.java
  8. 10 0
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/mapper/TAExamCourseRecordMapper.java
  9. 22 0
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/ReportCommonService.java
  10. 10 1
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/TAExamCourseCollegeInspectService.java
  11. 11 0
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/TAExamCourseRecordService.java
  12. 86 0
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/ReportCommonServiceImpl.java
  13. 13 1
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamCourseCollegeInspectServiceImpl.java
  14. 18 0
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamCourseRecordServiceImpl.java
  15. 22 11
      teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamCourseServiceImpl.java
  16. 29 0
      teachcloud-report-business/src/main/resources/mapper/TAExamCourseCollegeInspectMapper.xml
  17. 79 54
      teachcloud-report-business/src/main/resources/mapper/TAExamCourseRecordMapper.xml

+ 4 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/enums/ExceptionResultEnum.java

@@ -77,6 +77,10 @@ public enum ExceptionResultEnum {
 
     EXAM_TASK_IS_NULL(HttpStatus.INTERNAL_SERVER_ERROR, 50000029, "命题任务为空"),
 
+    NO_DATA(HttpStatus.INTERNAL_SERVER_ERROR, 5000030, "没有数据"),
+
+    DATA_COUNT_EXCEPTION(HttpStatus.INTERNAL_SERVER_ERROR, 5000031, "得到的数据条数异常,应该有且仅有一条数据"),
+
     /**
      * 401
      */

+ 46 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/CourseInfoResult.java

@@ -0,0 +1,46 @@
+package com.qmth.teachcloud.report.business.bean.result;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: CourseInfoResult
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/6/10
+ */
+public class CourseInfoResult implements Serializable {
+
+    @ApiModelProperty(value = "试卷result")
+    private TBPaperInfoResult courseProfile;
+
+    @ApiModelProperty(value = "DescriptiveStatisticsResult")
+    private DescriptiveStatisticsResult descriptiveStatistics;
+
+    public CourseInfoResult() {
+
+    }
+
+    public CourseInfoResult(TBPaperInfoResult courseProfile, DescriptiveStatisticsResult descriptiveStatistics) {
+        this.courseProfile = courseProfile;
+        this.descriptiveStatistics = descriptiveStatistics;
+    }
+
+    public TBPaperInfoResult getCourseProfile() {
+        return courseProfile;
+    }
+
+    public void setCourseProfile(TBPaperInfoResult courseProfile) {
+        this.courseProfile = courseProfile;
+    }
+
+    public DescriptiveStatisticsResult getDescriptiveStatistics() {
+        return descriptiveStatistics;
+    }
+
+    public void setDescriptiveStatistics(DescriptiveStatisticsResult descriptiveStatistics) {
+        this.descriptiveStatistics = descriptiveStatistics;
+    }
+}

+ 46 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/DescriptiveStatisticsResult.java

@@ -0,0 +1,46 @@
+package com.qmth.teachcloud.report.business.bean.result;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: DescriptiveStatisticsResult
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/6/10
+ */
+public class DescriptiveStatisticsResult implements Serializable {
+
+    @ApiModelProperty(value = "学院result")
+    private TAExamCourseCollegeInspectResult collegeDescriptiveStatistics;
+
+    @ApiModelProperty(value = "学校result")
+    private TAExamCourseCollegeInspectResult schoolDescriptiveStatistics;
+
+    public DescriptiveStatisticsResult() {
+
+    }
+
+    public DescriptiveStatisticsResult(TAExamCourseCollegeInspectResult collegeDescriptiveStatistics, TAExamCourseCollegeInspectResult schoolDescriptiveStatistics) {
+        this.collegeDescriptiveStatistics = collegeDescriptiveStatistics;
+        this.schoolDescriptiveStatistics = schoolDescriptiveStatistics;
+    }
+
+    public TAExamCourseCollegeInspectResult getCollegeDescriptiveStatistics() {
+        return collegeDescriptiveStatistics;
+    }
+
+    public void setCollegeDescriptiveStatistics(TAExamCourseCollegeInspectResult collegeDescriptiveStatistics) {
+        this.collegeDescriptiveStatistics = collegeDescriptiveStatistics;
+    }
+
+    public TAExamCourseCollegeInspectResult getSchoolDescriptiveStatistics() {
+        return schoolDescriptiveStatistics;
+    }
+
+    public void setSchoolDescriptiveStatistics(TAExamCourseCollegeInspectResult schoolDescriptiveStatistics) {
+        this.schoolDescriptiveStatistics = schoolDescriptiveStatistics;
+    }
+}

+ 60 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/ExamRecordResult.java

@@ -0,0 +1,60 @@
+package com.qmth.teachcloud.report.business.bean.result;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @Description: ExamRecordResult
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/6/10
+ */
+public class ExamRecordResult implements Serializable {
+
+    @ApiModelProperty(value = "考生准考证号")
+    private String ticketNumber;
+
+    @ApiModelProperty(value = "学院名称")
+    private String collegeName;
+
+    @ApiModelProperty(value = "赋分分数")
+    private BigDecimal assignedScore;
+
+    @ApiModelProperty(value = "百分位等级")
+    private BigDecimal percentGrade;
+
+    public String getTicketNumber() {
+        return ticketNumber;
+    }
+
+    public void setTicketNumber(String ticketNumber) {
+        this.ticketNumber = ticketNumber;
+    }
+
+    public String getCollegeName() {
+        return collegeName;
+    }
+
+    public void setCollegeName(String collegeName) {
+        this.collegeName = collegeName;
+    }
+
+    public BigDecimal getAssignedScore() {
+        return assignedScore;
+    }
+
+    public void setAssignedScore(BigDecimal assignedScore) {
+        this.assignedScore = assignedScore;
+    }
+
+    public BigDecimal getPercentGrade() {
+        return percentGrade;
+    }
+
+    public void setPercentGrade(BigDecimal percentGrade) {
+        this.percentGrade = percentGrade;
+    }
+}

+ 16 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/TAExamCourseCollegeInspectResult.java

@@ -1,6 +1,8 @@
 package com.qmth.teachcloud.report.business.bean.result;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.teachcloud.report.business.entity.TAExamCourseCollegeInspect;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -16,9 +18,23 @@ import java.io.Serializable;
 @JsonInclude(JsonInclude.Include.NON_NULL)
 public class TAExamCourseCollegeInspectResult extends TAExamCourseCollegeInspect implements Serializable {
 
+    @ApiModelProperty(value = "学院id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long collegeId;
+
     @ApiModelProperty(value = "学院名称")
     private String collegeName;
 
+    @Override
+    public Long getCollegeId() {
+        return collegeId;
+    }
+
+    @Override
+    public void setCollegeId(Long collegeId) {
+        this.collegeId = collegeId;
+    }
+
     public String getCollegeName() {
         return collegeName;
     }

+ 29 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/TBPaperInfoResult.java

@@ -0,0 +1,29 @@
+package com.qmth.teachcloud.report.business.bean.result;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.qmth.teachcloud.report.business.entity.TBPaper;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: TBPaperInfoResult
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/6/10
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class TBPaperInfoResult extends TBPaper implements Serializable {
+
+    @ApiModelProperty(value = "学院数量")
+    private Integer collegeCount;
+
+    public Integer getCollegeCount() {
+        return collegeCount;
+    }
+
+    public void setCollegeCount(Integer collegeCount) {
+        this.collegeCount = collegeCount;
+    }
+}

+ 10 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/mapper/TAExamCourseCollegeInspectMapper.java

@@ -18,11 +18,20 @@ import java.util.List;
 public interface TAExamCourseCollegeInspectMapper extends BaseMapper<TAExamCourseCollegeInspect> {
 
     /**
-     * 查找科目维度
+     * 查找学院科目维度
      *
      * @param examId
      * @param courseCode
      * @return
      */
     List<TAExamCourseCollegeInspectResult> findCourseDescriptiveStatisticsForCollege(@Param("examId") Long examId, @Param("courseCode") String courseCode);
+
+    /**
+     * 查找学校科目维度
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    List<TAExamCourseCollegeInspectResult> findCourseDescriptiveStatisticsForSchool(@Param("examId") Long examId, @Param("courseCode") String courseCode);
 }

+ 10 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/mapper/TAExamCourseRecordMapper.java

@@ -1,6 +1,7 @@
 package com.qmth.teachcloud.report.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.teachcloud.report.business.bean.result.ExamRecordResult;
 import com.qmth.teachcloud.report.business.bean.result.ExamStudentResult;
 import com.qmth.teachcloud.report.business.bean.result.SynthesisResult;
 import com.qmth.teachcloud.report.business.entity.TAExamCourseRecord;
@@ -24,4 +25,13 @@ public interface TAExamCourseRecordMapper extends BaseMapper<TAExamCourseRecord>
     ExamStudentResult getStudent(@Param("schoolId") String schoolId, @Param("examId") String examId, @Param("studentCode") String studentCode, @Param("courseCode") String courseCode);
 
     SynthesisResult getSynthesisResult(@Param("schoolId") String schoolId, @Param("examId") String examId, @Param("studentCode") String studentCode, @Param("courseCode") String courseCode);
+
+    /**
+     * 查询考生信息
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    List<ExamRecordResult> findExamRecordByExamIdAndCourseCode(@Param("examId") Long examId, @Param("courseCode") String courseCode);
 }

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

@@ -1,5 +1,7 @@
 package com.qmth.teachcloud.report.business.service;
 
+import com.qmth.teachcloud.report.business.bean.result.CourseInfoResult;
+
 /**
  * @Description: 教研公共服务
  * @Param:
@@ -8,4 +10,24 @@ package com.qmth.teachcloud.report.business.service;
  * @Date: 2021/6/4
  */
 public interface ReportCommonService {
+
+    /**
+     * 学院学科报表查询科目信息
+     *
+     * @param examId
+     * @param courseCode
+     * @param collegeId
+     * @return
+     */
+    CourseInfoResult findCourseInfo(Long examId, String courseCode, Long collegeId);
+
+    /**
+     * 学院学科报表科目描述
+     *
+     * @param examId
+     * @param courseCode
+     * @param collegeId
+     * @return
+     */
+    Object findCourseDistribution(Long examId, String courseCode, Long collegeId);
 }

+ 10 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/TAExamCourseCollegeInspectService.java

@@ -17,11 +17,20 @@ import java.util.List;
 public interface TAExamCourseCollegeInspectService extends IService<TAExamCourseCollegeInspect> {
 
     /**
-     * 查找科目维度
+     * 查找学院科目维度
      *
      * @param examId
      * @param courseCode
      * @return
      */
     List<TAExamCourseCollegeInspectResult> findCourseDescriptiveStatisticsForCollege(Long examId, String courseCode);
+
+    /**
+     * 查找学校科目维度
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    List<TAExamCourseCollegeInspectResult> findCourseDescriptiveStatisticsForSchool(Long examId, String courseCode);
 }

+ 11 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/TAExamCourseRecordService.java

@@ -1,8 +1,11 @@
 package com.qmth.teachcloud.report.business.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.teachcloud.report.business.bean.result.ExamRecordResult;
 import com.qmth.teachcloud.report.business.entity.TAExamCourseRecord;
 
+import java.util.List;
+
 /**
  * <p>
  * 参考课程考生成绩维度表 服务类
@@ -13,4 +16,12 @@ import com.qmth.teachcloud.report.business.entity.TAExamCourseRecord;
  */
 public interface TAExamCourseRecordService extends IService<TAExamCourseRecord> {
 
+    /**
+     * 查询考生信息
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    List<ExamRecordResult> findExamRecordByExamIdAndCourseCode(Long examId, String courseCode);
 }

+ 86 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/ReportCommonServiceImpl.java

@@ -1,8 +1,25 @@
 package com.qmth.teachcloud.report.business.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.google.gson.Gson;
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.report.business.bean.result.CourseInfoResult;
+import com.qmth.teachcloud.report.business.bean.result.DescriptiveStatisticsResult;
+import com.qmth.teachcloud.report.business.bean.result.TAExamCourseCollegeInspectResult;
+import com.qmth.teachcloud.report.business.bean.result.TBPaperInfoResult;
+import com.qmth.teachcloud.report.business.entity.TBPaper;
 import com.qmth.teachcloud.report.business.service.ReportCommonService;
+import com.qmth.teachcloud.report.business.service.TAExamCourseCollegeInspectService;
+import com.qmth.teachcloud.report.business.service.TBPaperService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
 /**
  * @Description: 教研公共服务
  * @Param:
@@ -12,4 +29,73 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class ReportCommonServiceImpl implements ReportCommonService {
+    private final static Logger log = LoggerFactory.getLogger(ReportCommonServiceImpl.class);
+
+    @Resource
+    TBPaperService tbPaperService;
+
+    @Resource
+    TAExamCourseCollegeInspectService taExamCourseCollegeInspectService;
+
+    /**
+     * 学院学科报表查询科目信息
+     *
+     * @param examId
+     * @param courseCode
+     * @param collegeId
+     * @return
+     */
+    @Override
+    public CourseInfoResult findCourseInfo(Long examId, String courseCode, Long collegeId) {
+        //查找试卷
+        QueryWrapper<TBPaper> tbPaperQueryWrapper = new QueryWrapper<>();
+        tbPaperQueryWrapper.lambda().eq(TBPaper::getExamId, examId)
+                .eq(TBPaper::getCourseCode, courseCode);
+        List<TBPaper> tbPaperList = tbPaperService.list(tbPaperQueryWrapper);
+
+        //查找学院科目维度
+        List<TAExamCourseCollegeInspectResult> taExamCourseCollegeInspectResultList = taExamCourseCollegeInspectService.findCourseDescriptiveStatisticsForCollege(examId, courseCode);
+        //查找学校科目维度
+        List<TAExamCourseCollegeInspectResult> taExamCourseSchoolInspectResultList = taExamCourseCollegeInspectService.findCourseDescriptiveStatisticsForSchool(examId, courseCode);
+
+        // 课程概况
+        if (tbPaperList.size() < 1) {
+            throw ExceptionResultEnum.NO_DATA.exception();
+        }
+        Set<String> paperTypeSet = tbPaperList.stream().map(e -> e.getPaperType()).collect(Collectors.toSet());
+        String paperType = String.join(",", paperTypeSet); // 多种试卷类型的试卷类型合并','号隔开
+        Gson gson = new Gson();
+        TBPaperInfoResult TBPaperInfoResult = gson.fromJson(gson.toJson(tbPaperList.get(0)), TBPaperInfoResult.class);
+        TBPaperInfoResult.setPaperType(paperType);
+        TBPaperInfoResult.setCollegeCount(taExamCourseCollegeInspectResultList.size());
+
+        // 学院该科目的描述统计
+        List<TAExamCourseCollegeInspectResult> collegeDescriptiveStatisticsList = taExamCourseCollegeInspectResultList
+                .stream().filter(e -> collegeId.intValue() == e.getCollegeId().intValue()).collect(Collectors.toList());
+        if (collegeDescriptiveStatisticsList.size() != 1) {
+            throw ExceptionResultEnum.DATA_COUNT_EXCEPTION.exception();
+        }
+        TAExamCourseCollegeInspectResult collegeDescriptiveStatistics = taExamCourseCollegeInspectResultList.get(0);
+
+        // 全校该科目的描述统计
+        if (taExamCourseSchoolInspectResultList.size() != 1) {
+            throw ExceptionResultEnum.DATA_COUNT_EXCEPTION.exception();
+        }
+        TAExamCourseCollegeInspectResult schoolDescriptiveStatistics = taExamCourseSchoolInspectResultList.get(0);
+        DescriptiveStatisticsResult descriptiveStatisticsResult = new DescriptiveStatisticsResult(collegeDescriptiveStatistics, schoolDescriptiveStatistics);
+        return new CourseInfoResult(TBPaperInfoResult, descriptiveStatisticsResult);
+    }
+
+    /**
+     * 学院学科报表科目描述
+     *
+     * @param examId
+     * @param courseCode
+     * @param collegeId
+     * @return
+     */
+    @Override
+    public Object findCourseDistribution(Long examId, String courseCode, Long collegeId) {
+        return null;
+    }
 }

+ 13 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamCourseCollegeInspectServiceImpl.java

@@ -25,7 +25,7 @@ public class TAExamCourseCollegeInspectServiceImpl extends ServiceImpl<TAExamCou
     TAExamCourseCollegeInspectMapper taExamCourseCollegeInspectMapper;
 
     /**
-     * 查找科目维度
+     * 查找学院科目维度
      *
      * @param examId
      * @param courseCode
@@ -35,4 +35,16 @@ public class TAExamCourseCollegeInspectServiceImpl extends ServiceImpl<TAExamCou
     public List<TAExamCourseCollegeInspectResult> findCourseDescriptiveStatisticsForCollege(Long examId, String courseCode) {
         return taExamCourseCollegeInspectMapper.findCourseDescriptiveStatisticsForCollege(examId, courseCode);
     }
+
+    /**
+     * 查找学校科目维度
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    @Override
+    public List<TAExamCourseCollegeInspectResult> findCourseDescriptiveStatisticsForSchool(Long examId, String courseCode) {
+        return taExamCourseCollegeInspectMapper.findCourseDescriptiveStatisticsForSchool(examId, courseCode);
+    }
 }

+ 18 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamCourseRecordServiceImpl.java

@@ -1,11 +1,15 @@
 package com.qmth.teachcloud.report.business.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.teachcloud.report.business.bean.result.ExamRecordResult;
 import com.qmth.teachcloud.report.business.entity.TAExamCourseRecord;
 import com.qmth.teachcloud.report.business.mapper.TAExamCourseRecordMapper;
 import com.qmth.teachcloud.report.business.service.TAExamCourseRecordService;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.List;
+
 /**
  * <p>
  * 参考课程考生成绩维度表 服务实现类
@@ -17,4 +21,18 @@ import org.springframework.stereotype.Service;
 @Service
 public class TAExamCourseRecordServiceImpl extends ServiceImpl<TAExamCourseRecordMapper, TAExamCourseRecord> implements TAExamCourseRecordService {
 
+    @Resource
+    TAExamCourseRecordMapper taExamCourseRecordMapper;
+
+    /**
+     * 查询考生信息
+     *
+     * @param examId
+     * @param courseCode
+     * @return
+     */
+    @Override
+    public List<ExamRecordResult> findExamRecordByExamIdAndCourseCode(Long examId, String courseCode) {
+        return taExamCourseRecordMapper.findExamRecordByExamIdAndCourseCode(examId, courseCode);
+    }
 }

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

@@ -7,13 +7,15 @@ import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.report.business.bean.result.*;
-import com.qmth.teachcloud.report.business.entity.*;
+import com.qmth.teachcloud.report.business.entity.TAExamCourse;
+import com.qmth.teachcloud.report.business.entity.TAExamCourseRecord;
+import com.qmth.teachcloud.report.business.entity.TBCommonLevelConfig;
+import com.qmth.teachcloud.report.business.entity.TBDimension;
 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.*;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -58,6 +60,12 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
     @Resource
     TAExamCourseCollegeTeacherService taExamCourseCollegeTeacherService;
 
+    @Resource
+    ReportCommonService reportCommonService;
+
+    @Resource
+    TAExamCourseRecordService taExamCourseRecordService;
+
     /**
      * 开课课程考试总览列表接口
      *
@@ -144,15 +152,18 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
         if (Objects.isNull(sysUser)) {
             throw ExceptionResultEnum.NOT_LOGIN.exception();
         }
-        //查找试卷
-        QueryWrapper<TBPaper> tbPaperQueryWrapper = new QueryWrapper<>();
-        tbPaperQueryWrapper.lambda().eq(TBPaper::getExamId, examId)
-                .eq(TBPaper::getCourseCode, courseCode);
-        List<TBPaper> tbPaperList = tbPaperService.list(tbPaperQueryWrapper);
-
-        //查找科目学院维度
-        List<TAExamCourseCollegeInspectResult> taExamCourseCollegeInspectResultList = taExamCourseCollegeInspectService.findCourseDescriptiveStatisticsForCollege(examId, courseCode);
-
+//        //查找试卷
+//        QueryWrapper<TBPaper> tbPaperQueryWrapper = new QueryWrapper<>();
+//        tbPaperQueryWrapper.lambda().eq(TBPaper::getExamId, examId)
+//                .eq(TBPaper::getCourseCode, courseCode);
+//        List<TBPaper> tbPaperList = tbPaperService.list(tbPaperQueryWrapper);
+//
+//        //查找学院科目维度
+//        List<TAExamCourseCollegeInspectResult> taExamCourseCollegeInspectResultList = taExamCourseCollegeInspectService.findCourseDescriptiveStatisticsForCollege(examId, courseCode);
+//        //查找学校科目维度
+//        List<TAExamCourseCollegeInspectResult> taExamCourseSchoolInspectResultList = taExamCourseCollegeInspectService.findCourseDescriptiveStatisticsForSchool(examId, courseCode);
+
+        CourseInfoResult courseInfoResult = reportCommonService.findCourseInfo(examId, courseCode, sysUser.getOrgId());
         //查找维度
         List<CourseDimensionResult> courseDimensionResultList = tbDimensionService.findDimensionInfo(examId, courseCode, sysUser.getOrgId());
 

+ 29 - 0
teachcloud-report-business/src/main/resources/mapper/TAExamCourseCollegeInspectMapper.xml

@@ -4,6 +4,7 @@
 
     <select id="findCourseDescriptiveStatisticsForCollege" resultType="com.qmth.teachcloud.report.business.bean.result.TAExamCourseCollegeInspectResult">
         select
+            so.id as collegeId,
             so.name as collegeName,
             round(convert(taecci.max_score, decimal(10, 4)), 2) as maxScore,
             round(convert(taecci.min_score, decimal(10, 4)), 2) as minScore,
@@ -33,4 +34,32 @@
             </if>
         </where>
     </select>
+
+    <select id="findCourseDescriptiveStatisticsForSchool" resultType="com.qmth.teachcloud.report.business.bean.result.TAExamCourseCollegeInspectResult">
+        SELECT
+            round(convert(current_min_score,decimal(10,4)),2) AS minScore,
+            round(convert(current_max_score,decimal(10,4)),2) AS maxScore,
+            round(convert(current_avg_score,decimal(10,4)),2) AS avgScore,
+            current_reality_count AS realityCount,
+            current_absent_count AS absentCount,
+            current_total_count AS totalCount,
+            round(convert(current_upper_quartile,decimal(10,4)),2) AS upperQuartile,
+            round(convert(current_median,decimal(10,4)),2) AS median,
+            round(convert(current_lower_quartile,decimal(10,4)),2) AS lowerQuartile,
+            current_mode,
+            round(convert(current_standard_deviation,decimal(10,4)),2) AS standardDeviation
+        FROM
+            t_a_exam_course taec
+        <where>
+            <if test="courseCode != null and courseCode != ''">
+                and taec.course_code = #{courseCode}
+            </if>
+            <if test="examId != null and examId != ''">
+                and taec.exam_id = #{examId}
+            </if>
+            <if test="schoolId != null and schoolId != ''">
+                and taec.school_id = #{schoolId}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 79 - 54
teachcloud-report-business/src/main/resources/mapper/TAExamCourseRecordMapper.xml

@@ -5,20 +5,20 @@
     <select id="listExamCourseRecord"
             resultType="com.qmth.teachcloud.report.business.entity.TAExamCourseRecord">
         SELECT
-            a.assigned_score assignedScore,
-            a.student_code studentCode,
-            a.current
+        a.assigned_score assignedScore,
+        a.student_code studentCode,
+        a.current
         FROM
-            t_a_exam_course_record a
-                LEFT JOIN
-            t_b_exam b ON a.exam_id = b.id
+        t_a_exam_course_record a
+        LEFT JOIN
+        t_b_exam b ON a.exam_id = b.id
         WHERE
         <where>
             and b.school_id = #{schoolId}
             <if test="semester != null and semester != ''">
                 AND b.semester = #{semester}
             </if>
-            <if test="examId != null">
+            <if test="examId != null and examId != ''">
                 AND a.exam_id = #{examId}
             </if>
             <if test="courseCode != null and courseCode != ''">
@@ -26,29 +26,30 @@
             </if>
         </where>
     </select>
+
     <select id="getStudent" resultType="com.qmth.teachcloud.report.business.bean.result.ExamStudentResult">
         SELECT
-            a.rank_level level,
-            c.name collegeName,
-            d.name courseName,
-            b.exam_name examName,
-            e.name examStudentName,
-            a.student_code studentCode,
-            b.exam_time time,
-            f.clazz_name className
+        a.rank_level level,
+        c.name collegeName,
+        d.name courseName,
+        b.exam_name examName,
+        e.name examStudentName,
+        a.student_code studentCode,
+        b.exam_time time,
+        f.clazz_name className
         FROM
-            t_a_exam_course_record a
-                LEFT JOIN
-            t_b_exam b ON a.exam_id = b.id
-                LEFT JOIN
-            sys_org c ON a.inspect_college_id = c.id
-                LEFT JOIN
-            basic_course d ON a.school_id = d.school_id
-                AND a.course_code = d.code
-                LEFT JOIN
-            t_b_student e ON a.student_id = e.id
-                LEFT JOIN
-            t_b_school_clazz f ON a.clazz_id = f.id
+        t_a_exam_course_record a
+        LEFT JOIN
+        t_b_exam b ON a.exam_id = b.id
+        LEFT JOIN
+        sys_org c ON a.inspect_college_id = c.id
+        LEFT JOIN
+        basic_course d ON a.school_id = d.school_id
+        AND a.course_code = d.code
+        LEFT JOIN
+        t_b_student e ON a.student_id = e.id
+        LEFT JOIN
+        t_b_school_clazz f ON a.clazz_id = f.id
         <where>
             and a.school_id = #{schoolId}
             and a.exam_id = #{examId}
@@ -56,37 +57,38 @@
             and a.course_code = #{courseCode}
         </where>
     </select>
+
     <select id="getSynthesisResult"
             resultType="com.qmth.teachcloud.report.business.bean.result.SynthesisResult">
         SELECT
-            ROUND(a.assigned_score, 1) myScore,
-            b.reality_count actualCount,
-            ROUND(a.over_college_rate, 1) overRate,
-            ROUND(b.min_score, 1) collegeMinScore,
-            ROUND(b.avg_score, 1) collegeAvgScore,
-            ROUND(b.max_score, 1) collegeMaxScore,
-            ROUND(c.min_score, 1) clazzMinScore,
-            ROUND(c.avg_score, 1) clazzAvgScore,
-            ROUND(c.max_score, 1) clazzMaxScore,
-            ROUND(d.total_score, 1) fullScore,
-            ROUND(d.current_score_rate, 1) difficult,
-            d.difficulty difficultInfo
+        ROUND(a.assigned_score, 1) myScore,
+        b.reality_count actualCount,
+        ROUND(a.over_college_rate, 1) overRate,
+        ROUND(b.min_score, 1) collegeMinScore,
+        ROUND(b.avg_score, 1) collegeAvgScore,
+        ROUND(b.max_score, 1) collegeMaxScore,
+        ROUND(c.min_score, 1) clazzMinScore,
+        ROUND(c.avg_score, 1) clazzAvgScore,
+        ROUND(c.max_score, 1) clazzMaxScore,
+        ROUND(d.total_score, 1) fullScore,
+        ROUND(d.current_score_rate, 1) difficult,
+        d.difficulty difficultInfo
         FROM
-            t_a_exam_course_record a
-                LEFT JOIN
-            t_a_exam_course_college_inspect b ON a.school_id = b.school_id
-                AND a.exam_id = b.exam_id
-                AND a.course_code = b.course_code
-                AND a.inspect_college_id = b.college_id
-                LEFT JOIN
-            t_a_exam_course_clazz c ON a.school_id = c.school_id
-                AND a.exam_id = c.exam_id
-                AND a.course_code = c.course_code
-                AND a.clazz_id = c.clazz_id
-                LEFT JOIN
-            t_a_exam_course d ON a.school_id = d.school_id
-                AND a.exam_id = d.exam_id
-                AND a.course_code = d.course_code
+        t_a_exam_course_record a
+        LEFT JOIN
+        t_a_exam_course_college_inspect b ON a.school_id = b.school_id
+        AND a.exam_id = b.exam_id
+        AND a.course_code = b.course_code
+        AND a.inspect_college_id = b.college_id
+        LEFT JOIN
+        t_a_exam_course_clazz c ON a.school_id = c.school_id
+        AND a.exam_id = c.exam_id
+        AND a.course_code = c.course_code
+        AND a.clazz_id = c.clazz_id
+        LEFT JOIN
+        t_a_exam_course d ON a.school_id = d.school_id
+        AND a.exam_id = d.exam_id
+        AND a.course_code = d.course_code
         <where>
             and a.school_id = #{schoolId}
             and a.exam_id = #{examId}
@@ -94,4 +96,27 @@
             and a.course_code = #{courseCode}
         </where>
     </select>
+
+    <select id="findExamRecordByExamIdAndCourseCode" resultType="com.qmth.teachcloud.report.business.bean.result.ExamRecordResult">
+        SELECT
+            tbes.ticket_number AS ticketNumber,
+            (select so.name from sys_org so where so.id = taecr.inspect_college_id) AS collegeName,
+            assigned_score AS assignedScore,
+            percent_grade AS percentGrade
+        FROM
+            t_a_exam_course_record taecr
+            join t_b_exam_record tber
+            on tber.id = taecr.exam_record_id
+            join t_b_exam_student tbes
+            on tber.exam_student_id = tbes.id
+           <where>
+               <if test="examId != null">
+                   AND taecr.exam_id = #{examId}
+               </if>
+               <if test="courseCode != null and courseCode != ''">
+                   AND taecr.course_code = #{courseCode}
+               </if>
+               and taecr.absent = 0
+           </where>
+    </select>
 </mapper>