九州仙境 v3.0.0版本的 MD5 值为:7b5ce5daab0f4a38a386ae4309157477
以下内容为反编译后的 RetailStoreService.java 源代码,内容仅作参考
package com.wechat.pay.java.service.retailstore;
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.retailstore.model.AddRepresentativeRequest;
import com.wechat.pay.java.service.retailstore.model.ApplyActivityRequest;
import com.wechat.pay.java.service.retailstore.model.ApplyActivityResponse;
import com.wechat.pay.java.service.retailstore.model.CreateMaterialsRequest;
import com.wechat.pay.java.service.retailstore.model.DeleteRepresentativeRequest;
import com.wechat.pay.java.service.retailstore.model.DeleteRepresentativeResponse;
import com.wechat.pay.java.service.retailstore.model.ListActsByAreaRequest;
import com.wechat.pay.java.service.retailstore.model.ListActsByAreaResponse;
import com.wechat.pay.java.service.retailstore.model.ListRepresentativeRequest;
import com.wechat.pay.java.service.retailstore.model.ListRepresentativeResponse;
import com.wechat.pay.java.service.retailstore.model.LockQualificationRequest;
import com.wechat.pay.java.service.retailstore.model.LockQualificationResponse;
import com.wechat.pay.java.service.retailstore.model.Materials;
import com.wechat.pay.java.service.retailstore.model.Representatives;
import com.wechat.pay.java.service.retailstore.model.UnlockQualificationRequest;
import com.wechat.pay.java.service.retailstore.model.UnlockQualificationResponse;
import java.util.Objects;
public class RetailStoreService {
private final HostName hostName;
private final HttpClient httpClient;
private RetailStoreService(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 RetailStoreService build() {
return new RetailStoreService(this.httpClient, this.hostName);
}
}
public ApplyActivityResponse applyActivity(ApplyActivityRequest applyActivityRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/marketing/goods-subsidy-activity/activity/{activity_id}/apply".replace("{activity_id}", UrlEncoder.urlEncode(applyActivityRequest.getActivityId()));
if (this.hostName != null) {
replace = replace.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 (ApplyActivityResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replace).headers(httpHeaders).body(createRequestBody(applyActivityRequest)).build(), ApplyActivityResponse.class).getServiceResponse();
}
public ListActsByAreaResponse listActsByArea(ListActsByAreaRequest listActsByAreaRequest) {
QueryParameter queryParameter = new QueryParameter();
if (listActsByAreaRequest.getCityId() != null) {
queryParameter.add("city_id", UrlEncoder.urlEncode(listActsByAreaRequest.getCityId()));
}
if (listActsByAreaRequest.getOffset() != null) {
queryParameter.add("offset", UrlEncoder.urlEncode(listActsByAreaRequest.getOffset().toString()));
}
if (listActsByAreaRequest.getLimit() != null) {
queryParameter.add("limit", UrlEncoder.urlEncode(listActsByAreaRequest.getLimit().toString()));
}
String str = "https://api.mch.weixin.qq.com/v3/marketing/goods-subsidy-activity/activities" + 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 (ListActsByAreaResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(str).headers(httpHeaders).build(), ListActsByAreaResponse.class).getServiceResponse();
}
public LockQualificationResponse lockQualification(LockQualificationRequest lockQualificationRequest) {
String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/marketing/goods-subsidy-activity/qualification/lock".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/marketing/goods-subsidy-activity/qualification/lock";
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
httpHeaders.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
return (LockQualificationResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(lockQualificationRequest)).build(), LockQualificationResponse.class).getServiceResponse();
}
public UnlockQualificationResponse unlockQualification(UnlockQualificationRequest unlockQualificationRequest) {
String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/marketing/goods-subsidy-activity/qualification/unlock".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/marketing/goods-subsidy-activity/qualification/unlock";
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
httpHeaders.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
return (UnlockQualificationResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(unlockQualificationRequest)).build(), UnlockQualificationResponse.class).getServiceResponse();
}
public Representatives addRepresentative(AddRepresentativeRequest addRepresentativeRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representative".replace("{activity_id}", UrlEncoder.urlEncode(addRepresentativeRequest.getActivityId()));
if (this.hostName != null) {
replace = replace.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 (Representatives) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.PUT).url(replace).headers(httpHeaders).body(createRequestBody(addRepresentativeRequest)).build(), Representatives.class).getServiceResponse();
}
public Materials createMaterials(CreateMaterialsRequest createMaterialsRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/materials".replace("{brand_id}", UrlEncoder.urlEncode(createMaterialsRequest.getBrandId()));
if (this.hostName != null) {
replace = replace.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 (Materials) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replace).headers(httpHeaders).body(createRequestBody(createMaterialsRequest)).build(), Materials.class).getServiceResponse();
}
public DeleteRepresentativeResponse deleteRepresentative(DeleteRepresentativeRequest deleteRepresentativeRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representative".replace("{activity_id}", UrlEncoder.urlEncode(deleteRepresentativeRequest.getActivityId()));
if (this.hostName != null) {
replace = replace.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 (DeleteRepresentativeResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.DELETE).url(replace).headers(httpHeaders).body(createRequestBody(deleteRepresentativeRequest)).build(), DeleteRepresentativeResponse.class).getServiceResponse();
}
public ListRepresentativeResponse listRepresentative(ListRepresentativeRequest listRepresentativeRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representatives".replace("{activity_id}", UrlEncoder.urlEncode(listRepresentativeRequest.getActivityId()));
QueryParameter queryParameter = new QueryParameter();
if (listRepresentativeRequest.getOffset() != null) {
queryParameter.add("offset", UrlEncoder.urlEncode(listRepresentativeRequest.getOffset().toString()));
}
if (listRepresentativeRequest.getLimit() != null) {
queryParameter.add("limit", UrlEncoder.urlEncode(listRepresentativeRequest.getLimit().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 (ListRepresentativeResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(str).headers(httpHeaders).build(), ListRepresentativeResponse.class).getServiceResponse();
}
private RequestBody createRequestBody(Object obj) {
return new JsonRequestBody.Builder().body(GsonUtil.toJson(obj)).build();
}
}