From c2bca10e8a52132f633d8e44f787f7218e07b96c Mon Sep 17 00:00:00 2001 From: minghui <1229660539@qq.com> Date: Mon, 14 Aug 2023 15:47:01 +0800 Subject: [PATCH 1/4] delete QueryOrderReq --- .../avatasdk/model/order/QueryOrderReq.java | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 src/main/java/ai/bianjie/avatasdk/model/order/QueryOrderReq.java diff --git a/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrderReq.java b/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrderReq.java deleted file mode 100644 index 593332b..0000000 --- a/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrderReq.java +++ /dev/null @@ -1,18 +0,0 @@ -package ai.bianjie.avatasdk.model.order; - -import com.alibaba.fastjson.annotation.JSONField; - -public class QueryOrderReq { - @JSONField(name = "offset") - private Integer offset;// 游标,默认为 0 - @JSONField(name = "limit") - private Integer limit;// 每页记录数,默认为 10,上限为 50 - @JSONField(name = "status") - private Integer status; - @JSONField(name = "start_date") - private Integer startDate; - @JSONField(name = "end_date") - private Integer endDate; - @JSONField(name = "sort_by") - private Integer sortBy; -} From d75f2c711550506d7397bf845656e4dec329a0ae Mon Sep 17 00:00:00 2001 From: minghui <1229660539@qq.com> Date: Mon, 14 Aug 2023 15:48:16 +0800 Subject: [PATCH 2/4] update QueryOrderRes --- .../ai/bianjie/avatasdk/model/order/QueryOrderRes.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrderRes.java b/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrderRes.java index 7f8c3e2..80638cb 100644 --- a/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrderRes.java +++ b/src/main/java/ai/bianjie/avatasdk/model/order/QueryOrderRes.java @@ -1,21 +1,22 @@ package ai.bianjie.avatasdk.model.order; import com.alibaba.fastjson.annotation.JSONField; +import lombok.Data; import lombok.NoArgsConstructor; /** * 查询能量值/业务费购买结果接口返回值 */ @NoArgsConstructor -@lombok.Data +@Data public class QueryOrderRes { @JSONField(name = "data") - private Data data; + private DataDTO data; @NoArgsConstructor - @lombok.Data - public static class Data { + @Data + public static class DataDTO { @JSONField(name = "order_id") private String orderId;// 订单流水号 @JSONField(name = "status") From ff5d6ccae0f85b0bf8dc90d0de001fc0810b0aaa Mon Sep 17 00:00:00 2001 From: minghui <1229660539@qq.com> Date: Mon, 14 Aug 2023 16:13:29 +0800 Subject: [PATCH 3/4] =?UTF-8?q?update=20AvataException=E3=80=81HttpClient?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ai/bianjie/avatasdk/exception/AvataException.java | 9 ++++++--- src/main/java/ai/bianjie/avatasdk/util/HttpClient.java | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/ai/bianjie/avatasdk/exception/AvataException.java b/src/main/java/ai/bianjie/avatasdk/exception/AvataException.java index 019c427..2527b29 100644 --- a/src/main/java/ai/bianjie/avatasdk/exception/AvataException.java +++ b/src/main/java/ai/bianjie/avatasdk/exception/AvataException.java @@ -10,7 +10,7 @@ */ @Data public class AvataException extends RuntimeException { - private static final String CodeSpace = "AVATA-SDK-JAVA"; + private static final String CodeSpace = "AVATA-SDK"; private static final String BadRequest = "BAD_REQUEST"; private static final String UnknownError = "UNKNOWN_ERROR"; private static final String TimeoutError = "TIMEOUT_ERROR"; @@ -34,20 +34,23 @@ public AvataException(String code, String codeSpace, String message) { this.code = code; } + // 来自 Avata SDK 返回的报错信息 public static AvataException NewSDKException(String errorMessage) { return new AvataException(UnknownError, CodeSpace, errorMessage); } - public static AvataException NewHTTPException(ErrorResponse.AvataError avataError) { + // 来自 Avata OPEN API 返回的报错信息 + public static AvataException NewClientException(ErrorResponse.AvataError avataError) { return new AvataException(avataError.getCode(), avataError.getCodeSpace(), avataError.getMessage()); } + // 来自 Avata SDK 返回的报错信息,必填参数校验 public static AvataException InvalidParamException(String errorMessage) { return new AvataException(BadRequest, CodeSpace, errorMessage); } + // 来自 Avata SDK 返回的报错信息,HTTP 连接超时报错 public static AvataException TimeOutException() { return new AvataException(TimeoutError, CodeSpace, "request timeout"); } - } diff --git a/src/main/java/ai/bianjie/avatasdk/util/HttpClient.java b/src/main/java/ai/bianjie/avatasdk/util/HttpClient.java index fdbfb37..baa2a28 100644 --- a/src/main/java/ai/bianjie/avatasdk/util/HttpClient.java +++ b/src/main/java/ai/bianjie/avatasdk/util/HttpClient.java @@ -135,7 +135,7 @@ public static void validateResponse(ForestResponse response) { throw AvataException.NewSDKException(response.getException().getMessage()); } ErrorResponse res = JSONObject.parseObject(response.getContent(), ErrorResponse.class); - throw AvataException.NewHTTPException(res.getError()); + throw AvataException.NewClientException(res.getError()); } } } From d77126d3ca9f99187a95b85fd2da7ab00919806a Mon Sep 17 00:00:00 2001 From: minghui <1229660539@qq.com> Date: Mon, 14 Aug 2023 16:30:04 +0800 Subject: [PATCH 4/4] update QueryMtHistoryReq --- .../bianjie/avatasdk/model/mt/QueryMtHistoryReq.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtHistoryReq.java b/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtHistoryReq.java index cc67aca..5be3821 100644 --- a/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtHistoryReq.java +++ b/src/main/java/ai/bianjie/avatasdk/model/mt/QueryMtHistoryReq.java @@ -15,15 +15,15 @@ public class QueryMtHistoryReq { @JSONField(name = "limit") private Integer limit;// 每页记录数,默认为 10,上限为 50 @JSONField(name = "signer") - private Integer signer;// Tx 签名者地址 + private String signer;// Tx 签名者地址 @JSONField(name = "tx_hash") - private Integer txHash;// MT 操作 Tx Hash + private String txHash;// MT 操作 Tx Hash @JSONField(name = "operation") - private Integer operation;// 操作类型: issue(首发MT) / mint(增发MT) / edit(编辑MT) / transfer(转让MT) / burn(销毁MT) + private String operation;// 操作类型: issue(首发MT) / mint(增发MT) / edit(编辑MT) / transfer(转让MT) / burn(销毁MT) @JSONField(name = "start_date") - private Integer startDate;// MT 操作日期范围 - 开始,yyyy-MM-dd(UTC 时间) + private String startDate;// MT 操作日期范围 - 开始,yyyy-MM-dd(UTC 时间) @JSONField(name = "end_date") - private Integer endDate;// MT 操作日期范围 - 结束,yyyy-MM-dd(UTC 时间) + private String endDate;// MT 操作日期范围 - 结束,yyyy-MM-dd(UTC 时间) @JSONField(name = "sort_by") - private Integer sortBy;// 排序规则:DATE_ASC / DATE_DESC + private String sortBy;// 排序规则:DATE_ASC / DATE_DESC }