feat(business): add Kingdee sales order API sync

Implement private Kingdee config generation, token login/refresh caching, paginated sales order fetching, official response-field normalization, and CLI filters for deterministic business fact sync. Update docs to keep credentials in .runtime and cover dry-run auth.

Validation: python3 -m unittest discover -v; python3 -m compileall obsidian_wiki tests; git diff --check.
This commit is contained in:
Codex
2026-07-06 19:47:40 +00:00
parent 4dfef7e099
commit 5f257a7ccb
9 changed files with 785 additions and 43 deletions
+11 -5
View File
@@ -322,10 +322,16 @@ Operational counts and amounts belong in a structured fact database, not in mark
# Sync from an exported or API-fetched Kingdee JSON payload.
obsidian-wiki business sync kingdee --input ./kingdee-orders.json
# Or fetch from a simple JSON endpoint.
KINGDEE_API_URL="https://example.internal/orders" \
KINGDEE_API_TOKEN="..." \
obsidian-wiki business sync kingdee --since 2026-07-01T00:00:00Z
# Or create the private local config for the real Kingdee API/token flow.
obsidian-wiki business config kingdee
vim .runtime/kingdee.env
obsidian-wiki business sync kingdee --dry-run-auth
# Then fetch reviewed June orders from Kingdee.
obsidian-wiki business sync kingdee \
--start-bizdate 2026-06-01 \
--end-bizdate 2026-06-30 \
--billstatus C
# Ask deterministic statistics questions.
obsidian-wiki business query "2026年6月接了多少单"
@@ -333,7 +339,7 @@ obsidian-wiki business query "2026-06 sales amount"
obsidian-wiki business query "2026-06 top customer"
```
V1 uses fixed templates for monthly order count, monthly sales amount, monthly top customers, and a customer trend query. The default order-count basis is distinct Kingdee sales order number by order date. Detailed order rows stay in SQLite; the wiki remains for business context, customer/project knowledge, and later summary pages when you choose to generate them.
V1 uses fixed templates for monthly order count, monthly sales amount, monthly top customers, and a customer trend query. The default order-count basis is distinct Kingdee sales order number by order date. Detailed order rows stay in SQLite; the wiki remains for business context, customer/project knowledge, and later summary pages when you choose to generate them. Real Kingdee credentials live in `.runtime/kingdee.env`, and fetched tokens are cached in `.runtime/kingdee-token.json`; both files are local-only and ignored by git.
### Optional: Source File MCP Server