feat(aihr): export human calibration evidence

This commit is contained in:
2026-07-14 03:36:02 +08:00
parent 5e3dfd0085
commit 65e6483d23
7 changed files with 58 additions and 9 deletions
@@ -187,8 +187,16 @@ public class AihrPracticeSeedService {
(SELECT GROUP_CONCAT(DISTINCT o.project_code ORDER BY o.project_code SEPARATOR ';')
FROM safe_org o WHERE o.ext_party_id = s.formal_ext_party_id) AS project_codes,
s.session_id, s.trainee_name, s.scenario_name, s.total_score, s.status,
s.finished_time, s.summary, s.review_advice, s.incentive_point
s.finished_time, s.summary, s.review_advice, s.incentive_point,
s.total_score AS ai_score,
c.original_score AS calibration_original_score,
c.corrected_score AS human_score,
c.reviewer AS calibration_reviewer,
c.create_time AS calibration_time,
COALESCE(c.corrected_score, s.total_score) AS final_adopted_score
FROM formal_sessions s
LEFT JOIN latest_calibration l ON l.session_id = s.session_id
LEFT JOIN aihr_practice_calibration c ON c.id = l.id
ORDER BY s.finished_time DESC, s.id DESC
""";
@@ -1056,7 +1064,7 @@ public class AihrPracticeSeedService {
appendCsvRow(csv, "sop_answer_usable_ready", sopReady);
appendCsvRow(csv, "pilot_metric_ready", metrics.scenarioCount() >= 12 && completionReady && calibrationReady && sopReady);
csv.append('\n');
appendCsvRow(csv, "formal_ext_party_id", "project_codes", "session_id", "trainee", "scene", "score", "status", "finished_time", "summary", "review_advice", "incentive_point");
appendCsvRow(csv, "formal_ext_party_id", "project_codes", "session_id", "trainee", "scene", "score", "status", "finished_time", "summary", "review_advice", "incentive_point", "ai_score", "calibration_original_score", "human_score", "calibration_reviewer", "calibration_time", "final_adopted_score");
sessionRows.forEach(row -> appendCsvRow(
csv,
row.get("formal_ext_party_id"),
@@ -1069,7 +1077,13 @@ public class AihrPracticeSeedService {
row.get("finished_time"),
row.get("summary"),
row.get("review_advice"),
row.get("incentive_point")
row.get("incentive_point"),
row.get("ai_score"),
row.get("calibration_original_score"),
row.get("human_score"),
row.get("calibration_reviewer"),
row.get("calibration_time"),
row.get("final_adopted_score")
));
return csv.toString();
}
@@ -82,8 +82,12 @@ public class AihrPracticeSeedServiceTest {
assertTrue(jdbcTemplate.metricsSql.contains("HAVING COUNT(*) >= 10"));
assertTrue(jdbcTemplate.metricsSql.contains("JOIN formal_sessions s ON s.session_id = c.session_id"));
assertTrue(jdbcTemplate.sessionRowsSql.contains("JOIN org_identity o ON o.identity_key = s.ext_party_id"));
assertTrue(jdbcTemplate.sessionRowsSql.contains("LEFT JOIN latest_calibration l ON l.session_id = s.session_id"));
assertTrue(csv.contains("\"training_count\",\"1\""));
assertTrue(csv.contains("\"FORMAL-1\",\"P1\",\"session-1\""));
assertTrue(csv.contains("\"ai_score\",\"calibration_original_score\",\"human_score\""));
assertTrue(csv.contains("\"3\",\"86\",\"86\",\"78\",\"主管甲\""));
assertTrue(csv.contains("\"78\"\n"));
}
@Test
@@ -618,7 +622,13 @@ public class AihrPracticeSeedServiceTest {
Map.entry("finished_time", Timestamp.valueOf("2026-07-08 10:00:00")),
Map.entry("summary", "正式试点记录"),
Map.entry("review_advice", "保持回访"),
Map.entry("incentive_point", 3)
Map.entry("incentive_point", 3),
Map.entry("ai_score", 86),
Map.entry("calibration_original_score", 86),
Map.entry("human_score", 78),
Map.entry("calibration_reviewer", "主管甲"),
Map.entry("calibration_time", Timestamp.valueOf("2026-07-08 11:00:00")),
Map.entry("final_adopted_score", 78)
));
}
}