wangliang 4 роки тому
батько
коміт
aef39a828b

+ 157 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/dto/excel/TAExamCourseDto.java

@@ -0,0 +1,157 @@
+package com.qmth.teachcloud.report.business.bean.dto.excel;
+
+import com.qmth.teachcloud.common.annotation.ExcelProperty;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * @Description: TAExamCourseDto
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/6/17
+ */
+public class TAExamCourseDto implements Serializable {
+
+    @ExcelProperty(name = "课程(代码)", width = 40, index = 1)
+    private String courseCodeName;
+
+    @ExcelProperty(name = "开课学院", width = 30, index = 2)
+    private String teachCollegeName;
+
+    @ExcelProperty(name = "考查学院", width = 30, index = 3)
+    private String inspectCollegeName;
+
+    @ExcelProperty(name = "有效人数", width = 30, index = 4)
+    private Integer realityCount;
+
+    @ExcelProperty(name = "应届占比(人数)", width = 50, index = 5)
+    private String currentRealityRate;
+
+    @ExcelProperty(name = "非应届占比(人数)", width = 50, index = 6)
+    private String pastRealityRate;
+
+    @ExcelProperty(name = "总体平均分", width = 30, index = 7)
+    private BigDecimal avgScore;
+
+    @ExcelProperty(name = "不及格率(人数)", width = 40, index = 8)
+    private String notPassRate;
+
+    @ExcelProperty(name = "缺考", width = 30, index = 9)
+    private Integer absentCount;
+
+    @ExcelProperty(name = "应届平均分", width = 30, index = 10)
+    private BigDecimal paperCurrentAvgScore;
+
+    @ExcelProperty(name = "应届不及格率(人数)", width = 50, index = 11)
+    private String currentNotPassRate;
+
+    public TAExamCourseDto() {
+
+    }
+
+    public TAExamCourseDto(String courseCodeName, String teachCollegeName, String inspectCollegeName, Integer realityCount,
+                           String currentRealityRate, String pastRealityRate, BigDecimal avgScore, String notPassRate,
+                           Integer absentCount, BigDecimal paperCurrentAvgScore, String currentNotPassRate) {
+        this.courseCodeName = courseCodeName;
+        this.teachCollegeName = teachCollegeName;
+        this.inspectCollegeName = inspectCollegeName;
+        this.realityCount = realityCount;
+        this.currentRealityRate = currentRealityRate;
+        this.pastRealityRate = pastRealityRate;
+        this.avgScore = avgScore;
+        this.notPassRate = notPassRate;
+        this.absentCount = absentCount;
+        this.paperCurrentAvgScore = paperCurrentAvgScore;
+        this.currentNotPassRate = currentNotPassRate;
+    }
+
+    public String getCourseCodeName() {
+        return courseCodeName;
+    }
+
+    public void setCourseCodeName(String courseCodeName) {
+        this.courseCodeName = courseCodeName;
+    }
+
+    public String getTeachCollegeName() {
+        return teachCollegeName;
+    }
+
+    public void setTeachCollegeName(String teachCollegeName) {
+        this.teachCollegeName = teachCollegeName;
+    }
+
+    public String getInspectCollegeName() {
+        return inspectCollegeName;
+    }
+
+    public void setInspectCollegeName(String inspectCollegeName) {
+        this.inspectCollegeName = inspectCollegeName;
+    }
+
+    public Integer getRealityCount() {
+        return realityCount;
+    }
+
+    public void setRealityCount(Integer realityCount) {
+        this.realityCount = realityCount;
+    }
+
+    public String getCurrentRealityRate() {
+        return currentRealityRate;
+    }
+
+    public void setCurrentRealityRate(String currentRealityRate) {
+        this.currentRealityRate = currentRealityRate;
+    }
+
+    public String getPastRealityRate() {
+        return pastRealityRate;
+    }
+
+    public void setPastRealityRate(String pastRealityRate) {
+        this.pastRealityRate = pastRealityRate;
+    }
+
+    public BigDecimal getAvgScore() {
+        return avgScore;
+    }
+
+    public void setAvgScore(BigDecimal avgScore) {
+        this.avgScore = avgScore;
+    }
+
+    public String getNotPassRate() {
+        return notPassRate;
+    }
+
+    public void setNotPassRate(String notPassRate) {
+        this.notPassRate = notPassRate;
+    }
+
+    public Integer getAbsentCount() {
+        return absentCount;
+    }
+
+    public void setAbsentCount(Integer absentCount) {
+        this.absentCount = absentCount;
+    }
+
+    public BigDecimal getPaperCurrentAvgScore() {
+        return paperCurrentAvgScore;
+    }
+
+    public void setPaperCurrentAvgScore(BigDecimal paperCurrentAvgScore) {
+        this.paperCurrentAvgScore = paperCurrentAvgScore;
+    }
+
+    public String getCurrentNotPassRate() {
+        return currentNotPassRate;
+    }
+
+    public void setCurrentNotPassRate(String currentNotPassRate) {
+        this.currentNotPassRate = currentNotPassRate;
+    }
+}

+ 9 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamTotalServiceImpl.java

@@ -3,9 +3,13 @@ package com.qmth.teachcloud.report.business.service.impl;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.reflect.TypeToken;
+import com.google.gson.Gson;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.util.ExcelUtil;
+import com.qmth.teachcloud.common.util.JacksonUtil;
 import com.qmth.teachcloud.common.util.ServletUtil;
+import com.qmth.teachcloud.report.business.bean.dto.excel.TAExamCourseDto;
 import com.qmth.teachcloud.report.business.entity.TAExamCourse;
 import com.qmth.teachcloud.report.business.entity.TAExamTotal;
 import com.qmth.teachcloud.report.business.enums.SemesterEnum;
@@ -15,6 +19,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 import java.util.Objects;
 
 /**
@@ -51,7 +56,10 @@ public class TAExamTotalServiceImpl extends ServiceImpl<TAExamTotalMapper, TAExa
     @Override
     public void exportCourseSummary(SemesterEnum semester, Long examId, HttpServletResponse response) throws Exception {
         IPage<TAExamCourse> taExamCourseIPage = taExamTotalService.getCourseSummary(semester, examId, SystemConstant.PAGE_NUMBER, SystemConstant.PAGE_SIZE);
-        ExcelUtil.excelExport("课程分析", TAExamCourse.class, taExamCourseIPage.getRecords(), response);
+        Gson gson = new Gson();
+        List<TAExamCourseDto> examStudentCourseDtoList = gson.fromJson(JacksonUtil.parseJson(taExamCourseIPage.getRecords()), new TypeToken<List<TAExamCourseDto>>() {
+        }.getType());
+        ExcelUtil.excelExport("课程分析", TAExamCourseDto.class, examStudentCourseDtoList, response);
     }
 
     @Override

+ 6 - 1
teachcloud-report-business/src/main/resources/mapper/TAExamTotalMapper.xml

@@ -44,7 +44,12 @@
             round(a.pass_rate * 100,1) passRate,
             round(a.current_avg_score, 1) currentAvgScore,
             a.current_pass_count currentPassCount,
-            round(a.current_pass_rate * 100, 1) currentPassRate
+            round(a.current_pass_rate * 100, 1) currentPassRate,
+            round(a.current_reality_rate * 100, 1) currentRealityRate,
+            round(a.past_reality_rate * 100, 1) pastRealityRate,
+            round((1 - a.pass_rate),1) as notPassRate,
+            a.paper_current_avg_score as paperCurrentAvgScore,
+            round((1 - a.current_pass_rate),1) as currentNotPassRate
         FROM
             t_a_exam_course a
                 LEFT JOIN