九州仙境 v3.0.0版本的 MD5 值为:7b5ce5daab0f4a38a386ae4309157477
以下内容为反编译后的 MarketingBankPackagesService.java 源代码,内容仅作参考
package com.wechat.pay.java.service.marketingbankpackages;
import com.wechat.pay.java.core.Config;
import com.wechat.pay.java.core.http.Constant;
import com.wechat.pay.java.core.http.DefaultHttpClientBuilder;
import com.wechat.pay.java.core.http.HostName;
import com.wechat.pay.java.core.http.HttpClient;
import com.wechat.pay.java.core.http.HttpHeaders;
import com.wechat.pay.java.core.http.HttpMethod;
import com.wechat.pay.java.core.http.HttpRequest;
import com.wechat.pay.java.core.http.JsonRequestBody;
import com.wechat.pay.java.core.http.MediaType;
import com.wechat.pay.java.core.http.QueryParameter;
import com.wechat.pay.java.core.http.RequestBody;
import com.wechat.pay.java.core.http.UrlEncoder;
import com.wechat.pay.java.core.util.GsonUtil;
import com.wechat.pay.java.service.marketingbankpackages.model.ListTaskRequest;
import com.wechat.pay.java.service.marketingbankpackages.model.ListTaskResponse;
import java.util.Objects;
public class MarketingBankPackagesService {
private final HostName hostName;
private final HttpClient httpClient;
private MarketingBankPackagesService(HttpClient httpClient, HostName hostName) {
this.httpClient = (HttpClient) Objects.requireNonNull(httpClient);
this.hostName = hostName;
}
public static class Builder {
private HostName hostName;
private HttpClient httpClient;
public Builder config(Config config) {
this.httpClient = new DefaultHttpClientBuilder().config(config).build();
return this;
}
public Builder hostName(HostName hostName) {
this.hostName = hostName;
return this;
}
public Builder httpClient(HttpClient httpClient) {
this.httpClient = httpClient;
return this;
}
public MarketingBankPackagesService build() {
return new MarketingBankPackagesService(this.httpClient, this.hostName);
}
}
public ListTaskResponse listTask(ListTaskRequest listTaskRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/marketing/bank/packages/{package_id}/tasks".replace("{package_id}", UrlEncoder.urlEncode(listTaskRequest.getPackageId()));
QueryParameter queryParameter = new QueryParameter();
if (listTaskRequest.getFilename() != null) {
queryParameter.add("filename", UrlEncoder.urlEncode(listTaskRequest.getFilename()));
}
if (listTaskRequest.getOffset() != null) {
queryParameter.add("offset", UrlEncoder.urlEncode(listTaskRequest.getOffset().toString()));
}
if (listTaskRequest.getLimit() != null) {
queryParameter.add("limit", UrlEncoder.urlEncode(listTaskRequest.getLimit().toString()));
}
if (listTaskRequest.getStatus() != null) {
queryParameter.add("status", UrlEncoder.urlEncode(listTaskRequest.getStatus().toString()));
}
String str = replace + queryParameter.getQueryStr();
if (this.hostName != null) {
str = str.replaceFirst(HostName.API.getValue(), this.hostName.getValue());
}
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
httpHeaders.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
return (ListTaskResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(str).headers(httpHeaders).build(), ListTaskResponse.class).getServiceResponse();
}
private RequestBody createRequestBody(Object obj) {
return new JsonRequestBody.Builder().body(GsonUtil.toJson(obj)).build();
}
}