feat: 2026-04-15~05-02 累积变更基线 — AI 重构 + Runtime Context + DWS 修复
涵盖(每条对应已存的审计记录): - AI 模块拆分:apps/backend/app/ai/apps -> prompts/(8 个 APP + app2a 派生) audit: 2026-04-20__ai-module-complete.md - admin-web AI 管理套件:AIDashboard / AIOperations / AIRunLogs / AITriggers / TriggerManager audit: 2026-04-21__admin-web-ai-management-suite.md - App2 财务洞察 prompt v3 -> v5.1 + 小程序 AI 接入(chat / board-finance) audit: 2026-04-22__app2_prompt_v5_1_and_miniprogram_ai_insight.md - App2 prewarm 全过滤器 + AI 触发器 cron reschedule audit: 2026-04-21__app2-finance-prewarm-all-filters.md migration: 20260420_ai_trigger_jobs_and_app2_prewarm.sql / 20260421_app2_prewarm_cron_reschedule.sql - AppType 联合类型对齐 + adminAiAppTypes.test.ts audit: 2026-04-30__admin_web_ai_app_type_alignment.md - DashScope tokens_used 提取修复 audit: 2026-04-30__backend_dashscope_tokens_used_extraction.md - App3 线索完整详情 prompt audit: 2026-05-01__backend_app3_full_detail_prompt.md - Runtime Context 沙箱(5-1~5-2 主线): - 后端 schema/service + admin_runtime_context / xcx_runtime_clock 两个 router - admin-web RuntimeContext.tsx + miniprogram runtime-clock.ts - migration: 20260501__runtime_context_sandbox.sql - tools/db/verify_admin_web_sandbox.py + verify_sandbox_end_to_end.py - database/changes: 7 份 sandbox_* 验证报告 - 飞球 DWS 修复:finance_area_daily 区域汇总 + task_engine 调整 + RLS 视图业务日上界(migration 20260502 + scripts/ops/gen_rls_business_date_migration.py) 合规: - .gitignore 启用 tmp/ 排除 - 不入仓:apps/etl/connectors/feiqiu/.env(API_TOKEN secret,本地修改保留) 待验证清单: - docs/audit/changes/2026-05-04__cumulative_baseline_pending_verification.md 每个主题的功能完整性 / 上线验证几乎都未收口,按优先级 P0~P3 逐一处理
This commit is contained in:
@@ -352,7 +352,9 @@ def _text_board_finance(
|
||||
"SET LOCAL statement_timeout = %s",
|
||||
(f"{FDW_QUERY_TIMEOUT_SEC * 1000}",),
|
||||
)
|
||||
# 简化查询:获取汇总数据
|
||||
# 简化查询:获取汇总数据(CHANGE 2026-05-02 | 用 business_date 替代 CURRENT_DATE)
|
||||
from app.services.runtime_context import as_runtime_today_param
|
||||
_ref_date = as_runtime_today_param(site_id)
|
||||
cur.execute(
|
||||
"""
|
||||
SELECT
|
||||
@@ -361,8 +363,10 @@ def _text_board_finance(
|
||||
COALESCE(AVG(items_sum), 0) AS avg_revenue
|
||||
FROM app.v_dwd_settlement_head
|
||||
WHERE settle_type IN (1, 3)
|
||||
AND settle_date >= (CURRENT_DATE - INTERVAL '1 month')
|
||||
AND settle_date >= (%s::date - INTERVAL '1 month')
|
||||
AND settle_date <= %s::date
|
||||
""",
|
||||
(_ref_date, _ref_date),
|
||||
)
|
||||
row = cur.fetchone()
|
||||
etl_conn.commit()
|
||||
@@ -399,7 +403,9 @@ def _text_board_customer(
|
||||
"SET LOCAL statement_timeout = %s",
|
||||
(f"{FDW_QUERY_TIMEOUT_SEC * 1000}",),
|
||||
)
|
||||
# Top 10 客户
|
||||
# Top 10 客户(CHANGE 2026-05-02 | 用 business_date 替代 CURRENT_DATE)
|
||||
from app.services.runtime_context import as_runtime_today_param
|
||||
_ref_date = as_runtime_today_param(site_id)
|
||||
cur.execute(
|
||||
"""
|
||||
SELECT
|
||||
@@ -410,11 +416,13 @@ def _text_board_customer(
|
||||
ON dm.member_id = sh.member_id AND dm.scd2_is_current = 1
|
||||
WHERE sh.settle_type IN (1, 3)
|
||||
AND sh.member_id > 0
|
||||
AND sh.settle_date >= (CURRENT_DATE - INTERVAL '1 month')
|
||||
AND sh.settle_date >= (%s::date - INTERVAL '1 month')
|
||||
AND sh.settle_date <= %s::date
|
||||
GROUP BY dm.nickname
|
||||
ORDER BY total_consumption DESC
|
||||
LIMIT 10
|
||||
""",
|
||||
(_ref_date, _ref_date),
|
||||
)
|
||||
rows = cur.fetchall()
|
||||
etl_conn.commit()
|
||||
@@ -452,6 +460,9 @@ def _text_board_coach(
|
||||
"SET LOCAL statement_timeout = %s",
|
||||
(f"{FDW_QUERY_TIMEOUT_SEC * 1000}",),
|
||||
)
|
||||
# CHANGE 2026-05-02 | 用 business_date 替代 CURRENT_DATE
|
||||
from app.services.runtime_context import as_runtime_today_param
|
||||
_ref_date = as_runtime_today_param(site_id)
|
||||
cur.execute(
|
||||
"""
|
||||
SELECT
|
||||
@@ -462,11 +473,13 @@ def _text_board_coach(
|
||||
JOIN app.v_dim_assistant da
|
||||
ON da.assistant_id = sl.site_assistant_id
|
||||
WHERE sl.is_delete = 0
|
||||
AND sl.create_time >= (CURRENT_DATE - INTERVAL '1 month')
|
||||
AND sl.create_time >= (%s::date - INTERVAL '1 month')
|
||||
AND sl.create_time < (%s::date + INTERVAL '1 day')
|
||||
GROUP BY da.nickname
|
||||
ORDER BY service_count DESC
|
||||
LIMIT 10
|
||||
""",
|
||||
(_ref_date, _ref_date),
|
||||
)
|
||||
rows = cur.fetchall()
|
||||
etl_conn.commit()
|
||||
@@ -590,6 +603,9 @@ def _text_customer_service_records(
|
||||
"SET LOCAL statement_timeout = %s",
|
||||
(f"{FDW_QUERY_TIMEOUT_SEC * 1000}",),
|
||||
)
|
||||
# CHANGE 2026-05-02 | 仅取业务日及之前的服务记录,沙箱不读「未来」
|
||||
from app.services.runtime_context import as_runtime_today_param
|
||||
_ref_date = as_runtime_today_param(site_id)
|
||||
cur.execute(
|
||||
"""
|
||||
SELECT
|
||||
@@ -599,10 +615,11 @@ def _text_customer_service_records(
|
||||
site_table_id
|
||||
FROM app.v_dwd_assistant_service_log
|
||||
WHERE tenant_member_id = %s AND is_delete = 0
|
||||
AND create_time < (%s::date + INTERVAL '1 day')
|
||||
ORDER BY create_time DESC
|
||||
LIMIT 10
|
||||
""",
|
||||
(member_id,),
|
||||
(member_id, _ref_date),
|
||||
)
|
||||
rows = cur.fetchall()
|
||||
etl_conn.commit()
|
||||
|
||||
Reference in New Issue
Block a user