在前后端开发联调前 的提交20260223

This commit is contained in:
Neo
2026-02-23 23:02:20 +08:00
parent 254ccb1e77
commit fafc95e64c
1142 changed files with 10366960 additions and 36957 deletions

View File

@@ -0,0 +1,185 @@
- [P20260222-225157] 2026-02-22 22:51:57 +0800
- summary: CONTEXT TRANSFER: We are continuing a conversation that had gotten too long. Here is a summary: --- ## TASK 1: Database …
- prompt:
```text
CONTEXT TRANSFER: We are continuing a conversation that had gotten too long. Here is a summary:
---
## TASK 1: Database DDL Consolidation — Per-Schema Split
**STATUS**: done
**USER QUERIES**: 1 ("审查任务查库现在数据库以数据库现状为准对db目录下的各个sql文件整合输出一套最全的DDL"), 2 ("再单独输出各Schema的文件替换当前DDL")
**DETAILS**:
- Generated 8 per-schema DDL files in `docs/database/ddl/` from test databases
- Script uses `TEST_DB_DSN` / `TEST_APP_DB_DSN` from `.env`
**FILEPATHS**:
- `scripts/ops/gen_consolidated_ddl.py` — generation script
- `docs/database/ddl/` — 8 output DDL files
---
## TASK 2: Archive Old DDL Baseline Files
**STATUS**: done
**USER QUERIES**: 3
**DETAILS**:
- Archived 12 old baseline DDL files to `db/_archived/ddl_baseline_2026-02-22/`
**FILEPATHS**:
- `scripts/ops/_archive_old_ddl.py`
- `db/_archived/ddl_baseline_2026-02-22/`
---
## TASK 3: Archive Migration Scripts + Outdated Change Docs
**STATUS**: done
**USER QUERIES**: 4, 5
**DETAILS**:
- Archived 29 migration SQL files + 9 migration change docs
- Created/updated README files
**FILEPATHS**:
- `scripts/ops/_archive_phase2.py`
- `db/README.md`, `db/etl_feiqiu/README.md`, `docs/database/README.md`
---
## TASK 4: Archive ETL Module's Outdated Database Docs
**STATUS**: done
**USER QUERIES**: 6, 7
**DETAILS**:
- Archived 15 outdated files to `apps/etl/connectors/feiqiu/docs/database/_archived/`
**FILEPATHS**:
- `scripts/ops/_archive_etl_db_docs.py`
- `apps/etl/connectors/feiqiu/docs/database/README.md`
---
## TASK 5: Update Retained BD_Manual Docs & All Active Docs to Current State
**STATUS**: in-progress
**USER QUERIES**: 8 ("保留的这些内容,也有过时的信息,帮我更新到现状版本。")
**DETAILS**:
### Part A: Path reference fixes (DONE)
- Ran `scripts/ops/_fix_bd_manual_refs.py` — fixed 7 files, 9 replacements in `docs/database/` BD_Manual files
### Part B: ETL module docs path updates (DONE)
- Updated 6 ETL module docs files with new DDL paths
### Part C: BD_Manual field-level accuracy (IN PROGRESS)
- Created verification script `scripts/ops/_verify_bd_manual_fields.py` that compares doc columns vs DB columns
- Ran the script and got a complete diff report for all 9 remaining BD_Manual files
**Files fully verified and accurate (no changes needed):**
- `BD_Manual_assistant_accounts_master.md` — dim_assistant 19 cols ✓, dim_assistant_ex 52 cols ✓
- `BD_Manual_tenant_goods_master.md` — fully updated in previous session
- `BD_Manual_goods_stock_movements.md` — 20 cols ✓ (exact match)
- `BD_Manual_goods_stock_summary.md` — 17 cols ✓ (exact match)
- `BD_Manual_dws_goods_stock_summary.md` — 20 cols ✓ (DWS tables match, parser didn't match table name but manual verification confirms correct)
**Files updated in THIS session:**
- `BD_Manual_recharge_settlements.md` — removed spurious `fetched_at` from `dwd_recharge_order` (DB has 24 cols, no fetched_at). `dwd_recharge_order_ex` 43 cols ✓ exact match.
- `BD_Manual_site_tables_master.md` — `dim_table`: removed `table_status`/`table_type`/`tenant_id` (not in DB), added `site_table_area_id`. `dim_table_ex`: added `is_online_reservation`/`table_cloth_use_cycle`/`table_status`, fixed `table_cloth_use_time` type from TIMESTAMPTZ to INTEGER.
- `BD_Manual_store_goods_master.md` — `dim_store_goods`: removed `goods_unit`/`goods_price`/`purchase_price`/`goods_category_second_id`, added `goods_second_category_id`/`sale_price`/`goods_state`/`enable_status`/`send_state`/`is_delete`, fixed types. `dim_store_goods_ex`: expanded from 14 to 28 cols, added 14 missing columns (unit, pinyin_initial, cost_price, cost_price_type, total_purchase_cost, min_discount_price, audit_status, sale_channel, is_warehousing, forbid_sell_status, able_site_transfer, custom_label_type, option_required, batch_stock_quantity).
### Part D: Steering file `tech.md` update (DONE)
- Updated `.kiro/steering/tech.md` DDL path references from old `db/etl_feiqiu/schemas/` to new `docs/database/ddl/`
**NEXT STEPS — Files still needing field-level updates:**
1. **`docs/database/BD_Manual_member_balance_changes.md`** — `dwd_member_balance_change`: remove `fetched_at`/`member_id` (not in DB), add `card_type_id`, `is_delete`, `payment_method`, `principal_change_amount`, `register_site_id`, `remark`, `system_member_id`, `tenant_member_id`. `dwd_member_balance_change_ex`: add `operator_id`, `operator_name`, `refund_amount`.
2. **`docs/database/BD_Manual_assistant_service_records.md`** — MAJOR REWRITE NEEDED. `dwd_assistant_service_log`: doc has 21 cols, DB has 33 cols. Doc has 10 wrong columns (`table_id`→`site_table_id`, `member_id`→`tenant_member_id`+`system_member_id`, `charge_minutes`→doesn't exist, `start_time`/`end_time`→`start_use_time`/`last_use_time`, `status`→doesn't exist, `service_money`/`is_trash`/`fetched_at`→not in main table). Missing 22 DB columns. `dwd_assistant_service_log_ex`: doc has 10 cols, DB has 33 cols — missing 23 columns.
3. **`docs/database/BD_Manual_store_goods_sales_records.md`** — MAJOR REWRITE NEEDED. `dwd_store_goods_sale`: doc has 16 cols, DB has 25 cols. Doc has 6 wrong columns (`goods_name`/`goods_num`/`goods_price`/`goods_money`/`member_id`/`fetched_at` not in DB). Missing 15 DB columns. `dwd_store_goods_sale_ex`: doc has 8 cols, DB has 28 cols — missing 20 columns.
**DB column data already collected** — the verification script output and the large `information_schema.columns` query result from the MCP tool contain all needed column info. Key reference:
For `dwd_assistant_service_log` (33 cols): assistant_service_id, order_trade_no, order_settle_id, order_pay_id, order_assistant_id, order_assistant_type, tenant_id, site_id, site_table_id, tenant_member_id, system_member_id, assistant_no, nickname, site_assistant_id, user_id, assistant_team_id, person_org_id, assistant_level, level_name, skill_id, skill_name, ledger_unit_price, ledger_amount, projected_income, coupon_deduct_money, income_seconds, real_use_seconds, add_clock, create_time, start_use_time, last_use_time, is_delete, real_service_money
For `dwd_assistant_service_log_ex` (33 cols): assistant_service_id, table_name, assistant_name, ledger_name, ledger_group_name, ledger_count, member_discount_amount, manual_discount_amount, service_money, returns_clock, ledger_start_time, ledger_end_time, ledger_status, is_confirm, is_single_order, is_not_responding, is_trash, trash_applicant_id, trash_applicant_name, trash_reason, salesman_user_id, salesman_name, salesman_org_id, skill_grade, service_grade, composite_grade, sum_grade, get_grade_times, grade_status, composite_grade_time, assistant_team_name, operator_id, operator_name
For `dwd_store_goods_sale` (25 cols): store_goods_sale_id, order_trade_no, order_settle_id, order_pay_id, order_goods_id, site_id, tenant_id, site_goods_id, tenant_goods_id, tenant_goods_category_id, tenant_goods_business_id, site_table_id, ledger_name, ledger_group_name, ledger_unit_price, ledger_count, ledger_amount, discount_money, real_goods_money, cost_money, ledger_status, is_delete, create_time, coupon_share_money, discount_price
For `dwd_store_goods_sale_ex` (28 cols): store_goods_sale_id, legacy_order_goods_id, site_name, legacy_site_id, goods_remark, option_value_name, operator_name, open_salesman_flag, salesman_user_id, salesman_name, salesman_role_id, salesman_org_id, discount_money, returns_number, coupon_deduct_money, member_discount_amount, point_discount_money, point_discount_money_cost, package_coupon_id, order_coupon_id, member_coupon_id, option_price, option_member_discount_money, option_coupon_deduct_money, push_money, is_single_order, sales_type, operator_id
For `dwd_member_balance_change` (22 cols): balance_change_id, tenant_id, site_id, register_site_id, tenant_member_id, system_member_id, tenant_member_card_id, card_type_id, card_type_name, member_name, member_mobile, balance_before, change_amount, balance_after, from_type, payment_method, change_time, is_delete, remark, principal_before, principal_after, principal_change_amount
For `dwd_member_balance_change_ex` (8 cols): balance_change_id, pay_site_name, register_site_name, refund_amount, operator_id, operator_name, principal_data, relate_id
**FACT_MAPPINGS reference** — fully read from `apps/etl/connectors/feiqiu/tasks/dwd/dwd_load_task.py` lines 17-622. Key mappings for remaining files:
- `dwd.dwd_assistant_service_log`: 6 explicit mappings (assistant_service_id←id, assistant_no←assistantno, site_assistant_id←site_assistant_id, level_name←levelname, skill_name←skillname, real_service_money←real_service_money). All other cols are auto-mapped (DWD col = ODS col).
- `dwd.dwd_assistant_service_log_ex`: 10 explicit mappings (assistant_service_id←id, assistant_name←assistantname, ledger_group_name, trash_applicant_name, trash_reason, salesman_name, table_name←tablename, assistant_team_name←assistantteamname, operator_id, operator_name). Rest auto-mapped.
- `dwd.dwd_store_goods_sale`: 4 explicit (store_goods_sale_id←id, discount_money←discount_money, discount_price←discount_price, coupon_share_money). Rest auto-mapped.
- `dwd.dwd_store_goods_sale_ex`: 8 explicit (store_goods_sale_id←id, option_value_name, open_salesman_flag←opensalesman cast integer, salesman_name, salesman_org_id←sales_man_org_id, legacy_order_goods_id←ordergoodsid, site_name←sitename, legacy_site_id←siteid). Rest auto-mapped.
- `dwd.dwd_member_balance_change`: 11 explicit (balance_change_id←id, balance_before←before, change_amount←account_data, balance_after←after, card_type_name←membercardtypename, change_time←create_time, member_name←membername, member_mobile←membermobile, principal_before, principal_after, principal_change_amount←computed). Rest auto-mapped.
- `dwd.dwd_member_balance_change_ex`: 5 explicit (balance_change_id←id, pay_site_name←paysitename, register_site_name←registersitename, principal_data, relate_id).
**FILEPATHS**:
- `scripts/ops/_verify_bd_manual_fields.py` — verification script (already run, can re-run)
- `scripts/ops/_fix_bd_manual_refs.py` — batch path fix script (already run)
- `docs/database/BD_Manual_recharge_settlements.md` — updated this session
- `docs/database/BD_Manual_site_tables_master.md` — updated this session
- `docs/database/BD_Manual_store_goods_master.md` — updated this session
- `docs/database/BD_Manual_member_balance_changes.md` — needs field update
- `docs/database/BD_Manual_assistant_service_records.md` — needs major rewrite
- `docs/database/BD_Manual_store_goods_sales_records.md` — needs major rewrite
- `.kiro/steering/tech.md` — updated this session
- `apps/etl/connectors/feiqiu/tasks/dwd/dwd_load_task.py` — FACT_MAPPINGS reference (lines 130-622)
---
## USER CORRECTIONS AND INSTRUCTIONS:
- 以数据库现状为准 (database reality takes precedence over SQL files)
- Language: Chinese for documentation/comments, English for code identifiers
- `docs/database/` files are project documentation (DDL baseline), NOT runtime output — lives in `docs/` not `export/`
- `export-paths.md` applies to runtime outputs only
- Database connections must use test databases via `TEST_DB_DSN` / `TEST_APP_DB_DSN`
- Prefer Python scripts over complex PowerShell (per tech.md)
- Scripts go in `scripts/ops/` (one-off ops scripts)
- MCP tools: `mcp_pg_etl_test_execute_sql` (for test_etl_feiqiu) and `mcp_pg_app_test_execute_sql` (for test_zqyy_app)
- Audit reminder is pending — user should trigger `/audit` when ready
- For field-level verification: query DB columns with `information_schema.columns`, compare against FACT_MAPPINGS in `dwd_load_task.py`, and check both explicit mappings and auto-mapped columns (where DWD col name = ODS col name)
- Code default paths like `database/schema_ODS_doc.sql` in utility task configs are code-level defaults that still exist in Python source — document them with ⚠️ warnings but don't pretend they've been changed in code
- Low priority remaining docs (historical, don't modify): `docs/migrate/monorepo-migration-summary.md`, `apps/etl/connectors/feiqiu/docs/CHANGELOG.md`, `docs/audit/` files
## Files to read:
- `docs/database/BD_Manual_member_balance_changes.md` — next file to update (smallest remaining diff)
- `docs/database/BD_Manual_assistant_service_records.md` — needs major rewrite
- `docs/database/BD_Manual_store_goods_sales_records.md` — needs major rewrite
- `apps/etl/connectors/feiqiu/tasks/dwd/dwd_load_task.py` — FACT_MAPPINGS reference (read lines 130-622 for all mapping definitions)
- `scripts/ops/_verify_bd_manual_fields.py` — can re-run to verify after updates
USER QUERIES(most recent first):
1. Output:
Command executed successfully with no output.
Exit Code: 0
2. Output:
Command executed successfully with no output.
Exit Code: 0
---
METADATA:
The previous conversation had 2 messages.
INSTRUCTIONS:
Continue working until the user query has been fully addressed. Do not ask for clarification - proceed with the work based on the context provided.
IMPORTANT: you need to read from the files to Read section
```