Skip to content

新增微信小店代发管理模块:Supplier 关联、自动分配与 Dropship 单据接口支持#4031

Open
Copilot wants to merge 2 commits into
developfrom
copilot/fix-1343140-49122742-9a4504fb-0040-486e-93ce-33f73309afba
Open

新增微信小店代发管理模块:Supplier 关联、自动分配与 Dropship 单据接口支持#4031
Copilot wants to merge 2 commits into
developfrom
copilot/fix-1343140-49122742-9a4504fb-0040-486e-93ce-33f73309afba

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 31, 2026

当前 weixin-java-channel 缺少代发管理能力,无法覆盖商家与供货商关联、订单自动分配以及代发单管理场景。
本 PR 基于官方代发管理文档,补齐 12 个接口在服务层、路由入口与数据模型层的支持。

  • 服务入口与能力挂载

    • 新增 WxChannelSupplierService,定义 12 个代发管理接口方法(供货商列表、分配策略、代发单分配/取消/查询/列表/搜索)。
    • WxChannelService 暴露 getSupplierService()
    • BaseWxChannelServiceImpl 中完成 WxChannelSupplierServiceImpl 的懒加载接入。
  • API 常量补齐(官方路径)

    • WxChannelApiUrlConstants 新增 Supplier 分组,增加以下路径常量:
      • /channels/ec/supplier/relation/get_supplier_list
      • /channels/ec/supplier/relation/get_distribute
      • /channels/ec/supplier/relation/set_manually_distribute
      • /channels/ec/supplier/relation/set_all_distribution
      • /channels/ec/supplier/relation/set_product_distribute
      • /channels/ec/supplier/relation/get_product_default_distribute
      • /channels/ec/supplier/relation/get_product_list
      • /channels/ec/order/dropship/assign
      • /channels/ec/order/dropship/cancel
      • /channels/ec/order/dropship/get
      • /channels/ec/order/dropship/list
      • /channels/ec/order/dropship/search
  • 请求/响应模型新增

    • 新增 bean/supplier 下请求与响应对象,覆盖:
      • 分配设置:ProductDistributeRequestDistributeTypeResponseSupplierInfoResponseProductListResponse
      • 代发单:DropshipAssignRequestDropshipResponseDropshipDetailResponseDropshipListRequestDropshipSearchRequestDropshipListResponse
      • 基础实体:SupplierInfoDropshipInfo
    • 字段命名统一使用 @JsonProperty 对齐接口 JSON 键(如 supplier_idproduct_id_listdropship_list)。
  • 实现示例(服务调用形态)

    WxChannelSupplierService supplierService = channelService.getSupplierService();
    
    // 设置按商品自动分配
    ProductDistributeRequest req = new ProductDistributeRequest();
    req.setSupplierId("10001");
    req.setProductIdList(Arrays.asList("p100", "p101"));
    supplierService.setProductDistribute(req);
    
    // 拉取代发单列表
    DropshipListRequest listReq = new DropshipListRequest();
    listReq.setSupplierId("10001");
    listReq.setPageSize(20);
    DropshipListResponse resp = supplierService.listDropship(listReq);
  • 单元测试补充

    • 新增 WxChannelSupplierBeanTest,覆盖新增模型的关键序列化/反序列化契约,确保请求体与响应映射可用。

Copilot AI linked an issue May 31, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add代发管理模块支持 for WxJava 新增微信小店代发管理模块:Supplier 关联、自动分配与 Dropship 单据接口支持 May 31, 2026
Copilot AI requested a review from binarywang May 31, 2026 14:32
@binarywang binarywang marked this pull request as ready for review May 31, 2026 14:32
Copilot AI review requested due to automatic review settings May 31, 2026 14:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

weixin-java-channel 模块新增了视频号小店"代发管理"能力,覆盖供货商关联、分配策略与代发单管理共 12 个接口,并补充服务入口、URL 常量、请求/响应模型以及关键序列化单测。

Changes:

  • 新增 WxChannelSupplierService 接口与实现,并在 WxChannelService/BaseWxChannelServiceImpl 中以懒加载方式暴露。
  • WxChannelApiUrlConstants 增加 Supplier 分组的 12 条官方接口 URL 常量。
  • bean/supplier 下新增供货商/代发单的请求与响应模型,并补充 WxChannelSupplierBeanTest 验证序列化契约。

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelService.java 暴露 getSupplierService() 入口
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelSupplierService.java 新增代发管理服务接口,定义 12 个方法
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelServiceImpl.java 注册并懒加载 WxChannelSupplierServiceImpl
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelSupplierServiceImpl.java 服务实现,调用各接口 URL
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/WxChannelApiUrlConstants.java 新增 Supplier URL 常量分组
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/supplier/SupplierInfo.java 基础供货商实体
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/supplier/SupplierInfoResponse.java 单个供货商响应
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/supplier/SupplierListResponse.java 供货商列表分页响应
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/supplier/ProductDistributeRequest.java 按商品分配请求
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/supplier/ProductListResponse.java 商品分配列表响应
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/supplier/DistributeTypeResponse.java 分配方式响应
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/supplier/DropshipInfo.java 代发单实体
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/supplier/DropshipAssignRequest.java 代发单分配请求
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/supplier/DropshipResponse.java 代发单分配响应
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/supplier/DropshipDetailResponse.java 代发单详情响应
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/supplier/DropshipListRequest.java 代发单列表请求
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/supplier/DropshipListResponse.java 代发单列表响应
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/supplier/DropshipSearchRequest.java 代发单搜索请求(继承列表请求)
weixin-java-channel/src/test/java/me/chanjar/weixin/channel/bean/supplier/WxChannelSupplierBeanTest.java 关键序列化/反序列化单测


@Override
public SupplierInfoResponse getProductDefaultDistribute(String productId) throws WxErrorException {
String respJson = shopService.post(GET_PRODUCT_DEFAULT_DISTRIBUTE_URL, "{\"product_id\":\"" + productId + "\"}");
Comment on lines +66 to +71
public WxChannelBaseResponse setAllDistribute(String supplierId) throws WxErrorException {
ProductDistributeRequest req = new ProductDistributeRequest();
req.setSupplierId(supplierId);
String respJson = shopService.post(SET_ALL_DISTRIBUTION_URL, req);
return ResponseUtils.decode(respJson, WxChannelBaseResponse.class);
}
assertNotNull(json);
assertFalse(json.contains("supplierId"));
assertFalse(json.contains("productIdList"));
assertEquals(json, "{\"supplier_id\":\"1001\",\"product_id_list\":[\"p1\",\"p2\"]}");
* 视频号小店代发管理服务。
*
* @author <a href="https://github.com/github-copilot">GitHub Copilot</a>
* @link <a href="https://developers.weixin.qq.com/doc/channels/API/supplier/">代发管理接口文档</a>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 75ac877537

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +26 to +27
@JsonProperty("dropship_id")
private String dropshipId;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Map dropship order ids with the API field name

When deserializing real dropship records, this field will remain null because the WeChat shop order payload uses ds_order_id for the dropship order number (the existing me.chanjar.weixin.channel.bean.order.DropshipInfo model already maps that key), not dropship_id. This affects list/detail/assign responses that need to expose the returned dropship order id to callers.

Useful? React with 👍 / 👎.

Comment on lines +48 to +49
public SupplierListResponse getSupplierList() throws WxErrorException {
String respJson = shopService.post(GET_SUPPLIER_LIST_URL, "{}");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Expose pagination parameters for supplier lists

When a merchant has more suppliers than the first page, callers cannot retrieve the next page: the response model exposes has_more/next_key, but this method always posts an empty body and the public API has no way to send the returned cursor (or page size). This makes the service silently unusable for complete supplier enumeration once has_more is true.

Useful? React with 👍 / 👎.

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.

[Feature] 新增代发管理模块支持

3 participants