Skip to content

Commit 1fa9012

Browse files
authored
🆕 #4039 【视频号】新增微信小店质检管理模块接口与模型支持
1 parent b3a9ee7 commit 1fa9012

11 files changed

Lines changed: 665 additions & 0 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package me.chanjar.weixin.channel.api;
2+
3+
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
4+
import me.chanjar.weixin.channel.bean.qic.InspectCodeResponse;
5+
import me.chanjar.weixin.channel.bean.qic.InspectConfigResponse;
6+
import me.chanjar.weixin.channel.bean.qic.RegisterLogisticsRequest;
7+
import me.chanjar.weixin.channel.bean.qic.SubmitConfigResponse;
8+
import me.chanjar.weixin.channel.bean.qic.SubmitInspectRequest;
9+
import me.chanjar.weixin.common.error.WxErrorException;
10+
11+
/**
12+
* 视频号小店 质检管理接口.
13+
*/
14+
public interface WxChannelQicService {
15+
16+
/**
17+
* 查询质检仓配置.
18+
*
19+
* @return 质检仓配置
20+
* @throws WxErrorException 异常
21+
*/
22+
InspectConfigResponse getInspectConfig() throws WxErrorException;
23+
24+
/**
25+
* 查询送检配置模板信息.
26+
*
27+
* @param orderId 订单号(可选)
28+
* @return 送检配置模板信息
29+
* @throws WxErrorException 异常
30+
*/
31+
SubmitConfigResponse getSubmitConfig(String orderId) throws WxErrorException;
32+
33+
/**
34+
* 查询送检配置模板信息.
35+
*
36+
* @return 送检配置模板信息
37+
* @throws WxErrorException 异常
38+
*/
39+
SubmitConfigResponse getSubmitConfig() throws WxErrorException;
40+
41+
/**
42+
* 打印质检码.
43+
*
44+
* @param orderId 订单号
45+
* @return 质检码详情
46+
* @throws WxErrorException 异常
47+
*/
48+
InspectCodeResponse printInspectCode(String orderId) throws WxErrorException;
49+
50+
/**
51+
* 绑定送检信息.
52+
*
53+
* @param request 送检信息请求
54+
* @return 基础响应
55+
* @throws WxErrorException 异常
56+
*/
57+
WxChannelBaseResponse submitInspectInfo(SubmitInspectRequest request) throws WxErrorException;
58+
59+
/**
60+
* 自寄快递送检.
61+
*
62+
* @param request 自寄快递请求
63+
* @return 基础响应
64+
* @throws WxErrorException 异常
65+
*/
66+
WxChannelBaseResponse registerLogistics(RegisterLogisticsRequest request) throws WxErrorException;
67+
}

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelService.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,11 @@ public interface WxChannelService extends BaseWxChannelService {
182182
*/
183183
WxChannelLiveDashboardService getLiveDashboardService();
184184

185+
/**
186+
* 质检管理服务.
187+
*
188+
* @return 质检管理服务
189+
*/
190+
WxChannelQicService getQicService();
191+
185192
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public abstract class BaseWxChannelServiceImpl<H, P> implements WxChannelService
6060
private WxChannelVipService vipService = null;
6161
private WxChannelCompassFinderService compassFinderService = null;
6262
private WxChannelLiveDashboardService liveDashboardService = null;
63+
private WxChannelQicService qicService = null;
6364

6465
protected WxChannelConfig config;
6566
private int retrySleepMillis = 1000;
@@ -473,4 +474,12 @@ public synchronized WxChannelLiveDashboardService getLiveDashboardService() {
473474
return liveDashboardService;
474475
}
475476

477+
@Override
478+
public synchronized WxChannelQicService getQicService() {
479+
if (qicService == null) {
480+
qicService = new WxChannelQicServiceImpl(this);
481+
}
482+
return qicService;
483+
}
484+
476485
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package me.chanjar.weixin.channel.api.impl;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import lombok.AllArgsConstructor;
5+
import lombok.Data;
6+
import me.chanjar.weixin.channel.api.WxChannelQicService;
7+
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
8+
import me.chanjar.weixin.channel.bean.qic.InspectCodeResponse;
9+
import me.chanjar.weixin.channel.bean.qic.InspectConfigResponse;
10+
import me.chanjar.weixin.channel.bean.qic.RegisterLogisticsRequest;
11+
import me.chanjar.weixin.channel.bean.qic.SubmitConfigResponse;
12+
import me.chanjar.weixin.channel.bean.qic.SubmitInspectRequest;
13+
import me.chanjar.weixin.channel.util.ResponseUtils;
14+
import me.chanjar.weixin.common.error.WxErrorException;
15+
import org.apache.commons.lang3.StringUtils;
16+
17+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Qic.GET_INSPECT_CONFIG_URL;
18+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Qic.GET_SUBMIT_CONFIG_URL;
19+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Qic.PRINT_INSPECT_CODE_URL;
20+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Qic.REGISTER_LOGISTICS_URL;
21+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Qic.SUBMIT_INSPECT_INFO_URL;
22+
23+
/**
24+
* 视频号小店 质检管理服务实现.
25+
*/
26+
public class WxChannelQicServiceImpl implements WxChannelQicService {
27+
private final BaseWxChannelServiceImpl<?, ?> shopService;
28+
29+
public WxChannelQicServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
30+
this.shopService = shopService;
31+
}
32+
33+
@Override
34+
public InspectConfigResponse getInspectConfig() throws WxErrorException {
35+
String respJson = shopService.get(GET_INSPECT_CONFIG_URL, null);
36+
return ResponseUtils.decode(respJson, InspectConfigResponse.class);
37+
}
38+
39+
@Override
40+
public SubmitConfigResponse getSubmitConfig(String orderId) throws WxErrorException {
41+
String queryParam = StringUtils.isBlank(orderId) ? null : "order_id=" + orderId;
42+
String respJson = shopService.get(GET_SUBMIT_CONFIG_URL, queryParam);
43+
return ResponseUtils.decode(respJson, SubmitConfigResponse.class);
44+
}
45+
46+
@Override
47+
public SubmitConfigResponse getSubmitConfig() throws WxErrorException {
48+
return getSubmitConfig(null);
49+
}
50+
51+
@Override
52+
public InspectCodeResponse printInspectCode(String orderId) throws WxErrorException {
53+
String respJson = shopService.post(PRINT_INSPECT_CODE_URL, new PrintInspectCodeRequest(orderId));
54+
return ResponseUtils.decode(respJson, InspectCodeResponse.class);
55+
}
56+
57+
@Override
58+
public WxChannelBaseResponse submitInspectInfo(SubmitInspectRequest request) throws WxErrorException {
59+
String respJson = shopService.post(SUBMIT_INSPECT_INFO_URL, request);
60+
return ResponseUtils.decode(respJson, WxChannelBaseResponse.class);
61+
}
62+
63+
@Override
64+
public WxChannelBaseResponse registerLogistics(RegisterLogisticsRequest request) throws WxErrorException {
65+
String respJson = shopService.post(REGISTER_LOGISTICS_URL, request);
66+
return ResponseUtils.decode(respJson, WxChannelBaseResponse.class);
67+
}
68+
69+
@Data
70+
@AllArgsConstructor
71+
private static class PrintInspectCodeRequest {
72+
@JsonProperty("order_id")
73+
private String orderId;
74+
}
75+
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
package me.chanjar.weixin.channel.bean.qic;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
8+
9+
import java.io.Serializable;
10+
import java.util.List;
11+
12+
@Data
13+
@NoArgsConstructor
14+
@JsonInclude(JsonInclude.Include.NON_NULL)
15+
public class InspectCodeResponse extends WxChannelBaseResponse {
16+
private static final long serialVersionUID = -6242555695898612990L;
17+
18+
private DataPayload data;
19+
20+
@Data
21+
@NoArgsConstructor
22+
@JsonInclude(JsonInclude.Include.NON_NULL)
23+
public static class DataPayload implements Serializable {
24+
private static final long serialVersionUID = 684071509005627272L;
25+
26+
@JsonProperty("backupDeliveryId")
27+
private String backupDeliveryId;
28+
29+
@JsonProperty("backupDeliveryName")
30+
private String backupDeliveryName;
31+
32+
@JsonProperty("boxDTOList")
33+
private List<BoxInfo> boxInfoList;
34+
35+
@JsonProperty("channelAppId")
36+
private String channelAppId;
37+
38+
@JsonProperty("deliveryId")
39+
private String deliveryId;
40+
41+
@JsonProperty("deliveryName")
42+
private String deliveryName;
43+
44+
@JsonProperty("embedGoodsMaterial")
45+
private String embedGoodsMaterial;
46+
47+
@JsonProperty("goodsDesc")
48+
private String goodsDesc;
49+
50+
@JsonProperty("expressMerge")
51+
private Boolean expressMerge;
52+
53+
@JsonProperty("goodsMainMaterial")
54+
private String goodsMainMaterial;
55+
56+
@JsonProperty("goodsName")
57+
private String goodsName;
58+
59+
@JsonProperty("goodsNum")
60+
private Integer goodsNum;
61+
62+
@JsonProperty("goodsPartsMaterial")
63+
private String goodsPartsMaterial;
64+
65+
@JsonProperty("inspectBaseId")
66+
private String inspectBaseId;
67+
68+
@JsonProperty("inspectBaseName")
69+
private String inspectBaseName;
70+
71+
@JsonProperty("inspectCode")
72+
private String inspectCode;
73+
74+
@JsonProperty("inspectOrgId")
75+
private String inspectOrgId;
76+
77+
@JsonProperty("inspectOrgName")
78+
private String inspectOrgName;
79+
80+
@JsonProperty("inspectOrgShortName")
81+
private String inspectOrgShortName;
82+
83+
@JsonProperty("merchantName")
84+
private String merchantName;
85+
86+
@JsonProperty("orderId")
87+
private String orderId;
88+
89+
@JsonProperty("urgentOrder")
90+
private Boolean urgentOrder;
91+
92+
@JsonProperty("printInfo")
93+
private String printInfo;
94+
95+
@JsonProperty("needLabel")
96+
private Boolean needLabel;
97+
}
98+
99+
@Data
100+
@NoArgsConstructor
101+
@JsonInclude(JsonInclude.Include.NON_NULL)
102+
public static class BoxInfo implements Serializable {
103+
private static final long serialVersionUID = 4074623844069371776L;
104+
105+
@JsonProperty("boxId")
106+
private Long boxId;
107+
108+
@JsonProperty("boxName")
109+
private String boxName;
110+
111+
@JsonProperty("boxNum")
112+
private Integer boxNum;
113+
}
114+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package me.chanjar.weixin.channel.bean.qic;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
8+
9+
import java.io.Serializable;
10+
11+
@Data
12+
@NoArgsConstructor
13+
@JsonInclude(JsonInclude.Include.NON_NULL)
14+
public class InspectConfigResponse extends WxChannelBaseResponse {
15+
private static final long serialVersionUID = 6463651966377955876L;
16+
17+
@JsonProperty("inspect_config")
18+
private InspectConfig inspectConfig;
19+
20+
@Data
21+
@NoArgsConstructor
22+
@JsonInclude(JsonInclude.Include.NON_NULL)
23+
public static class InspectConfig implements Serializable {
24+
private static final long serialVersionUID = 5829846300579243328L;
25+
26+
@JsonProperty("warehouse_id")
27+
private String warehouseId;
28+
29+
@JsonProperty("delivery_address")
30+
private Address deliveryAddress;
31+
32+
@JsonProperty("return_address")
33+
private Address returnAddress;
34+
35+
@JsonProperty("warehouse_name")
36+
private String warehouseName;
37+
38+
@JsonProperty("warehouse_addr")
39+
private String warehouseAddr;
40+
}
41+
42+
@Data
43+
@NoArgsConstructor
44+
@JsonInclude(JsonInclude.Include.NON_NULL)
45+
public static class Address implements Serializable {
46+
private static final long serialVersionUID = -664266740472865991L;
47+
48+
@JsonProperty("contact_name")
49+
private String contactName;
50+
51+
@JsonProperty("contact_phone")
52+
private String contactPhone;
53+
54+
private String province;
55+
56+
private String city;
57+
58+
private String county;
59+
60+
private String detail;
61+
}
62+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package me.chanjar.weixin.channel.bean.qic;
2+
3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import lombok.Data;
6+
import lombok.NoArgsConstructor;
7+
8+
import java.io.Serializable;
9+
import java.util.List;
10+
11+
@Data
12+
@NoArgsConstructor
13+
@JsonInclude(JsonInclude.Include.NON_NULL)
14+
public class RegisterLogisticsRequest implements Serializable {
15+
private static final long serialVersionUID = 4346443649534209624L;
16+
17+
@JsonProperty("order_id_list")
18+
private List<String> orderIdList;
19+
20+
@JsonProperty("logistics_info")
21+
private LogisticsInfo logisticsInfo;
22+
23+
@Data
24+
@NoArgsConstructor
25+
@JsonInclude(JsonInclude.Include.NON_NULL)
26+
public static class LogisticsInfo implements Serializable {
27+
private static final long serialVersionUID = 8677143207727485993L;
28+
29+
@JsonProperty("waybill_id")
30+
private String waybillId;
31+
32+
@JsonProperty("delivery_id")
33+
private String deliveryId;
34+
35+
@JsonProperty("delivery_name")
36+
private String deliveryName;
37+
38+
@JsonProperty("delivery_type")
39+
private Integer deliveryType;
40+
}
41+
}

0 commit comments

Comments
 (0)