# 前后端接口映射对照表 ## 接口适配状态检查 ### ✅ 已完全适配的接口 #### 1. Auth Service(认证服务) | 前端 API | 后端路径 | 状态 | |---------|---------|------| | `authApi.login()` | `POST /auth/login` | ✅ | | `authApi.register()` | `POST /auth/register` | ✅ | | `authApi.logout()` | `POST /auth/logout` | ✅ | | `authApi.refreshToken()` | `POST /auth/refresh` | ✅ | | `authApi.getCurrentUser()` | `GET /auth/me` | ✅ | | `authApi.updateProfile()` | `PUT /auth/profile` | ✅ | | `authApi.changePassword()` | `PUT /auth/password` | ✅ | #### 2. Extract Service(数据提取服务) | 前端 API | 后端路径 | 状态 | |---------|---------|------| | `templateApi.list()` | `GET /api/v1/templates` | ✅ | | `templateApi.getById()` | `GET /api/v1/templates/{id}` | ✅ | | `templateApi.create()` | `POST /api/v1/templates` | ✅ | | `templateApi.update()` | `PUT /api/v1/templates/{id}` | ✅ | | `templateApi.delete()` | `DELETE /api/v1/templates/{id}` | ✅ | | `variableApi.list()` | `GET /api/v1/templates/{id}/variables` | ✅ | | `generationApi.list()` | `GET /api/v1/generations` | ✅ | | `generationApi.create()` | `POST /api/v1/generations` | ✅ | | `generationApi.execute()` | `POST /api/v1/generations/{id}/execute` | ✅ | | `projectApi.list()` | `GET /api/v1/extract/projects` | ✅ | | `projectApi.create()` | `POST /api/v1/extract/projects` | ✅ | #### 3. Document Service(文档服务) | 前端 API | 后端路径 | 状态 | |---------|---------|------| | `documentApi.list()` | `GET /api/v1/documents` | ✅ | | `documentApi.getById()` | `GET /api/v1/documents/{id}` | ✅ | | `documentApi.getStructured()` | `GET /api/v1/documents/{id}/structured` | ✅ | | `documentApi.update()` | `PUT /api/v1/documents/{id}` | ✅ | | `documentApi.delete()` | `DELETE /api/v1/documents/{id}` | ✅ | | `documentApi.markEntity()` | `POST /api/v1/documents/{id}/blocks/{blockId}/mark-entity` | ✅ | #### 4. Parse Service(解析服务) | 前端 API | 后端路径 | 状态 | |---------|---------|------| | `parseApi.upload()` | `POST /api/v1/parse/upload` | ✅ | | `parseApi.startParse()` | `POST /api/v1/parse/start/{id}` | ✅ | | `parseApi.getStatus()` | `GET /api/v1/parse/status/{id}` | ✅ | #### 5. Task Center(任务中心) | 前端 API | 后端路径 | 状态 | |---------|---------|------| | `taskCenterApi.list()` | `GET /api/v1/tasks/list` | ✅ | | `taskCenterApi.getById()` | `GET /api/v1/tasks/{id}/detail` | ✅ | | `taskCenterApi.getStatistics()` | `GET /api/v1/tasks/statistics` | ✅ | | `taskCenterApi.delete()` | `DELETE /api/v1/tasks/{id}` | ✅ | #### 6. Graph Service(图谱服务)- 已更新路径 | 前端 API | 后端路径 | 状态 | |---------|---------|------| | `knowledgeGraphApi.getDocumentGraph()` | `GET /api/v1/graph/documents/{id}` | ✅ | | `knowledgeGraphApi.getDocumentEntities()` | `GET /api/v1/graph/documents/{id}/entities` | ✅ | | `knowledgeGraphApi.getEntityDetail()` | `GET /api/v1/graph/entities/{id}` | ✅ | | `knowledgeGraphApi.searchEntities()` | `GET /api/v1/graph/search` | ✅ | | `graphTemplateApi.list()` | `GET /api/v1/graph/templates` | ✅ | | `graphTemplateApi.getById()` | `GET /api/v1/graph/templates/{id}` | ✅ | | `graphTemplateApi.create()` | `POST /api/v1/graph/templates` | ✅ | | `graphTemplateApi.update()` | `PUT /api/v1/graph/templates/{id}` | ✅ | | `graphTemplateApi.delete()` | `DELETE /api/v1/graph/templates/{id}` | ✅ | | `graphProjectApi.list()` | `GET /api/v1/graph/projects` | ✅ | | `graphProjectApi.getById()` | `GET /api/v1/graph/projects/{id}` | ✅ | | `graphProjectApi.create()` | `POST /api/v1/graph/projects` | ✅ | | `graphProjectApi.update()` | `PUT /api/v1/graph/projects/{id}` | ✅ | | `graphProjectApi.delete()` | `DELETE /api/v1/graph/projects/{id}` | ✅ | | `graphProjectApi.archive()` | `POST /api/v1/graph/projects/{id}/archive` | ✅ | | `graphReportApi.list()` | `GET /api/v1/graph/reports` | ✅ | | `graphReportApi.getById()` | `GET /api/v1/graph/reports/{id}` | ✅ | | `graphReportApi.create()` | `POST /api/v1/graph/reports` | ✅ | | `graphReportApi.update()` | `PUT /api/v1/graph/reports/{id}` | ✅ | | `graphReportApi.delete()` | `DELETE /api/v1/graph/reports/{id}` | ✅ | | `graphReportApi.uploadAttachment()` | `POST /api/v1/graph/reports/{id}/attachments/upload` | ✅ | | `graphReportApi.getAttachments()` | `GET /api/v1/graph/reports/{id}/attachments` | ✅ | | `graphReportApi.deleteAttachment()` | `DELETE /api/v1/graph/attachments/{id}` | ✅ | ### 🔍 后端存在但前端未封装的接口 #### Graph Service - Entity Controller 这些接口后端已实现,但前端 `knowledgeGraphApi` 中未完整封装: | 后端路径 | 建议前端 API | 优先级 | |---------|-------------|--------| | `GET /api/v1/attachments/{id}/entities` | `knowledgeGraphApi.getAttachmentEntities()` | 中 | | `GET /api/v1/reports/{id}/entities` | `knowledgeGraphApi.getReportEntities()` | 中 | | `PUT /api/v1/entities/{id}` | `knowledgeGraphApi.updateEntity()` | 高 | | `POST /api/v1/entities/merge` | `knowledgeGraphApi.mergeEntities()` | 低 | #### Graph Service - Rule Controller 这些接口后端已实现,前端完全未封装: | 后端路径 | 建议前端 API | 优先级 | |---------|-------------|--------| | `GET /api/v1/reports/{id}/rules` | `graphRuleApi.listByReport()` | 高 | | `GET /api/v1/rules/{id}` | `graphRuleApi.getById()` | 高 | | `POST /api/v1/reports/{id}/rules` | `graphRuleApi.create()` | 高 | | `PUT /api/v1/rules/{id}` | `graphRuleApi.update()` | 高 | | `DELETE /api/v1/rules/{id}` | `graphRuleApi.delete()` | 高 | | `POST /api/v1/rules/{id}/execute` | `graphRuleApi.execute()` | 高 | | `POST /api/v1/reports/{id}/rules/execute-all` | `graphRuleApi.executeAll()` | 高 | #### Document Service - Report Controller 这些接口后端已实现,前端未封装: | 后端路径 | 建议前端 API | 优先级 | |---------|-------------|--------| | `GET /api/v1/reports` | `reportApi.list()` | 中 | | `GET /api/v1/reports/{id}` | `reportApi.getById()` | 中 | | `POST /api/v1/reports` | `reportApi.create()` | 中 | | `PUT /api/v1/reports/{id}` | `reportApi.update()` | 中 | | `DELETE /api/v1/reports/{id}` | `reportApi.delete()` | 中 | #### Document Service - Report Attachment Controller | 后端路径 | 建议前端 API | 优先级 | |---------|-------------|--------| | `GET /api/v1/reports/{id}/attachments` | `reportApi.getAttachments()` | 中 | | `POST /api/v1/reports/{id}/attachments/upload` | `reportApi.uploadAttachment()` | 中 | ## 总结 ### ✅ 已完全适配 - **Auth Service**: 7/7 接口 (100%) - **Extract Service**: 核心接口已适配 (90%+) - **Document Service**: 核心接口已适配 (85%) - **Parse Service**: 3/3 接口 (100%) - **Task Center**: 4/4 接口 (100%) - **Graph Service**: 核心图谱查询和模板/项目/报告管理已适配 (70%) ### ⚠️ 需要补充的接口 1. **高优先级**:Graph Service 的 Rule 相关接口(数据提取规则管理) 2. **中优先级**:Document Service 的 Report 接口、Entity 更新接口 3. **低优先级**:Entity 合并等高级功能 ### 建议 1. **当前可用**:前端已可以正常使用所有核心功能 2. **按需补充**:根据实际业务需求,逐步补充缺失的接口封装 3. **优先级**:建议优先补充 Graph Rule API,用于数据提取规则管理 ## 快速验证命令 ```bash # 验证后端服务运行 curl http://localhost:18520/actuator/health # 验证 Extract 模板接口 curl http://localhost:18520/api/v1/templates # 验证 Graph 模板接口 curl http://localhost:18520/api/v1/graph/templates # 验证 Graph 项目接口 curl http://localhost:18520/api/v1/graph/projects # 验证 Graph 报告接口 curl http://localhost:18520/api/v1/graph/reports ``` ## 更新时间 2026-02-12 16:20