11package me .chanjar .weixin .channel .api .impl ;
22
3+ import static me .chanjar .weixin .channel .constant .WxChannelApiUrlConstants .Spu .BEGIN_TIMING_SALE_URL ;
4+ import static me .chanjar .weixin .channel .constant .WxChannelApiUrlConstants .Spu .CANCEL_TIMING_SALE_URL ;
5+ import static me .chanjar .weixin .channel .constant .WxChannelApiUrlConstants .Spu .CATEGORY_PRE_CHECK_URL ;
6+ import static me .chanjar .weixin .channel .constant .WxChannelApiUrlConstants .Spu .EXTERNAL_PRODUCT_MAPPING_NEW_URL ;
7+ import static me .chanjar .weixin .channel .constant .WxChannelApiUrlConstants .Spu .EXTERNAL_PRODUCT_MAPPING_URL ;
8+ import static me .chanjar .weixin .channel .constant .WxChannelApiUrlConstants .Spu .PRODUCT_BRAND_RECOMMEND_URL ;
9+
310import me .chanjar .weixin .channel .api .WxChannelProductAssistantService ;
11+ import me .chanjar .weixin .channel .bean .base .WxChannelBaseResponse ;
12+ import me .chanjar .weixin .channel .bean .product .assistant .BeginTimingSaleParam ;
13+ import me .chanjar .weixin .channel .bean .product .assistant .CancelTimingSaleParam ;
14+ import me .chanjar .weixin .channel .bean .product .assistant .CategoryPreCheckParam ;
15+ import me .chanjar .weixin .channel .bean .product .assistant .CategoryPreCheckResponse ;
16+ import me .chanjar .weixin .channel .bean .product .assistant .ExternalProductMappingNewParam ;
17+ import me .chanjar .weixin .channel .bean .product .assistant .ExternalProductMappingNewResponse ;
18+ import me .chanjar .weixin .channel .bean .product .assistant .ExternalProductMappingParam ;
19+ import me .chanjar .weixin .channel .bean .product .assistant .ExternalProductMappingResponse ;
20+ import me .chanjar .weixin .channel .bean .product .assistant .ProductBrandRecommendParam ;
21+ import me .chanjar .weixin .channel .bean .product .assistant .ProductBrandRecommendResponse ;
22+ import me .chanjar .weixin .channel .util .JsonUtils ;
23+ import me .chanjar .weixin .channel .util .ResponseUtils ;
24+ import me .chanjar .weixin .common .error .WxErrorException ;
425
526/**
627 * 微信小店商品辅助功能服务实现。
@@ -13,4 +34,44 @@ public class WxChannelProductAssistantServiceImpl implements WxChannelProductAss
1334 public WxChannelProductAssistantServiceImpl (BaseWxChannelServiceImpl <?, ?> shopService ) {
1435 this .shopService = shopService ;
1536 }
37+
38+ @ Override
39+ public CategoryPreCheckResponse categoryPreCheck (CategoryPreCheckParam param ) throws WxErrorException {
40+ return post (CATEGORY_PRE_CHECK_URL , param , CategoryPreCheckResponse .class );
41+ }
42+
43+ @ Override
44+ public ProductBrandRecommendResponse getProductBrandRecommend (ProductBrandRecommendParam param )
45+ throws WxErrorException {
46+ return post (PRODUCT_BRAND_RECOMMEND_URL , param , ProductBrandRecommendResponse .class );
47+ }
48+
49+ @ Override
50+ public ExternalProductMappingResponse externalProductMapping (ExternalProductMappingParam param )
51+ throws WxErrorException {
52+ return post (EXTERNAL_PRODUCT_MAPPING_URL , param , ExternalProductMappingResponse .class );
53+ }
54+
55+ @ Override
56+ public ExternalProductMappingNewResponse externalProductMappingNew (ExternalProductMappingNewParam param )
57+ throws WxErrorException {
58+ return post (EXTERNAL_PRODUCT_MAPPING_NEW_URL , param , ExternalProductMappingNewResponse .class );
59+ }
60+
61+ @ Override
62+ public WxChannelBaseResponse beginTimingSale (BeginTimingSaleParam param ) throws WxErrorException {
63+ return post (BEGIN_TIMING_SALE_URL , param , WxChannelBaseResponse .class );
64+ }
65+
66+ @ Override
67+ public WxChannelBaseResponse cancelTimingSale (CancelTimingSaleParam param ) throws WxErrorException {
68+ return post (CANCEL_TIMING_SALE_URL , param , WxChannelBaseResponse .class );
69+ }
70+
71+ private <T extends WxChannelBaseResponse > T post (String url , Object param , Class <T > responseType )
72+ throws WxErrorException {
73+ String reqJson = JsonUtils .encode (param );
74+ String resJson = shopService .post (url , reqJson );
75+ return ResponseUtils .decode (resJson , responseType );
76+ }
1677}
0 commit comments