mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-25 01:14:36 +08:00
使用lombok的@Data注解简化miniapp模块的所有bean类
This commit is contained in:
parent
e9ef9eb152
commit
e007a13df6
@ -1,5 +1,8 @@
|
|||||||
package cn.binarywang.wx.miniapp.bean;
|
package cn.binarywang.wx.miniapp.bean;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* lineColor 包装类
|
* lineColor 包装类
|
||||||
@ -8,36 +11,8 @@ package cn.binarywang.wx.miniapp.bean;
|
|||||||
* </pre>
|
* </pre>
|
||||||
* @author Element
|
* @author Element
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
public class WxMaCodeLineColor {
|
public class WxMaCodeLineColor {
|
||||||
private String r = "0", g = "0", b = "0";
|
private String r = "0", g = "0", b = "0";
|
||||||
|
|
||||||
public WxMaCodeLineColor(String r, String g, String b) {
|
|
||||||
this.r = r;
|
|
||||||
this.g = g;
|
|
||||||
this.b = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getR() {
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setR(String r) {
|
|
||||||
this.r = r;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getG() {
|
|
||||||
return g;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setG(String g) {
|
|
||||||
this.g = g;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getB() {
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setB(String b) {
|
|
||||||
this.b = b;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package cn.binarywang.wx.miniapp.bean;
|
|||||||
|
|
||||||
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@ -10,6 +12,8 @@ import java.io.Serializable;
|
|||||||
*
|
*
|
||||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class WxMaJscode2SessionResult implements Serializable {
|
public class WxMaJscode2SessionResult implements Serializable {
|
||||||
private static final long serialVersionUID = -1060216618475607933L;
|
private static final long serialVersionUID = -1060216618475607933L;
|
||||||
|
|
||||||
@ -29,36 +33,4 @@ public class WxMaJscode2SessionResult implements Serializable {
|
|||||||
return WxMaGsonBuilder.create().fromJson(json, WxMaJscode2SessionResult.class);
|
return WxMaGsonBuilder.create().fromJson(json, WxMaJscode2SessionResult.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSessionKey() {
|
|
||||||
return sessionKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSessionKey(String sessionKey) {
|
|
||||||
this.sessionKey = sessionKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getExpiresin() {
|
|
||||||
return expiresin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setExpiresin(Integer expiresin) {
|
|
||||||
this.expiresin = expiresin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOpenid() {
|
|
||||||
return openid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOpenid(String openid) {
|
|
||||||
this.openid = openid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnionid() {
|
|
||||||
return unionid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUnionid(String unionid) {
|
|
||||||
this.unionid = unionid;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package cn.binarywang.wx.miniapp.bean;
|
|||||||
import cn.binarywang.wx.miniapp.builder.ImageBuilder;
|
import cn.binarywang.wx.miniapp.builder.ImageBuilder;
|
||||||
import cn.binarywang.wx.miniapp.builder.TextBuilder;
|
import cn.binarywang.wx.miniapp.builder.TextBuilder;
|
||||||
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@ -11,6 +12,7 @@ import java.io.Serializable;
|
|||||||
*
|
*
|
||||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class WxMaKefuMessage implements Serializable {
|
public class WxMaKefuMessage implements Serializable {
|
||||||
private static final long serialVersionUID = -9196732086954365246L;
|
private static final long serialVersionUID = -9196732086954365246L;
|
||||||
|
|
||||||
@ -36,62 +38,6 @@ public class WxMaKefuMessage implements Serializable {
|
|||||||
return new ImageBuilder();
|
return new ImageBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToUser() {
|
|
||||||
return this.toUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setToUser(String toUser) {
|
|
||||||
this.toUser = toUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMsgType() {
|
|
||||||
return this.msgType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMsgType(String msgType) {
|
|
||||||
this.msgType = msgType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContent() {
|
|
||||||
return this.content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContent(String content) {
|
|
||||||
this.content = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMediaId() {
|
|
||||||
return this.mediaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMediaId(String mediaId) {
|
|
||||||
this.mediaId = mediaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getThumbMediaId() {
|
|
||||||
return this.thumbMediaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setThumbMediaId(String thumbMediaId) {
|
|
||||||
this.thumbMediaId = thumbMediaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return this.title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return this.description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toJson() {
|
public String toJson() {
|
||||||
return WxMaGsonBuilder.create().toJson(this);
|
return WxMaGsonBuilder.create().toJson(this);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import cn.binarywang.wx.miniapp.util.xml.XStreamTransformer;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||||
|
import lombok.Data;
|
||||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
@ -20,6 +21,7 @@ import java.nio.charset.StandardCharsets;
|
|||||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||||
*/
|
*/
|
||||||
@XStreamAlias("xml")
|
@XStreamAlias("xml")
|
||||||
|
@Data
|
||||||
public class WxMaMessage implements Serializable {
|
public class WxMaMessage implements Serializable {
|
||||||
private static final long serialVersionUID = -3586245291677274914L;
|
private static final long serialVersionUID = -3586245291677274914L;
|
||||||
|
|
||||||
@ -146,91 +148,4 @@ public class WxMaMessage implements Serializable {
|
|||||||
return WxMaGsonBuilder.create().toJson(this);
|
return WxMaGsonBuilder.create().toJson(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToUser() {
|
|
||||||
return toUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setToUser(String toUser) {
|
|
||||||
this.toUser = toUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFromUser() {
|
|
||||||
return fromUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFromUser(String fromUser) {
|
|
||||||
this.fromUser = fromUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTime(Integer createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMsgType() {
|
|
||||||
return msgType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMsgType(String msgType) {
|
|
||||||
this.msgType = msgType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContent() {
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContent(String content) {
|
|
||||||
this.content = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getMsgId() {
|
|
||||||
return msgId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMsgId(Long msgId) {
|
|
||||||
this.msgId = msgId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPicUrl() {
|
|
||||||
return picUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPicUrl(String picUrl) {
|
|
||||||
this.picUrl = picUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMediaId() {
|
|
||||||
return mediaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMediaId(String mediaId) {
|
|
||||||
this.mediaId = mediaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEvent() {
|
|
||||||
return event;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEvent(String event) {
|
|
||||||
this.event = event;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSessionFrom() {
|
|
||||||
return sessionFrom;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSessionFrom(String sessionFrom) {
|
|
||||||
this.sessionFrom = sessionFrom;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEncrypt() {
|
|
||||||
return encrypt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEncrypt(String encrypt) {
|
|
||||||
this.encrypt = encrypt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
package cn.binarywang.wx.miniapp.bean;
|
package cn.binarywang.wx.miniapp.bean;
|
||||||
|
|
||||||
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class WxMaQrcode extends AbstractWxMaQrcodeWrapper implements Serializable {
|
public class WxMaQrcode extends AbstractWxMaQrcodeWrapper implements Serializable {
|
||||||
private static final long serialVersionUID = 5777119669111011584L;
|
private static final long serialVersionUID = 5777119669111011584L;
|
||||||
private String path;
|
private String path;
|
||||||
@ -21,22 +25,6 @@ public class WxMaQrcode extends AbstractWxMaQrcodeWrapper implements Serializabl
|
|||||||
return WxMaGsonBuilder.create().fromJson(json, WxMaQrcode.class);
|
return WxMaGsonBuilder.create().fromJson(json, WxMaQrcode.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPath() {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPath(String path) {
|
|
||||||
this.path = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWidth() {
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWidth(int width) {
|
|
||||||
this.width = width;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return WxMaGsonBuilder.create().toJson(this);
|
return WxMaGsonBuilder.create().toJson(this);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package cn.binarywang.wx.miniapp.bean;
|
package cn.binarywang.wx.miniapp.bean;
|
||||||
|
|
||||||
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -11,6 +13,8 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
public class WxMaTemplateMessage implements Serializable {
|
public class WxMaTemplateMessage implements Serializable {
|
||||||
private static final long serialVersionUID = 5063374783759519418L;
|
private static final long serialVersionUID = 5063374783759519418L;
|
||||||
|
|
||||||
@ -57,7 +61,8 @@ public class WxMaTemplateMessage implements Serializable {
|
|||||||
* 描述: 模板内容,不填则下发空模板
|
* 描述: 模板内容,不填则下发空模板
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
private List<Data> data = new ArrayList<>();
|
@Builder.Default
|
||||||
|
private final List<Data> data = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@ -77,80 +82,11 @@ public class WxMaTemplateMessage implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String emphasisKeyword;
|
private String emphasisKeyword;
|
||||||
|
|
||||||
private WxMaTemplateMessage(Builder builder) {
|
|
||||||
setToUser(builder.toUser);
|
|
||||||
setTemplateId(builder.templateId);
|
|
||||||
setPage(builder.page);
|
|
||||||
setFormId(builder.formId);
|
|
||||||
setData(builder.data);
|
|
||||||
setColor(builder.color);
|
|
||||||
setEmphasisKeyword(builder.emphasisKeyword);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Builder newBuilder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toJson() {
|
public String toJson() {
|
||||||
return WxMaGsonBuilder.create().toJson(this);
|
return WxMaGsonBuilder.create().toJson(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToUser() {
|
@lombok.Data
|
||||||
return toUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setToUser(String toUser) {
|
|
||||||
this.toUser = toUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTemplateId() {
|
|
||||||
return templateId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTemplateId(String templateId) {
|
|
||||||
this.templateId = templateId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPage() {
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPage(String page) {
|
|
||||||
this.page = page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFormId() {
|
|
||||||
return formId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFormId(String formId) {
|
|
||||||
this.formId = formId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Data> getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setData(List<Data> data) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setColor(String color) {
|
|
||||||
this.color = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEmphasisKeyword() {
|
|
||||||
return emphasisKeyword;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEmphasisKeyword(String emphasisKeyword) {
|
|
||||||
this.emphasisKeyword = emphasisKeyword;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Data {
|
public static class Data {
|
||||||
private String name;
|
private String name;
|
||||||
private String value;
|
private String value;
|
||||||
@ -167,81 +103,6 @@ public class WxMaTemplateMessage implements Serializable {
|
|||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getColor() {
|
|
||||||
return this.color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setColor(String color) {
|
|
||||||
this.color = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class Builder {
|
|
||||||
private String toUser;
|
|
||||||
private String templateId;
|
|
||||||
private String page;
|
|
||||||
private String formId;
|
|
||||||
private List<Data> data;
|
|
||||||
private String color;
|
|
||||||
private String emphasisKeyword;
|
|
||||||
|
|
||||||
private Builder() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder toUser(String toUser) {
|
|
||||||
this.toUser = toUser;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder templateId(String templateId) {
|
|
||||||
this.templateId = templateId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder page(String page) {
|
|
||||||
this.page = page;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder formId(String formId) {
|
|
||||||
this.formId = formId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder data(List<Data> data) {
|
|
||||||
this.data = data;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder color(String color) {
|
|
||||||
this.color = color;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder emphasisKeyword(String emphasisKeyword) {
|
|
||||||
this.emphasisKeyword = emphasisKeyword;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WxMaTemplateMessage build() {
|
|
||||||
return new WxMaTemplateMessage(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package cn.binarywang.wx.miniapp.bean;
|
package cn.binarywang.wx.miniapp.bean;
|
||||||
|
|
||||||
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import lombok.Data;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class WxMaUserInfo implements Serializable {
|
public class WxMaUserInfo implements Serializable {
|
||||||
private static final long serialVersionUID = 6719822331555402137L;
|
private static final long serialVersionUID = 6719822331555402137L;
|
||||||
|
|
||||||
@ -27,109 +27,9 @@ public class WxMaUserInfo implements Serializable {
|
|||||||
return WxMaGsonBuilder.create().fromJson(json, WxMaUserInfo.class);
|
return WxMaGsonBuilder.create().fromJson(json, WxMaUserInfo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Data
|
||||||
public String toString() {
|
|
||||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOpenId() {
|
|
||||||
return openId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOpenId(String openId) {
|
|
||||||
this.openId = openId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNickName() {
|
|
||||||
return nickName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNickName(String nickName) {
|
|
||||||
this.nickName = nickName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGender() {
|
|
||||||
return gender;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGender(String gender) {
|
|
||||||
this.gender = gender;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguage() {
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLanguage(String language) {
|
|
||||||
this.language = language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCity() {
|
|
||||||
return city;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCity(String city) {
|
|
||||||
this.city = city;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProvince() {
|
|
||||||
return province;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProvince(String province) {
|
|
||||||
this.province = province;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCountry() {
|
|
||||||
return country;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCountry(String country) {
|
|
||||||
this.country = country;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAvatarUrl() {
|
|
||||||
return avatarUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAvatarUrl(String avatarUrl) {
|
|
||||||
this.avatarUrl = avatarUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnionId() {
|
|
||||||
return unionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUnionId(String unionId) {
|
|
||||||
this.unionId = unionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Watermark getWatermark() {
|
|
||||||
return watermark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWatermark(Watermark watermark) {
|
|
||||||
this.watermark = watermark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Watermark {
|
public static class Watermark {
|
||||||
private String timestamp;
|
private String timestamp;
|
||||||
private String appid;
|
private String appid;
|
||||||
|
|
||||||
public String getTimestamp() {
|
|
||||||
return timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTimestamp(String timestamp) {
|
|
||||||
this.timestamp = timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAppid() {
|
|
||||||
return appid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAppid(String appid) {
|
|
||||||
this.appid = appid;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package cn.binarywang.wx.miniapp.bean;
|
|||||||
|
|
||||||
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@ -10,9 +12,11 @@ import java.io.Serializable;
|
|||||||
* @author Element
|
* @author Element
|
||||||
* @date 2017/7/27
|
* @date 2017/7/27
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class WxMaWxcode extends AbstractWxMaQrcodeWrapper implements Serializable {
|
public class WxMaWxcode extends AbstractWxMaQrcodeWrapper implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1287399621649210322L;
|
private static final long serialVersionUID = 1287399621649210322L;
|
||||||
|
|
||||||
private String path;
|
private String path;
|
||||||
private int width = 430;
|
private int width = 430;
|
||||||
|
|
||||||
@ -26,40 +30,4 @@ public class WxMaWxcode extends AbstractWxMaQrcodeWrapper implements Serializabl
|
|||||||
return WxMaGsonBuilder.create().fromJson(json, WxMaWxcode.class);
|
return WxMaGsonBuilder.create().fromJson(json, WxMaWxcode.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getSerialVersionUID() {
|
|
||||||
return serialVersionUID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPath() {
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPath(String path) {
|
|
||||||
this.path = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWidth() {
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWidth(int width) {
|
|
||||||
this.width = width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAutoColor() {
|
|
||||||
return autoColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutoColor(boolean autoColor) {
|
|
||||||
this.autoColor = autoColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WxMaCodeLineColor getLineColor() {
|
|
||||||
return lineColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLineColor(WxMaCodeLineColor lineColor) {
|
|
||||||
this.lineColor = lineColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package cn.binarywang.wx.miniapp.bean;
|
|||||||
|
|
||||||
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@ -10,6 +12,8 @@ import java.io.Serializable;
|
|||||||
* @author Element
|
* @author Element
|
||||||
* @date 2017/7/27
|
* @date 2017/7/27
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class WxMaWxcodeLimit extends AbstractWxMaQrcodeWrapper implements Serializable {
|
public class WxMaWxcodeLimit extends AbstractWxMaQrcodeWrapper implements Serializable {
|
||||||
private static final long serialVersionUID = 4782193774524960401L;
|
private static final long serialVersionUID = 4782193774524960401L;
|
||||||
private String scene;
|
private String scene;
|
||||||
@ -27,43 +31,4 @@ public class WxMaWxcodeLimit extends AbstractWxMaQrcodeWrapper implements Serial
|
|||||||
return WxMaGsonBuilder.create().fromJson(json, WxMaWxcodeLimit.class);
|
return WxMaGsonBuilder.create().fromJson(json, WxMaWxcodeLimit.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPage() {
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPage(String page) {
|
|
||||||
this.page = page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getScene() {
|
|
||||||
return scene;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setScene(String scene) {
|
|
||||||
this.scene = scene;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWidth() {
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWidth(int width) {
|
|
||||||
this.width = width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAutoColor() {
|
|
||||||
return autoColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAutoColor(boolean autoColor) {
|
|
||||||
this.autoColor = autoColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WxMaCodeLineColor getLineColor() {
|
|
||||||
return lineColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLineColor(WxMaCodeLineColor lineColor) {
|
|
||||||
this.lineColor = lineColor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public class WxMaMsgServiceImplTest {
|
|||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
TestConfig config = (TestConfig) this.wxService.getWxMaConfig();
|
TestConfig config = (TestConfig) this.wxService.getWxMaConfig();
|
||||||
|
|
||||||
WxMaTemplateMessage templateMessage = WxMaTemplateMessage.newBuilder()
|
WxMaTemplateMessage templateMessage = WxMaTemplateMessage.builder()
|
||||||
.toUser(config.getOpenid())
|
.toUser(config.getOpenid())
|
||||||
.formId("FORMID")
|
.formId("FORMID")
|
||||||
.page("index")
|
.page("index")
|
||||||
|
@ -11,7 +11,7 @@ import static org.testng.AssertJUnit.assertEquals;
|
|||||||
public class WxMaTemplateMessageTest {
|
public class WxMaTemplateMessageTest {
|
||||||
@Test
|
@Test
|
||||||
public void testToJson() throws Exception {
|
public void testToJson() throws Exception {
|
||||||
WxMaTemplateMessage tm = WxMaTemplateMessage.newBuilder()
|
WxMaTemplateMessage tm = WxMaTemplateMessage.builder()
|
||||||
.toUser("OPENID")
|
.toUser("OPENID")
|
||||||
//.color("aaaaa")
|
//.color("aaaaa")
|
||||||
.formId("FORMID")
|
.formId("FORMID")
|
||||||
|
@ -94,7 +94,7 @@ public class WxMaDemoServer {
|
|||||||
public void handle(WxMaMessage wxMessage, Map<String, Object> context,
|
public void handle(WxMaMessage wxMessage, Map<String, Object> context,
|
||||||
WxMaService service, WxSessionManager sessionManager)
|
WxMaService service, WxSessionManager sessionManager)
|
||||||
throws WxErrorException {
|
throws WxErrorException {
|
||||||
service.getMsgService().sendTemplateMsg(WxMaTemplateMessage.newBuilder()
|
service.getMsgService().sendTemplateMsg(WxMaTemplateMessage.builder()
|
||||||
.templateId(templateId).data(Lists.newArrayList(
|
.templateId(templateId).data(Lists.newArrayList(
|
||||||
new WxMaTemplateMessage.Data("keyword1", "339208499", "#173177")))
|
new WxMaTemplateMessage.Data("keyword1", "339208499", "#173177")))
|
||||||
.toUser(wxMessage.getFromUser())
|
.toUser(wxMessage.getFromUser())
|
||||||
|
Loading…
Reference in New Issue
Block a user