|
|
|
|
@ -441,6 +441,7 @@ public class TeaScoreController {
|
|
|
|
|
rank.setCompletedTaskCount(0);
|
|
|
|
|
rank.setTrainingProgress(null);
|
|
|
|
|
rank.setTeacherScore(null);
|
|
|
|
|
rank.setAiAssessmentScore(null);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
List<StudentTrainingAnswer> answers = studentTrainingAnswerMapper == null ? Collections.emptyList()
|
|
|
|
|
@ -454,6 +455,7 @@ public class TeaScoreController {
|
|
|
|
|
.multiply(BigDecimal.valueOf(100))
|
|
|
|
|
.divide(BigDecimal.valueOf(totalTaskCount), 2, BigDecimal.ROUND_HALF_UP));
|
|
|
|
|
rank.setTeacherScore(calculateTeacherScore(classId, allocations, answersByTaskKey));
|
|
|
|
|
rank.setAiAssessmentScore(calculateAiAssessmentScore(classId, allocations, answersByTaskKey));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -551,6 +553,48 @@ public class TeaScoreController {
|
|
|
|
|
if (!hasTeacherScore) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return weightedSixModuleScore(classId, scoresByProject, comprehensiveParticipating);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* AI评测成绩:与教师评分同一套六项目加权口径,聚合各任务的 ai_assessment_score。
|
|
|
|
|
* 直接读 student_training_answer(实时),AI 评分完成即可见于教师端。
|
|
|
|
|
*/
|
|
|
|
|
private BigDecimal calculateAiAssessmentScore(String classId, List<TaskAllocation> allocations,
|
|
|
|
|
Map<String, StudentTrainingAnswer> answersByTaskKey) {
|
|
|
|
|
if (teacherScoreService == null || trainingTaskMapper == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
Map<String, List<BigDecimal>> scoresByProject = new HashMap<>();
|
|
|
|
|
boolean hasAiScore = false;
|
|
|
|
|
boolean comprehensiveParticipating = false;
|
|
|
|
|
for (TaskAllocation allocation : allocations) {
|
|
|
|
|
if (allocation == null || StringUtils.isBlank(allocation.getModule())) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if ("comprehensive-case-training".equals(allocation.getModule())) {
|
|
|
|
|
comprehensiveParticipating = true;
|
|
|
|
|
}
|
|
|
|
|
TrainingTask task = trainingTaskMapper.selectByTaskKey(allocation.getModule());
|
|
|
|
|
if (task == null || StringUtils.isBlank(task.getProjectName())) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
StudentTrainingAnswer answer = answersByTaskKey.get(allocation.getModule());
|
|
|
|
|
Integer taskScore = answer == null ? null : answer.getAiAssessmentScore();
|
|
|
|
|
if (taskScore != null) {
|
|
|
|
|
hasAiScore = true;
|
|
|
|
|
}
|
|
|
|
|
scoresByProject.computeIfAbsent(task.getProjectName(), key -> new ArrayList<>())
|
|
|
|
|
.add(taskScore == null ? BigDecimal.ZERO : BigDecimal.valueOf(taskScore));
|
|
|
|
|
}
|
|
|
|
|
if (!hasAiScore) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return weightedSixModuleScore(classId, scoresByProject, comprehensiveParticipating);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private BigDecimal weightedSixModuleScore(String classId, Map<String, List<BigDecimal>> scoresByProject,
|
|
|
|
|
boolean comprehensiveParticipating) {
|
|
|
|
|
TeachingClassScoreWeight weight = teacherScoreService.getOrCreateWeightForCalculation(classId);
|
|
|
|
|
if (weight == null) {
|
|
|
|
|
return null;
|
|
|
|
|
|