Files
docsify-jsonrpc/zh-cn/excel_output_process.md
2025-08-04 17:16:18 +08:00

31 lines
690 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 导出、导入任务
> 处理千万行数据必须分页、分块,避免内存溢出。
## 导出流程
---
### 1. 队列设计
系统整体导出分为以下流程:
- OpenSpout 流式写入(内存友好)
- 分页查询 + 生成器 Generator避免全量加载
- 进度推送SSE
- 协程上传 OSS
- GC 优化
- 清理临时文件
```mermaid
graph TD
A[用户点击导出] --> B[生成任务, 发送 AMQP 消息]
B --> C[AMQP Consumer 消费消息]
C --> D[加锁, 启动协程]
D --> E[立即返回 ACK]
C --> F[RabbitMQ 确认完成]
D --> G[协程执行 runExport]
G --> H[分页流式写入 Excel]
H --> I[上传 OSS]
I --> J[记录任务, 推送完成]
```