Browse Source
# Conflicts: # warehouse-sdk-xincang/src/main/java/common/ecommerce/xincang/adapter/XincangTransferMapper.javafeature/supplier-lingxing
8 changed files with 618 additions and 10 deletions
@ -0,0 +1,122 @@ |
|||||||
|
package common.ecommerce.warehouse.model; |
||||||
|
|
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
/** |
||||||
|
* 仓方文件上传后的附件元数据。 |
||||||
|
* |
||||||
|
* <p>信仓的转运 / 订单附件要求先用 {@code upload.files} 上传,再把返回的对象原样放进 |
||||||
|
* 对应字段({@code product_label_att} 等)。SDK <b>不下载、不解析、不落盘</b>, |
||||||
|
* 只做字段搬运。</p> |
||||||
|
*/ |
||||||
|
public final class TransferAttachment { |
||||||
|
|
||||||
|
/** 存储类型,如 {@code aliyun_oss}。 */ |
||||||
|
private final String type; |
||||||
|
/** bucket 名。 */ |
||||||
|
private final String bucket; |
||||||
|
/** 对象键。 */ |
||||||
|
private final String fileName; |
||||||
|
/** 可访问 URL。 */ |
||||||
|
private final String fileUrl; |
||||||
|
/** 文件类型(如 pdf / png);部分仓必填。 */ |
||||||
|
private final String fileType; |
||||||
|
/** 原始文件名。 */ |
||||||
|
private final String name; |
||||||
|
|
||||||
|
private TransferAttachment(Builder b) { |
||||||
|
this.type = b.type; |
||||||
|
this.bucket = b.bucket; |
||||||
|
this.fileName = require(b.fileName, "fileName"); |
||||||
|
this.fileUrl = b.fileUrl; |
||||||
|
this.fileType = b.fileType; |
||||||
|
this.name = b.name; |
||||||
|
} |
||||||
|
|
||||||
|
public static Builder builder() { |
||||||
|
return new Builder(); |
||||||
|
} |
||||||
|
|
||||||
|
/** 存储类型;可能为 null。 */ |
||||||
|
public String type() { |
||||||
|
return type; |
||||||
|
} |
||||||
|
|
||||||
|
/** bucket 名;可能为 null。 */ |
||||||
|
public String bucket() { |
||||||
|
return bucket; |
||||||
|
} |
||||||
|
|
||||||
|
/** 对象键;必填。 */ |
||||||
|
public String fileName() { |
||||||
|
return fileName; |
||||||
|
} |
||||||
|
|
||||||
|
/** 可访问 URL;可能为 null。 */ |
||||||
|
public String fileUrl() { |
||||||
|
return fileUrl; |
||||||
|
} |
||||||
|
|
||||||
|
/** 文件类型;可能为 null。 */ |
||||||
|
public String fileType() { |
||||||
|
return fileType; |
||||||
|
} |
||||||
|
|
||||||
|
/** 原始文件名;可能为 null。 */ |
||||||
|
public String name() { |
||||||
|
return name; |
||||||
|
} |
||||||
|
|
||||||
|
private static String require(String v, String n) { |
||||||
|
Objects.requireNonNull(v, n); |
||||||
|
if (v.trim().isEmpty()) { |
||||||
|
throw new IllegalArgumentException(n + " must not be blank"); |
||||||
|
} |
||||||
|
return v.trim(); |
||||||
|
} |
||||||
|
|
||||||
|
public static final class Builder { |
||||||
|
|
||||||
|
private String type; |
||||||
|
private String bucket; |
||||||
|
private String fileName; |
||||||
|
private String fileUrl; |
||||||
|
private String fileType; |
||||||
|
private String name; |
||||||
|
|
||||||
|
public Builder type(String v) { |
||||||
|
this.type = v; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public Builder bucket(String v) { |
||||||
|
this.bucket = v; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
/** 对象键;必填。 */ |
||||||
|
public Builder fileName(String v) { |
||||||
|
this.fileName = v; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public Builder fileUrl(String v) { |
||||||
|
this.fileUrl = v; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public Builder fileType(String v) { |
||||||
|
this.fileType = v; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public Builder name(String v) { |
||||||
|
this.name = v; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public TransferAttachment build() { |
||||||
|
return new TransferAttachment(this); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue