package com.yanzuoguang.wxxcx.logistics.delivery; import com.alibaba.fastjson.TypeReference; import com.yanzuoguang.util.helper.HttpHelper; import com.yanzuoguang.util.helper.JsonHelper; import com.yanzuoguang.wxxcx.base.*; /*** * 获取所有绑定的物流账号 * * @author:heyanou */ public class WxLogisticsGetAllDeliveryDataRequest implements WxXcxRequestUrl, WxXcxRequestUrlPara { private final WxXcxConfig wxXcxConfig; private final WxXcxRequest wxXcxRequest; private final WxXcxAccessToken accessToken; private final WxLogisticsGetAllDeliveryDataReq req; public WxLogisticsGetAllDeliveryDataRequest(WxXcxConfig wxXcxConfig, WxXcxRequest wxXcxRequest, WxXcxAccessToken accessToken, WxLogisticsGetAllDeliveryDataReq req) { this.wxXcxConfig = wxXcxConfig; this.wxXcxRequest = wxXcxRequest; this.accessToken = accessToken; this.req = req; } @Override public String getUrlPara() { return HttpHelper.getUrlParameter(accessToken); } @Override public String getUrl() { return wxXcxConfig.getBaseUrl() + wxXcxConfig.getLogisticsGetAllDeliveryDataUrl() + "?" + this.getUrlPara(); } /*** * <b>response返回结果集检测</b> * @return 返回类对象 */ public WxLogisticsGetAllDeliveryDataRes getResponse() { // todo: 检测参数是否合法 return this.wxXcxRequest.request(this, response -> { WxLogisticsGetAllDeliveryDataRes ret = JsonHelper.deserialize(response, new TypeReference<WxLogisticsGetAllDeliveryDataRes>() { }); WxXcxAssert.assertBaseError(ret); return ret; }); } }