START TRANSACTION;

INSERT INTO ccdi_bank_tag_rule (
    model_code,
    model_name,
    rule_code,
    rule_name,
    indicator_code,
    result_type,
    risk_level,
    business_caliber,
    enabled,
    sort_order,
    create_by,
    remark
) VALUES
('EXTERNAL_LARGE_TRANSACTION', '外部人员大额交易',
 'EXTERNAL_SINGLE_LARGE_AMOUNT', '外部人员单笔大额交易', 'FREQUENT_TRANSFER',
 'STATEMENT', 'MEDIUM',
 '本方证件号非空且未命中员工、员工亲属的外部主体，单笔交易金额超过大额转账阈值。',
 1, 10, 'system', '真实规则：识别外部人员单笔大额交易'),
('EXTERNAL_LARGE_TRANSACTION', '外部人员大额交易',
 'EXTERNAL_CUMULATIVE_TRANSACTION_AMOUNT', '外部人员累计交易超限', 'CUMULATIVE_TRANSACTION_AMOUNT',
 'OBJECT', 'MEDIUM',
 '本方证件号非空且未命中员工、员工亲属的外部主体，累计交易金额超过累计大额收入阈值。',
 1, 20, 'system', '真实规则：识别外部人员累计交易金额超限'),
('EXTERNAL_LARGE_TRANSACTION', '外部人员大额交易',
 'EXTERNAL_ANNUAL_TURNOVER', '外部人员年流水交易额超限', 'ANNUAL_TURNOVER',
 'OBJECT', 'MEDIUM',
 '本方证件号非空且未命中员工、员工亲属的外部主体，近一年流水交易额超过年累计交易额阈值。',
 1, 30, 'system', '真实规则：识别外部人员年流水交易额超限'),
('EXTERNAL_ABNORMAL_TRANSACTION', '外部人员异常交易',
 'EXTERNAL_NIGHT_TRANSACTION', '外部人员夜间集中交易', NULL,
 'STATEMENT', 'MEDIUM',
 '本方证件号非空且未命中员工、员工亲属的外部主体，在22:00至次日06:00发生资金交易。',
 1, 40, 'system', '真实规则：识别外部人员夜间交易'),
('EXTERNAL_SUSPICIOUS_GAMBLING', '外部人员可疑赌博',
 'EXTERNAL_GAMBLING_MEMO', '外部人员疑似赌博摘要', NULL,
 'STATEMENT', 'MEDIUM',
 '本方证件号非空且未命中员工、员工亲属的外部主体，交易摘要、交易类型或对手方名称命中赌博敏感词。',
 1, 50, 'system', '真实规则：识别外部人员疑似赌博摘要'),
('EXTERNAL_SUSPICIOUS_GAMBLING', '外部人员可疑赌博',
 'EXTERNAL_MULTI_PARTY_GAMBLING_TRANSFER', '外部人员同日多对手方疑似赌博交易', NULL,
 'OBJECT', 'HIGH',
 '本方证件号非空且未命中员工、员工亲属的外部主体，同日多笔、多对手方交易且金额落在疑似赌博区间。',
 1, 60, 'system', '真实规则：识别外部人员同日多对手方疑似赌博交易'),
('EXTERNAL_SUSPICIOUS_RELATION', '外部人员可疑关系',
 'EXTERNAL_TO_STAFF_FAMILY_TRANSACTION', '外部人员与员工或员工亲属交易', NULL,
 'STATEMENT', 'HIGH',
 '本方证件号非空且未命中员工、员工亲属的外部主体，对手方账号命中员工或员工亲属，或对手方账号未命中已维护账号时对手方名称命中员工或员工亲属。',
 1, 70, 'system', '真实规则：识别外部人员与员工或员工亲属资金往来')
ON DUPLICATE KEY UPDATE
    model_code = VALUES(model_code),
    model_name = VALUES(model_name),
    rule_name = VALUES(rule_name),
    indicator_code = VALUES(indicator_code),
    result_type = VALUES(result_type),
    risk_level = VALUES(risk_level),
    business_caliber = VALUES(business_caliber),
    enabled = VALUES(enabled),
    sort_order = VALUES(sort_order),
    update_by = 'system',
    update_time = NOW(),
    remark = VALUES(remark);

COMMIT;
