yml2213
|
88ba87efff
|
feat(cost-center): 总览统计支持按来源收敛
页面顶部的 6 张统计卡原本是全局口径:选了「自动发货」,商品数还是 2017、
异常数还是 108,314,和下面的列表对不上。
- overview 接口接受 scope(all / affiliate_dash / work_order / manual);
- 商品、映射、成本项、生效版本、待处理异常、未映射订单项全部按来源过滤:
商品看 canonical_sku 前缀(aff: / tpl:+wo: / man:),
成本项与版本看 cost_model,异常与未映射订单项看 order_items.fulfillment_mode;
- 额外返回 productTotalCount(全局商品数),供「全部」徽标使用,
避免切到单一来源后「全部」也被算成 49。
实测四种口径:
all 商品 2017 / 映射 4897 / 成本项 3 / 版本 712 / 异常 108314 / 未映射 53901
affiliate_dash 商品 49 / 映射 0 / 成本项 1 / 版本 0 / 异常 53204 / 未映射 0
work_order 商品 773 / 映射 4897 / 成本项 1 / 版本 711 / 异常 1209 / 未映射 0
manual 商品 1195 / 映射 0 / 成本项 1 / 版本 1 / 异常 0 / 未映射 0
|
2026-10-25 13:55:25 +08:00 |
|
yml2213
|
63ae32d18c
|
refactor(finance): 成本模型与履约方式正交,拆分成本中心巨型文件
后端:
- 删除 services/admin/admin-cost-center-service.ts(4,248 行),拆为
services/cost-center/ 下 5 个模块:
cost-center-shared(类型/枚举/归一化/映射/costModelScopeSql)、
cost-center-overview(总览与选项)、
product-catalog(商品与渠道映射)、
template-bootstrap(模板引导、自动发货同步、工单证据回填)、
cost-definition(成本项/版本/异常/预览/快照)
- cost_items.carrier_type / cost_type 改为单一 cost_model;专属模型只对
对应履约方式生效,通用模型对所有履约方式生效
- cost_snapshots / cost_exceptions 删除载体列;按履约方式筛异常改用
IN 半连接(248k 异常下 EXISTS 逐行回表 2.7s -> 170ms)
- sales_daily_facts.carrier_type -> fulfillment_mode
- 人工支出按 cost_model 归类;履约方式只读 order_items.fulfillment_mode
- 移除 syncOpenCostExceptionCarrierTypes:异常表已无载体列可同步
前端:
- AdminCostCenterPage.tsx(2,887 行 -> 18 行转发),拆为
pages/admin/cost-center/ 下 8 个 Panel + shared + CostCenterContext
- CostCarrierType 删除;新增 FulfillmentMode / ProductSource / CostModel
- 销售毛利页 carrierType -> fulfillmentMode
同步补两个索引:idx_order_items_fulfillment_id(异常半连接)、
idx_work_categories_name(商品目录分类 lateral join)。
|
2026-10-23 16:06:25 +08:00 |
|