feat(file): support seven delivery document categories
This commit is contained in:
@@ -7,6 +7,13 @@ import java.util.Arrays;
|
||||
|
||||
/** File-owned storage policy. Business visibility and lifecycle remain in the calling service. */
|
||||
enum BusinessFileCategory {
|
||||
DELIVERY_BOL(true, FormatPolicy.ARBITRARY, Limits.CUSTOMS, BusinessIdPolicy.POSITIVE_LONG),
|
||||
DELIVERY_CUSTOMER_DOCUMENT(true, FormatPolicy.ARBITRARY, Limits.CUSTOMS, BusinessIdPolicy.POSITIVE_LONG),
|
||||
DELIVERY_BILL_OF_LADING(true, FormatPolicy.ARBITRARY, Limits.CUSTOMS, BusinessIdPolicy.POSITIVE_LONG),
|
||||
DELIVERY_POD(true, FormatPolicy.ARBITRARY, Limits.CUSTOMS, BusinessIdPolicy.POSITIVE_LONG),
|
||||
DELIVERY_PHOTO(true, FormatPolicy.ARBITRARY, Limits.CUSTOMS, BusinessIdPolicy.POSITIVE_LONG),
|
||||
DELIVERY_LOADING_PHOTO(true, FormatPolicy.ARBITRARY, Limits.CUSTOMS, BusinessIdPolicy.POSITIVE_LONG),
|
||||
DELIVERY_EXPRESS_RECEIPT(true, FormatPolicy.ARBITRARY, Limits.CUSTOMS, BusinessIdPolicy.POSITIVE_LONG),
|
||||
TRUCK_APPOINTMENT_ATTACHMENT(false, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
|
||||
OCEAN_BOOKING_DOCUMENT(true, FormatPolicy.ARBITRARY, Limits.CUSTOMS, BusinessIdPolicy.POSITIVE_LONG),
|
||||
CUSTOMS_DOCUMENT(false, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
|
||||
|
||||
@@ -84,10 +84,11 @@ public class InternalBusinessFileService {
|
||||
private static Metadata metadata(FileObjectEntity value) {
|
||||
return new Metadata(value.getId(), value.getTenantId() == 0 ? "PLATFORM" : "CUSTOMER",
|
||||
value.getTenantId(), value.getBusinessType(), value.getBusinessId(),
|
||||
value.getOriginalName(), value.getSha256(), value.getContentType(), value.getSizeBytes());
|
||||
value.getOriginalName(), value.getSha256(), value.getContentType(), value.getSizeBytes(), value.getCreatedAt());
|
||||
}
|
||||
|
||||
public record Metadata(Long fileId, String ownerScope, Long tenantId, String businessType, String businessId,
|
||||
String fileName, String sha256, String contentType, Long sizeBytes) {}
|
||||
String fileName, String sha256, String contentType, Long sizeBytes,
|
||||
LocalDateTime createdAt) {}
|
||||
public record Download(String fileName, String contentType, byte[] content) {}
|
||||
}
|
||||
|
||||
@@ -118,6 +118,7 @@ components:
|
||||
sha256: {type: string}
|
||||
contentType: {type: string}
|
||||
sizeBytes: {type: integer, format: int64, maximum: 52428800}
|
||||
createdAt: {type: string, description: 持久化上传时间LocalDateTime,无时区偏移}
|
||||
ExportBatchRequest:
|
||||
type: object
|
||||
required: [taskId, tenantId, appCode, requestedBy, dispatchVersion, parameters, limit]
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
openapi: 3.0.3
|
||||
info:
|
||||
title: 派送单七类资料 File 内部契约
|
||||
version: 1.0.0
|
||||
description: >-
|
||||
tenantId为派送单所属客户,businessId为deliveryOrderId内部Long的十进制字符串,不是派送单号或BOL号。
|
||||
任意格式,非空单文件最多50MiB(52428800字节)。每类最多20文件由Lastleg控制,七类不强制必传。
|
||||
上传只创建不可变对象,不自动绑定。Lastleg原子保存分类绑定与版本,替换/删除仅解绑并保留历史证据,
|
||||
用户下载前由Lastleg检查当前引用或获准历史引用和权限,再调用File精确归属下载。不得按BOL号跨客户复用。
|
||||
x-category-mapping:
|
||||
BOL: DELIVERY_BOL
|
||||
CUSTOMER_DOCUMENT: DELIVERY_CUSTOMER_DOCUMENT
|
||||
BILL_OF_LADING: DELIVERY_BILL_OF_LADING
|
||||
POD: DELIVERY_POD
|
||||
DELIVERY_PHOTO: DELIVERY_PHOTO
|
||||
LOADING_PHOTO: DELIVERY_LOADING_PHOTO
|
||||
EXPRESS_RECEIPT: DELIVERY_EXPRESS_RECEIPT
|
||||
paths:
|
||||
/internal/file/v1/business-files/{tenantId}/{businessType}/{businessId}:
|
||||
parameters:
|
||||
- {$ref: '#/components/parameters/Token'}
|
||||
- {$ref: '#/components/parameters/Tenant'}
|
||||
- {$ref: '#/components/parameters/Type'}
|
||||
- {$ref: '#/components/parameters/Business'}
|
||||
post:
|
||||
summary: 上传派送资料不可变对象
|
||||
parameters:
|
||||
- {name: X-Operator-Id, in: header, required: true, schema: {type: string, pattern: '^[1-9][0-9]*$'}}
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
required: [file]
|
||||
properties:
|
||||
file: {type: string, format: binary}
|
||||
responses:
|
||||
'200': {$ref: '#/components/responses/Metadata'}
|
||||
/internal/file/v1/business-files/{tenantId}/{businessType}/{businessId}/{fileId}:
|
||||
parameters:
|
||||
- {$ref: '#/components/parameters/Token'}
|
||||
- {$ref: '#/components/parameters/Tenant'}
|
||||
- {$ref: '#/components/parameters/Type'}
|
||||
- {$ref: '#/components/parameters/Business'}
|
||||
- {$ref: '#/components/parameters/File'}
|
||||
get:
|
||||
summary: 校验客户、派送单、类别和文件ID,读取有效未删除文件元数据
|
||||
responses:
|
||||
'200': {$ref: '#/components/responses/Metadata'}
|
||||
/internal/file/v1/business-files/{tenantId}/{businessType}/{businessId}/{fileId}/content:
|
||||
parameters:
|
||||
- {$ref: '#/components/parameters/Token'}
|
||||
- {$ref: '#/components/parameters/Tenant'}
|
||||
- {$ref: '#/components/parameters/Type'}
|
||||
- {$ref: '#/components/parameters/Business'}
|
||||
- {$ref: '#/components/parameters/File'}
|
||||
get:
|
||||
summary: 按完整归属下载;内部令牌必需,不提供匿名下载
|
||||
responses:
|
||||
'200':
|
||||
description: 二进制成功响应;失败按统一JSON code判断
|
||||
headers:
|
||||
Cache-Control: {schema: {type: string, enum: [no-store]}}
|
||||
Content-Disposition: {schema: {type: string}, description: attachment及UTF-8原文件名}
|
||||
components:
|
||||
parameters:
|
||||
Token: {name: X-Internal-Service-Token, in: header, required: true, schema: {type: string}}
|
||||
Tenant: {name: tenantId, in: path, required: true, schema: {type: string, pattern: '^[1-9][0-9]*$'}}
|
||||
Business: {name: businessId, in: path, required: true, schema: {type: string, pattern: '^[1-9][0-9]*$'}}
|
||||
File: {name: fileId, in: path, required: true, schema: {type: string, pattern: '^[1-9][0-9]*$'}}
|
||||
Type:
|
||||
name: businessType
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
enum: [DELIVERY_BOL, DELIVERY_CUSTOMER_DOCUMENT, DELIVERY_BILL_OF_LADING, DELIVERY_POD, DELIVERY_PHOTO, DELIVERY_LOADING_PHOTO, DELIVERY_EXPRESS_RECEIPT]
|
||||
responses:
|
||||
Metadata:
|
||||
description: 业务成功/失败使用HTTP200,成功code为字符串200;无效内部令牌拒绝
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code: {type: string}
|
||||
message: {type: string}
|
||||
data:
|
||||
type: object
|
||||
properties:
|
||||
fileId: {type: string}
|
||||
ownerScope: {type: string, enum: [CUSTOMER]}
|
||||
tenantId: {type: string}
|
||||
businessType: {type: string}
|
||||
businessId: {type: string}
|
||||
fileName: {type: string}
|
||||
sha256: {type: string}
|
||||
contentType: {type: string}
|
||||
sizeBytes: {type: integer, format: int64, maximum: 52428800}
|
||||
createdAt: {type: string, description: 持久化created_at原值,LocalDateTime格式yyyy-MM-ddTHH:mm:ss,无时区偏移}
|
||||
@@ -112,3 +112,4 @@ components:
|
||||
sha256: {type: string, pattern: '^[0-9a-f]{64}$'}
|
||||
contentType: {type: string}
|
||||
sizeBytes: {type: integer, format: int64, minimum: 1, maximum: 52428800}
|
||||
createdAt: {type: string, description: 持久化上传时间LocalDateTime,无时区偏移}
|
||||
|
||||
@@ -134,3 +134,4 @@ components:
|
||||
sha256: {type: string, pattern: '^[0-9a-f]{64}$'}
|
||||
contentType: {type: string, enum: [application/vnd.openxmlformats-officedocument.spreadsheetml.sheet]}
|
||||
sizeBytes: {type: integer, format: int64, minimum: 1, maximum: 5242880}
|
||||
createdAt: {type: string, description: 持久化上传时间LocalDateTime,无时区偏移}
|
||||
|
||||
@@ -107,3 +107,4 @@ components:
|
||||
sha256: {type: string, pattern: '^[0-9a-f]{64}$'}
|
||||
contentType: {type: string}
|
||||
sizeBytes: {type: integer, format: int64, minimum: 1, maximum: 10485760}
|
||||
createdAt: {type: string, description: 持久化上传时间LocalDateTime,无时区偏移}
|
||||
|
||||
Reference in New Issue
Block a user