feat(dc/tool-c): Day 2 - Session管理与数据处理完成

核心功能:
- 数据库: 创建dc_tool_c_sessions表 (12字段, 3索引)
- 服务层: SessionService (383行), DataProcessService (303行)
- 控制器: SessionController (300行, 6个API端点)
- 路由: 新增6个Session管理路由
- 测试: 7个API测试全部通过 (100%)

技术亮点:
- 零落盘架构: Excel内存解析, OSS存储
- Session管理: 10分钟过期, 心跳延长机制
- 云原生规范: storage/logger/prisma全平台复用
- 完整测试: 上传/预览/完整数据/删除/心跳

文件清单:
- backend/prisma/schema.prisma (新增DcToolCSession模型)
- backend/prisma/migrations/create_tool_c_session.sql
- backend/scripts/create-tool-c-table.mjs
- backend/src/modules/dc/tool-c/services/ (SessionService, DataProcessService)
- backend/src/modules/dc/tool-c/controllers/SessionController.ts
- backend/src/modules/dc/tool-c/routes/index.ts
- backend/test-tool-c-day2.mjs
- docs/03-业务模块/DC-数据清洗整理/00-工具C当前状态与开发指南.md
- docs/03-业务模块/DC-数据清洗整理/06-开发记录/2025-12-06_工具C_Day2开发完成总结.md

代码统计: ~1900行
测试结果: 7/7 通过 (100%)
云原生规范: 完全符合
This commit is contained in:
2025-12-06 22:12:47 +08:00
parent 8be741cd52
commit 2348234013
13 changed files with 3466 additions and 0 deletions

View File

@@ -846,3 +846,30 @@ model DCExtractionItem {
@@map("dc_extraction_items")
@@schema("dc_schema")
}
// ==================== DC数据清洗模块 - Tool C (科研数据编辑器) ====================
// Tool C Session 会话表
model DcToolCSession {
id String @id @default(uuid())
userId String @map("user_id")
fileName String @map("file_name")
fileKey String @map("file_key") // OSS存储key: dc/tool-c/sessions/{timestamp}-{fileName}
// 数据元信息
totalRows Int @map("total_rows")
totalCols Int @map("total_cols")
columns Json @map("columns") // ["age", "gender", "diagnosis"] 列名数组
encoding String? @map("encoding") // 文件编码 utf-8, gbk等
fileSize Int @map("file_size") // 文件大小(字节)
// 时间戳
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
expiresAt DateTime @map("expires_at") // 过期时间创建后10分钟
@@index([userId])
@@index([expiresAt])
@@map("dc_tool_c_sessions")
@@schema("dc_schema")
}