admin/sql/seed_e2e_order_lifecycle.sql
zzh c918faec97 feat(order): 订单链路演练签收 API、E2E 测试与批量任务 SQL 修复
补充链路演练模拟签收接口、E2E 主数据/菜单种子与测试项目,并修复批量任务列表 SqlSugar 查询及表结构注释脚本。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-08 11:32:45 +08:00

150 lines
5.3 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.

-- E2E 订单全链路测试主数据(固定 ID 段 900x / 99001)
-- 前置:已执行 db.sql;库中已有 t_country.US
-- 用法:mysql ... oms_test < sql/seed_e2e_order_lifecycle.sql
-- RBAC 菜单/权限:sql/seed_order_lab_rbac_menu.sql + sql/seed_order_lab_role_permissions.sql
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- 清理旧 E2E 数据(子表优先)
DELETE FROM `t_sales_product_allocation_provider` WHERE `SalesProductId` = 9001;
DELETE FROM `t_sales_product_price_detail` WHERE `PriceId` = 9001;
DELETE FROM `t_sales_product_price_factor` WHERE `PriceId` = 9001;
DELETE FROM `t_sales_product_price` WHERE `Id` = 9001;
DELETE FROM `t_service_channel_price_detail` WHERE `PriceId` = 9001;
DELETE FROM `t_service_channel_price_factor` WHERE `PriceId` = 9001;
DELETE FROM `t_service_channel_price` WHERE `Id` = 9001;
DELETE FROM `t_sales_product` WHERE `Id` = 9001;
DELETE FROM `t_service_channel` WHERE `Id` = 9001;
DELETE FROM `t_weight_rounding_info` WHERE `RoundingId` = 9001;
DELETE FROM `t_weight_rounding` WHERE `Id` = 9001;
DELETE FROM `t_weight_rule_info` WHERE `RuleId` = 9001;
DELETE FROM `t_weight_rule` WHERE `Id` = 9001;
DELETE FROM `t_kpi_area_info` WHERE `AreaId` = 9001;
DELETE FROM `t_kpi_area` WHERE `Id` = 9001;
DELETE FROM `t_warehouse_address` WHERE `Id` = 9001;
DELETE FROM `t_customer` WHERE `Id` = 99001;
-- 仓库
INSERT INTO `t_warehouse_address` (
`Id`, `WarehouseName`, `WarehouseType`, `Recipient`, `ContactPhone`, `ShippingAddress`,
`IsDeleted`, `ConcurrencyStamp`, `CreateUserId`, `CreateTime`
) VALUES (
9001, 'E2E测试仓', 'main', 'E2E', '0755-00000000', '深圳市南山区测试路1号',
0, UUID(), 0, NOW()
);
-- 价格分区(美西 → US)
INSERT INTO `t_kpi_area` (
`Id`, `AppKey`, `AreaType`, `Name`, `SystemName`,
`IsDeleted`, `ConcurrencyStamp`, `CreateUserId`, `CreateTime`
) VALUES (
9001, 'oms', 'warning', '美西', 'E2E-US-WEST',
0, UUID(), 0, NOW()
);
INSERT INTO `t_kpi_area_info` (
`AreaId`, `CountryCode`, `CountryName`, `IsDeleted`, `CreateUserId`, `CreateTime`
) VALUES (
9001, 'US', '美国', 0, 0, NOW()
);
-- 计重规则 / 进位
INSERT INTO `t_weight_rule` (
`Id`, `AppKey`, `Name`, `IsDeleted`, `ConcurrencyStamp`, `CreateUserId`, `CreateTime`
) VALUES (
9001, 'oms', 'E2E计重规则', 0, UUID(), 0, NOW()
);
INSERT INTO `t_weight_rule_info` (
`RuleId`, `Client`, `Condition`, `BillableWeight`, `VolumetricFactor`,
`IsDeleted`, `CreateUserId`, `CreateTime`
) VALUES (
9001, '全部', 'gw>=vw', 'gw', '6000', 0, 0, NOW()
);
INSERT INTO `t_weight_rounding` (
`Id`, `AppKey`, `Name`, `IsDeleted`, `ConcurrencyStamp`, `CreateUserId`, `CreateTime`
) VALUES (
9001, 'oms', 'E2E进位', 0, UUID(), 0, NOW()
);
INSERT INTO `t_weight_rounding_info` (
`RoundingId`, `StartValue`, `EndValue`, `Public`, `IsDeleted`, `CreateUserId`, `CreateTime`
) VALUES (
9001, 0, 30, '0.5', 0, 0, NOW()
);
-- 服务渠道 + 买价
INSERT INTO `t_service_channel` (
`Id`, `ChannelCode`, `ChannelName`, `IsActive`,
`IsDeleted`, `ConcurrencyStamp`, `CreateUserId`, `CreateTime`
) VALUES (
9001, 'E2E-CH-01', 'E2E测试渠道', 1,
0, UUID(), 0, NOW()
);
INSERT INTO `t_service_channel_price` (
`Id`, `ServiceChannelId`, `SerialNumber`, `Status`, `PriceName`, `CostItem`, `CostUnit`, `Currency`,
`IsDeleted`, `CreateUserId`, `CreateTime`
) VALUES (
9001, 9001, 1, 1, 'E2E买价', 'freight', 'kg', 'CNY',
0, 0, NOW()
);
INSERT INTO `t_service_channel_price_detail` (
`PriceId`, `FactorValuesJson`, `CalculationFormula`, `CalculatedValue`,
`IsDeleted`, `CreateUserId`, `CreateTime`
) VALUES (
9001,
'{"分区":"美西","货物类型":"普货","首重":"1","首重价":"10","续重单位":"0.5","续重价":"4"}',
'续单价', NULL,
0, 0, NOW()
);
-- 销售产品 + 卖价 + 排货
INSERT INTO `t_sales_product` (
`Id`, `ProductCode`, `ProductName`, `ProductGroup`, `PriceAreaId`, `WeightRuleId`, `WeightRoundingId`,
`IsActive`, `Scheme`, `IsDeleted`, `ConcurrencyStamp`, `CreateUserId`, `CreateTime`
) VALUES (
9001, 'E2E-SP-01', 'E2E测试产品', '专线', 9001, 9001, 9001,
1, 'costLowest', 0, UUID(), 0, NOW()
);
INSERT INTO `t_sales_product_price` (
`Id`, `SalesProductId`, `SerialNumber`, `Status`, `PriceName`, `CostItem`, `CostUnit`, `Currency`,
`IsDeleted`, `CreateUserId`, `CreateTime`
) VALUES (
9001, 9001, 1, 1, 'E2E卖价', 'freight', 'kg', 'CNY',
0, 0, NOW()
);
INSERT INTO `t_sales_product_price_detail` (
`PriceId`, `FactorValuesJson`, `CalculationFormula`, `CalculatedValue`,
`IsDeleted`, `CreateUserId`, `CreateTime`
) VALUES (
9001,
'{"分区":"美西","货物类型":"普货","首重":"1","首重价":"18","续重单位":"0.5","续重价":"6"}',
'续单价', NULL,
0, 0, NOW()
);
INSERT INTO `t_sales_product_allocation_provider` (
`SalesProductId`, `SerialNumber`, `ProviderName`, `ServiceChannelId`, `Weight`,
`IsDeleted`, `CreateUserId`, `CreateTime`
) VALUES (
9001, 1, 'E2E渠道商', 9001, 100,
0, 0, NOW()
);
-- 客户(密码明文 e2e123 → MD5)
INSERT INTO `t_customer` (
`Id`, `UserId`, `CustomerCode`, `CustomerName`, `Email`, `Phone`, `Balance`,
`Status`, `Password`, `IsDeleted`, `ConcurrencyStamp`, `CreateUserId`, `CreateTime`
) VALUES (
99001, 1, 'E2E001', 'E2E测试客户', 'e2e99001@test.local', '19900009901', 50000.00,
1, '5df3e7decfd8323014e399401de7d82f', 0, UUID(), 0, NOW()
);
SET FOREIGN_KEY_CHECKS = 1;