update 报告相关算法更新

develop
hhb@hotmail.com 1 month ago
parent d37286b83e
commit a3bbce2897

@ -1456,8 +1456,7 @@ public class MoralEducationServiceImpl implements MoralEducationService {
// 6. 处理每月数据,传入主观评价统计结果 // 6. 处理每月数据,传入主观评价统计结果
return processMonthlyData( return processMonthlyData(records,res,rightCount,wrongCount,
records,res, rightCount, wrongCount,
targetStudents, targetStudents,
monthlyResults, monthlyResults,
knowledgeBlockMap, knowledgeBlockMap,
@ -1632,18 +1631,17 @@ public class MoralEducationServiceImpl implements MoralEducationService {
detail.put("resCount", res.size()); detail.put("resCount", res.size());
details.add(detail); details.add(detail);
detailList.put("detail",details); detailList.put("detail",details);
List<Map<String, Object>> collect = months.stream().map(month -> { List<Map<String, Object>> collect = months.stream().map(month -> {
Map<String, Object> monthEntry = new LinkedHashMap<>(); Map<String, Object> monthEntry = new LinkedHashMap<>();
monthEntry.put("month", month); monthEntry.put("month", month);
List<Map<String, Object>> scoreList = new ArrayList<>(); List<Map<String, Object>> scoreList = new ArrayList<>();
// 按学生分组考试结果 // 按学生分组考试结果
Map<String, List<ExamResultWrapper>> studentResults = monthlyResults Map<String, List<MoralEducationServiceImpl.ExamResultWrapper>> studentResults = monthlyResults
.getOrDefault(month, Collections.emptyList()) .getOrDefault(month, Collections.emptyList())
.stream() .stream()
.filter(wrapper -> targetStudentIds.contains(wrapper.getStudentId())) .filter(wrapper -> targetStudentIds.contains(wrapper.getStudentId()))
.collect(Collectors.groupingBy(ExamResultWrapper::getStudentId)); .collect(Collectors.groupingBy(MoralEducationServiceImpl.ExamResultWrapper::getStudentId));
// 初始化知识块总分计数器 // 初始化知识块总分计数器
Map<String, Double> blockTotalScores = new HashMap<>(); Map<String, Double> blockTotalScores = new HashMap<>();
@ -1651,9 +1649,9 @@ public class MoralEducationServiceImpl implements MoralEducationService {
// 遍历所有目标学生 // 遍历所有目标学生
targetStudentIds.forEach(studentId -> { targetStudentIds.forEach(studentId -> {
List<ExamResultWrapper> wrappers = studentResults.getOrDefault(studentId, Collections.emptyList()); List<MoralEducationServiceImpl.ExamResultWrapper> wrappers = studentResults.getOrDefault(studentId, Collections.emptyList());
List<ExamClassResult> examResults = wrappers.stream() List<ExamClassResult> examResults = wrappers.stream()
.map(ExamResultWrapper::getResult) .map(MoralEducationServiceImpl.ExamResultWrapper::getResult)
.collect(Collectors.toList()); .collect(Collectors.toList());
// 1. 计算知识点得分(保留原始逻辑) // 1. 计算知识点得分(保留原始逻辑)
@ -1661,11 +1659,11 @@ public class MoralEducationServiceImpl implements MoralEducationService {
studentId, studentId,
examResults, examResults,
wrappers.stream().collect(Collectors.toMap( wrappers.stream().collect(Collectors.toMap(
ExamResultWrapper::getExamId, MoralEducationServiceImpl.ExamResultWrapper::getExamId,
ExamResultWrapper::getKnowledge)), MoralEducationServiceImpl.ExamResultWrapper::getKnowledge)),
wrappers.stream().collect(Collectors.toMap( wrappers.stream().collect(Collectors.toMap(
ExamResultWrapper::getExamId, MoralEducationServiceImpl.ExamResultWrapper::getExamId,
ExamResultWrapper::getPoints)) MoralEducationServiceImpl.ExamResultWrapper::getPoints))
); );
// 2. 计算每个知识块的客观得分(新增关键逻辑) // 2. 计算每个知识块的客观得分(新增关键逻辑)

Loading…
Cancel
Save