RuoYi-Vue-Plus/script/sql/pms_order_demo_data.sql

2014 lines
37 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- ========================================
-- PMS订单模块演示数据初始化脚本
-- 包含:客户联系人、房型房间、订单、客人信息、状态历史等
-- 适用于开发测试和功能演示
-- ========================================
SET FOREIGN_KEY_CHECKS = 0;
SET NAMES utf8mb4;
-- ========================================
-- 1. 客户联系人演示数据
-- ========================================
-- 清理现有数据
DELETE FROM pms_customer_contacts
WHERE tenant_id = '000000';
-- 插入客户联系人数据
INSERT INTO pms_customer_contacts (
contact_id,
tenant_id,
contact_type,
full_name,
phone_number,
email,
gender,
date_of_birth,
id_type,
id_number_encrypted,
nationality_country_code,
address_province,
address_city,
address_district,
address_detail,
postal_code,
contact_status,
member_level,
total_stays,
total_amount,
last_stay_date,
remarks,
create_dept,
create_by,
create_time,
update_by,
update_time,
del_flag
)
VALUES -- VIP客户
(
1001,
'000000',
'individual_guest',
'张三',
'13800138000',
'zhangsan@example.com',
'male',
'1985-03-15',
'ID_CARD',
'ENC_340123198503151234',
'CHN',
'安徽省',
'合肥市',
'蜀山区',
'望江西路123号',
'230031',
'active',
'platinum',
8,
12500.00,
'2024-11-15',
'VIP客户喜欢安静房间对服务要求较高',
103,
1,
NOW(),
1,
NOW(),
'0'
),
-- 常客
(
1002,
'000000',
'individual_guest',
'李四',
'13900139000',
'lisi@example.com',
'female',
'1990-07-22',
'ID_CARD',
'ENC_110101199007221234',
'CHN',
'北京市',
'北京市',
'朝阳区',
'建国路456号',
'100000',
'active',
'gold',
5,
6800.00,
'2024-10-20',
'常客,商务出差较多,偏好高楼层房间',
103,
1,
NOW(),
1,
NOW(),
'0'
),
-- 新客户
(
1003,
'000000',
'individual_guest',
'王五',
'15012345678',
'wangwu@example.com',
'male',
'1995-12-08',
'ID_CARD',
'ENC_320102199512081234',
'CHN',
'江苏省',
'南京市',
'玄武区',
'中山路789号',
'210000',
'active',
'silver',
1,
580.00,
'2024-09-10',
'新客户,首次入住体验良好',
103,
1,
NOW(),
1,
NOW(),
'0'
),
-- 团队负责人
(
1004,
'000000',
'group_leader',
'陈六',
'18612345678',
'chenliu@company.com',
'male',
'1982-05-30',
'ID_CARD',
'ENC_440103198205301234',
'CHN',
'广东省',
'广州市',
'天河区',
'天河路101号',
'510000',
'active',
'gold',
3,
4200.00,
'2024-08-25',
'公司团建负责人,经常预订多间房',
103,
1,
NOW(),
1,
NOW(),
'0'
),
-- 企业客户
(
1005,
'000000',
'corporate_contact',
'刘七',
'13712345678',
'liuqi@corp.com',
'female',
'1988-11-12',
'ID_CARD',
'ENC_510104198811121234',
'CHN',
'四川省',
'成都市',
'锦江区',
'春熙路202号',
'610000',
'active',
'platinum',
12,
18600.00,
'2024-11-28',
'企业协议客户,享受协议价格',
103,
1,
NOW(),
1,
NOW(),
'0'
);
-- ========================================
-- 2. 房型和房间演示数据
-- ========================================
-- 清理现有数据
DELETE FROM pms_room_rooms
WHERE tenant_id = '000000';
DELETE FROM pms_room_types
WHERE tenant_id = '000000';
-- 插入房型数据
INSERT INTO pms_room_types (
room_type_id,
tenant_id,
dept_id,
name,
description,
default_price,
capacity,
max_occupancy,
bed_type,
room_size,
amenities_json,
status,
create_dept,
create_by,
create_time,
update_by,
update_time,
del_flag
)
VALUES (
101,
'000000',
103,
'标准间',
'舒适的标准双人间,配备基础设施',
288.00,
2,
3,
'twin_beds',
25.0,
'["空调","电视","WiFi","热水器","吹风机"]',
'active',
103,
1,
NOW(),
1,
NOW(),
'0'
),
(
102,
'000000',
103,
'豪华间',
'宽敞的豪华房间,设施齐全',
388.00,
2,
4,
'queen_bed',
35.0,
'["空调","液晶电视","WiFi","热水器","吹风机","小冰箱","保险箱"]',
'active',
103,
1,
NOW(),
1,
NOW(),
'0'
),
(
103,
'000000',
103,
'套房',
'豪华套房,独立客厅和卧室',
588.00,
4,
6,
'king_bed',
60.0,
'["空调","液晶电视","WiFi","热水器","吹风机","小冰箱","保险箱","沙发","茶几","阳台"]',
'active',
103,
1,
NOW(),
1,
NOW(),
'0'
);
-- 插入房间数据
INSERT INTO pms_room_rooms (
room_id,
tenant_id,
dept_id,
room_type_id,
room_number,
floor,
room_status,
cleaning_status,
create_dept,
create_by,
create_time,
update_by,
update_time,
del_flag
)
VALUES -- 标准间
(
201,
'000000',
103,
101,
'201',
'2',
'available',
'clean',
103,
1,
NOW(),
1,
NOW(),
'0'
),
(
202,
'000000',
103,
101,
'202',
'2',
'available',
'clean',
103,
1,
NOW(),
1,
NOW(),
'0'
),
(
203,
'000000',
103,
101,
'203',
'2',
'occupied',
'clean',
103,
1,
NOW(),
1,
NOW(),
'0'
),
(
204,
'000000',
103,
101,
'204',
'2',
'available',
'clean',
103,
1,
NOW(),
1,
NOW(),
'0'
),
-- 豪华间
(
301,
'000000',
103,
102,
'301',
'3',
'available',
'clean',
103,
1,
NOW(),
1,
NOW(),
'0'
),
(
302,
'000000',
103,
102,
'302',
'3',
'occupied',
'clean',
103,
1,
NOW(),
1,
NOW(),
'0'
),
(
303,
'000000',
103,
102,
'303',
'3',
'available',
'clean',
103,
1,
NOW(),
1,
NOW(),
'0'
),
-- 套房
(
401,
'000000',
103,
103,
'401',
'4',
'available',
'clean',
103,
1,
NOW(),
1,
NOW(),
'0'
),
(
402,
'000000',
103,
103,
'402',
'4',
'occupied',
'clean',
103,
1,
NOW(),
1,
NOW(),
'0'
);
-- ========================================
-- 3. 渠道数据
-- ========================================
-- 清理现有数据
DELETE FROM pms_core_channels
WHERE tenant_id = '000000';
-- 插入渠道数据
INSERT INTO pms_core_channels (
channel_id,
tenant_id,
dept_id,
channel_name,
channel_type,
channel_code,
commission_rate,
contact_person,
contact_phone,
contact_email,
status,
create_dept,
create_by,
create_time,
update_by,
update_time,
del_flag
)
VALUES (
1,
'000000',
103,
'官网直订',
'direct_booking',
'DIRECT',
0.00,
'前台',
'400-123-4567',
'front@hotel.com',
'active',
103,
1,
NOW(),
1,
NOW(),
'0'
),
(
2,
'000000',
103,
'电话预订',
'direct_booking',
'PHONE',
0.00,
'前台',
'400-123-4567',
'front@hotel.com',
'active',
103,
1,
NOW(),
1,
NOW(),
'0'
),
(
3,
'000000',
103,
'现场步入',
'direct_booking',
'WALKIN',
0.00,
'前台',
'400-123-4567',
'front@hotel.com',
'active',
103,
1,
NOW(),
1,
NOW(),
'0'
),
(
4,
'000000',
103,
'携程',
'ota',
'CTRIP',
12.00,
'张经理',
'021-12345678',
'partner@ctrip.com',
'active',
103,
1,
NOW(),
1,
NOW(),
'0'
),
(
5,
'000000',
103,
'美团',
'ota',
'MEITUAN',
10.00,
'李经理',
'010-87654321',
'partner@meituan.com',
'active',
103,
1,
NOW(),
1,
NOW(),
'0'
);
-- ========================================
-- 4. 订单演示数据
-- ========================================
-- 清理现有数据
DELETE FROM pms_order_guests
WHERE tenant_id = '000000';
DELETE FROM pms_order_status_history
WHERE tenant_id = '000000';
DELETE FROM pms_core_orders
WHERE tenant_id = '000000';
-- 插入订单数据
INSERT INTO pms_core_orders (
order_id,
tenant_id,
dept_id,
contact_id,
pms_room_id,
room_type_id,
channel_id,
check_in_date,
check_out_date,
num_adults,
num_children,
total_amount,
paid_amount,
order_status,
order_source,
notes,
actual_check_in_time,
actual_check_out_time,
confirmed_time,
expected_arrival_time,
special_requests,
create_dept,
create_by,
create_time,
update_by,
update_time,
del_flag
)
VALUES -- 已入住订单
(
10001,
'000000',
103,
1001,
203,
101,
1,
'2024-12-01',
'2024-12-03',
2,
0,
576.00,
576.00,
'checked_in',
'direct_website',
'客人要求安静房间',
'2024-12-01 15:30:00',
NULL,
'2024-11-28 10:15:00',
'15:00:00',
'需要安静房间,高楼层优先',
103,
1,
'2024-11-28 10:15:00',
1,
'2024-12-01 15:30:00',
'0'
),
-- 已入住订单(豪华间)
(
10002,
'000000',
103,
1002,
302,
102,
2,
'2024-12-01',
'2024-12-02',
1,
0,
388.00,
388.00,
'checked_in',
'direct_phone',
'商务客人',
'2024-12-01 14:20:00',
NULL,
'2024-11-29 16:30:00',
'14:00:00',
'需要发票,商务出差',
103,
1,
'2024-11-29 16:30:00',
1,
'2024-12-01 14:20:00',
'0'
),
-- 已入住订单(套房)
(
10003,
'000000',
103,
1004,
402,
103,
4,
'2024-11-30',
'2024-12-03',
4,
1,
1764.00,
1764.00,
'checked_in',
'ota_channel_manager',
'团队入住',
'2024-11-30 16:00:00',
NULL,
'2024-11-25 09:45:00',
'16:00:00',
'团队入住,需要相邻房间',
103,
1,
'2024-11-25 09:45:00',
1,
'2024-11-30 16:00:00',
'0'
),
-- 已确认订单(待入住)
(
10004,
'000000',
103,
1003,
NULL,
101,
1,
'2024-12-05',
'2024-12-07',
2,
0,
576.00,
288.00,
'confirmed',
'direct_website',
'预付50%',
NULL,
NULL,
'2024-12-02 11:20:00',
'15:00:00',
'蜜月旅行,需要浪漫布置',
103,
1,
'2024-12-02 11:20:00',
1,
'2024-12-02 11:20:00',
'0'
),
-- 待确认订单
(
10005,
'000000',
103,
1005,
NULL,
102,
5,
'2024-12-10',
'2024-12-12',
2,
0,
776.00,
0.00,
'pending_confirmation',
'ota_channel_manager',
'企业协议价格',
NULL,
NULL,
NULL,
'18:00:00',
'企业客户,享受协议价格',
103,
1,
'2024-12-03 09:30:00',
1,
'2024-12-03 09:30:00',
'0'
),
-- 已退房订单
(
10006,
'000000',
103,
1001,
301,
102,
1,
'2024-11-25',
'2024-11-27',
2,
0,
776.00,
776.00,
'checked_out',
'direct_website',
'满意的住宿体验',
'2024-11-25 15:00:00',
'2024-11-27 11:30:00',
'2024-11-20 14:15:00',
'15:00:00',
'周年纪念,需要鲜花布置',
103,
1,
'2024-11-20 14:15:00',
1,
'2024-11-27 11:30:00',
'0'
),
-- 已取消订单
(
10007,
'000000',
103,
1002,
NULL,
101,
2,
'2024-11-28',
'2024-11-30',
1,
0,
576.00,
0.00,
'cancelled',
'direct_phone',
'客人临时取消',
NULL,
NULL,
'2024-11-26 10:00:00',
'14:00:00',
'因公司会议取消出差',
103,
1,
'2024-11-26 10:00:00',
1,
'2024-11-26 15:20:00',
'0'
);
-- ========================================
-- 5. 订单客人信息
-- ========================================
-- 插入订单客人数据
INSERT INTO pms_order_guests (
guest_id,
tenant_id,
order_id,
dept_id,
contact_id,
guest_type,
is_primary_contact,
full_name,
id_type,
id_number_encrypted,
phone_number,
age_group,
create_time,
create_by,
del_flag
)
VALUES -- 订单10001的客人信息
(
20001,
'000000',
10001,
103,
1001,
'primary',
1,
'张三',
'ID_CARD',
'ENC_340123198503151234',
'13800138000',
'adult',
NOW(),
1,
'0'
),
(
20002,
'000000',
10001,
103,
NULL,
'additional',
0,
'张夫人',
'ID_CARD',
'ENC_340123198703201234',
'13800138001',
'adult',
NOW(),
1,
'0'
),
-- 订单10002的客人信息
(
20003,
'000000',
10002,
103,
1002,
'primary',
1,
'李四',
'ID_CARD',
'ENC_110101199007221234',
'13900139000',
'adult',
NOW(),
1,
'0'
),
-- 订单10003的客人信息团队
(
20004,
'000000',
10003,
103,
1004,
'primary',
1,
'陈六',
'ID_CARD',
'ENC_440103198205301234',
'18612345678',
'adult',
NOW(),
1,
'0'
),
(
20005,
'000000',
10003,
103,
NULL,
'additional',
0,
'同事甲',
'ID_CARD',
'ENC_440103199001011234',
'18612345679',
'adult',
NOW(),
1,
'0'
),
(
20006,
'000000',
10003,
103,
NULL,
'additional',
0,
'同事乙',
'ID_CARD',
'ENC_440103199102021234',
'18612345680',
'adult',
NOW(),
1,
'0'
),
(
20007,
'000000',
10003,
103,
NULL,
'additional',
0,
'同事丙',
'ID_CARD',
'ENC_440103199203031234',
'18612345681',
'adult',
NOW(),
1,
'0'
),
(
20008,
'000000',
10003,
103,
NULL,
'additional',
0,
'小朋友',
'ID_CARD',
'ENC_440103201505051234',
'',
'child',
NOW(),
1,
'0'
),
-- 订单10004的客人信息
(
20009,
'000000',
10004,
103,
1003,
'primary',
1,
'王五',
'ID_CARD',
'ENC_320102199512081234',
'15012345678',
'adult',
NOW(),
1,
'0'
),
(
20010,
'000000',
10004,
103,
NULL,
'additional',
0,
'王夫人',
'ID_CARD',
'ENC_320102199612121234',
'15012345679',
'adult',
NOW(),
1,
'0'
),
-- 订单10005的客人信息
(
20011,
'000000',
10005,
103,
1005,
'primary',
1,
'刘七',
'ID_CARD',
'ENC_510104198811121234',
'13712345678',
'adult',
NOW(),
1,
'0'
),
(
20012,
'000000',
10005,
103,
NULL,
'additional',
0,
'同事',
'ID_CARD',
'ENC_510104199001011234',
'13712345679',
'adult',
NOW(),
1,
'0'
),
-- 订单10006的客人信息已退房
(
20013,
'000000',
10006,
103,
1001,
'primary',
1,
'张三',
'ID_CARD',
'ENC_340123198503151234',
'13800138000',
'adult',
'2024-11-25 15:00:00',
1,
'0'
),
(
20014,
'000000',
10006,
103,
NULL,
'additional',
0,
'张夫人',
'ID_CARD',
'ENC_340123198703201234',
'13800138001',
'adult',
'2024-11-25 15:00:00',
1,
'0'
);
-- ========================================
-- 6. 订单状态变更历史
-- ========================================
-- 插入订单状态历史数据
INSERT INTO pms_order_status_history (
history_id,
tenant_id,
order_id,
dept_id,
from_status,
to_status,
change_reason,
change_time,
change_by,
notes,
del_flag
)
VALUES -- 订单10001状态历史
(
30001,
'000000',
10001,
103,
NULL,
'pending_confirmation',
'system_auto',
'2024-11-28 10:15:00',
1,
'订单创建',
'0'
),
(
30002,
'000000',
10001,
103,
'pending_confirmation',
'confirmed',
'payment_received',
'2024-11-28 10:30:00',
1,
'收到全额付款',
'0'
),
(
30003,
'000000',
10001,
103,
'confirmed',
'checked_in',
'guest_arrived',
'2024-12-01 15:30:00',
1,
'客人按时到达办理入住',
'0'
),
-- 订单10002状态历史
(
30004,
'000000',
10002,
103,
NULL,
'pending_confirmation',
'system_auto',
'2024-11-29 16:30:00',
1,
'电话预订创建',
'0'
),
(
30005,
'000000',
10002,
103,
'pending_confirmation',
'confirmed',
'staff_operation',
'2024-11-29 16:35:00',
1,
'前台确认预订',
'0'
),
(
30006,
'000000',
10002,
103,
'confirmed',
'checked_in',
'guest_arrived',
'2024-12-01 14:20:00',
1,
'商务客人提前到达',
'0'
),
-- 订单10003状态历史
(
30007,
'000000',
10003,
103,
NULL,
'pending_confirmation',
'system_auto',
'2024-11-25 09:45:00',
1,
'OTA订单同步',
'0'
),
(
30008,
'000000',
10003,
103,
'pending_confirmation',
'confirmed',
'payment_received',
'2024-11-25 10:00:00',
1,
'OTA确认付款',
'0'
),
(
30009,
'000000',
10003,
103,
'confirmed',
'checked_in',
'guest_arrived',
'2024-11-30 16:00:00',
1,
'团队按时入住',
'0'
),
-- 订单10004状态历史
(
30010,
'000000',
10004,
103,
NULL,
'pending_confirmation',
'system_auto',
'2024-12-02 11:20:00',
1,
'官网预订',
'0'
),
(
30011,
'000000',
10004,
103,
'pending_confirmation',
'confirmed',
'payment_received',
'2024-12-02 11:25:00',
1,
'收到预付款',
'0'
),
-- 订单10005状态历史
(
30012,
'000000',
10005,
103,
NULL,
'pending_confirmation',
'system_auto',
'2024-12-03 09:30:00',
1,
'OTA订单同步',
'0'
),
-- 订单10006状态历史已完成
(
30013,
'000000',
10006,
103,
NULL,
'pending_confirmation',
'system_auto',
'2024-11-20 14:15:00',
1,
'周年纪念预订',
'0'
),
(
30014,
'000000',
10006,
103,
'pending_confirmation',
'confirmed',
'payment_received',
'2024-11-20 14:30:00',
1,
'收到全额付款',
'0'
),
(
30015,
'000000',
10006,
103,
'confirmed',
'checked_in',
'guest_arrived',
'2024-11-25 15:00:00',
1,
'客人入住,房间已布置',
'0'
),
(
30016,
'000000',
10006,
103,
'checked_in',
'checked_out',
'guest_departed',
'2024-11-27 11:30:00',
1,
'客人满意退房',
'0'
),
-- 订单10007状态历史已取消
(
30017,
'000000',
10007,
103,
NULL,
'pending_confirmation',
'system_auto',
'2024-11-26 10:00:00',
1,
'电话预订',
'0'
),
(
30018,
'000000',
10007,
103,
'pending_confirmation',
'confirmed',
'staff_operation',
'2024-11-26 10:05:00',
1,
'前台确认',
'0'
),
(
30019,
'000000',
10007,
103,
'confirmed',
'cancelled',
'guest_request',
'2024-11-26 15:20:00',
1,
'客人因公司会议取消',
'0'
);
-- ========================================
-- 7. 价格规则演示数据
-- ========================================
-- 清理现有数据
DELETE FROM pms_room_pricing_rules
WHERE tenant_id = '000000';
-- 插入价格规则数据
INSERT INTO pms_room_pricing_rules (
rule_id,
tenant_id,
dept_id,
name,
room_type_id,
date_range_start,
date_range_end,
days_of_week_json,
price_adjustment_type,
adjustment_value,
min_los,
max_los,
advance_booking_days_min,
advance_booking_days_max,
channel_restrictions_json,
guest_count_min,
guest_count_max,
member_level_restrictions_json,
priority,
status,
description,
create_dept,
create_by,
create_time,
update_by,
update_time,
del_flag
)
VALUES -- 周末加价规则
(
40001,
'000000',
103,
'周末加价',
NULL,
'2024-01-01',
'2024-12-31',
'[6,7]',
'percentage_increase_on_base',
20.00,
1,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
10,
'active',
'周末房价上浮20%',
103,
1,
NOW(),
1,
NOW(),
'0'
),
-- 提前预订优惠
(
40002,
'000000',
103,
'早鸟优惠',
NULL,
'2024-01-01',
'2024-12-31',
NULL,
'percentage_discount_from_base',
15.00,
2,
NULL,
7,
NULL,
NULL,
NULL,
NULL,
NULL,
8,
'active',
'提前7天预订享受15%优惠',
103,
1,
NOW(),
1,
NOW(),
'0'
),
-- VIP会员专享价格
(
40003,
'000000',
103,
'VIP会员价',
NULL,
'2024-01-01',
'2024-12-31',
NULL,
'percentage_discount_from_base',
10.00,
1,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
'["platinum","gold"]',
15,
'active',
'VIP会员享受10%优惠',
103,
1,
NOW(),
1,
NOW(),
'0'
),
-- 连住优惠
(
40004,
'000000',
103,
'连住优惠',
NULL,
'2024-01-01',
'2024-12-31',
NULL,
'percentage_discount_from_base',
8.00,
3,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
5,
'active',
'连住3晚及以上享受8%优惠',
103,
1,
NOW(),
1,
NOW(),
'0'
),
-- 节假日特价(春节)
(
40005,
'000000',
103,
'春节特价',
NULL,
'2024-02-10',
'2024-02-17',
NULL,
'percentage_increase_on_base',
50.00,
1,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
20,
'active',
'春节期间房价上浮50%',
103,
1,
NOW(),
1,
NOW(),
'0'
);
-- ========================================
-- 8. 特殊日期价格
-- ========================================
-- 清理现有数据
DELETE FROM pms_special_date_pricing
WHERE tenant_id = '000000';
-- 插入特殊日期价格数据
INSERT INTO pms_special_date_pricing (
special_date_id,
tenant_id,
dept_id,
room_type_id,
special_date,
date_type,
price_adjustment_type,
adjustment_value,
min_los,
max_los,
description,
priority,
status,
create_dept,
create_by,
create_time,
update_by,
update_time,
del_flag
)
VALUES -- 元旦节
(
50001,
'000000',
103,
NULL,
'2024-01-01',
'national_holiday',
'percentage_increase_on_base',
30.00,
1,
NULL,
'元旦节特价',
20,
'active',
103,
1,
NOW(),
1,
NOW(),
'0'
),
-- 情人节
(
50002,
'000000',
103,
NULL,
'2024-02-14',
'traditional_festival',
'percentage_increase_on_base',
25.00,
1,
NULL,
'情人节浪漫套餐',
18,
'active',
103,
1,
NOW(),
1,
NOW(),
'0'
),
-- 五一劳动节
(
50003,
'000000',
103,
NULL,
'2024-05-01',
'national_holiday',
'percentage_increase_on_base',
40.00,
1,
NULL,
'五一黄金周',
20,
'active',
103,
1,
NOW(),
1,
NOW(),
'0'
),
-- 本地音乐节
(
50004,
'000000',
103,
NULL,
'2024-06-15',
'local_event',
'percentage_increase_on_base',
35.00,
1,
NULL,
'本地音乐节期间',
15,
'active',
103,
1,
NOW(),
1,
NOW(),
'0'
),
-- 中秋节
(
50005,
'000000',
103,
NULL,
'2024-09-17',
'traditional_festival',
'percentage_increase_on_base',
20.00,
1,
NULL,
'中秋佳节',
18,
'active',
103,
1,
NOW(),
1,
NOW(),
'0'
);
-- ========================================
-- 9. 库存快照演示数据
-- ========================================
-- 清理现有数据
DELETE FROM pms_room_inventory_snapshot
WHERE tenant_id = '000000';
-- 插入库存快照数据最近7天
INSERT INTO pms_room_inventory_snapshot (
snapshot_id,
tenant_id,
dept_id,
room_type_id,
snapshot_date,
total_rooms,
available_rooms,
occupied_rooms,
dirty_rooms,
out_of_order_rooms,
reserved_rooms,
occupancy_rate,
create_time,
del_flag
)
VALUES -- 2024-12-01 快照
(
60001,
'000000',
103,
101,
'2024-12-01',
4,
1,
3,
0,
0,
0,
75.00,
'2024-12-01 23:59:59',
'0'
),
(
60002,
'000000',
103,
102,
'2024-12-01',
3,
1,
2,
0,
0,
0,
66.67,
'2024-12-01 23:59:59',
'0'
),
(
60003,
'000000',
103,
103,
'2024-12-01',
2,
0,
2,
0,
0,
0,
100.00,
'2024-12-01 23:59:59',
'0'
),
-- 2024-11-30 快照
(
60004,
'000000',
103,
101,
'2024-11-30',
4,
2,
2,
0,
0,
0,
50.00,
'2024-11-30 23:59:59',
'0'
),
(
60005,
'000000',
103,
102,
'2024-11-30',
3,
2,
1,
0,
0,
0,
33.33,
'2024-11-30 23:59:59',
'0'
),
(
60006,
'000000',
103,
103,
'2024-11-30',
2,
1,
1,
0,
0,
0,
50.00,
'2024-11-30 23:59:59',
'0'
),
-- 2024-11-29 快照
(
60007,
'000000',
103,
101,
'2024-11-29',
4,
3,
1,
0,
0,
0,
25.00,
'2024-11-29 23:59:59',
'0'
),
(
60008,
'000000',
103,
102,
'2024-11-29',
3,
2,
1,
0,
0,
0,
33.33,
'2024-11-29 23:59:59',
'0'
),
(
60009,
'000000',
103,
103,
'2024-11-29',
2,
2,
0,
0,
0,
0,
0.00,
'2024-11-29 23:59:59',
'0'
);
-- ========================================
-- 10. 价格计算历史演示数据
-- ========================================
-- 清理现有数据
DELETE FROM pms_pricing_calculations
WHERE tenant_id = '000000';
-- 插入价格计算历史数据
INSERT INTO pms_pricing_calculations (
calculation_id,
tenant_id,
dept_id,
order_id,
room_type_id,
check_in_date,
check_out_date,
base_price,
final_price,
applied_rules_json,
calculation_context,
calculation_time,
calculated_by,
del_flag
)
VALUES -- 订单10001的价格计算
(
70001,
'000000',
103,
10001,
101,
'2024-12-01',
'2024-12-03',
288.00,
288.00,
'[]',
'{"booking_channel":"direct","member_level":"platinum","advance_days":4}',
'2024-11-28 10:15:00',
1,
'0'
),
-- 订单10002的价格计算
(
70002,
'000000',
103,
10002,
102,
'2024-12-01',
'2024-12-02',
388.00,
388.00,
'[]',
'{"booking_channel":"phone","member_level":"gold","advance_days":2}',
'2024-11-29 16:30:00',
1,
'0'
),
-- 订单10003的价格计算团队价格
(
70003,
'000000',
103,
10003,
103,
'2024-11-30',
'2024-12-03',
588.00,
588.00,
'[{"rule_id":40001,"rule_name":"周末加价","adjustment":"+20%","amount":117.60}]',
'{"booking_channel":"ota","member_level":"gold","advance_days":5,"guest_count":5}',
'2024-11-25 09:45:00',
1,
'0'
),
-- 订单10004的价格计算早鸟优惠
(
70004,
'000000',
103,
10004,
101,
'2024-12-05',
'2024-12-07',
288.00,
244.80,
'[{"rule_id":40002,"rule_name":"早鸟优惠","adjustment":"-15%","amount":-43.20}]',
'{"booking_channel":"direct","member_level":"silver","advance_days":3}',
'2024-12-02 11:20:00',
1,
'0'
),
-- 订单10006的价格计算VIP优惠+周末加价)
(
70005,
'000000',
103,
10006,
102,
'2024-11-25',
'2024-11-27',
388.00,
418.32,
'[{"rule_id":40001,"rule_name":"周末加价","adjustment":"+20%","amount":77.60},{"rule_id":40003,"rule_name":"VIP会员价","adjustment":"-10%","amount":-46.56}]',
'{"booking_channel":"direct","member_level":"platinum","advance_days":5}',
'2024-11-20 14:15:00',
1,
'0'
);
-- ========================================
-- 数据初始化完成
-- ========================================
SET FOREIGN_KEY_CHECKS = 1;
-- 输出统计信息
SELECT '=== PMS订单模块演示数据初始化完成 ===' AS message;
SELECT '客户联系人' AS data_type,
COUNT(*) AS record_count
FROM pms_customer_contacts
WHERE tenant_id = '000000'
UNION ALL
SELECT '房型数据' AS data_type,
COUNT(*) AS record_count
FROM pms_room_types
WHERE tenant_id = '000000'
UNION ALL
SELECT '房间数据' AS data_type,
COUNT(*) AS record_count
FROM pms_room_rooms
WHERE tenant_id = '000000'
UNION ALL
SELECT '订单数据' AS data_type,
COUNT(*) AS record_count
FROM pms_core_orders
WHERE tenant_id = '000000'
UNION ALL
SELECT '订单客人' AS data_type,
COUNT(*) AS record_count
FROM pms_order_guests
WHERE tenant_id = '000000'
UNION ALL
SELECT '状态历史' AS data_type,
COUNT(*) AS record_count
FROM pms_order_status_history
WHERE tenant_id = '000000'
UNION ALL
SELECT '价格规则' AS data_type,
COUNT(*) AS record_count
FROM pms_room_pricing_rules
WHERE tenant_id = '000000'
UNION ALL
SELECT '特殊价格' AS data_type,
COUNT(*) AS record_count
FROM pms_special_date_pricing
WHERE tenant_id = '000000';
-- 显示订单状态分布
SELECT '=== 订单状态分布 ===' AS message,
order_status,
COUNT(*) AS count
FROM pms_core_orders
WHERE tenant_id = '000000'
GROUP BY order_status
ORDER BY count DESC;