|
14 | 14 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.GIFT_PRODUCT_STOCK_UPDATE_URL; |
15 | 15 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.GIFT_PRODUCT_UPDATE_URL; |
16 | 16 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.LIST_LIMIT_TASK_URL; |
| 17 | +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_ADD_PRODUCT_THIRD_PARTY_SOURCE_URL; |
17 | 18 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_ADD_URL; |
18 | 19 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_AUDIT_FREE_UPDATE_URL; |
| 20 | +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_AUDIT_STRATEGY_GET_URL; |
| 21 | +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_AUDIT_STRATEGY_SET_URL; |
| 22 | +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_BEGIN_TIMING_SALE_URL; |
| 23 | +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_CANCEL_TIMING_SALE_URL; |
| 24 | +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_CATEGORY_CLASSIFY_URL; |
| 25 | +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_CATEGORY_PRE_CHECK_URL; |
19 | 26 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_DELISTING_URL; |
20 | 27 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_DEL_URL; |
| 28 | +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_EXTERNAL_PRODUCT_MAPPING_NEW_URL; |
| 29 | +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_EXTERNAL_PRODUCT_MAPPING_URL; |
| 30 | +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_AUDIT_QUOTA_URL; |
21 | 31 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_STOCK_BATCH_URL; |
| 32 | +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_STOCK_FLOW_URL; |
22 | 33 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_STOCK_URL; |
23 | 34 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_URL; |
24 | 35 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_H5URL_URL; |
25 | 36 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_LISTING_URL; |
26 | 37 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_LIST_URL; |
| 38 | +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_PRODUCT_BRAND_RECOMMEND_URL; |
27 | 39 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_QRCODE_URL; |
| 40 | +import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_SCHEME_URL; |
28 | 41 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_TAGLINK_URL; |
29 | 42 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_UPDATE_STOCK_URL; |
30 | 43 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_UPDATE_URL; |
31 | 44 | import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.STOP_LIMIT_TASK_URL; |
32 | 45 |
|
| 46 | +import java.util.Collections; |
33 | 47 | import java.util.List; |
34 | 48 | import lombok.extern.slf4j.Slf4j; |
35 | 49 | import me.chanjar.weixin.channel.api.WxChannelProductService; |
|
38 | 52 | import me.chanjar.weixin.channel.bean.limit.LimitTaskListParam; |
39 | 53 | import me.chanjar.weixin.channel.bean.limit.LimitTaskListResponse; |
40 | 54 | import me.chanjar.weixin.channel.bean.limit.LimitTaskParam; |
| 55 | +import me.chanjar.weixin.channel.bean.product.AddProductThirdPartySourceParam; |
| 56 | +import me.chanjar.weixin.channel.bean.product.AddProductThirdPartySourceResponse; |
| 57 | +import me.chanjar.weixin.channel.bean.product.ExternalProductMappingNewParam; |
| 58 | +import me.chanjar.weixin.channel.bean.product.ExternalProductMappingNewResponse; |
| 59 | +import me.chanjar.weixin.channel.bean.product.ExternalProductMappingParam; |
| 60 | +import me.chanjar.weixin.channel.bean.product.ExternalProductMappingResponse; |
41 | 61 | import me.chanjar.weixin.channel.bean.product.GiftActivityAddParam; |
42 | 62 | import me.chanjar.weixin.channel.bean.product.GiftActivityAddResponse; |
43 | 63 | import me.chanjar.weixin.channel.bean.product.GiftActivityInfo; |
|
46 | 66 | import me.chanjar.weixin.channel.bean.product.GiftProductInfo; |
47 | 67 | import me.chanjar.weixin.channel.bean.product.GiftProductListParam; |
48 | 68 | import me.chanjar.weixin.channel.bean.product.GiftProductListResponse; |
| 69 | +import me.chanjar.weixin.channel.bean.product.ProductAuditQuotaResponse; |
| 70 | +import me.chanjar.weixin.channel.bean.product.ProductAuditStrategyResponse; |
| 71 | +import me.chanjar.weixin.channel.bean.product.ProductAuditStrategySetParam; |
| 72 | +import me.chanjar.weixin.channel.bean.product.ProductBrandRecommendParam; |
| 73 | +import me.chanjar.weixin.channel.bean.product.ProductBrandRecommendResponse; |
| 74 | +import me.chanjar.weixin.channel.bean.product.ProductCategoryClassifyParam; |
| 75 | +import me.chanjar.weixin.channel.bean.product.ProductCategoryClassifyResponse; |
| 76 | +import me.chanjar.weixin.channel.bean.product.ProductCategoryPreCheckParam; |
| 77 | +import me.chanjar.weixin.channel.bean.product.ProductCategoryPreCheckResponse; |
| 78 | +import me.chanjar.weixin.channel.bean.product.ProductSchemeParam; |
| 79 | +import me.chanjar.weixin.channel.bean.product.ProductSchemeResponse; |
| 80 | +import me.chanjar.weixin.channel.bean.product.ProductStockFlowParam; |
| 81 | +import me.chanjar.weixin.channel.bean.product.ProductStockFlowResponse; |
| 82 | +import me.chanjar.weixin.channel.bean.product.ProductTimingSaleParam; |
49 | 83 | import me.chanjar.weixin.channel.bean.product.SkuStockBatchParam; |
50 | 84 | import me.chanjar.weixin.channel.bean.product.SkuStockBatchResponse; |
51 | 85 | import me.chanjar.weixin.channel.bean.product.SkuStockParam; |
@@ -228,6 +262,85 @@ public ProductTagLinkResponse getProductTagLink(String productId) throws WxError |
228 | 262 | return ResponseUtils.decode(resJson, ProductTagLinkResponse.class); |
229 | 263 | } |
230 | 264 |
|
| 265 | + @Override |
| 266 | + public ProductSchemeResponse getProductScheme(ProductSchemeParam param) throws WxErrorException { |
| 267 | + return postAndDecode(SPU_SCHEME_URL, param, ProductSchemeResponse.class); |
| 268 | + } |
| 269 | + |
| 270 | + @Override |
| 271 | + public ProductCategoryClassifyResponse classifyProductCategory(ProductCategoryClassifyParam param) |
| 272 | + throws WxErrorException { |
| 273 | + return postAndDecode(SPU_CATEGORY_CLASSIFY_URL, param, ProductCategoryClassifyResponse.class); |
| 274 | + } |
| 275 | + |
| 276 | + @Override |
| 277 | + public WxChannelBaseResponse beginTimingSale(ProductTimingSaleParam param) throws WxErrorException { |
| 278 | + return postAndDecode(SPU_BEGIN_TIMING_SALE_URL, param, WxChannelBaseResponse.class); |
| 279 | + } |
| 280 | + |
| 281 | + @Override |
| 282 | + public WxChannelBaseResponse cancelTimingSale(String productId) throws WxErrorException { |
| 283 | + return postAndDecode(SPU_CANCEL_TIMING_SALE_URL, Collections.singletonMap("product_id", productId), |
| 284 | + WxChannelBaseResponse.class); |
| 285 | + } |
| 286 | + |
| 287 | + @Override |
| 288 | + public ExternalProductMappingResponse externalProductMapping(ExternalProductMappingParam param) |
| 289 | + throws WxErrorException { |
| 290 | + return postAndDecode(SPU_EXTERNAL_PRODUCT_MAPPING_URL, param, ExternalProductMappingResponse.class); |
| 291 | + } |
| 292 | + |
| 293 | + @Override |
| 294 | + public ProductCategoryPreCheckResponse categoryPreCheck(ProductCategoryPreCheckParam param) |
| 295 | + throws WxErrorException { |
| 296 | + return postAndDecode(SPU_CATEGORY_PRE_CHECK_URL, param, ProductCategoryPreCheckResponse.class); |
| 297 | + } |
| 298 | + |
| 299 | + @Override |
| 300 | + public ProductAuditStrategyResponse getProductAuditStrategy() throws WxErrorException { |
| 301 | + return postAndDecode(SPU_AUDIT_STRATEGY_GET_URL, "{}", ProductAuditStrategyResponse.class); |
| 302 | + } |
| 303 | + |
| 304 | + @Override |
| 305 | + public WxChannelBaseResponse setProductAuditStrategy(ProductAuditStrategySetParam param) throws WxErrorException { |
| 306 | + return postAndDecode(SPU_AUDIT_STRATEGY_SET_URL, param, WxChannelBaseResponse.class); |
| 307 | + } |
| 308 | + |
| 309 | + @Override |
| 310 | + public ProductAuditQuotaResponse getProductAuditQuota() throws WxErrorException { |
| 311 | + return postAndDecode(SPU_GET_AUDIT_QUOTA_URL, "{}", ProductAuditQuotaResponse.class); |
| 312 | + } |
| 313 | + |
| 314 | + @Override |
| 315 | + public ExternalProductMappingNewResponse externalProductMappingNew(ExternalProductMappingNewParam param) |
| 316 | + throws WxErrorException { |
| 317 | + return postAndDecode(SPU_EXTERNAL_PRODUCT_MAPPING_NEW_URL, param, ExternalProductMappingNewResponse.class); |
| 318 | + } |
| 319 | + |
| 320 | + @Override |
| 321 | + public ProductBrandRecommendResponse productBrandRecommend(ProductBrandRecommendParam param) |
| 322 | + throws WxErrorException { |
| 323 | + return postAndDecode(SPU_PRODUCT_BRAND_RECOMMEND_URL, param, ProductBrandRecommendResponse.class); |
| 324 | + } |
| 325 | + |
| 326 | + @Override |
| 327 | + public AddProductThirdPartySourceResponse addProductThirdPartySource(AddProductThirdPartySourceParam param) |
| 328 | + throws WxErrorException { |
| 329 | + return postAndDecode(SPU_ADD_PRODUCT_THIRD_PARTY_SOURCE_URL, param, AddProductThirdPartySourceResponse.class); |
| 330 | + } |
| 331 | + |
| 332 | + @Override |
| 333 | + public ProductStockFlowResponse getStockFlow(ProductStockFlowParam param) throws WxErrorException { |
| 334 | + return postAndDecode(SPU_GET_STOCK_FLOW_URL, param, ProductStockFlowResponse.class); |
| 335 | + } |
| 336 | + |
| 337 | + private <T extends WxChannelBaseResponse> T postAndDecode(String url, Object param, Class<T> responseType) |
| 338 | + throws WxErrorException { |
| 339 | + String reqJson = param instanceof String ? (String) param : JsonUtils.encode(param); |
| 340 | + String resJson = shopService.post(url, reqJson); |
| 341 | + return ResponseUtils.decode(resJson, responseType); |
| 342 | + } |
| 343 | + |
231 | 344 | @Override |
232 | 345 | public GiftProductAddResponse addGiftProduct(GiftProductInfo info) throws WxErrorException { |
233 | 346 | String reqJson = JsonUtils.encode(info); |
|
0 commit comments