refactor(vendor): 抽出缺貨 API 查詢服務
All checks were successful
CD Pipeline / deploy (push) Successful in 2m11s

This commit is contained in:
OoO
2026-05-01 14:12:56 +08:00
parent b5de8d5d61
commit fbc85fcedc
8 changed files with 157 additions and 131 deletions

View File

@@ -4,8 +4,8 @@
## 盤點結論
- Python 總量:約 66,596 行。
- 最大壓力區:`routes/` 約 21,038 行、`services/` 約 25,717 行。
- Python 總量:約 66,719 行。
- 最大壓力區:`routes/` 約 20,928 行、`services/` 約 25,929 行。
- `app.py` 目前約 1,209 行,功能定位應固定為 bootstrap / Blueprint registration / startup guard不再承接新 route。
- 目前仍有 15 個 Python 檔案超過 800 行;這些不是禁止修 bug而是禁止繼續塞新功能。
@@ -17,7 +17,7 @@
| 2707 | `scheduler.py` | P0 排程總管 | task registry / crawler jobs / report jobs / notification jobs |
| 2653 | `routes/sales_routes.py` | P0 巨型 Blueprint | page routes / API routes / chart query service / calendar service |
| 1743 | `routes/ai_routes.py` | P1 AI Blueprint | route glue / AI orchestration service / prompt builders |
| 1675 | `routes/vendor_routes.py` | P1 Vendor Blueprint | route glue / stockout serviceV2 query 已抽到 `services/vendor_stockout_query_service.py` |
| 1565 | `routes/vendor_routes.py` | P1 Vendor Blueprint | route glue / stockout mutation/emailV2 page query 與 stockout list/batches API query 已抽到 `services/vendor_stockout_query_service.py` |
| 1345 | `services/ppt_generator.py` | P1 報表生成 service | deck orchestration / slide builders / chart builders |
| 1339 | `services/nemoton_dispatcher_service.py` | P1 NemoTron service | NIM client / tool-call parser / action dispatcher |
| 1300 | `services/openclaw_strategist_service.py` | P1 OpenClaw service | prompt builders / report composer / strategy rules |
@@ -25,7 +25,7 @@
| 1079 | `routes/cicd_routes.py` | P2 CI/CD Blueprint | route glue / CI query service / deployment action service |
| 986 | `services/telegram_bot_service.py` | P2 Telegram service | command handlers / message formatters / bot client |
| 966 | `services/trend_crawler.py` | P2 crawler service | source adapters / parser / persistence |
| 868 | `services/elephant_alpha_autonomous_engine.py` | P2 ElephantAlpha engine | HITL / executor / planning policy |
| 946 | `services/elephant_alpha_autonomous_engine.py` | P2 ElephantAlpha engine | HITL / executor / planning policy |
| 818 | `services/import_service.py` | P2 import service | validators / import writers / report builders |
| 805 | `routes/bot_api_routes.py` | P2 Bot API Blueprint | route glue / bot action service |
@@ -34,7 +34,7 @@
1. P0持續拆 `routes/openclaw_bot_routes.py`Telegram API helper 已搬到 `services/openclaw_bot/telegram_api.py`Inline Keyboard builders 已搬到 `services/openclaw_bot/menu_keyboards.py`,下一步拆 report formatting 或 command dispatcher。
2. P0`routes/sales_routes.py`,先把 chart/query/calendar 計算搬到 `services/sales/`
3. P0`scheduler.py`,建立 `jobs/``services/scheduler/` task registry。
4. P1`routes/ai_routes.py``routes/vendor_routes.py` 的資料處理移出 routeVendor V2 query 第一刀已完成,下一步可抽 API list/batches email grouping。
4. P1`routes/ai_routes.py``routes/vendor_routes.py` 的資料處理移出 routeVendor V2 page query API list/batches 已完成,下一步可抽 email grouping 或 vendor management query
5. P1把 PPT / NemoTron / OpenClaw 大 service 拆成 client、parser、composer、policy。
6. P2對 800-1100 行檔案採「碰到就順手抽」策略,但不可讓淨行數繼續增加。