九州世界 v1.0版本的 MD5 值为:7e82e48b69a4c36d0bdfb2a8d382d05d
以下内容为反编译后的 GiftActivityService.java 源代码,内容仅作参考
package com.wechat.pay.java.service.giftactivity;
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.giftactivity.model.AddActivityMerchantRequest;
import com.wechat.pay.java.service.giftactivity.model.AddActivityMerchantResponse;
import com.wechat.pay.java.service.giftactivity.model.CreateFullSendActRequest;
import com.wechat.pay.java.service.giftactivity.model.CreateFullSendActResponse;
import com.wechat.pay.java.service.giftactivity.model.DeleteActivityMerchantRequest;
import com.wechat.pay.java.service.giftactivity.model.DeleteActivityMerchantResponse;
import com.wechat.pay.java.service.giftactivity.model.GetActDetailRequest;
import com.wechat.pay.java.service.giftactivity.model.GetActDetailResponse;
import com.wechat.pay.java.service.giftactivity.model.ListActMchResponse;
import com.wechat.pay.java.service.giftactivity.model.ListActSkuResponse;
import com.wechat.pay.java.service.giftactivity.model.ListActivitiesRequest;
import com.wechat.pay.java.service.giftactivity.model.ListActivitiesResponse;
import com.wechat.pay.java.service.giftactivity.model.ListActivityMerchantRequest;
import com.wechat.pay.java.service.giftactivity.model.ListActivitySkuRequest;
import com.wechat.pay.java.service.giftactivity.model.TerminateActResponse;
import com.wechat.pay.java.service.giftactivity.model.TerminateActivityRequest;
import java.util.Objects;
public class GiftActivityService {
private final HostName hostName;
private final HttpClient httpClient;
private GiftActivityService(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 GiftActivityService build() {
return new GiftActivityService(this.httpClient, this.hostName);
}
}
public AddActivityMerchantResponse addActivityMerchant(AddActivityMerchantRequest addActivityMerchantRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/marketing/paygiftactivity/activities/{activity_id}/merchants/add".replace("{activity_id}", UrlEncoder.urlEncode(addActivityMerchantRequest.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 (AddActivityMerchantResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replace).headers(httpHeaders).body(createRequestBody(addActivityMerchantRequest)).build(), AddActivityMerchantResponse.class).getServiceResponse();
}
public CreateFullSendActResponse createFullSendAct(CreateFullSendActRequest createFullSendActRequest) {
String replaceFirst = this.hostName != null ? "https://api.mch.weixin.qq.com/v3/marketing/paygiftactivity/unique-threshold-activity".replaceFirst(HostName.API.getValue(), this.hostName.getValue()) : "https://api.mch.weixin.qq.com/v3/marketing/paygiftactivity/unique-threshold-activity";
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
httpHeaders.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
return (CreateFullSendActResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replaceFirst).headers(httpHeaders).body(createRequestBody(createFullSendActRequest)).build(), CreateFullSendActResponse.class).getServiceResponse();
}
public DeleteActivityMerchantResponse deleteActivityMerchant(DeleteActivityMerchantRequest deleteActivityMerchantRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/marketing/paygiftactivity/activities/{activity_id}/merchants/delete".replace("{activity_id}", UrlEncoder.urlEncode(deleteActivityMerchantRequest.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 (DeleteActivityMerchantResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replace).headers(httpHeaders).body(createRequestBody(deleteActivityMerchantRequest)).build(), DeleteActivityMerchantResponse.class).getServiceResponse();
}
public GetActDetailResponse getActDetail(GetActDetailRequest getActDetailRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/marketing/paygiftactivity/activities/{activity_id}".replace("{activity_id}", UrlEncoder.urlEncode(getActDetailRequest.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 (GetActDetailResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(replace).headers(httpHeaders).build(), GetActDetailResponse.class).getServiceResponse();
}
public ListActivitiesResponse listActivities(ListActivitiesRequest listActivitiesRequest) {
QueryParameter queryParameter = new QueryParameter();
if (listActivitiesRequest.getOffset() != null) {
queryParameter.add("offset", UrlEncoder.urlEncode(listActivitiesRequest.getOffset().toString()));
}
if (listActivitiesRequest.getLimit() != null) {
queryParameter.add("limit", UrlEncoder.urlEncode(listActivitiesRequest.getLimit().toString()));
}
if (listActivitiesRequest.getActivityName() != null) {
queryParameter.add("activity_name", UrlEncoder.urlEncode(listActivitiesRequest.getActivityName()));
}
if (listActivitiesRequest.getActivityStatus() != null) {
queryParameter.add("activity_status", UrlEncoder.urlEncode(listActivitiesRequest.getActivityStatus().toString()));
}
if (listActivitiesRequest.getAwardType() != null) {
queryParameter.add("award_type", UrlEncoder.urlEncode(listActivitiesRequest.getAwardType().toString()));
}
String str = "https://api.mch.weixin.qq.com/v3/marketing/paygiftactivity/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 (ListActivitiesResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(str).headers(httpHeaders).build(), ListActivitiesResponse.class).getServiceResponse();
}
public ListActMchResponse listActivityMerchant(ListActivityMerchantRequest listActivityMerchantRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/marketing/paygiftactivity/activities/{activity_id}/merchants".replace("{activity_id}", UrlEncoder.urlEncode(listActivityMerchantRequest.getActivityId()));
QueryParameter queryParameter = new QueryParameter();
if (listActivityMerchantRequest.getOffset() != null) {
queryParameter.add("offset", UrlEncoder.urlEncode(listActivityMerchantRequest.getOffset().toString()));
}
if (listActivityMerchantRequest.getLimit() != null) {
queryParameter.add("limit", UrlEncoder.urlEncode(listActivityMerchantRequest.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 (ListActMchResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(str).headers(httpHeaders).build(), ListActMchResponse.class).getServiceResponse();
}
public ListActSkuResponse listActivitySku(ListActivitySkuRequest listActivitySkuRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/marketing/paygiftactivity/activities/{activity_id}/goods".replace("{activity_id}", UrlEncoder.urlEncode(listActivitySkuRequest.getActivityId()));
QueryParameter queryParameter = new QueryParameter();
if (listActivitySkuRequest.getOffset() != null) {
queryParameter.add("offset", UrlEncoder.urlEncode(listActivitySkuRequest.getOffset().toString()));
}
if (listActivitySkuRequest.getLimit() != null) {
queryParameter.add("limit", UrlEncoder.urlEncode(listActivitySkuRequest.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 (ListActSkuResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.GET).url(str).headers(httpHeaders).build(), ListActSkuResponse.class).getServiceResponse();
}
public TerminateActResponse terminateActivity(TerminateActivityRequest terminateActivityRequest) {
String replace = "https://api.mch.weixin.qq.com/v3/marketing/paygiftactivity/activities/{activity_id}/terminate".replace("{activity_id}", UrlEncoder.urlEncode(terminateActivityRequest.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 (TerminateActResponse) this.httpClient.execute(new HttpRequest.Builder().httpMethod(HttpMethod.POST).url(replace).headers(httpHeaders).build(), TerminateActResponse.class).getServiceResponse();
}
private RequestBody createRequestBody(Object obj) {
return new JsonRequestBody.Builder().body(GsonUtil.toJson(obj)).build();
}
}