v8_analysis_report.sql
2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
-- v8_analysis_report.sql
-- 分析报告表,支持按品牌组合分组的分析数据持久化
-- 分析内容由 LLM 生成
CREATE TABLE IF NOT EXISTS ai_analysis_report (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
task_no VARCHAR(32) NOT NULL COMMENT '任务编号',
group_id BIGINT NOT NULL COMMENT '集团ID',
dealer_grouping_id BIGINT NOT NULL COMMENT '商家组合ID',
brand_grouping_id BIGINT DEFAULT NULL COMMENT '品牌组合ID,NULL表示全部品牌',
brand_grouping_name VARCHAR(256) DEFAULT NULL COMMENT '品牌组合名称',
-- 风险管控统计(数量)
total_count INT DEFAULT 0 COMMENT '配件总数',
shortage_count INT DEFAULT 0 COMMENT '缺货数量',
overstock_count INT DEFAULT 0 COMMENT '超标数量',
normal_count INT DEFAULT 0 COMMENT '正常数量',
low_frequency_count INT DEFAULT 0 COMMENT '低频数量',
stagnant_count INT DEFAULT 0 COMMENT '呆滞数量',
-- 风险管控统计(金额)
total_amount DECIMAL(16,2) DEFAULT 0 COMMENT '总金额',
shortage_amount DECIMAL(16,2) DEFAULT 0 COMMENT '缺货金额',
overstock_amount DECIMAL(16,2) DEFAULT 0 COMMENT '超标金额',
normal_amount DECIMAL(16,2) DEFAULT 0 COMMENT '正常金额',
low_frequency_amount DECIMAL(16,2) DEFAULT 0 COMMENT '低频金额',
stagnant_amount DECIMAL(16,2) DEFAULT 0 COMMENT '呆滞金额',
-- LLM 生成的分析内容
overview_analysis TEXT COMMENT '核心经营综述(LLM生成)',
risk_analysis TEXT COMMENT '风险管控分析(LLM生成)',
action_plan TEXT COMMENT '行动计划分析(LLM生成)',
report_content JSON COMMENT '结构化报告内容',
llm_provider VARCHAR(32) COMMENT 'LLM提供商',
llm_model VARCHAR(64) COMMENT 'LLM模型名称',
generation_tokens INT DEFAULT 0 COMMENT '生成token数',
statistics_date VARCHAR(16) COMMENT '统计日期',
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
INDEX idx_task_no (task_no),
INDEX idx_task_brand (task_no, brand_grouping_id),
INDEX idx_dealer_grouping (dealer_grouping_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='AI分析报告表';