From c7904a9f8b9a1f2fb87e2fc704dd2ca51f5325f3 Mon Sep 17 00:00:00 2001 From: zhangjf Date: Mon, 16 Feb 2026 09:59:21 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E5=90=8C=E6=AD=A5=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=AE=A1=E7=90=86=E6=A8=A1=E5=9D=97=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新内容: 1. API接口文档.md - 新增「十六、文件管理接口」章节(194行) - 7个核心接口文档: * 16.1 上传文件(multipart/form-data) * 16.2 分页查询文件列表 * 16.3 根据业务类型和ID查询文件列表 * 16.4 获取文件详情 * 16.5 删除文件 * 16.6 获取文件访问URL * 16.7 文件类型说明(支持的MIME类型) - 完整的请求参数、响应示例、字段说明 - 文件类型白名单、大小限制说明 - 调整附录章节编号为「十七」 2. 资金服务平台 FundPlatform 功能清单.md - 新增「4.1.3 文件管理」章节 - 标记文件管理功能为已完成 ✅ - 添加实现状态说明: * 后端:FileRecord + FileRecordMapper + FileService + FileController * 前端:file.js + file.vue * 功能清单:12大功能点 * 支持文件类型、存储方式、业务关联 文档与代码同步完成! --- doc/API接口文档.md | 195 +++++++++++++++++++++- doc/资金服务平台 FundPlatform 功能清单.md | 23 ++- 2 files changed, 215 insertions(+), 3 deletions(-) diff --git a/doc/API接口文档.md b/doc/API接口文档.md index 9009da0..4162f27 100644 --- a/doc/API接口文档.md +++ b/doc/API接口文档.md @@ -2291,9 +2291,200 @@ X-Tenant-Id: 1 --- -## 十六、附录 +## 十六、文件管理接口 -### 14.1 枚举值定义 +### 16.1 上传文件 + +**接口地址:** `POST /api/v1/file/upload` + +**接口说明:** 上传文件到服务器 + +**请求参数(multipart/form-data):** + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| file | File | 是 | 文件(支持图片、PDF、Office文档、文本等) | +| businessType | String | 否 | 业务类型:contract-合同,receipt-收款凭证,expense-支出凭证,other-其他 | +| businessId | Long | 否 | 关联业务ID | +| uploadBy | Long | 否 | 上传人ID | +| uploadName | String | 否 | 上传人名称 | + +**响应示例:** + +```json +{ + "code": 200, + "message": "操作成功", + "data": { + "fileId": 1, + "tenantId": 1, + "fileName": "a1b2c3d4e5f6.pdf", + "originalName": "合同附件.pdf", + "fileType": "application/pdf", + "fileSize": 1024567, + "filePath": "2026/02/13/a1b2c3d4e5f6.pdf", + "fileUrl": "/uploads/2026/02/13/a1b2c3d4e5f6.pdf", + "storageType": "local", + "businessType": "contract", + "businessId": 1001, + "uploadBy": 1, + "uploadName": "管理员", + "status": 1, + "createdTime": "2026-02-13 10:00:00" + } +} +``` + +--- + +### 16.2 分页查询文件列表 + +**接口地址:** `GET /api/v1/file/list` + +**接口说明:** 分页查询文件列表 + +**请求参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| current | Long | 否 | 当前页码,默认1 | +| size | Long | 否 | 每页条数,默认10 | +| fileName | String | 否 | 文件名(模糊查询) | +| businessType | String | 否 | 业务类型 | +| businessId | Long | 否 | 关联业务ID | + +**响应示例:** + +```json +{ + "code": 200, + "message": "操作成功", + "data": { + "records": [ + { + "fileId": 1, + "fileName": "a1b2c3d4e5f6.pdf", + "originalName": "合同附件.pdf", + "fileType": "application/pdf", + "fileSize": 1024567, + "fileUrl": "/uploads/2026/02/13/a1b2c3d4e5f6.pdf", + "businessType": "contract", + "businessId": 1001, + "uploadName": "管理员", + "createdTime": "2026-02-13 10:00:00" + } + ], + "total": 50, + "size": 10, + "current": 1 + } +} +``` + +--- + +### 16.3 根据业务类型和ID查询文件列表 + +**接口地址:** `GET /api/v1/file/list/business` + +**接口说明:** 查询指定业务关联的所有文件 + +**请求参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| businessType | String | 是 | 业务类型 | +| businessId | Long | 是 | 关联业务ID | + +**响应示例:** 同16.2 + +--- + +### 16.4 获取文件详情 + +**接口地址:** `GET /api/v1/file/{fileId}` + +**接口说明:** 根据ID查询文件详情 + +**路径参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| fileId | Long | 是 | 文件ID | + +**响应示例:** 同16.1 + +--- + +### 16.5 删除文件 + +**接口地址:** `DELETE /api/v1/file/{fileId}` + +**接口说明:** 删除指定文件(物理+逻辑删除) + +**路径参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| fileId | Long | 是 | 文件ID | + +**响应示例:** + +```json +{ + "code": 200, + "message": "删除成功", + "data": null +} +``` + +--- + +### 16.6 获取文件访问URL + +**接口地址:** `GET /api/v1/file/{fileId}/url` + +**接口说明:** 获取文件的访问URL + +**路径参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|--------|------|------|------| +| fileId | Long | 是 | 文件ID | + +**响应示例:** + +```json +{ + "code": 200, + "message": "操作成功", + "data": "/uploads/2026/02/13/a1b2c3d4e5f6.pdf" +} +``` + +--- + +### 16.7 文件类型说明 + +**支持的文件类型:** + +| 类型 | MIME类型 | +|------|----------| +| 图片 | image/jpeg, image/png, image/gif, image/bmp | +| PDF | application/pdf | +| Word | application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document | +| Excel | application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | +| PPT | application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation | +| 文本 | text/plain, text/csv | + +**限制:** +- 最大文件大小:50MB + +--- + +## 十七、附录 + +### 17.1 枚举值定义 #### 性别(gender) diff --git a/doc/资金服务平台 FundPlatform 功能清单.md b/doc/资金服务平台 FundPlatform 功能清单.md index cc36b7d..a458160 100644 --- a/doc/资金服务平台 FundPlatform 功能清单.md +++ b/doc/资金服务平台 FundPlatform 功能清单.md @@ -61,7 +61,28 @@ * 部门树选择器、岗位下拉选择 * 职位管理 -#### 4.1.3 系统配置 +#### 4.1.3 文件管理 ✅ +- 文件上传(合同附件、收款凭证、支出凭证) ✅ +- 文件列表管理 ✅ +- 文件预览(图片、PDF) ✅ +- 文件下载 ✅ +- 文件删除 ✅ +- **实现状态**:✅ 已完成 + - 后端:FileRecord + FileRecordMapper + FileService + FileController + - 前端:file.js + file.vue + - 功能: + * 文件上传(支持多类型:图片、PDF、Office、文本) + * 文件验证(类型白名单、大小限制50MB) + * 本地存储(支持扩展至COS/OSS) + * 按日期分目录存储 + * UUID重命名防冲突 + * 业务关联(合同/收款/支出/其他) + * 分页查询、按业务查询 + * 图片/PDF预览 + * 文件下载 + * 物理+逻辑双删除 + +#### 4.1.4 系统配置 - 基础参数设置(公司信息、币种、日期格式等) ---