feat: 教师端成绩列表AI评测成绩列返回真实数据——按教学班任务聚合各任务ai_assessment_score(六项目加权,同教师评分口径,实时读作答表)

main
chenyuan 9 hours ago
parent e5a2bd740f
commit e2ee0b1d42

@ -441,6 +441,7 @@ public class TeaScoreController {
rank.setCompletedTaskCount(0); rank.setCompletedTaskCount(0);
rank.setTrainingProgress(null); rank.setTrainingProgress(null);
rank.setTeacherScore(null); rank.setTeacherScore(null);
rank.setAiAssessmentScore(null);
continue; continue;
} }
List<StudentTrainingAnswer> answers = studentTrainingAnswerMapper == null ? Collections.emptyList() List<StudentTrainingAnswer> answers = studentTrainingAnswerMapper == null ? Collections.emptyList()
@ -454,6 +455,7 @@ public class TeaScoreController {
.multiply(BigDecimal.valueOf(100)) .multiply(BigDecimal.valueOf(100))
.divide(BigDecimal.valueOf(totalTaskCount), 2, BigDecimal.ROUND_HALF_UP)); .divide(BigDecimal.valueOf(totalTaskCount), 2, BigDecimal.ROUND_HALF_UP));
rank.setTeacherScore(calculateTeacherScore(classId, allocations, answersByTaskKey)); rank.setTeacherScore(calculateTeacherScore(classId, allocations, answersByTaskKey));
rank.setAiAssessmentScore(calculateAiAssessmentScore(classId, allocations, answersByTaskKey));
} }
} }
@ -551,6 +553,48 @@ public class TeaScoreController {
if (!hasTeacherScore) { if (!hasTeacherScore) {
return null; 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); TeachingClassScoreWeight weight = teacherScoreService.getOrCreateWeightForCalculation(classId);
if (weight == null) { if (weight == null) {
return null; return null;

@ -52,6 +52,9 @@ public class StuRank {
@ApiModelProperty(notes = "老师人工评分(查询时从教学班评分表读取)") @ApiModelProperty(notes = "老师人工评分(查询时从教学班评分表读取)")
private BigDecimal teacherScore; private BigDecimal teacherScore;
@ApiModelProperty(notes = "AI评测成绩(查询时按教学班任务聚合各任务ai_assessment_score,不落库)")
private BigDecimal aiAssessmentScore;
@ApiModelProperty(notes = "市场需求挖掘分数") @ApiModelProperty(notes = "市场需求挖掘分数")
private BigDecimal scqxwjScore; private BigDecimal scqxwjScore;
@ -200,6 +203,14 @@ public class StuRank {
this.teacherScore = teacherScore; this.teacherScore = teacherScore;
} }
public BigDecimal getAiAssessmentScore() {
return aiAssessmentScore;
}
public void setAiAssessmentScore(BigDecimal aiAssessmentScore) {
this.aiAssessmentScore = aiAssessmentScore;
}
public BigDecimal getScqxwjScore() { public BigDecimal getScqxwjScore() {
return scqxwjScore; return scqxwjScore;
} }

Loading…
Cancel
Save