@@ -2,10 +2,8 @@ package me.chanjar.weixin.common.bean; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import lombok.Data; | |||
import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
/** | |||
* 卡券Api签名. | |||
@@ -37,6 +35,6 @@ public class WxCardApiSignature implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -7,9 +7,6 @@ import java.nio.charset.StandardCharsets; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import lombok.Data; | |||
import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
@@ -49,7 +46,7 @@ public class WxMenu implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return this.toJson(); | |||
} | |||
} |
@@ -4,11 +4,9 @@ import java.io.Serializable; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
/** | |||
* menu button. | |||
@@ -83,7 +81,7 @@ public class WxMenuButton implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -2,11 +2,9 @@ package me.chanjar.weixin.common.bean.menu; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
/** | |||
* menu rule. | |||
@@ -31,6 +29,6 @@ public class WxMenuRule implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -2,9 +2,6 @@ package me.chanjar.weixin.common.bean.result; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import lombok.Data; | |||
import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
@@ -28,7 +25,7 @@ public class WxMediaUploadResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -7,9 +7,13 @@ import me.chanjar.weixin.common.bean.menu.WxMenu; | |||
import me.chanjar.weixin.common.error.WxError; | |||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; | |||
/** | |||
* . | |||
* @author chanjarster | |||
*/ | |||
public class WxGsonBuilder { | |||
public static final GsonBuilder INSTANCE = new GsonBuilder(); | |||
private static final GsonBuilder INSTANCE = new GsonBuilder(); | |||
static { | |||
INSTANCE.disableHtmlEscaping(); | |||
@@ -56,7 +56,7 @@ public class WxCpDepartmentServiceImpl implements WxCpDepartmentService { | |||
String responseContent = this.mainService.get(url, null); | |||
JsonElement tmpJsonElement = new JsonParser().parse(responseContent); | |||
return WxCpGsonBuilder.INSTANCE.create() | |||
return WxCpGsonBuilder.create() | |||
.fromJson(tmpJsonElement.getAsJsonObject().get("department"), | |||
new TypeToken<List<WxCpDepart>>() { | |||
}.getType() | |||
@@ -1,6 +1,5 @@ | |||
package me.chanjar.weixin.cp.api.impl; | |||
import com.google.gson.GsonBuilder; | |||
import com.google.gson.JsonElement; | |||
import com.google.gson.JsonObject; | |||
import com.google.gson.JsonParser; | |||
@@ -11,6 +10,7 @@ import me.chanjar.weixin.common.util.json.GsonHelper; | |||
import me.chanjar.weixin.cp.api.WxCpOAuth2Service; | |||
import me.chanjar.weixin.cp.api.WxCpService; | |||
import me.chanjar.weixin.cp.bean.WxCpUserDetail; | |||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; | |||
/** | |||
* <pre> | |||
@@ -87,6 +87,6 @@ public class WxCpOAuth2ServiceImpl implements WxCpOAuth2Service { | |||
JsonObject param = new JsonObject(); | |||
param.addProperty("user_ticket", userTicket); | |||
String responseText = this.mainService.post(url, param.toString()); | |||
return new GsonBuilder().create().fromJson(responseText, WxCpUserDetail.class); | |||
return WxCpGsonBuilder.create().fromJson(responseText, WxCpUserDetail.class); | |||
} | |||
} |
@@ -1,6 +1,12 @@ | |||
package me.chanjar.weixin.cp.api.impl; | |||
import com.google.gson.*; | |||
import java.util.List; | |||
import com.google.gson.JsonArray; | |||
import com.google.gson.JsonElement; | |||
import com.google.gson.JsonObject; | |||
import com.google.gson.JsonParser; | |||
import com.google.gson.JsonPrimitive; | |||
import com.google.gson.reflect.TypeToken; | |||
import me.chanjar.weixin.common.error.WxErrorException; | |||
import me.chanjar.weixin.cp.api.WxCpService; | |||
@@ -11,8 +17,6 @@ import me.chanjar.weixin.cp.bean.WxCpTagGetResult; | |||
import me.chanjar.weixin.cp.bean.WxCpUser; | |||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; | |||
import java.util.List; | |||
/** | |||
* <pre> | |||
* 标签管理接口 | |||
@@ -57,7 +61,7 @@ public class WxCpTagServiceImpl implements WxCpTagService { | |||
String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/list"; | |||
String responseContent = this.mainService.get(url, null); | |||
JsonElement tmpJsonElement = new JsonParser().parse(responseContent); | |||
return WxCpGsonBuilder.INSTANCE.create() | |||
return WxCpGsonBuilder.create() | |||
.fromJson( | |||
tmpJsonElement.getAsJsonObject().get("taglist"), | |||
new TypeToken<List<WxCpTag>>() { | |||
@@ -70,7 +74,7 @@ public class WxCpTagServiceImpl implements WxCpTagService { | |||
String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/get?tagid=" + tagId; | |||
String responseContent = this.mainService.get(url, null); | |||
JsonElement tmpJsonElement = new JsonParser().parse(responseContent); | |||
return WxCpGsonBuilder.INSTANCE.create() | |||
return WxCpGsonBuilder.create() | |||
.fromJson( | |||
tmpJsonElement.getAsJsonObject().get("userlist"), | |||
new TypeToken<List<WxCpUser>>() { | |||
@@ -90,7 +90,7 @@ public class WxCpUserServiceImpl implements WxCpUserService { | |||
String responseContent = this.mainService.get(url, params); | |||
JsonElement tmpJsonElement = new JsonParser().parse(responseContent); | |||
return WxCpGsonBuilder.INSTANCE.create() | |||
return WxCpGsonBuilder.create() | |||
.fromJson(tmpJsonElement.getAsJsonObject().get("userlist"), | |||
new TypeToken<List<WxCpUser>>() { | |||
}.getType() | |||
@@ -112,7 +112,7 @@ public class WxCpUserServiceImpl implements WxCpUserService { | |||
String responseContent = this.mainService.get(url, params); | |||
JsonElement tmpJsonElement = new JsonParser().parse(responseContent); | |||
return WxCpGsonBuilder.INSTANCE.create() | |||
return WxCpGsonBuilder.create() | |||
.fromJson( | |||
tmpJsonElement.getAsJsonObject().get("userlist"), | |||
new TypeToken<List<WxCpUser>>() { | |||
@@ -1,5 +1,8 @@ | |||
package me.chanjar.weixin.cp.bean; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Builder; | |||
@@ -7,9 +10,6 @@ import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
/** | |||
* <pre> | |||
* 企业号应用信息. | |||
@@ -80,12 +80,14 @@ public class WxCpAgent implements Serializable { | |||
@Data | |||
public static class Users implements Serializable { | |||
private static final long serialVersionUID = 8801100463558788565L; | |||
@SerializedName("user") | |||
private List<User> users; | |||
} | |||
@Data | |||
public class User implements Serializable { | |||
private static final long serialVersionUID = 7287632514385508024L; | |||
@SerializedName("userid") | |||
private String userId; | |||
} | |||
@@ -5,8 +5,6 @@ import java.util.Collections; | |||
import java.util.List; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.common.base.Splitter; | |||
import com.google.gson.annotations.SerializedName; | |||
@@ -25,11 +23,11 @@ public class WxCpInviteResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxCpGsonBuilder.create().toJson(this); | |||
} | |||
public static WxCpInviteResult fromJson(String json) { | |||
return WxCpGsonBuilder.INSTANCE.create().fromJson(json, WxCpInviteResult.class); | |||
return WxCpGsonBuilder.create().fromJson(json, WxCpInviteResult.class); | |||
} | |||
@SerializedName("errcode") | |||
@@ -1,16 +1,23 @@ | |||
package me.chanjar.weixin.cp.bean; | |||
import java.io.Serializable; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import lombok.Data; | |||
import me.chanjar.weixin.common.api.WxConsts; | |||
import me.chanjar.weixin.cp.bean.article.MpnewsArticle; | |||
import me.chanjar.weixin.cp.bean.article.NewArticle; | |||
import me.chanjar.weixin.cp.bean.messagebuilder.*; | |||
import me.chanjar.weixin.cp.bean.messagebuilder.FileBuilder; | |||
import me.chanjar.weixin.cp.bean.messagebuilder.ImageBuilder; | |||
import me.chanjar.weixin.cp.bean.messagebuilder.MpnewsBuilder; | |||
import me.chanjar.weixin.cp.bean.messagebuilder.NewsBuilder; | |||
import me.chanjar.weixin.cp.bean.messagebuilder.TextBuilder; | |||
import me.chanjar.weixin.cp.bean.messagebuilder.TextCardBuilder; | |||
import me.chanjar.weixin.cp.bean.messagebuilder.VideoBuilder; | |||
import me.chanjar.weixin.cp.bean.messagebuilder.VoiceBuilder; | |||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; | |||
import java.io.Serializable; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
* 消息. | |||
* | |||
@@ -114,7 +121,7 @@ public class WxCpMessage implements Serializable { | |||
} | |||
public String toJson() { | |||
return WxCpGsonBuilder.INSTANCE.create().toJson(this); | |||
return WxCpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -5,8 +5,6 @@ import java.util.Collections; | |||
import java.util.List; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.common.base.Splitter; | |||
import com.google.gson.annotations.SerializedName; | |||
@@ -25,11 +23,11 @@ public class WxCpMessageSendResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxCpGsonBuilder.create().toJson(this); | |||
} | |||
public static WxCpMessageSendResult fromJson(String json) { | |||
return WxCpGsonBuilder.INSTANCE.create().fromJson(json, WxCpMessageSendResult.class); | |||
return WxCpGsonBuilder.create().fromJson(json, WxCpMessageSendResult.class); | |||
} | |||
@SerializedName("errcode") | |||
@@ -1,14 +1,15 @@ | |||
package me.chanjar.weixin.cp.bean; | |||
import java.io.Serializable; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; | |||
import java.io.Serializable; | |||
/** | |||
* Created by Daniel Qian. | |||
* @author Daniel Qian | |||
*/ | |||
@Data | |||
@AllArgsConstructor | |||
@@ -5,8 +5,6 @@ import java.util.Collections; | |||
import java.util.List; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.common.base.Splitter; | |||
import com.google.gson.annotations.SerializedName; | |||
@@ -25,11 +23,11 @@ public class WxCpTagAddOrRemoveUsersResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxCpGsonBuilder.create().toJson(this); | |||
} | |||
public static WxCpTagAddOrRemoveUsersResult fromJson(String json) { | |||
return WxCpGsonBuilder.INSTANCE.create().fromJson(json, WxCpTagAddOrRemoveUsersResult.class); | |||
return WxCpGsonBuilder.create().fromJson(json, WxCpTagAddOrRemoveUsersResult.class); | |||
} | |||
@SerializedName("errcode") | |||
@@ -50,11 +50,11 @@ public class WxCpUser implements Serializable { | |||
} | |||
public static WxCpUser fromJson(String json) { | |||
return WxCpGsonBuilder.INSTANCE.create().fromJson(json, WxCpUser.class); | |||
return WxCpGsonBuilder.create().fromJson(json, WxCpUser.class); | |||
} | |||
public String toJson() { | |||
return WxCpGsonBuilder.INSTANCE.create().toJson(this); | |||
return WxCpGsonBuilder.create().toJson(this); | |||
} | |||
@Data | |||
@@ -7,8 +7,6 @@ import java.util.ArrayList; | |||
import java.util.List; | |||
import org.apache.commons.io.IOUtils; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.thoughtworks.xstream.annotations.XStreamAlias; | |||
import com.thoughtworks.xstream.annotations.XStreamConverter; | |||
@@ -18,6 +16,7 @@ import me.chanjar.weixin.common.api.WxConsts; | |||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter; | |||
import me.chanjar.weixin.cp.config.WxCpConfigStorage; | |||
import me.chanjar.weixin.cp.util.crypto.WxCpCryptUtil; | |||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; | |||
import me.chanjar.weixin.cp.util.xml.XStreamTransformer; | |||
/** | |||
@@ -378,7 +377,7 @@ public class WxCpXmlMessage implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxCpGsonBuilder.create().toJson(this); | |||
} | |||
@Data | |||
@@ -2,11 +2,9 @@ package me.chanjar.weixin.cp.config; | |||
import java.io.File; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import me.chanjar.weixin.common.bean.WxAccessToken; | |||
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder; | |||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; | |||
/** | |||
* 基于内存的微信配置provider,在实际生产环境中应该将这些配置持久化 | |||
@@ -203,7 +201,7 @@ public class WxCpInMemoryConfigStorage implements WxCpConfigStorage { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxCpGsonBuilder.create().toJson(this); | |||
} | |||
@Override | |||
@@ -15,7 +15,7 @@ import me.chanjar.weixin.cp.bean.WxCpUser; | |||
*/ | |||
public class WxCpGsonBuilder { | |||
public static final GsonBuilder INSTANCE = new GsonBuilder(); | |||
private static final GsonBuilder INSTANCE = new GsonBuilder(); | |||
static { | |||
INSTANCE.disableHtmlEscaping(); | |||
@@ -1,5 +1,9 @@ | |||
package cn.binarywang.wx.miniapp.api.impl; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import cn.binarywang.wx.miniapp.api.WxMaService; | |||
import cn.binarywang.wx.miniapp.api.WxMaTemplateService; | |||
import cn.binarywang.wx.miniapp.bean.template.WxMaTemplateAddResult; | |||
@@ -10,15 +14,11 @@ import me.chanjar.weixin.common.error.WxError; | |||
import me.chanjar.weixin.common.error.WxErrorException; | |||
import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
public class WxMaTemplateServiceImpl implements WxMaTemplateService { | |||
private WxMaService wxMaService; | |||
public WxMaTemplateServiceImpl(WxMaService wxMaService){ | |||
public WxMaTemplateServiceImpl(WxMaService wxMaService) { | |||
this.wxMaService = wxMaService; | |||
} | |||
@@ -31,9 +31,9 @@ public class WxMaTemplateServiceImpl implements WxMaTemplateService { | |||
String responseText = this.wxMaService.post(TEMPLATE_LIBRARY_LIST_URL, WxGsonBuilder.create().toJson(params)); | |||
WxError wxError = WxError.fromJson(responseText); | |||
if(wxError.getErrorCode() == 0){ | |||
if (wxError.getErrorCode() == 0) { | |||
return WxMaTemplateLibraryListResult.fromJson(responseText); | |||
}else { | |||
} else { | |||
throw new WxErrorException(wxError); | |||
} | |||
} | |||
@@ -46,9 +46,9 @@ public class WxMaTemplateServiceImpl implements WxMaTemplateService { | |||
String responseText = this.wxMaService.post(TEMPLATE_LIBRARY_KEYWORD_URL, WxGsonBuilder.create().toJson(params)); | |||
WxError wxError = WxError.fromJson(responseText); | |||
if(wxError.getErrorCode() == 0){ | |||
if (wxError.getErrorCode() == 0) { | |||
return WxMaTemplateLibraryGetResult.fromJson(responseText); | |||
}else { | |||
} else { | |||
throw new WxErrorException(wxError); | |||
} | |||
} | |||
@@ -62,9 +62,9 @@ public class WxMaTemplateServiceImpl implements WxMaTemplateService { | |||
String responseText = this.wxMaService.post(TEMPLATE_ADD_URL, WxGsonBuilder.create().toJson(params)); | |||
WxError wxError = WxError.fromJson(responseText); | |||
if(wxError.getErrorCode() == 0){ | |||
if (wxError.getErrorCode() == 0) { | |||
return WxMaTemplateAddResult.fromJson(responseText); | |||
}else { | |||
} else { | |||
throw new WxErrorException(wxError); | |||
} | |||
} | |||
@@ -78,9 +78,9 @@ public class WxMaTemplateServiceImpl implements WxMaTemplateService { | |||
String responseText = this.wxMaService.post(TEMPLATE_LIST_URL, WxGsonBuilder.create().toJson(params)); | |||
WxError wxError = WxError.fromJson(responseText); | |||
if(wxError.getErrorCode() == 0){ | |||
if (wxError.getErrorCode() == 0) { | |||
return WxMaTemplateListResult.fromJson(responseText); | |||
}else { | |||
} else { | |||
throw new WxErrorException(wxError); | |||
} | |||
} | |||
@@ -92,9 +92,9 @@ public class WxMaTemplateServiceImpl implements WxMaTemplateService { | |||
String responseText = this.wxMaService.post(TEMPLATE_DEL_URL, WxGsonBuilder.create().toJson(params)); | |||
WxError wxError = WxError.fromJson(responseText); | |||
if(wxError.getErrorCode() == 0){ | |||
if (wxError.getErrorCode() == 0) { | |||
return true; | |||
}else { | |||
} else { | |||
throw new WxErrorException(wxError); | |||
} | |||
} | |||
@@ -6,8 +6,6 @@ import java.io.Serializable; | |||
import java.nio.charset.StandardCharsets; | |||
import org.apache.commons.io.IOUtils; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import cn.binarywang.wx.miniapp.config.WxMaConfig; | |||
import cn.binarywang.wx.miniapp.util.crypt.WxMaCryptUtils; | |||
@@ -168,7 +166,7 @@ public class WxMaMessage implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return this.toJson(); | |||
} | |||
public String toJson() { | |||
@@ -1,14 +1,13 @@ | |||
package cn.binarywang.wx.miniapp.config; | |||
import me.chanjar.weixin.common.bean.WxAccessToken; | |||
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.File; | |||
import java.util.concurrent.locks.Lock; | |||
import java.util.concurrent.locks.ReentrantLock; | |||
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder; | |||
import me.chanjar.weixin.common.bean.WxAccessToken; | |||
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder; | |||
/** | |||
* 基于内存的微信配置provider,在实际生产环境中应该将这些配置持久化 | |||
* | |||
@@ -224,7 +223,7 @@ public class WxMaInMemoryConfig implements WxMaConfig { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMaGsonBuilder.create().toJson(this); | |||
} | |||
@Override | |||
@@ -4,11 +4,9 @@ import java.io.File; | |||
import java.util.concurrent.locks.Lock; | |||
import java.util.concurrent.locks.ReentrantLock; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import me.chanjar.weixin.common.bean.WxAccessToken; | |||
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 基于内存的微信配置provider,在实际生产环境中应该将这些配置持久化 | |||
@@ -250,7 +248,7 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
@Override | |||
@@ -1,6 +1,18 @@ | |||
package me.chanjar.weixin.mp.api.impl; | |||
import com.google.gson.*; | |||
import java.util.Arrays; | |||
import java.util.concurrent.locks.Lock; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import com.google.gson.Gson; | |||
import com.google.gson.JsonArray; | |||
import com.google.gson.JsonElement; | |||
import com.google.gson.JsonObject; | |||
import com.google.gson.JsonParser; | |||
import com.google.gson.JsonPrimitive; | |||
import com.google.gson.reflect.TypeToken; | |||
import me.chanjar.weixin.common.bean.WxCardApiSignature; | |||
import me.chanjar.weixin.common.error.WxError; | |||
@@ -15,12 +27,6 @@ import me.chanjar.weixin.mp.bean.card.WxMpCardLandingPageCreateResult; | |||
import me.chanjar.weixin.mp.bean.card.WxMpCardQrcodeCreateResult; | |||
import me.chanjar.weixin.mp.bean.result.WxMpCardResult; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import java.util.Arrays; | |||
import java.util.concurrent.locks.Lock; | |||
/** | |||
* Created by Binary Wang on 2016/7/27. | |||
@@ -31,7 +37,7 @@ public class WxMpCardServiceImpl implements WxMpCardService { | |||
private WxMpService wxMpService; | |||
private static final Gson GSON = new Gson(); | |||
private static final Gson GSON = WxMpGsonBuilder.create(); | |||
public WxMpCardServiceImpl(WxMpService wxMpService) { | |||
this.wxMpService = wxMpService; | |||
@@ -156,7 +162,7 @@ public class WxMpCardServiceImpl implements WxMpCardService { | |||
param.addProperty("check_consume", checkConsume); | |||
String responseContent = this.wxMpService.post(CARD_CODE_GET, param.toString()); | |||
JsonElement tmpJsonElement = new JsonParser().parse(responseContent); | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(tmpJsonElement, | |||
return WxMpGsonBuilder.create().fromJson(tmpJsonElement, | |||
new TypeToken<WxMpCardResult>() { | |||
}.getType()); | |||
} | |||
@@ -213,7 +219,7 @@ public class WxMpCardServiceImpl implements WxMpCardService { | |||
param.addProperty("is_mark", isMark); | |||
String responseContent = this.getWxMpService().post(CARD_CODE_MARK, param.toString()); | |||
JsonElement tmpJsonElement = new JsonParser().parse(responseContent); | |||
WxMpCardResult cardResult = WxMpGsonBuilder.INSTANCE.create().fromJson(tmpJsonElement, | |||
WxMpCardResult cardResult = WxMpGsonBuilder.create().fromJson(tmpJsonElement, | |||
new TypeToken<WxMpCardResult>() { | |||
}.getType()); | |||
if (!"0".equals(cardResult.getErrorCode())) { | |||
@@ -1,5 +1,14 @@ | |||
package me.chanjar.weixin.mp.api.impl; | |||
import java.io.UnsupportedEncodingException; | |||
import java.net.URLDecoder; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import com.google.gson.Gson; | |||
import com.google.gson.JsonElement; | |||
import com.google.gson.JsonObject; | |||
@@ -9,20 +18,25 @@ import me.chanjar.weixin.common.error.WxErrorException; | |||
import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
import me.chanjar.weixin.mp.api.WxMpMemberCardService; | |||
import me.chanjar.weixin.mp.api.WxMpService; | |||
import me.chanjar.weixin.mp.bean.card.*; | |||
import me.chanjar.weixin.mp.bean.card.AdvancedInfo; | |||
import me.chanjar.weixin.mp.bean.card.BaseInfo; | |||
import me.chanjar.weixin.mp.bean.card.DateInfo; | |||
import me.chanjar.weixin.mp.bean.card.MemberCard; | |||
import me.chanjar.weixin.mp.bean.card.MemberCardActivateUserFormRequest; | |||
import me.chanjar.weixin.mp.bean.card.MemberCardActivateUserFormResult; | |||
import me.chanjar.weixin.mp.bean.card.MemberCardCreateRequest; | |||
import me.chanjar.weixin.mp.bean.card.WxMpCardCreateResult; | |||
import me.chanjar.weixin.mp.bean.card.enums.BusinessServiceType; | |||
import me.chanjar.weixin.mp.bean.card.enums.CardColor; | |||
import me.chanjar.weixin.mp.bean.card.enums.DateInfoType; | |||
import me.chanjar.weixin.mp.bean.membercard.*; | |||
import me.chanjar.weixin.mp.bean.membercard.ActivatePluginParam; | |||
import me.chanjar.weixin.mp.bean.membercard.ActivatePluginParamResult; | |||
import me.chanjar.weixin.mp.bean.membercard.WxMpMemberCardActivatedMessage; | |||
import me.chanjar.weixin.mp.bean.membercard.WxMpMemberCardCreateMessage; | |||
import me.chanjar.weixin.mp.bean.membercard.WxMpMemberCardUpdateMessage; | |||
import me.chanjar.weixin.mp.bean.membercard.WxMpMemberCardUpdateResult; | |||
import me.chanjar.weixin.mp.bean.membercard.WxMpMemberCardUserInfoResult; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import java.io.UnsupportedEncodingException; | |||
import java.net.URLDecoder; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
/** | |||
* 会员卡相关接口的实现类 | |||
@@ -36,7 +50,7 @@ public class WxMpMemberCardServiceImpl implements WxMpMemberCardService { | |||
private WxMpService wxMpService; | |||
private static final Gson GSON = new Gson(); | |||
private static final Gson GSON = WxMpGsonBuilder.create(); | |||
WxMpMemberCardServiceImpl(WxMpService wxMpService) { | |||
this.wxMpService = wxMpService; | |||
@@ -244,7 +258,7 @@ public class WxMpMemberCardServiceImpl implements WxMpMemberCardService { | |||
String responseContent = this.getWxMpService().post(MEMBER_CARD_USER_INFO_GET, jsonObject.toString()); | |||
log.debug("{}", responseContent); | |||
JsonElement tmpJsonElement = new JsonParser().parse(responseContent); | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(tmpJsonElement, | |||
return WxMpGsonBuilder.create().fromJson(tmpJsonElement, | |||
new TypeToken<WxMpMemberCardUserInfoResult>() { | |||
}.getType()); | |||
} | |||
@@ -267,7 +281,7 @@ public class WxMpMemberCardServiceImpl implements WxMpMemberCardService { | |||
String responseContent = this.getWxMpService().post(MEMBER_CARD_UPDATE_USER, GSON.toJson(updateUserMessage)); | |||
JsonElement tmpJsonElement = new JsonParser().parse(responseContent); | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(tmpJsonElement, | |||
return WxMpGsonBuilder.create().fromJson(tmpJsonElement, | |||
new TypeToken<WxMpMemberCardUpdateResult>() { | |||
}.getType()); | |||
} | |||
@@ -1,16 +1,16 @@ | |||
package me.chanjar.weixin.mp.api.impl; | |||
import com.google.gson.Gson; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import com.google.gson.JsonObject; | |||
import me.chanjar.weixin.common.error.WxErrorException; | |||
import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor; | |||
import me.chanjar.weixin.mp.api.WxMpService; | |||
import me.chanjar.weixin.mp.api.WxMpUserBlacklistService; | |||
import me.chanjar.weixin.mp.bean.result.WxMpUserBlacklistGetResult; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* @author miller | |||
@@ -37,14 +37,15 @@ public class WxMpUserBlacklistServiceImpl implements WxMpUserBlacklistService { | |||
Map<String, Object> map = new HashMap<>(); | |||
map.put("openid_list", openidList); | |||
String url = API_BLACKLIST_PREFIX + "/batchblacklist"; | |||
this.wxMpService.execute(SimplePostRequestExecutor.create(this.wxMpService.getRequestHttp()), url, new Gson().toJson(map)); | |||
this.wxMpService.execute(SimplePostRequestExecutor.create(this.wxMpService.getRequestHttp()), url, | |||
WxMpGsonBuilder.create().toJson(map)); | |||
} | |||
@Override | |||
public void pullFromBlacklist(List<String> openidList) throws WxErrorException { | |||
Map<String, Object> map = new HashMap<>(); | |||
Map<String, Object> map = new HashMap<>(2); | |||
map.put("openid_list", openidList); | |||
String url = API_BLACKLIST_PREFIX + "/batchunblacklist"; | |||
this.wxMpService.execute(SimplePostRequestExecutor.create(this.wxMpService.getRequestHttp()), url, new Gson().toJson(map)); | |||
this.wxMpService.execute(SimplePostRequestExecutor.create(this.wxMpService.getRequestHttp()), url, WxMpGsonBuilder.create().toJson(map)); | |||
} | |||
} |
@@ -3,19 +3,17 @@ package me.chanjar.weixin.mp.bean; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 微信卡券 | |||
* 微信卡券. | |||
* | |||
* @author YuJian | |||
* @version 15/11/11 | |||
*/ | |||
@Data | |||
public class WxMpCard implements Serializable{ | |||
public class WxMpCard implements Serializable { | |||
private static final long serialVersionUID = 9214301870017772921L; | |||
private String cardId; | |||
@@ -30,6 +28,6 @@ public class WxMpCard implements Serializable{ | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -4,9 +4,6 @@ import java.io.Serializable; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@@ -26,7 +23,7 @@ public class WxMpMassNews implements Serializable { | |||
} | |||
public String toJson() { | |||
return WxMpGsonBuilder.INSTANCE.create().toJson(this); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
public boolean isEmpty() { | |||
@@ -35,7 +32,7 @@ public class WxMpMassNews implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
/** | |||
@@ -85,7 +82,7 @@ public class WxMpMassNews implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} | |||
} |
@@ -51,7 +51,7 @@ public class WxMpMassOpenIdsMessage implements Serializable { | |||
} | |||
public String toJson() { | |||
return WxMpGsonBuilder.INSTANCE.create().toJson(this); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
/** | |||
@@ -36,6 +36,6 @@ public class WxMpMassPreviewMessage implements Serializable { | |||
} | |||
public String toJson() { | |||
return WxMpGsonBuilder.INSTANCE.create().toJson(this); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -54,7 +54,7 @@ public class WxMpMassTagMessage implements Serializable { | |||
} | |||
public String toJson() { | |||
return WxMpGsonBuilder.INSTANCE.create().toJson(this); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
public void setSendAll(boolean sendAll) { | |||
@@ -19,6 +19,6 @@ public class WxMpMassVideo implements Serializable { | |||
private String description; | |||
public String toJson() { | |||
return WxMpGsonBuilder.INSTANCE.create().toJson(this); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -22,7 +22,7 @@ public class WxMpShakeInfoResult implements Serializable { | |||
private ShakeInfoData data; | |||
public static WxMpShakeInfoResult fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpShakeInfoResult.class); | |||
return WxMpGsonBuilder.create().fromJson(json, WxMpShakeInfoResult.class); | |||
} | |||
@Data | |||
@@ -1,33 +1,35 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 封面摘要 | |||
* author:yuanqixun | |||
* 封面摘要. | |||
* @author yuanqixun | |||
* date:2018-08-25 00:35 | |||
*/ | |||
@Data | |||
public class Abstract implements Serializable { | |||
private static final long serialVersionUID = -2612656133201770573L; | |||
/** | |||
* 摘要 | |||
* 摘要. | |||
*/ | |||
@SerializedName("abstract") | |||
private String abstractInfo; | |||
/** | |||
* 封面图片列表,仅支持填入一 个封面图片链接, 上传图片接口 上传获取图片获得链接,填写 非CDN链接会报错,并在此填入。 建议图片尺寸像素850*350 | |||
* 封面图片列表. | |||
* 仅支持填入一 个封面图片链接, 上传图片接口 上传获取图片获得链接,填写 非CDN链接会报错,并在此填入。 建议图片尺寸像素850*350 | |||
*/ | |||
@SerializedName("icon_url_list") | |||
private String iconUrlList; | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,23 +1,22 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.bean.card.enums.BusinessServiceType; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
//子对象列表 | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.bean.card.enums.BusinessServiceType; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 微信会员卡高级字段信息 | |||
* author:yuanqixun | |||
* 微信会员卡高级字段信息. | |||
* @author yuanqixun | |||
* date:2018-08-25 00:36 | |||
*/ | |||
@Data | |||
public class AdvancedInfo implements Serializable { | |||
private static final long serialVersionUID = -8470424140133771841L; | |||
// public AdvancedInfo(){ | |||
// useCondition = new UseCondition(); | |||
@@ -27,50 +26,56 @@ public class AdvancedInfo implements Serializable { | |||
// } | |||
/** | |||
* 使用门槛(条件),若不填写使用条件则在券面拼写 :无最低消费限制,全场通用,不限品类;并在使用说明显示: 可与其他优惠共享 | |||
* 使用门槛(条件). | |||
* 若不填写使用条件则在券面拼写 :无最低消费限制,全场通用,不限品类;并在使用说明显示: 可与其他优惠共享 | |||
*/ | |||
@SerializedName("use_condition") | |||
private UseCondition useCondition; | |||
/** | |||
* 封面摘要 | |||
* 封面摘要. | |||
*/ | |||
@SerializedName("abstract") | |||
private Abstract abstractInfo; | |||
/** | |||
* 图文列表,显示在详情内页 ,优惠券券开发者须至少传入 一组图文列表 | |||
* 图文列表. | |||
* 显示在详情内页 ,优惠券券开发者须至少传入 一组图文列表 | |||
*/ | |||
@SerializedName("text_image_list") | |||
private List<TextImageList> textImageList; | |||
/** | |||
* 商家服务类型,数组类型:BIZ_SERVICE_DELIVER 外卖服务; BIZ_SERVICE_FREE_PARK 停车位; BIZ_SERVICE_WITH_PET 可带宠物; BIZ_SERVICE_FREE_WIFI 免费wifi, 可多选 | |||
* 商家服务类型. | |||
* 数组类型:BIZ_SERVICE_DELIVER 外卖服务; BIZ_SERVICE_FREE_PARK 停车位; BIZ_SERVICE_WITH_PET 可带宠物; BIZ_SERVICE_FREE_WIFI 免费wifi, 可多选 | |||
*/ | |||
@SerializedName("business_service") | |||
private List<String> businessServiceList; | |||
/** | |||
* 使用时段限制 | |||
* 使用时段限制. | |||
*/ | |||
@SerializedName("time_limit") | |||
private TimeLimit timeLimit; | |||
/** | |||
* 是否可以分享朋友 | |||
* 是否可以分享朋友. | |||
*/ | |||
@SerializedName("share_friends") | |||
private Boolean shareFriends; | |||
public void addBusinessService(BusinessServiceType businessServiceType) { | |||
if (businessServiceType != null) { | |||
if (businessServiceList == null) | |||
businessServiceList = new ArrayList<String>(); | |||
if (businessServiceList == null){ | |||
businessServiceList = new ArrayList<>(); | |||
} | |||
businessServiceList.add(businessServiceType.name()); | |||
} | |||
} | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,196 +1,198 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
//子对象列表 | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 微信会员卡基本信息 | |||
* author:yuanqixun | |||
* 微信会员卡基本信息. | |||
* @author yuanqixun | |||
* date:2018-08-25 00:36 | |||
*/ | |||
@Data | |||
public class BaseInfo implements Serializable { | |||
/** | |||
* 卡券的商户logo,建议像素为300*300。 | |||
* 卡券的商户logo,建议像素为300*300. | |||
*/ | |||
@SerializedName("logo_url") | |||
private String logoUrl; | |||
/** | |||
* Code展示类型,"CODE_TYPE_TEXT" 文本 "CODE_TYPE_BARCODE" 一维码 "CODE_TYPE_QRCODE" 二维码 "CODE_TYPE_ONLY_QRCODE" 仅显示二维码 "CODE_TYPE_ONLY_BARCODE" 仅显示一维码 "CODE_TYPE_NONE" 不显示任何码型 | |||
* Code展示类型. | |||
* "CODE_TYPE_TEXT" 文本 "CODE_TYPE_BARCODE" 一维码 "CODE_TYPE_QRCODE" 二维码 "CODE_TYPE_ONLY_QRCODE" 仅显示二维码 "CODE_TYPE_ONLY_BARCODE" 仅显示一维码 "CODE_TYPE_NONE" 不显示任何码型 | |||
*/ | |||
@SerializedName("code_type") | |||
private String codeType = "CODE_TYPE_QRCODE"; | |||
/** | |||
* 支付功能结构体,swipe_card结构 | |||
* 支付功能结构体,swipe_card结构. | |||
*/ | |||
@SerializedName("pay_info") | |||
private PayInfo payInfo; | |||
/** | |||
* 是否设置该会员卡中部的按钮同时支持微信支付刷卡和会员卡二维码 | |||
* 是否设置该会员卡中部的按钮同时支持微信支付刷卡和会员卡二维码. | |||
*/ | |||
@SerializedName("is_pay_and_qrcode") | |||
private boolean isPayAndQrcode; | |||
/** | |||
* 商户名字,字数上限为12个汉字 | |||
* 商户名字,字数上限为12个汉字. | |||
*/ | |||
@SerializedName("brand_name") | |||
private String brandName; | |||
/** | |||
* 卡券名,字数上限为9个汉字 (建议涵盖卡券属性、服务及金额)。 | |||
* 卡券名,字数上限为9个汉字 (建议涵盖卡券属性、服务及金额). | |||
*/ | |||
@SerializedName("title") | |||
private String title; | |||
/** | |||
* 券颜色,按色彩规范标注填写Color010-Color100 | |||
* 券颜色,按色彩规范标注填写Color010-Color100. | |||
*/ | |||
@SerializedName("color") | |||
private String color; | |||
/** | |||
* 卡券使用提醒,字数上限为16个汉字 | |||
* 卡券使用提醒,字数上限为16个汉字. | |||
*/ | |||
@SerializedName("notice") | |||
private String notice; | |||
/** | |||
* 卡券使用说明,字数上限为1024个汉字。 | |||
* 卡券使用说明,字数上限为1024个汉字. | |||
*/ | |||
@SerializedName("description") | |||
private String description; | |||
/** | |||
* 商品信息 | |||
* 商品信息. | |||
*/ | |||
@SerializedName("sku") | |||
private Sku sku; | |||
/** | |||
* 使用日期,有效期的信息。 | |||
* 使用日期,有效期的信息. | |||
*/ | |||
@SerializedName("date_info") | |||
private DateInfo dateInfo; | |||
/** | |||
* 是否自定义Code码,填写true或false,默认为false 通常自有优惠码系统的开发者选择自定义Code码,详情见 是否自定义code | |||
* 是否自定义Code码,填写true或false. | |||
* 默认为false 通常自有优惠码系统的开发者选择自定义Code码,详情见 是否自定义code | |||
*/ | |||
@SerializedName("use_custom_code") | |||
private boolean useCustomCode; | |||
/** | |||
* 是否指定用户领取,填写true或false。默认为false | |||
* 是否指定用户领取,填写true或false。默认为false. | |||
*/ | |||
@SerializedName("bind_openid") | |||
private boolean bindOpenid; | |||
/** | |||
* 客服电话 | |||
* 客服电话. | |||
*/ | |||
@SerializedName("service_phone") | |||
private String servicePhone; | |||
/** | |||
* 门店位置ID,调用 POI门店管理接口 获取门店位置ID。 | |||
* 门店位置ID,调用 POI门店管理接口 获取门店位置ID. | |||
*/ | |||
@SerializedName("location_id_list") | |||
private String locationIdList; | |||
/** | |||
* 会员卡是否支持全部门店,填写后商户门店更新时会自动同步至卡券 | |||
* 会员卡是否支持全部门店,填写后商户门店更新时会自动同步至卡券. | |||
*/ | |||
@SerializedName("use_all_locations") | |||
private boolean useAllLocations = true; | |||
/** | |||
* 卡券中部居中的按钮,仅在卡券激活后且可用状态 时显示 | |||
* 卡券中部居中的按钮,仅在卡券激活后且可用状态 时显示. | |||
*/ | |||
@SerializedName("center_title") | |||
private String centerTitle; | |||
/** | |||
* 显示在入口下方的提示语,仅在卡券激活后且可用状态时显示 | |||
* 显示在入口下方的提示语,仅在卡券激活后且可用状态时显示. | |||
*/ | |||
@SerializedName("center_sub_title") | |||
private String centerSubTitle; | |||
/** | |||
* 顶部居中的url,仅在卡券激活后且可用状态时显示 | |||
* 顶部居中的url,仅在卡券激活后且可用状态时显示. | |||
*/ | |||
@SerializedName("center_url") | |||
private String centerUrl; | |||
/** | |||
* 自定义跳转外链的入口名字 | |||
* 自定义跳转外链的入口名字. | |||
*/ | |||
@SerializedName("custom_url_name") | |||
private String customUrlName; | |||
/** | |||
* 自定义跳转的URL | |||
* 自定义跳转的URL. | |||
*/ | |||
@SerializedName("custom_url") | |||
private String customUrl; | |||
/** | |||
* 显示在入口右侧的提示语 | |||
* 显示在入口右侧的提示语. | |||
*/ | |||
@SerializedName("custom_url_sub_title") | |||
private String customUrlSubTitle; | |||
/** | |||
* 营销场景的自定义入口名称 | |||
* 营销场景的自定义入口名称. | |||
*/ | |||
@SerializedName("promotion_url_name") | |||
private String promotionUrlName; | |||
/** | |||
* 入口跳转外链的地址链接 | |||
* 入口跳转外链的地址链接. | |||
*/ | |||
@SerializedName("promotion_url") | |||
private String promotionUrl; | |||
/** | |||
* 显示在营销入口右侧的提示语 | |||
* 显示在营销入口右侧的提示语. | |||
*/ | |||
@SerializedName("promotion_url_sub_title") | |||
private String promotionUrlSubTitle; | |||
/** | |||
* 每人可领券的数量限制,建议会员卡每人限领一张 | |||
* 每人可领券的数量限制,建议会员卡每人限领一张. | |||
*/ | |||
@SerializedName("get_limit") | |||
private Integer getLimit = 1; | |||
/** | |||
* 卡券领取页面是否可分享,默认为true | |||
* 卡券领取页面是否可分享,默认为true. | |||
*/ | |||
@SerializedName("can_share") | |||
private boolean canShare; | |||
/** | |||
* 卡券是否可转赠,默认为true | |||
* 卡券是否可转赠,默认为true. | |||
*/ | |||
@SerializedName("can_give_friend") | |||
private boolean canGiveFriend; | |||
/** | |||
* 用户点击进入会员卡时推送事件,填写true为用户点击进入会员卡时推送事件,默认为false。详情见 进入会员卡事件推送 | |||
* 用户点击进入会员卡时推送事件. | |||
* 填写true为用户点击进入会员卡时推送事件,默认为false。详情见 进入会员卡事件推送 | |||
*/ | |||
@SerializedName("need_push_on_view") | |||
private boolean needPushOnView; | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,69 +1,70 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 积分规则 | |||
* author:yuanqixun | |||
* 积分规则. | |||
* @author yuanqixun | |||
* date:2018-08-25 00:33 | |||
*/ | |||
@Data | |||
public class BonusRule implements Serializable { | |||
private static final long serialVersionUID = -8698218402074475078L; | |||
/** | |||
* 消费金额,以分为单位。 | |||
* 消费金额,以分为单位. | |||
*/ | |||
@SerializedName("cost_money_unit") | |||
private Integer costMoneyUnit; | |||
/** | |||
* 对应增加的积分 | |||
* 对应增加的积分. | |||
*/ | |||
@SerializedName("increase_bonus") | |||
private Integer increaseBonus; | |||
/** | |||
* 用户单次可获取的积分上限 | |||
* 用户单次可获取的积分上限. | |||
*/ | |||
@SerializedName("max_increase_bonus") | |||
private Integer maxIncreaseBonus; | |||
/** | |||
* 初始设置积分 | |||
* 初始设置积分. | |||
*/ | |||
@SerializedName("init_increase_bonus") | |||
private Integer initIncreaseBonus; | |||
/** | |||
* 每使用积分 | |||
* 每使用积分. | |||
*/ | |||
@SerializedName("cost_bonus_unit") | |||
private Integer costBonusUnit; | |||
/** | |||
* 抵扣xx元,这里以分为单位) | |||
* 抵扣xx元,这里以分为单位). | |||
*/ | |||
@SerializedName("reduce_money") | |||
private Integer reduceMoney; | |||
/** | |||
* 抵扣条件,满xx元(这里以分为单位)可用。 | |||
* 抵扣条件,满xx元(这里以分为单位)可用. | |||
*/ | |||
@SerializedName("least_moneyto_use_bonus") | |||
private Integer leastMoneytoUseBonus; | |||
/** | |||
* 抵扣条件,单笔最多使用xx积分。 | |||
* 抵扣条件,单笔最多使用xx积分. | |||
*/ | |||
@SerializedName("max_reduce_bonus") | |||
private Integer maxReduceBonus; | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,39 +1,40 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 自定义会员信息类目 | |||
* author:yuanqixun | |||
* 自定义会员信息类目. | |||
* @author yuanqixun | |||
* date:2018-08-25 00:34 | |||
*/ | |||
@Data | |||
public class CustomCell1 implements Serializable { | |||
private static final long serialVersionUID = -6446192667149800447L; | |||
/** | |||
* 入口名称 | |||
* 入口名称. | |||
*/ | |||
@SerializedName("name") | |||
private String name; | |||
/** | |||
* 入口右侧提示语,6个汉字内。 | |||
* 入口右侧提示语,6个汉字内. | |||
*/ | |||
@SerializedName("tips") | |||
private String tips; | |||
/** | |||
* 入口跳转链接。 | |||
* 入口跳转链接. | |||
*/ | |||
@SerializedName("url") | |||
private String url; | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,19 +1,19 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 自定义会员信息类目 | |||
* author:yuanqixun | |||
* 自定义会员信息类目. | |||
* @author yuanqixun | |||
* date:2018-08-25 00:34 | |||
*/ | |||
@Data | |||
public class CustomField implements Serializable { | |||
private static final long serialVersionUID = -5364412812328198195L; | |||
/** | |||
* 半自定义名称,当开发者变更这类类目信息的value值时 可以选择触发系统模板消息通知用户。 FIELD_NAME_TYPE_LEVEL 等级 FIELD_NAME_TYPE_COUPON 优惠券 FIELD_NAME_TYPE_STAMP 印花 FIELD_NAME_TYPE_DISCOUNT 折扣 FIELD_NAME_TYPE_ACHIEVEMEN 成就 FIELD_NAME_TYPE_MILEAGE 里程 FIELD_NAME_TYPE_SET_POINTS 集点 FIELD_NAME_TYPE_TIMS 次数 | |||
@@ -37,7 +37,8 @@ public class CustomField implements Serializable { | |||
return nameType; | |||
} | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,51 +1,57 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 使用日期,有效期的信息 | |||
* author:yuanqixun | |||
* 使用日期,有效期的信息. | |||
* @author yuanqixun | |||
* date:2018-08-25 00:31 | |||
*/ | |||
@Data | |||
public class DateInfo implements Serializable { | |||
private static final long serialVersionUID = 2734999880412106549L; | |||
/** | |||
* 使用时间的类型,支持固定时长有效类型 固定日期有效类型 永久有效类型:DATE_TYPE_FIX_TERM_RANGE、DATE_TYPE_FIX_TERM 、DATE_TYPE_PERMANENT | |||
* 使用时间的类型. | |||
* 支持固定时长有效类型 固定日期有效类型 永久有效类型:DATE_TYPE_FIX_TERM_RANGE、DATE_TYPE_FIX_TERM 、DATE_TYPE_PERMANENT | |||
*/ | |||
@SerializedName("type") | |||
private String type = "DATE_TYPE_PERMANENT"; | |||
/** | |||
* 起用时间,type为DATE_TYPE_FIX_TIME_RANGE时专用, 表示起用时间。从1970年1月1日00:00:00至起用时间的秒数 ( 东八区时间,UTC+8,单位为秒 ) | |||
* 起用时间. | |||
* type为DATE_TYPE_FIX_TIME_RANGE时专用, 表示起用时间。从1970年1月1日00:00:00至起用时间的秒数 ( 东八区时间,UTC+8,单位为秒 ) | |||
*/ | |||
@SerializedName("begin_timestamp") | |||
private Long beginTimestamp; | |||
/** | |||
* 结束时间,type为DATE_TYPE_FIX_TERM_RANGE时专用,表示结束时间 ( 东八区时间,UTC+8,单位为秒 ) | |||
* 结束时间. | |||
* type为DATE_TYPE_FIX_TERM_RANGE时专用,表示结束时间 ( 东八区时间,UTC+8,单位为秒 ) | |||
*/ | |||
@SerializedName("end_timestamp") | |||
private Long endTimestamp; | |||
/** | |||
* 自领取后多少天内有效,type为DATE_TYPE_FIX_TERM时专用,表示自领取后多少天内有效,领取后当天有效填写0(单位为天) | |||
* 自领取后多少天内有效. | |||
* type为DATE_TYPE_FIX_TERM时专用,表示自领取后多少天内有效,领取后当天有效填写0(单位为天) | |||
*/ | |||
@SerializedName("fixed_term") | |||
private Integer fixedTerm; | |||
/** | |||
* 自领取后多少天开始生效,type为DATE_TYPE_FIX_TERM时专用,表示自领取后多少天开始生效。(单位为天) | |||
* 自领取后多少天开始生效. | |||
* type为DATE_TYPE_FIX_TERM时专用,表示自领取后多少天开始生效。(单位为天) | |||
*/ | |||
@SerializedName("fixed_begin_term") | |||
private Integer fixedBeginTerm; | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,152 +1,156 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
/** | |||
* . | |||
* @author yuanqixun | |||
*/ | |||
@Data | |||
public final class MemberCard implements Serializable { | |||
private static final long serialVersionUID = 2922028551810647622L; | |||
/** | |||
* 会员卡背景图 | |||
* 会员卡背景图. | |||
*/ | |||
@SerializedName("background_pic_url") | |||
private String backgroundPicUrl; | |||
/** | |||
* 基本信息 | |||
* 基本信息. | |||
*/ | |||
@SerializedName("base_info") | |||
private BaseInfo baseInfo; | |||
/** | |||
* 特权说明 | |||
* 特权说明. | |||
*/ | |||
@SerializedName("prerogative") | |||
private String prerogative; | |||
/** | |||
* 自动激活 | |||
* 自动激活. | |||
*/ | |||
@SerializedName("auto_activate") | |||
private boolean autoActivate; | |||
/** | |||
* 是否一键开卡 | |||
* 是否一键开卡. | |||
*/ | |||
@SerializedName("wx_activate") | |||
private boolean wxActivate; | |||
/** | |||
* 显示积分 | |||
* 显示积分. | |||
*/ | |||
@SerializedName("supply_bonus") | |||
private boolean supplyBonus; | |||
/** | |||
* 查看积分外链,设置跳转外链查看积分详情。仅适用于积分无法通过激活接口同步的情况下使用该字段。 | |||
* 查看积分外链,设置跳转外链查看积分详情。仅适用于积分无法通过激活接口同步的情况下使用该字段. | |||
*/ | |||
@SerializedName("bonus_url") | |||
private String bonusUrl; | |||
/** | |||
* 支持储值 | |||
* 支持储值. | |||
*/ | |||
@SerializedName("supply_balance") | |||
private boolean supplyBalance; | |||
/** | |||
* 余额外链,仅适用于余额无法通过激活接口同步的情况下使用该字段。 | |||
* 余额外链,仅适用于余额无法通过激活接口同步的情况下使用该字段. | |||
*/ | |||
@SerializedName("balance_url") | |||
private String balanceUrl; | |||
/** | |||
* 自定义会员类目1,会员卡激活后显示 | |||
* 自定义会员类目1,会员卡激活后显示. | |||
*/ | |||
@SerializedName("custom_field1") | |||
private CustomField customField1; | |||
/** | |||
* 自定义会员类目2 | |||
* 自定义会员类目2. | |||
*/ | |||
@SerializedName("custom_field2") | |||
private CustomField customField2; | |||
/** | |||
* 自定义会员类目3 | |||
* 自定义会员类目3. | |||
*/ | |||
@SerializedName("custom_field3") | |||
private CustomField customField3; | |||
/** | |||
* 积分清零规则 | |||
* 积分清零规则. | |||
*/ | |||
@SerializedName("bonus_cleared") | |||
private String bonusCleared; | |||
/** | |||
* 积分规则 | |||
* 积分规则. | |||
*/ | |||
@SerializedName("bonus_rules") | |||
private String bonusRules; | |||
/** | |||
* 储值规则 | |||
* 储值规则. | |||
*/ | |||
@SerializedName("balance_rules") | |||
private String balanceRules; | |||
/** | |||
* 激活会员卡的url | |||
* 激活会员卡的url. | |||
*/ | |||
@SerializedName("activate_url") | |||
private String activateUrl; | |||
/** | |||
* 激活会原卡url对应的小程序user_name,仅可跳转该公众号绑定的小程序 | |||
* 激活会原卡url对应的小程序user_name,仅可跳转该公众号绑定的小程序. | |||
*/ | |||
@SerializedName("activate_app_brand_user_name") | |||
private String activateAppBrandUserName; | |||
/** | |||
* 激活会原卡url对应的小程序path | |||
* 激活会原卡url对应的小程序path. | |||
*/ | |||
@SerializedName("activate_app_brand_pass") | |||
private String activateAppBrandPass; | |||
/** | |||
* 自定义会员信息类目,会员卡激活后显示。 | |||
* 自定义会员信息类目,会员卡激活后显示. | |||
*/ | |||
@SerializedName("custom_cell1") | |||
private CustomCell1 customCell1; | |||
/** | |||
* 积分规则,JSON结构积分规则 。 | |||
* 积分规则,JSON结构积分规则. | |||
*/ | |||
@SerializedName("bonus_rule") | |||
private BonusRule bonusRule; | |||
/** | |||
* 折扣,该会员卡享受的折扣优惠,填10就是九折。 | |||
* 折扣,该会员卡享受的折扣优惠,填10就是九折. | |||
*/ | |||
private Integer discount; | |||
/** | |||
* 创建优惠券特有的高级字段 | |||
* 创建优惠券特有的高级字段. | |||
*/ | |||
@SerializedName("advanced_info") | |||
private AdvancedInfo advancedInfo; | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
public static MemberCard fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, MemberCard.class); | |||
return WxMpGsonBuilder.create().fromJson(json, MemberCard.class); | |||
} | |||
} |
@@ -1,11 +1,9 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
@Data | |||
public class MemberCardActivateUserFormResult implements Serializable { | |||
@@ -22,7 +20,7 @@ public class MemberCardActivateUserFormResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} | |||
@@ -1,11 +1,10 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@Data | |||
public class MemberCardCreateRequest implements Serializable { | |||
@@ -15,7 +14,8 @@ public class MemberCardCreateRequest implements Serializable { | |||
@SerializedName("member_card") | |||
private MemberCard memberCard; | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,24 +1,25 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.bean.card.enums.CardWechatFieldType; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.apache.commons.lang3.StringUtils; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.bean.card.enums.CardWechatFieldType; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 用户表单对象 | |||
* 用户表单对象. | |||
* | |||
* @author yuanqixun | |||
* @date 2018-08-30 | |||
*/ | |||
@Data | |||
public class MemberCardUserForm implements Serializable { | |||
private static final long serialVersionUID = -1142881966808073662L; | |||
/** | |||
* 当前结构(required_form或者optional_form )内的字段是否允许用户激活后再次修改, | |||
@@ -49,44 +50,48 @@ public class MemberCardUserForm implements Serializable { | |||
/** | |||
* 添加富文本类型字段 | |||
* | |||
* @param fieldType | |||
*/ | |||
public void addRichField(MemberCardUserFormRichField field) { | |||
if (field == null) | |||
if (field == null) { | |||
return; | |||
if (richFieldList == null) | |||
} | |||
if (richFieldList == null) { | |||
richFieldList = new ArrayList<>(); | |||
} | |||
richFieldList.add(field); | |||
} | |||
/** | |||
* 添加微信选项类型字段 | |||
* | |||
* @param fieldType | |||
*/ | |||
public void addWechatField(CardWechatFieldType fieldType) { | |||
if (fieldType == null) | |||
if (fieldType == null) { | |||
return; | |||
if (wechatFieldIdList == null) | |||
} | |||
if (wechatFieldIdList == null) { | |||
wechatFieldIdList = new ArrayList<>(); | |||
} | |||
wechatFieldIdList.add(fieldType.name()); | |||
} | |||
/** | |||
* 添加文本类型字段 | |||
* | |||
* @param fieldType | |||
*/ | |||
public void addCustomField(String field) { | |||
if (StringUtils.isBlank(field)) | |||
if (StringUtils.isBlank(field)) { | |||
return; | |||
if (customFieldList == null) | |||
} | |||
if (customFieldList == null) { | |||
customFieldList = new ArrayList<>(); | |||
} | |||
customFieldList.add(field); | |||
} | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,16 +1,15 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.bean.card.enums.CardRichFieldType; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 富文本字段 | |||
* 富文本字段. | |||
* | |||
* @author yuanqixun | |||
* @date 2018-08-30 | |||
@@ -31,12 +30,14 @@ public class MemberCardUserFormRichField { | |||
private List<String> valueList; | |||
public void add(String value) { | |||
if (valueList == null) | |||
if (valueList == null) { | |||
valueList = new ArrayList<String>(); | |||
} | |||
valueList.add(value); | |||
} | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,15 +1,14 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 支付功能 | |||
* author:yuanqixun | |||
* 支付功能. | |||
* @author yuanqixun | |||
* date:2018-08-25 00:33 | |||
*/ | |||
@Data | |||
@@ -21,7 +20,8 @@ public class PayInfo implements Serializable { | |||
@SerializedName("swipe_card") | |||
private SwipeCard swipeCard; | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,15 +1,14 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 商品信息 | |||
* author:yuanqixun | |||
* 商品信息. | |||
* @author yuanqixun | |||
* date:2018-08-25 00:32 | |||
*/ | |||
@Data | |||
@@ -21,7 +20,8 @@ public class Sku implements Serializable { | |||
@SerializedName("quantity") | |||
private Integer quantity = 100000000; | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,15 +1,14 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 刷卡功能 | |||
* author:yuanqixun | |||
* 刷卡功能. | |||
* @author yuanqixun | |||
* date:2018-08-25 00:33 | |||
*/ | |||
@Data | |||
@@ -21,7 +20,8 @@ public class SwipeCard implements Serializable { | |||
@SerializedName("is_swipe_card") | |||
private boolean isSwipeCard; | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,15 +1,14 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 图文列表 | |||
* author:yuanqixun | |||
* 图文列表. | |||
* @author yuanqixun | |||
* date:2018-08-25 00:35 | |||
*/ | |||
@Data | |||
@@ -22,12 +21,13 @@ public class TextImageList implements Serializable { | |||
private String imageUrl; | |||
/** | |||
* 图文描述 | |||
* 图文描述. | |||
*/ | |||
@SerializedName("text") | |||
private String text; | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,16 +1,14 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
//子对象列表 | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 使用时段限制 | |||
* author:yuanqixun | |||
* 使用时段限制. | |||
* @author yuanqixun | |||
* date:2018-08-25 00:34 | |||
*/ | |||
@Data | |||
@@ -46,7 +44,8 @@ public class TimeLimit implements Serializable { | |||
@SerializedName("end_minute") | |||
private Integer endMinute; | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,16 +1,15 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
//子对象列表 | |||
/** | |||
* 使用门槛 | |||
* author:yuanqixun | |||
* @author yuanqixun | |||
* date:2018-08-25 00:35 | |||
*/ | |||
@Data | |||
@@ -46,7 +45,8 @@ public class UseCondition implements Serializable { | |||
@SerializedName("can_use_with_other_discount") | |||
private boolean canUseWithOtherDiscount; | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,13 +1,15 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
/** | |||
* . | |||
* @author yuanqixun | |||
*/ | |||
@Data | |||
public class WxMpCardCreateResult implements Serializable { | |||
private static final long serialVersionUID = -128818731449449537L; | |||
@@ -40,7 +42,7 @@ public class WxMpCardCreateResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} | |||
@@ -1,15 +1,14 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.StringUtils; | |||
import com.google.gson.JsonArray; | |||
import com.google.gson.JsonObject; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
@Data | |||
public class WxMpCardLandingPageCreateRequest implements Serializable { | |||
@@ -45,8 +44,9 @@ public class WxMpCardLandingPageCreateRequest implements Serializable { | |||
public void addCard(String cardId, String thumbUrl) { | |||
if (StringUtils.isNoneBlank(cardId, thumbUrl)) { | |||
if (cardList == null) | |||
if (cardList == null) { | |||
cardList = new JsonArray(); | |||
} | |||
JsonObject cardJson = new JsonObject(); | |||
cardJson.addProperty("card_id", cardId); | |||
cardJson.addProperty("thumb_url", thumbUrl); | |||
@@ -60,7 +60,7 @@ public class WxMpCardLandingPageCreateRequest implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} | |||
@@ -1,12 +1,10 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
@Data | |||
public class WxMpCardLandingPageCreateResult implements Serializable { | |||
@@ -33,7 +31,7 @@ public class WxMpCardLandingPageCreateResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} | |||
@@ -1,12 +1,10 @@ | |||
package me.chanjar.weixin.mp.bean.card; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
@Data | |||
public class WxMpCardQrcodeCreateResult implements Serializable { | |||
@@ -33,7 +31,7 @@ public class WxMpCardQrcodeCreateResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} | |||
@@ -1,13 +1,13 @@ | |||
package me.chanjar.weixin.mp.bean.datacube; | |||
import java.util.List; | |||
import com.google.gson.annotations.SerializedName; | |||
import com.google.gson.reflect.TypeToken; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
import java.util.List; | |||
/** | |||
* 图文分析数据接口返回结果对象 | |||
* <p> | |||
@@ -114,7 +114,7 @@ public class WxDataCubeArticleResult extends WxDataCubeBaseResult { | |||
private Integer userSource; | |||
public static List<WxDataCubeArticleResult> fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson( | |||
return WxMpGsonBuilder.create().fromJson( | |||
JSON_PARSER.parse(json).getAsJsonObject().get("list"), | |||
new TypeToken<List<WxDataCubeArticleResult>>() { | |||
}.getType()); | |||
@@ -1,13 +1,13 @@ | |||
package me.chanjar.weixin.mp.bean.datacube; | |||
import java.util.List; | |||
import com.google.gson.annotations.SerializedName; | |||
import com.google.gson.reflect.TypeToken; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
import java.util.List; | |||
/** | |||
* 图文分析数据接口返回结果对象. | |||
* Created by Binary Wang on 2016/8/24. | |||
@@ -41,7 +41,7 @@ public class WxDataCubeArticleTotal extends WxDataCubeBaseResult { | |||
private List<WxDataCubeArticleTotalDetail> details; | |||
public static List<WxDataCubeArticleTotal> fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson( | |||
return WxMpGsonBuilder.create().fromJson( | |||
JSON_PARSER.parse(json).getAsJsonObject().get("list"), | |||
new TypeToken<List<WxDataCubeArticleTotal>>() { | |||
}.getType()); | |||
@@ -2,12 +2,10 @@ package me.chanjar.weixin.mp.bean.datacube; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.JsonParser; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* <pre> | |||
@@ -31,7 +29,7 @@ public abstract class WxDataCubeBaseResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -56,7 +56,7 @@ public class WxDataCubeInterfaceResult extends WxDataCubeBaseResult { | |||
private Integer maxTimeCost; | |||
public static List<WxDataCubeInterfaceResult> fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson( | |||
return WxMpGsonBuilder.create().fromJson( | |||
JSON_PARSER.parse(json).getAsJsonObject().get("list"), | |||
new TypeToken<List<WxDataCubeInterfaceResult>>() { | |||
}.getType()); | |||
@@ -69,7 +69,7 @@ public class WxDataCubeMsgResult extends WxDataCubeBaseResult { | |||
private Integer oriPageReadUser; | |||
public static List<WxDataCubeMsgResult> fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson( | |||
return WxMpGsonBuilder.create().fromJson( | |||
JSON_PARSER.parse(json).getAsJsonObject().get("list"), | |||
new TypeToken<List<WxDataCubeMsgResult>>() { | |||
}.getType()); | |||
@@ -4,9 +4,7 @@ import java.io.Serializable; | |||
import java.util.Date; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.GsonBuilder; | |||
import com.google.gson.JsonParser; | |||
import com.google.gson.reflect.TypeToken; | |||
import lombok.Data; | |||
@@ -31,7 +29,7 @@ public class WxDataCubeUserCumulate implements Serializable { | |||
private Integer cumulateUser; | |||
public static List<WxDataCubeUserCumulate> fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson( | |||
return WxMpGsonBuilder.create().fromJson( | |||
JSON_PARSER.parse(json).getAsJsonObject().get("list"), | |||
new TypeToken<List<WxDataCubeUserCumulate>>() { | |||
}.getType()); | |||
@@ -39,6 +37,6 @@ public class WxDataCubeUserCumulate implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -4,9 +4,7 @@ import java.io.Serializable; | |||
import java.util.Date; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.GsonBuilder; | |||
import com.google.gson.JsonParser; | |||
import com.google.gson.reflect.TypeToken; | |||
import lombok.Data; | |||
@@ -33,7 +31,7 @@ public class WxDataCubeUserSummary implements Serializable { | |||
private Integer cancelUser; | |||
public static List<WxDataCubeUserSummary> fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson( | |||
return WxMpGsonBuilder.create().fromJson( | |||
JSON_PARSER.parse(json).getAsJsonObject().get("list"), | |||
new TypeToken<List<WxDataCubeUserSummary>>() { | |||
}.getType()); | |||
@@ -41,6 +39,6 @@ public class WxDataCubeUserSummary implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -1,11 +1,9 @@ | |||
package me.chanjar.weixin.mp.bean.device; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* @author keungtung. | |||
@@ -26,6 +24,6 @@ public class WxDeviceMsg extends AbstractDeviceBean { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -24,7 +24,7 @@ public class WxDeviceQrCodeResult extends AbstractDeviceBean { | |||
private BaseResp baseResp; | |||
public static WxDeviceQrCodeResult fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxDeviceQrCodeResult.class); | |||
return WxMpGsonBuilder.create().fromJson(json, WxDeviceQrCodeResult.class); | |||
} | |||
} |
@@ -117,7 +117,7 @@ public class WxMpKefuMessage implements Serializable { | |||
} | |||
public String toJson() { | |||
return WxMpGsonBuilder.INSTANCE.create().toJson(this); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
@Data | |||
@@ -43,7 +43,7 @@ public class WxMpKfAccountRequest implements Serializable { | |||
} | |||
public String toJson() { | |||
return WxMpGsonBuilder.INSTANCE.create().toJson(this); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -2,9 +2,6 @@ package me.chanjar.weixin.mp.bean.kefu.request; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@@ -32,11 +29,11 @@ public class WxMpKfSessionRequest implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return this.toJson(); | |||
} | |||
public String toJson() { | |||
return WxMpGsonBuilder.INSTANCE.create().toJson(this); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -2,12 +2,10 @@ package me.chanjar.weixin.mp.bean.kefu.result; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.annotations.Expose; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 客服基本信息以及客服在线状态信息 | |||
@@ -81,7 +79,7 @@ public class WxMpKfInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -3,9 +3,6 @@ package me.chanjar.weixin.mp.bean.kefu.result; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@@ -21,12 +18,12 @@ public class WxMpKfList implements Serializable { | |||
private List<WxMpKfInfo> kfList; | |||
public static WxMpKfList fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpKfList.class); | |||
return WxMpGsonBuilder.create().fromJson(json, WxMpKfList.class); | |||
} | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -3,9 +3,6 @@ package me.chanjar.weixin.mp.bean.kefu.result; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@@ -29,11 +26,11 @@ public class WxMpKfMsgList implements Serializable { | |||
private Long msgId; | |||
public static WxMpKfMsgList fromJson(String responseContent) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(responseContent, WxMpKfMsgList.class); | |||
return WxMpGsonBuilder.create().fromJson(responseContent, WxMpKfMsgList.class); | |||
} | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -2,11 +2,9 @@ package me.chanjar.weixin.mp.bean.kefu.result; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* | |||
@@ -49,7 +47,7 @@ public class WxMpKfMsgRecord implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
public String getWorker() { | |||
@@ -3,9 +3,7 @@ package me.chanjar.weixin.mp.bean.kefu.result; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.GsonBuilder; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@@ -21,12 +19,12 @@ public class WxMpKfOnlineList implements Serializable { | |||
private List<WxMpKfInfo> kfOnlineList; | |||
public static WxMpKfOnlineList fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpKfOnlineList.class); | |||
return WxMpGsonBuilder.create().fromJson(json, WxMpKfOnlineList.class); | |||
} | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -2,11 +2,9 @@ package me.chanjar.weixin.mp.bean.kefu.result; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* @author Binary Wang | |||
@@ -43,7 +41,7 @@ public class WxMpKfSession implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -2,9 +2,7 @@ package me.chanjar.weixin.mp.bean.kefu.result; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.GsonBuilder; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@@ -29,12 +27,12 @@ public class WxMpKfSessionGetResult implements Serializable { | |||
private long createTime; | |||
public static WxMpKfSessionGetResult fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpKfSessionGetResult.class); | |||
return WxMpGsonBuilder.create().fromJson(json, WxMpKfSessionGetResult.class); | |||
} | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -3,9 +3,6 @@ package me.chanjar.weixin.mp.bean.kefu.result; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@@ -24,13 +21,13 @@ public class WxMpKfSessionList implements Serializable { | |||
private List<WxMpKfSession> kfSessionList; | |||
public static WxMpKfSessionList fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, | |||
return WxMpGsonBuilder.create().fromJson(json, | |||
WxMpKfSessionList.class); | |||
} | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -3,9 +3,6 @@ package me.chanjar.weixin.mp.bean.kefu.result; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@@ -30,13 +27,13 @@ public class WxMpKfSessionWaitCaseList implements Serializable { | |||
private List<WxMpKfSession> kfSessionWaitCaseList; | |||
public static WxMpKfSessionWaitCaseList fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, | |||
return WxMpGsonBuilder.create().fromJson(json, | |||
WxMpKfSessionWaitCaseList.class); | |||
} | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -2,10 +2,8 @@ package me.chanjar.weixin.mp.bean.material; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* @author codepiano | |||
@@ -21,7 +19,7 @@ public class WxMpMaterialCountResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} | |||
@@ -4,10 +4,8 @@ import java.io.Serializable; | |||
import java.util.Date; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* @author codepiano | |||
@@ -22,7 +20,7 @@ public class WxMpMaterialFileBatchGetResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
@Data | |||
@@ -34,7 +32,7 @@ public class WxMpMaterialFileBatchGetResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} | |||
} |
@@ -5,9 +5,6 @@ import java.util.ArrayList; | |||
import java.util.Date; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@@ -34,7 +31,7 @@ public class WxMpMaterialNews implements Serializable { | |||
} | |||
public String toJson() { | |||
return WxMpGsonBuilder.INSTANCE.create().toJson(this); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
public boolean isEmpty() { | |||
@@ -117,7 +114,7 @@ public class WxMpMaterialNews implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} | |||
} |
@@ -4,10 +4,8 @@ import java.io.Serializable; | |||
import java.util.Date; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@Data | |||
public class WxMpMaterialNewsBatchGetResult implements Serializable { | |||
@@ -19,7 +17,7 @@ public class WxMpMaterialNewsBatchGetResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
@Data | |||
@@ -30,7 +28,7 @@ public class WxMpMaterialNewsBatchGetResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} | |||
} |
@@ -2,9 +2,6 @@ package me.chanjar.weixin.mp.bean.material; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@@ -22,7 +19,7 @@ public class WxMpMaterialUploadResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} | |||
@@ -1,13 +1,11 @@ | |||
package me.chanjar.weixin.mp.bean.membercard; | |||
import java.io.Serializable; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.bean.card.MemberCardCreateRequest; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
@Data | |||
public final class WxMpMemberCardCreateMessage implements Serializable { | |||
@@ -15,11 +13,12 @@ public final class WxMpMemberCardCreateMessage implements Serializable { | |||
@SerializedName("card") | |||
private MemberCardCreateRequest cardCreateRequest; | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
public static WxMpMemberCardCreateMessage fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpMemberCardCreateMessage.class); | |||
return WxMpGsonBuilder.create().fromJson(json, WxMpMemberCardCreateMessage.class); | |||
} | |||
} |
@@ -2,9 +2,6 @@ package me.chanjar.weixin.mp.bean.membercard; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@@ -34,10 +31,10 @@ public class WxMpMemberCardUpdateResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
public static WxMpMemberCardUpdateResult fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpMemberCardUpdateResult.class); | |||
return WxMpGsonBuilder.create().fromJson(json, WxMpMemberCardUpdateResult.class); | |||
} | |||
} |
@@ -2,9 +2,6 @@ package me.chanjar.weixin.mp.bean.membercard; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@@ -47,11 +44,11 @@ public class WxMpMemberCardUserInfoResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
public static WxMpMemberCardUserInfoResult fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpMemberCardUserInfoResult.class); | |||
return WxMpGsonBuilder.create().fromJson(json, WxMpMemberCardUserInfoResult.class); | |||
} | |||
} | |||
@@ -2,12 +2,10 @@ package me.chanjar.weixin.mp.bean.menu; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* <pre> | |||
@@ -32,7 +30,7 @@ public class WxMpGetSelfMenuInfoResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -3,14 +3,12 @@ package me.chanjar.weixin.mp.bean.menu; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.common.bean.menu.WxMenuButton; | |||
import me.chanjar.weixin.common.bean.menu.WxMenuRule; | |||
import me.chanjar.weixin.common.util.json.WxGsonBuilder; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* <pre> | |||
@@ -36,7 +34,7 @@ public class WxMpMenu implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return this.toJson(); | |||
} | |||
public String toJson() { | |||
@@ -56,7 +54,7 @@ public class WxMpMenu implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} | |||
@@ -4,11 +4,9 @@ import java.io.Serializable; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* <pre> | |||
@@ -29,7 +27,7 @@ public class WxMpSelfMenuInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
@Data | |||
@@ -89,7 +87,7 @@ public class WxMpSelfMenuInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
@Data | |||
@@ -101,7 +99,7 @@ public class WxMpSelfMenuInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} | |||
@@ -114,7 +112,7 @@ public class WxMpSelfMenuInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
@Data | |||
@@ -160,7 +158,7 @@ public class WxMpSelfMenuInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} | |||
@@ -2,13 +2,11 @@ package me.chanjar.weixin.mp.bean.message; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.thoughtworks.xstream.annotations.XStreamAlias; | |||
import com.thoughtworks.xstream.annotations.XStreamConverter; | |||
import lombok.Data; | |||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* <pre> | |||
@@ -19,7 +17,7 @@ import me.chanjar.weixin.common.util.xml.XStreamCDataConverter; | |||
*/ | |||
@XStreamAlias("HardWare") | |||
@Data | |||
public class HardWare implements Serializable{ | |||
public class HardWare implements Serializable { | |||
private static final long serialVersionUID = -1295785297354896461L; | |||
/** | |||
@@ -37,6 +35,6 @@ public class HardWare implements Serializable{ | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -2,13 +2,11 @@ package me.chanjar.weixin.mp.bean.message; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.thoughtworks.xstream.annotations.XStreamAlias; | |||
import com.thoughtworks.xstream.annotations.XStreamConverter; | |||
import lombok.Data; | |||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* <pre> | |||
@@ -38,7 +36,7 @@ public class ScanCodeInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -2,13 +2,11 @@ package me.chanjar.weixin.mp.bean.message; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.thoughtworks.xstream.annotations.XStreamAlias; | |||
import com.thoughtworks.xstream.annotations.XStreamConverter; | |||
import lombok.Data; | |||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* <pre> | |||
@@ -44,6 +42,6 @@ public class SendLocationInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -4,13 +4,11 @@ import java.io.Serializable; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.thoughtworks.xstream.annotations.XStreamAlias; | |||
import com.thoughtworks.xstream.annotations.XStreamConverter; | |||
import lombok.Data; | |||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* <pre> | |||
@@ -32,7 +30,7 @@ public class SendPicsInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
@XStreamAlias("item") | |||
@@ -46,7 +44,7 @@ public class SendPicsInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} | |||
@@ -5,8 +5,6 @@ import java.io.InputStream; | |||
import java.io.Serializable; | |||
import org.apache.commons.io.IOUtils; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.thoughtworks.xstream.annotations.XStreamAlias; | |||
import com.thoughtworks.xstream.annotations.XStreamConverter; | |||
@@ -16,6 +14,7 @@ import me.chanjar.weixin.common.api.WxConsts; | |||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter; | |||
import me.chanjar.weixin.mp.api.WxMpConfigStorage; | |||
import me.chanjar.weixin.mp.util.crypto.WxMpCryptUtil; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
import me.chanjar.weixin.mp.util.xml.XStreamTransformer; | |||
/** | |||
@@ -629,7 +628,7 @@ public class WxMpXmlMessage implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -2,11 +2,9 @@ package me.chanjar.weixin.mp.bean.result; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.bean.WxMpCard; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
/** | |||
* 卡券查询Code,核销Code接口返回结果 | |||
@@ -32,7 +30,7 @@ public class WxMpCardResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -4,9 +4,6 @@ import java.io.Serializable; | |||
import java.util.Date; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.annotations.JsonAdapter; | |||
import com.google.gson.annotations.SerializedName; | |||
import lombok.Data; | |||
@@ -28,7 +25,7 @@ public class WxMpCurrentAutoReplyInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
public static WxMpCurrentAutoReplyInfo fromJson(String json) { | |||
@@ -58,7 +55,7 @@ public class WxMpCurrentAutoReplyInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
@SerializedName("rule_name") | |||
@@ -85,7 +82,7 @@ public class WxMpCurrentAutoReplyInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
private String type; | |||
@@ -102,7 +99,7 @@ public class WxMpCurrentAutoReplyInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
private List<NewsItem> list; | |||
@@ -115,7 +112,7 @@ public class WxMpCurrentAutoReplyInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
@SerializedName("cover_url") | |||
@@ -139,7 +136,7 @@ public class WxMpCurrentAutoReplyInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
private String type; | |||
@@ -155,7 +152,7 @@ public class WxMpCurrentAutoReplyInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
private List<AutoReplyRule> list; | |||
@@ -167,7 +164,7 @@ public class WxMpCurrentAutoReplyInfo implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
private String type; | |||
@@ -2,9 +2,6 @@ package me.chanjar.weixin.mp.bean.result; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@@ -34,7 +31,7 @@ public class WxMpMassSendResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -2,9 +2,6 @@ package me.chanjar.weixin.mp.bean.result; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@@ -30,7 +27,7 @@ public class WxMpMassUploadResult implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -2,9 +2,6 @@ package me.chanjar.weixin.mp.bean.result; | |||
import java.io.Serializable; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import lombok.Data; | |||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||
@@ -37,6 +34,6 @@ public class WxMpOAuth2AccessToken implements Serializable { | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -22,11 +22,11 @@ public class WxMpQrCodeTicket implements Serializable { | |||
protected String url; | |||
public static WxMpQrCodeTicket fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpQrCodeTicket.class); | |||
return WxMpGsonBuilder.create().fromJson(json, WxMpQrCodeTicket.class); | |||
} | |||
@Override | |||
public String toString() { | |||
return WxMpGsonBuilder.INSTANCE.create().toJson(this); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |
@@ -4,9 +4,6 @@ import java.io.Serializable; | |||
import java.lang.reflect.Type; | |||
import java.util.List; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.google.gson.Gson; | |||
import com.google.gson.JsonObject; | |||
import com.google.gson.reflect.TypeToken; | |||
@@ -76,20 +73,20 @@ public class WxMpUser implements Serializable { | |||
public static WxMpUser fromJson(String json) { | |||
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpUser.class); | |||
return WxMpGsonBuilder.create().fromJson(json, WxMpUser.class); | |||
} | |||
public static List<WxMpUser> fromJsonList(String json) { | |||
Type collectionType = new TypeToken<List<WxMpUser>>() { | |||
}.getType(); | |||
Gson gson = WxMpGsonBuilder.INSTANCE.create(); | |||
Gson gson = WxMpGsonBuilder.create(); | |||
JsonObject jsonObject = gson.fromJson(json, JsonObject.class); | |||
return gson.fromJson(jsonObject.get("user_info_list"), collectionType); | |||
} | |||
@Override | |||
public String toString() { | |||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||
return WxMpGsonBuilder.create().toJson(this); | |||
} | |||
} |