refactor(ecom): 订单状态统计规则从单一开关升级为多维度独立控制

- ec_order_status 表 auto_statistics 拆分为四个独立字段:include_sales_amount / include_product_cost / include_freight_cost / include_other_cost / include_refund
- CompanyOverviewServiceImpl / ShopOverviewStatisticsServiceImpl / ProductOverviewServiceImpl / ExportStatusRangeHelper 全部改为按各维度独立统计
- OrderStatus PO/DTO/VO 层字段更新,Service 层校验逻辑同步调整
- ProductSpecImportHelper 导入逻辑适配新字段
- 前端订单状态配置页适配新字段及展示
- 新增 OrderStatusCard.vue 卡片组件
- 更新 ec_design.sql 设计文档
This commit is contained in:
小蟑螂
2026-05-05 21:09:46 +08:00
parent a1953d5447
commit c6025a7c2c
22 changed files with 1173 additions and 616 deletions
+7 -4
View File
@@ -166,6 +166,8 @@ CREATE TABLE `ec_order` (
-- ----------------------------
-- 订单状态表
-- 说明:各统计维度独立开关(0否 1是),替代原 auto_statistics / is_refund。
-- 概览、导出等按维度筛选订单状态时分别读取对应字段;任一为 1 的状态会进入「待拉取订单」并集。
-- ----------------------------
DROP TABLE IF EXISTS `ec_order_status`;
CREATE TABLE `ec_order_status` (
@@ -175,8 +177,11 @@ CREATE TABLE `ec_order_status` (
`description` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '状态描述',
`color` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '状态颜色(十六进制)',
`sort_order` int NOT NULL DEFAULT 0 COMMENT '排序',
`auto_statistics` tinyint NOT NULL DEFAULT 1 COMMENT '是否自动参与统计 0不参与 1参与',
`is_refund` tinyint NOT NULL DEFAULT 0 COMMENT '是否为退款状态 0否 1是',
`include_sales_amount` tinyint NOT NULL DEFAULT 0 COMMENT '是否计入销售额/单量等统计 0否 1是',
`include_product_cost` tinyint NOT NULL DEFAULT 0 COMMENT '是否计入商品成本统计 0否 1是',
`include_freight_cost` tinyint NOT NULL DEFAULT 0 COMMENT '是否计入运费成本统计 0否 1是',
`include_other_cost` tinyint NOT NULL DEFAULT 0 COMMENT '是否计入其他成本统计 0否 1是',
`include_refund` tinyint NOT NULL DEFAULT 0 COMMENT '是否计入退款金额统计 0否 1是',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`create_by` bigint UNSIGNED NULL DEFAULT NULL COMMENT '创建人ID',
@@ -185,10 +190,8 @@ CREATE TABLE `ec_order_status` (
UNIQUE INDEX `uk_company_status_name`(`company_id` ASC, `status_name` ASC) USING BTREE,
INDEX `idx_company_id`(`company_id` ASC) USING BTREE,
INDEX `idx_sort_order`(`sort_order` ASC) USING BTREE,
INDEX `idx_auto_statistics`(`auto_statistics` ASC) USING BTREE,
INDEX `fk_ec_order_status_creator`(`create_by` ASC) USING BTREE,
INDEX `fk_ec_order_status_updater`(`update_by` ASC) USING BTREE,
INDEX `idx_is_refund`(`is_refund` ASC) USING BTREE,
CONSTRAINT `fk_ec_order_status_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_ec_order_status_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `fk_ec_order_status_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE