diff --git a/docs/openapi.yaml b/docs/openapi.yaml index d96791b..8a1a355 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -1,15 +1,11 @@ openapi: "3.1.0" info: - title: GMP Mock Service API - description: | - Mock 服务,提供基于 Word 模板的文档导出功能。 - 模板使用 poi-tl 的 `{{variable}}` 语法标记占位符, - 业务数据通过 `businessData` 传入。 + title: Service API version: "1.0.0" contact: name: closein servers: - - url: http://localhost:6666 + - url: http://193.112.146.124:6666 description: 本地开发服务器 paths: @@ -17,9 +13,7 @@ paths: post: summary: 导出 Word 文档 description: | - 根据模板 ID 选择模板,填充业务数据后流式返回 `.docx` 文件。 - - 请求成功时直接流式下载文件,失败时返回 JSON 错误体。 + 请求成功时返回文件流,失败时返回 JSON 错误体。 operationId: exportDocx tags: - Docx Export @@ -31,10 +25,10 @@ paths: $ref: '#/components/schemas/DocxExportRequest' example: exportId: "annualReport" - businessData: {} + businessData: { startYear: 2023, endYear: 2024 } responses: "200": - description: 成功 — 流式下载 `.docx` 文件 + description: 成功 — 流式下载文件 content: application/vnd.openxmlformats-officedocument.wordprocessingml.document: schema: @@ -84,7 +78,7 @@ components: description: | 业务数据键值对,用于填充模板中的变量。 当前模板自行定义默认值,后续可改为从此处读取。 - example: {} + example: { } additionalProperties: false ApiError: @@ -101,38 +95,3 @@ components: type: string description: 错误描述 example: "exportId 不能为空" - - # --- 模板定义(非 OpenAPI 标准,用于文档参考) --- - - Template: - type: object - description: 可用模板 - properties: - exportId: - type: string - description: 模板标识 - example: "annualReport" - fileName: - type: string - description: 生成的文件名 - example: "annualReport.docx" - variables: - type: array - description: 模板中可用的占位符变量 - items: - type: string - example: - - "{{title}}" - - "{{companyName}}" - - "{{reportPeriod}}" - - "{{generatedDate}}" - -x-templates: - - exportId: "annualReport" - fileName: "annualReport.docx" - description: 年度工作报告模板,包含标题、公司信息、表格(3 行数据) - variables: - - title - - companyName - - reportPeriod - - generatedDate diff --git a/src/main/resources/templates/annualReportTemplate.docx b/src/main/resources/templates/annualReportTemplate.docx index 1dbee72..3004bdb 100644 Binary files a/src/main/resources/templates/annualReportTemplate.docx and b/src/main/resources/templates/annualReportTemplate.docx differ