Skip to content

feat(channel): 补齐视频号小店商品相关接口 - #4109

Merged
binarywang merged 4 commits into
developfrom
feat/channel-product-api-completion-clean
Aug 22, 2026
Merged

feat(channel): 补齐视频号小店商品相关接口#4109
binarywang merged 4 commits into
developfrom
feat/channel-product-api-completion-clean

Conversation

@binarywang

Copy link
Copy Markdown
Owner

Closes #4002

变更

  • 拆分赠品、限时抢购、库存和商品辅助领域服务,保留既有 ProductService 调用兼容性。
  • 支持限时抢购任务更新、库存流水及 6 个商品辅助接口。
  • 请求使用结构化 Bean,标识符保持字符串,新增 TestNG 覆盖。

未实现

审核策略和审核额度接口当前无法获取可验证的官方契约,未猜测实现。

验证

mvn -pl weixin-java-channel test(28 tests, 0 failures/errors/skips)

@augmentcode

augmentcode Bot commented Aug 22, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

摘要:

  • 本 PR 为微信小店商品能力补齐赠品、限时抢购、库存及商品辅助服务。
  • 新增 WxChannelGiftService,承载赠品商品与买赠活动接口。
  • 新增 WxChannelLimitedDiscountService,并支持更新限时抢购任务。
  • 新增 WxChannelProductStockService,提供库存查询、更新及库存流水查询。
  • 新增 WxChannelProductAssistantService,覆盖发品前校验、品牌推荐和属性映射等接口。
  • WxChannelService 暴露四个领域服务访问器,并以默认方法保护既有实现的二进制兼容性。
  • BaseWxChannelServiceImpl 创建并复用各领域服务实例。
  • 既有 WxChannelProductService 方法改为委托至新服务,保持原调用入口兼容。
  • 新增限时抢购更新、库存流水及商品辅助接口对应的请求/响应 Bean 与 URL 常量。
  • 标识符采用字符串字段,避免大整数精度丢失并保留前导零。
  • 新增 TestNG 测试,验证请求 JSON、接口路径及关键响应反序列化。
  • 模块 Surefire 配置改为执行 TestNG 套件,使新增测试纳入模块测试流程。

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@binarywang
binarywang merged commit d9caa8a into develop Aug 22, 2026
2 checks passed
@binarywang
binarywang deleted the feat/channel-product-api-completion-clean branch August 22, 2026 10:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 为视频号小店商品能力补充独立的赠品、限时抢购、库存及商品辅助服务,并通过委托保留既有 WxChannelProductService 兼容性。

Changes:

  • 新增领域服务接口、实现类及 WxChannelService 访问器。
  • 新增限时抢购更新、库存流水及 6 个商品辅助接口的请求/响应 Bean。
  • 新增 TestNG 测试并启用模块测试套件;审核策略与额度接口仍未实现。

Reviewed changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
weixin-java-channel/src/test/resources/testng.xml Updated as part of this pull request.
weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelServiceImplTest.java Updated as part of this pull request.
weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelProductStockServiceImplTest.java Updated as part of this pull request.
weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelProductAssistantServiceImplTest.java Updated as part of this pull request.
weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelLimitedDiscountServiceImplTest.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/WxChannelApiUrlConstants.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/stock/StockFlowResponse.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/stock/StockFlowParam.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/stock/StockFlowInfo.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/stock/StockFlowExtInfo.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/assistant/ProductBrandRecommendResponse.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/assistant/ProductBrandRecommendParam.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/assistant/ExternalProductMappingResponse.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/assistant/ExternalProductMappingParam.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/assistant/ExternalProductMappingNewResponse.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/assistant/ExternalProductMappingNewParam.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/assistant/ExternalAttribute.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/assistant/CategoryPreCheckResponse.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/assistant/CategoryPreCheckParam.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/assistant/CancelTimingSaleParam.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/assistant/BeginTimingSaleParam.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/limit/LimitTaskUpdateResponse.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/limit/LimitTaskUpdateParam.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/limit/LimitSkuUpdate.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelService.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelProductStockService.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelProductAssistantService.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelLimitedDiscountService.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelGiftService.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelProductStockServiceImpl.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelProductServiceImpl.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelProductAssistantServiceImpl.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelLimitedDiscountServiceImpl.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelGiftServiceImpl.java Updated as part of this pull request.
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelServiceImpl.java Updated as part of this pull request.
weixin-java-channel/pom.xml Updated as part of this pull request.
Suppressed comments (8)

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelProductStockService.java:26

  • #4002 列出的库存子 API 名称是 updateStockFastgetStockgetStockBatch,但这里仍只暴露既有的 updateStockgetSkuStockgetSkuStockBatch。拆分出新的公开领域服务后,调用方仍无法按完整 API 名称使用这些接口;建议补充规范命名的方法,并保留当前短名作为兼容委托。
  WxChannelBaseResponse updateStock(String productId, String skuId, Integer diffType, Integer num)

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelLimitedDiscountServiceImpl.java:36

  • 当前针对新限时抢购服务的测试只覆盖了 updateLimitTaskaddLimitTasklistLimitTaskstopLimitTaskdeleteLimitTask 的新实现没有直接验证。旧的 WxChannelProductServiceImplTest 也未被 testng.xml 纳入本次测试套件,因此这些抽取后的路径或请求格式回归仍可能漏过;请补齐端点级单元测试。
  public LimitTaskAddResponse addLimitTask(LimitTaskParam param) throws WxErrorException {
    String reqJson = JsonUtils.encode(param);
    String resJson = shopService.post(ADD_LIMIT_TASK_URL, reqJson);
    return ResponseUtils.decode(resJson, LimitTaskAddResponse.class);

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelProductStockServiceImpl.java:37

  • 当前库存服务测试只覆盖了 getStockFlow;本次抽取后的 updateStockgetSkuStockgetSkuStockBatch 都没有直接的请求/响应测试。旧的商品服务测试未被当前 testng.xml 套件执行,库存接口的 URL、序列化或响应类型回归可能因此漏过;请补齐这些测试。
  public WxChannelBaseResponse updateStock(String productId, String skuId, Integer diffType, Integer num)
    throws WxErrorException {
    SkuStockParam param = new SkuStockParam(productId, skuId, diffType, num);
    String reqJson = JsonUtils.encode(param);
    String resJson = shopService.post(SPU_UPDATE_STOCK_URL, reqJson);

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/assistant/CategoryPreCheckParam.java:19

  • 这里将 cat_id 建模为 Long,与本 PR 所述“标识符保持字符串”不一致;同模块现有 PassCategoryInfo.catIdCatsV2.catId 也使用 String。这会把公共 API 的类型和序列化契约固定为数值,无法保留字符串标识符的原始形式;请改为 String,并同步调整调用方测试。
  private Long catId;

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/assistant/ExternalProductMappingNewParam.java:20

  • 这里将 cat_id 建模为 Long,与本 PR 所述“标识符保持字符串”及同模块现有类目 ID 类型不一致。该公共请求 Bean 会把标识符序列化为数值,不能保持字符串形式;请改为 String,并同步调整测试中的赋值。
  private Long catId;

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/assistant/ExternalProductMappingParam.java:19

  • 这里将 cat_id 建模为 Long,与本 PR 所述“标识符保持字符串”及同模块 PassCategoryInfo.catIdCatsV2.catId 的类型约定不一致。该公共请求 Bean 会因此把标识符序列化为数值而不是字符串;请改为 String,并同步调整测试中的赋值。
  private Long catId;

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/assistant/ProductBrandRecommendParam.java:20

  • 这里将 cat_id 建模为 Long,与本 PR 所述“标识符保持字符串”不一致;同模块现有类对类目 ID 使用 String。这会使该公共请求 Bean 只能按数值处理标识符,丢失字符串契约;请改为 String,并同步调整测试中的赋值。
  private Long catId;

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/assistant/ProductBrandRecommendResponse.java:21

  • brand_id 是对外暴露的标识符,但这里使用了 Long;本 PR 明确要求标识符保持字符串,而同模块的 SpuInfo.brandIdBasicBrand.brandId 等也使用 String。如果接口返回带引号、前导零或超出数值语义的标识符,该类型会破坏原始值;请改为 String
  private Long brandId;

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

* @return 更新任务响应
* @throws WxErrorException 异常
*/
LimitTaskUpdateResponse updateLimitTask(LimitTaskUpdateParam param) throws WxErrorException;
Comment on lines +47 to +50
public WxChannelBaseResponse updateGiftProduct(GiftProductInfo info) throws WxErrorException {
String reqJson = JsonUtils.encode(info);
String resJson = shopService.post(GIFT_PRODUCT_UPDATE_URL, reqJson);
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);

@Override
public LimitTaskAddResponse addLimitTask(LimitTaskParam param) throws WxErrorException {
String reqJson = JsonUtils.encode(param);
@binarywang binarywang added this to the 4.8.6 milestone Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[weixin-java-channel] WxChannelProductService 缺失赠品/买赠活动/限时抢购/库存等完整子API(共28个端点)

2 participants