Skip to content

Commit 52b883c

Browse files
authored
实现商品管理缺失接口与模型
1 parent 88be9c3 commit 52b883c

24 files changed

Lines changed: 1036 additions & 0 deletions

‎weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelProductService.java‎

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,25 @@
88
import me.chanjar.weixin.channel.bean.limit.LimitTaskParam;
99
import me.chanjar.weixin.channel.bean.product.SkuStockBatchResponse;
1010
import me.chanjar.weixin.channel.bean.product.SkuStockResponse;
11+
import me.chanjar.weixin.channel.bean.product.AddProductThirdPartySourceParam;
12+
import me.chanjar.weixin.channel.bean.product.ExternalProductMappingNewParam;
13+
import me.chanjar.weixin.channel.bean.product.ExternalProductMappingNewResponse;
14+
import me.chanjar.weixin.channel.bean.product.ExternalProductMappingParam;
15+
import me.chanjar.weixin.channel.bean.product.ExternalProductMappingResponse;
16+
import me.chanjar.weixin.channel.bean.product.ProductAuditQuotaResponse;
17+
import me.chanjar.weixin.channel.bean.product.ProductAuditStrategyResponse;
18+
import me.chanjar.weixin.channel.bean.product.ProductAuditStrategySetParam;
19+
import me.chanjar.weixin.channel.bean.product.ProductBrandRecommendParam;
20+
import me.chanjar.weixin.channel.bean.product.ProductBrandRecommendResponse;
21+
import me.chanjar.weixin.channel.bean.product.ProductCategoryClassifyParam;
22+
import me.chanjar.weixin.channel.bean.product.ProductCategoryClassifyResponse;
23+
import me.chanjar.weixin.channel.bean.product.ProductCategoryPreCheckParam;
24+
import me.chanjar.weixin.channel.bean.product.ProductCategoryPreCheckResponse;
25+
import me.chanjar.weixin.channel.bean.product.ProductSchemeParam;
26+
import me.chanjar.weixin.channel.bean.product.ProductSchemeResponse;
27+
import me.chanjar.weixin.channel.bean.product.ProductStockFlowParam;
28+
import me.chanjar.weixin.channel.bean.product.ProductStockFlowResponse;
29+
import me.chanjar.weixin.channel.bean.product.ProductTimingSaleParam;
1130
import me.chanjar.weixin.channel.bean.product.SpuFastInfo;
1231
import me.chanjar.weixin.channel.bean.product.SpuGetResponse;
1332
import me.chanjar.weixin.channel.bean.product.SpuInfo;
@@ -206,6 +225,122 @@ WxChannelBaseResponse updateStock(String productId, String skuId, Integer diffTy
206225
*/
207226
ProductTagLinkResponse getProductTagLink(String productId) throws WxErrorException;
208227

228+
/**
229+
* 获取商品的移动应用跳转scheme码
230+
*
231+
* @param param 请求参数
232+
* @return 商品scheme码
233+
* @throws WxErrorException 异常
234+
*/
235+
ProductSchemeResponse getProductScheme(ProductSchemeParam param) throws WxErrorException;
236+
237+
/**
238+
* 商品类目推荐
239+
*
240+
* @param param 请求参数
241+
* @return 推荐类目
242+
* @throws WxErrorException 异常
243+
*/
244+
ProductCategoryClassifyResponse classifyProductCategory(ProductCategoryClassifyParam param) throws WxErrorException;
245+
246+
/**
247+
* 商品立即开售
248+
*
249+
* @param param 请求参数
250+
* @return 是否成功
251+
* @throws WxErrorException 异常
252+
*/
253+
WxChannelBaseResponse beginTimingSale(ProductTimingSaleParam param) throws WxErrorException;
254+
255+
/**
256+
* 取消商品开售
257+
*
258+
* @param productId 商品ID
259+
* @return 是否成功
260+
* @throws WxErrorException 异常
261+
*/
262+
WxChannelBaseResponse cancelTimingSale(String productId) throws WxErrorException;
263+
264+
/**
265+
* 站内外商品属性映射
266+
*
267+
* @param param 请求参数
268+
* @return 映射结果
269+
* @throws WxErrorException 异常
270+
*/
271+
ExternalProductMappingResponse externalProductMapping(ExternalProductMappingParam param) throws WxErrorException;
272+
273+
/**
274+
* 发品前校验
275+
*
276+
* @param param 请求参数
277+
* @return 校验结果
278+
* @throws WxErrorException 异常
279+
*/
280+
ProductCategoryPreCheckResponse categoryPreCheck(ProductCategoryPreCheckParam param) throws WxErrorException;
281+
282+
/**
283+
* 获取商品上架策略
284+
*
285+
* @return 上架策略
286+
* @throws WxErrorException 异常
287+
*/
288+
ProductAuditStrategyResponse getProductAuditStrategy() throws WxErrorException;
289+
290+
/**
291+
* 设置商品上架策略
292+
*
293+
* @param param 请求参数
294+
* @return 是否成功
295+
* @throws WxErrorException 异常
296+
*/
297+
WxChannelBaseResponse setProductAuditStrategy(ProductAuditStrategySetParam param) throws WxErrorException;
298+
299+
/**
300+
* 获取商品提审限额
301+
*
302+
* @return 提审限额
303+
* @throws WxErrorException 异常
304+
*/
305+
ProductAuditQuotaResponse getProductAuditQuota() throws WxErrorException;
306+
307+
/**
308+
* 商品属性映射及推荐
309+
*
310+
* @param param 请求参数
311+
* @return 映射推荐结果
312+
* @throws WxErrorException 异常
313+
*/
314+
ExternalProductMappingNewResponse externalProductMappingNew(ExternalProductMappingNewParam param)
315+
throws WxErrorException;
316+
317+
/**
318+
* 商品品牌推荐
319+
*
320+
* @param param 请求参数
321+
* @return 品牌推荐结果
322+
* @throws WxErrorException 异常
323+
*/
324+
ProductBrandRecommendResponse productBrandRecommend(ProductBrandRecommendParam param) throws WxErrorException;
325+
326+
/**
327+
* 新增第三方货源信息
328+
*
329+
* @param param 请求参数
330+
* @return 是否成功
331+
* @throws WxErrorException 异常
332+
*/
333+
WxChannelBaseResponse addProductThirdPartySource(AddProductThirdPartySourceParam param) throws WxErrorException;
334+
335+
/**
336+
* 获取库存流水
337+
*
338+
* @param param 请求参数
339+
* @return 库存流水
340+
* @throws WxErrorException 异常
341+
*/
342+
ProductStockFlowResponse getStockFlow(ProductStockFlowParam param) throws WxErrorException;
343+
209344
/**
210345
* 添加限时抢购任务
211346
*

‎weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelProductServiceImpl.java‎

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,30 @@
55
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.CANCEL_AUDIT_URL;
66
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.DELETE_LIMIT_TASK_URL;
77
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.LIST_LIMIT_TASK_URL;
8+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_ADD_PRODUCT_THIRD_PARTY_SOURCE_URL;
89
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_ADD_URL;
910
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_AUDIT_FREE_UPDATE_URL;
11+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_AUDIT_STRATEGY_GET_URL;
12+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_AUDIT_STRATEGY_SET_URL;
13+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_BEGIN_TIMING_SALE_URL;
14+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_CANCEL_TIMING_SALE_URL;
15+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_CATEGORY_CLASSIFY_URL;
16+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_CATEGORY_PRE_CHECK_URL;
1017
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_DELISTING_URL;
1118
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_DEL_URL;
19+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_EXTERNAL_PRODUCT_MAPPING_NEW_URL;
20+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_EXTERNAL_PRODUCT_MAPPING_URL;
21+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_AUDIT_QUOTA_URL;
1222
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_STOCK_BATCH_URL;
23+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_STOCK_FLOW_URL;
1324
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_STOCK_URL;
1425
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_URL;
1526
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_H5URL_URL;
1627
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_LISTING_URL;
1728
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_LIST_URL;
29+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_PRODUCT_BRAND_RECOMMEND_URL;
1830
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_QRCODE_URL;
31+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_SCHEME_URL;
1932
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_TAGLINK_URL;
2033
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_UPDATE_STOCK_URL;
2134
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_UPDATE_URL;
@@ -29,6 +42,25 @@
2942
import me.chanjar.weixin.channel.bean.limit.LimitTaskListParam;
3043
import me.chanjar.weixin.channel.bean.limit.LimitTaskListResponse;
3144
import me.chanjar.weixin.channel.bean.limit.LimitTaskParam;
45+
import me.chanjar.weixin.channel.bean.product.AddProductThirdPartySourceParam;
46+
import me.chanjar.weixin.channel.bean.product.ExternalProductMappingNewParam;
47+
import me.chanjar.weixin.channel.bean.product.ExternalProductMappingNewResponse;
48+
import me.chanjar.weixin.channel.bean.product.ExternalProductMappingParam;
49+
import me.chanjar.weixin.channel.bean.product.ExternalProductMappingResponse;
50+
import me.chanjar.weixin.channel.bean.product.ProductAuditQuotaResponse;
51+
import me.chanjar.weixin.channel.bean.product.ProductAuditStrategyResponse;
52+
import me.chanjar.weixin.channel.bean.product.ProductAuditStrategySetParam;
53+
import me.chanjar.weixin.channel.bean.product.ProductBrandRecommendParam;
54+
import me.chanjar.weixin.channel.bean.product.ProductBrandRecommendResponse;
55+
import me.chanjar.weixin.channel.bean.product.ProductCategoryClassifyParam;
56+
import me.chanjar.weixin.channel.bean.product.ProductCategoryClassifyResponse;
57+
import me.chanjar.weixin.channel.bean.product.ProductCategoryPreCheckParam;
58+
import me.chanjar.weixin.channel.bean.product.ProductCategoryPreCheckResponse;
59+
import me.chanjar.weixin.channel.bean.product.ProductSchemeParam;
60+
import me.chanjar.weixin.channel.bean.product.ProductSchemeResponse;
61+
import me.chanjar.weixin.channel.bean.product.ProductStockFlowParam;
62+
import me.chanjar.weixin.channel.bean.product.ProductStockFlowResponse;
63+
import me.chanjar.weixin.channel.bean.product.ProductTimingSaleParam;
3264
import me.chanjar.weixin.channel.bean.product.SkuStockBatchParam;
3365
import me.chanjar.weixin.channel.bean.product.SkuStockBatchResponse;
3466
import me.chanjar.weixin.channel.bean.product.SkuStockParam;
@@ -211,6 +243,101 @@ public ProductTagLinkResponse getProductTagLink(String productId) throws WxError
211243
return ResponseUtils.decode(resJson, ProductTagLinkResponse.class);
212244
}
213245

246+
@Override
247+
public ProductSchemeResponse getProductScheme(ProductSchemeParam param) throws WxErrorException {
248+
String reqJson = JsonUtils.encode(param);
249+
String resJson = shopService.post(SPU_SCHEME_URL, reqJson);
250+
return ResponseUtils.decode(resJson, ProductSchemeResponse.class);
251+
}
252+
253+
@Override
254+
public ProductCategoryClassifyResponse classifyProductCategory(ProductCategoryClassifyParam param)
255+
throws WxErrorException {
256+
String reqJson = JsonUtils.encode(param);
257+
String resJson = shopService.post(SPU_CATEGORY_CLASSIFY_URL, reqJson);
258+
return ResponseUtils.decode(resJson, ProductCategoryClassifyResponse.class);
259+
}
260+
261+
@Override
262+
public WxChannelBaseResponse beginTimingSale(ProductTimingSaleParam param) throws WxErrorException {
263+
String reqJson = JsonUtils.encode(param);
264+
String resJson = shopService.post(SPU_BEGIN_TIMING_SALE_URL, reqJson);
265+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
266+
}
267+
268+
@Override
269+
public WxChannelBaseResponse cancelTimingSale(String productId) throws WxErrorException {
270+
String reqJson = "{\"product_id\":\"" + productId + "\"}";
271+
String resJson = shopService.post(SPU_CANCEL_TIMING_SALE_URL, reqJson);
272+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
273+
}
274+
275+
@Override
276+
public ExternalProductMappingResponse externalProductMapping(ExternalProductMappingParam param)
277+
throws WxErrorException {
278+
String reqJson = JsonUtils.encode(param);
279+
String resJson = shopService.post(SPU_EXTERNAL_PRODUCT_MAPPING_URL, reqJson);
280+
return ResponseUtils.decode(resJson, ExternalProductMappingResponse.class);
281+
}
282+
283+
@Override
284+
public ProductCategoryPreCheckResponse categoryPreCheck(ProductCategoryPreCheckParam param)
285+
throws WxErrorException {
286+
String reqJson = JsonUtils.encode(param);
287+
String resJson = shopService.post(SPU_CATEGORY_PRE_CHECK_URL, reqJson);
288+
return ResponseUtils.decode(resJson, ProductCategoryPreCheckResponse.class);
289+
}
290+
291+
@Override
292+
public ProductAuditStrategyResponse getProductAuditStrategy() throws WxErrorException {
293+
String resJson = shopService.post(SPU_AUDIT_STRATEGY_GET_URL, "{}");
294+
return ResponseUtils.decode(resJson, ProductAuditStrategyResponse.class);
295+
}
296+
297+
@Override
298+
public WxChannelBaseResponse setProductAuditStrategy(ProductAuditStrategySetParam param) throws WxErrorException {
299+
String reqJson = JsonUtils.encode(param);
300+
String resJson = shopService.post(SPU_AUDIT_STRATEGY_SET_URL, reqJson);
301+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
302+
}
303+
304+
@Override
305+
public ProductAuditQuotaResponse getProductAuditQuota() throws WxErrorException {
306+
String resJson = shopService.post(SPU_GET_AUDIT_QUOTA_URL, "{}");
307+
return ResponseUtils.decode(resJson, ProductAuditQuotaResponse.class);
308+
}
309+
310+
@Override
311+
public ExternalProductMappingNewResponse externalProductMappingNew(ExternalProductMappingNewParam param)
312+
throws WxErrorException {
313+
String reqJson = JsonUtils.encode(param);
314+
String resJson = shopService.post(SPU_EXTERNAL_PRODUCT_MAPPING_NEW_URL, reqJson);
315+
return ResponseUtils.decode(resJson, ExternalProductMappingNewResponse.class);
316+
}
317+
318+
@Override
319+
public ProductBrandRecommendResponse productBrandRecommend(ProductBrandRecommendParam param)
320+
throws WxErrorException {
321+
String reqJson = JsonUtils.encode(param);
322+
String resJson = shopService.post(SPU_PRODUCT_BRAND_RECOMMEND_URL, reqJson);
323+
return ResponseUtils.decode(resJson, ProductBrandRecommendResponse.class);
324+
}
325+
326+
@Override
327+
public WxChannelBaseResponse addProductThirdPartySource(AddProductThirdPartySourceParam param)
328+
throws WxErrorException {
329+
String reqJson = JsonUtils.encode(param);
330+
String resJson = shopService.post(SPU_ADD_PRODUCT_THIRD_PARTY_SOURCE_URL, reqJson);
331+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
332+
}
333+
334+
@Override
335+
public ProductStockFlowResponse getStockFlow(ProductStockFlowParam param) throws WxErrorException {
336+
String reqJson = JsonUtils.encode(param);
337+
String resJson = shopService.post(SPU_GET_STOCK_FLOW_URL, reqJson);
338+
return ResponseUtils.decode(resJson, ProductStockFlowResponse.class);
339+
}
340+
214341
@Override
215342
public LimitTaskAddResponse addLimitTask(LimitTaskParam param) throws WxErrorException {
216343
String reqJson = JsonUtils.encode(param);
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package me.chanjar.weixin.channel.bean.product;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import com.fasterxml.jackson.databind.JsonNode;
5+
import java.io.Serializable;
6+
import lombok.Data;
7+
import lombok.NoArgsConstructor;
8+
9+
/**
10+
* 新增第三方货源信息请求参数.
11+
*
12+
* @author GitHub Copilot
13+
*/
14+
@Data
15+
@NoArgsConstructor
16+
public class AddProductThirdPartySourceParam implements Serializable {
17+
18+
private static final long serialVersionUID = -5784320217481497742L;
19+
20+
/** 场景值. */
21+
@JsonProperty("scene_value")
22+
private Integer sceneValue;
23+
24+
/** 商品发布方式. */
25+
@JsonProperty("publish_method")
26+
private Integer publishMethod;
27+
28+
/** 货主信息. */
29+
private JsonNode supplier;
30+
31+
/** 货主店铺经营表现. */
32+
@JsonProperty("supplier_shop_performance")
33+
private JsonNode supplierShopPerformance;
34+
35+
/** 商品在货源平台信息. */
36+
@JsonProperty("product_source_info")
37+
private JsonNode productSourceInfo;
38+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package me.chanjar.weixin.channel.bean.product;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import java.io.Serializable;
5+
import java.util.List;
6+
import lombok.Data;
7+
import lombok.NoArgsConstructor;
8+
9+
/**
10+
* 商品属性映射及推荐请求参数.
11+
*
12+
* @author GitHub Copilot
13+
*/
14+
@Data
15+
@NoArgsConstructor
16+
public class ExternalProductMappingNewParam implements Serializable {
17+
18+
private static final long serialVersionUID = -7982070319116550518L;
19+
20+
/** 叶子类目ID. */
21+
@JsonProperty("cat_id")
22+
private Long catId;
23+
24+
/** 外部商品类目名称. */
25+
@JsonProperty("external_category_name")
26+
private String externalCategoryName;
27+
28+
/** 商品主图. */
29+
@JsonProperty("head_imgs")
30+
private List<String> headImgs;
31+
32+
/** 商品详情图. */
33+
@JsonProperty("detail_imgs")
34+
private List<String> detailImgs;
35+
36+
/** 商品标题. */
37+
private String title;
38+
39+
/** 外部属性列表. */
40+
@JsonProperty("external_attributes")
41+
private List<ExternalAttribute> externalAttributes;
42+
43+
@Data
44+
@NoArgsConstructor
45+
public static class ExternalAttribute implements Serializable {
46+
private static final long serialVersionUID = 300805187240781417L;
47+
48+
private String key;
49+
private String value;
50+
}
51+
}

0 commit comments

Comments
 (0)