Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions weixin-java-channel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>false</skip>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package me.chanjar.weixin.channel.api;

import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
import me.chanjar.weixin.channel.bean.product.GiftActivityAddResponse;
import me.chanjar.weixin.channel.bean.product.GiftActivityInfo;
import me.chanjar.weixin.channel.bean.product.GiftProductAddResponse;
import me.chanjar.weixin.channel.bean.product.GiftProductGetResponse;
import me.chanjar.weixin.channel.bean.product.GiftProductInfo;
import me.chanjar.weixin.channel.bean.product.GiftProductListParam;
import me.chanjar.weixin.channel.bean.product.GiftProductListResponse;
import me.chanjar.weixin.common.error.WxErrorException;

/**
* 微信小店赠品与买赠活动服务。
*/
public interface WxChannelGiftService {

/**
* 添加非卖商品。
*
* @param info 赠品信息
* @return 添加赠品响应
* @throws WxErrorException 异常
*/
GiftProductAddResponse addGiftProduct(GiftProductInfo info) throws WxErrorException;

/**
* 更新非卖商品。
*
* @param info 赠品信息
* @return 操作响应
* @throws WxErrorException 异常
*/
WxChannelBaseResponse updateGiftProduct(GiftProductInfo info) throws WxErrorException;

/**
* 在售商品转赠品。
*
* @param productId 商品ID
* @return 操作响应
* @throws WxErrorException 异常
*/
WxChannelBaseResponse setProductAsGift(String productId) throws WxErrorException;

/**
* 获取赠品。
*
* @param productId 赠品商品ID
* @return 赠品详情响应
* @throws WxErrorException 异常
*/
GiftProductGetResponse getGiftProduct(String productId) throws WxErrorException;

/**
* 获取赠品列表。
*
* @param param 查询参数
* @return 赠品列表
* @throws WxErrorException 异常
*/
GiftProductListResponse listGiftProduct(GiftProductListParam param) throws WxErrorException;

/**
* 更新赠品库存。
*
* @param productId 赠品商品ID
* @param skuId 赠品sku_id
* @param diffType 修改类型 1增加 2减少 3设置
* @param num 增加、减少或者设置的库存值
* @return 操作响应
* @throws WxErrorException 异常
*/
WxChannelBaseResponse updateGiftStock(String productId, String skuId, Integer diffType, Integer num)
throws WxErrorException;

/**
* 创建赠品活动。
*
* @param info 活动信息
* @return 创建赠品活动响应
* @throws WxErrorException 异常
*/
GiftActivityAddResponse addGiftActivity(GiftActivityInfo info) throws WxErrorException;

/**
* 删除赠品活动。
*
* @param activityId 活动ID
* @return 操作响应
* @throws WxErrorException 异常
*/
WxChannelBaseResponse deleteGiftActivity(String activityId) throws WxErrorException;

/**
* 停止赠品活动。
*
* @param activityId 活动ID
* @return 操作响应
* @throws WxErrorException 异常
*/
WxChannelBaseResponse stopGiftActivity(String activityId) throws WxErrorException;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package me.chanjar.weixin.channel.api;

import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
import me.chanjar.weixin.channel.bean.limit.LimitTaskAddResponse;
import me.chanjar.weixin.channel.bean.limit.LimitTaskListResponse;
import me.chanjar.weixin.channel.bean.limit.LimitTaskParam;
import me.chanjar.weixin.channel.bean.limit.LimitTaskUpdateParam;
import me.chanjar.weixin.channel.bean.limit.LimitTaskUpdateResponse;
import me.chanjar.weixin.common.error.WxErrorException;

/**
* 微信小店限时抢购服务。
*/
public interface WxChannelLimitedDiscountService {

/**
* 添加限时抢购任务。
*
* @param param 限时抢购任务
* @return 添加任务响应
* @throws WxErrorException 异常
*/
LimitTaskAddResponse addLimitTask(LimitTaskParam param) throws WxErrorException;

/**
* 拉取限时抢购任务列表。
*
* @param pageSize 每页数量
* @param nextKey 翻页上下文
* @param status 抢购活动状态
* @return 任务列表响应
* @throws WxErrorException 异常
*/
LimitTaskListResponse listLimitTask(Integer pageSize, String nextKey, Integer status) throws WxErrorException;

/**
* 停止限时抢购任务。
*
* @param taskId 限时抢购任务ID
* @return 操作响应
* @throws WxErrorException 异常
*/
WxChannelBaseResponse stopLimitTask(String taskId) throws WxErrorException;

/**
* 删除限时抢购任务。
*
* @param taskId 限时抢购任务ID
* @return 操作响应
* @throws WxErrorException 异常
*/
WxChannelBaseResponse deleteLimitTask(String taskId) throws WxErrorException;

/**
* 更新限时抢购任务。
*
* @param param 更新任务参数
* @return 更新任务响应
* @throws WxErrorException 异常
*/
LimitTaskUpdateResponse updateLimitTask(LimitTaskUpdateParam param) throws WxErrorException;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package me.chanjar.weixin.channel.api;

import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
import me.chanjar.weixin.channel.bean.product.assistant.BeginTimingSaleParam;
import me.chanjar.weixin.channel.bean.product.assistant.CancelTimingSaleParam;
import me.chanjar.weixin.channel.bean.product.assistant.CategoryPreCheckParam;
import me.chanjar.weixin.channel.bean.product.assistant.CategoryPreCheckResponse;
import me.chanjar.weixin.channel.bean.product.assistant.ExternalProductMappingNewParam;
import me.chanjar.weixin.channel.bean.product.assistant.ExternalProductMappingNewResponse;
import me.chanjar.weixin.channel.bean.product.assistant.ExternalProductMappingParam;
import me.chanjar.weixin.channel.bean.product.assistant.ExternalProductMappingResponse;
import me.chanjar.weixin.channel.bean.product.assistant.ProductBrandRecommendParam;
import me.chanjar.weixin.channel.bean.product.assistant.ProductBrandRecommendResponse;
import me.chanjar.weixin.common.error.WxErrorException;

/**
* 微信小店商品辅助功能服务。
*/
public interface WxChannelProductAssistantService {

/**
* 发品前校验。
*
* @param param 校验参数
* @return 校验结果
* @throws WxErrorException 异常
*/
CategoryPreCheckResponse categoryPreCheck(CategoryPreCheckParam param) throws WxErrorException;

/**
* 获取商品品牌推荐。
*
* @param param 推荐参数
* @return 推荐结果
* @throws WxErrorException 异常
*/
ProductBrandRecommendResponse getProductBrandRecommend(ProductBrandRecommendParam param)
throws WxErrorException;

/**
* 获取站内外商品属性映射。
*
* @param param 映射参数
* @return 映射结果
* @throws WxErrorException 异常
*/
ExternalProductMappingResponse externalProductMapping(ExternalProductMappingParam param)
throws WxErrorException;

/**
* 获取商品属性映射及推荐。
*
* @param param 映射参数
* @return 映射结果
* @throws WxErrorException 异常
*/
ExternalProductMappingNewResponse externalProductMappingNew(ExternalProductMappingNewParam param)
throws WxErrorException;

/**
* 将定时开售商品改为立即开售。
*
* @param param 开售参数
* @return 操作结果
* @throws WxErrorException 异常
*/
WxChannelBaseResponse beginTimingSale(BeginTimingSaleParam param) throws WxErrorException;

/**
* 取消商品定时开售。
*
* @param param 取消参数
* @return 操作结果
* @throws WxErrorException 异常
*/
WxChannelBaseResponse cancelTimingSale(CancelTimingSaleParam param) throws WxErrorException;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package me.chanjar.weixin.channel.api;

import java.util.List;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
import me.chanjar.weixin.channel.bean.product.SkuStockBatchResponse;
import me.chanjar.weixin.channel.bean.product.SkuStockResponse;
import me.chanjar.weixin.channel.bean.product.stock.StockFlowParam;
import me.chanjar.weixin.channel.bean.product.stock.StockFlowResponse;
import me.chanjar.weixin.common.error.WxErrorException;

/**
* 微信小店商品库存服务。
*/
public interface WxChannelProductStockService {

/**
* 更新商品库存。
*
* @param productId 商品ID
* @param skuId 商品sku_id
* @param diffType 修改类型 1增加 2减少 3设置
* @param num 增加、减少或者设置的库存值
* @return 操作响应
* @throws WxErrorException 异常
*/
WxChannelBaseResponse updateStock(String productId, String skuId, Integer diffType, Integer num)
throws WxErrorException;

/**
* 获取商品实时库存。
*
* @param productId 商品ID
* @param skuId 商品sku_id
* @return 库存响应
* @throws WxErrorException 异常
*/
SkuStockResponse getSkuStock(String productId, String skuId) throws WxErrorException;

/**
* 批量获取库存信息。
*
* @param productIds 商品ID列表,单次请求不超过50个
* @return 库存信息
* @throws WxErrorException 异常
*/
SkuStockBatchResponse getSkuStockBatch(List<String> productIds) throws WxErrorException;

/**
* 获取商品库存流水。
*
* @param param 库存流水查询参数
* @return 库存流水响应
* @throws WxErrorException 异常
*/
StockFlowResponse getStockFlow(StockFlowParam param) throws WxErrorException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,42 @@ public interface WxChannelService extends BaseWxChannelService {
*/
WxChannelProductService getProductService();

/**
* 赠品与买赠活动服务
*
* @return 赠品与买赠活动服务
*/
default WxChannelGiftService getGiftService() {
throw new UnsupportedOperationException("Gift service is not supported by this implementation");
}

/**
* 限时抢购服务
*
* @return 限时抢购服务
*/
default WxChannelLimitedDiscountService getLimitedDiscountService() {
throw new UnsupportedOperationException("Limited discount service is not supported by this implementation");
}

/**
* 商品库存服务
*
* @return 商品库存服务
*/
default WxChannelProductStockService getProductStockService() {
throw new UnsupportedOperationException("Product stock service is not supported by this implementation");
}

/**
* 商品辅助功能服务
*
* @return 商品辅助功能服务
*/
default WxChannelProductAssistantService getProductAssistantService() {
throw new UnsupportedOperationException("Product assistant service is not supported by this implementation");
}

/**
* 仓库服务
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ public abstract class BaseWxChannelServiceImpl<H, P> implements WxChannelService
private final WxChannelBasicService basicService = new WxChannelBasicServiceImpl(this);
private final WxChannelCategoryService categoryService = new WxChannelCategoryServiceImpl(this);
private final WxChannelBrandService brandService = new WxChannelBrandServiceImpl(this);
private final WxChannelProductService productService = new WxChannelProductServiceImpl(this);
private final WxChannelGiftService giftService = new WxChannelGiftServiceImpl(this);
private final WxChannelLimitedDiscountService limitedDiscountService =
new WxChannelLimitedDiscountServiceImpl(this);
private final WxChannelProductStockService productStockService = new WxChannelProductStockServiceImpl(this);
private final WxChannelProductAssistantService productAssistantService =
new WxChannelProductAssistantServiceImpl(this);
private final WxChannelProductService productService = new WxChannelProductServiceImpl(
this, giftService, limitedDiscountService, productStockService);
private final WxChannelWarehouseService warehouseService = new WxChannelWarehouseServiceImpl(this);
private final WxChannelOrderService orderService = new WxChannelOrderServiceImpl(this);
private final WxChannelAfterSaleService afterSaleService = new WxChannelAfterSaleServiceImpl(this);
Expand Down Expand Up @@ -336,6 +343,26 @@ public WxChannelProductService getProductService() {
return productService;
}

@Override
public WxChannelGiftService getGiftService() {
return giftService;
}

@Override
public WxChannelLimitedDiscountService getLimitedDiscountService() {
return limitedDiscountService;
}

@Override
public WxChannelProductStockService getProductStockService() {
return productStockService;
}

@Override
public WxChannelProductAssistantService getProductAssistantService() {
return productAssistantService;
}

@Override
public WxChannelWarehouseService getWarehouseService() {
return warehouseService;
Expand Down
Loading