腾讯WorkBuddy 763a940683 B-39: 数据库持久化与不可变导入
- 版本化 SQLite 迁移(向前/回滚)与连接助手。
- 导入管线:上传文件按 SHA-256 内容哈希不可变保存,文件/行/批次
  幂等;重复上传返回 duplicate 并复用已有批次,不产生第二份事实。
- 每条规范化源行反查文件、工作表、原始行号与模板版本。
- 解析失败保留 exception/failed 批次与诊断,不产生已确认交易。
- 决策记录见 docs/decisions/002-persistence.md。
2026-08-16 01:48:53 +08:00

往来台账

当前版本包含银行流水表头识别内核,以及相互独立的总账管理端和公司业务端原型。

How recognition works

  1. Scan the first 50 rows of every worksheet.
  2. Normalize whitespace and full-width characters in candidate headers.
  3. Match required header aliases against known bank template signatures.
  4. Map columns by header name, independent of their order.
  5. Normalize transaction dates, income, expense, balance, counterparty, and reference fields.
  6. Reject unknown or ambiguous templates instead of guessing.

The original Excel file is never modified.

Run

python -m pip install -r requirements.txt
$env:PYTHONPATH = "src"
python -m bank_importer.cli "流水模板"
python -m unittest discover -s tests -v
python server.py

访问地址:

  • 登录入口:http://127.0.0.1:4173/
  • 总账管理端:http://127.0.0.1:4173/admin.html
  • 公司业务端:http://127.0.0.1:4173/company.html

公司端上传会把所选工作簿提交到本地 /api/parse,与 CLI 使用同一个确定性表头解析器。当前前端是交互原型,公司、账号、期初、提醒和导入确认仅保存在当前浏览器页面中,尚未接入数据库和正式身份认证。

The CLI prints batch summaries only. It does not print sensitive transaction details.

S
Description
No description provided
Readme
3.7 MiB
Languages
Python 60.7%
JavaScript 17.4%
HTML 17.1%
CSS 4.8%