From e2ee0b1d424b70b0dafb3b19befbe1e6b60d04bc Mon Sep 17 00:00:00 2001 From: chenyuan Date: Wed, 14 Oct 2026 18:46:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=95=99=E5=B8=88=E7=AB=AF=E6=88=90?= =?UTF-8?q?=E7=BB=A9=E5=88=97=E8=A1=A8AI=E8=AF=84=E6=B5=8B=E6=88=90?= =?UTF-8?q?=E7=BB=A9=E5=88=97=E8=BF=94=E5=9B=9E=E7=9C=9F=E5=AE=9E=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E2=80=94=E2=80=94=E6=8C=89=E6=95=99=E5=AD=A6=E7=8F=AD?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E8=81=9A=E5=90=88=E5=90=84=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?ai=5Fassessment=5Fscore=EF=BC=88=E5=85=AD=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=8A=A0=E6=9D=83=EF=BC=8C=E5=90=8C=E6=95=99=E5=B8=88=E8=AF=84?= =?UTF-8?q?=E5=88=86=E5=8F=A3=E5=BE=84=EF=BC=8C=E5=AE=9E=E6=97=B6=E8=AF=BB?= =?UTF-8?q?=E4=BD=9C=E7=AD=94=E8=A1=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/stu/TeaScoreController.java | 44 +++++++++++++++++++ .../sztzjy/linkCommerce/entity/StuRank.java | 11 +++++ 2 files changed, 55 insertions(+) diff --git a/src/main/java/com/sztzjy/linkCommerce/controller/stu/TeaScoreController.java b/src/main/java/com/sztzjy/linkCommerce/controller/stu/TeaScoreController.java index 9cecea3..5d3001a 100644 --- a/src/main/java/com/sztzjy/linkCommerce/controller/stu/TeaScoreController.java +++ b/src/main/java/com/sztzjy/linkCommerce/controller/stu/TeaScoreController.java @@ -441,6 +441,7 @@ public class TeaScoreController { rank.setCompletedTaskCount(0); rank.setTrainingProgress(null); rank.setTeacherScore(null); + rank.setAiAssessmentScore(null); continue; } List 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 allocations, + Map answersByTaskKey) { + if (teacherScoreService == null || trainingTaskMapper == null) { + return null; + } + Map> 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> scoresByProject, + boolean comprehensiveParticipating) { TeachingClassScoreWeight weight = teacherScoreService.getOrCreateWeightForCalculation(classId); if (weight == null) { return null; diff --git a/src/main/java/com/sztzjy/linkCommerce/entity/StuRank.java b/src/main/java/com/sztzjy/linkCommerce/entity/StuRank.java index 7dfe7fe..dd1e822 100644 --- a/src/main/java/com/sztzjy/linkCommerce/entity/StuRank.java +++ b/src/main/java/com/sztzjy/linkCommerce/entity/StuRank.java @@ -52,6 +52,9 @@ public class StuRank { @ApiModelProperty(notes = "老师人工评分(查询时从教学班评分表读取)") private BigDecimal teacherScore; + @ApiModelProperty(notes = "AI评测成绩(查询时按教学班任务聚合各任务ai_assessment_score,不落库)") + private BigDecimal aiAssessmentScore; + @ApiModelProperty(notes = "市场需求挖掘分数") private BigDecimal scqxwjScore; @@ -200,6 +203,14 @@ public class StuRank { this.teacherScore = teacherScore; } + public BigDecimal getAiAssessmentScore() { + return aiAssessmentScore; + } + + public void setAiAssessmentScore(BigDecimal aiAssessmentScore) { + this.aiAssessmentScore = aiAssessmentScore; + } + public BigDecimal getScqxwjScore() { return scqxwjScore; }