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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ sonar-project.properties
!/.mvn/wrapper/maven-wrapper.jar
*.versionsBackup

# Local Superpowers planning artifacts
docs/superpowers/

# STS
.factorypath
*.zip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@
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.channel.bean.product.AddProductThirdPartySourceParam;
import me.chanjar.weixin.channel.bean.product.AddProductThirdPartySourceResponse;
import me.chanjar.weixin.channel.bean.product.ExternalProductMappingNewParam;
import me.chanjar.weixin.channel.bean.product.ExternalProductMappingNewResponse;
import me.chanjar.weixin.channel.bean.product.ExternalProductMappingParam;
import me.chanjar.weixin.channel.bean.product.ExternalProductMappingResponse;
import me.chanjar.weixin.channel.bean.product.ProductAuditQuotaResponse;
import me.chanjar.weixin.channel.bean.product.ProductAuditStrategyResponse;
import me.chanjar.weixin.channel.bean.product.ProductAuditStrategySetParam;
import me.chanjar.weixin.channel.bean.product.ProductBrandRecommendParam;
import me.chanjar.weixin.channel.bean.product.ProductBrandRecommendResponse;
import me.chanjar.weixin.channel.bean.product.ProductCategoryClassifyParam;
import me.chanjar.weixin.channel.bean.product.ProductCategoryClassifyResponse;
import me.chanjar.weixin.channel.bean.product.ProductCategoryPreCheckParam;
import me.chanjar.weixin.channel.bean.product.ProductCategoryPreCheckResponse;
import me.chanjar.weixin.channel.bean.product.ProductSchemeParam;
import me.chanjar.weixin.channel.bean.product.ProductSchemeResponse;
import me.chanjar.weixin.channel.bean.product.ProductStockFlowParam;
import me.chanjar.weixin.channel.bean.product.ProductStockFlowResponse;
import me.chanjar.weixin.channel.bean.product.ProductTimingSaleParam;
import me.chanjar.weixin.channel.bean.product.SkuStockBatchResponse;
import me.chanjar.weixin.channel.bean.product.SkuStockResponse;
import me.chanjar.weixin.channel.bean.product.SpuFastInfo;
Expand Down Expand Up @@ -213,6 +233,123 @@ WxChannelBaseResponse updateStock(String productId, String skuId, Integer diffTy
*/
ProductTagLinkResponse getProductTagLink(String productId) throws WxErrorException;

/**
* 获取商品的移动应用跳转 scheme 码.
*
* @param param 商品 ID、来源 appid、过期时间和附加信息
* @return 商品跳转 scheme 码
* @throws WxErrorException 调用微信接口失败
*/
ProductSchemeResponse getProductScheme(ProductSchemeParam param) throws WxErrorException;

/**
* 商品类目推荐.
*
* @param param 请求类型、商品标题、主图和可选类目 ID;当请求类型为 2 时必须提供类目 ID
* @return 推荐类目及店铺经营权限
* @throws WxErrorException 调用微信接口失败
*/
ProductCategoryClassifyResponse classifyProductCategory(ProductCategoryClassifyParam param) throws WxErrorException;

/**
* 将定时开售商品改为立即开售.
*
* @param param 商品 ID 和定时开售任务 ID
* @return 操作结果
* @throws WxErrorException 调用微信接口失败
*/
WxChannelBaseResponse beginTimingSale(ProductTimingSaleParam param) throws WxErrorException;

/**
* 取消商品开售.
*
* @param productId 商品 ID
* @return 操作结果
* @throws WxErrorException 调用微信接口失败
*/
WxChannelBaseResponse cancelTimingSale(String productId) throws WxErrorException;

/**
* 查询站内外商品属性映射.
*
* @param param 叶子类目 ID、外部类目和外部属性
* @return 对应的站内属性及可选属性值
* @throws WxErrorException 调用微信接口失败
*/
ExternalProductMappingResponse externalProductMapping(ExternalProductMappingParam param) throws WxErrorException;

/**
* 发品前校验店铺类目资质.
*
* @param param 待发布商品的叶子类目 ID
* @return 校验结果和未通过原因
* @throws WxErrorException 调用微信接口失败
*/
ProductCategoryPreCheckResponse categoryPreCheck(ProductCategoryPreCheckParam param) throws WxErrorException;

/**
* 获取店铺维度的商品上架策略.
*
* @return 当前上架策略
* @throws WxErrorException 调用微信接口失败
*/
ProductAuditStrategyResponse getProductAuditStrategy() throws WxErrorException;

/**
* 设置店铺维度的商品上架策略.
*
* @param param 要设置的上架策略
* @return 操作结果
* @throws WxErrorException 调用微信接口失败
*/
WxChannelBaseResponse setProductAuditStrategy(ProductAuditStrategySetParam param) throws WxErrorException;

/**
* 获取当前店铺的商品提审限额.
*
* @return 提审总额度和新品剩余额度
* @throws WxErrorException 调用微信接口失败
*/
ProductAuditQuotaResponse getProductAuditQuota() throws WxErrorException;

/**
* 商品属性映射及推荐.
*
* @param param 叶子类目、商品标题、主图及可选的外部属性
* @return 推荐的站内属性
* @throws WxErrorException 调用微信接口失败
*/
ExternalProductMappingNewResponse externalProductMappingNew(ExternalProductMappingNewParam param)
throws WxErrorException;

/**
* 根据商品信息推荐店铺已有资质的品牌.
*
* @param param 商品叶子类目、标题和图片
* @return 推荐品牌
* @throws WxErrorException 调用微信接口失败
*/
ProductBrandRecommendResponse productBrandRecommend(ProductBrandRecommendParam param) throws WxErrorException;

/**
* 新增第三方货源信息.
*
* @param param 场景、发布方式、货主及货源商品信息
* @return 包含第三方货源 ID 的操作结果
* @throws WxErrorException 调用微信接口失败
*/
AddProductThirdPartySourceResponse addProductThirdPartySource(AddProductThirdPartySourceParam param)
throws WxErrorException;

/**
* 获取商品库存流水.
*
* @param param 商品、SKU、库存类型、时间范围和分页参数;pageSize 必填,stockType 为 1 时 finderId 必填,库存类型非 0 和 1 时 stockTypeId 必填
* @return 库存流水及下一页标识
* @throws WxErrorException 调用微信接口失败
*/
ProductStockFlowResponse getStockFlow(ProductStockFlowParam param) throws WxErrorException;

/**
* 添加非卖商品
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,45 @@


import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.CANCEL_AUDIT_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.DELETE_LIMIT_TASK_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.GIFT_ACTIVITY_ADD_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.GIFT_ACTIVITY_DELETE_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.GIFT_ACTIVITY_STOP_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.GIFT_PRODUCT_ADD_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.GIFT_PRODUCT_GET_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.GIFT_PRODUCT_LIST_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.GIFT_PRODUCT_ON_SALE_SET_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.GIFT_PRODUCT_STOCK_UPDATE_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.GIFT_PRODUCT_UPDATE_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.LIST_LIMIT_TASK_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_ADD_PRODUCT_THIRD_PARTY_SOURCE_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_ADD_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_AUDIT_FREE_UPDATE_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_AUDIT_STRATEGY_GET_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_AUDIT_STRATEGY_SET_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_BEGIN_TIMING_SALE_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_CANCEL_TIMING_SALE_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_CATEGORY_CLASSIFY_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_CATEGORY_PRE_CHECK_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_DELISTING_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_DEL_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_EXTERNAL_PRODUCT_MAPPING_NEW_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_EXTERNAL_PRODUCT_MAPPING_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_AUDIT_QUOTA_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_STOCK_BATCH_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_STOCK_FLOW_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_STOCK_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_H5URL_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_LISTING_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_LIST_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_PRODUCT_BRAND_RECOMMEND_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_QRCODE_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_SCHEME_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_TAGLINK_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_UPDATE_URL;

import java.util.Collections;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.channel.api.WxChannelGiftService;
Expand All @@ -24,13 +51,35 @@
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.product.AddProductThirdPartySourceParam;
import me.chanjar.weixin.channel.bean.product.AddProductThirdPartySourceResponse;
import me.chanjar.weixin.channel.bean.product.ExternalProductMappingNewParam;
import me.chanjar.weixin.channel.bean.product.ExternalProductMappingNewResponse;
import me.chanjar.weixin.channel.bean.product.ExternalProductMappingParam;
import me.chanjar.weixin.channel.bean.product.ExternalProductMappingResponse;
import me.chanjar.weixin.channel.bean.product.GiftActivityAddParam;
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.channel.bean.product.ProductAuditQuotaResponse;
import me.chanjar.weixin.channel.bean.product.ProductAuditStrategyResponse;
import me.chanjar.weixin.channel.bean.product.ProductAuditStrategySetParam;
import me.chanjar.weixin.channel.bean.product.ProductBrandRecommendParam;
import me.chanjar.weixin.channel.bean.product.ProductBrandRecommendResponse;
import me.chanjar.weixin.channel.bean.product.ProductCategoryClassifyParam;
import me.chanjar.weixin.channel.bean.product.ProductCategoryClassifyResponse;
import me.chanjar.weixin.channel.bean.product.ProductCategoryPreCheckParam;
import me.chanjar.weixin.channel.bean.product.ProductCategoryPreCheckResponse;
import me.chanjar.weixin.channel.bean.product.ProductSchemeParam;
import me.chanjar.weixin.channel.bean.product.ProductSchemeResponse;
import me.chanjar.weixin.channel.bean.product.ProductStockFlowParam;
import me.chanjar.weixin.channel.bean.product.ProductStockFlowResponse;
import me.chanjar.weixin.channel.bean.product.ProductTimingSaleParam;
import me.chanjar.weixin.channel.bean.product.SkuStockBatchParam;
import me.chanjar.weixin.channel.bean.product.SkuStockBatchResponse;
import me.chanjar.weixin.channel.bean.product.SkuStockResponse;
import me.chanjar.weixin.channel.bean.product.SpuFastInfo;
Expand Down Expand Up @@ -216,6 +265,85 @@ public ProductTagLinkResponse getProductTagLink(String productId) throws WxError
return ResponseUtils.decode(resJson, ProductTagLinkResponse.class);
}

@Override
public ProductSchemeResponse getProductScheme(ProductSchemeParam param) throws WxErrorException {
return postAndDecode(SPU_SCHEME_URL, param, ProductSchemeResponse.class);
}

@Override
public ProductCategoryClassifyResponse classifyProductCategory(ProductCategoryClassifyParam param)
throws WxErrorException {
return postAndDecode(SPU_CATEGORY_CLASSIFY_URL, param, ProductCategoryClassifyResponse.class);
}

@Override
public WxChannelBaseResponse beginTimingSale(ProductTimingSaleParam param) throws WxErrorException {
return postAndDecode(SPU_BEGIN_TIMING_SALE_URL, param, WxChannelBaseResponse.class);
}

@Override
public WxChannelBaseResponse cancelTimingSale(String productId) throws WxErrorException {
return postAndDecode(SPU_CANCEL_TIMING_SALE_URL, Collections.singletonMap("product_id", productId),
WxChannelBaseResponse.class);
}

@Override
public ExternalProductMappingResponse externalProductMapping(ExternalProductMappingParam param)
throws WxErrorException {
return postAndDecode(SPU_EXTERNAL_PRODUCT_MAPPING_URL, param, ExternalProductMappingResponse.class);
}

@Override
public ProductCategoryPreCheckResponse categoryPreCheck(ProductCategoryPreCheckParam param)
throws WxErrorException {
return postAndDecode(SPU_CATEGORY_PRE_CHECK_URL, param, ProductCategoryPreCheckResponse.class);
}

@Override
public ProductAuditStrategyResponse getProductAuditStrategy() throws WxErrorException {
return postAndDecode(SPU_AUDIT_STRATEGY_GET_URL, "{}", ProductAuditStrategyResponse.class);
}

@Override
public WxChannelBaseResponse setProductAuditStrategy(ProductAuditStrategySetParam param) throws WxErrorException {
return postAndDecode(SPU_AUDIT_STRATEGY_SET_URL, param, WxChannelBaseResponse.class);
}

@Override
public ProductAuditQuotaResponse getProductAuditQuota() throws WxErrorException {
return postAndDecode(SPU_GET_AUDIT_QUOTA_URL, "{}", ProductAuditQuotaResponse.class);
}

@Override
public ExternalProductMappingNewResponse externalProductMappingNew(ExternalProductMappingNewParam param)
throws WxErrorException {
return postAndDecode(SPU_EXTERNAL_PRODUCT_MAPPING_NEW_URL, param, ExternalProductMappingNewResponse.class);
}

@Override
public ProductBrandRecommendResponse productBrandRecommend(ProductBrandRecommendParam param)
throws WxErrorException {
return postAndDecode(SPU_PRODUCT_BRAND_RECOMMEND_URL, param, ProductBrandRecommendResponse.class);
}

@Override
public AddProductThirdPartySourceResponse addProductThirdPartySource(AddProductThirdPartySourceParam param)
throws WxErrorException {
return postAndDecode(SPU_ADD_PRODUCT_THIRD_PARTY_SOURCE_URL, param, AddProductThirdPartySourceResponse.class);
}

@Override
public ProductStockFlowResponse getStockFlow(ProductStockFlowParam param) throws WxErrorException {
return postAndDecode(SPU_GET_STOCK_FLOW_URL, param, ProductStockFlowResponse.class);
}

private <T extends WxChannelBaseResponse> T postAndDecode(String url, Object param, Class<T> responseType)
throws WxErrorException {
String reqJson = param instanceof String ? (String) param : JsonUtils.encode(param);
String resJson = shopService.post(url, reqJson);
return ResponseUtils.decode(resJson, responseType);
}

@Override
public GiftProductAddResponse addGiftProduct(GiftProductInfo info) throws WxErrorException {
return giftService.addGiftProduct(info);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package me.chanjar.weixin.channel.bean.product;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;
import java.io.Serializable;
import lombok.Data;

/** 新增第三方货源信息请求参数. */
@Data
public class AddProductThirdPartySourceParam implements Serializable {
private static final long serialVersionUID = -5784320217481497742L;

@JsonProperty("scene_value")
private Integer sceneValue;
@JsonProperty("publish_method")
private Integer publishMethod;
private JsonNode supplier;
@JsonProperty("supplier_shop_performance")
private JsonNode supplierShopPerformance;
@JsonProperty("product_source_info")
private JsonNode productSourceInfo;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package me.chanjar.weixin.channel.bean.product;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;

/** 新增第三方货源信息响应. */
@Data
@EqualsAndHashCode(callSuper = true)
public class AddProductThirdPartySourceResponse extends WxChannelBaseResponse {
private static final long serialVersionUID = -7528226120383065861L;

@JsonProperty("third_party_source_id")
private Long thirdPartySourceId;
}
Loading