feat: 累积功能变更 — 聊天集成、租户管理、小程序更新、ETL 增强、迁移脚本

包含多个会话的累积代码变更:
- backend: AI 聊天服务、触发器调度、认证增强、WebSocket、调度器最小间隔
- admin-web: ETL 状态页、任务管理、调度配置、登录优化
- miniprogram: 看板页面、聊天集成、UI 组件、导航更新
- etl: DWS 新任务(finance_area_daily/board_cache)、连接器增强
- tenant-admin: 项目初始化
- db: 19 个迁移脚本(etl_feiqiu 11 + zqyy_app 8)
- packages/shared: 枚举和工具函数更新
- tools: 数据库工具、报表生成、健康检查
- docs: PRD/架构/部署/合约文档更新

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Neo
2026-04-06 00:03:48 +08:00
parent 70324d8542
commit 6f8f12314f
515 changed files with 76604 additions and 7456 deletions

View File

@@ -0,0 +1,83 @@
# -*- coding: utf-8 -*-
"""
在 zqyy_app 和 test_zqyy_app 中执行 FDW 配置。
- zqyy_app -> setup_fdw.sql (指向 etl_feiqiu)
- test_zqyy_app -> setup_fdw_test.sql (指向 test_etl_feiqiu)
"""
import os
import psycopg2
CONN = dict(host="100.64.0.4", port=5432, user="local-Python", password="Neo-local-1991125")
BASE = r"C:\NeoZQYY"
# 实际密码替换占位符 '***'
APP_READER_PWD = "AppR3ad_2026!"
TARGETS = [
("zqyy_app", os.path.join(BASE, "db", "fdw", "setup_fdw.sql")),
("test_zqyy_app", os.path.join(BASE, "db", "fdw", "setup_fdw_test.sql")),
]
for dbname, sql_path in TARGETS:
print(f"\n{'='*60}")
print(f"执行 FDW 配置: {dbname} <- {os.path.basename(sql_path)}")
print(f"{'='*60}")
sql = open(sql_path, encoding="utf-8").read()
# 替换密码占位符
sql = sql.replace("password '***'", f"password '{APP_READER_PWD}'")
conn = psycopg2.connect(**CONN, dbname=dbname)
conn.autocommit = True
cur = conn.cursor()
# 逐条执行(按分号拆分,跳过注释和空行)
statements = []
current = []
for line in sql.split("\n"):
stripped = line.strip()
if stripped.startswith("--") or not stripped:
continue
current.append(line)
if stripped.endswith(";"):
statements.append("\n".join(current))
current = []
success = 0
skip = 0
fail = 0
for stmt in statements:
try:
cur.execute(stmt)
first_line = stmt.strip().split("\n")[0][:80]
print(f" [OK] {first_line}")
success += 1
except psycopg2.errors.DuplicateObject as e:
conn.rollback()
print(f" [SKIP] 已存在: {str(e).strip().split(chr(10))[0]}")
skip += 1
except Exception as e:
conn.rollback()
print(f" [FAIL] {str(e).strip().split(chr(10))[0]}")
print(f" SQL: {stmt[:100]}")
fail += 1
# 验证
cur.execute("SELECT 1 FROM pg_extension WHERE extname = 'postgres_fdw'")
fdw_ext = cur.fetchone() is not None
cur.execute("SELECT srvname FROM pg_foreign_server")
servers = [r[0] for r in cur.fetchall()]
cur.execute(
"SELECT count(*) FROM information_schema.tables "
"WHERE table_schema = 'fdw_etl'"
)
fdw_tables = cur.fetchone()[0]
print(f"\n 结果: {success} OK, {skip} SKIP, {fail} FAIL")
print(f" 验证: fdw扩展={fdw_ext}, servers={servers}, fdw_etl表数={fdw_tables}")
conn.close()
print("\n完成!")