Skip to content

Commit

Permalink
🆕 #3427【视频号】新增罗盘商家版API、微信小店合作账号API相关接口以及订单待发货消息回调
Browse files Browse the repository at this point in the history
  • Loading branch information
lixize authored Dec 1, 2024
1 parent f72f748 commit fae5cad
Show file tree
Hide file tree
Showing 62 changed files with 1,869 additions and 34 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
- 微信开放平台:`weixin-java-open`
- 公众号(包括订阅号和服务号):`weixin-java-mp`
- 企业号/企业微信:`weixin-java-cp`
- 视频号/微信小店:`weixin-java-channel`


---------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ void orderCancel(OrderCancelMessage message, final String content, final String
void orderPay(OrderPayMessage message, final String content, final String appId, final Map<String, Object> context,
final WxSessionManager sessionManager);

/**
* 订单待发货
*
* @param message 消息
* @param content 消息原始内容
* @param appId appId
* @param context 上下文
* @param sessionManager session管理器
*/
void orderWaitShipping(OrderIdMessage message, final String content, final String appId, final Map<String, Object> context,
final WxSessionManager sessionManager);

/**
* 订单发货
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
package me.chanjar.weixin.channel.api;

import me.chanjar.weixin.channel.bean.compass.shop.FinderAuthListResponse;
import me.chanjar.weixin.channel.bean.compass.shop.FinderListResponse;
import me.chanjar.weixin.channel.bean.compass.shop.FinderOverallResponse;
import me.chanjar.weixin.channel.bean.compass.shop.FinderProductListResponse;
import me.chanjar.weixin.channel.bean.compass.shop.FinderProductOverallResponse;
import me.chanjar.weixin.channel.bean.compass.shop.ShopLiveListResponse;
import me.chanjar.weixin.channel.bean.compass.shop.ShopOverallResponse;
import me.chanjar.weixin.channel.bean.compass.shop.ShopProductDataResponse;
import me.chanjar.weixin.channel.bean.compass.shop.ShopProductListResponse;
import me.chanjar.weixin.channel.bean.compass.shop.ShopSaleProfileDataResponse;
import me.chanjar.weixin.common.error.WxErrorException;

/**
* 视频号/微信小店 罗盘商家版服务
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
public interface WxChannelCompassShopService {

/**
* 获取电商概览数据
*
* @param ds 日期,格式 yyyyMMdd
* @return 电商概览数据
*
* @throws WxErrorException 异常
*/
ShopOverallResponse getShopOverall(String ds) throws WxErrorException;

/**
* 获取授权视频号列表
*
* @return 获取授权视频号列表
*
* @throws WxErrorException 异常
*/
FinderAuthListResponse getFinderAuthorizationList() throws WxErrorException;

/**
* 获取带货达人列表
*
* @param ds 日期,格式 yyyyMMdd
* @return 带货达人列表
*
* @throws WxErrorException 异常
*/
FinderListResponse getFinderList(String ds) throws WxErrorException;

/**
* 获取带货数据概览
*
* @param ds 日期,格式 yyyyMMdd
* @return 带货数据概览
*
* @throws WxErrorException 异常
*/
FinderOverallResponse getFinderOverall(String ds) throws WxErrorException;

/**
* 获取带货达人商品列表
*
* @param ds 日期,格式YYYYMMDD
* @param finderId 视频号ID
* @return 带货达人商品列表
*
* @throws WxErrorException 异常
*/
FinderProductListResponse getFinderProductList(String ds, String finderId) throws WxErrorException;

/**
* 获取带货达人详情
*
* @param ds 日期,格式YYYYMMDD
* @param finderId 视频号ID
* @return 带货达人详情
*
* @throws WxErrorException 异常
*/
FinderProductOverallResponse getFinderProductOverall(String ds, String finderId) throws WxErrorException;

/**
* 获取店铺开播列表
*
* @param ds 日期,格式YYYYMMDD
* @param finderId 视频号ID
* @return 店铺开播列表
*
* @throws WxErrorException 异常
*/
ShopLiveListResponse getShopLiveList(String ds, String finderId) throws WxErrorException;

/**
* 获取商品详细信息
*
* @param ds 日期,格式YYYYMMDD
* @param productId 商品id
* @return 商品详细信息
*
* @throws WxErrorException 异常
*/
ShopProductDataResponse getShopProductData(String ds, String productId) throws WxErrorException;

/**
* 获取商品列表
*
* @param ds 日期,格式YYYYMMDD
* @return 商品列表
*
* @throws WxErrorException 异常
*/
ShopProductListResponse getShopProductList(String ds) throws WxErrorException;

/**
* 获取店铺人群数据
*
* @param ds 日期,格式 yyyyMMdd
* @param type 用户类型,1商品曝光用户 2商品点击用户 3购买用户 4首购用户 5复购用户
* @return 店铺人群数据
*
* @throws WxErrorException 异常
*/
ShopSaleProfileDataResponse getShopSaleProfileData(String ds, Integer type) throws WxErrorException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ public interface WxChannelService extends BaseWxChannelService {
*/
WxStoreHomePageService getHomePageService();

/**
* 合作账号服务
*
* @return 团长合作服务
*/
WxStoreCooperationService getCooperationService();

/**
* 视频号/微信小店 罗盘商家版服务
*
* @return 罗盘商家版服务
*/
WxChannelCompassShopService getCompassShopService();

/**
* 优选联盟-团长合作达人管理服务
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package me.chanjar.weixin.channel.api;

import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
import me.chanjar.weixin.channel.bean.cooperation.CooperationListResponse;
import me.chanjar.weixin.channel.bean.cooperation.CooperationQrCodeResponse;
import me.chanjar.weixin.channel.bean.cooperation.CooperationStatusResponse;
import me.chanjar.weixin.common.error.WxErrorException;

/**
* 微信小店 合作账号相关接口
*
* @author <a href="https://github.com/lixize">Zeyes</a>
* @see <a href="https://developers.weixin.qq.com/doc/store/API/cooperation/">合作账号状态机</a>
*/
public interface WxStoreCooperationService {

/**
* 获取合作账号列表
*
* @param sharerType 合作账号类型 2公众号 3小程序
* @return 合作账号列表
*
* @throws WxErrorException 异常
*/
CooperationListResponse listCooperation(Integer sharerType) throws WxErrorException;

/**
* 获取合作账号状态
*
* @param sharerId 合作账号id 公众号: gh_开头id 小程序: appid
* @param sharerType 合作账号类型 2公众号 3小程序
* @return 合作账号状态
*
* @throws WxErrorException 异常
*/
CooperationStatusResponse getCooperationStatus(String sharerId, Integer sharerType) throws WxErrorException;

/**
* 生成合作账号邀请二维码
*
* @param sharerId 合作账号id 公众号: gh_开头id 小程序: appid
* @param sharerType 合作账号类型 2公众号 3小程序
* @return 二维码
*
* @throws WxErrorException 异常
*/
CooperationQrCodeResponse generateQrCode(String sharerId, Integer sharerType) throws WxErrorException;

/**
* 取消合作账号邀请
*
* @param sharerId 合作账号id 公众号: gh_开头id 小程序: appid
* @param sharerType 合作账号类型 2公众号 3小程序
* @return WxChannelBaseResponse
*
* @throws WxErrorException 异常
*/
WxChannelBaseResponse cancelInvitation(String sharerId, Integer sharerType) throws WxErrorException;

/**
* 解绑合作账号
*
* @param sharerId 合作账号id 公众号: gh_开头id 小程序: appid
* @param sharerType 合作账号类型 2公众号 3小程序
* @return WxChannelBaseResponse
*
* @throws WxErrorException 异常
*/
WxChannelBaseResponse unbind(String sharerId, Integer sharerType) throws WxErrorException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ protected void addDefaultRule() {
this.addRule(OrderCancelMessage.class, ORDER_CANCEL, this::orderCancel);
/* 订单支付成功 */
this.addRule(OrderPayMessage.class, ORDER_PAY, this::orderPay);
/* 订单待发货 */
this.addRule(OrderIdMessage.class, ORDER_WAIT_SHIPPING, this::orderWaitShipping);
/* 订单发货 */
this.addRule(OrderDeliveryMessage.class, ORDER_DELIVER, this::orderDelivery);
/* 订单确认收货 */
Expand Down Expand Up @@ -186,6 +188,12 @@ public void orderPay(OrderPayMessage message, String content, String appId,
log.info("订单支付成功:{}", JsonUtils.encode(message));
}

@Override
public void orderWaitShipping(OrderIdMessage message, String content, String appId,
Map<String, Object> context, WxSessionManager sessionManager) {
log.info("订单待发货:{}", JsonUtils.encode(message));
}

@Override
public void orderDelivery(OrderDeliveryMessage message, String content, String appId,
Map<String, Object> context, WxSessionManager sessionManager) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public abstract class BaseWxChannelServiceImpl<H, P> implements WxChannelService
private final WxChannelSharerService sharerService = new WxChannelSharerServiceImpl(this);
private final WxChannelFundService fundService = new WxChannelFundServiceImpl(this);
private WxStoreHomePageService homePageService = null;
private WxStoreCooperationService cooperationService = null;
private WxChannelCompassShopService compassShopService = null;
private WxLeagueWindowService leagueWindowService = null;
private WxLeagueSupplierService leagueSupplierService = null;
private WxLeaguePromoterService leaguePromoterService = null;
Expand All @@ -56,10 +58,8 @@ public abstract class BaseWxChannelServiceImpl<H, P> implements WxChannelService
private WxFinderLiveService finderLiveService = null;
private WxAssistantService assistantService = null;
private WxChannelVipService vipService = null;
private final WxChannelCompassFinderService compassFinderService =
new WxChannelCompassFinderServiceImpl(this);
private final WxChannelLiveDashboardService liveDashboardService =
new WxChannelLiveDashboardServiceImpl(this);
private WxChannelCompassFinderService compassFinderService = null;
private WxChannelLiveDashboardService liveDashboardService = null;

protected WxChannelConfig config;
private int retrySleepMillis = 1000;
Expand Down Expand Up @@ -376,6 +376,22 @@ public synchronized WxStoreHomePageService getHomePageService() {
return homePageService;
}

@Override
public synchronized WxStoreCooperationService getCooperationService() {
if (cooperationService == null) {
cooperationService = new WxStoreCooperationServiceImpl(this);
}
return cooperationService;
}

@Override
public synchronized WxChannelCompassShopService getCompassShopService() {
if (compassShopService == null) {
compassShopService = new WxChannelCompassShopServiceImpl(this);
}
return compassShopService;
}

@Override
public synchronized WxLeagueWindowService getLeagueWindowService() {
if (leagueWindowService == null) {
Expand Down Expand Up @@ -409,23 +425,23 @@ public synchronized WxLeagueProductService getLeagueProductService() {
}

@Override
public WxLeadComponentService getLeadComponentService() {
public synchronized WxLeadComponentService getLeadComponentService() {
if (leadComponentService == null) {
leadComponentService = new WxLeadComponentServiceImpl(this);
}
return leadComponentService;
}

@Override
public WxFinderLiveService getFinderLiveService() {
public synchronized WxFinderLiveService getFinderLiveService() {
if (finderLiveService == null) {
finderLiveService = new WxFinderLiveServiceImpl(this);
}
return finderLiveService;
}

@Override
public WxAssistantService getAssistantService() {
public synchronized WxAssistantService getAssistantService() {
if (assistantService == null) {
assistantService = new WxAssistantServiceImpl(this) {
};
Expand All @@ -434,17 +450,27 @@ public WxAssistantService getAssistantService() {
}

@Override
public WxChannelVipService getVipService() {
public synchronized WxChannelVipService getVipService() {
if (vipService == null) {
vipService = new WxChannelVipServiceImpl(this);
}
return vipService;
}

@Override
public WxChannelCompassFinderService getCompassFinderService() { return compassFinderService; }
public synchronized WxChannelCompassFinderService getCompassFinderService() {
if (compassFinderService == null) {
compassFinderService = new WxChannelCompassFinderServiceImpl(this);
}
return compassFinderService;
}

@Override
public WxChannelLiveDashboardService getLiveDashboardService() { return liveDashboardService; }
public synchronized WxChannelLiveDashboardService getLiveDashboardService() {
if (liveDashboardService == null) {
liveDashboardService = new WxChannelLiveDashboardServiceImpl(this);
}
return liveDashboardService;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.channel.api.WxChannelCompassFinderService;
import me.chanjar.weixin.channel.bean.compass.CompassFinderBaseParam;
import me.chanjar.weixin.channel.bean.compass.finder.*;
import me.chanjar.weixin.channel.util.ResponseUtils;
import me.chanjar.weixin.common.error.WxErrorException;
Expand Down
Loading

0 comments on commit fae5cad

Please sign in to comment.