|
|
@@ -236,8 +236,10 @@ public class RelationshipQualityService {
|
|
|
if (center == null || (familyId != null && !familyId.equals(center.getFamilyId()))) {
|
|
|
throw new RuntimeException("成员不存在或不属于该家庭");
|
|
|
}
|
|
|
+ // fail-closed:查看者家庭归属不可核验(familyId 缺位)时拒绝,不得静默回退中心成员家庭
|
|
|
+ // (SC-P-07 边界:仅本家庭成员可见,防越权 fail-open)
|
|
|
if (familyId == null) {
|
|
|
- familyId = center.getFamilyId();
|
|
|
+ throw new RuntimeException("无法核验查看者家庭归属,拒绝访问");
|
|
|
}
|
|
|
|
|
|
List<FamilyMember> members = familyMemberMapper.selectList(
|
|
|
@@ -262,6 +264,9 @@ public class RelationshipQualityService {
|
|
|
vo.setGeneration(fm.getGeneration());
|
|
|
vo.setEffectiveRole(computeEffectiveRole(fm));
|
|
|
vo.setRoleLabel(computeEffectiveRole(fm));
|
|
|
+ // 关系图节点形状字段(SC-P-07):parent/child,前端按 memberType 区分节点形状,
|
|
|
+ // 缺失时前端全部节点退化为 child 圆形。约定与 CompatibilityService 一致:辈分 < 0 → child。
|
|
|
+ vo.setMemberType(fm.getGeneration() != null && fm.getGeneration() < 0 ? "child" : "parent");
|
|
|
vo.setIsSpouse(fm.getIsSpouse());
|
|
|
vo.setIsSelf(centerMemberId.equals(fm.getId()));
|
|
|
vo.setAge(fm.getAge());
|
|
|
@@ -272,7 +277,11 @@ public class RelationshipQualityService {
|
|
|
vo.setGenerationValue(rel.getGenerationValue());
|
|
|
String label = rel.getRelationshipKey() != null && !rel.getRelationshipKey().isEmpty()
|
|
|
? rel.getRelationshipKey()
|
|
|
- : familyRelationshipService.computeRelationshipLabel(rel.getGenerationValue(), fm.getGender());
|
|
|
+ // 配偶/同辈等特殊关系走 3 参重载(R4):辈分差 0 时 spouse→「丈夫/妻子」而非「兄弟/姐妹」;
|
|
|
+ // 其余(lineal/null)仍走 2 参推断,避免把普通关系误标为配偶。
|
|
|
+ : ("spouse".equals(rel.getRelationType()) || "sibling".equals(rel.getRelationType()))
|
|
|
+ ? familyRelationshipService.computeRelationshipLabel(rel.getGenerationValue(), fm.getGender(), rel.getRelationType())
|
|
|
+ : familyRelationshipService.computeRelationshipLabel(rel.getGenerationValue(), fm.getGender());
|
|
|
vo.setRelativeLabel(label);
|
|
|
vo.setRelationship(label);
|
|
|
vo.setTrustScore(rel.getTrustScore());
|
|
|
@@ -285,6 +294,9 @@ public class RelationshipQualityService {
|
|
|
vo.setTrustScore(BigDecimal.ZERO);
|
|
|
vo.setIntimacyScore(BigDecimal.ZERO);
|
|
|
vo.setCommunicationScore(BigDecimal.ZERO);
|
|
|
+ // SC-P-07 边界「关系缺失的节点降级展示」:关系缺失成员仍须有可渲染的降级关系标签(非 null/非空白)
|
|
|
+ vo.setRelationship("家人");
|
|
|
+ vo.setRelativeLabel("家人");
|
|
|
}
|
|
|
result.add(vo);
|
|
|
}
|