|
|
@ -126,7 +126,8 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
academicYearId,
|
|
|
|
academicYearId,
|
|
|
|
startTime,
|
|
|
|
startTime,
|
|
|
|
endTime,
|
|
|
|
endTime,
|
|
|
|
classIds
|
|
|
|
classIds,
|
|
|
|
|
|
|
|
"德育"
|
|
|
|
);
|
|
|
|
);
|
|
|
|
//表扬的次数
|
|
|
|
//表扬的次数
|
|
|
|
int rightCount = (int) res.stream().filter(RecordVo::isPraise).count();
|
|
|
|
int rightCount = (int) res.stream().filter(RecordVo::isPraise).count();
|
|
|
@ -138,6 +139,11 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
.filter(Objects::nonNull) // 过滤掉 null 值
|
|
|
|
.filter(Objects::nonNull) // 过滤掉 null 值
|
|
|
|
.distinct()
|
|
|
|
.distinct()
|
|
|
|
.count();
|
|
|
|
.count();
|
|
|
|
|
|
|
|
List<String> targetId = res.stream()
|
|
|
|
|
|
|
|
.map(RecordVo::getTargetId)
|
|
|
|
|
|
|
|
.filter(Objects::nonNull) // 过滤掉 null 值
|
|
|
|
|
|
|
|
.distinct()
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
List<String> recordIds = new ArrayList<>();
|
|
|
|
List<String> recordIds = new ArrayList<>();
|
|
|
|
for (LessonRecord record : records) {
|
|
|
|
for (LessonRecord record : records) {
|
|
|
@ -298,6 +304,7 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
convertedScore = 100.0; // 如果次数超过最大次数,设置为满分
|
|
|
|
convertedScore = 100.0; // 如果次数超过最大次数,设置为满分
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
convertedScore = (count / maxCount) * 100;
|
|
|
|
convertedScore = (count / maxCount) * 100;
|
|
|
|
|
|
|
|
convertedScore = Double.parseDouble(String.format("%.2f", convertedScore));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
subjectiveTotal += convertedScore;
|
|
|
|
subjectiveTotal += convertedScore;
|
|
|
|
|
|
|
|
|
|
|
@ -310,7 +317,7 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
String combinedScore = count + "/" + objectiveScore;
|
|
|
|
String combinedScore = count + "/" + objectiveScore;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
double finalCount = convertedScore;
|
|
|
|
double finalCount = convertedScore;
|
|
|
|
double finalScore = score / knowledgeBlockCount;
|
|
|
|
double finalScore = score;
|
|
|
|
finalScore = Double.parseDouble(String.format("%.2f", finalScore));
|
|
|
|
finalScore = Double.parseDouble(String.format("%.2f", finalScore));
|
|
|
|
double finalScore1 = finalScore;
|
|
|
|
double finalScore1 = finalScore;
|
|
|
|
combinedScores.put(knowledgeBlock, new HashMap<String, Object>() {{
|
|
|
|
combinedScores.put(knowledgeBlock, new HashMap<String, Object>() {{
|
|
|
@ -324,15 +331,19 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 计算客观平均分
|
|
|
|
// 计算客观平均分
|
|
|
|
double objectiveAverage = (knowledgeBlockCount > 0) ? objectiveTotal : 0.0;
|
|
|
|
double objectiveAverage = (knowledgeBlockCount > 0) ? objectiveTotal / knowledgeBlockCount : 0.0;
|
|
|
|
|
|
|
|
objectiveAverage = Double.parseDouble(String.format("%.2f", objectiveAverage));
|
|
|
|
|
|
|
|
//计算主观平均分
|
|
|
|
|
|
|
|
double subjectiveAverage = (subjectiveTotal > 0) ? subjectiveTotal / knowledgeBlockCount : 0.0;
|
|
|
|
|
|
|
|
subjectiveAverage = Double.parseDouble(String.format("%.2f", subjectiveAverage));
|
|
|
|
|
|
|
|
|
|
|
|
// 计算综合得分(主观占 60%,客观占 40%)
|
|
|
|
// 计算综合得分(主观占 60%,客观占 40%)
|
|
|
|
double compositeScore = (subjectiveTotal * 0.6) + (objectiveAverage * 0.4);
|
|
|
|
double compositeScore = (subjectiveAverage * 0.6) + (objectiveAverage * 0.4);
|
|
|
|
compositeScore = Double.parseDouble(String.format("%.2f", compositeScore));
|
|
|
|
compositeScore = Double.parseDouble(String.format("%.2f", compositeScore));
|
|
|
|
|
|
|
|
|
|
|
|
// 更新返回数据
|
|
|
|
// 更新返回数据
|
|
|
|
studentResult.put("scores", combinedScores);
|
|
|
|
studentResult.put("scores", combinedScores);
|
|
|
|
studentResult.put("subjectiveTotal", subjectiveTotal);
|
|
|
|
studentResult.put("subjectiveTotal", subjectiveAverage);
|
|
|
|
studentResult.put("objectiveTotal", objectiveAverage);
|
|
|
|
studentResult.put("objectiveTotal", objectiveAverage);
|
|
|
|
studentResult.put("compositeScore", compositeScore);
|
|
|
|
studentResult.put("compositeScore", compositeScore);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -639,7 +650,13 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
String block = entry.getKey();
|
|
|
|
String block = entry.getKey();
|
|
|
|
int count = entry.getValue();
|
|
|
|
int count = entry.getValue();
|
|
|
|
double maxCount = 50.0;
|
|
|
|
double maxCount = 50.0;
|
|
|
|
double convertedScore = (count / maxCount) * 100;
|
|
|
|
double convertedScore;
|
|
|
|
|
|
|
|
if (count > maxCount) {
|
|
|
|
|
|
|
|
convertedScore = 100.0; // 如果次数超过最大次数,设置为满分
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
convertedScore = (count / maxCount) * 100;
|
|
|
|
|
|
|
|
convertedScore = Double.parseDouble(String.format("%.2f", convertedScore));
|
|
|
|
|
|
|
|
}
|
|
|
|
convertedScores.put(block, convertedScore);
|
|
|
|
convertedScores.put(block, convertedScore);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -743,65 +760,68 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
Map<String, List<Double>> points,
|
|
|
|
Map<String, List<Double>> points,
|
|
|
|
Map<String, Double> knowledgeTotalScore) {
|
|
|
|
Map<String, Double> knowledgeTotalScore) {
|
|
|
|
|
|
|
|
|
|
|
|
// 记录每个知识点在所有考试中的平均分总和及考试次数
|
|
|
|
|
|
|
|
Map<String, Double> knowledgeTotalAverage = new HashMap<>();
|
|
|
|
Map<String, Double> knowledgeTotalAverage = new HashMap<>();
|
|
|
|
Map<String, Integer> knowledgeExamCount = new HashMap<>();
|
|
|
|
Map<String, Integer> knowledgeExamCount = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
// 过滤出当前学生的考试结果
|
|
|
|
|
|
|
|
for (ExamClassResult examResult : examResults) {
|
|
|
|
for (ExamClassResult examResult : examResults) {
|
|
|
|
int studentIndex = examResult.getStudentIds().indexOf(studentId);
|
|
|
|
int studentIndex = examResult.getStudentIds().indexOf(studentId);
|
|
|
|
if (studentIndex == -1) continue;
|
|
|
|
if (studentIndex == -1) continue;
|
|
|
|
int status = examResult.getStatus().get(studentIndex);
|
|
|
|
int status = examResult.getStatus().get(studentIndex);
|
|
|
|
if (status == 1) continue; // 跳过无效考试
|
|
|
|
if (status == 1) continue;
|
|
|
|
|
|
|
|
|
|
|
|
// 获取当前考试的知识点和题目分数
|
|
|
|
|
|
|
|
List<List<String>> knowledgeList = knowledgeMap.get(examResult.getExamId());
|
|
|
|
List<List<String>> knowledgeList = knowledgeMap.get(examResult.getExamId());
|
|
|
|
List<Double> pointList = points.get(examResult.getExamId());
|
|
|
|
List<Double> pointList = points.get(examResult.getExamId());
|
|
|
|
if (knowledgeList == null || pointList == null) continue;
|
|
|
|
if (knowledgeList == null || pointList == null) continue;
|
|
|
|
|
|
|
|
|
|
|
|
// 获取学生的得分列表
|
|
|
|
|
|
|
|
List<List<Double>> studentScores = examResult.getStudentScores();
|
|
|
|
List<List<Double>> studentScores = examResult.getStudentScores();
|
|
|
|
if (studentIndex >= studentScores.size() || studentScores.get(studentIndex) == null) continue;
|
|
|
|
if (studentIndex >= studentScores.size() || studentScores.get(studentIndex) == null) continue;
|
|
|
|
List<Double> studentScoreList = studentScores.get(studentIndex);
|
|
|
|
List<Double> studentScoreList = studentScores.get(studentIndex);
|
|
|
|
|
|
|
|
|
|
|
|
// 确保数据一致性
|
|
|
|
|
|
|
|
if (knowledgeList.size() != studentScoreList.size()) continue;
|
|
|
|
if (knowledgeList.size() != studentScoreList.size()) continue;
|
|
|
|
|
|
|
|
|
|
|
|
// 记录当前考试中每个知识点的总得分和题目数量
|
|
|
|
|
|
|
|
Map<String, Double> currentExamKnowledgeTotal = new HashMap<>();
|
|
|
|
Map<String, Double> currentExamKnowledgeTotal = new HashMap<>();
|
|
|
|
Map<String, Integer> currentExamKnowledgeCount = new HashMap<>();
|
|
|
|
Map<String, Integer> currentExamKnowledgeCount = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
// 遍历每道题
|
|
|
|
// 遍历每道题
|
|
|
|
for (int i = 0; i < studentScoreList.size(); i++) {
|
|
|
|
for (int i = 0; i < studentScoreList.size(); i++) {
|
|
|
|
String knowledge = knowledgeList.get(i).get(0); // 取第一个知识点
|
|
|
|
List<String> knowledgePoints = knowledgeList.get(i); // 题目对应的知识点列表
|
|
|
|
double score = studentScoreList.get(i);
|
|
|
|
double score = studentScoreList.get(i);
|
|
|
|
|
|
|
|
|
|
|
|
// 累加当前考试中该知识点的总得分和题目数量
|
|
|
|
// 如果题目没有知识点或得分为空,跳过
|
|
|
|
currentExamKnowledgeTotal.merge(knowledge, score, Double::sum);
|
|
|
|
if (knowledgePoints.isEmpty() || score < 0) continue;
|
|
|
|
currentExamKnowledgeCount.merge(knowledge, 1, Integer::sum);
|
|
|
|
|
|
|
|
|
|
|
|
// 将题目得分分摊到每个知识点
|
|
|
|
|
|
|
|
double scorePerKnowledge = score / knowledgePoints.size();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 遍历该题的所有知识点
|
|
|
|
|
|
|
|
for (String knowledge : knowledgePoints) {
|
|
|
|
|
|
|
|
// 累加当前考试中该知识点的总得分和题目数量
|
|
|
|
|
|
|
|
currentExamKnowledgeTotal.merge(knowledge, scorePerKnowledge, Double::sum);
|
|
|
|
|
|
|
|
currentExamKnowledgeCount.merge(knowledge, 1, Integer::sum);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 计算当前考试中每个知识点的平均分,并累加到总平均分
|
|
|
|
// 计算当前考试中每个知识点的平均分(总得分/题目数量)
|
|
|
|
for (String knowledge : currentExamKnowledgeTotal.keySet()) {
|
|
|
|
for (String knowledge : currentExamKnowledgeTotal.keySet()) {
|
|
|
|
double total = currentExamKnowledgeTotal.get(knowledge);
|
|
|
|
double total = currentExamKnowledgeTotal.get(knowledge);
|
|
|
|
int count = currentExamKnowledgeCount.get(knowledge);
|
|
|
|
int count = currentExamKnowledgeCount.get(knowledge);
|
|
|
|
double average = total / count; // 当前考试内该知识点的平均分
|
|
|
|
double average = total / count;
|
|
|
|
|
|
|
|
|
|
|
|
// 将该考试的平均分累加到总平均分中,并增加考试次数
|
|
|
|
// 累加跨考试的总平均分和考试次数
|
|
|
|
knowledgeTotalAverage.merge(knowledge, average, Double::sum);
|
|
|
|
knowledgeTotalAverage.merge(knowledge, average, Double::sum);
|
|
|
|
knowledgeExamCount.merge(knowledge, 1, Integer::sum);
|
|
|
|
knowledgeExamCount.merge(knowledge, 1, Integer::sum);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 计算每个知识点的最终平均分(所有考试平均分的平均)
|
|
|
|
// 计算最终平均分(所有考试平均分的平均)
|
|
|
|
for (String knowledge : knowledgeTotalAverage.keySet()) {
|
|
|
|
for (String knowledge : knowledgeTotalAverage.keySet()) {
|
|
|
|
double totalAverage = knowledgeTotalAverage.get(knowledge);
|
|
|
|
double totalAverage = knowledgeTotalAverage.get(knowledge);
|
|
|
|
int examCount = knowledgeExamCount.getOrDefault(knowledge, 1);
|
|
|
|
int examCount = knowledgeExamCount.get(knowledge);
|
|
|
|
double finalAverage = totalAverage / examCount;
|
|
|
|
double finalAverage = totalAverage / examCount;
|
|
|
|
|
|
|
|
finalAverage = Double.parseDouble(String.format("%.2f", finalAverage));
|
|
|
|
knowledgeTotalScore.put(knowledge, finalAverage);
|
|
|
|
knowledgeTotalScore.put(knowledge, finalAverage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 返回知识点平均分对象列表
|
|
|
|
|
|
|
|
return knowledgeTotalScore.entrySet().stream()
|
|
|
|
return knowledgeTotalScore.entrySet().stream()
|
|
|
|
.map(entry -> new KnowledgeScoreRate(entry.getKey(), entry.getValue()))
|
|
|
|
.map(entry -> new KnowledgeScoreRate(entry.getKey(), entry.getValue()))
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
@ -873,7 +893,13 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
String block = entry.getKey();
|
|
|
|
String block = entry.getKey();
|
|
|
|
int count = entry.getValue();
|
|
|
|
int count = entry.getValue();
|
|
|
|
double maxCount = 50.0;
|
|
|
|
double maxCount = 50.0;
|
|
|
|
double convertedScore = (count / maxCount) * 100;
|
|
|
|
double convertedScore;
|
|
|
|
|
|
|
|
if (count > maxCount) {
|
|
|
|
|
|
|
|
convertedScore = 100.0; // 如果次数超过最大次数,设置为满分
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
convertedScore = (count / maxCount) * 100;
|
|
|
|
|
|
|
|
convertedScore = Double.parseDouble(String.format("%.2f", convertedScore));
|
|
|
|
|
|
|
|
}
|
|
|
|
convertedScores.put(block, convertedScore);
|
|
|
|
convertedScores.put(block, convertedScore);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1054,7 +1080,13 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
String block = entry.getKey();
|
|
|
|
String block = entry.getKey();
|
|
|
|
int count = entry.getValue();
|
|
|
|
int count = entry.getValue();
|
|
|
|
double maxCount = 50.0;
|
|
|
|
double maxCount = 50.0;
|
|
|
|
double convertedScore = (count / maxCount) * 100;
|
|
|
|
double convertedScore;
|
|
|
|
|
|
|
|
if (count > maxCount) {
|
|
|
|
|
|
|
|
convertedScore = 100.0; // 如果次数超过最大次数,设置为满分
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
convertedScore = (count / maxCount) * 100;
|
|
|
|
|
|
|
|
convertedScore = Double.parseDouble(String.format("%.2f", convertedScore));
|
|
|
|
|
|
|
|
}
|
|
|
|
convertedScores.put(block, convertedScore);
|
|
|
|
convertedScores.put(block, convertedScore);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|