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