317 lines
10 KiB
JSON
317 lines
10 KiB
JSON
{
|
||
"openapi": "3.0.3",
|
||
"info": {
|
||
"title": "HXOPS Accounting Voucher Check Tool API",
|
||
"description": "立账凭证检核查询 Tool API:缺资料清单、批次明细、单票最新状态。启动检核请复用 File Check 的 run_file_check(可传 run_options)。鉴权:Authorization Bearer 或 X-Integration-Key(与 FILE_CHECK_TOOL_API_KEY / INTEGRATION_API_KEY 相同)。",
|
||
"version": "1.0.0"
|
||
},
|
||
"servers": [
|
||
{
|
||
"url": "http://127.0.0.1:5052",
|
||
"description": "HXOPS_TOOLS_API_BASE"
|
||
}
|
||
],
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
},
|
||
{
|
||
"IntegrationKey": []
|
||
}
|
||
],
|
||
"paths": {
|
||
"/api/accounting-voucher-check/tools/tasks/{task_id}/missing": {
|
||
"get": {
|
||
"operationId": "list_voucher_missing",
|
||
"summary": "查询缺资料发票(最新状态)",
|
||
"description": "按账套与月份查询 status=missing 的发票;默认当前自然月。",
|
||
"tags": ["Accounting Voucher Check"],
|
||
"parameters": [
|
||
{
|
||
"name": "task_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": { "type": "integer", "example": 12 },
|
||
"description": "排程任务 ID(Agent 绑定的 schedule_task_id,用于回显)"
|
||
},
|
||
{
|
||
"name": "period",
|
||
"in": "query",
|
||
"required": false,
|
||
"schema": { "type": "string", "example": "2026-08" },
|
||
"description": "检核月份 YYYY-MM;缺省为当前自然月"
|
||
},
|
||
{
|
||
"name": "scope_code",
|
||
"in": "query",
|
||
"required": false,
|
||
"schema": { "type": "string", "default": "HXJM", "example": "HXJM" }
|
||
},
|
||
{
|
||
"name": "limit",
|
||
"in": "query",
|
||
"required": false,
|
||
"schema": { "type": "integer", "default": 200, "minimum": 1, "maximum": 1000 }
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": { "$ref": "#/components/schemas/MissingListResponse" }
|
||
}
|
||
}
|
||
},
|
||
"400": { "$ref": "#/components/responses/BadRequest" },
|
||
"401": { "$ref": "#/components/responses/Unauthorized" },
|
||
"503": { "$ref": "#/components/responses/MissingAuth" }
|
||
}
|
||
}
|
||
},
|
||
"/api/accounting-voucher-check/tools/runs/{run_id}/items": {
|
||
"get": {
|
||
"operationId": "list_voucher_run_items",
|
||
"summary": "查询批次发票明细",
|
||
"description": "分页返回某 ScheduleRun 的单票结论;可按 result 过滤。",
|
||
"tags": ["Accounting Voucher Check"],
|
||
"parameters": [
|
||
{
|
||
"name": "run_id",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": { "type": "integer", "example": 1001 }
|
||
},
|
||
{
|
||
"name": "result",
|
||
"in": "query",
|
||
"required": false,
|
||
"schema": {
|
||
"type": "string",
|
||
"enum": ["complete", "missing", "skipped", "technical_error"],
|
||
"example": "missing"
|
||
}
|
||
},
|
||
{
|
||
"name": "page",
|
||
"in": "query",
|
||
"required": false,
|
||
"schema": { "type": "integer", "default": 1, "minimum": 1 }
|
||
},
|
||
{
|
||
"name": "page_size",
|
||
"in": "query",
|
||
"required": false,
|
||
"schema": { "type": "integer", "default": 50, "minimum": 1, "maximum": 200 }
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": { "$ref": "#/components/schemas/RunItemsResponse" }
|
||
}
|
||
}
|
||
},
|
||
"401": { "$ref": "#/components/responses/Unauthorized" },
|
||
"404": { "$ref": "#/components/responses/NotFound" },
|
||
"503": { "$ref": "#/components/responses/MissingAuth" }
|
||
}
|
||
}
|
||
},
|
||
"/api/accounting-voucher-check/tools/invoices/{invoice_no}/latest": {
|
||
"get": {
|
||
"operationId": "get_voucher_invoice_latest",
|
||
"summary": "查询指定发票最新检核状态",
|
||
"description": "返回单票最新状态及近期批次快照;invoice_no 保持业务原值(仅 trim)。",
|
||
"tags": ["Accounting Voucher Check"],
|
||
"parameters": [
|
||
{
|
||
"name": "invoice_no",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": { "type": "string", "example": "INV-20260803001" },
|
||
"description": "发票号(apa08 原值)"
|
||
},
|
||
{
|
||
"name": "period",
|
||
"in": "query",
|
||
"required": false,
|
||
"schema": { "type": "string", "example": "2026-08" }
|
||
},
|
||
{
|
||
"name": "scope_code",
|
||
"in": "query",
|
||
"required": false,
|
||
"schema": { "type": "string", "default": "HXJM" }
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": { "$ref": "#/components/schemas/InvoiceLatestResponse" }
|
||
}
|
||
}
|
||
},
|
||
"400": { "$ref": "#/components/responses/BadRequest" },
|
||
"401": { "$ref": "#/components/responses/Unauthorized" },
|
||
"404": { "$ref": "#/components/responses/NotFound" },
|
||
"503": { "$ref": "#/components/responses/MissingAuth" }
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"components": {
|
||
"securitySchemes": {
|
||
"BearerAuth": {
|
||
"type": "http",
|
||
"scheme": "bearer",
|
||
"description": "Authorization: Bearer <FILE_CHECK_TOOL_API_KEY 或 INTEGRATION_API_KEY>"
|
||
},
|
||
"IntegrationKey": {
|
||
"type": "apiKey",
|
||
"in": "header",
|
||
"name": "X-Integration-Key",
|
||
"description": "与 Bearer 二选一"
|
||
}
|
||
},
|
||
"schemas": {
|
||
"MissingMaterial": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": { "type": "string", "example": "price_check_sheet" },
|
||
"name": { "type": "string", "example": "核价单" }
|
||
}
|
||
},
|
||
"InvoiceState": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": { "type": "integer" },
|
||
"scope_code": { "type": "string" },
|
||
"period_month": { "type": "string", "nullable": true },
|
||
"invoice_no": { "type": "string" },
|
||
"invoice_date": { "type": "string", "nullable": true },
|
||
"status": { "type": "string", "enum": ["complete", "missing"] },
|
||
"folder_path": { "type": "string", "nullable": true },
|
||
"folder_exists": { "type": "boolean" },
|
||
"matched_files": { "type": "object", "additionalProperties": { "type": "string" } },
|
||
"missing_materials": {
|
||
"type": "array",
|
||
"items": { "$ref": "#/components/schemas/MissingMaterial" }
|
||
},
|
||
"last_checked_at": { "type": "string", "nullable": true }
|
||
}
|
||
},
|
||
"MissingListResponse": {
|
||
"type": "object",
|
||
"required": ["ok", "items", "count"],
|
||
"properties": {
|
||
"ok": { "type": "boolean", "example": true },
|
||
"task_id": { "type": "integer", "nullable": true },
|
||
"scope_code": { "type": "string" },
|
||
"period": { "type": "string", "example": "2026-08" },
|
||
"count": { "type": "integer" },
|
||
"items": {
|
||
"type": "array",
|
||
"items": { "$ref": "#/components/schemas/InvoiceState" }
|
||
}
|
||
}
|
||
},
|
||
"RunItem": {
|
||
"type": "object",
|
||
"properties": {
|
||
"id": { "type": "integer" },
|
||
"schedule_run_id": { "type": "integer" },
|
||
"invoice_no": { "type": "string" },
|
||
"result": {
|
||
"type": "string",
|
||
"enum": ["complete", "missing", "skipped", "technical_error"]
|
||
},
|
||
"folder_path": { "type": "string", "nullable": true },
|
||
"matched_files": { "type": "object", "additionalProperties": { "type": "string" } },
|
||
"missing_materials": {
|
||
"type": "array",
|
||
"items": { "$ref": "#/components/schemas/MissingMaterial" }
|
||
},
|
||
"error_code": { "type": "string", "nullable": true },
|
||
"error_message": { "type": "string", "nullable": true }
|
||
}
|
||
},
|
||
"RunItemsResponse": {
|
||
"type": "object",
|
||
"required": ["ok", "items", "total"],
|
||
"properties": {
|
||
"ok": { "type": "boolean" },
|
||
"run_id": { "type": "integer" },
|
||
"run_no": { "type": "string" },
|
||
"page": { "type": "integer" },
|
||
"page_size": { "type": "integer" },
|
||
"total": { "type": "integer" },
|
||
"items": {
|
||
"type": "array",
|
||
"items": { "$ref": "#/components/schemas/RunItem" }
|
||
}
|
||
}
|
||
},
|
||
"InvoiceLatestResponse": {
|
||
"type": "object",
|
||
"required": ["ok", "state"],
|
||
"properties": {
|
||
"ok": { "type": "boolean" },
|
||
"state": { "$ref": "#/components/schemas/InvoiceState" },
|
||
"recent_run_items": {
|
||
"type": "array",
|
||
"items": { "$ref": "#/components/schemas/RunItem" }
|
||
}
|
||
}
|
||
},
|
||
"ToolError": {
|
||
"type": "object",
|
||
"properties": {
|
||
"ok": { "type": "boolean", "example": false },
|
||
"error_code": { "type": "string" },
|
||
"message": { "type": "string" },
|
||
"details": { "type": "object" }
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"BadRequest": {
|
||
"description": "参数错误",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": { "$ref": "#/components/schemas/ToolError" }
|
||
}
|
||
}
|
||
},
|
||
"Unauthorized": {
|
||
"description": "鉴权失败",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": { "$ref": "#/components/schemas/ToolError" }
|
||
}
|
||
}
|
||
},
|
||
"NotFound": {
|
||
"description": "资源不存在",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": { "$ref": "#/components/schemas/ToolError" }
|
||
}
|
||
}
|
||
},
|
||
"MissingAuth": {
|
||
"description": "服务端未配置 Tool API Key",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": { "$ref": "#/components/schemas/ToolError" }
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|