fix(aihr): align task labels and training duration

This commit is contained in:
2026-07-14 14:15:02 +08:00
parent 23328f66ff
commit 8bb43a2394
6 changed files with 92 additions and 7 deletions
@@ -1568,7 +1568,12 @@ public class AihrPracticeSeedService {
COALESCE(ROUND(AVG(dim_communication)), 0) communication,
COALESCE(ROUND(AVG(dim_emotion)), 0) emotion,
COALESCE(ROUND(AVG(dim_marketing)), 0) marketing,
COALESCE(SUM(incentive_point), 0) incentive_points
COALESCE(SUM(incentive_point), 0) incentive_points,
COALESCE(ROUND(SUM(CASE
WHEN started_time IS NOT NULL AND finished_time IS NOT NULL
THEN GREATEST(TIMESTAMPDIFF(SECOND, started_time, finished_time), 0)
ELSE 0
END) / 60.0), 0) training_minutes
FROM aihr_practice_session
WHERE tenant_id = ? AND mode = 'mobile' AND (? = '' OR ext_party_id = ?)
""", (rs, rowNum) -> new CompetencySnapshot(
@@ -1579,10 +1584,11 @@ public class AihrPracticeSeedService {
rs.getInt("communication"),
rs.getInt("emotion"),
rs.getInt("marketing"),
rs.getInt("incentive_points")
rs.getInt("incentive_points"),
rs.getInt("training_minutes")
), tenantId(), party, party);
CompetencySnapshot snapshot = rows.isEmpty() ? new CompetencySnapshot(0, 0, 0, 0, 0, 0, 0, 0) : rows.get(0);
int trainingMinutes = snapshot.completed() * 8;
CompetencySnapshot snapshot = rows.isEmpty() ? new CompetencySnapshot(0, 0, 0, 0, 0, 0, 0, 0, 0) : rows.get(0);
int trainingMinutes = snapshot.trainingMinutes();
int contribution = Math.min(100, Math.max(0, snapshot.incentivePoints()));
int assessmentScore = snapshot.score();
String aiLevel = aiLevel(snapshot.completed(), assessmentScore);
@@ -3894,7 +3900,7 @@ public class AihrPracticeSeedService {
return Math.round((left + right) / 2.0f);
}
private record CompetencySnapshot(Integer completed, Integer score, Integer pendingReview, Integer compliance, Integer communication, Integer emotion, Integer marketing, Integer incentivePoints) {
private record CompetencySnapshot(Integer completed, Integer score, Integer pendingReview, Integer compliance, Integer communication, Integer emotion, Integer marketing, Integer incentivePoints, Integer trainingMinutes) {
}
private record EvidenceScoreSnapshot(Integer aiScore, Integer humanScore, Integer finalScore, Integer calibrationCount) {
@@ -677,7 +677,8 @@ public class AihrPracticeSeedServiceTest {
"communication", "0",
"emotion", "0",
"marketing", "0",
"incentive_points", "0"
"incentive_points", "0",
"training_minutes", "0"
)));
AihrPracticeSeedService service = new AihrPracticeSeedService(new ObjectMapper(), jdbcTemplate, null, null);
@@ -724,13 +725,15 @@ public class AihrPracticeSeedServiceTest {
"communication", "80",
"emotion", "78",
"marketing", "74",
"incentive_points", "20"
"incentive_points", "20",
"training_minutes", "42"
)));
AihrPracticeSeedService service = new AihrPracticeSeedService(new ObjectMapper(), jdbcTemplate, null, null);
CompetencyResponse profile = service.competency("13900001001");
assertEquals("初级", profile.aiLevel());
assertEquals(42, profile.trainingMinutes());
assertEquals(20, profile.contribution());
assertEquals(100, profile.growthPath().get(0).progress());
assertEquals("已达成", profile.growthPath().get(0).status());