Browse Source

3.3.1 期末成绩分数明细

xiaofei 1 năm trước cách đây
mục cha
commit
dab448e7dc

+ 116 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/bean/archivescore/MarkStudentScoreVo.java

@@ -0,0 +1,116 @@
+package com.qmth.teachcloud.mark.bean.archivescore;
+
+import com.qmth.teachcloud.mark.dto.mark.ScoreItem;
+
+import java.util.List;
+
+public class MarkStudentScoreVo {
+    private Long examId;
+    private String courseCode;
+    private String courseName;
+    private String paperNumber;
+    private String studentCode;
+    private String studentName;
+    private Double objectiveScore;
+    private List<ScoreItem> objectiveScoreList;
+    private Double subjectiveScore;
+    private List<ScoreItem> subjectiveScoreList;
+    private Double totalScore;
+    private List<ScoreItem> totalScoreList;
+
+    public Long getExamId() {
+        return examId;
+    }
+
+    public void setExamId(Long examId) {
+        this.examId = examId;
+    }
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public String getPaperNumber() {
+        return paperNumber;
+    }
+
+    public void setPaperNumber(String paperNumber) {
+        this.paperNumber = paperNumber;
+    }
+
+    public String getStudentCode() {
+        return studentCode;
+    }
+
+    public void setStudentCode(String studentCode) {
+        this.studentCode = studentCode;
+    }
+
+    public String getStudentName() {
+        return studentName;
+    }
+
+    public void setStudentName(String studentName) {
+        this.studentName = studentName;
+    }
+
+    public Double getObjectiveScore() {
+        return objectiveScore;
+    }
+
+    public void setObjectiveScore(Double objectiveScore) {
+        this.objectiveScore = objectiveScore;
+    }
+
+    public List<ScoreItem> getObjectiveScoreList() {
+        return objectiveScoreList;
+    }
+
+    public void setObjectiveScoreList(List<ScoreItem> objectiveScoreList) {
+        this.objectiveScoreList = objectiveScoreList;
+    }
+
+    public Double getSubjectiveScore() {
+        return subjectiveScore;
+    }
+
+    public void setSubjectiveScore(Double subjectiveScore) {
+        this.subjectiveScore = subjectiveScore;
+    }
+
+    public List<ScoreItem> getSubjectiveScoreList() {
+        return subjectiveScoreList;
+    }
+
+    public void setSubjectiveScoreList(List<ScoreItem> subjectiveScoreList) {
+        this.subjectiveScoreList = subjectiveScoreList;
+    }
+
+    public Double getTotalScore() {
+        return totalScore;
+    }
+
+    public void setTotalScore(Double totalScore) {
+        this.totalScore = totalScore;
+    }
+
+    public List<ScoreItem> getTotalScoreList() {
+        return totalScoreList;
+    }
+
+    public void setTotalScoreList(List<ScoreItem> totalScoreList) {
+        this.totalScoreList = totalScoreList;
+    }
+}

+ 15 - 13
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/dto/mark/ScoreItem.java

@@ -9,17 +9,19 @@ public class ScoreItem {
     public static final String SPLIT = ":";
 
     public static final DecimalFormat NUMBER_FORMAT = new DecimalFormat("####.##");
-
+    // 大题号
     private int mainNumber;
-
+    // 小题号
     private Integer subNumber;
-
+    // 标题名称
     private String title;
+    // 小题满分
     private Double totalScore;
+    // 小题得分
     private Double score;
-
+    // 答案(客观题有,主观题为null)
     private String answer;
-
+    // 是否客观题
     private boolean objective;
 
     public ScoreItem(MarkSubjectiveScore ss) {
@@ -109,13 +111,13 @@ public class ScoreItem {
         }
     }
 
-	public Double getTotalScore() {
-		return totalScore;
-	}
+    public Double getTotalScore() {
+        return totalScore;
+    }
+
+    public void setTotalScore(Double totalScore) {
+        this.totalScore = totalScore;
+    }
+
 
-	public void setTotalScore(Double totalScore) {
-		this.totalScore = totalScore;
-	}
-    
-    
 }

+ 2 - 2
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/entity/MarkStudent.java

@@ -65,10 +65,10 @@ public class MarkStudent implements Serializable {
     @ApiModelProperty(value = "试卷编号(交互)")
     private String coursePaperId;
 
-    @ApiModelProperty(value = "试卷类型")
+    @ApiModelProperty(value = "试卷编号")
     private String paperNumber;
 
-    @ApiModelProperty(value = "试卷编号")
+    @ApiModelProperty(value = "试卷类型")
     private String paperType;
 
     @ApiModelProperty(value = "密号")

+ 3 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkStudentService.java

@@ -17,6 +17,7 @@ import com.qmth.teachcloud.common.enums.mark.SubjectiveStatus;
 import com.qmth.teachcloud.mark.bean.UpdateTimeVo;
 import com.qmth.teachcloud.mark.bean.archivescore.ArchiveStudentQuery;
 import com.qmth.teachcloud.mark.bean.archivescore.ArchiveStudentVo;
+import com.qmth.teachcloud.mark.bean.archivescore.MarkStudentScoreVo;
 import com.qmth.teachcloud.mark.bean.archivescore.ScoreReportVo;
 import com.qmth.teachcloud.mark.bean.omredit.OmrEditDomain;
 import com.qmth.teachcloud.mark.bean.scananswer.AnswerQueryDomain;
@@ -148,4 +149,6 @@ public interface MarkStudentService extends IService<MarkStudent> {
     int countUnexistByExamIdAndPaperNumberAndPaperType(Long examId, String paperNumber, String paperType);
 
     void updateStudentAnswer(@NotNull Long studentId);
+
+    List<MarkStudentScoreVo> listMarkStudentScoreList(Long examId, String paperNumber);
 }

+ 46 - 13
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

@@ -894,24 +894,24 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
     @Override
     public void scoreExport(ArchiveStudentQuery query, HttpServletResponse response) {
         //生成表头
-        String[] columnName= new String[]{"学生姓名", "学号", "学院", "班级", "课程代码", "课程名称", "客观分", "主观分",
+        String[] columnName = new String[]{"学生姓名", "学号", "学院", "班级", "课程代码", "课程名称", "客观分", "主观分",
                 "成绩"};
         List<MarkQuestion> oQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndGroupNumber(query.getExamId(), query.getPaperNumber(), null, true);
         List<MarkQuestion> sQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndGroupNumber(query.getExamId(), query.getPaperNumber(), null, false);
-        List<String> columnNameList =Arrays.asList(columnName);
-        for (MarkQuestion question:oQuestionList) {
-            columnNameList.add(question.getMainTitle() + " " + question.getMainNumber() + "-" + question.getSubNumber() +"选项");
-            columnNameList.add(question.getMainTitle() + " " + question.getMainNumber() + "-" + question.getSubNumber() +"得分");
+        List<String> columnNameList = Arrays.asList(columnName);
+        for (MarkQuestion question : oQuestionList) {
+            columnNameList.add(question.getMainTitle() + " " + question.getMainNumber() + "-" + question.getSubNumber() + "选项");
+            columnNameList.add(question.getMainTitle() + " " + question.getMainNumber() + "-" + question.getSubNumber() + "得分");
         }
-        for (MarkQuestion question:oQuestionList) {
+        for (MarkQuestion question : oQuestionList) {
             columnNameList.add(question.getMainTitle() + " " + question.getMainNumber() + "-" + question.getSubNumber());
         }
-        String[] columnNames =columnNameList.toArray(new String[0]);
+        String[] columnNames = columnNameList.toArray(new String[0]);
         //生成动态内容
-         List<String[]> columnValues=new ArrayList<>();
+        List<String[]> columnValues = new ArrayList<>();
         List<ArchiveStudentVo> ret = baseMapper.studentList(query);
-        for (ArchiveStudentVo s: ret ) {
-            List<String> valueList =new ArrayList<>();
+        for (ArchiveStudentVo s : ret) {
+            List<String> valueList = new ArrayList<>();
             valueList.add(s.getStudentName());
             valueList.add(s.getStudentCode());
             valueList.add(s.getCollege());
@@ -925,10 +925,10 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
                 valueList.add(item.getAnswer());
                 valueList.add(item.getScore().toString());
             }
-            for (ScoreItem item  : s.getScoreList(false)) {
+            for (ScoreItem item : s.getScoreList(false)) {
                 valueList.add(item.getScore().toString());
             }
-            String[] columnValue =valueList.toArray(new String[0]);
+            String[] columnValue = valueList.toArray(new String[0]);
             columnValues.add(columnValue);
         }
         try {
@@ -937,7 +937,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
             response.setContentType("application/vnd.ms-excel");
             ServletOutputStream outputStream = response.getOutputStream();
             ExcelWriter writer = ExcelWriter.create(ExcelType.XLSX);
-            writer.writeDataArrays("成绩导出", null,columnNames ,columnValues.listIterator());
+            writer.writeDataArrays("成绩导出", null, columnNames, columnValues.listIterator());
             writer.output(outputStream);
             outputStream.flush();
             outputStream.close();
@@ -1348,4 +1348,37 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
         // 客观题统分
         this.calculateObjectiveScore(student);
     }
+
+    @Override
+    public List<MarkStudentScoreVo> listMarkStudentScoreList(Long examId, String paperNumber) {
+        List<MarkStudent> markStudentList = this.listByExamIdAndPaperNumberAndNotAbsent(examId, paperNumber);
+        List<MarkQuestion> objectiveQuestionList = markQuestionService.listByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null, true);
+        List<MarkQuestion> subjectiveQuestionList = markQuestionService.listByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null, false);
+        List<MarkStudentScoreVo> markStudentScoreVoList = new ArrayList<>();
+        for (MarkStudent markStudent : markStudentList) {
+            MarkStudentScoreVo markStudentScoreVo = new MarkStudentScoreVo();
+            markStudentScoreVo.setExamId(markStudent.getExamId());
+            markStudentScoreVo.setCourseCode(markStudent.getCourseCode());
+            markStudentScoreVo.setCourseName(markStudent.getCourseName());
+            markStudentScoreVo.setPaperNumber(markStudent.getPaperNumber());
+            markStudentScoreVo.setStudentCode(markStudent.getStudentCode());
+            markStudentScoreVo.setStudentName(markStudent.getStudentName());
+            // 客观题
+            markStudentScoreVo.setObjectiveScore(markStudent.getObjectiveScore());
+            markStudentScoreVo.setObjectiveScoreList(markStudent.getScoreList(true, objectiveQuestionList));
+            // 主观题
+            markStudentScoreVo.setSubjectiveScore(markStudent.getSubjectiveScore());
+            markStudentScoreVo.setSubjectiveScoreList(markStudent.getScoreList(false, subjectiveQuestionList));
+
+            // 总分
+            markStudentScoreVo.setTotalScore(markStudent.getTotalScore());
+            List<ScoreItem> totalScoreItemList = new ArrayList<>();
+            totalScoreItemList.addAll(markStudentScoreVo.getObjectiveScoreList());
+            totalScoreItemList.addAll(markStudentScoreVo.getSubjectiveScoreList());
+            totalScoreItemList.stream().sorted(Comparator.comparing(ScoreItem::getMainNumber).thenComparing(ScoreItem::getSubNumber));
+            markStudentScoreVo.setTotalScoreList(totalScoreItemList);
+            markStudentScoreVoList.add(markStudentScoreVo);
+        }
+        return markStudentScoreVoList;
+    }
 }