|
|
@ -1569,12 +1569,14 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
// 3. 获取考试及知识点映射
|
|
|
|
// 3. 获取考试及知识点映射
|
|
|
|
Map<String, List<List<String>>> examKnowledgeMap = new HashMap<>();
|
|
|
|
Map<String, List<List<String>>> examKnowledgeMap = new HashMap<>();
|
|
|
|
Map<String, List<Double>> points = new HashMap<>();
|
|
|
|
Map<String, List<Double>> points = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
List<ExamVo> exams = getExamsWithKnowledge(laborDto, records, examKnowledgeMap, points);
|
|
|
|
List<ExamVo> exams = getExamsWithKnowledge(laborDto, records, examKnowledgeMap, points);
|
|
|
|
|
|
|
|
|
|
|
|
// 4. 获取考试结果并按月份分组
|
|
|
|
// 4. 获取考试结果并按月份分组
|
|
|
|
List<String> targetStudents = laborDto.getClassId() != null ?
|
|
|
|
List<String> targetStudents = laborDto.getClassId() != null ?
|
|
|
|
classStudentIds : Collections.singletonList(studentId);
|
|
|
|
classStudentIds : Collections.singletonList(studentId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//records有可能没有数据 重写monthlyResults
|
|
|
|
Map<Integer, List<ExamResultWrapper>> monthlyResults = getMonthlyExamResults(
|
|
|
|
Map<Integer, List<ExamResultWrapper>> monthlyResults = getMonthlyExamResults(
|
|
|
|
schoolId, laborDto.getClassId(), exams, records,
|
|
|
|
schoolId, laborDto.getClassId(), exams, records,
|
|
|
|
examKnowledgeMap, points, targetStudents // 传入目标学生列表
|
|
|
|
examKnowledgeMap, points, targetStudents // 传入目标学生列表
|
|
|
@ -1697,7 +1699,20 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
private List<ExamVo> getExamsWithKnowledge(LaborDto laborDto, List<LessonRecord> records,
|
|
|
|
private List<ExamVo> getExamsWithKnowledge(LaborDto laborDto, List<LessonRecord> records,
|
|
|
|
Map<String, List<List<String>>> examKnowledgeMap,
|
|
|
|
Map<String, List<List<String>>> examKnowledgeMap,
|
|
|
|
Map<String, List<Double>> points) {
|
|
|
|
Map<String, List<Double>> points) {
|
|
|
|
List<String> lessonRecordIds = records.stream().map(LessonRecord::getId).collect(Collectors.toList());
|
|
|
|
if (records == null || records.isEmpty()) {
|
|
|
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> lessonRecordIds = records.stream()
|
|
|
|
|
|
|
|
.map(LessonRecord::getId)
|
|
|
|
|
|
|
|
.filter(id -> id != null && !id.isEmpty())
|
|
|
|
|
|
|
|
.distinct()
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (lessonRecordIds.isEmpty()) {
|
|
|
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<ExamVo> exams = examRepository.findExamsByIds(laborDto.getSource(), lessonRecordIds);
|
|
|
|
List<ExamVo> exams = examRepository.findExamsByIds(laborDto.getSource(), lessonRecordIds);
|
|
|
|
|
|
|
|
|
|
|
|
exams.forEach(exam -> {
|
|
|
|
exams.forEach(exam -> {
|
|
|
@ -1712,13 +1727,16 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<Integer, List<ExamResultWrapper>> getMonthlyExamResults(
|
|
|
|
private Map<Integer, List<ExamResultWrapper>> getMonthlyExamResults(
|
|
|
|
String schoolId, String classId, List<ExamVo> exams,
|
|
|
|
String schoolId, String classId, List<ExamVo> exams,
|
|
|
|
List<LessonRecord> records, Map<String, List<List<String>>> examKnowledgeMap,
|
|
|
|
List<LessonRecord> records, Map<String, List<List<String>>> examKnowledgeMap,
|
|
|
|
Map<String, List<Double>> points, List<String> studentIds) { // 新增studentIds参数
|
|
|
|
Map<String, List<Double>> points, List<String> studentIds) { // 新增studentIds参数
|
|
|
|
|
|
|
|
|
|
|
|
Map<Integer, List<ExamResultWrapper>> monthlyResults = new HashMap<>();
|
|
|
|
Map<Integer, List<ExamResultWrapper>> monthlyResults = new HashMap<>();
|
|
|
|
|
|
|
|
if (exams == null || exams.isEmpty() || records == null || records.isEmpty()) {
|
|
|
|
|
|
|
|
return monthlyResults; // 安全退出,返回空 map
|
|
|
|
|
|
|
|
}
|
|
|
|
if (classId == null) {
|
|
|
|
if (classId == null) {
|
|
|
|
exams.forEach(exam -> {
|
|
|
|
exams.forEach(exam -> {
|
|
|
|
List<ExamClassResult> results = examClassResultRepository.findByStudentId(
|
|
|
|
List<ExamClassResult> results = examClassResultRepository.findByStudentId(
|
|
|
|