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

@@ -47,7 +47,7 @@ import { useNavigate } from "react-router-dom";
import TaskSelector from "../components/TaskSelector";
import { validateTaskConfig, fetchFlows } from "../api/tasks";
import type { FlowDef, ProcessingModeDef } from "../api/tasks";
import { submitToQueue, executeDirectly } from "../api/execution";
import { submitToQueue, executeDirectly, cleanupOutput } from "../api/execution";
import { createSchedule } from "../api/schedules";
import { useAuthStore } from "../store/authStore";
import BusinessDayHint from "../components/BusinessDayHint";
@@ -55,6 +55,7 @@ import type { RadioChangeEvent } from "antd";
import type { Dayjs } from "dayjs";
import dayjs from "dayjs";
import type { TaskConfig as TaskConfigType, ScheduleConfig } from "../types";
import type { MinRunIntervalItem } from "../types";
const { Title, Text } = Typography;
const { TextArea } = Input;
@@ -228,6 +229,7 @@ const TaskConfig: React.FC = () => {
/* ---------- 任务选择 ---------- */
const [selectedTasks, setSelectedTasks] = useState<string[]>([]);
const [selectedDwdTables, setSelectedDwdTables] = useState<string[]>([]);
const [taskIntervals, setTaskIntervals] = useState<Record<string, MinRunIntervalItem>>({});
/* ---------- 高级选项 ---------- */
const [dryRun, setDryRun] = useState(false);
@@ -320,12 +322,26 @@ const TaskConfig: React.FC = () => {
/* ---------- 事件处理 ---------- */
const handleFlowChange = (e: RadioChangeEvent) => setFlow(e.target.value);
// CHANGE 2026-03-27 | 包含 ODS 层的 flow 执行前清理输出目录,每类任务只保留最近 10 个运行记录
const tryCleanupOutput = async () => {
if (!layers.includes("ODS")) return;
try {
const result = await cleanupOutput();
if (result.dirs_deleted > 0) {
message.info(`已清理 ${result.dirs_deleted} 个旧运行记录`);
}
} catch {
message.warning("输出目录清理失败,不影响任务执行");
}
};
const handleSubmitToQueue = async () => {
setSubmitting(true);
try {
await tryCleanupOutput();
await submitToQueue(buildTaskConfig());
message.success("已提交到执行队列");
navigate("/task-manager");
navigate("/etl-tasks?tab=queue");
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : "提交失败";
message.error(`提交到队列失败:${msg}`);
@@ -334,12 +350,14 @@ const TaskConfig: React.FC = () => {
}
};
// CHANGE 2026-03-27 | 直接执行后跳转历史 tab 并自动打开任务详情
const handleExecuteDirectly = async () => {
setSubmitting(true);
try {
await executeDirectly(buildTaskConfig());
await tryCleanupOutput();
const { execution_id } = await executeDirectly(buildTaskConfig());
message.success("任务已开始执行");
navigate("/task-manager");
navigate(`/etl-tasks?tab=history&openExecution=${execution_id}`);
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : "执行失败";
message.error(`直接执行失败:${msg}`);
@@ -399,6 +417,7 @@ const TaskConfig: React.FC = () => {
task_config: taskConfig,
schedule_config: scheduleConfig,
run_immediately: !!values.run_immediately,
min_run_intervals: Object.keys(taskIntervals).length > 0 ? taskIntervals : undefined,
});
message.success("调度任务已创建");
setScheduleModalOpen(false);
@@ -681,13 +700,15 @@ const TaskConfig: React.FC = () => {
</Card>
{/* ---- 任务选择(含 DWD 表过滤) ---- */}
<Card size="small" title="任务选择" style={cardStyle}>
<Card size="small" title={<Space size={8}><Text type="secondary" style={{ fontSize: 11, fontWeight: 400 }}></Text></Space>} style={cardStyle}>
<TaskSelector
layers={layers}
selectedTasks={selectedTasks}
onTasksChange={setSelectedTasks}
selectedDwdTables={selectedDwdTables}
onDwdTablesChange={setSelectedDwdTables}
taskIntervals={taskIntervals}
onTaskIntervalsChange={setTaskIntervals}
/>
</Card>