Просмотр исходного кода

fix(dim): T2/T3/T5 维度 code 与种子数据对齐健康页雷达真实指标

- DimensionCodeConstants: 删除虚构维度(bigFive*/12个action.*/growth_mindset),
  按权威清单重建 5 根 + 33 子维(body7/wisdom7/mind10/action5/wealth4)
- seedDimensionRegistry: wisdom 补 attention(7)、mind 大五重命名为 openness 等(10)、
  action 收敛为 5 个 RelationshipScoreVO 字段、wealth 改名且 source=energy、mind source=emi,
  legacy_alias 改为真实取数字段名
- 迁移 SQL 第2步白名单同步为 5 根 + 33 子维
Agnes Agent 1 неделя назад
Родитель
Сommit
bcbc4c3e0c

+ 19 - 24
cfc-backend/src/main/java/com/etotem/cfc/common/constant/DimensionCodeConstants.java

@@ -11,7 +11,8 @@ import java.util.Set;
  * <p>全系统引用统一维度 code 的唯一来源,禁止散落字面量。
  * 根维度 5 个(body/mind/wisdom/action/wealth)为唯一权威;其余为 {root}.{sub} 点分全小写。</p>
  *
- * <p>扩围子维以代码为准(见报告):认知为「六维认知体系」非 5 维;关系实际为 12 个 action* 维非 5 维。</p>
+ * <p>权威维度清单(来源:健康页雷达图真实展示指标,cfc-frontend/pages/health-main/index.vue):
+ * body 7 / wisdom 7 / mind 10 / action 5 / wealth 4,共 5 根 + 33 子维。</p>
  */
 public final class DimensionCodeConstants {
 
@@ -39,41 +40,35 @@ public final class DimensionCodeConstants {
     public static final Set<String> BODY_CODES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
             BODY_GROWTH, BODY_SLEEP, BODY_VISION, BODY_IMMUNITY, BODY_NUTRITION, BODY_GUT, BODY_EXERCISE)));
 
-    // ===================== 认知 6 维(wisdom 根;DAN「六维认知体系」) =====================
-    public static final String WISDOM_PERCEPTION = "wisdom.perception";
-    public static final String WISDOM_FOCUS = "wisdom.focus";
+    // ===================== wisdom 7 维(wisdom 根;DAN 认知报告字段) =====================
     public static final String WISDOM_MEMORY = "wisdom.memory";
+    public static final String WISDOM_ATTENTION = "wisdom.attention";
     public static final String WISDOM_LOGIC = "wisdom.logic";
     public static final String WISDOM_SPATIAL = "wisdom.spatial";
+    public static final String WISDOM_PERCEPTION = "wisdom.perception";
+    public static final String WISDOM_FOCUS = "wisdom.focus";
     public static final String WISDOM_PROCESSING_SPEED = "wisdom.processingSpeed";
 
-    // ===================== 心 10 维(mind 根;EMI/心理) =====================
-    public static final String MIND_BIG_FIVE_OPENNESS = "mind.bigFiveOpenness";
-    public static final String MIND_BIG_FIVE_CONSCIENTIOUSNESS = "mind.bigFiveConscientiousness";
-    public static final String MIND_BIG_FIVE_EXTRAVERSION = "mind.bigFiveExtraversion";
-    public static final String MIND_BIG_FIVE_AGREEABLENESS = "mind.bigFiveAgreeableness";
-    public static final String MIND_BIG_FIVE_NEUROTICISM = "mind.bigFiveNeuroticism";
+    // ===================== mind 10 维(mind 根;EMI/心理:大五5 + 自我驱动3 + 情绪稳定 + 自我概念) =====================
+    public static final String MIND_OPENNESS = "mind.openness";
+    public static final String MIND_CONSCIENTIOUSNESS = "mind.conscientiousness";
+    public static final String MIND_EXTRAVERSION = "mind.extraversion";
+    public static final String MIND_AGREEABLENESS = "mind.agreeableness";
+    public static final String MIND_NEUROTICISM = "mind.neuroticism";
     public static final String MIND_EMOTION_STABILITY = "mind.emotionStability";
     public static final String MIND_DRIVE_AUTONOMY = "mind.driveAutonomy";
     public static final String MIND_DRIVE_COMPETENCE = "mind.driveCompetence";
     public static final String MIND_DRIVE_RELATEDNESS = "mind.driveRelatedness";
     public static final String MIND_SELF_CONCEPT_OVERALL = "mind.selfConceptOverall";
 
-    // ===================== 关系 12 维(action 根;关系质量,代码实际 12 个 action*) =====================
-    public static final String ACTION_CHILD_PARENT_CHILD = "action.childParentChild";
-    public static final String ACTION_SIBLING = "action.sibling";
-    public static final String ACTION_RELATIVE = "action.relative";
-    public static final String ACTION_TEACHER_STUDENT = "action.teacherStudent";
-    public static final String ACTION_CHILD_SOCIALITY = "action.childSociality";
-    public static final String ACTION_CHILD_INTERPERSONAL = "action.childInterpersonal";
-    public static final String ACTION_PARENT_CHILD = "action.parentChild";
-    public static final String ACTION_MARITAL = "action.marital";
-    public static final String ACTION_PARENTAL = "action.parental";
-    public static final String ACTION_LEADERSHIP = "action.leadership";
-    public static final String ACTION_SOCIALITY = "action.sociality";
-    public static final String ACTION_INTERPERSONAL = "action.interpersonal";
+    // ===================== action 5 维(action 根;RelationshipScoreVO 字段) =====================
+    public static final String ACTION_PARENT_TRUST = "action.parentTrust";
+    public static final String ACTION_PARENT_INTIMACY = "action.parentIntimacy";
+    public static final String ACTION_COMMUNICATION = "action.communication";
+    public static final String ACTION_HEALTH_STATUS = "action.healthStatus";
+    public static final String ACTION_LAST_INTERACTION = "action.lastInteraction";
 
-    // ===================== 富 4 维(wealth 根;财富素养) =====================
+    // ===================== wealth 4 维(wealth 根;MemberEnergyDTO 字段) =====================
     public static final String WEALTH_SKILL = "wealth.skill";
     public static final String WEALTH_ALTRUISM = "wealth.altruism";
     public static final String WEALTH_INCOME = "wealth.income";

+ 40 - 46
cfc-backend/src/main/java/com/etotem/cfc/config/DatabaseInitializer.java

@@ -4242,81 +4242,75 @@ sqls.add("INSERT IGNORE INTO health_norm_reference (dimension, gender, age_min,
             Long actionId = dimensionNodeId("action");
             Long wealthId = dimensionNodeId("wealth");
 
-            // 2) 7 body 维(health,legacy_alias 保留旧名)
+            // 2) 7 body 维(health,原 health_dimension_scores;legacy_alias = 旧取数字段名)
             String[][] bodyChildren = {
-                {"body.growth",     "成长", "growth"},
-                {"body.sleep",      "睡眠", "sleep"},
-                {"body.vision",     "视力", "vision"},
-                {"body.immunity",   "免疫", "immunity"},
-                {"body.nutrition",  "营养", "nutrition"},
-                {"body.gut",        "肠道", "gut"},
-                {"body.exercise",   "运动", "exercise"},
+                {"body.growth",     "生长发育", "growth"},
+                {"body.sleep",      "睡眠质量", "sleep"},
+                {"body.vision",     "视力健康", "vision"},
+                {"body.immunity",   "免疫力",   "immunity"},
+                {"body.nutrition",  "营养均衡", "nutrition"},
+                {"body.gut",        "肠胃健康", "gut"},
+                {"body.exercise",   "运动活力", "exercise"},
             };
             for (String[] c : bodyChildren) {
                 ensureDimensionNode(c[0], c[1], bodyId, "health", "[\"" + c[2] + "\"]", null, 0, "sub");
             }
 
-            // 3) 认知 6 维(wisdom 根;DAN 测评「六维认知体系」)
+            // 3) 认知 7 维(wisdom 根;DAN 认知报告字段)
             String[][] wisdomChildren = {
-                {"wisdom.perception",       "感知",     "perceptionScore"},
-                {"wisdom.focus",           "专注",     "focusScore"},
-                {"wisdom.memory",          "记忆",     "memoryScore"},
-                {"wisdom.logic",           "逻辑",     "logicScore"},
-                {"wisdom.spatial",         "空间",     "spatialScore"},
+                {"wisdom.memory",          "记忆力",   "memoryScore"},
+                {"wisdom.attention",       "注意力",   "attentionScore"},
+                {"wisdom.logic",           "逻辑推理", "logicScore"},
+                {"wisdom.spatial",         "空间想象", "spatialScore"},
+                {"wisdom.perception",      "感知能力", "perceptionScore"},
+                {"wisdom.focus",           "专注力",   "focusScore"},
                 {"wisdom.processingSpeed", "加工速度", "processingSpeedScore"},
             };
             for (String[] c : wisdomChildren) {
                 ensureDimensionNode(c[0], c[1], wisdomId, "cognitive", "[\"" + c[2] + "\"]", null, 0, "sub");
             }
 
-            // 4) 心 10 维(mind 根;EMI/心理:大五5 + 情绪稳定 + 自我驱动3 + 自我概念)
+            // 4) 心 10 维(mind 根;EMI/心理:大五5 + 自我驱动3 + 情绪稳定 + 自我概念)
             String[][] mindChildren = {
-                {"mind.bigFiveOpenness",         "开放性", "bigFiveOpenness"},
-                {"mind.bigFiveConscientiousness","尽责性", "bigFiveConscientiousness"},
-                {"mind.bigFiveExtraversion",     "外向性", "bigFiveExtraversion"},
-                {"mind.bigFiveAgreeableness",    "宜人性", "bigFiveAgreeableness"},
-                {"mind.bigFiveNeuroticism",      "神经质", "bigFiveNeuroticism"},
-                {"mind.emotionStability",        "情绪稳定", "emotionStability"},
-                {"mind.driveAutonomy",           "自主",   "driveAutonomy"},
-                {"mind.driveCompetence",         "胜任",   "driveCompetence"},
-                {"mind.driveRelatedness",        "关系归属", "driveRelatedness"},
-                {"mind.selfConceptOverall",      "自我概念", "selfConceptOverall"},
+                {"mind.openness",         "开放性",     "opennessScore"},
+                {"mind.conscientiousness","尽责性",     "conscientiousnessScore"},
+                {"mind.extraversion",     "外向性",     "extraversionScore"},
+                {"mind.agreeableness",    "宜人性",     "agreeablenessScore"},
+                {"mind.neuroticism",      "神经质",     "neuroticismScore"},
+                {"mind.emotionStability", "情绪稳定性", "emotionStability"},
+                {"mind.driveAutonomy",    "自主性",     "driveAutonomy"},
+                {"mind.driveCompetence",  "胜任感",     "driveCompetence"},
+                {"mind.driveRelatedness", "归属感",     "driveRelatedness"},
+                {"mind.selfConceptOverall","自我概念",  "selfConceptOverall"},
             };
             for (String[] c : mindChildren) {
-                ensureDimensionNode(c[0], c[1], mindId, "psych", "[\"" + c[2] + "\"]", null, 0, "sub");
+                ensureDimensionNode(c[0], c[1], mindId, "emi", "[\"" + c[2] + "\"]", null, 0, "sub");
             }
 
-            // 5) 关系 12 维(action 根;关系质量:代码实际 12 个 action* 维,非推定的 5 维)
+            // 5) 关系 5 维(action 根;RelationshipScoreVO 字段:亲子信任/亲密度/沟通质量/关系健康度/最近互动)
             String[][] actionChildren = {
-                {"action.childParentChild", "亲子(子→父)", "actionChildParentChild"},
-                {"action.sibling",          "手足",        "actionSibling"},
-                {"action.relative",         "亲戚",        "actionRelative"},
-                {"action.teacherStudent",   "师生",        "actionTeacherStudent"},
-                {"action.childSociality",   "儿童社交",    "actionChildSociality"},
-                {"action.childInterpersonal","儿童人际",   "actionChildInterpersonal"},
-                {"action.parentChild",      "父→子",       "actionParentChild"},
-                {"action.marital",          "婚姻",        "actionMarital"},
-                {"action.parental",         "教养",        "actionParental"},
-                {"action.leadership",       "领导",        "actionLeadership"},
-                {"action.sociality",        "社交",        "actionSociality"},
-                {"action.interpersonal",    "人际",        "actionInterpersonal"},
+                {"action.parentTrust",      "亲子信任",   "trustScore"},
+                {"action.parentIntimacy",   "亲子亲密度", "intimacyScore"},
+                {"action.communication",    "沟通质量",   "communicationScore"},
+                {"action.healthStatus",     "关系健康度", "totalScore"},
+                {"action.lastInteraction",  "最近互动",   "lastInteractionAt"},
             };
             for (String[] c : actionChildren) {
                 ensureDimensionNode(c[0], c[1], actionId, "relationship", "[\"" + c[2] + "\"]", null, 0, "sub");
             }
 
-            // 6) 富 4 维(wealth 根;财富素养)
+            // 6) 富 4 维(wealth 根;MemberEnergyDTO 字段)
             String[][] wealthChildren = {
-                {"wealth.skill",    "财商技能", "wealthSkill"},
-                {"wealth.altruism", "财富利他", "wealthAltruism"},
-                {"wealth.income",   "财富收入", "wealthIncome"},
-                {"wealth.fx",       "外汇",     "wealthFx"},
+                {"wealth.skill",    "个人能力", "wealthSkill"},
+                {"wealth.altruism", "利他贡献", "wealthAltruism"},
+                {"wealth.income",   "CF值积累", "wealthIncome"},
+                {"wealth.fx",       "财务素养", "wealthFx"},
             };
             for (String[] c : wealthChildren) {
-                ensureDimensionNode(c[0], c[1], wealthId, "wealth-literacy", "[\"" + c[2] + "\"]", null, 0, "sub");
+                ensureDimensionNode(c[0], c[1], wealthId, "energy", "[\"" + c[2] + "\"]", null, 0, "sub");
             }
 
-            log.info("统一维度注册中心种子已就绪(5根 + 7 body + 认知6 + 心10 + 关系12 + 富4)");
+            log.info("统一维度注册中心种子已就绪(5根 + body7 + wisdom7 + mind10 + action5 + wealth4)");
         } catch (Exception e) {
             log.warn("统一维度注册中心种子初始化失败: {}", e.getMessage());
         }

+ 4 - 5
cfc-backend/src/main/resources/db/migrate_dimension_unified.sql

@@ -18,17 +18,16 @@ UPDATE health_dimension_scores
  WHERE dimension IN ('growth','sleep','vision','immunity','nutrition','gut','exercise');
 
 -- 2) indicator_definitions.dimension_code 越界扫描(仅报告,不修改;收敛留待 P1-T3)
---    统一 code 集合 = 5 根 + 扩围子维;以下 SELECT 列出当前不在集合内的 dimension_code(如迁移362写入的 'dim.body' 等展示标签)
+--    统一 code 集合 = 5 根 + 33 子维(健康页雷达图真实指标);以下 SELECT 列出当前不在集合内的 dimension_code
 SELECT id, code, name, dimension_code
   FROM indicator_definitions
  WHERE dimension_code IS NOT NULL
    AND dimension_code NOT IN (
      'body','mind','wisdom','action','wealth',
      'body.growth','body.sleep','body.vision','body.immunity','body.nutrition','body.gut','body.exercise',
-     'wisdom.perception','wisdom.focus','wisdom.memory','wisdom.logic','wisdom.spatial','wisdom.processingSpeed',
-     'mind.bigFiveOpenness','mind.bigFiveConscientiousness','mind.bigFiveExtraversion','mind.bigFiveAgreeableness','mind.bigFiveNeuroticism',
+     'wisdom.memory','wisdom.attention','wisdom.logic','wisdom.spatial','wisdom.perception','wisdom.focus','wisdom.processingSpeed',
+     'mind.openness','mind.conscientiousness','mind.extraversion','mind.agreeableness','mind.neuroticism',
      'mind.emotionStability','mind.driveAutonomy','mind.driveCompetence','mind.driveRelatedness','mind.selfConceptOverall',
-     'action.childParentChild','action.sibling','action.relative','action.teacherStudent','action.childSociality','action.childInterpersonal',
-     'action.parentChild','action.marital','action.parental','action.leadership','action.sociality','action.interpersonal',
+     'action.parentTrust','action.parentIntimacy','action.communication','action.healthStatus','action.lastInteraction',
      'wealth.skill','wealth.altruism','wealth.income','wealth.fx'
    );