Skip to content

Commit fae5cad

Browse files
authored
🆕 #3427【视频号】新增罗盘商家版API、微信小店合作账号API相关接口以及订单待发货消息回调
1 parent f72f748 commit fae5cad

File tree

62 files changed

+1869
-34
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1869
-34
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
- 微信开放平台:`weixin-java-open`
9898
- 公众号(包括订阅号和服务号):`weixin-java-mp`
9999
- 企业号/企业微信:`weixin-java-cp`
100+
- 视频号/微信小店:`weixin-java-channel`
100101

101102

102103
---------------------------------

Diff for: weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/BaseWxChannelMessageService.java

+12
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,18 @@ void orderCancel(OrderCancelMessage message, final String content, final String
8989
void orderPay(OrderPayMessage message, final String content, final String appId, final Map<String, Object> context,
9090
final WxSessionManager sessionManager);
9191

92+
/**
93+
* 订单待发货
94+
*
95+
* @param message 消息
96+
* @param content 消息原始内容
97+
* @param appId appId
98+
* @param context 上下文
99+
* @param sessionManager session管理器
100+
*/
101+
void orderWaitShipping(OrderIdMessage message, final String content, final String appId, final Map<String, Object> context,
102+
final WxSessionManager sessionManager);
103+
92104
/**
93105
* 订单发货
94106
*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
package me.chanjar.weixin.channel.api;
2+
3+
import me.chanjar.weixin.channel.bean.compass.shop.FinderAuthListResponse;
4+
import me.chanjar.weixin.channel.bean.compass.shop.FinderListResponse;
5+
import me.chanjar.weixin.channel.bean.compass.shop.FinderOverallResponse;
6+
import me.chanjar.weixin.channel.bean.compass.shop.FinderProductListResponse;
7+
import me.chanjar.weixin.channel.bean.compass.shop.FinderProductOverallResponse;
8+
import me.chanjar.weixin.channel.bean.compass.shop.ShopLiveListResponse;
9+
import me.chanjar.weixin.channel.bean.compass.shop.ShopOverallResponse;
10+
import me.chanjar.weixin.channel.bean.compass.shop.ShopProductDataResponse;
11+
import me.chanjar.weixin.channel.bean.compass.shop.ShopProductListResponse;
12+
import me.chanjar.weixin.channel.bean.compass.shop.ShopSaleProfileDataResponse;
13+
import me.chanjar.weixin.common.error.WxErrorException;
14+
15+
/**
16+
* 视频号/微信小店 罗盘商家版服务
17+
*
18+
* @author <a href="https://github.com/lixize">Zeyes</a>
19+
*/
20+
public interface WxChannelCompassShopService {
21+
22+
/**
23+
* 获取电商概览数据
24+
*
25+
* @param ds 日期,格式 yyyyMMdd
26+
* @return 电商概览数据
27+
*
28+
* @throws WxErrorException 异常
29+
*/
30+
ShopOverallResponse getShopOverall(String ds) throws WxErrorException;
31+
32+
/**
33+
* 获取授权视频号列表
34+
*
35+
* @return 获取授权视频号列表
36+
*
37+
* @throws WxErrorException 异常
38+
*/
39+
FinderAuthListResponse getFinderAuthorizationList() throws WxErrorException;
40+
41+
/**
42+
* 获取带货达人列表
43+
*
44+
* @param ds 日期,格式 yyyyMMdd
45+
* @return 带货达人列表
46+
*
47+
* @throws WxErrorException 异常
48+
*/
49+
FinderListResponse getFinderList(String ds) throws WxErrorException;
50+
51+
/**
52+
* 获取带货数据概览
53+
*
54+
* @param ds 日期,格式 yyyyMMdd
55+
* @return 带货数据概览
56+
*
57+
* @throws WxErrorException 异常
58+
*/
59+
FinderOverallResponse getFinderOverall(String ds) throws WxErrorException;
60+
61+
/**
62+
* 获取带货达人商品列表
63+
*
64+
* @param ds 日期,格式YYYYMMDD
65+
* @param finderId 视频号ID
66+
* @return 带货达人商品列表
67+
*
68+
* @throws WxErrorException 异常
69+
*/
70+
FinderProductListResponse getFinderProductList(String ds, String finderId) throws WxErrorException;
71+
72+
/**
73+
* 获取带货达人详情
74+
*
75+
* @param ds 日期,格式YYYYMMDD
76+
* @param finderId 视频号ID
77+
* @return 带货达人详情
78+
*
79+
* @throws WxErrorException 异常
80+
*/
81+
FinderProductOverallResponse getFinderProductOverall(String ds, String finderId) throws WxErrorException;
82+
83+
/**
84+
* 获取店铺开播列表
85+
*
86+
* @param ds 日期,格式YYYYMMDD
87+
* @param finderId 视频号ID
88+
* @return 店铺开播列表
89+
*
90+
* @throws WxErrorException 异常
91+
*/
92+
ShopLiveListResponse getShopLiveList(String ds, String finderId) throws WxErrorException;
93+
94+
/**
95+
* 获取商品详细信息
96+
*
97+
* @param ds 日期,格式YYYYMMDD
98+
* @param productId 商品id
99+
* @return 商品详细信息
100+
*
101+
* @throws WxErrorException 异常
102+
*/
103+
ShopProductDataResponse getShopProductData(String ds, String productId) throws WxErrorException;
104+
105+
/**
106+
* 获取商品列表
107+
*
108+
* @param ds 日期,格式YYYYMMDD
109+
* @return 商品列表
110+
*
111+
* @throws WxErrorException 异常
112+
*/
113+
ShopProductListResponse getShopProductList(String ds) throws WxErrorException;
114+
115+
/**
116+
* 获取店铺人群数据
117+
*
118+
* @param ds 日期,格式 yyyyMMdd
119+
* @param type 用户类型,1商品曝光用户 2商品点击用户 3购买用户 4首购用户 5复购用户
120+
* @return 店铺人群数据
121+
*
122+
* @throws WxErrorException 异常
123+
*/
124+
ShopSaleProfileDataResponse getShopSaleProfileData(String ds, Integer type) throws WxErrorException;
125+
126+
}

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

+14
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,20 @@ public interface WxChannelService extends BaseWxChannelService {
9898
*/
9999
WxStoreHomePageService getHomePageService();
100100

101+
/**
102+
* 合作账号服务
103+
*
104+
* @return 团长合作服务
105+
*/
106+
WxStoreCooperationService getCooperationService();
107+
108+
/**
109+
* 视频号/微信小店 罗盘商家版服务
110+
*
111+
* @return 罗盘商家版服务
112+
*/
113+
WxChannelCompassShopService getCompassShopService();
114+
101115
/**
102116
* 优选联盟-团长合作达人管理服务
103117
*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package me.chanjar.weixin.channel.api;
2+
3+
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
4+
import me.chanjar.weixin.channel.bean.cooperation.CooperationListResponse;
5+
import me.chanjar.weixin.channel.bean.cooperation.CooperationQrCodeResponse;
6+
import me.chanjar.weixin.channel.bean.cooperation.CooperationStatusResponse;
7+
import me.chanjar.weixin.common.error.WxErrorException;
8+
9+
/**
10+
* 微信小店 合作账号相关接口
11+
*
12+
* @author <a href="https://github.com/lixize">Zeyes</a>
13+
* @see <a href="https://developers.weixin.qq.com/doc/store/API/cooperation/">合作账号状态机</a>
14+
*/
15+
public interface WxStoreCooperationService {
16+
17+
/**
18+
* 获取合作账号列表
19+
*
20+
* @param sharerType 合作账号类型 2公众号 3小程序
21+
* @return 合作账号列表
22+
*
23+
* @throws WxErrorException 异常
24+
*/
25+
CooperationListResponse listCooperation(Integer sharerType) throws WxErrorException;
26+
27+
/**
28+
* 获取合作账号状态
29+
*
30+
* @param sharerId 合作账号id 公众号: gh_开头id 小程序: appid
31+
* @param sharerType 合作账号类型 2公众号 3小程序
32+
* @return 合作账号状态
33+
*
34+
* @throws WxErrorException 异常
35+
*/
36+
CooperationStatusResponse getCooperationStatus(String sharerId, Integer sharerType) throws WxErrorException;
37+
38+
/**
39+
* 生成合作账号邀请二维码
40+
*
41+
* @param sharerId 合作账号id 公众号: gh_开头id 小程序: appid
42+
* @param sharerType 合作账号类型 2公众号 3小程序
43+
* @return 二维码
44+
*
45+
* @throws WxErrorException 异常
46+
*/
47+
CooperationQrCodeResponse generateQrCode(String sharerId, Integer sharerType) throws WxErrorException;
48+
49+
/**
50+
* 取消合作账号邀请
51+
*
52+
* @param sharerId 合作账号id 公众号: gh_开头id 小程序: appid
53+
* @param sharerType 合作账号类型 2公众号 3小程序
54+
* @return WxChannelBaseResponse
55+
*
56+
* @throws WxErrorException 异常
57+
*/
58+
WxChannelBaseResponse cancelInvitation(String sharerId, Integer sharerType) throws WxErrorException;
59+
60+
/**
61+
* 解绑合作账号
62+
*
63+
* @param sharerId 合作账号id 公众号: gh_开头id 小程序: appid
64+
* @param sharerType 合作账号类型 2公众号 3小程序
65+
* @return WxChannelBaseResponse
66+
*
67+
* @throws WxErrorException 异常
68+
*/
69+
WxChannelBaseResponse unbind(String sharerId, Integer sharerType) throws WxErrorException;
70+
}

Diff for: weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelMessageServiceImpl.java

+8
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ protected void addDefaultRule() {
7272
this.addRule(OrderCancelMessage.class, ORDER_CANCEL, this::orderCancel);
7373
/* 订单支付成功 */
7474
this.addRule(OrderPayMessage.class, ORDER_PAY, this::orderPay);
75+
/* 订单待发货 */
76+
this.addRule(OrderIdMessage.class, ORDER_WAIT_SHIPPING, this::orderWaitShipping);
7577
/* 订单发货 */
7678
this.addRule(OrderDeliveryMessage.class, ORDER_DELIVER, this::orderDelivery);
7779
/* 订单确认收货 */
@@ -186,6 +188,12 @@ public void orderPay(OrderPayMessage message, String content, String appId,
186188
log.info("订单支付成功:{}", JsonUtils.encode(message));
187189
}
188190

191+
@Override
192+
public void orderWaitShipping(OrderIdMessage message, String content, String appId,
193+
Map<String, Object> context, WxSessionManager sessionManager) {
194+
log.info("订单待发货:{}", JsonUtils.encode(message));
195+
}
196+
189197
@Override
190198
public void orderDelivery(OrderDeliveryMessage message, String content, String appId,
191199
Map<String, Object> context, WxSessionManager sessionManager) {

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

+36-10
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public abstract class BaseWxChannelServiceImpl<H, P> implements WxChannelService
4848
private final WxChannelSharerService sharerService = new WxChannelSharerServiceImpl(this);
4949
private final WxChannelFundService fundService = new WxChannelFundServiceImpl(this);
5050
private WxStoreHomePageService homePageService = null;
51+
private WxStoreCooperationService cooperationService = null;
52+
private WxChannelCompassShopService compassShopService = null;
5153
private WxLeagueWindowService leagueWindowService = null;
5254
private WxLeagueSupplierService leagueSupplierService = null;
5355
private WxLeaguePromoterService leaguePromoterService = null;
@@ -56,10 +58,8 @@ public abstract class BaseWxChannelServiceImpl<H, P> implements WxChannelService
5658
private WxFinderLiveService finderLiveService = null;
5759
private WxAssistantService assistantService = null;
5860
private WxChannelVipService vipService = null;
59-
private final WxChannelCompassFinderService compassFinderService =
60-
new WxChannelCompassFinderServiceImpl(this);
61-
private final WxChannelLiveDashboardService liveDashboardService =
62-
new WxChannelLiveDashboardServiceImpl(this);
61+
private WxChannelCompassFinderService compassFinderService = null;
62+
private WxChannelLiveDashboardService liveDashboardService = null;
6363

6464
protected WxChannelConfig config;
6565
private int retrySleepMillis = 1000;
@@ -376,6 +376,22 @@ public synchronized WxStoreHomePageService getHomePageService() {
376376
return homePageService;
377377
}
378378

379+
@Override
380+
public synchronized WxStoreCooperationService getCooperationService() {
381+
if (cooperationService == null) {
382+
cooperationService = new WxStoreCooperationServiceImpl(this);
383+
}
384+
return cooperationService;
385+
}
386+
387+
@Override
388+
public synchronized WxChannelCompassShopService getCompassShopService() {
389+
if (compassShopService == null) {
390+
compassShopService = new WxChannelCompassShopServiceImpl(this);
391+
}
392+
return compassShopService;
393+
}
394+
379395
@Override
380396
public synchronized WxLeagueWindowService getLeagueWindowService() {
381397
if (leagueWindowService == null) {
@@ -409,23 +425,23 @@ public synchronized WxLeagueProductService getLeagueProductService() {
409425
}
410426

411427
@Override
412-
public WxLeadComponentService getLeadComponentService() {
428+
public synchronized WxLeadComponentService getLeadComponentService() {
413429
if (leadComponentService == null) {
414430
leadComponentService = new WxLeadComponentServiceImpl(this);
415431
}
416432
return leadComponentService;
417433
}
418434

419435
@Override
420-
public WxFinderLiveService getFinderLiveService() {
436+
public synchronized WxFinderLiveService getFinderLiveService() {
421437
if (finderLiveService == null) {
422438
finderLiveService = new WxFinderLiveServiceImpl(this);
423439
}
424440
return finderLiveService;
425441
}
426442

427443
@Override
428-
public WxAssistantService getAssistantService() {
444+
public synchronized WxAssistantService getAssistantService() {
429445
if (assistantService == null) {
430446
assistantService = new WxAssistantServiceImpl(this) {
431447
};
@@ -434,17 +450,27 @@ public WxAssistantService getAssistantService() {
434450
}
435451

436452
@Override
437-
public WxChannelVipService getVipService() {
453+
public synchronized WxChannelVipService getVipService() {
438454
if (vipService == null) {
439455
vipService = new WxChannelVipServiceImpl(this);
440456
}
441457
return vipService;
442458
}
443459

444460
@Override
445-
public WxChannelCompassFinderService getCompassFinderService() { return compassFinderService; }
461+
public synchronized WxChannelCompassFinderService getCompassFinderService() {
462+
if (compassFinderService == null) {
463+
compassFinderService = new WxChannelCompassFinderServiceImpl(this);
464+
}
465+
return compassFinderService;
466+
}
446467

447468
@Override
448-
public WxChannelLiveDashboardService getLiveDashboardService() { return liveDashboardService; }
469+
public synchronized WxChannelLiveDashboardService getLiveDashboardService() {
470+
if (liveDashboardService == null) {
471+
liveDashboardService = new WxChannelLiveDashboardServiceImpl(this);
472+
}
473+
return liveDashboardService;
474+
}
449475

450476
}

Diff for: weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelCompassFinderServiceImpl.java

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import lombok.extern.slf4j.Slf4j;
44
import me.chanjar.weixin.channel.api.WxChannelCompassFinderService;
5+
import me.chanjar.weixin.channel.bean.compass.CompassFinderBaseParam;
56
import me.chanjar.weixin.channel.bean.compass.finder.*;
67
import me.chanjar.weixin.channel.util.ResponseUtils;
78
import me.chanjar.weixin.common.error.WxErrorException;

0 commit comments

Comments
 (0)