-- =====================================================================
-- 预警结果模拟数据 (按规则引擎产出, 供前端预警中心展示验证)
-- 与真实 scanAllContracts() 产出一致, 规则已用 SQL 验证
-- =====================================================================

SET NAMES utf8mb4;

-- 清理旧模拟结果(保留真实预警)
DELETE FROM `edu_alert` WHERE contract_id BETWEEN 4201 AND 4299;
DELETE FROM `edu_alert` WHERE contract_id = (SELECT id FROM (SELECT id FROM edu_contract WHERE contract_no='EDUCT20260115001') t);

INSERT INTO `edu_alert`(`id`,`tenant_id`,`student_id`,`contract_id`,`contract_no`,`alert_type`,`level`,`title`,`content`,`threshold_value`,`current_value`,`housekeeper_id`,`status`,`del_flag`,`create_by`,`create_time`) VALUES
-- 1. 主合同到期警告(WARN): 赵小明数学课 距到期19天
(7001,'000000',2001,(SELECT id FROM (SELECT id FROM edu_contract WHERE contract_no='EDUCT20260115001') t),'EDUCT20260115001','EXPIRING','WARN','合同即将到期','合同将于19天后到期(2026-07-15), 请跟进续费',30,19,1003,'0','0',1,NOW()),
-- 2. ALERT-001 课时不足(WARN): 钱小红 剩8课时
(7002,'000000',2002,4201,'EDUCT-ALERT-001','HOURS_LOW','WARN','课时不足预警','剩余8.00课时(占20%), 建议尽快续费',20,8,1003,'0','0',1,NOW()),
-- 3. ALERT-002 课时不足(URGENT): 孙小刚 剩1.5课时
(7003,'000000',2003,4202,'EDUCT-ALERT-002','HOURS_LOW','URGENT','课时不足预警','剩余1.50课时(占8%), 建议尽快续费',20,1.5,1003,'0','0',1,NOW()),
-- 4. ALERT-003 即将到期(WARN): 钱小红 15天后到期
(7004,'000000',2002,4203,'EDUCT-ALERT-003','EXPIRING','WARN','合同即将到期','合同将于15天后到期(2026-07-11), 请跟进续费',30,15,1003,'0','0',1,NOW()),
-- 5. ALERT-004 已过期(URGENT): 孙小刚 已过期10天
(7005,'000000',2003,4204,'EDUCT-ALERT-004','EXPIRED','URGENT','合同已过期','合同已于2026-06-16过期(10天前), 但仍为执行中状态, 请核查结清或续费',0,10,1003,'0','0',1,NOW()),
-- 6. ALERT-004 课时不足(INFO): 孙小刚 剩18课时(同一合同可同时有课时+过期两类)
(7006,'000000',2003,4204,'EDUCT-ALERT-004','HOURS_LOW','INFO','课时不足预警','剩余18.00课时(占60%), 建议尽快续费',20,18,1003,'0','0',1,NOW());
