|
@@ -1310,6 +1310,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
String postUrl = "/api/admin/mark/archive/score/list";
|
|
|
DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(), sysUser.getId(), postUrl);
|
|
|
ScoreReportVo ret = new ScoreReportVo();
|
|
|
+ // 考试概况
|
|
|
ret.setOverview(baseMapper.overview(sysUser.getSchoolId(), query, dpr));
|
|
|
if (ret.getOverview() != null && ret.getOverview().getStudentCount() > 0) {
|
|
|
double total = ret.getOverview().getStudentCount() - ret.getOverview().getAbsentCount();
|
|
@@ -1320,8 +1321,11 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
ret.getOverview().setAvgScore(Calculator.round(ret.getOverview().getAvgScore(), 2));
|
|
|
}
|
|
|
List<ArchiveStudentVo> studentList = baseMapper.studentList(sysUser.getSchoolId(), query, dpr);
|
|
|
+
|
|
|
+ // 成绩分数段分析
|
|
|
fillScoreRange(ret, studentList);
|
|
|
|
|
|
+ // 学院成绩分析
|
|
|
ret.setCollege(baseMapper.college(sysUser.getSchoolId(), query, dpr));
|
|
|
if (CollectionUtils.isNotEmpty(ret.getCollege())) {
|
|
|
for (CollegeVo vo : ret.getCollege()) {
|
|
@@ -1335,6 +1339,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 班级成绩分析
|
|
|
ret.setClassData(baseMapper.classData(sysUser.getSchoolId(), query, dpr));
|
|
|
if (CollectionUtils.isNotEmpty(ret.getClassData())) {
|
|
|
for (ClassVo vo : ret.getClassData()) {
|
|
@@ -1348,6 +1353,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 任课老师分析
|
|
|
ret.setTeacher(baseMapper.teacher(sysUser.getSchoolId(), query, dpr));
|
|
|
if (CollectionUtils.isNotEmpty(ret.getTeacher())) {
|
|
|
for (TeacherVo vo : ret.getTeacher()) {
|
|
@@ -1361,6 +1367,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 任课老师班级分析
|
|
|
ret.setTeacherClass(baseMapper.teacherClass(sysUser.getSchoolId(), query, dpr));
|
|
|
if (CollectionUtils.isNotEmpty(ret.getTeacherClass())) {
|
|
|
for (TeacherClassVo vo : ret.getTeacherClass()) {
|
|
@@ -1372,7 +1379,10 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 客观题成绩分析
|
|
|
fillObjective(ret, studentList, query.getExamId(), query.getPaperNumber());
|
|
|
+
|
|
|
+ // 主观题成绩分析
|
|
|
List<Long> studentIds = studentList.stream().map(ArchiveStudentVo::getStudentId).collect(Collectors.toList());
|
|
|
ret.setSubjective(markSubjectiveScoreService.getSubjectiveVo(studentIds));
|
|
|
if (CollectionUtils.isNotEmpty(ret.getSubjective())) {
|
|
@@ -1383,6 +1393,8 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
vo.setAvgScore(Calculator.round(vo.getAvgScore(), 2));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 大题分析
|
|
|
fillMainQuestionAnalysis(ret, studentList, query.getExamId(), query.getPaperNumber());
|
|
|
return ret;
|
|
|
}
|
|
@@ -1536,60 +1548,69 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
|
|
|
|
|
|
private void fillObjective(ScoreReportVo ret, List<ArchiveStudentVo> studentList, Long examId, String paperNumber) {
|
|
|
List<MarkQuestion> qs = markQuestionService.listByExamIdAndPaperNumberAndObjective(examId, paperNumber, true);
|
|
|
- Map<String, QuestionVo> map = new HashMap<>();
|
|
|
- List<QuestionVo> list = new ArrayList<>();
|
|
|
- for (ArchiveStudentVo s : studentList) {
|
|
|
- List<ScoreItem> sis = s.getScoreList(true, qs);
|
|
|
- if (CollectionUtils.isNotEmpty(sis)) {
|
|
|
- for (ScoreItem si : sis) {
|
|
|
- String key = si.getMainNumber() + "-" + si.getSubNumber();
|
|
|
- QuestionVo vo = map.get(key);
|
|
|
- if (vo == null) {
|
|
|
- vo = new QuestionVo();
|
|
|
- vo.setScoreCount(0);
|
|
|
- vo.setFullScoreCount(0);
|
|
|
- vo.setStudentCount(0);
|
|
|
- vo.setScoreSum(0.0);
|
|
|
- vo.setMainNumber(si.getMainNumber());
|
|
|
- vo.setSubNumber(si.getSubNumber());
|
|
|
- vo.setTitle(si.getTitle());
|
|
|
- vo.setScore(si.getTotalScore());
|
|
|
- map.put(key, vo);
|
|
|
- }
|
|
|
- vo.setStudentCount(vo.getStudentCount() + 1);
|
|
|
- vo.setScoreSum(vo.getScoreSum() + si.getScore());
|
|
|
- if (Objects.nonNull(si.getScore()) && Objects.nonNull(si.getTotalScore()) && si.getScore().doubleValue() == si.getTotalScore().doubleValue()) {
|
|
|
- vo.setFullScoreCount(vo.getFullScoreCount() + 1);
|
|
|
- }
|
|
|
- if (si.getScore() > 0) {
|
|
|
- vo.setScoreCount(vo.getScoreCount() + 1);
|
|
|
+ Map<String, List<ArchiveStudentVo>> collect = studentList.stream().collect(Collectors.groupingBy(ArchiveStudentVo::getPaperType));
|
|
|
+
|
|
|
+ List<QuestionObjectiveVo> questionObjectiveVoList = new ArrayList<>();
|
|
|
+ for (Map.Entry<String, List<ArchiveStudentVo>> entry : collect.entrySet()) {
|
|
|
+ QuestionObjectiveVo questionObjectiveVo = new QuestionObjectiveVo();
|
|
|
+ questionObjectiveVo.setPaperType(entry.getKey());
|
|
|
+ Map<String, QuestionVo> map = new HashMap<>();
|
|
|
+ List<QuestionVo> list = new ArrayList<>();
|
|
|
+ for (ArchiveStudentVo s : entry.getValue()) {
|
|
|
+ List<ScoreItem> sis = s.getScoreList(true, qs);
|
|
|
+ if (CollectionUtils.isNotEmpty(sis)) {
|
|
|
+ for (ScoreItem si : sis) {
|
|
|
+ String key = si.getMainNumber() + "-" + si.getSubNumber();
|
|
|
+ QuestionVo vo = map.get(key);
|
|
|
+ if (vo == null) {
|
|
|
+ vo = new QuestionVo();
|
|
|
+ vo.setScoreCount(0);
|
|
|
+ vo.setFullScoreCount(0);
|
|
|
+ vo.setStudentCount(0);
|
|
|
+ vo.setScoreSum(0.0);
|
|
|
+ vo.setMainNumber(si.getMainNumber());
|
|
|
+ vo.setSubNumber(si.getSubNumber());
|
|
|
+ vo.setTitle(si.getTitle());
|
|
|
+ vo.setScore(si.getTotalScore());
|
|
|
+ map.put(key, vo);
|
|
|
+ }
|
|
|
+ vo.setStudentCount(vo.getStudentCount() + 1);
|
|
|
+ vo.setScoreSum(vo.getScoreSum() + si.getScore());
|
|
|
+ if (Objects.nonNull(si.getScore()) && Objects.nonNull(si.getTotalScore()) && si.getScore().doubleValue() == si.getTotalScore().doubleValue()) {
|
|
|
+ vo.setFullScoreCount(vo.getFullScoreCount() + 1);
|
|
|
+ }
|
|
|
+ if (si.getScore() > 0) {
|
|
|
+ vo.setScoreCount(vo.getScoreCount() + 1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- if (map.isEmpty()) {
|
|
|
- ret.setObjective(list);
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (map.isEmpty()) {
|
|
|
+ questionObjectiveVo.setList(list);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- list = new ArrayList<>(map.values());
|
|
|
- for (QuestionVo questionVo : list) {
|
|
|
- // 平均分
|
|
|
- if (questionVo.getStudentCount() == null || questionVo.getStudentCount() == 0) {
|
|
|
- questionVo.setAvgScore(0D);
|
|
|
- } else {
|
|
|
- questionVo.setAvgScore(Calculator.round(Calculator.divide(questionVo.getScoreSum(), questionVo.getStudentCount()), 2));
|
|
|
+ list = new ArrayList<>(map.values());
|
|
|
+ for (QuestionVo questionVo : list) {
|
|
|
+ // 平均分
|
|
|
+ if (questionVo.getStudentCount() == null || questionVo.getStudentCount() == 0) {
|
|
|
+ questionVo.setAvgScore(0D);
|
|
|
+ } else {
|
|
|
+ questionVo.setAvgScore(Calculator.round(Calculator.divide(questionVo.getScoreSum(), questionVo.getStudentCount()), 2));
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- list.sort(Comparator.comparingInt(QuestionVo::getMainNumber).thenComparingInt(QuestionVo::getSubNumber));
|
|
|
+ list.sort(Comparator.comparingInt(QuestionVo::getMainNumber).thenComparingInt(QuestionVo::getSubNumber));
|
|
|
|
|
|
- for (QuestionVo vo : list) {
|
|
|
- double total = vo.getStudentCount();
|
|
|
- vo.setScoreRate(Calculator.divide(vo.getScoreCount(), total, 2));
|
|
|
- vo.setFullScoreRate(Calculator.divide(vo.getFullScoreCount(), total, 2));
|
|
|
+ for (QuestionVo vo : list) {
|
|
|
+ double total = vo.getStudentCount();
|
|
|
+ vo.setScoreRate(Calculator.divide(vo.getScoreCount(), total, 2));
|
|
|
+ vo.setFullScoreRate(Calculator.divide(vo.getFullScoreCount(), total, 2));
|
|
|
+ }
|
|
|
+ questionObjectiveVo.setList(list);
|
|
|
+ questionObjectiveVoList.add(questionObjectiveVo);
|
|
|
}
|
|
|
- ret.setObjective(list);
|
|
|
+ ret.setObjective(questionObjectiveVoList);
|
|
|
}
|
|
|
|
|
|
/**
|