You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

183 lines
5.7 KiB

package common.ecommerce.xincang.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.math.BigDecimal;
/**
* 信仓报文结构。
*
* <p>字段名以 Apifox「OMS接口文档V2」为准。信仓全局响应外层统一为
* {@code {"rst": ..., "errno": 0, "err": "", "trace_id": "..."}},这里只放登录接口用到的部分。
* 字段差异只改本类,不动适配器与领域模型。</p>
*/
public final class XincangDtos {
private XincangDtos() {
}
/**
* 登录响应({@code GET /api.login})。
*
* <p>注意与业务接口不同:登录的 {@code rst} <b>没有</b> {@code code/msg/data} 包裹,
* 而是直接给出客户与 token 字段。</p>
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class LoginResponse {
/** 登录结果;业务失败时可能为 null。 */
@JsonProperty("rst")
public LoginResult rst;
/** 0 表示成功。 */
@JsonProperty("errno")
public Integer errno;
/** 错误描述;成功时为空串。 */
@JsonProperty("err")
public String err;
/** 信仓侧链路号。 */
@JsonProperty("trace_id")
public String traceId;
}
/** 登录结果的 {@code rst} 部分。 */
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class LoginResult {
/** 客户 id。 */
@JsonProperty("id")
public String customerId;
/** 回显的 APIKEY,正常等于登录用的 appkey。 */
@JsonProperty("api_client_id")
public String apiClientId;
/** 回显的 APISECRET;不需要也不应落盘,仅用于排障时核对身份。 */
@JsonProperty("api_client_secret")
public String apiClientSecret;
/** 过期时间,北京时间 {@code yyyy-MM-dd HH:mm:ss}。 */
@JsonProperty("token_expire_time")
public String tokenExpireTime;
/** 令牌本体(形如 {@code {D0A7A4FB-...}})。 */
@JsonProperty("token")
public String token;
}
/**
* 新增 / 更新产品请求({@code POST api.add_product} / {@code api.update_product})。
*
* <p>信仓这两个接口的 {@code token} 放在 <b>请求体</b>里(文档 required 列表含 {@code token});
* 新增接口的 query 里同时也收一份,见 {@code XincangRequestFactory}。</p>
*
* <p>单位:金额美元、尺寸英寸、重量磅;与统一模型(cm / g)的换算在
* {@code XincangProductMapper}。</p>
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public static final class ProductRequest {
/** 令牌。 */
@JsonProperty("token")
public String token;
/** 产品 SKU。 */
@JsonProperty("product_no")
public String productNo;
/** 中文名。 */
@JsonProperty("chn_name")
public String chnName;
/** 金额,美元,最长两位小数。 */
@JsonProperty("amount")
public BigDecimal amount;
/** 产品条码。 */
@JsonProperty("bar_code")
public String barCode;
/** 毛重,磅,最长四位小数。 */
@JsonProperty("weight_lbs")
public BigDecimal weightLbs;
/** 装箱率 / 箱率。 */
@JsonProperty("packing_rate")
public Integer packingRate;
/** 长,英寸,最长四位小数。 */
@JsonProperty("size_l_ln")
public BigDecimal sizeLLn;
/** 宽,英寸,最长四位小数。 */
@JsonProperty("size_w_ln")
public BigDecimal sizeWLn;
/** 高,英寸,最长四位小数。 */
@JsonProperty("size_h_ln")
public BigDecimal sizeHLn;
/** 备注。 */
@JsonProperty("remark")
public String remark;
/** 仓库码(信仓 {@code ckm})。 */
@JsonProperty("ckm")
public String ckm;
/** 产品类型:1 普货 / 2 配件 / 3 危险品;不传默认 1。 */
@JsonProperty("product_type")
public Integer productType;
/** 产品品类:0 其它 / 1 家具 / 2 食品 / 3 汽配 / 4 服饰 / 5 化妆品 / 6 鞋类 / 7 玩具 / 8 电子 / 9 数码。 */
@JsonProperty("product_category")
public Integer productCategory;
/** 产品图片;需先调 {@code upload.files}。统一模型暂不承载图片,通常为 null。 */
@JsonProperty("product_image")
public ProductImage productImage;
}
/** 产品图片(OSS 元数据)。 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public static final class ProductImage {
/** 存储类型,如 {@code aliyun_oss}。 */
@JsonProperty("type")
public String type;
/** bucket 名。 */
@JsonProperty("bucket")
public String bucket;
/** 对象键。 */
@JsonProperty("file_name")
public String fileName;
/** 可访问 URL。 */
@JsonProperty("file_url")
public String fileUrl;
}
/**
* 产品列表响应({@code GET api.productlist})中 {@code rst.data[]} 的元素。
*
* <p>只声明判断「是否已存在、处于什么状态」需要的字段。</p>
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class ProductListItem {
/** 产品 SKU。 */
@JsonProperty("product_no")
public String productNo;
/** 产品状态:0 临时产品 / 1 正式产品。 */
@JsonProperty("state")
public String state;
}
}