Browse Source

S-cfc-459: implement butler.oneOnOne.coach contract (TDD-GREEN) - ButlerOneOnOneCoachService + entity/mapper/table + family & admin one-on-one endpoints

Administrator 4 hours ago
parent
commit
364b87eb45

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

@@ -3674,6 +3674,52 @@ insertSysConfigSeed("gift_membership_pay_price", "198000", "送会员商品达
         // 迁移501: 食材推荐加权规则表 food_recommend_weight_rule(能力键 food.rule.weightEngine,§4.2/§5)
         // 承载 6 因子权重/阈值/病症分组/版本/灰度开关;CREATE TABLE IF NOT EXISTS 幂等
         createFoodRecommendWeightRuleTable();
+
+        // 迁移502: 一对一陪跑/多方协调工单 butler_one_on_one_coach_records(能力键 butler.oneOnOne.coach,SC-H-02/H-03)
+        // 承载档案+服务计划(可配 SLA/回访节奏)、回访/咨询留痕、协调全过程留痕;CREATE TABLE IF NOT EXISTS 幂等
+        createButlerOneOnOneCoachRecordsTable();
+    }
+
+    /**
+     * 迁移502: 真人管家一对一陪跑 / 多方协调工单表(能力键 {@code butler.oneOnOne.coach},SC-H-02/H-03)。
+     * 幂等:CREATE TABLE IF NOT EXISTS + try/catch 忽略「表已存在」异常,可重复执行。
+     */
+    void createButlerOneOnOneCoachRecordsTable() {
+        try {
+            jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS butler_one_on_one_coach_records ("
+                    + "id BIGINT AUTO_INCREMENT PRIMARY KEY, "
+                    + "family_id BIGINT NOT NULL COMMENT '工单所属家庭(仅本服务家庭可见)', "
+                    + "parent_user_id BIGINT NOT NULL COMMENT '家长用户 ID', "
+                    + "butler_user_id BIGINT NULL COMMENT '管家用户 ID', "
+                    + "service_cycle VARCHAR(32) NULL COMMENT '服务周期', "
+                    + "follow_up_cadence VARCHAR(32) DEFAULT 'WEEKLY' COMMENT '定期回访节奏(可配)', "
+                    + "sla_minutes INT DEFAULT 120 COMMENT '响应/回访 SLA(分钟,可配)', "
+                    + "status VARCHAR(16) DEFAULT 'ACTIVE' COMMENT 'ACTIVE/PAUSED/EXPIRED/ALIGNED/MERGED', "
+                    + "service_expire_at DATETIME NULL COMMENT '服务到期时间', "
+                    + "follow_up_at DATETIME NULL COMMENT '最近回访时间', "
+                    + "follow_up_content TEXT NULL COMMENT '回访内容留痕', "
+                    + "follow_up_todo TEXT NULL COMMENT '回访待办留痕', "
+                    + "consult_content TEXT NULL COMMENT '咨询内容', "
+                    + "consult_started_at DATETIME NULL COMMENT '咨询发起时间(SLA 计时起点)', "
+                    + "consult_response TEXT NULL COMMENT '管家响应(家长可见)', "
+                    + "responded_at DATETIME NULL COMMENT '响应时间', "
+                    + "message_id BIGINT NULL COMMENT 'teacher.message.push 同源消息主键', "
+                    + "reply_content TEXT NULL COMMENT '同源消息回复内容', "
+                    + "coordination_status VARCHAR(16) DEFAULT 'COLLECTING' COMMENT '协调状态', "
+                    + "parent_demand TEXT NULL COMMENT '家长诉求', "
+                    + "teacher_conclusion TEXT NULL COMMENT '规划师方案结论(只同步不变更)', "
+                    + "translated_conclusion TEXT NULL COMMENT '翻译后结论', "
+                    + "teacher_feedback TEXT NULL COMMENT '向规划师反馈', "
+                    + "supervision_feedback TEXT NULL COMMENT '监督反馈处置结论', "
+                    + "created_at DATETIME DEFAULT CURRENT_TIMESTAMP, "
+                    + "updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, "
+                    + "INDEX idx_family_id (family_id), "
+                    + "INDEX idx_status_sla (status, consult_started_at) "
+                    + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='真人管家一对一陪跑/多方协调工单(SC-H-02/SC-H-03)'");
+            log.info("迁移502: 已创建 butler_one_on_one_coach_records 表");
+        } catch (Exception e) {
+            log.warn("迁移502: butler_one_on_one_coach_records 建表失败(可能已存在): {}", e.getMessage());
+        }
     }
 
     /**

+ 67 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/admin/AdminButlerController.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.etotem.cfc.common.Result;
 import com.etotem.cfc.entity.ButlerCommissionSettlement;
 import com.etotem.cfc.entity.ButlerEscalationOrder;
+import com.etotem.cfc.entity.ButlerOneOnOneCoachRecord;
 import com.etotem.cfc.entity.ButlerProfile;
 import com.etotem.cfc.entity.ButlerServiceRecord;
 import com.etotem.cfc.entity.User;
@@ -13,6 +14,7 @@ import com.etotem.cfc.mapper.ButlerProfileMapper;
 import com.etotem.cfc.mapper.ButlerServiceRecordMapper;
 import com.etotem.cfc.mapper.UserMapper;
 import com.etotem.cfc.service.ButlerEscalationService;
+import com.etotem.cfc.service.ButlerOneOnOneCoachService;
 import com.etotem.cfc.service.ButlerService;
 import org.springframework.web.bind.annotation.*;
 
@@ -45,6 +47,9 @@ public class AdminButlerController {
     @Resource
     private UserMapper userMapper;
 
+    @Resource
+    private ButlerOneOnOneCoachService butlerOneOnOneCoachService;
+
     /**
      * 管家申请来源为 users.butler_status(小程序服务角色申请/管家申请写入)。
      * 返回用户维度的管家申请列表,供审核中心管家审核 Tab 使用。
@@ -311,4 +316,66 @@ public class AdminButlerController {
         Long userId = ParamUtils.getLong(params.get("userId"));
         return butlerEscalationService.recordReview(workorderId, durationMinutes, conclusion, userId);
     }
+
+    // ==================== 一对一陪跑 / 多方协调管理(能力键 butler.oneOnOne.coach · SC-H-02/H-03) ====================
+
+    /**
+     * 分配 / 更换陪跑管家(admin/finance 角色校验)。
+     * POST /api/admin/butler/one-on-one/assign
+     */
+    @PostMapping("/api/admin/butler/one-on-one/assign")
+    public Result<ButlerOneOnOneCoachRecord> oneOnOneAssign(@RequestBody Map<String, Object> params,
+                                                             @RequestAttribute("role") String role) {
+        if (!"admin".equals(role) && !"finance".equals(role)) {
+            return Result.error("权限不足");
+        }
+        return butlerOneOnOneCoachService.assignButler(
+                ParamUtils.getLong(params.get("recordId")),
+                ParamUtils.getLong(params.get("butlerUserId")));
+    }
+
+    /**
+     * 按套餐 / 家庭配置回访与响应 SLA(admin/finance 角色校验)。
+     * POST /api/admin/butler/one-on-one/sla/config
+     */
+    @PostMapping("/api/admin/butler/one-on-one/sla/config")
+    public Result<ButlerOneOnOneCoachRecord> oneOnOneSlaConfig(@RequestBody Map<String, Object> params,
+                                                                @RequestAttribute("role") String role) {
+        if (!"admin".equals(role) && !"finance".equals(role)) {
+            return Result.error("权限不足");
+        }
+        Integer slaMinutes = params.get("slaMinutes") != null
+                ? Integer.valueOf(params.get("slaMinutes").toString()) : null;
+        return butlerOneOnOneCoachService.configureSla(
+                ParamUtils.getLong(params.get("recordId")), slaMinutes,
+                (String) params.get("followUpCadence"));
+    }
+
+    /**
+     * 陪跑档案台账(admin/finance 角色校验,按家庭隔离)。
+     * POST /api/admin/butler/one-on-one/records
+     */
+    @PostMapping("/api/admin/butler/one-on-one/records")
+    public Result<List<ButlerOneOnOneCoachRecord>> oneOnOneRecords(@RequestBody Map<String, Object> params,
+                                                                    @RequestAttribute("role") String role) {
+        if (!"admin".equals(role) && !"finance".equals(role)) {
+            return Result.error("权限不足");
+        }
+        return butlerOneOnOneCoachService.listRecords(ParamUtils.getLong(params.get("familyId")));
+    }
+
+    /**
+     * 监督反馈闭环:记录反馈与处置结论,留痕可审计(admin/finance 角色校验)。
+     * POST /api/admin/butler/one-on-one/supervision
+     */
+    @PostMapping("/api/admin/butler/one-on-one/supervision")
+    public Result<ButlerOneOnOneCoachRecord> oneOnOneSupervision(@RequestBody Map<String, Object> params,
+                                                                  @RequestAttribute("role") String role) {
+        if (!"admin".equals(role) && !"finance".equals(role)) {
+            return Result.error("权限不足");
+        }
+        return butlerOneOnOneCoachService.recordSupervisionFeedback(
+                ParamUtils.getLong(params.get("recordId")),
+                (String) params.get("feedback"), (String) params.get("resolution"));
+    }
 }

+ 94 - 0
cfc-backend/src/main/java/com/etotem/cfc/controller/butler/ButlerController.java

@@ -4,11 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.etotem.cfc.common.Result;
 import com.etotem.cfc.entity.ButlerEscalationOrder;
+import com.etotem.cfc.entity.ButlerOneOnOneCoachRecord;
 import com.etotem.cfc.entity.ButlerResourceMatchResult;
 import com.etotem.cfc.entity.User;
 import com.etotem.cfc.mapper.ButlerResourceMatchResultMapper;
 import com.etotem.cfc.mapper.UserMapper;
 import com.etotem.cfc.service.ButlerEscalationService;
+import com.etotem.cfc.service.ButlerOneOnOneCoachService;
 import com.etotem.cfc.service.ButlerResourceMatchService;
 import com.etotem.cfc.service.ButlerService;
 import com.etotem.cfc.service.RealNameBackfillService;
@@ -43,6 +45,9 @@ public class ButlerController {
     @Resource
     private ButlerResourceMatchResultMapper butlerResourceMatchResultMapper;
 
+    @Resource
+    private ButlerOneOnOneCoachService butlerOneOnOneCoachService;
+
     /**
      * 申请成为管家
      * POST /api/butler/apply
@@ -268,4 +273,93 @@ public class ButlerController {
         Long workorderId = ParamUtils.getLong(params.get("workorderId"));
         return butlerEscalationService.withdraw(workorderId, userId);
     }
+
+    // ==================== 一对一陪跑 / 多方协调(能力键 butler.oneOnOne.coach · SC-H-02/H-03) ====================
+
+    /**
+     * 建立家长档案与服务计划(服务周期 / 回访节奏 / 可配 SLA)。
+     * POST /api/butler/one-on-one/profile/create
+     */
+    @PostMapping("/api/butler/one-on-one/profile/create")
+    public Result<ButlerOneOnOneCoachRecord> oneOnOneProfileCreate(@RequestBody Map<String, Object> params,
+                                                                    @RequestAttribute("userId") Long userId) {
+        Long familyId = ParamUtils.getLong(params.get("familyId"));
+        Long butlerUserId = ParamUtils.getLong(params.get("butlerUserId"));
+        String serviceCycle = (String) params.get("serviceCycle");
+        String followUpCadence = (String) params.get("followUpCadence");
+        Integer slaMinutes = params.get("slaMinutes") != null
+                ? Integer.valueOf(params.get("slaMinutes").toString()) : null;
+        java.util.Date expireAt = null;
+        if (params.get("serviceExpireAt") != null) {
+            try {
+                expireAt = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
+                        .parse(params.get("serviceExpireAt").toString());
+            } catch (Exception ignore) {
+                // 到期时间非法时按不设限处理,由 SLA 配置端点后续补齐
+            }
+        }
+        return butlerOneOnOneCoachService.createProfile(
+                familyId, userId, butlerUserId, serviceCycle, followUpCadence, slaMinutes, expireAt);
+    }
+
+    /**
+     * 定期回访留痕(时间 / 内容 / 待办),暂停期不回访。
+     * POST /api/butler/one-on-one/follow-up
+     */
+    @PostMapping("/api/butler/one-on-one/follow-up")
+    public Result<ButlerOneOnOneCoachRecord> oneOnOneFollowUp(@RequestBody Map<String, Object> params,
+                                                               @RequestAttribute("userId") Long userId) {
+        Long recordId = ParamUtils.getLong(params.get("recordId"));
+        Result<Boolean> access = butlerOneOnOneCoachService.canAccessProfile(recordId, userId);
+        if (access.getCode() != 200) {
+            return Result.error(access.getCode(), access.getMessage());
+        }
+        return butlerOneOnOneCoachService.recordFollowUp(recordId,
+                (String) params.get("content"), (String) params.get("todo"), userId);
+    }
+
+    /**
+     * 家长发起 1v1 咨询(即时到管家侧 + SLA 计时,到期给续费入口)。
+     * POST /api/butler/one-on-one/consult/start
+     */
+    @PostMapping("/api/butler/one-on-one/consult/start")
+    public Result<ButlerOneOnOneCoachRecord> oneOnOneConsultStart(@RequestBody Map<String, Object> params,
+                                                                   @RequestAttribute("userId") Long userId) {
+        Long recordId = ParamUtils.getLong(params.get("recordId"));
+        Result<Boolean> access = butlerOneOnOneCoachService.canAccessProfile(recordId, userId);
+        if (access.getCode() != 200) {
+            return Result.error(access.getCode(), access.getMessage());
+        }
+        return butlerOneOnOneCoachService.startConsultation(
+                recordId, (String) params.get("content"), userId);
+    }
+
+    /**
+     * 管家响应并记录,家长端可见答复。
+     * POST /api/butler/one-on-one/consult/respond
+     */
+    @PostMapping("/api/butler/one-on-one/consult/respond")
+    public Result<ButlerOneOnOneCoachRecord> oneOnOneConsultRespond(@RequestBody Map<String, Object> params,
+                                                                     @RequestAttribute("userId") Long userId) {
+        Long recordId = ParamUtils.getLong(params.get("recordId"));
+        Result<Boolean> access = butlerOneOnOneCoachService.canAccessProfile(recordId, userId);
+        if (access.getCode() != 200) {
+            return Result.error(access.getCode(), access.getMessage());
+        }
+        return butlerOneOnOneCoachService.respondConsultation(
+                recordId, (String) params.get("response"), userId);
+    }
+
+    /**
+     * 同源消息列表(复用 teacher.message.push 通道)。
+     * POST /api/butler/one-on-one/messages
+     */
+    @PostMapping("/api/butler/one-on-one/messages")
+    public Result<Map<String, Object>> oneOnOneMessages(@RequestBody Map<String, Object> params,
+                                                         @RequestAttribute("userId") Long userId) {
+        Long familyId = ParamUtils.getLong(params.get("familyId"));
+        Integer page = params.get("page") != null ? Integer.valueOf(params.get("page").toString()) : 1;
+        Integer size = params.get("size") != null ? Integer.valueOf(params.get("size").toString()) : 20;
+        return butlerOneOnOneCoachService.listMessages(familyId, page, size);
+    }
 }

+ 124 - 0
cfc-backend/src/main/java/com/etotem/cfc/entity/ButlerOneOnOneCoachRecord.java

@@ -0,0 +1,124 @@
+package com.etotem.cfc.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 真人管家 · 一对一陪跑 / 多方协调工单(能力键 {@code butler.oneOnOne.coach},SC-H-02 / SC-H-03)。
+ *
+ * <p>承载家长档案 + 服务计划(服务周期 / 回访节奏 / 可配 SLA)、定期回访留痕、1v1 咨询计时与响应、
+ * 多方沟通协调(收集→同步→反馈→闭环)以及与 {@code teacher.message.push} 同源的消息主键。</p>
+ *
+ * <p>仅本服务家庭可见({@code familyId} 隔离,越界 403),全过程留痕依赖审计字段。</p>
+ */
+@Data
+@TableName("butler_one_on_one_coach_records")
+public class ButlerOneOnOneCoachRecord implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 服务状态:服务中 */
+    public static final String STATUS_ACTIVE = "ACTIVE";
+    /** 服务状态:暂停期(不发起回访) */
+    public static final String STATUS_PAUSED = "PAUSED";
+    /** 服务状态:已到期(咨询给续费入口,不静默拒) */
+    public static final String STATUS_EXPIRED = "EXPIRED";
+    /** 服务状态:已对齐(协调闭环) */
+    public static final String STATUS_ALIGNED = "ALIGNED";
+    /** 服务状态:已合并(并发咨询合并单会话) */
+    public static final String STATUS_MERGED = "MERGED";
+
+    /** 协调状态:收集诉求与方案 */
+    public static final String COORDINATION_COLLECTING = "COLLECTING";
+    /** 协调状态:已同步翻译后结论(不变更方案) */
+    public static final String COORDINATION_SYNCED = "SYNCED";
+    /** 协调状态:已向规划师反馈 */
+    public static final String COORDINATION_FEEDBACKED = "FEEDBACKED";
+    /** 协调状态:已闭环对齐 */
+    public static final String COORDINATION_ALIGNED = "ALIGNED";
+    /** 协调状态:争议引导直连 */
+    public static final String COORDINATION_DISPUTED = "DISPUTED";
+
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    /** 工单所属家庭(仅本服务家庭可见,越界 403)。 */
+    private Long familyId;
+
+    /** 家长用户 ID(咨询发起方)。 */
+    private Long parentUserId;
+
+    /** 管家用户 ID(服务提供方)。 */
+    private Long butlerUserId;
+
+    /** 服务周期(如 MONTHLY / QUARTERLY)。 */
+    private String serviceCycle;
+
+    /** 定期回访节奏(如 WEEKLY / BIWEEKLY)。 */
+    private String followUpCadence;
+
+    /** 响应 / 回访 SLA(分钟,按套餐可配)。 */
+    private Integer slaMinutes;
+
+    /** 服务状态:ACTIVE/PAUSED/EXPIRED/ALIGNED/MERGED。 */
+    private String status;
+
+    /** 服务到期时间(到期当天咨询给续费入口)。 */
+    private Date serviceExpireAt;
+
+    /** 最近回访时间。 */
+    private Date followUpAt;
+
+    /** 最近回访内容。 */
+    private String followUpContent;
+
+    /** 最近回访待办。 */
+    private String followUpTodo;
+
+    /** 咨询内容。 */
+    private String consultContent;
+
+    /** 咨询发起时间(SLA 计时起点)。 */
+    private Date consultStartedAt;
+
+    /** 管家响应内容(家长端可见)。 */
+    private String consultResponse;
+
+    /** 响应时间。 */
+    private Date respondedAt;
+
+    /** 关联 teacher.message.push 同源消息主键(teacher_messages.id)。 */
+    private Long messageId;
+
+    /** 同源消息回复内容。 */
+    private String replyContent;
+
+    /** 协调状态:COLLECTING/SYNCED/FEEDBACKED/ALIGNED/DISPUTED。 */
+    private String coordinationStatus;
+
+    /** 家长诉求(SC-H-03 步骤 1)。 */
+    private String parentDemand;
+
+    /** 规划师方案结论(只同步不变更)。 */
+    private String teacherConclusion;
+
+    /** 翻译后结论(向家长同步,不改方案)。 */
+    private String translatedConclusion;
+
+    /** 向规划师反馈的执行情况与疑虑。 */
+    private String teacherFeedback;
+
+    /** 监督反馈处置结论(闭环留痕)。 */
+    private String supervisionFeedback;
+
+    /** 创建时间(全过程留痕)。 */
+    private Date createdAt;
+
+    /** 更新时间(全过程留痕)。 */
+    private Date updatedAt;
+}

+ 14 - 0
cfc-backend/src/main/java/com/etotem/cfc/mapper/ButlerOneOnOneCoachRecordMapper.java

@@ -0,0 +1,14 @@
+package com.etotem.cfc.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.etotem.cfc.entity.ButlerOneOnOneCoachRecord;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 真人管家 · 一对一陪跑 / 多方协调工单 Mapper(能力键 {@code butler.oneOnOne.coach})。
+ *
+ * <p>Controller → Service → Mapper 分层,陪跑档案 / 协调工单经此落库。</p>
+ */
+@Mapper
+public interface ButlerOneOnOneCoachRecordMapper extends BaseMapper<ButlerOneOnOneCoachRecord> {
+}

+ 392 - 0
cfc-backend/src/main/java/com/etotem/cfc/service/ButlerOneOnOneCoachService.java

@@ -0,0 +1,392 @@
+package com.etotem.cfc.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.etotem.cfc.common.Result;
+import com.etotem.cfc.entity.ButlerOneOnOneCoachRecord;
+import com.etotem.cfc.mapper.ButlerOneOnOneCoachRecordMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 真人管家 · 一对一陪跑 / 多方沟通协调宿主服务(能力键 {@code butler.oneOnOne.coach},SC-H-02 / SC-H-03)。
+ *
+ * <p>陪跑闭环:建档案 + 服务计划(周期 / 回访节奏 / 可配 SLA)→ 定期回访留痕 → 家长随时 1v1 咨询
+ * (即时到管家侧 + SLA 计时 + 响应留痕家长可见);到期给续费入口、暂停期不回访、敏感字段脱敏、
+ * 并发咨询合并单会话,仅本服务家庭可见(越界 403)。</p>
+ *
+ * <p>协调闭环:收集家长诉求与规划师方案 → 翻译后同步(不变更方案结论)→ 向规划师反馈 →
+ * 闭环确认并全程留痕;争议引导直连,管家不改方案。消息协同复用 {@code teacher.message.push}
+ * 同源通道({@link TeacherMessageService}),PII 脱敏复用 {@link PiisService}。</p>
+ *
+ * <p>方法签名由契约测试 {@code ButlerOneOnOneCoachContractTest} /
+ * {@code ButlerOneOnOneCoachPersistenceContractTest} 反射锚定。</p>
+ */
+@Service
+public class ButlerOneOnOneCoachService {
+
+    private static final Logger log = LoggerFactory.getLogger(ButlerOneOnOneCoachService.class);
+
+    /** SLA 缺省响应时长(分钟),可按套餐 / 家庭覆盖。 */
+    private static final Integer DEFAULT_SLA_MINUTES = 120;
+    /** 缺省回访节奏。 */
+    private static final String DEFAULT_FOLLOW_UP_CADENCE = "WEEKLY";
+
+    @Resource
+    private ButlerOneOnOneCoachRecordMapper butlerOneOnOneCoachRecordMapper;
+
+    /** PII 脱敏:档案与协调消息含高敏字段时走统一脱敏口径(TC-H-02-E / TC-H-03-E)。 */
+    @Resource
+    private PiisService piisService;
+
+    /** teacher.message.push 同源通道:不另起独立消息通道,保证监督反馈闭环可审计。 */
+    @Resource
+    private TeacherMessageService teacherMessageService;
+
+    // ==================== SC-H-02:建档案 + 服务计划 + 定期回访 ====================
+
+    /**
+     * 建立家长档案与服务计划(TC-H-02 步骤 1)。
+     */
+    public Result<ButlerOneOnOneCoachRecord> createProfile(Long familyId, Long parentUserId,
+                                                            Long butlerUserId, String serviceCycle,
+                                                            String followUpCadence, Integer slaMinutes,
+                                                            Date serviceExpireAt) {
+        if (familyId == null || parentUserId == null) {
+            return Result.badRequest("familyId和parentUserId不能为空");
+        }
+        ButlerOneOnOneCoachRecord record = new ButlerOneOnOneCoachRecord();
+        record.setFamilyId(familyId);
+        record.setParentUserId(parentUserId);
+        record.setButlerUserId(butlerUserId);
+        record.setServiceCycle(serviceCycle);
+        record.setFollowUpCadence(followUpCadence == null ? DEFAULT_FOLLOW_UP_CADENCE : followUpCadence);
+        record.setSlaMinutes(slaMinutes == null ? DEFAULT_SLA_MINUTES : slaMinutes);
+        record.setServiceExpireAt(serviceExpireAt);
+        record.setStatus(ButlerOneOnOneCoachRecord.STATUS_ACTIVE);
+        record.setCoordinationStatus(ButlerOneOnOneCoachRecord.COORDINATION_COLLECTING);
+        record.setCreatedAt(new Date());
+        record.setUpdatedAt(new Date());
+        butlerOneOnOneCoachRecordMapper.insert(record);
+        return Result.success(record);
+    }
+
+    /**
+     * 执行一次定期回访并生成记录(时间 / 内容 / 待办,TC-H-02 步骤 2);暂停期不回访。
+     */
+    public Result<ButlerOneOnOneCoachRecord> recordFollowUp(Long recordId, String content,
+                                                             String todo, Long butlerUserId) {
+        ButlerOneOnOneCoachRecord record = butlerOneOnOneCoachRecordMapper.selectById(recordId);
+        if (record == null) {
+            return Result.notFound("陪跑档案不存在");
+        }
+        if (ButlerOneOnOneCoachRecord.STATUS_PAUSED.equals(record.getStatus())) {
+            return Result.error("服务暂停期不发起回访");
+        }
+        butlerOneOnOneCoachRecordMapper.update(null, new LambdaUpdateWrapper<ButlerOneOnOneCoachRecord>()
+                .eq(ButlerOneOnOneCoachRecord::getId, recordId)
+                .set(ButlerOneOnOneCoachRecord::getFollowUpAt, new Date())
+                .set(ButlerOneOnOneCoachRecord::getFollowUpContent, content)
+                .set(ButlerOneOnOneCoachRecord::getFollowUpTodo, todo)
+                .set(ButlerOneOnOneCoachRecord::getButlerUserId,
+                        butlerUserId == null ? record.getButlerUserId() : butlerUserId)
+                .set(ButlerOneOnOneCoachRecord::getUpdatedAt, new Date()));
+        return Result.success(butlerOneOnOneCoachRecordMapper.selectById(recordId));
+    }
+
+    // ==================== SC-H-02:1v1 咨询 + SLA + 响应留痕 ====================
+
+    /**
+     * 家长主动发起 1v1 咨询:请求即时到管家侧并启动 SLA 计时(TC-H-02 步骤 3)。
+     */
+    public Result<ButlerOneOnOneCoachRecord> startConsultation(Long recordId, String content, Long parentUserId) {
+        Result<Boolean> entitlement = checkServiceEntitlement(recordId);
+        if (entitlement.getCode() != 200) {
+            return Result.error(entitlement.getCode(), entitlement.getMessage());
+        }
+        butlerOneOnOneCoachRecordMapper.update(null, new LambdaUpdateWrapper<ButlerOneOnOneCoachRecord>()
+                .eq(ButlerOneOnOneCoachRecord::getId, recordId)
+                .set(ButlerOneOnOneCoachRecord::getConsultContent, content)
+                .set(ButlerOneOnOneCoachRecord::getConsultStartedAt, new Date())
+                .set(ButlerOneOnOneCoachRecord::getConsultResponse, null)
+                .set(ButlerOneOnOneCoachRecord::getRespondedAt, null)
+                .set(ButlerOneOnOneCoachRecord::getParentUserId,
+                        parentUserId == null ? null : parentUserId)
+                .set(ButlerOneOnOneCoachRecord::getUpdatedAt, new Date()));
+        return Result.success(butlerOneOnOneCoachRecordMapper.selectById(recordId));
+    }
+
+    /**
+     * 管家响应并记录,家长端可见答复(TC-H-02 步骤 4)。
+     */
+    public Result<ButlerOneOnOneCoachRecord> respondConsultation(Long recordId, String response, Long butlerUserId) {
+        ButlerOneOnOneCoachRecord record = butlerOneOnOneCoachRecordMapper.selectById(recordId);
+        if (record == null) {
+            return Result.notFound("陪跑档案不存在");
+        }
+        butlerOneOnOneCoachRecordMapper.update(null, new LambdaUpdateWrapper<ButlerOneOnOneCoachRecord>()
+                .eq(ButlerOneOnOneCoachRecord::getId, recordId)
+                .set(ButlerOneOnOneCoachRecord::getConsultResponse, piisService.sanitizeText(response))
+                .set(ButlerOneOnOneCoachRecord::getRespondedAt, new Date())
+                .set(ButlerOneOnOneCoachRecord::getButlerUserId,
+                        butlerUserId == null ? record.getButlerUserId() : butlerUserId)
+                .set(ButlerOneOnOneCoachRecord::getUpdatedAt, new Date()));
+        return Result.success(butlerOneOnOneCoachRecordMapper.selectById(recordId));
+    }
+
+    // ==================== TC-H-02-E:到期 / 暂停 / 脱敏 / 并发 ====================
+
+    /**
+     * 服务到期当天发起咨询 → 提示已到期并给出续费入口(不静默拒,TC-H-02-E)。
+     */
+    public Result<Boolean> checkServiceEntitlement(Long recordId) {
+        if (recordId == null) {
+            return Result.badRequest("recordId不能为空");
+        }
+        ButlerOneOnOneCoachRecord record = butlerOneOnOneCoachRecordMapper.selectById(recordId);
+        if (record == null) {
+            return Result.notFound("陪跑档案不存在");
+        }
+        if (ButlerOneOnOneCoachRecord.STATUS_PAUSED.equals(record.getStatus())) {
+            return Result.error("服务暂停中,暂不提供咨询");
+        }
+        Date expireAt = record.getServiceExpireAt();
+        if (ButlerOneOnOneCoachRecord.STATUS_EXPIRED.equals(record.getStatus())
+                || (expireAt != null && expireAt.before(new Date()))) {
+            return Result.error("服务已到期,请续费后继续咨询");
+        }
+        return Result.success(Boolean.TRUE);
+    }
+
+    /**
+     * 服务暂停期不发起回访、状态置为暂停(TC-H-02-E)。
+     */
+    public Result<ButlerOneOnOneCoachRecord> pauseFollowUp(Long recordId, Long butlerUserId, String reason) {
+        ButlerOneOnOneCoachRecord record = butlerOneOnOneCoachRecordMapper.selectById(recordId);
+        if (record == null) {
+            return Result.notFound("陪跑档案不存在");
+        }
+        butlerOneOnOneCoachRecordMapper.update(null, new LambdaUpdateWrapper<ButlerOneOnOneCoachRecord>()
+                .eq(ButlerOneOnOneCoachRecord::getId, recordId)
+                .set(ButlerOneOnOneCoachRecord::getStatus, ButlerOneOnOneCoachRecord.STATUS_PAUSED)
+                .set(ButlerOneOnOneCoachRecord::getFollowUpTodo, reason)
+                .set(ButlerOneOnOneCoachRecord::getButlerUserId,
+                        butlerUserId == null ? record.getButlerUserId() : butlerUserId)
+                .set(ButlerOneOnOneCoachRecord::getUpdatedAt, new Date()));
+        return Result.success(butlerOneOnOneCoachRecordMapper.selectById(recordId));
+    }
+
+    /**
+     * 家长档案含高敏信息时敏感字段脱敏,未授权不可导出(复用 PII 脱敏口径,TC-H-02-E)。
+     */
+    public Result<String> sanitizeProfileSensitive(String text) {
+        if (text == null) {
+            return Result.success(null);
+        }
+        return Result.success(piisService.sanitizeText(text));
+    }
+
+    /**
+     * 同一家长并发发起多个咨询 → 合并为 1 个会话,不产生多条并行工单(TC-H-02-E)。
+     */
+    @Transactional
+    public Result<ButlerOneOnOneCoachRecord> mergeConcurrentConsultations(Long familyId, Long parentUserId) {
+        List<ButlerOneOnOneCoachRecord> records = butlerOneOnOneCoachRecordMapper.selectList(
+                new LambdaQueryWrapper<ButlerOneOnOneCoachRecord>()
+                        .eq(familyId != null, ButlerOneOnOneCoachRecord::getFamilyId, familyId)
+                        .eq(parentUserId != null, ButlerOneOnOneCoachRecord::getParentUserId, parentUserId)
+                        .eq(ButlerOneOnOneCoachRecord::getStatus, ButlerOneOnOneCoachRecord.STATUS_ACTIVE)
+                        .orderByAsc(ButlerOneOnOneCoachRecord::getId));
+        if (records == null || records.isEmpty()) {
+            return Result.notFound("无进行中的咨询");
+        }
+        ButlerOneOnOneCoachRecord primary = records.get(0);
+        for (int i = 1; i < records.size(); i++) {
+            ButlerOneOnOneCoachRecord duplicate = records.get(i);
+            butlerOneOnOneCoachRecordMapper.update(null, new LambdaUpdateWrapper<ButlerOneOnOneCoachRecord>()
+                    .eq(ButlerOneOnOneCoachRecord::getId, duplicate.getId())
+                    .set(ButlerOneOnOneCoachRecord::getStatus, ButlerOneOnOneCoachRecord.STATUS_MERGED)
+                    .set(ButlerOneOnOneCoachRecord::getConsultResponse, "已合并至会话 " + primary.getId())
+                    .set(ButlerOneOnOneCoachRecord::getRespondedAt, new Date())
+                    .set(ButlerOneOnOneCoachRecord::getUpdatedAt, new Date()));
+        }
+        return Result.success(primary);
+    }
+
+    /**
+     * SLA 可配:按套餐 / 家庭配置回访与响应 SLA(SC-H-02 边界)。
+     */
+    public Result<ButlerOneOnOneCoachRecord> configureSla(Long recordId, Integer slaMinutes,
+                                                           String followUpCadence) {
+        if (slaMinutes == null || slaMinutes <= 0) {
+            return Result.badRequest("slaMinutes必须为正整数");
+        }
+        butlerOneOnOneCoachRecordMapper.update(null, new LambdaUpdateWrapper<ButlerOneOnOneCoachRecord>()
+                .eq(ButlerOneOnOneCoachRecord::getId, recordId)
+                .set(ButlerOneOnOneCoachRecord::getSlaMinutes, slaMinutes)
+                .set(ButlerOneOnOneCoachRecord::getFollowUpCadence, followUpCadence)
+                .set(ButlerOneOnOneCoachRecord::getUpdatedAt, new Date()));
+        return Result.success(butlerOneOnOneCoachRecordMapper.selectById(recordId));
+    }
+
+    // ==================== TC-H-02-P:家庭隔离 ====================
+
+    /**
+     * 仅本服务家庭可见,越界拒绝(403,TC-H-02-P)。
+     */
+    public Result<Boolean> canAccessProfile(Long recordId, Long userId) {
+        if (recordId == null || userId == null) {
+            return Result.forbidden("仅本服务家庭可见");
+        }
+        ButlerOneOnOneCoachRecord record = butlerOneOnOneCoachRecordMapper.selectById(recordId);
+        if (record == null) {
+            return Result.notFound("陪跑档案不存在");
+        }
+        if (userId.equals(record.getParentUserId()) || userId.equals(record.getButlerUserId())) {
+            return Result.success(Boolean.TRUE);
+        }
+        return Result.forbidden("仅本服务家庭可见");
+    }
+
+    // ==================== SC-H-03:多方沟通协调 + 消息同源 ====================
+
+    /**
+     * 收集家长诉求与规划师方案,三方信息在同一工单内可查(TC-H-03 步骤 1)。
+     */
+    public Result<ButlerOneOnOneCoachRecord> collectCoordination(Long recordId, String parentDemand,
+                                                                  String teacherConclusion, Long messageId) {
+        butlerOneOnOneCoachRecordMapper.update(null, new LambdaUpdateWrapper<ButlerOneOnOneCoachRecord>()
+                .eq(ButlerOneOnOneCoachRecord::getId, recordId)
+                .set(ButlerOneOnOneCoachRecord::getParentDemand, piisService.sanitizeText(parentDemand))
+                .set(ButlerOneOnOneCoachRecord::getTeacherConclusion, piisService.sanitizeText(teacherConclusion))
+                .set(ButlerOneOnOneCoachRecord::getMessageId, messageId)
+                .set(ButlerOneOnOneCoachRecord::getCoordinationStatus,
+                        ButlerOneOnOneCoachRecord.COORDINATION_COLLECTING)
+                .set(ButlerOneOnOneCoachRecord::getUpdatedAt, new Date()));
+        return Result.success(butlerOneOnOneCoachRecordMapper.selectById(recordId));
+    }
+
+    /**
+     * 向家长同步「翻译后」结论,不擅自变更规划师方案结论(TC-H-03 步骤 2 / TC-H-03-E)。
+     */
+    public Result<ButlerOneOnOneCoachRecord> syncTranslatedConclusion(Long recordId, String translatedConclusion) {
+        butlerOneOnOneCoachRecordMapper.update(null, new LambdaUpdateWrapper<ButlerOneOnOneCoachRecord>()
+                .eq(ButlerOneOnOneCoachRecord::getId, recordId)
+                .set(ButlerOneOnOneCoachRecord::getTranslatedConclusion,
+                        piisService.sanitizeText(translatedConclusion))
+                .set(ButlerOneOnOneCoachRecord::getCoordinationStatus,
+                        ButlerOneOnOneCoachRecord.COORDINATION_SYNCED)
+                .set(ButlerOneOnOneCoachRecord::getUpdatedAt, new Date()));
+        return Result.success(butlerOneOnOneCoachRecordMapper.selectById(recordId));
+    }
+
+    /**
+     * 向规划师反馈家长执行情况与疑虑,规划师侧可回复(TC-H-03 步骤 3)。
+     */
+    public Result<ButlerOneOnOneCoachRecord> feedbackToTeacher(Long recordId, String teacherFeedback) {
+        butlerOneOnOneCoachRecordMapper.update(null, new LambdaUpdateWrapper<ButlerOneOnOneCoachRecord>()
+                .eq(ButlerOneOnOneCoachRecord::getId, recordId)
+                .set(ButlerOneOnOneCoachRecord::getTeacherFeedback, piisService.sanitizeText(teacherFeedback))
+                .set(ButlerOneOnOneCoachRecord::getCoordinationStatus,
+                        ButlerOneOnOneCoachRecord.COORDINATION_FEEDBACKED)
+                .set(ButlerOneOnOneCoachRecord::getUpdatedAt, new Date()));
+        return Result.success(butlerOneOnOneCoachRecordMapper.selectById(recordId));
+    }
+
+    /**
+     * 完成节点对齐并闭环确认,工单状态置为已对齐且全过程留痕(TC-H-03 步骤 4)。
+     */
+    public Result<ButlerOneOnOneCoachRecord> closeCoordination(Long recordId) {
+        butlerOneOnOneCoachRecordMapper.update(null, new LambdaUpdateWrapper<ButlerOneOnOneCoachRecord>()
+                .eq(ButlerOneOnOneCoachRecord::getId, recordId)
+                .set(ButlerOneOnOneCoachRecord::getCoordinationStatus,
+                        ButlerOneOnOneCoachRecord.COORDINATION_ALIGNED)
+                .set(ButlerOneOnOneCoachRecord::getStatus, ButlerOneOnOneCoachRecord.STATUS_ALIGNED)
+                .set(ButlerOneOnOneCoachRecord::getUpdatedAt, new Date()));
+        return Result.success(butlerOneOnOneCoachRecordMapper.selectById(recordId));
+    }
+
+    /**
+     * 家长与规划师意见冲突 → 引导双方直接沟通并记录,不由管家单方裁决 / 不改方案(TC-H-03-E)。
+     */
+    public Result<ButlerOneOnOneCoachRecord> recordDisputeDirectConnect(Long recordId, String note) {
+        butlerOneOnOneCoachRecordMapper.update(null, new LambdaUpdateWrapper<ButlerOneOnOneCoachRecord>()
+                .eq(ButlerOneOnOneCoachRecord::getId, recordId)
+                .set(ButlerOneOnOneCoachRecord::getCoordinationStatus,
+                        ButlerOneOnOneCoachRecord.COORDINATION_DISPUTED)
+                .set(ButlerOneOnOneCoachRecord::getReplyContent, piisService.sanitizeText(note))
+                .set(ButlerOneOnOneCoachRecord::getUpdatedAt, new Date()));
+        return Result.success(butlerOneOnOneCoachRecordMapper.selectById(recordId));
+    }
+
+    /**
+     * 复用 teacher.message.push 同源通道推送三方协调消息(家长 / 规划师 / 管家)。
+     */
+    public Result<Long> pushCoordinationMessage(Long familyId, Long parentUserId, Long teacherId,
+                                                 String content, Long recordId) {
+        if (familyId == null || parentUserId == null || teacherId == null) {
+            return Result.badRequest("familyId/parentUserId/teacherId不能为空");
+        }
+        Long messageId = teacherMessageService.sendMessage(
+                familyId, parentUserId, teacherId, piisService.sanitizeText(content));
+        if (recordId != null) {
+            butlerOneOnOneCoachRecordMapper.update(null, new LambdaUpdateWrapper<ButlerOneOnOneCoachRecord>()
+                    .eq(ButlerOneOnOneCoachRecord::getId, recordId)
+                    .set(ButlerOneOnOneCoachRecord::getMessageId, messageId)
+                    .set(ButlerOneOnOneCoachRecord::getUpdatedAt, new Date()));
+        }
+        log.info("[butler.oneOnOne.coach] 协调消息已推送,messageId={}, recordId={}", messageId, recordId);
+        return Result.success(messageId);
+    }
+
+    /**
+     * 监督反馈闭环:记录家长 / 规划师反馈与处置结论,留痕可审计(SC-H-03 反馈→闭环)。
+     */
+    public Result<ButlerOneOnOneCoachRecord> recordSupervisionFeedback(Long recordId, String feedback,
+                                                                        String resolution) {
+        butlerOneOnOneCoachRecordMapper.update(null, new LambdaUpdateWrapper<ButlerOneOnOneCoachRecord>()
+                .eq(ButlerOneOnOneCoachRecord::getId, recordId)
+                .set(ButlerOneOnOneCoachRecord::getSupervisionFeedback, piisService.sanitizeText(feedback))
+                .set(ButlerOneOnOneCoachRecord::getReplyContent, piisService.sanitizeText(resolution))
+                .set(ButlerOneOnOneCoachRecord::getUpdatedAt, new Date()));
+        return Result.success(butlerOneOnOneCoachRecordMapper.selectById(recordId));
+    }
+
+    // ==================== 端点辅助查询 ====================
+
+    /** 分配 / 更换陪跑管家(管理端 assign)。 */
+    public Result<ButlerOneOnOneCoachRecord> assignButler(Long recordId, Long butlerUserId) {
+        if (recordId == null || butlerUserId == null) {
+            return Result.badRequest("recordId和butlerUserId不能为空");
+        }
+        butlerOneOnOneCoachRecordMapper.update(null, new LambdaUpdateWrapper<ButlerOneOnOneCoachRecord>()
+                .eq(ButlerOneOnOneCoachRecord::getId, recordId)
+                .set(ButlerOneOnOneCoachRecord::getButlerUserId, butlerUserId)
+                .set(ButlerOneOnOneCoachRecord::getUpdatedAt, new Date()));
+        return Result.success(butlerOneOnOneCoachRecordMapper.selectById(recordId));
+    }
+
+    /** 陪跑档案台账(管理端 records,按家庭隔离)。 */
+    public Result<List<ButlerOneOnOneCoachRecord>> listRecords(Long familyId) {
+        LambdaQueryWrapper<ButlerOneOnOneCoachRecord> wrapper = new LambdaQueryWrapper<ButlerOneOnOneCoachRecord>()
+                .eq(familyId != null, ButlerOneOnOneCoachRecord::getFamilyId, familyId)
+                .orderByDesc(ButlerOneOnOneCoachRecord::getCreatedAt);
+        return Result.success(butlerOneOnOneCoachRecordMapper.selectList(wrapper));
+    }
+
+    /** 同源消息列表(家庭端 messages,复用 teacher.message.push 通道)。 */
+    public Result<Map<String, Object>> listMessages(Long familyId, Integer page, Integer size) {
+        if (familyId == null) {
+            return Result.badRequest("familyId不能为空");
+        }
+        return Result.success(teacherMessageService.getFamilyMessages(
+                familyId, page == null ? 1 : page, size == null ? 20 : size));
+    }
+}

+ 33 - 0
cfc-backend/src/main/resources/schema.sql

@@ -3199,6 +3199,39 @@ CREATE TABLE IF NOT EXISTS butler_escalation_orders (
     INDEX idx_status_sla (status, sla_deadline)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='真人管家升级工单(SC-H-01/SC-H-04)';
 
+-- 真人管家一对一陪跑 / 多方协调工单(能力键 butler.oneOnOne.coach · SC-H-02 一对一家长陪跑 / SC-H-03 多方沟通协调)
+-- 档案 + 服务计划(周期/回访节奏/可配 SLA)、回访/咨询留痕、协调全过程留痕;family_id 隔离(越界 403)
+CREATE TABLE IF NOT EXISTS butler_one_on_one_coach_records (
+    id BIGINT AUTO_INCREMENT PRIMARY KEY,
+    family_id BIGINT NOT NULL COMMENT '工单所属家庭(仅本服务家庭可见,越界 403)',
+    parent_user_id BIGINT NOT NULL COMMENT '家长用户 ID(咨询发起方)',
+    butler_user_id BIGINT NULL COMMENT '管家用户 ID(服务提供方)',
+    service_cycle VARCHAR(32) NULL COMMENT '服务周期: MONTHLY/QUARTERLY',
+    follow_up_cadence VARCHAR(32) DEFAULT 'WEEKLY' COMMENT '定期回访节奏(可配)',
+    sla_minutes INT DEFAULT 120 COMMENT '响应/回访 SLA(分钟,按套餐可配)',
+    status VARCHAR(16) DEFAULT 'ACTIVE' COMMENT '状态: ACTIVE/PAUSED/EXPIRED/ALIGNED/MERGED',
+    service_expire_at DATETIME NULL COMMENT '服务到期时间(到期咨询给续费入口,不静默拒)',
+    follow_up_at DATETIME NULL COMMENT '最近回访时间',
+    follow_up_content TEXT NULL COMMENT '最近回访内容(留痕)',
+    follow_up_todo TEXT NULL COMMENT '最近回访待办(留痕)',
+    consult_content TEXT NULL COMMENT '咨询内容',
+    consult_started_at DATETIME NULL COMMENT '咨询发起时间(SLA 计时起点)',
+    consult_response TEXT NULL COMMENT '管家响应内容(家长端可见)',
+    responded_at DATETIME NULL COMMENT '响应时间',
+    message_id BIGINT NULL COMMENT '关联 teacher.message.push 同源消息主键(teacher_messages.id)',
+    reply_content TEXT NULL COMMENT '同源消息回复内容',
+    coordination_status VARCHAR(16) DEFAULT 'COLLECTING' COMMENT '协调状态: COLLECTING/SYNCED/FEEDBACKED/ALIGNED/DISPUTED',
+    parent_demand TEXT NULL COMMENT '家长诉求(SC-H-03 步骤1)',
+    teacher_conclusion TEXT NULL COMMENT '规划师方案结论(只同步不变更)',
+    translated_conclusion TEXT NULL COMMENT '翻译后结论(向家长同步,不改方案)',
+    teacher_feedback TEXT NULL COMMENT '向规划师反馈的执行情况与疑虑',
+    supervision_feedback TEXT NULL COMMENT '监督反馈处置结论(闭环留痕)',
+    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
+    updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+    INDEX idx_family_id (family_id),
+    INDEX idx_status_sla (status, consult_started_at)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='真人管家一对一陪跑/多方协调工单(SC-H-02/SC-H-03)';
+
 -- 家庭订阅记录
 CREATE TABLE IF NOT EXISTS member_subscription (
     id BIGINT AUTO_INCREMENT PRIMARY KEY,

+ 13 - 0
docs/superpowers/api/API_REFERENCE.md

@@ -3657,6 +3657,13 @@ W0.2 双配置中心合并:`product_config` 已并入 `service_config`(唯
 | `POST /api/butler/escalation/close` | 人工处置结论并闭环(PENDING→PROCESSING→CLOSED 留痕,TC-H-01 步骤4/5) |
 | `POST /api/butler/escalation/transfer` | 转交规划师(SC-H-01 转规划师) |
 | `POST /api/butler/escalation/withdraw` | 撤回升级工单(SC-H-04 已撤回) |
+| `POST /api/butler/one-on-one/profile/create` | 建立家长档案与服务计划(周期 / 回访节奏 / 可配 SLA,SC-H-02) |
+| `POST /api/butler/one-on-one/follow-up` | 定期回访留痕(时间 / 内容 / 待办;暂停期不回访,SC-H-02) |
+| `POST /api/butler/one-on-one/consult/start` | 家长发起 1v1 咨询(即时到管家侧 + SLA 计时;到期给续费入口,SC-H-02) |
+| `POST /api/butler/one-on-one/consult/respond` | 管家响应并留痕(家长端可见答复,SC-H-02) |
+| `POST /api/butler/one-on-one/messages` | 同源消息列表(复用 `teacher.message.push` 通道,SC-H-03) |
+
+> 能力键 `butler.oneOnOne.coach`(SC-H-02/SC-H-03)家庭端点已落地 `ButlerOneOnOneCoachService`:陪跑档案 / 回访 / 咨询 / 消息同源,仅本服务家庭可见(越界 403)。
 
 > 能力键 `butler.escalation.handle`(SC-H-01/SC-H-04)新增端点已落地 `ButlerEscalationService`:风险等级优先排序 / 乐观锁认领 / SLA 超时扫描 / 家庭隔离(越界 403)/ 联系/复盘留痕。
 
@@ -3681,6 +3688,12 @@ W0.2 双配置中心合并:`product_config` 已并入 `service_config`(唯
 | `POST /api/admin/butler/escalation/grade` | 按 SOP 分级升级工单:一级自行处置/二级升级(SC-H-04,admin/finance 角色校验) |
 | `POST /api/admin/butler/escalation/escalate` | 二级升级至运营/医疗顾问,携带完整上下文(SC-H-04,admin/finance 角色校验) |
 | `POST /api/admin/butler/escalation/review` | 生成复盘记录(含处置时长与结论,SC-H-04 复盘,admin/finance 角色校验) |
+| `POST /api/admin/butler/one-on-one/assign` | 分配 / 更换陪跑管家(SC-H-02,admin/finance 角色校验) |
+| `POST /api/admin/butler/one-on-one/sla/config` | 按套餐 / 家庭配置回访与响应 SLA(SC-H-02 边界,admin/finance 角色校验) |
+| `POST /api/admin/butler/one-on-one/records` | 陪跑档案台账(按家庭隔离,SC-H-02/H-03,admin/finance 角色校验) |
+| `POST /api/admin/butler/one-on-one/supervision` | 监督反馈闭环(反馈 + 处置结论留痕,SC-H-03,admin/finance 角色校验) |
+
+> 能力键 `butler.oneOnOne.coach` admin 端点(assign / sla/config / records / supervision)已落地 `ButlerOneOnOneCoachService`,仅 admin/finance 角色可操作。
 
 > 能力键 `butler.escalation.handle` admin 治理端点(grade/escalate/review)已落地 `ButlerEscalationService`,仅 admin/finance 角色可操作。
 | `POST /api/admin/butler/service-records` | 服务记录台账(多方沟通记录 / 质检台账,SC-H-03/H-07;分页) |