From 7a44b1541c56fa6bb88740ecb684e33144fea017 Mon Sep 17 00:00:00 2001 From: AllenWalker <5262097@qq.com> Date: Thu, 7 Jul 2022 14:01:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B4=B9=E7=94=A8?= =?UTF-8?q?=E8=B4=A6=E5=8D=95=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../order/GetSettleBillDetailV3Request.java | 140 +++++++++++ .../request/product/ProductDetailRequest.java | 53 ++++ .../alliance/GetOrderListResponse.java | 1 + .../order/GetSettleBillDetailV3Response.java | 238 ++++++++++++++++++ .../product/ProductDetailResponse.java | 17 ++ .../request/OrderSearchListRequestTest.java | 4 +- .../alliance/GetOrderListRequestTest.java | 4 +- .../request/product/SkuListRequestTest.java | 17 +- 9 files changed, 470 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/moming/douapisdk/request/order/GetSettleBillDetailV3Request.java create mode 100644 src/main/java/com/moming/douapisdk/request/product/ProductDetailRequest.java create mode 100644 src/main/java/com/moming/douapisdk/response/order/GetSettleBillDetailV3Response.java create mode 100644 src/main/java/com/moming/douapisdk/response/product/ProductDetailResponse.java diff --git a/pom.xml b/pom.xml index 721b80c..6feff3f 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.moming dou-api-sdk - 1.2.3 + 1.2.5 org.springframework.boot diff --git a/src/main/java/com/moming/douapisdk/request/order/GetSettleBillDetailV3Request.java b/src/main/java/com/moming/douapisdk/request/order/GetSettleBillDetailV3Request.java new file mode 100644 index 0000000..1980480 --- /dev/null +++ b/src/main/java/com/moming/douapisdk/request/order/GetSettleBillDetailV3Request.java @@ -0,0 +1,140 @@ +package com.moming.douapisdk.request.order; + +import com.moming.douapisdk.BaseDouYinRequest; +import com.moming.douapisdk.internal.util.DouYinHashMap; +import com.moming.douapisdk.response.order.GetSettleBillDetailV3Response; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springframework.util.CollectionUtils; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * 商家结算账单 + * + * 已结算的订单才会有数据,数据T+1生成,建议第二天12点之后查询。如因任务积压导致延迟的情况,建议重试。 + * + * @author lujingpo + * @date 2022/7/6 + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class GetSettleBillDetailV3Request extends BaseDouYinRequest { + + private final static DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + /** + * 查询页大小(默认100,最大为1000) + */ + private Long size; + + /** + * 查询开始时间,格式为:yyyy-MM-dd HH:mm:ss, + * 订单号未传的情况下,开始时间必须传,注意:分页查询时,除首次查询外,应填入上一次返回的next_start_time + */ + private LocalDateTime startTime; + + /** + * 查询结束时间,和end_time的时间间隔建议不超过7天,格式为:yyyy-MM-dd HH:mm:ss, + * 订单号未传的情况下,结束时间必须传 + */ + private LocalDateTime endTime; + + /** + * SKU单,子订单号,支持通过英文逗号分隔传入多个参数 + */ + private List orderId; + + /** + * 商品id + */ + private String productId; + + /** + * 结算账户,不传则 + * 默认为全部,枚举: + * 1(微信:升级前)、 + * 2(微信)、 + * 3(支付宝)、 + * 4(合众支付)、 + * 5(聚合账户), + * 支持通过英文逗号分隔传入多个参数 + */ + private String payType; + + /** + * 业务类型,不传则默认为全部,枚举: + * 1(鲁班广告)、 + * 2(值点商城), + * 3(精选联盟)、 + * 4(小店自卖) + */ + private String flowType; + + /** + * 时间类型 ,不传则默认为结算时间,枚举: 0(结算时间) 1(下单时间) + */ + private String timeType; + + /** + * 查询开始索引,注意: + * 分页查询时,除首次查询可不填外, + * 应填入上一次返回的next_start_index + */ + private String startIndex; + + /** + * 获取api的url地址 + * + * @return url地址 + */ + @Override + public String getApiUrl() { + return "/order/getSettleBillDetailV3"; + } + + /** + * 获取API的名称 + * + * @return API名称 + */ + @Override + public String getApiMethodName() { + return "order.getSettleBillDetailV3"; + } + + /** + * 获取所有的key-value形式的文本请求参数集合,其中: + *
    + *
  • Key: 请求参数名
  • + *
  • Value: 请求参数值
  • + *
+ * + * @return 文本请求参数集合 + */ + @Override + public Map getTextParams() { + final DouYinHashMap map = new DouYinHashMap(); + map.put("size", size); + if (Objects.nonNull(startTime)) { + map.put("start_time", startTime.format(TIME_FORMATTER)); + } + if (Objects.nonNull(endTime)) { + map.put("start_time", endTime.format(TIME_FORMATTER)); + } + if (!CollectionUtils.isEmpty(orderId)) { + map.put("order_id", String.join(",", orderId)); + } + + map.put("product_id", productId); + map.put("pay_type", payType); + map.put("flow_type", flowType); + map.put("time_type", timeType); + map.put("start_index", startIndex); + return map; + } +} diff --git a/src/main/java/com/moming/douapisdk/request/product/ProductDetailRequest.java b/src/main/java/com/moming/douapisdk/request/product/ProductDetailRequest.java new file mode 100644 index 0000000..c0356ba --- /dev/null +++ b/src/main/java/com/moming/douapisdk/request/product/ProductDetailRequest.java @@ -0,0 +1,53 @@ +package com.moming.douapisdk.request.product; + +import com.moming.douapisdk.BaseDouYinRequest; +import com.moming.douapisdk.response.product.ProductDetailResponse; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Map; + +/** + * @author lujingpo + * @date 2022/5/13 + */ + +@Data +public class ProductDetailRequest extends BaseDouYinRequest { + + + + /** + * 获取api的url地址 + * + * @return url地址 + */ + @Override + public String getApiUrl() { + return null; + } + + /** + * 获取API的名称 + * + * @return API名称 + */ + @Override + public String getApiMethodName() { + return null; + } + + /** + * 获取所有的key-value形式的文本请求参数集合,其中: + *
    + *
  • Key: 请求参数名
  • + *
  • Value: 请求参数值
  • + *
+ * + * @return 文本请求参数集合 + */ + @Override + public Map getTextParams() { + return null; + } +} diff --git a/src/main/java/com/moming/douapisdk/response/alliance/GetOrderListResponse.java b/src/main/java/com/moming/douapisdk/response/alliance/GetOrderListResponse.java index 45cc9ce..9782060 100644 --- a/src/main/java/com/moming/douapisdk/response/alliance/GetOrderListResponse.java +++ b/src/main/java/com/moming/douapisdk/response/alliance/GetOrderListResponse.java @@ -16,6 +16,7 @@ import java.util.List; @Data public class GetOrderListResponse extends BaseDouYinResponse { + private static final long serialVersionUID = 8468534375624027142L; /** * 返回编码 */ diff --git a/src/main/java/com/moming/douapisdk/response/order/GetSettleBillDetailV3Response.java b/src/main/java/com/moming/douapisdk/response/order/GetSettleBillDetailV3Response.java new file mode 100644 index 0000000..4fc8348 --- /dev/null +++ b/src/main/java/com/moming/douapisdk/response/order/GetSettleBillDetailV3Response.java @@ -0,0 +1,238 @@ +package com.moming.douapisdk.response.order; + +import com.alibaba.fastjson.annotation.JSONField; +import com.moming.douapisdk.BaseDouYinResponse; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * @author lujingpo + * @date 2022/7/6 + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class GetSettleBillDetailV3Response extends BaseDouYinResponse { + private static final long serialVersionUID = 3557343171948553495L; + + /** + * 返回code 100000为成功,其他为失败 + * + */ + private String code; + + /** + * 返回信息描述,失败状态下会有失败描述 + */ + @JSONField(name = "code_msg") + private String codeMsg; + + /** + * 订单流水明细列表 + */ + private List data; + + /** + * 请求的size + */ + @JSONField(name = "data_size") + private String dataSize; + + /** + * 判断查询是否结束。0 未结束, 1 结束。 + * 未结束时,需要 + * 把next_start_index作为下一次请求的start_index,next_start_time作为下一次请求的start_time + */ + @JSONField(name = "is_end") + private String isEnd; + + /** + * 下一次查询start_index + */ + @JSONField(name = "next_start_index") + private String nextStartIndex; + + /** + * 下一次查询start_time + */ + @JSONField(name = "next_start_time") + private String nextStartTime; + + /** + * 请求的size + */ + private String size; + + + @Data + public static class SettleBillDetailV3 { + + /** + * 达人补贴(分) + */ + @JSONField(name = "author_coupon") + private Long authorCoupon; + /** + * 直播间站外推广(分) + */ + @JSONField(name = "channel_promotion_fee") + private Long channelPromotionFee; + /** + * 团长服务费(分) + */ + @JSONField(name = "colonel_service_fee") + private Long colonelServiceFee; + /** + * 佣金(分) + */ + private Long commission; + /** + * 业务类型: 鲁班广告、值点商城、精选联盟、小店自卖等 + */ + @JSONField(name = "flow_type_desc") + private String flowTypeDesc; + /** + * 渠道分成(分) + */ + @JSONField(name = "good_learn_channel_fee") + private Long goodLearnChannelFee; + /** + * 商品数量 + */ + @JSONField(name = "goods_count") + private Integer goodsCount; + /** + * 是否包含结算前退款 0:不包含 1:包含 + */ + @JSONField(name = "is_contains_refund_before_settle") + private Integer isContainsRefundBeforeSettle; + + /** + * 子订单号 + */ + @JSONField(name = "order_id") + private String orderId; + /** + * 下单时间 + */ + @JSONField(name = "order_time") + private String orderTime; + /** + * 订单类型:普通订单、尾款(尾款已支付)、尾款(已退款)、定金(已退款)、定金(尾款已支付)、定金(尾款未支付) + */ + @JSONField(name = "order_type") + private String orderType; + + /** + * 其他分成(学浪)(分) + */ + @JSONField(name = "other_sharing_amount") + private String otherSharingAmount; + /** + * 货款结算对应的账户类型: “聚合账户”“微信”“支付宝”“微信升级前”“合众支付”等 + */ + @JSONField(name = "pay_type_desc") + private String payTypeDesc; + /** + * 平台补贴(分) + */ + @JSONField(name = "platform_coupon") + private Long platformCoupon; + /** + * 平台服务费(分) + */ + @JSONField(name = "platform_service_fee") + private Long platformServiceFee; + /** + * 运费(分) + */ + @JSONField(name = "post_amount") + private Long postAmount; + /** + * 商品id + */ + @JSONField(name = "product_id") + private String productId; + /** + * 用户实付(分) + */ + @JSONField(name = "real_pay_amount") + private Long realPayAmount; + /** + * 结算前退款金额(分) (结算前退货+运费-店铺券) + */ + @JSONField(name = "refund_before_settle") + private Long refundBeforeSettle; + + /** + * 备注 + */ + private String remark; + /** + * 结算单号 + */ + @JSONField(name = "request_no") + private String requestNo; + /** + * 商家实收(分) + */ + @JSONField(name = "settle_amount") + private Long settleAmount; + /** + * 结算时间 + */ + @JSONField(name = "settle_time") + private String settleTime; + /** + * 店铺券(分) + */ + @JSONField(name = "shop_coupon") + private Long shopCoupon; + /** + * 订单号 + */ + @JSONField(name = "shop_order_id") + private String shopOrderId; + /** + * 订单总价(分) + */ + @JSONField(name = "total_amount") + private Long totalAmount; + /** + * 商品总价(分) + */ + @JSONField(name = "total_goods_amount") + private Long totalGoodsAmount; + /** + * 收入合计(分) + */ + @JSONField(name = "total_income") + private Long totalIncome; + /** + * 其他分成(学浪)(分) + */ + @JSONField(name = "total_outcome") + private Long totalOutcome; + /** + * 结算单类型 + * 0 :已结算 + * 1 :结算后退款-原路退回 + * 2: 保证金退款-支出退回 + * 3: 结算后退款-非原路退回 + */ + @JSONField(name = "trade_type") + private Integer tradeType; + /** + * DOU分期营销补贴(分) + */ + @JSONField(name = "zr_pay_promotion") + private Long zrPayPromotion; + + /** + * 抖音支付补贴(分) + */ + @JSONField(name = "zt_pay_promotion") + private String ztPayPromotion; + } +} diff --git a/src/main/java/com/moming/douapisdk/response/product/ProductDetailResponse.java b/src/main/java/com/moming/douapisdk/response/product/ProductDetailResponse.java new file mode 100644 index 0000000..bc8467f --- /dev/null +++ b/src/main/java/com/moming/douapisdk/response/product/ProductDetailResponse.java @@ -0,0 +1,17 @@ +package com.moming.douapisdk.response.product; + +import com.moming.douapisdk.BaseDouYinResponse; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author lujingpo + * @date 2022/5/13 + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class ProductDetailResponse extends BaseDouYinResponse { + private static final long serialVersionUID = -1532773510201791227L; + + +} diff --git a/src/test/java/com/moming/douapisdk/request/OrderSearchListRequestTest.java b/src/test/java/com/moming/douapisdk/request/OrderSearchListRequestTest.java index 104bbc8..1f5dc29 100644 --- a/src/test/java/com/moming/douapisdk/request/OrderSearchListRequestTest.java +++ b/src/test/java/com/moming/douapisdk/request/OrderSearchListRequestTest.java @@ -27,7 +27,7 @@ class OrderSearchListRequestTest { @Autowired private DouYinClient douYinClient; - private final String accessToken = "b7a02bea-b85b-4c45-8aca-1106f9c49f7e"; + // private final String accessToken = "b7a02bea-b85b-4c45-8aca-1106f9c49f7e"; @Test @@ -39,7 +39,7 @@ class OrderSearchListRequestTest { request.setPage(0); request.setSize(1); - OrderSearchListResponse execute = douYinClient.execute(request, accessToken); + OrderSearchListResponse execute = douYinClient.execute(request); assertNotNull(execute); } diff --git a/src/test/java/com/moming/douapisdk/request/alliance/GetOrderListRequestTest.java b/src/test/java/com/moming/douapisdk/request/alliance/GetOrderListRequestTest.java index 8af3507..551c981 100644 --- a/src/test/java/com/moming/douapisdk/request/alliance/GetOrderListRequestTest.java +++ b/src/test/java/com/moming/douapisdk/request/alliance/GetOrderListRequestTest.java @@ -22,12 +22,12 @@ class GetOrderListRequestTest { @Autowired private DouYinClient douYinClient; - private final String accessToken = "b7a02bea-b85b-4c45-8aca-1106f9c49f7e"; + // private final String accessToken = "2ba2eb8a-cd8d-4521-9a9c-fbe1916970e2"; @Test void testExecute() throws ApiException { GetOrderListRequest getOrderListRequest = new GetOrderListRequest(); - getOrderListRequest.setOrderIds(Lists.newArrayList("4889121367946007720")); + getOrderListRequest.setOrderIds(Lists.newArrayList("4919080139231403124")); GetOrderListResponse execute = douYinClient.execute(getOrderListRequest); System.out.println(execute.getDatas()); } diff --git a/src/test/java/com/moming/douapisdk/request/product/SkuListRequestTest.java b/src/test/java/com/moming/douapisdk/request/product/SkuListRequestTest.java index 4b24c00..7347778 100644 --- a/src/test/java/com/moming/douapisdk/request/product/SkuListRequestTest.java +++ b/src/test/java/com/moming/douapisdk/request/product/SkuListRequestTest.java @@ -2,12 +2,16 @@ package com.moming.douapisdk.request.product; import com.moming.douapisdk.ApiException; import com.moming.douapisdk.client.DouYinClient; +import com.moming.douapisdk.request.order.GetSettleBillDetailV3Request; +import com.moming.douapisdk.response.order.GetSettleBillDetailV3Response; import com.moming.douapisdk.response.product.SkuListResponse; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; +import java.util.Collections; + import static org.junit.jupiter.api.Assertions.*; /** @@ -24,9 +28,20 @@ class SkuListRequestTest { @Test void testInvoke() throws ApiException { SkuListRequest skuListRequest = new SkuListRequest(); - skuListRequest.setProductId(3511458752689786486L); + skuListRequest.setProductId(3540020826474726212L); SkuListResponse execute = douYinClient.execute(skuListRequest); assertNotNull(execute); } + + @Test + void testGetSettleBillDetailV3() throws ApiException { + GetSettleBillDetailV3Request request = new GetSettleBillDetailV3Request(); + request.setOrderId(Collections.singletonList("4950649583376942734")); + request.setSize(100L); + + GetSettleBillDetailV3Response execute = douYinClient.execute(request); + + assertNotNull(execute); + } } \ No newline at end of file -- Gitee From 154b0ed173459818a491a1749bbb933d7396679b Mon Sep 17 00:00:00 2001 From: AllenWalker <5262097@qq.com> Date: Tue, 16 Aug 2022 15:53:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../douapisdk/request/LogisticsAddRequestTest.java | 10 ++++++++-- .../douapisdk/request/OrderDetailNewRequestTest.java | 4 ++-- .../request/alliance/GetOrderListRequestTest.java | 2 +- .../douapisdk/request/product/SkuListRequestTest.java | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/test/java/com/moming/douapisdk/request/LogisticsAddRequestTest.java b/src/test/java/com/moming/douapisdk/request/LogisticsAddRequestTest.java index c01fa6d..c72d3b8 100644 --- a/src/test/java/com/moming/douapisdk/request/LogisticsAddRequestTest.java +++ b/src/test/java/com/moming/douapisdk/request/LogisticsAddRequestTest.java @@ -8,6 +8,7 @@ import com.moming.douapisdk.ApiException; import com.moming.douapisdk.client.DouYinClient; import com.moming.douapisdk.client.SelfUseDouYinClient; import com.moming.douapisdk.response.LogisticsAddResponse; +import com.moming.douapisdk.response.OrderLogisticsCompanyListResponse; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -26,7 +27,7 @@ import java.util.Map; * @date 2021/3/15 */ @SpringBootTest -@ActiveProfiles(value = "self-use") +@ActiveProfiles(value = "local") @Slf4j @ConditionalOnProperty(prefix = "spring.dou-yin", name = "is-self-use", havingValue = "true") class LogisticsAddRequestTest { @@ -35,7 +36,12 @@ class LogisticsAddRequestTest { @Autowired private DouYinClient defaultDouYinClient; - + @Test + void name() throws ApiException { + OrderLogisticsCompanyListRequest request = new OrderLogisticsCompanyListRequest(); + OrderLogisticsCompanyListResponse execute = defaultDouYinClient.execute(request); + System.out.println(execute); + } /** * 批量发货api接口 diff --git a/src/test/java/com/moming/douapisdk/request/OrderDetailNewRequestTest.java b/src/test/java/com/moming/douapisdk/request/OrderDetailNewRequestTest.java index 0bdd40c..f606090 100644 --- a/src/test/java/com/moming/douapisdk/request/OrderDetailNewRequestTest.java +++ b/src/test/java/com/moming/douapisdk/request/OrderDetailNewRequestTest.java @@ -31,9 +31,9 @@ class OrderDetailNewRequestTest { //4807770641499757618 OrderDetailNewRequest request = new OrderDetailNewRequest(); - request.setShopOrderId("4889121367946007720"); + request.setShopOrderId("4955862329347448785"); - OrderDetailNewResponse execute = douYinClient.execute(request, accessToken); + OrderDetailNewResponse execute = douYinClient.execute(request); assertNotNull(execute); } diff --git a/src/test/java/com/moming/douapisdk/request/alliance/GetOrderListRequestTest.java b/src/test/java/com/moming/douapisdk/request/alliance/GetOrderListRequestTest.java index 551c981..f82aa1c 100644 --- a/src/test/java/com/moming/douapisdk/request/alliance/GetOrderListRequestTest.java +++ b/src/test/java/com/moming/douapisdk/request/alliance/GetOrderListRequestTest.java @@ -27,7 +27,7 @@ class GetOrderListRequestTest { @Test void testExecute() throws ApiException { GetOrderListRequest getOrderListRequest = new GetOrderListRequest(); - getOrderListRequest.setOrderIds(Lists.newArrayList("4919080139231403124")); + getOrderListRequest.setOrderIds(Lists.newArrayList("4938754323566135196")); GetOrderListResponse execute = douYinClient.execute(getOrderListRequest); System.out.println(execute.getDatas()); } diff --git a/src/test/java/com/moming/douapisdk/request/product/SkuListRequestTest.java b/src/test/java/com/moming/douapisdk/request/product/SkuListRequestTest.java index 7347778..4286bbb 100644 --- a/src/test/java/com/moming/douapisdk/request/product/SkuListRequestTest.java +++ b/src/test/java/com/moming/douapisdk/request/product/SkuListRequestTest.java @@ -37,8 +37,8 @@ class SkuListRequestTest { @Test void testGetSettleBillDetailV3() throws ApiException { GetSettleBillDetailV3Request request = new GetSettleBillDetailV3Request(); - request.setOrderId(Collections.singletonList("4950649583376942734")); - request.setSize(100L); + request.setOrderId(Collections.singletonList("4882882833460698823")); + // request.setSize(100L); GetSettleBillDetailV3Response execute = douYinClient.execute(request); -- Gitee