|
|
@@ -3538,6 +3538,10 @@ insertSysConfigSeed("gift_membership_pay_price", "198000", "送会员商品达
|
|
|
|
|
|
// 迁移473(FamilyWorkbench 2026-11-13): tasks 加 (family_id, created_at) 索引(工作台按家庭聚合与逐日趋势分桶)
|
|
|
addTasksFamilyCreatedIndex();
|
|
|
+
|
|
|
+ // 迁移474: 创建管家服务质检/满意度/绩效三张表
|
|
|
+ //(butler.quality.qa · SC-H-07 服务质检与满意度:质检→满意度回访→回流改进;差评触发复盘;隐私脱敏)
|
|
|
+ createButlerQualityQaTables();
|
|
|
}
|
|
|
|
|
|
/** 迁移473(FamilyWorkbench): tasks 加家庭+时间复合索引,支撑工作台按家庭聚合计数与近 30 天逐日趋势。 */
|
|
|
@@ -3550,6 +3554,72 @@ insertSysConfigSeed("gift_membership_pay_price", "198000", "送会员商品达
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 迁移474: 创建管家服务质检/满意度/绩效承载表(butler.quality.qa · SC-H-07 服务质检与满意度)。
|
|
|
+ *
|
|
|
+ * <p>三张表构成「质检→满意度回访→回流改进」闭环:
|
|
|
+ * butler_quality_inspections(抽样/全量质检,逐项通过/不通过+依据+脱敏摘要,不展示隐私对话原文)、
|
|
|
+ * butler_satisfaction(家长满意度评分,差评触发复盘标记,uk_butler_user 幂等去重)、
|
|
|
+ * butler_performance(质检结果回流的绩效看板,uk_butler_period 唯一)。
|
|
|
+ * 幂等(CREATE TABLE IF NOT EXISTS)。</p>
|
|
|
+ */
|
|
|
+ private void createButlerQualityQaTables() {
|
|
|
+ // 迁移474: butler_quality_inspections(服务质检记录)
|
|
|
+ try {
|
|
|
+ jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS butler_quality_inspections ("
|
|
|
+ + "id BIGINT AUTO_INCREMENT PRIMARY KEY, "
|
|
|
+ + "butler_id BIGINT NOT NULL COMMENT '被质检管家 userId', "
|
|
|
+ + "inspection_type VARCHAR(20) DEFAULT 'sampling' COMMENT '质检方式: sampling=抽样/full=全量', "
|
|
|
+ + "inspection_items TEXT COMMENT '逐项质检结果JSON[{item:SLA/合规/态度,basis:依据,result:PASS/FAIL}](逐项通过/不通过+依据)', "
|
|
|
+ + "desensitized_summary TEXT COMMENT '脱敏摘要(质检报告不展示家长隐私对话原文)', "
|
|
|
+ + "overall_result VARCHAR(10) DEFAULT 'PASS' COMMENT '总体结论 PASS/FAIL', "
|
|
|
+ + "inspected_by BIGINT COMMENT '质检操作人 userId', "
|
|
|
+ + "created_at DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', "
|
|
|
+ + "updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', "
|
|
|
+ + "INDEX idx_butler_id (butler_id) "
|
|
|
+ + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管家服务质检记录'");
|
|
|
+ log.info("迁移474: 已创建 butler_quality_inspections 表");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("迁移474: 创建 butler_quality_inspections 表失败(可能已存在): {}", e.getMessage());
|
|
|
+ }
|
|
|
+ // 迁移474: butler_satisfaction(满意度评分)
|
|
|
+ try {
|
|
|
+ jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS butler_satisfaction ("
|
|
|
+ + "id BIGINT AUTO_INCREMENT PRIMARY KEY, "
|
|
|
+ + "butler_id BIGINT NOT NULL COMMENT '被评价管家 userId', "
|
|
|
+ + "user_id BIGINT NOT NULL COMMENT '提交评分的家长 userId', "
|
|
|
+ + "rating INT NOT NULL COMMENT '满意度评分(1-5)', "
|
|
|
+ + "comment VARCHAR(1000) COMMENT '回访意见', "
|
|
|
+ + "bad_review_triggered TINYINT(1) DEFAULT 0 COMMENT '差评触发复盘标记(幂等: 0=未触发 1=已触发)', "
|
|
|
+ + "created_at DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', "
|
|
|
+ + "updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', "
|
|
|
+ + "UNIQUE KEY uk_butler_user (butler_id, user_id), "
|
|
|
+ + "INDEX idx_user_id (user_id) "
|
|
|
+ + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管家服务满意度评分'");
|
|
|
+ log.info("迁移474: 已创建 butler_satisfaction 表");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("迁移474: 创建 butler_satisfaction 表失败(可能已存在): {}", e.getMessage());
|
|
|
+ }
|
|
|
+ // 迁移474: butler_performance(绩效看板)
|
|
|
+ try {
|
|
|
+ jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS butler_performance ("
|
|
|
+ + "id BIGINT AUTO_INCREMENT PRIMARY KEY, "
|
|
|
+ + "butler_id BIGINT NOT NULL COMMENT '管家 userId', "
|
|
|
+ + "period VARCHAR(7) NOT NULL COMMENT '统计月份 yyyy-MM', "
|
|
|
+ + "inspection_pass_rate DECIMAL(5,2) DEFAULT 0 COMMENT '质检通过率(%)', "
|
|
|
+ + "satisfaction_avg DECIMAL(3,2) DEFAULT 0 COMMENT '满意度均分(1-5)', "
|
|
|
+ + "weak_items TEXT COMMENT '薄弱环节JSON(回流改进)', "
|
|
|
+ + "created_at DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', "
|
|
|
+ + "updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', "
|
|
|
+ + "UNIQUE KEY uk_butler_period (butler_id, period), "
|
|
|
+ + "INDEX idx_period (period) "
|
|
|
+ + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管家绩效看板'");
|
|
|
+ log.info("迁移474: 已创建 butler_performance 表");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("迁移474: 创建 butler_performance 表失败(可能已存在): {}", e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 迁移464: 创建 P3 跨案例聚合承载表(T15 跨案例聚合,S-cfc-119 guhe.p3.lowSideAggregate)。
|
|
|
*
|