feat(aihr): align competency profile with brd dimensions

This commit is contained in:
2026-07-14 09:11:45 +08:00
parent 1b0f737ed7
commit ac8cddbbee
9 changed files with 61 additions and 12 deletions
@@ -1438,6 +1438,7 @@ public class AihrPracticeSeedService {
COALESCE(ROUND(AVG(dim_compliance)), 0) compliance,
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
FROM aihr_practice_session
WHERE tenant_id = ? AND mode = 'mobile' AND (? = '' OR ext_party_id = ?)
@@ -1448,9 +1449,10 @@ public class AihrPracticeSeedService {
rs.getInt("compliance"),
rs.getInt("communication"),
rs.getInt("emotion"),
rs.getInt("marketing"),
rs.getInt("incentive_points")
), tenantId(), party, party);
CompetencySnapshot snapshot = rows.isEmpty() ? new CompetencySnapshot(0, 0, 0, 0, 0, 0, 0) : rows.get(0);
CompetencySnapshot snapshot = rows.isEmpty() ? new CompetencySnapshot(0, 0, 0, 0, 0, 0, 0, 0) : rows.get(0);
int trainingMinutes = snapshot.completed() * 8;
int contribution = snapshot.completed() == 0 && snapshot.incentivePoints() == 0
? 0
@@ -1466,9 +1468,16 @@ public class AihrPracticeSeedService {
assessmentScore,
aiLevel,
List.of(
new DimensionResponse("合规", snapshot.compliance(), "SOP关键点覆盖"),
new DimensionResponse("沟通", snapshot.communication(), "承诺与表达清晰度"),
new DimensionResponse("情绪", snapshot.emotion(), "安抚与承接能力")
new DimensionResponse("任务完成度", null,
"权重40%;需接入工单闭环率、首解率与处理结果,当前待采集"),
new DimensionResponse("话术规范性", snapshot.completed() == 0 ? null : average(snapshot.compliance(), snapshot.communication()),
"权重25%;当前以合规+沟通训练维度代理,正式绩效口径需HR确认"),
new DimensionResponse("情绪管理能力", snapshot.completed() == 0 ? null : snapshot.emotion(),
"权重20%;当前以陪练情绪维度代理"),
new DimensionResponse("响应时效", null,
"权重10%;需接入首响时长、处理周期与跟进频率,当前待采集"),
new DimensionResponse("增值转化潜力", snapshot.completed() == 0 ? null : snapshot.marketing(),
"权重5%;当前以陪练营销维度代理,正式口径需HR确认")
),
growthPath(snapshot.completed(), assessmentScore)
);
@@ -3546,7 +3555,14 @@ public class AihrPracticeSeedService {
private record RoundSeed(String customer, String coachHint, Integer emotion, Integer trust) {
}
private record CompetencySnapshot(Integer completed, Integer score, Integer pendingReview, Integer compliance, Integer communication, Integer emotion, Integer incentivePoints) {
private Integer average(Integer left, Integer right) {
if (left == null || right == null) {
return null;
}
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 SessionAnnotationSource(String scenarioId, String dialogueJson, String annotationsJson) {
@@ -33,6 +33,7 @@ import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
@@ -464,6 +465,7 @@ public class AihrPracticeSeedServiceTest {
"compliance", "0",
"communication", "0",
"emotion", "0",
"marketing", "0",
"incentive_points", "0"
)));
AihrPracticeSeedService service = new AihrPracticeSeedService(new ObjectMapper(), jdbcTemplate, null, null);
@@ -476,7 +478,10 @@ public class AihrPracticeSeedServiceTest {
assertEquals(0, profile.trainingMinutes());
assertEquals(0, profile.contribution());
assertEquals("未评级", profile.aiLevel());
assertTrue(profile.dimensions().stream().allMatch(item -> Integer.valueOf(0).equals(item.value())));
assertEquals(5, profile.dimensions().size());
assertTrue(profile.dimensions().stream().allMatch(item -> item.value() == null));
assertEquals("任务完成度", profile.dimensions().get(0).label());
assertEquals("响应时效", profile.dimensions().get(3).label());
assertTrue(profile.growthPath().stream().allMatch(item -> Integer.valueOf(0).equals(item.progress())));
}
@@ -493,6 +498,7 @@ public class AihrPracticeSeedServiceTest {
"compliance", "82",
"communication", "80",
"emotion", "78",
"marketing", "74",
"incentive_points", "20"
)));
AihrPracticeSeedService service = new AihrPracticeSeedService(new ObjectMapper(), jdbcTemplate, null, null);
@@ -506,6 +512,11 @@ public class AihrPracticeSeedServiceTest {
assertEquals("待积累", profile.growthPath().get(1).status());
assertEquals(90, profile.growthPath().get(2).progress());
assertEquals("待积累", profile.growthPath().get(2).status());
assertEquals(81, profile.dimensions().get(1).value());
assertEquals(78, profile.dimensions().get(2).value());
assertEquals(74, profile.dimensions().get(4).value());
assertNull(profile.dimensions().get(0).value());
assertNull(profile.dimensions().get(3).value());
}
@SuppressWarnings({"unchecked", "rawtypes"})