feat(channel): 新增微信小店质检管理(QIC)5个官方接口支持 by Copilot · Pull Request #4039 · binarywang/WxJava · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,11 @@ public interface WxChannelService extends BaseWxChannelService {
*/
WxChannelLiveDashboardService getLiveDashboardService();

/**
* 质检管理服务.
*
* @return 质检管理服务
*/
WxChannelQicService getQicService();

}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public abstract class BaseWxChannelServiceImpl<H, P> implements WxChannelService
private WxChannelVipService vipService = null;
private WxChannelCompassFinderService compassFinderService = null;
private WxChannelLiveDashboardService liveDashboardService = null;
private WxChannelQicService qicService = null;

protected WxChannelConfig config;
private int retrySleepMillis = 1000;
Expand Down Expand Up @@ -473,4 +474,12 @@ public synchronized WxChannelLiveDashboardService getLiveDashboardService() {
return liveDashboardService;
}

@Override
public synchronized WxChannelQicService getQicService() {
if (qicService == null) {
qicService = new WxChannelQicServiceImpl(this);
}
return qicService;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package me.chanjar.weixin.channel.api.impl;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import me.chanjar.weixin.channel.api.WxChannelQicService;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
import me.chanjar.weixin.channel.bean.qic.InspectCodeResponse;
import me.chanjar.weixin.channel.bean.qic.InspectConfigResponse;
import me.chanjar.weixin.channel.bean.qic.RegisterLogisticsRequest;
import me.chanjar.weixin.channel.bean.qic.SubmitConfigResponse;
import me.chanjar.weixin.channel.bean.qic.SubmitInspectRequest;
import me.chanjar.weixin.channel.util.ResponseUtils;
import me.chanjar.weixin.common.error.WxErrorException;
import org.apache.commons.lang3.StringUtils;

import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Qic.GET_INSPECT_CONFIG_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Qic.GET_SUBMIT_CONFIG_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Qic.PRINT_INSPECT_CODE_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Qic.REGISTER_LOGISTICS_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Qic.SUBMIT_INSPECT_INFO_URL;

/**
* 视频号小店 质检管理服务实现.
*/
public class WxChannelQicServiceImpl implements WxChannelQicService {
private final BaseWxChannelServiceImpl<?, ?> shopService;

public WxChannelQicServiceImpl(BaseWxChannelServiceImpl<?, ?> shopService) {
this.shopService = shopService;
}

@Override
public InspectConfigResponse getInspectConfig() throws WxErrorException {
String respJson = shopService.get(GET_INSPECT_CONFIG_URL, null);
return ResponseUtils.decode(respJson, InspectConfigResponse.class);
}

@Override
public SubmitConfigResponse getSubmitConfig(String orderId) throws WxErrorException {
String queryParam = StringUtils.isBlank(orderId) ? "" : "order_id=" + orderId;
String respJson = shopService.get(GET_SUBMIT_CONFIG_URL, queryParam);
return ResponseUtils.decode(respJson, SubmitConfigResponse.class);
}

@Override
public SubmitConfigResponse getSubmitConfig() throws WxErrorException {
return getSubmitConfig(null);
}

@Override
public InspectCodeResponse printInspectCode(String orderId) throws WxErrorException {
String respJson = shopService.post(PRINT_INSPECT_CODE_URL, new PrintInspectCodeRequest(orderId));
return ResponseUtils.decode(respJson, InspectCodeResponse.class);
}

@Override
public WxChannelBaseResponse submitInspectInfo(SubmitInspectRequest request) throws WxErrorException {
String respJson = shopService.post(SUBMIT_INSPECT_INFO_URL, request);
return ResponseUtils.decode(respJson, WxChannelBaseResponse.class);
}

@Override
public WxChannelBaseResponse registerLogistics(RegisterLogisticsRequest request) throws WxErrorException {
String respJson = shopService.post(REGISTER_LOGISTICS_URL, request);
return ResponseUtils.decode(respJson, WxChannelBaseResponse.class);
}

@Data
@AllArgsConstructor
private static class PrintInspectCodeRequest {
@JsonProperty("order_id")
private String orderId;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
package me.chanjar.weixin.channel.bean.qic;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;

import java.io.Serializable;
import java.util.List;

@Data
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class InspectCodeResponse extends WxChannelBaseResponse {
private static final long serialVersionUID = -6242555695898612990L;

private DataPayload data;

@Data
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class DataPayload implements Serializable {
private static final long serialVersionUID = 684071509005627272L;

@JsonProperty("backupDeliveryId")
private String backupDeliveryId;

@JsonProperty("backupDeliveryName")
private String backupDeliveryName;

@JsonProperty("boxDTOList")
private List<BoxInfo> boxInfoList;

@JsonProperty("channelAppId")
private String channelAppId;

@JsonProperty("deliveryId")
private String deliveryId;

@JsonProperty("deliveryName")
private String deliveryName;

@JsonProperty("embedGoodsMaterial")
private String embedGoodsMaterial;

@JsonProperty("goodsDesc")
private String goodsDesc;

@JsonProperty("expressMerge")
private Boolean expressMerge;

@JsonProperty("goodsMainMaterial")
private String goodsMainMaterial;

@JsonProperty("goodsName")
private String goodsName;

@JsonProperty("goodsNum")
private Integer goodsNum;

@JsonProperty("goodsPartsMaterial")
private String goodsPartsMaterial;

@JsonProperty("inspectBaseId")
private String inspectBaseId;

@JsonProperty("inspectBaseName")
private String inspectBaseName;

@JsonProperty("inspectCode")
private String inspectCode;

@JsonProperty("inspectOrgId")
private String inspectOrgId;

@JsonProperty("inspectOrgName")
private String inspectOrgName;

@JsonProperty("inspectOrgShortName")
private String inspectOrgShortName;

@JsonProperty("merchantName")
private String merchantName;

@JsonProperty("orderId")
private String orderId;

@JsonProperty("urgentOrder")
private Boolean urgentOrder;

@JsonProperty("printInfo")
private String printInfo;

@JsonProperty("needLabel")
private Boolean needLabel;
}

@Data
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class BoxInfo implements Serializable {
private static final long serialVersionUID = 4074623844069371776L;

@JsonProperty("boxId")
private Long boxId;

@JsonProperty("boxName")
private String boxName;

@JsonProperty("boxNum")
private Integer boxNum;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package me.chanjar.weixin.channel.bean.qic;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;

import java.io.Serializable;

@Data
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class InspectConfigResponse extends WxChannelBaseResponse {
private static final long serialVersionUID = 6463651966377955876L;

@JsonProperty("inspect_config")
private InspectConfig inspectConfig;

@Data
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class InspectConfig implements Serializable {
private static final long serialVersionUID = 5829846300579243328L;

@JsonProperty("warehouse_id")
private String warehouseId;

@JsonProperty("delivery_address")
private Address deliveryAddress;

@JsonProperty("return_address")
private Address returnAddress;

@JsonProperty("warehouse_name")
private String warehouseName;

@JsonProperty("warehouse_addr")
private String warehouseAddr;
}

@Data
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class Address implements Serializable {
private static final long serialVersionUID = -664266740472865991L;

@JsonProperty("contact_name")
private String contactName;

@JsonProperty("contact_phone")
private String contactPhone;

private String province;

private String city;

private String county;

private String detail;
}
}
Loading
Loading