Skip to content

Commit 693f417

Browse files
authored
feat: 实现微信小店带货助手相关接口
1 parent e061da5 commit 693f417

14 files changed

Lines changed: 763 additions & 0 deletions

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelService.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,11 @@ public interface WxChannelService extends BaseWxChannelService {
182182
*/
183183
WxChannelLiveDashboardService getLiveDashboardService();
184184

185+
/**
186+
* 微信小店-带货助手服务
187+
*
188+
* @return 带货助手服务
189+
*/
190+
WxTalentService getTalentService();
191+
185192
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package me.chanjar.weixin.channel.api;
2+
3+
import me.chanjar.weixin.channel.bean.talent.TalentOrderDetailParam;
4+
import me.chanjar.weixin.channel.bean.talent.TalentOrderDetailResponse;
5+
import me.chanjar.weixin.channel.bean.talent.TalentOrderListParam;
6+
import me.chanjar.weixin.channel.bean.talent.TalentOrderListResponse;
7+
import me.chanjar.weixin.channel.bean.talent.TalentWindowProductDetailParam;
8+
import me.chanjar.weixin.channel.bean.talent.TalentWindowProductDetailResponse;
9+
import me.chanjar.weixin.channel.bean.talent.TalentWindowProductListParam;
10+
import me.chanjar.weixin.channel.bean.talent.TalentWindowProductListResponse;
11+
import me.chanjar.weixin.common.error.WxErrorException;
12+
13+
/**
14+
* 微信小店-带货助手服务接口
15+
*
16+
* @author <a href="https://github.com/features/copilot">GitHub Copilot</a>
17+
*/
18+
public interface WxTalentService {
19+
20+
/**
21+
* <a href="https://developers.weixin.qq.com/doc/store/talent/openapi/order/api_get_order_list.html">获取佣金单列表</a>
22+
*
23+
* @param param 查询参数
24+
* @return 佣金单列表
25+
* @throws WxErrorException 接口调用异常
26+
*/
27+
TalentOrderListResponse getOrderList(TalentOrderListParam param) throws WxErrorException;
28+
29+
/**
30+
* <a href="https://developers.weixin.qq.com/doc/store/talent/openapi/order/api_get_order_detail.html">获取佣金单详情</a>
31+
*
32+
* @param param 查询参数
33+
* @return 佣金单详情
34+
* @throws WxErrorException 接口调用异常
35+
*/
36+
TalentOrderDetailResponse getOrderDetail(TalentOrderDetailParam param) throws WxErrorException;
37+
38+
/**
39+
* <a href="https://developers.weixin.qq.com/doc/store/talent/openapi/window/api_get_product_list.html">获取达人橱窗商品列表</a>
40+
*
41+
* @param param 查询参数
42+
* @return 橱窗商品列表
43+
* @throws WxErrorException 接口调用异常
44+
*/
45+
TalentWindowProductListResponse getWindowProductList(TalentWindowProductListParam param) throws WxErrorException;
46+
47+
/**
48+
* <a href="https://developers.weixin.qq.com/doc/store/talent/openapi/window/api_get_product_detail.html">获取达人橱窗商品详情</a>
49+
*
50+
* @param param 查询参数
51+
* @return 橱窗商品详情
52+
* @throws WxErrorException 接口调用异常
53+
*/
54+
TalentWindowProductDetailResponse getWindowProductDetail(TalentWindowProductDetailParam param)
55+
throws WxErrorException;
56+
}

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelServiceImpl.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public abstract class BaseWxChannelServiceImpl<H, P> implements WxChannelService
6060
private WxChannelVipService vipService = null;
6161
private WxChannelCompassFinderService compassFinderService = null;
6262
private WxChannelLiveDashboardService liveDashboardService = null;
63+
private WxTalentService talentService = null;
6364

6465
protected WxChannelConfig config;
6566
private int retrySleepMillis = 1000;
@@ -473,4 +474,12 @@ public synchronized WxChannelLiveDashboardService getLiveDashboardService() {
473474
return liveDashboardService;
474475
}
475476

477+
@Override
478+
public synchronized WxTalentService getTalentService() {
479+
if (talentService == null) {
480+
talentService = new WxTalentServiceImpl(this);
481+
}
482+
return talentService;
483+
}
484+
476485
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package me.chanjar.weixin.channel.api.impl;
2+
3+
import lombok.RequiredArgsConstructor;
4+
import lombok.extern.slf4j.Slf4j;
5+
import me.chanjar.weixin.channel.api.WxTalentService;
6+
import me.chanjar.weixin.channel.bean.talent.TalentOrderDetailParam;
7+
import me.chanjar.weixin.channel.bean.talent.TalentOrderDetailResponse;
8+
import me.chanjar.weixin.channel.bean.talent.TalentOrderListParam;
9+
import me.chanjar.weixin.channel.bean.talent.TalentOrderListResponse;
10+
import me.chanjar.weixin.channel.bean.talent.TalentWindowProductDetailParam;
11+
import me.chanjar.weixin.channel.bean.talent.TalentWindowProductDetailResponse;
12+
import me.chanjar.weixin.channel.bean.talent.TalentWindowProductListParam;
13+
import me.chanjar.weixin.channel.bean.talent.TalentWindowProductListResponse;
14+
import me.chanjar.weixin.channel.util.ResponseUtils;
15+
import me.chanjar.weixin.common.error.WxErrorException;
16+
17+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Talent.GET_ORDER_DETAIL_URL;
18+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Talent.GET_ORDER_LIST_URL;
19+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Talent.GET_WINDOW_PRODUCT_DETAIL_URL;
20+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Talent.GET_WINDOW_PRODUCT_LIST_URL;
21+
22+
/**
23+
* 微信小店-带货助手服务实现
24+
*
25+
* @author <a href="https://github.com/features/copilot">GitHub Copilot</a>
26+
*/
27+
@RequiredArgsConstructor
28+
@Slf4j
29+
public class WxTalentServiceImpl implements WxTalentService {
30+
31+
/** 微信商店服务 */
32+
private final BaseWxChannelServiceImpl<?, ?> shopService;
33+
34+
@Override
35+
public TalentOrderListResponse getOrderList(TalentOrderListParam param) throws WxErrorException {
36+
String resJson = shopService.post(GET_ORDER_LIST_URL, param);
37+
return ResponseUtils.decode(resJson, TalentOrderListResponse.class);
38+
}
39+
40+
@Override
41+
public TalentOrderDetailResponse getOrderDetail(TalentOrderDetailParam param) throws WxErrorException {
42+
String resJson = shopService.post(GET_ORDER_DETAIL_URL, param);
43+
return ResponseUtils.decode(resJson, TalentOrderDetailResponse.class);
44+
}
45+
46+
@Override
47+
public TalentWindowProductListResponse getWindowProductList(TalentWindowProductListParam param)
48+
throws WxErrorException {
49+
String resJson = shopService.post(GET_WINDOW_PRODUCT_LIST_URL, param);
50+
return ResponseUtils.decode(resJson, TalentWindowProductListResponse.class);
51+
}
52+
53+
@Override
54+
public TalentWindowProductDetailResponse getWindowProductDetail(TalentWindowProductDetailParam param)
55+
throws WxErrorException {
56+
String resJson = shopService.post(GET_WINDOW_PRODUCT_DETAIL_URL, param);
57+
return ResponseUtils.decode(resJson, TalentWindowProductDetailResponse.class);
58+
}
59+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package me.chanjar.weixin.channel.bean.talent;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import java.io.Serializable;
6+
import lombok.Data;
7+
import lombok.NoArgsConstructor;
8+
9+
/**
10+
* 带货助手-获取佣金单详情 请求参数
11+
*
12+
* @author <a href="https://github.com/features/copilot">GitHub Copilot</a>
13+
*/
14+
@Data
15+
@NoArgsConstructor
16+
@JsonInclude(JsonInclude.Include.NON_NULL)
17+
public class TalentOrderDetailParam implements Serializable {
18+
19+
private static final long serialVersionUID = 8741285036412736219L;
20+
21+
/** 订单号,可从获取佣金单列表接口获得 */
22+
@JsonProperty("order_id")
23+
private String orderId;
24+
25+
/** 商品skuid,可从获取佣金单列表接口获得 */
26+
@JsonProperty("sku_id")
27+
private String skuId;
28+
29+
/** 订单额外参数【在订单列表里面返回的参数回传】 */
30+
@JsonProperty("special_id")
31+
private String specialId;
32+
}
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
package me.chanjar.weixin.channel.bean.talent;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import java.io.Serializable;
5+
import lombok.Data;
6+
import lombok.EqualsAndHashCode;
7+
import lombok.NoArgsConstructor;
8+
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
9+
10+
/**
11+
* 带货助手-获取佣金单详情 响应
12+
*
13+
* @author <a href="https://github.com/features/copilot">GitHub Copilot</a>
14+
*/
15+
@Data
16+
@NoArgsConstructor
17+
@EqualsAndHashCode(callSuper = true)
18+
public class TalentOrderDetailResponse extends WxChannelBaseResponse {
19+
20+
private static final long serialVersionUID = 2174806923145876312L;
21+
22+
/** 订单基础信息 */
23+
@JsonProperty("base_info")
24+
private BaseInfo baseInfo;
25+
26+
/** 订单佣金信息 */
27+
@JsonProperty("commission_info")
28+
private CommissionInfo commissionInfo;
29+
30+
/** 下单通道信息 */
31+
@JsonProperty("channel_info")
32+
private ChannelInfo channelInfo;
33+
34+
/** 内容推广推客机构信息 */
35+
@JsonProperty("promotion_head_supplier_info")
36+
private PromotionHeadSupplierInfo promotionHeadSupplierInfo;
37+
38+
/** 商品信息 */
39+
@JsonProperty("product_info")
40+
private ProductInfo productInfo;
41+
42+
/** 订单基础信息 */
43+
@Data
44+
@NoArgsConstructor
45+
public static class BaseInfo implements Serializable {
46+
47+
private static final long serialVersionUID = 6382947162830498251L;
48+
49+
/** 订单id */
50+
@JsonProperty("order_id")
51+
private String orderId;
52+
53+
/** 商品spuid */
54+
@JsonProperty("spu_id")
55+
private String spuId;
56+
57+
/** 商品skuid */
58+
@JsonProperty("sku_id")
59+
private String skuId;
60+
61+
/** 特殊id【针对本地生活】 */
62+
@JsonProperty("special_id")
63+
private String specialId;
64+
65+
/**
66+
* 订单状态:1=待支付, 2=待发货, 3=已发货, 4=已收货, 5=售后中, 6=已完成, 7=已取消, 8=已退款, 9=部分退款, 10=待使用
67+
*/
68+
@JsonProperty("order_status")
69+
private Integer orderStatus;
70+
71+
/** 实际支付金额【单位:分】 */
72+
@JsonProperty("actual_payment")
73+
private String actualPayment;
74+
75+
/** 订单创建时间 */
76+
@JsonProperty("order_create_time")
77+
private Long orderCreateTime;
78+
79+
/** 订单更新时间 */
80+
@JsonProperty("order_update_time")
81+
private Long orderUpdateTime;
82+
83+
/** 下单用户 */
84+
@JsonProperty("buyer_info")
85+
private BuyerInfo buyerInfo;
86+
87+
/** 订单支付时间 */
88+
@JsonProperty("order_pay_time")
89+
private Long orderPayTime;
90+
91+
/** 订单的分佣基数【单位:分】 */
92+
@JsonProperty("settle_payment")
93+
private String settlePayment;
94+
}
95+
96+
/** 下单用户信息 */
97+
@Data
98+
@NoArgsConstructor
99+
public static class BuyerInfo implements Serializable {
100+
101+
private static final long serialVersionUID = 4729638451027364819L;
102+
103+
/** 下单用户的openid */
104+
@JsonProperty("open_id")
105+
private String openId;
106+
107+
/** 下单用户的unionid */
108+
@JsonProperty("union_id")
109+
private String unionId;
110+
}
111+
112+
/** 订单佣金信息 */
113+
@Data
114+
@NoArgsConstructor
115+
public static class CommissionInfo implements Serializable {
116+
117+
private static final long serialVersionUID = -3819264037182640581L;
118+
119+
/** 佣金单状态:1=待结算, 2=已结算, 3=取消结算, 4=结算异常 */
120+
@JsonProperty("state")
121+
private Integer state;
122+
123+
/** 佣金比例 */
124+
@JsonProperty("ratio")
125+
private String ratio;
126+
127+
/** 预期结算时间 */
128+
@JsonProperty("expect_settle_time")
129+
private Long expectSettleTime;
130+
131+
/** 预期结算金额 */
132+
@JsonProperty("expect_settlement")
133+
private String expectSettlement;
134+
135+
/** 实际结算时间 */
136+
@JsonProperty("actual_settle_time")
137+
private Long actualSettleTime;
138+
139+
/** 实际结算金额 */
140+
@JsonProperty("actual_settlement")
141+
private String actualSettlement;
142+
}
143+
144+
/** 下单通道信息 */
145+
@Data
146+
@NoArgsConstructor
147+
public static class ChannelInfo implements Serializable {
148+
149+
private static final long serialVersionUID = 7364918204736159023L;
150+
151+
/** 渠道类型:1=视频号, 2=公众号 */
152+
@JsonProperty("channel_type")
153+
private Integer channelType;
154+
155+
/** 渠道id */
156+
@JsonProperty("channel_id")
157+
private String channelId;
158+
159+
/** 渠道名称 */
160+
@JsonProperty("channel_name")
161+
private String channelName;
162+
}
163+
164+
/** 内容推广推客机构信息 */
165+
@Data
166+
@NoArgsConstructor
167+
public static class PromotionHeadSupplierInfo implements Serializable {
168+
169+
private static final long serialVersionUID = 1826374950183647291L;
170+
171+
/** 机构id */
172+
@JsonProperty("id")
173+
private String id;
174+
175+
/** 机构名称 */
176+
@JsonProperty("name")
177+
private String name;
178+
179+
/** 佣金单比例 */
180+
@JsonProperty("ratio")
181+
private String ratio;
182+
183+
/** 佣金 */
184+
@JsonProperty("fee")
185+
private String fee;
186+
}
187+
188+
/** 商品信息 */
189+
@Data
190+
@NoArgsConstructor
191+
public static class ProductInfo implements Serializable {
192+
193+
private static final long serialVersionUID = -4920183645872916370L;
194+
195+
/** 商品的标题 */
196+
@JsonProperty("title")
197+
private String title;
198+
199+
/** 商品的头图 */
200+
@JsonProperty("thumb_img")
201+
private String thumbImg;
202+
}
203+
}

0 commit comments

Comments
 (0)