|
@@ -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;
|
|
|
+ }
|
|
|
}
|