fix(backend): return canonical extPartyId in practice review detail
The reviewDetail query referenced a.trainee_name without declaring the table alias, which 500s whenever org-sync display fields are enabled, and the mobile payload never exposed extPartyId, so the supervisor review pages could not resolve organization member names.
This commit is contained in:
+1
@@ -433,6 +433,7 @@ public class AihrMobileController {
|
||||
data.put("aiComment", maskSensitiveText(detail.aiComment()));
|
||||
data.put("reviewAdvice", maskSensitiveText(detail.reviewAdvice()));
|
||||
data.put("incentivePoint", detail.incentivePoint());
|
||||
data.put("extPartyId", detail.extPartyId());
|
||||
data.put("scoreItems", detail.scoreItems().stream().map(item -> Map.of(
|
||||
"label", item.label(),
|
||||
"value", item.value(),
|
||||
|
||||
+2
-1
@@ -229,7 +229,8 @@ public final class AihrPracticeDto {
|
||||
Integer incentivePoint,
|
||||
List<DimensionResponse> scoreItems,
|
||||
List<DialogueResponse> dialogue,
|
||||
List<AnnotationResponse> annotations
|
||||
List<AnnotationResponse> annotations,
|
||||
String extPartyId
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
+11
-4
@@ -1504,14 +1504,20 @@ public class AihrPracticeSeedService {
|
||||
return null;
|
||||
}
|
||||
String nameExpression = !storeDisplayFields ? "'员工'" : "a.trainee_name";
|
||||
boolean hasOrgSnapshot = orgSnapshotTableExists();
|
||||
boolean hasPhone = hasOrgSnapshot && orgSnapshotColumnExists("person_phone");
|
||||
String identityExpression = hasOrgSnapshot
|
||||
? teamCanonicalIdentityExpression("a", hasPhone)
|
||||
: "a.ext_party_id";
|
||||
List<ReviewDetailResponse> rows = jdbcTemplate.query("""
|
||||
SELECT id, session_id, finished_time, %s AS trainee_name, scenario_id, scenario_name, total_score, status,
|
||||
summary, mentor_rewrite, ai_comment, review_advice, incentive_point,
|
||||
dim_task_completion, dim_response_timeliness, response_latency_ms,
|
||||
dim_compliance, dim_emotion, dim_communication, dim_marketing, dialogue_json, annotations_json
|
||||
FROM aihr_practice_session
|
||||
dim_compliance, dim_emotion, dim_communication, dim_marketing, dialogue_json, annotations_json,
|
||||
%s AS ext_party_id
|
||||
FROM aihr_practice_session a
|
||||
WHERE tenant_id = ? AND mode = 'mobile' AND id = ?
|
||||
""".formatted(nameExpression), this::mapReviewDetail, tenantId(), id);
|
||||
""".formatted(nameExpression, identityExpression), this::mapReviewDetail, tenantId(), id);
|
||||
return rows.isEmpty() ? null : rows.get(0);
|
||||
}
|
||||
|
||||
@@ -3770,7 +3776,8 @@ public class AihrPracticeSeedService {
|
||||
rs.getObject("incentive_point") == null ? null : rs.getInt("incentive_point"),
|
||||
scoreItems(rs),
|
||||
dialogue,
|
||||
readAnnotations(rs.getString("annotations_json"), dialogue, scenario)
|
||||
readAnnotations(rs.getString("annotations_json"), dialogue, scenario),
|
||||
rs.getString("ext_party_id")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user