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:
@@ -1,6 +1,6 @@
|
||||
-- =============================================================================
|
||||
-- etl_feiqiu / app(RLS 视图层)
|
||||
-- 生成日期:2026-04-12
|
||||
-- 生成日期:2026-05-02
|
||||
-- 来源:测试库(通过脚本自动导出)
|
||||
-- =============================================================================
|
||||
|
||||
@@ -36,7 +36,8 @@ SELECT id,
|
||||
unique_customers,
|
||||
unique_tables,
|
||||
created_at
|
||||
FROM dws.dws_assistant_daily_detail d;
|
||||
FROM dws.dws_assistant_daily_detail d
|
||||
WHERE (stat_date <= app.business_date_now());
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_cfg_area_category AS
|
||||
@@ -61,7 +62,8 @@ SELECT price_id,
|
||||
description,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM dws.cfg_assistant_level_price;
|
||||
FROM dws.cfg_assistant_level_price
|
||||
WHERE ((effective_from <= app.business_date_now()) AND (effective_to >= app.business_date_now()));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_cfg_bonus_rules AS
|
||||
@@ -112,7 +114,8 @@ SELECT tier_id,
|
||||
description,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM dws.cfg_performance_tier;
|
||||
FROM dws.cfg_performance_tier
|
||||
WHERE ((effective_from <= app.business_date_now()) AND (effective_to >= app.business_date_now()));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dim_assistant AS
|
||||
@@ -301,7 +304,7 @@ SELECT assistant_service_id,
|
||||
is_delete,
|
||||
real_service_money
|
||||
FROM dwd.dwd_assistant_service_log
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint);
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (COALESCE((create_time)::date, '0001-01-01'::date) <= app.business_date_now()));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dwd_recharge_order AS
|
||||
@@ -330,7 +333,7 @@ SELECT recharge_order_id,
|
||||
real_electricity_money,
|
||||
electricity_adjust_money
|
||||
FROM dwd.dwd_recharge_order
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint);
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (COALESCE((pay_time)::date, '0001-01-01'::date) <= app.business_date_now()));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dwd_settlement_head AS
|
||||
@@ -372,7 +375,7 @@ SELECT order_settle_id,
|
||||
pl_coupon_sale_amount,
|
||||
mervou_sales_amount
|
||||
FROM dwd.dwd_settlement_head
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint);
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (COALESCE((create_time)::date, '0001-01-01'::date) <= app.business_date_now()));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dwd_store_goods_sale AS
|
||||
@@ -402,7 +405,7 @@ SELECT store_goods_sale_id,
|
||||
coupon_share_money,
|
||||
discount_price
|
||||
FROM dwd.dwd_store_goods_sale
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint);
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (COALESCE((create_time)::date, '0001-01-01'::date) <= app.business_date_now()));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dwd_table_fee_log AS
|
||||
@@ -436,7 +439,7 @@ SELECT table_fee_log_id,
|
||||
activity_discount_amount,
|
||||
real_service_money
|
||||
FROM dwd.dwd_table_fee_log
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint);
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (COALESCE((create_time)::date, '0001-01-01'::date) <= app.business_date_now()));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dws_assistant_customer_stats AS
|
||||
@@ -518,7 +521,7 @@ SELECT id,
|
||||
is_exempt,
|
||||
per_hour_contribution
|
||||
FROM dws.dws_assistant_daily_detail
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint);
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (stat_date <= app.business_date_now()));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dws_assistant_finance_analysis AS
|
||||
@@ -543,7 +546,7 @@ SELECT id,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM dws.dws_assistant_finance_analysis
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint);
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (stat_date <= app.business_date_now()));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dws_assistant_monthly_summary AS
|
||||
@@ -583,7 +586,7 @@ SELECT id,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM dws.dws_assistant_monthly_summary
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint);
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (stat_month <= (date_trunc('month'::text, (app.business_date_now())::timestamp with time zone))::date));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dws_assistant_order_contribution AS
|
||||
@@ -687,7 +690,7 @@ SELECT id,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM dws.dws_assistant_salary_calc
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint);
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (salary_month <= (date_trunc('month'::text, (app.business_date_now())::timestamp with time zone))::date));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dws_coach_area_hours AS
|
||||
@@ -746,9 +749,10 @@ SELECT id,
|
||||
renewal_cash,
|
||||
order_count,
|
||||
created_at,
|
||||
updated_at
|
||||
updated_at,
|
||||
member_order_count
|
||||
FROM dws.dws_finance_area_daily
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint);
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (stat_date <= app.business_date_now()));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dws_finance_board_cache AS
|
||||
@@ -822,7 +826,7 @@ SELECT id,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM dws.dws_finance_daily_summary
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint);
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (stat_date <= app.business_date_now()));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dws_finance_discount_detail AS
|
||||
@@ -839,7 +843,7 @@ SELECT id,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM dws.dws_finance_discount_detail
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint);
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (stat_date <= app.business_date_now()));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dws_finance_expense_summary AS
|
||||
@@ -860,7 +864,7 @@ SELECT id,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM dws.dws_finance_expense_summary
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint);
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (expense_month <= (date_trunc('month'::text, (app.business_date_now())::timestamp with time zone))::date));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dws_finance_income_structure AS
|
||||
@@ -878,7 +882,7 @@ SELECT id,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM dws.dws_finance_income_structure
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint);
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (stat_date <= app.business_date_now()));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dws_finance_recharge_summary AS
|
||||
@@ -912,7 +916,7 @@ SELECT id,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM dws.dws_finance_recharge_summary
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint);
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (stat_date <= app.business_date_now()));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dws_member_assistant_intimacy AS
|
||||
@@ -1033,7 +1037,7 @@ SELECT DISTINCT ON (member_id) id,
|
||||
recharge_amount_90d,
|
||||
avg_ticket_amount
|
||||
FROM dws.dws_member_consumption_summary
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint)
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (stat_date <= app.business_date_now()))
|
||||
ORDER BY member_id, stat_date DESC;
|
||||
;
|
||||
|
||||
@@ -1162,7 +1166,7 @@ SELECT id,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM dws.dws_member_visit_detail
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint);
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (visit_date <= app.business_date_now()));
|
||||
;
|
||||
|
||||
CREATE OR REPLACE VIEW app.v_dws_member_winback_index AS
|
||||
@@ -1204,7 +1208,7 @@ SELECT DISTINCT ON (member_id) winback_id,
|
||||
ideal_next_visit_date,
|
||||
stat_date
|
||||
FROM dws.dws_member_winback_index
|
||||
WHERE (site_id = (current_setting('app.current_site_id'::text))::bigint)
|
||||
WHERE ((site_id = (current_setting('app.current_site_id'::text))::bigint) AND (COALESCE((last_visit_time)::date, '0001-01-01'::date) <= app.business_date_now()))
|
||||
ORDER BY member_id, stat_date DESC;
|
||||
;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user