ai-coding
2026-08-20 ceabfcf368133ca651705f061557e8a22bb78cbe
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/** 日志来源模块 */
export type LogModule = 'CLOUD' | 'CDU' | 'XPU' | 'MINI_PROGRAM'
 
/** 日志级别 */
export type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'
 
/**
 * 模块级状态(与后端 status 枚举一致)
 * fetching = 车端日志拉取中(已提交拉取任务但日志尚不可取)
 * loading 为前端本地过渡态,不由后端返回
 */
export type ModuleStatus = 'success' | 'timeout' | 'error' | 'empty' | 'fetching' | 'loading'
 
/**
 * 查询记录状态(与后端 wire 值一致)
 * fetching=拉取中 / partial=部分完成(车端待回填) / completed=已完成
 */
export type RecordStatus = 'fetching' | 'partial' | 'completed'
 
/** 查询维度:1=订单号 2=VIN 3=小程序上传(自动生成) */
export type QueryType = 1 | 2 | 3
 
/** 异常标注 */
export interface AnnotationInfo {
  /** 异常模式,如"指令超时"、"状态不匹配" */
  pattern: string
  /** 推荐排查方向 */
  suggestion: string
}
 
/** 单条日志(时间线的一行,带来源标签 module) */
export interface LogEntry {
  /** 唯一ID */
  id: string
  /** ISO 8601 时间戳 */
  timestamp: string
  level: LogLevel
  /** 来源模块(时间线上作为来源标签展示) */
  module: LogModule
  /** 来源服务名 */
  source: string
  /** 日志内容摘要 */
  content: string
  /** 完整日志原文 */
  fullContent: string
  traceId?: string
  spanId?: string
  annotation?: AnnotationInfo
}
 
/** 四路状态摘要(列表页与详情页共用) */
export interface ModuleStatusSummary {
  module: LogModule
  status: ModuleStatus
  count: number
}
 
/** 订单信息(订单号维度查询时返回) */
export interface OrderInfo {
  orderNumber: string
  orderId: string
  vin: string
  plateNumber: string
  status: number
  statusDesc: string
  createTime: string
  appUserId: string
}
 
/** 车辆概要(VIN查询时返回) */
export interface VehicleSummary {
  vin: string
  plateNumber: string
  relatedOrderCount: number
  logTimeRange: { start: string; end: string }
}
 
/** 关联订单(VIN查询时返回) */
export interface RelatedOrder {
  orderNumber: string
  orderTime: string
  status: number
  statusDesc: string
  hasAnomaly: boolean
}
 
// ──────────────── 新建排查任务 POST /orderLog/query ────────────────
 
/** 新建排查任务请求 */
export interface CreateTaskParams {
  orderNumber: string
  vin: string
  timeRange: [number, number] | null
  /** 拉取来源多选,不选的路不拉取(直接减少车端下载/解压/落库开销) */
  modules: LogModule[]
  /** 关键字:随任务记录留存,作为详情页展示筛选的预填条件;不收缩拉取范围(落全量) */
  keyword: string
}
 
/** 新建排查任务响应 */
export interface CreateTaskResult {
  recordId: number
  /** 后端当前仅返回 recordId,status 可选 */
  status?: RecordStatus
}
 
// ──────────────── 查询记录列表 GET /orderLog/records ────────────────
 
/** 列表筛选参数 */
export interface RecordListParams {
  operator: string
  orderNumber: string
  vin: string
  queryType: QueryType | null
  timeRange: [number, number] | null
  page: number
  size: number
}
 
/** 列表项 */
export interface QueryRecord {
  recordId: number
  queryType: QueryType
  queryTypeDesc: string
  orderNumber: string
  vin: string
  queryStartTime: string
  queryEndTime: string
  operator: string
  /** 查询时间 */
  createTime: string
  status: RecordStatus
  statusDesc: string
  /** 四路状态摘要,用于区分同一订单的多条记录 */
  moduleStatus: ModuleStatusSummary[]
  totalCount: number
  hasError: boolean
}
 
/** 列表响应 */
export interface RecordListResult {
  records: QueryRecord[]
  page: number
  size: number
  total: number
}
 
// ──────────────── 记录详情 GET /orderLog/records/{recordId} ────────────────
 
/** 详情展示筛选参数(仅过滤已落库明细,不触发重新拉取) */
export interface DetailFilterParams {
  levels: LogLevel[]
  modules: LogModule[]
  keyword: string
  page: number
  size: number
}
 
/** 详情响应 */
export interface RecordDetailResult {
  recordId: number
  status: RecordStatus
  orderInfo: OrderInfo | null
  /** 新建时选中的来源(详情页模块筛选只在此范围内) */
  queryModules: LogModule[]
  /** 新建时填的关键字(详情页关键字筛选预填值) */
  keyword: string
  /** 四路状态与条数概览(含车端 fetching 提示) */
  moduleStatus: ModuleStatusSummary[]
  /** 统一时间线(按 timestamp 排序,每行带 module 来源标签) */
  entries: LogEntry[]
  page: number
  size: number
  total: number
  vehicleSummary?: VehicleSummary
  relatedOrders?: RelatedOrder[]
}
 
/** 分页状态 */
export interface PaginationState {
  page: number
  pageSize: number
}