From e061da577a6454b36ad8f7e2f2ada94be2619e7b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 31 May 2026 14:17:57 +0000 Subject: [PATCH 1/2] Initial plan From 693f417d8fdd9c663ccbe9b5cd6845f3b1d47601 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 31 May 2026 14:24:50 +0000 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E5=B0=8F=E5=BA=97=E5=B8=A6=E8=B4=A7=E5=8A=A9=E6=89=8B?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weixin/channel/api/WxChannelService.java | 7 + .../weixin/channel/api/WxTalentService.java | 56 +++++ .../api/impl/BaseWxChannelServiceImpl.java | 9 + .../channel/api/impl/WxTalentServiceImpl.java | 59 +++++ .../bean/talent/TalentOrderDetailParam.java | 32 +++ .../talent/TalentOrderDetailResponse.java | 203 ++++++++++++++++++ .../bean/talent/TalentOrderListParam.java | 52 +++++ .../bean/talent/TalentOrderListResponse.java | 54 +++++ .../TalentWindowProductDetailParam.java | 24 +++ .../TalentWindowProductDetailResponse.java | 81 +++++++ .../talent/TalentWindowProductListParam.java | 32 +++ .../TalentWindowProductListResponse.java | 58 +++++ .../constant/WxChannelApiUrlConstants.java | 26 +++ .../api/impl/WxTalentServiceImplTest.java | 70 ++++++ 14 files changed, 763 insertions(+) create mode 100644 weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxTalentService.java create mode 100644 weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxTalentServiceImpl.java create mode 100644 weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentOrderDetailParam.java create mode 100644 weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentOrderDetailResponse.java create mode 100644 weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentOrderListParam.java create mode 100644 weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentOrderListResponse.java create mode 100644 weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentWindowProductDetailParam.java create mode 100644 weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentWindowProductDetailResponse.java create mode 100644 weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentWindowProductListParam.java create mode 100644 weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentWindowProductListResponse.java create mode 100644 weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxTalentServiceImplTest.java diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelService.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelService.java index 50a029c196..92f5384f68 100644 --- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelService.java +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelService.java @@ -182,4 +182,11 @@ public interface WxChannelService extends BaseWxChannelService { */ WxChannelLiveDashboardService getLiveDashboardService(); + /** + * 微信小店-带货助手服务 + * + * @return 带货助手服务 + */ + WxTalentService getTalentService(); + } diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxTalentService.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxTalentService.java new file mode 100644 index 0000000000..e03cdbf502 --- /dev/null +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxTalentService.java @@ -0,0 +1,56 @@ +package me.chanjar.weixin.channel.api; + +import me.chanjar.weixin.channel.bean.talent.TalentOrderDetailParam; +import me.chanjar.weixin.channel.bean.talent.TalentOrderDetailResponse; +import me.chanjar.weixin.channel.bean.talent.TalentOrderListParam; +import me.chanjar.weixin.channel.bean.talent.TalentOrderListResponse; +import me.chanjar.weixin.channel.bean.talent.TalentWindowProductDetailParam; +import me.chanjar.weixin.channel.bean.talent.TalentWindowProductDetailResponse; +import me.chanjar.weixin.channel.bean.talent.TalentWindowProductListParam; +import me.chanjar.weixin.channel.bean.talent.TalentWindowProductListResponse; +import me.chanjar.weixin.common.error.WxErrorException; + +/** + * 微信小店-带货助手服务接口 + * + * @author GitHub Copilot + */ +public interface WxTalentService { + + /** + * 获取佣金单列表 + * + * @param param 查询参数 + * @return 佣金单列表 + * @throws WxErrorException 接口调用异常 + */ + TalentOrderListResponse getOrderList(TalentOrderListParam param) throws WxErrorException; + + /** + * 获取佣金单详情 + * + * @param param 查询参数 + * @return 佣金单详情 + * @throws WxErrorException 接口调用异常 + */ + TalentOrderDetailResponse getOrderDetail(TalentOrderDetailParam param) throws WxErrorException; + + /** + * 获取达人橱窗商品列表 + * + * @param param 查询参数 + * @return 橱窗商品列表 + * @throws WxErrorException 接口调用异常 + */ + TalentWindowProductListResponse getWindowProductList(TalentWindowProductListParam param) throws WxErrorException; + + /** + * 获取达人橱窗商品详情 + * + * @param param 查询参数 + * @return 橱窗商品详情 + * @throws WxErrorException 接口调用异常 + */ + TalentWindowProductDetailResponse getWindowProductDetail(TalentWindowProductDetailParam param) + throws WxErrorException; +} diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelServiceImpl.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelServiceImpl.java index 1a608e1f6a..8775b6a4f8 100644 --- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelServiceImpl.java +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelServiceImpl.java @@ -60,6 +60,7 @@ public abstract class BaseWxChannelServiceImpl implements WxChannelService private WxChannelVipService vipService = null; private WxChannelCompassFinderService compassFinderService = null; private WxChannelLiveDashboardService liveDashboardService = null; + private WxTalentService talentService = null; protected WxChannelConfig config; private int retrySleepMillis = 1000; @@ -473,4 +474,12 @@ public synchronized WxChannelLiveDashboardService getLiveDashboardService() { return liveDashboardService; } + @Override + public synchronized WxTalentService getTalentService() { + if (talentService == null) { + talentService = new WxTalentServiceImpl(this); + } + return talentService; + } + } diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxTalentServiceImpl.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxTalentServiceImpl.java new file mode 100644 index 0000000000..6bb623e9a4 --- /dev/null +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxTalentServiceImpl.java @@ -0,0 +1,59 @@ +package me.chanjar.weixin.channel.api.impl; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.channel.api.WxTalentService; +import me.chanjar.weixin.channel.bean.talent.TalentOrderDetailParam; +import me.chanjar.weixin.channel.bean.talent.TalentOrderDetailResponse; +import me.chanjar.weixin.channel.bean.talent.TalentOrderListParam; +import me.chanjar.weixin.channel.bean.talent.TalentOrderListResponse; +import me.chanjar.weixin.channel.bean.talent.TalentWindowProductDetailParam; +import me.chanjar.weixin.channel.bean.talent.TalentWindowProductDetailResponse; +import me.chanjar.weixin.channel.bean.talent.TalentWindowProductListParam; +import me.chanjar.weixin.channel.bean.talent.TalentWindowProductListResponse; +import me.chanjar.weixin.channel.util.ResponseUtils; +import me.chanjar.weixin.common.error.WxErrorException; + +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Talent.GET_ORDER_DETAIL_URL; +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Talent.GET_ORDER_LIST_URL; +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Talent.GET_WINDOW_PRODUCT_DETAIL_URL; +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Talent.GET_WINDOW_PRODUCT_LIST_URL; + +/** + * 微信小店-带货助手服务实现 + * + * @author GitHub Copilot + */ +@RequiredArgsConstructor +@Slf4j +public class WxTalentServiceImpl implements WxTalentService { + + /** 微信商店服务 */ + private final BaseWxChannelServiceImpl shopService; + + @Override + public TalentOrderListResponse getOrderList(TalentOrderListParam param) throws WxErrorException { + String resJson = shopService.post(GET_ORDER_LIST_URL, param); + return ResponseUtils.decode(resJson, TalentOrderListResponse.class); + } + + @Override + public TalentOrderDetailResponse getOrderDetail(TalentOrderDetailParam param) throws WxErrorException { + String resJson = shopService.post(GET_ORDER_DETAIL_URL, param); + return ResponseUtils.decode(resJson, TalentOrderDetailResponse.class); + } + + @Override + public TalentWindowProductListResponse getWindowProductList(TalentWindowProductListParam param) + throws WxErrorException { + String resJson = shopService.post(GET_WINDOW_PRODUCT_LIST_URL, param); + return ResponseUtils.decode(resJson, TalentWindowProductListResponse.class); + } + + @Override + public TalentWindowProductDetailResponse getWindowProductDetail(TalentWindowProductDetailParam param) + throws WxErrorException { + String resJson = shopService.post(GET_WINDOW_PRODUCT_DETAIL_URL, param); + return ResponseUtils.decode(resJson, TalentWindowProductDetailResponse.class); + } +} diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentOrderDetailParam.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentOrderDetailParam.java new file mode 100644 index 0000000000..8f37fa0eb2 --- /dev/null +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentOrderDetailParam.java @@ -0,0 +1,32 @@ +package me.chanjar.weixin.channel.bean.talent; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.Serializable; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 带货助手-获取佣金单详情 请求参数 + * + * @author GitHub Copilot + */ +@Data +@NoArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class TalentOrderDetailParam implements Serializable { + + private static final long serialVersionUID = 8741285036412736219L; + + /** 订单号,可从获取佣金单列表接口获得 */ + @JsonProperty("order_id") + private String orderId; + + /** 商品skuid,可从获取佣金单列表接口获得 */ + @JsonProperty("sku_id") + private String skuId; + + /** 订单额外参数【在订单列表里面返回的参数回传】 */ + @JsonProperty("special_id") + private String specialId; +} diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentOrderDetailResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentOrderDetailResponse.java new file mode 100644 index 0000000000..1e0f2d2c28 --- /dev/null +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentOrderDetailResponse.java @@ -0,0 +1,203 @@ +package me.chanjar.weixin.channel.bean.talent; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse; + +/** + * 带货助手-获取佣金单详情 响应 + * + * @author GitHub Copilot + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class TalentOrderDetailResponse extends WxChannelBaseResponse { + + private static final long serialVersionUID = 2174806923145876312L; + + /** 订单基础信息 */ + @JsonProperty("base_info") + private BaseInfo baseInfo; + + /** 订单佣金信息 */ + @JsonProperty("commission_info") + private CommissionInfo commissionInfo; + + /** 下单通道信息 */ + @JsonProperty("channel_info") + private ChannelInfo channelInfo; + + /** 内容推广推客机构信息 */ + @JsonProperty("promotion_head_supplier_info") + private PromotionHeadSupplierInfo promotionHeadSupplierInfo; + + /** 商品信息 */ + @JsonProperty("product_info") + private ProductInfo productInfo; + + /** 订单基础信息 */ + @Data + @NoArgsConstructor + public static class BaseInfo implements Serializable { + + private static final long serialVersionUID = 6382947162830498251L; + + /** 订单id */ + @JsonProperty("order_id") + private String orderId; + + /** 商品spuid */ + @JsonProperty("spu_id") + private String spuId; + + /** 商品skuid */ + @JsonProperty("sku_id") + private String skuId; + + /** 特殊id【针对本地生活】 */ + @JsonProperty("special_id") + private String specialId; + + /** + * 订单状态:1=待支付, 2=待发货, 3=已发货, 4=已收货, 5=售后中, 6=已完成, 7=已取消, 8=已退款, 9=部分退款, 10=待使用 + */ + @JsonProperty("order_status") + private Integer orderStatus; + + /** 实际支付金额【单位:分】 */ + @JsonProperty("actual_payment") + private String actualPayment; + + /** 订单创建时间 */ + @JsonProperty("order_create_time") + private Long orderCreateTime; + + /** 订单更新时间 */ + @JsonProperty("order_update_time") + private Long orderUpdateTime; + + /** 下单用户 */ + @JsonProperty("buyer_info") + private BuyerInfo buyerInfo; + + /** 订单支付时间 */ + @JsonProperty("order_pay_time") + private Long orderPayTime; + + /** 订单的分佣基数【单位:分】 */ + @JsonProperty("settle_payment") + private String settlePayment; + } + + /** 下单用户信息 */ + @Data + @NoArgsConstructor + public static class BuyerInfo implements Serializable { + + private static final long serialVersionUID = 4729638451027364819L; + + /** 下单用户的openid */ + @JsonProperty("open_id") + private String openId; + + /** 下单用户的unionid */ + @JsonProperty("union_id") + private String unionId; + } + + /** 订单佣金信息 */ + @Data + @NoArgsConstructor + public static class CommissionInfo implements Serializable { + + private static final long serialVersionUID = -3819264037182640581L; + + /** 佣金单状态:1=待结算, 2=已结算, 3=取消结算, 4=结算异常 */ + @JsonProperty("state") + private Integer state; + + /** 佣金比例 */ + @JsonProperty("ratio") + private String ratio; + + /** 预期结算时间 */ + @JsonProperty("expect_settle_time") + private Long expectSettleTime; + + /** 预期结算金额 */ + @JsonProperty("expect_settlement") + private String expectSettlement; + + /** 实际结算时间 */ + @JsonProperty("actual_settle_time") + private Long actualSettleTime; + + /** 实际结算金额 */ + @JsonProperty("actual_settlement") + private String actualSettlement; + } + + /** 下单通道信息 */ + @Data + @NoArgsConstructor + public static class ChannelInfo implements Serializable { + + private static final long serialVersionUID = 7364918204736159023L; + + /** 渠道类型:1=视频号, 2=公众号 */ + @JsonProperty("channel_type") + private Integer channelType; + + /** 渠道id */ + @JsonProperty("channel_id") + private String channelId; + + /** 渠道名称 */ + @JsonProperty("channel_name") + private String channelName; + } + + /** 内容推广推客机构信息 */ + @Data + @NoArgsConstructor + public static class PromotionHeadSupplierInfo implements Serializable { + + private static final long serialVersionUID = 1826374950183647291L; + + /** 机构id */ + @JsonProperty("id") + private String id; + + /** 机构名称 */ + @JsonProperty("name") + private String name; + + /** 佣金单比例 */ + @JsonProperty("ratio") + private String ratio; + + /** 佣金 */ + @JsonProperty("fee") + private String fee; + } + + /** 商品信息 */ + @Data + @NoArgsConstructor + public static class ProductInfo implements Serializable { + + private static final long serialVersionUID = -4920183645872916370L; + + /** 商品的标题 */ + @JsonProperty("title") + private String title; + + /** 商品的头图 */ + @JsonProperty("thumb_img") + private String thumbImg; + } +} diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentOrderListParam.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentOrderListParam.java new file mode 100644 index 0000000000..a780d92be5 --- /dev/null +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentOrderListParam.java @@ -0,0 +1,52 @@ +package me.chanjar.weixin.channel.bean.talent; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.Serializable; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 带货助手-获取佣金单列表 请求参数 + * + * @author GitHub Copilot + */ +@Data +@NoArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class TalentOrderListParam implements Serializable { + + private static final long serialVersionUID = -6218342185316399261L; + + /** 佣金单创建时间范围之开始时间【和更新时间范围二选一】 */ + @JsonProperty("create_time_gt") + private Long createTimeGt; + + /** 佣金单创建时间范围之结束时间【和更新时间范围二选一】 */ + @JsonProperty("create_time_lt") + private Long createTimeLt; + + /** 订单 ID 过滤 */ + @JsonProperty("order_id") + private String orderId; + + /** 商品 id 过滤 */ + @JsonProperty("spu_id") + private String spuId; + + /** 佣金单更新时间范围之开始时间【和创建时间范围二选一】 */ + @JsonProperty("update_time_gt") + private Long updateTimeGt; + + /** 佣金单更新时间范围之结束时间【和创建时间范围二选一】 */ + @JsonProperty("update_time_lt") + private Long updateTimeLt; + + /** 单页佣金单数(不超过10) */ + @JsonProperty("page_size") + private Integer pageSize; + + /** 由上次请求返回,顺序翻页时需要传入, 会从上次返回的结果往后翻一页 */ + @JsonProperty("next_key") + private String nextKey; +} diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentOrderListResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentOrderListResponse.java new file mode 100644 index 0000000000..8393ba656a --- /dev/null +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentOrderListResponse.java @@ -0,0 +1,54 @@ +package me.chanjar.weixin.channel.bean.talent; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.Serializable; +import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse; + +/** + * 带货助手-获取佣金单列表 响应 + * + * @author GitHub Copilot + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class TalentOrderListResponse extends WxChannelBaseResponse { + + private static final long serialVersionUID = 3541802319654186172L; + + /** 佣金单信息列表 */ + @JsonProperty("order_list") + private List orderList; + + /** 是否还有剩余订单 */ + @JsonProperty("has_more") + private Boolean hasMore; + + /** 本次翻页的上下文,用于顺序翻页请求 */ + @JsonProperty("next_key") + private String nextKey; + + /** 佣金单基础信息 */ + @Data + @NoArgsConstructor + public static class OrderInfo implements Serializable { + + private static final long serialVersionUID = 5261736494628827543L; + + /** 订单id */ + @JsonProperty("order_id") + private String orderId; + + /** skuid */ + @JsonProperty("sku_id") + private String skuId; + + /** 佣金单特殊标识【目前主要用于本地生活】 */ + @JsonProperty("special_id") + private String specialId; + } +} diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentWindowProductDetailParam.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentWindowProductDetailParam.java new file mode 100644 index 0000000000..5f7bca423e --- /dev/null +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentWindowProductDetailParam.java @@ -0,0 +1,24 @@ +package me.chanjar.weixin.channel.bean.talent; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.Serializable; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 带货助手-获取达人橱窗商品详情 请求参数 + * + * @author GitHub Copilot + */ +@Data +@NoArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class TalentWindowProductDetailParam implements Serializable { + + private static final long serialVersionUID = 3849271605183749261L; + + /** 橱窗商品ID(可以从"获取达人橱窗商品列表"接口获取) */ + @JsonProperty("product_id") + private String productId; +} diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentWindowProductDetailResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentWindowProductDetailResponse.java new file mode 100644 index 0000000000..c41f2f1de5 --- /dev/null +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentWindowProductDetailResponse.java @@ -0,0 +1,81 @@ +package me.chanjar.weixin.channel.bean.talent; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse; + +/** + * 带货助手-获取达人橱窗商品详情 响应 + * + * @author GitHub Copilot + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class TalentWindowProductDetailResponse extends WxChannelBaseResponse { + + private static final long serialVersionUID = 1634829710537264918L; + + /** 橱窗商品详情 */ + @JsonProperty("product") + private ProductDetail product; + + /** 橱窗商品详情 */ + @Data + @NoArgsConstructor + public static class ProductDetail implements Serializable { + + private static final long serialVersionUID = 7283640192847516039L; + + /** 橱窗商品ID */ + @JsonProperty("product_id") + private String productId; + + /** 商品来源店铺的appid */ + @JsonProperty("appid") + private String appid; + + /** 商品在货源店铺的商品ID,对于带货商品会返回 */ + @JsonProperty("out_product_id") + private String outProductId; + + /** 商品标题 */ + @JsonProperty("title") + private String title; + + /** 商品头图url */ + @JsonProperty("img_url") + private String imgUrl; + + /** 商品所属叶子类目(品类)ID */ + @JsonProperty("leaf_category_id") + private Long leafCategoryId; + + /** 商品状态:1=生效中,2=被禁止售卖 */ + @JsonProperty("status") + private Integer status; + + /** 价格区间最小值(单位分,销售价) */ + @JsonProperty("selling_price") + private Long sellingPrice; + + /** 剩余库存 */ + @JsonProperty("stock") + private Long stock; + + /** 销量 */ + @JsonProperty("sales") + private Long sales; + + /** 是否在橱窗设置对外隐藏 */ + @JsonProperty("is_hide") + private Boolean isHide; + + /** 用于在小程序跳转小店场景添加商品时传递跟佣信息 */ + @JsonProperty("product_promotion_link") + private String productPromotionLink; + } +} diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentWindowProductListParam.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentWindowProductListParam.java new file mode 100644 index 0000000000..bb6e77bb7f --- /dev/null +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentWindowProductListParam.java @@ -0,0 +1,32 @@ +package me.chanjar.weixin.channel.bean.talent; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.Serializable; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 带货助手-获取达人橱窗商品列表 请求参数 + * + * @author GitHub Copilot + */ +@Data +@NoArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +public class TalentWindowProductListParam implements Serializable { + + private static final long serialVersionUID = 7419836250174638291L; + + /** 单页商品数(不超过500) */ + @JsonProperty("page_size") + private Integer pageSize; + + /** 页面下标,下标从1开始(不可以与 lastBuffer 一起填写) */ + @JsonProperty("page_index") + private Integer pageIndex; + + /** 由上次请求返回,顺序翻页时需要传入(不可以与 pageIndex 一起填写) */ + @JsonProperty("last_buffer") + private String lastBuffer; +} diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentWindowProductListResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentWindowProductListResponse.java new file mode 100644 index 0000000000..3b925c2904 --- /dev/null +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/talent/TalentWindowProductListResponse.java @@ -0,0 +1,58 @@ +package me.chanjar.weixin.channel.bean.talent; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.Serializable; +import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse; + +/** + * 带货助手-获取达人橱窗商品列表 响应 + * + * @author GitHub Copilot + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class TalentWindowProductListResponse extends WxChannelBaseResponse { + + private static final long serialVersionUID = 8263047195826340712L; + + /** 橱窗商品列表 */ + @JsonProperty("products") + private List products; + + /** 本次翻页的上下文,用于顺序翻页请求 */ + @JsonProperty("last_buffer") + private String lastBuffer; + + /** 橱窗商品基础信息 */ + @Data + @NoArgsConstructor + public static class ProductInfo implements Serializable { + + private static final long serialVersionUID = 6142837490516284039L; + + /** 橱窗商品id */ + @JsonProperty("product_id") + private Long productId; + + /** 对于自营商品会返回,代表商品来源店铺的appid */ + @JsonProperty("appid") + private String appid; + + /** + * 对于带货商品会返回,代表商品在货源小店中的商品id + */ + @JsonProperty("product_source") + private Long productSource; + + /** + * 商品来源:1=来源店铺的自营商品,2=来源选品中心的带货商品 + */ + @JsonProperty("out_product_id") + private String outProductId; + } +} diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/WxChannelApiUrlConstants.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/WxChannelApiUrlConstants.java index 6c2076d85b..4818f67eea 100644 --- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/WxChannelApiUrlConstants.java +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/WxChannelApiUrlConstants.java @@ -550,6 +550,32 @@ public interface CompassFinder { String GET_SALE_PROFILE_DATA_URL = "https://api.weixin.qq.com/channels/ec/compass/finder/sale/profile/data/get"; } + /** + * 带货助手API + */ + public interface Talent { + + /** + * 获取佣金单列表 + */ + String GET_ORDER_LIST_URL = "https://api.weixin.qq.com/channels/ec/talent/get_order_list"; + + /** + * 获取佣金单详情 + */ + String GET_ORDER_DETAIL_URL = "https://api.weixin.qq.com/channels/ec/talent/get_order_detail"; + + /** + * 获取达人橱窗商品列表 + */ + String GET_WINDOW_PRODUCT_LIST_URL = "https://api.weixin.qq.com/channels/ec/talent/window/product/list/get"; + + /** + * 获取达人橱窗商品详情 + */ + String GET_WINDOW_PRODUCT_DETAIL_URL = "https://api.weixin.qq.com/channels/ec/talent/window/product/get"; + } + /** * 罗盘商家版API */ diff --git a/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxTalentServiceImplTest.java b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxTalentServiceImplTest.java new file mode 100644 index 0000000000..2e0b5ba781 --- /dev/null +++ b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxTalentServiceImplTest.java @@ -0,0 +1,70 @@ +package me.chanjar.weixin.channel.api.impl; + +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; + +import com.google.inject.Inject; +import me.chanjar.weixin.channel.api.WxChannelService; +import me.chanjar.weixin.channel.api.WxTalentService; +import me.chanjar.weixin.channel.bean.talent.TalentOrderDetailParam; +import me.chanjar.weixin.channel.bean.talent.TalentOrderDetailResponse; +import me.chanjar.weixin.channel.bean.talent.TalentOrderListParam; +import me.chanjar.weixin.channel.bean.talent.TalentOrderListResponse; +import me.chanjar.weixin.channel.bean.talent.TalentWindowProductDetailParam; +import me.chanjar.weixin.channel.bean.talent.TalentWindowProductDetailResponse; +import me.chanjar.weixin.channel.bean.talent.TalentWindowProductListParam; +import me.chanjar.weixin.channel.bean.talent.TalentWindowProductListResponse; +import me.chanjar.weixin.channel.test.ApiTestModule; +import me.chanjar.weixin.common.error.WxErrorException; +import org.testng.annotations.Guice; +import org.testng.annotations.Test; + +/** + * 带货助手服务测试 + * + * @author GitHub Copilot + */ +@Guice(modules = ApiTestModule.class) +public class WxTalentServiceImplTest { + + @Inject + private WxChannelService channelService; + + @Test + public void testGetOrderList() throws WxErrorException { + WxTalentService talentService = channelService.getTalentService(); + TalentOrderListParam param = new TalentOrderListParam(); + TalentOrderListResponse response = talentService.getOrderList(param); + assertNotNull(response); + assertTrue(response.isSuccess()); + } + + @Test + public void testGetOrderDetail() throws WxErrorException { + WxTalentService talentService = channelService.getTalentService(); + TalentOrderDetailParam param = new TalentOrderDetailParam(); + param.setOrderId(""); + TalentOrderDetailResponse response = talentService.getOrderDetail(param); + assertNotNull(response); + assertTrue(response.isSuccess()); + } + + @Test + public void testGetWindowProductList() throws WxErrorException { + WxTalentService talentService = channelService.getTalentService(); + TalentWindowProductListParam param = new TalentWindowProductListParam(); + TalentWindowProductListResponse response = talentService.getWindowProductList(param); + assertNotNull(response); + assertTrue(response.isSuccess()); + } + + @Test + public void testGetWindowProductDetail() throws WxErrorException { + WxTalentService talentService = channelService.getTalentService(); + TalentWindowProductDetailParam param = new TalentWindowProductDetailParam(); + param.setProductId(""); + TalentWindowProductDetailResponse response = talentService.getWindowProductDetail(param); + assertNotNull(response); + assertTrue(response.isSuccess()); + } +}