|
|
|
@ -702,7 +702,20 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
|
if (examResults != null && !examResults.isEmpty()) {
|
|
|
|
|
// 遍历班级中的每个学生
|
|
|
|
|
for (ExamClassResult examResult : examResults) {
|
|
|
|
|
if (!examResult.getInfo().getId().equals(classId)) continue;
|
|
|
|
|
if (!examResult.getInfo().getId().equals(classId)){
|
|
|
|
|
// 无考试数据时,初始化所有学生的默认分数为60
|
|
|
|
|
if (groupList != null) {
|
|
|
|
|
for (RMember member : groupList.members) {
|
|
|
|
|
String studentId = member.getId();
|
|
|
|
|
String studentName = studentIdToName.getOrDefault(studentId, "未知学生");
|
|
|
|
|
Map<String, Double> defaultScores = new HashMap<>();
|
|
|
|
|
for (String block : knowledgeBlocks) {
|
|
|
|
|
defaultScores.put(block, 84.0); // 初始化为60分
|
|
|
|
|
}
|
|
|
|
|
studentScoreRates.put(studentName, defaultScores);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
List<Integer> statuses = examResult.getStatus();
|
|
|
|
|
for (int i = 0; i < examResult.getStudentIds().size(); i++) {
|
|
|
|
|
String studentId = examResult.getStudentIds().get(i);
|
|
|
|
@ -726,6 +739,8 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
// 无考试数据时,初始化所有学生的默认分数为60
|
|
|
|
|
if (groupList != null) {
|
|
|
|
@ -734,7 +749,7 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
|
String studentName = studentIdToName.getOrDefault(studentId, "未知学生");
|
|
|
|
|
Map<String, Double> defaultScores = new HashMap<>();
|
|
|
|
|
for (String block : knowledgeBlocks) {
|
|
|
|
|
defaultScores.put(block, 60.0); // 初始化为60分
|
|
|
|
|
defaultScores.put(block, 84.0); // 初始化为60分
|
|
|
|
|
}
|
|
|
|
|
studentScoreRates.put(studentName, defaultScores);
|
|
|
|
|
}
|
|
|
|
@ -1376,7 +1391,7 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取每月各个知识库综合得分以及整体得分内容
|
|
|
|
|
public List<Map<String, Object>> getStudentMonthlyScores(LaborDto laborDto,HttpServletRequest request) {
|
|
|
|
|
public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto laborDto,HttpServletRequest request) {
|
|
|
|
|
// 1. 获取基础信息
|
|
|
|
|
String schoolId = SecurityUtil.getLoginUser().getSchoolId();
|
|
|
|
|
String studentId = laborDto.getStudentId();
|
|
|
|
@ -1384,6 +1399,8 @@ public List<Map<String, Object>> getStudentMonthlyScores(LaborDto laborDto,HttpS
|
|
|
|
|
// 2. 获取相关开课记录
|
|
|
|
|
List<LessonRecord> records = getLessonRecords(laborDto, schoolId);
|
|
|
|
|
List<RecordVo> res;
|
|
|
|
|
int rightCount = 0;
|
|
|
|
|
int wrongCount = 0;
|
|
|
|
|
if (laborDto.getClassId() == null) {
|
|
|
|
|
res = appraiseRecordRepository.getStudentRecords(
|
|
|
|
|
String.format(PK.PK_APPRAISE_RECORD, schoolId),
|
|
|
|
@ -1392,6 +1409,10 @@ public List<Map<String, Object>> getStudentMonthlyScores(LaborDto laborDto,HttpS
|
|
|
|
|
laborDto.getEndTime(),
|
|
|
|
|
"德育"
|
|
|
|
|
);
|
|
|
|
|
//表扬的次数
|
|
|
|
|
rightCount = (int) res.stream().filter(RecordVo::isPraise).count();
|
|
|
|
|
//批评的次数
|
|
|
|
|
wrongCount = (int) res.stream().filter(record -> !record.isPraise()).count();
|
|
|
|
|
}else {
|
|
|
|
|
//当班级ID 存在时 获取该班级下所有名单即学生Id
|
|
|
|
|
List<String> classIds = Collections.singletonList(laborDto.getClassId());
|
|
|
|
@ -1428,6 +1449,10 @@ public List<Map<String, Object>> getStudentMonthlyScores(LaborDto laborDto,HttpS
|
|
|
|
|
"德育",
|
|
|
|
|
classIds
|
|
|
|
|
);
|
|
|
|
|
//表扬的次数
|
|
|
|
|
rightCount = (int) res.stream().filter(RecordVo::isPraise).count();
|
|
|
|
|
//批评的次数
|
|
|
|
|
wrongCount = (int) res.stream().filter(record -> !record.isPraise()).count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 3. 获取考试及知识点映射
|
|
|
|
@ -1493,7 +1518,7 @@ public List<Map<String, Object>> getStudentMonthlyScores(LaborDto laborDto,HttpS
|
|
|
|
|
|
|
|
|
|
// 6. 处理每月数据,传入主观评价统计结果
|
|
|
|
|
|
|
|
|
|
return processMonthlyData(
|
|
|
|
|
return processMonthlyData(records,res,rightCount,wrongCount,
|
|
|
|
|
targetStudents,
|
|
|
|
|
monthlyResults,
|
|
|
|
|
knowledgeBlockMap,
|
|
|
|
@ -1651,14 +1676,24 @@ public List<Map<String, Object>> getStudentMonthlyScores(LaborDto laborDto,HttpS
|
|
|
|
|
return monthlyResults;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<Map<String, Object>> processMonthlyData(
|
|
|
|
|
private Map<String,List<Map<String, Object>>> processMonthlyData(
|
|
|
|
|
List<LessonRecord> records,List<RecordVo> res,int rightCount,int wrongCount,
|
|
|
|
|
List<String> targetStudentIds,
|
|
|
|
|
Map<Integer, List<ExamResultWrapper>> monthlyResults,
|
|
|
|
|
Map<String, List<String>> knowledgeBlockMap,
|
|
|
|
|
Set<Integer> months,
|
|
|
|
|
Map<String, Map<Integer, Integer>> blockMonthlyCounts) {
|
|
|
|
|
|
|
|
|
|
return months.stream().map(month -> {
|
|
|
|
|
Map<String,List<Map<String, Object>>> detailList = new HashMap<>();
|
|
|
|
|
List<Map<String, Object>> details = new ArrayList<>();
|
|
|
|
|
Map<String, Object> detail = new HashMap<>();
|
|
|
|
|
detail.put("rightCount", rightCount);
|
|
|
|
|
detail.put("wrongCount", wrongCount);
|
|
|
|
|
detail.put("recordCount", records.size());
|
|
|
|
|
detail.put("resCount", res.size());
|
|
|
|
|
details.add(detail);
|
|
|
|
|
detailList.put("detail",details);
|
|
|
|
|
List<Map<String, Object>> collect = months.stream().map(month -> {
|
|
|
|
|
Map<String, Object> monthEntry = new LinkedHashMap<>();
|
|
|
|
|
monthEntry.put("month", month);
|
|
|
|
|
List<Map<String, Object>> scoreList = new ArrayList<>();
|
|
|
|
@ -1753,6 +1788,8 @@ public List<Map<String, Object>> getStudentMonthlyScores(LaborDto laborDto,HttpS
|
|
|
|
|
return monthEntry;
|
|
|
|
|
}).sorted(Comparator.comparingInt(m -> (Integer) m.get("month")))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
detailList.put("collect", collect);
|
|
|
|
|
return detailList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 新增方法:计算主观评分转换后的得分
|
|
|
|
|