mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-10-14 10:15:08 +08:00
使用lombok的@Data注解简化cp模块的所有bean类
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
package me.chanjar.weixin.cp.bean;
|
||||
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 微信部门
|
||||
* 微信部门.
|
||||
*
|
||||
* @author Daniel Qian
|
||||
*/
|
||||
@Data
|
||||
public class WxCpDepart implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5028321625140879571L;
|
||||
@@ -21,49 +23,8 @@ public class WxCpDepart implements Serializable {
|
||||
return WxCpGsonBuilder.create().fromJson(json, WxCpDepart.class);
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Integer parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Long getOrder() {
|
||||
return this.order;
|
||||
}
|
||||
|
||||
public void setOrder(Long order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxCpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WxCpDepart{" +
|
||||
"id=" + this.id +
|
||||
", name='" + this.name + '\'' +
|
||||
", parentId=" + this.parentId +
|
||||
", order=" + this.order +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package me.chanjar.weixin.cp.bean;
|
||||
|
||||
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;
|
||||
@@ -11,13 +12,14 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 消息
|
||||
* 消息.
|
||||
*
|
||||
* @author Daniel Qian
|
||||
*/
|
||||
@Data
|
||||
public class WxCpMessage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2082278303476631708L;
|
||||
|
||||
private String toUser;
|
||||
private String toParty;
|
||||
private String toTag;
|
||||
@@ -36,104 +38,61 @@ public class WxCpMessage implements Serializable {
|
||||
private List<MpnewsArticle> mpnewsArticles = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 获得文本消息builder
|
||||
* 获得文本消息builder.
|
||||
*/
|
||||
public static TextBuilder TEXT() {
|
||||
return new TextBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得文本卡片消息builder
|
||||
* 获得文本卡片消息builder.
|
||||
*/
|
||||
public static TextCardBuilder TEXTCARD() {
|
||||
return new TextCardBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得图片消息builder
|
||||
* 获得图片消息builder.
|
||||
*/
|
||||
public static ImageBuilder IMAGE() {
|
||||
return new ImageBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得语音消息builder
|
||||
* 获得语音消息builder.
|
||||
*/
|
||||
public static VoiceBuilder VOICE() {
|
||||
return new VoiceBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得视频消息builder
|
||||
* 获得视频消息builder.
|
||||
*/
|
||||
public static VideoBuilder VIDEO() {
|
||||
return new VideoBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得图文消息builder
|
||||
* 获得图文消息builder.
|
||||
*/
|
||||
public static NewsBuilder NEWS() {
|
||||
return new NewsBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得mpnews图文消息builder
|
||||
* 获得mpnews图文消息builder.
|
||||
*/
|
||||
public static MpnewsBuilder MPNEWS() {
|
||||
return new MpnewsBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得文件消息builder
|
||||
* 获得文件消息builder.
|
||||
*/
|
||||
public static FileBuilder FILE() {
|
||||
return new FileBuilder();
|
||||
}
|
||||
|
||||
public List<MpnewsArticle> getMpnewsArticles() {
|
||||
return mpnewsArticles;
|
||||
}
|
||||
|
||||
public void setMpnewsArticles(List<MpnewsArticle> mpnewsArticles) {
|
||||
this.mpnewsArticles = mpnewsArticles;
|
||||
}
|
||||
|
||||
public String getToUser() {
|
||||
return this.toUser;
|
||||
}
|
||||
|
||||
public void setToUser(String toUser) {
|
||||
this.toUser = toUser;
|
||||
}
|
||||
|
||||
public String getToParty() {
|
||||
return this.toParty;
|
||||
}
|
||||
|
||||
public void setToParty(String toParty) {
|
||||
this.toParty = toParty;
|
||||
}
|
||||
|
||||
public String getToTag() {
|
||||
return this.toTag;
|
||||
}
|
||||
|
||||
public void setToTag(String toTag) {
|
||||
this.toTag = toTag;
|
||||
}
|
||||
|
||||
public Integer getAgentId() {
|
||||
return this.agentId;
|
||||
}
|
||||
|
||||
public void setAgentId(Integer agentId) {
|
||||
this.agentId = agentId;
|
||||
}
|
||||
|
||||
public String getMsgType() {
|
||||
return this.msgType;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -153,87 +112,8 @@ public class WxCpMessage implements Serializable {
|
||||
this.msgType = msgType;
|
||||
}
|
||||
|
||||
public String getSafe() {
|
||||
return this.safe;
|
||||
}
|
||||
|
||||
public void setSafe(String safe) {
|
||||
this.safe = safe;
|
||||
}
|
||||
|
||||
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 getMusicUrl() {
|
||||
return this.musicUrl;
|
||||
}
|
||||
|
||||
public void setMusicUrl(String musicUrl) {
|
||||
this.musicUrl = musicUrl;
|
||||
}
|
||||
|
||||
public String getHqMusicUrl() {
|
||||
return this.hqMusicUrl;
|
||||
}
|
||||
|
||||
public void setHqMusicUrl(String hqMusicUrl) {
|
||||
this.hqMusicUrl = hqMusicUrl;
|
||||
}
|
||||
|
||||
public List<NewArticle> getArticles() {
|
||||
return this.articles;
|
||||
}
|
||||
|
||||
public void setArticles(List<NewArticle> articles) {
|
||||
this.articles = articles;
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxCpGsonBuilder.INSTANCE.create().toJson(this);
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
}
|
||||
|
@@ -2,21 +2,25 @@ package me.chanjar.weixin.cp.bean;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 消息发送结果对象类
|
||||
* 消息发送结果对象类.
|
||||
* Created by Binary Wang on 2017-6-22.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* </pre>
|
||||
*/
|
||||
public class WxCpMessageSendResult {
|
||||
@Data
|
||||
public class WxCpMessageSendResult implements Serializable {
|
||||
private static final long serialVersionUID = 916455987193190004L;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringUtils.toSimpleString(this);
|
||||
@@ -41,52 +45,13 @@ public class WxCpMessageSendResult {
|
||||
@SerializedName("invalidtag")
|
||||
private String invalidTag;
|
||||
|
||||
public Integer getErrCode() {
|
||||
return this.errCode;
|
||||
}
|
||||
|
||||
public void setErrCode(Integer errCode) {
|
||||
this.errCode = errCode;
|
||||
}
|
||||
|
||||
public String getErrMsg() {
|
||||
return this.errMsg;
|
||||
}
|
||||
|
||||
public void setErrMsg(String errMsg) {
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
public String getInvalidUser() {
|
||||
return this.invalidUser;
|
||||
}
|
||||
|
||||
public void setInvalidUser(String invalidUser) {
|
||||
this.invalidUser = invalidUser;
|
||||
}
|
||||
|
||||
public String getInvalidParty() {
|
||||
return this.invalidParty;
|
||||
}
|
||||
|
||||
public void setInvalidParty(String invalidParty) {
|
||||
this.invalidParty = invalidParty;
|
||||
}
|
||||
|
||||
public String getInvalidTag() {
|
||||
return this.invalidTag;
|
||||
}
|
||||
|
||||
public void setInvalidTag(String invalidTag) {
|
||||
this.invalidTag = invalidTag;
|
||||
}
|
||||
|
||||
public List<String> getInvalidUserList() {
|
||||
return this.content2List(this.invalidUser);
|
||||
}
|
||||
|
||||
private List<String> content2List(String content) {
|
||||
if(StringUtils.isBlank(content)){
|
||||
if (StringUtils.isBlank(content)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
@@ -1,50 +1,30 @@
|
||||
package me.chanjar.weixin.cp.bean;
|
||||
|
||||
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
|
||||
* Created by Daniel Qian.
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class WxCpTag implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -7243320279646928402L;
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
public WxCpTag() {
|
||||
super();
|
||||
}
|
||||
|
||||
public WxCpTag(String id, String name) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static WxCpTag fromJson(String json) {
|
||||
return WxCpGsonBuilder.create().fromJson(json, WxCpTag.class);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxCpGsonBuilder.create().toJson(this);
|
||||
}
|
||||
|
@@ -2,21 +2,25 @@ package me.chanjar.weixin.cp.bean;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 为标签添加或移除用户结果对象类
|
||||
* 为标签添加或移除用户结果对象类.
|
||||
* Created by Binary Wang on 2017-6-22.
|
||||
*
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
* </pre>
|
||||
*/
|
||||
public class WxCpTagAddOrRemoveUsersResult {
|
||||
@Data
|
||||
public class WxCpTagAddOrRemoveUsersResult implements Serializable {
|
||||
private static final long serialVersionUID = 1420065684270213578L;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringUtils.toSimpleString(this);
|
||||
@@ -38,44 +42,12 @@ public class WxCpTagAddOrRemoveUsersResult {
|
||||
@SerializedName("invalidparty")
|
||||
private String[] invalidParty;
|
||||
|
||||
public Integer getErrCode() {
|
||||
return this.errCode;
|
||||
}
|
||||
|
||||
public void setErrCode(Integer errCode) {
|
||||
this.errCode = errCode;
|
||||
}
|
||||
|
||||
public String getErrMsg() {
|
||||
return this.errMsg;
|
||||
}
|
||||
|
||||
public void setErrMsg(String errMsg) {
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
public String getInvalidUser() {
|
||||
return this.invalidUsers;
|
||||
}
|
||||
|
||||
public void setInvalidUser(String invalidUser) {
|
||||
this.invalidUsers = invalidUser;
|
||||
}
|
||||
|
||||
public String[] getInvalidParty() {
|
||||
return this.invalidParty;
|
||||
}
|
||||
|
||||
public void setInvalidParty(String[] invalidParty) {
|
||||
this.invalidParty = invalidParty;
|
||||
}
|
||||
|
||||
public List<String> getInvalidUserList() {
|
||||
return this.content2List(this.invalidUsers);
|
||||
}
|
||||
|
||||
private List<String> content2List(String content) {
|
||||
if(StringUtils.isBlank(content)){
|
||||
if (StringUtils.isBlank(content)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package me.chanjar.weixin.cp.bean;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -7,12 +9,12 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微信用户信息
|
||||
* 微信用户信息.
|
||||
*
|
||||
* @author Daniel Qian
|
||||
*/
|
||||
@Data
|
||||
public class WxCpUser implements Serializable {
|
||||
|
||||
public enum Gender {
|
||||
MALE("男", "1"),
|
||||
FEMAIL("女", "2");
|
||||
@@ -62,159 +64,23 @@ public class WxCpUser implements Serializable {
|
||||
private String englishName;
|
||||
private String telephone;
|
||||
|
||||
public static WxCpUser fromJson(String json) {
|
||||
return WxCpGsonBuilder.INSTANCE.create().fromJson(json, WxCpUser.class);
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer[] getDepartIds() {
|
||||
return this.departIds;
|
||||
}
|
||||
|
||||
public void setDepartIds(Integer[] departIds) {
|
||||
this.departIds = departIds;
|
||||
}
|
||||
|
||||
public Gender getGender() {
|
||||
return this.gender;
|
||||
}
|
||||
|
||||
public void setGender(Gender gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getPosition() {
|
||||
return this.position;
|
||||
}
|
||||
|
||||
public void setPosition(String position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public String getMobile() {
|
||||
return this.mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public String getTelephone() {
|
||||
return this.telephone;
|
||||
}
|
||||
|
||||
public void setTelephone(String telephone) {
|
||||
this.telephone = telephone;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return this.email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return this.avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getEnable() {
|
||||
return this.enable;
|
||||
}
|
||||
|
||||
public void setEnable(Integer enable) {
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
public void addExtAttr(String name, String value) {
|
||||
this.extAttrs.add(new Attr(name, value));
|
||||
}
|
||||
|
||||
public List<Attr> getExtAttrs() {
|
||||
return this.extAttrs;
|
||||
}
|
||||
|
||||
public Integer getIsLeader() {
|
||||
return isLeader;
|
||||
}
|
||||
|
||||
public void setIsLeader(Integer isLeader) {
|
||||
this.isLeader = isLeader;
|
||||
}
|
||||
|
||||
public Integer getHideMobile() {
|
||||
return hideMobile;
|
||||
}
|
||||
|
||||
public void setHideMobile(Integer hideMobile) {
|
||||
this.hideMobile = hideMobile;
|
||||
}
|
||||
|
||||
public String getEnglishName() {
|
||||
return englishName;
|
||||
}
|
||||
|
||||
public void setEnglishName(String englishName) {
|
||||
this.englishName = englishName;
|
||||
public static WxCpUser fromJson(String json) {
|
||||
return WxCpGsonBuilder.INSTANCE.create().fromJson(json, WxCpUser.class);
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
return WxCpGsonBuilder.INSTANCE.create().toJson(this);
|
||||
}
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class Attr {
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
public Attr(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package me.chanjar.weixin.cp.bean;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.util.ToStringUtils;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
||||
@@ -28,6 +29,7 @@ import java.util.List;
|
||||
* @author Daniel Qian
|
||||
*/
|
||||
@XStreamAlias("xml")
|
||||
@Data
|
||||
public class WxCpXmlMessage implements Serializable {
|
||||
private static final long serialVersionUID = -1042994982179476410L;
|
||||
|
||||
@@ -130,28 +132,29 @@ public class WxCpXmlMessage implements Serializable {
|
||||
// 群发消息返回的结果
|
||||
///////////////////////////////////////
|
||||
/**
|
||||
* 群发的结果
|
||||
* 群发的结果.
|
||||
*/
|
||||
@XStreamAlias("Status")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String status;
|
||||
/**
|
||||
* group_id下粉丝数;或者openid_list中的粉丝数
|
||||
* group_id下粉丝数;或者openid_list中的粉丝数.
|
||||
*/
|
||||
@XStreamAlias("TotalCount")
|
||||
private Integer totalCount;
|
||||
/**
|
||||
* 过滤(过滤是指特定地区、性别的过滤、用户设置拒收的过滤,用户接收已超4条的过滤)后,准备发送的粉丝数,原则上,filterCount = sentCount + errorCount
|
||||
* 过滤.
|
||||
* (过滤是指特定地区、性别的过滤、用户设置拒收的过滤,用户接收已超4条的过滤)后,准备发送的粉丝数,原则上,filterCount = sentCount + errorCount
|
||||
*/
|
||||
@XStreamAlias("FilterCount")
|
||||
private Integer filterCount;
|
||||
/**
|
||||
* 发送成功的粉丝数
|
||||
* 发送成功的粉丝数.
|
||||
*/
|
||||
@XStreamAlias("SentCount")
|
||||
private Integer sentCount;
|
||||
/**
|
||||
* 发送失败的粉丝数
|
||||
* 发送失败的粉丝数.
|
||||
*/
|
||||
@XStreamAlias("ErrorCount")
|
||||
private Integer errorCount;
|
||||
@@ -176,7 +179,7 @@ public class WxCpXmlMessage implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* 从加密字符串转换
|
||||
* 从加密字符串转换.
|
||||
*/
|
||||
public static WxCpXmlMessage fromEncryptedXml(
|
||||
String encryptedXml,
|
||||
@@ -198,30 +201,6 @@ public class WxCpXmlMessage implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getAgentId() {
|
||||
return this.agentId;
|
||||
}
|
||||
|
||||
public void setAgentId(Integer agentId) {
|
||||
this.agentId = agentId;
|
||||
}
|
||||
|
||||
public String getToUserName() {
|
||||
return this.toUserName;
|
||||
}
|
||||
|
||||
public void setToUserName(String toUserName) {
|
||||
this.toUserName = toUserName;
|
||||
}
|
||||
|
||||
public Long getCreateTime() {
|
||||
return this.createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 当接受用户消息时,可能会获得以下值:
|
||||
@@ -247,322 +226,54 @@ public class WxCpXmlMessage implements Serializable {
|
||||
* {@link WxConsts.XmlMsgType#VIDEO}
|
||||
* {@link WxConsts.XmlMsgType#NEWS}
|
||||
* </pre>
|
||||
*
|
||||
* @param msgType
|
||||
*/
|
||||
public void setMsgType(String msgType) {
|
||||
this.msgType = msgType;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Long getMsgId() {
|
||||
return this.msgId;
|
||||
}
|
||||
|
||||
public void setMsgId(Long msgId) {
|
||||
this.msgId = msgId;
|
||||
}
|
||||
|
||||
public String getPicUrl() {
|
||||
return this.picUrl;
|
||||
}
|
||||
|
||||
public void setPicUrl(String picUrl) {
|
||||
this.picUrl = picUrl;
|
||||
}
|
||||
|
||||
public String getMediaId() {
|
||||
return this.mediaId;
|
||||
}
|
||||
|
||||
public void setMediaId(String mediaId) {
|
||||
this.mediaId = mediaId;
|
||||
}
|
||||
|
||||
public String getFormat() {
|
||||
return this.format;
|
||||
}
|
||||
|
||||
public void setFormat(String format) {
|
||||
this.format = format;
|
||||
}
|
||||
|
||||
public String getThumbMediaId() {
|
||||
return this.thumbMediaId;
|
||||
}
|
||||
|
||||
public void setThumbMediaId(String thumbMediaId) {
|
||||
this.thumbMediaId = thumbMediaId;
|
||||
}
|
||||
|
||||
public Double getLocationX() {
|
||||
return this.locationX;
|
||||
}
|
||||
|
||||
public void setLocationX(Double locationX) {
|
||||
this.locationX = locationX;
|
||||
}
|
||||
|
||||
public Double getLocationY() {
|
||||
return this.locationY;
|
||||
}
|
||||
|
||||
public void setLocationY(Double locationY) {
|
||||
this.locationY = locationY;
|
||||
}
|
||||
|
||||
public Double getScale() {
|
||||
return this.scale;
|
||||
}
|
||||
|
||||
public void setScale(Double scale) {
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return this.label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
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 getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getEvent() {
|
||||
return this.event;
|
||||
}
|
||||
|
||||
public void setEvent(String event) {
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
public String getEventKey() {
|
||||
return this.eventKey;
|
||||
}
|
||||
|
||||
public void setEventKey(String eventKey) {
|
||||
this.eventKey = eventKey;
|
||||
}
|
||||
|
||||
public String getTicket() {
|
||||
return this.ticket;
|
||||
}
|
||||
|
||||
public void setTicket(String ticket) {
|
||||
this.ticket = ticket;
|
||||
}
|
||||
|
||||
public Double getLatitude() {
|
||||
return this.latitude;
|
||||
}
|
||||
|
||||
public void setLatitude(Double latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public Double getLongitude() {
|
||||
return this.longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(Double longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public Double getPrecision() {
|
||||
return this.precision;
|
||||
}
|
||||
|
||||
public void setPrecision(Double precision) {
|
||||
this.precision = precision;
|
||||
}
|
||||
|
||||
public String getRecognition() {
|
||||
return this.recognition;
|
||||
}
|
||||
|
||||
public void setRecognition(String recognition) {
|
||||
this.recognition = recognition;
|
||||
}
|
||||
|
||||
public String getFromUserName() {
|
||||
return this.fromUserName;
|
||||
}
|
||||
|
||||
public void setFromUserName(String fromUserName) {
|
||||
this.fromUserName = fromUserName;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getTotalCount() {
|
||||
return this.totalCount;
|
||||
}
|
||||
|
||||
public void setTotalCount(Integer totalCount) {
|
||||
this.totalCount = totalCount;
|
||||
}
|
||||
|
||||
public Integer getFilterCount() {
|
||||
return this.filterCount;
|
||||
}
|
||||
|
||||
public void setFilterCount(Integer filterCount) {
|
||||
this.filterCount = filterCount;
|
||||
}
|
||||
|
||||
public Integer getSentCount() {
|
||||
return this.sentCount;
|
||||
}
|
||||
|
||||
public void setSentCount(Integer sentCount) {
|
||||
this.sentCount = sentCount;
|
||||
}
|
||||
|
||||
public Integer getErrorCount() {
|
||||
return this.errorCount;
|
||||
}
|
||||
|
||||
public void setErrorCount(Integer errorCount) {
|
||||
this.errorCount = errorCount;
|
||||
}
|
||||
|
||||
public WxCpXmlMessage.ScanCodeInfo getScanCodeInfo() {
|
||||
return this.scanCodeInfo;
|
||||
}
|
||||
|
||||
public void setScanCodeInfo(WxCpXmlMessage.ScanCodeInfo scanCodeInfo) {
|
||||
this.scanCodeInfo = scanCodeInfo;
|
||||
}
|
||||
|
||||
public WxCpXmlMessage.SendPicsInfo getSendPicsInfo() {
|
||||
return this.sendPicsInfo;
|
||||
}
|
||||
|
||||
public void setSendPicsInfo(WxCpXmlMessage.SendPicsInfo sendPicsInfo) {
|
||||
this.sendPicsInfo = sendPicsInfo;
|
||||
}
|
||||
|
||||
public WxCpXmlMessage.SendLocationInfo getSendLocationInfo() {
|
||||
return this.sendLocationInfo;
|
||||
}
|
||||
|
||||
public void setSendLocationInfo(WxCpXmlMessage.SendLocationInfo sendLocationInfo) {
|
||||
this.sendLocationInfo = sendLocationInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringUtils.toSimpleString(this);
|
||||
}
|
||||
|
||||
@Data
|
||||
@XStreamAlias("ScanCodeInfo")
|
||||
public static class ScanCodeInfo {
|
||||
|
||||
/**
|
||||
* 扫描类型,一般是qrcode.
|
||||
*/
|
||||
@XStreamAlias("ScanType")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String scanType;
|
||||
|
||||
/**
|
||||
* 扫描结果,即二维码对应的字符串信息.
|
||||
*/
|
||||
@XStreamAlias("ScanResult")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String scanResult;
|
||||
|
||||
/**
|
||||
* 扫描类型,一般是qrcode
|
||||
*/
|
||||
public String getScanType() {
|
||||
|
||||
return this.scanType;
|
||||
}
|
||||
|
||||
public void setScanType(String scanType) {
|
||||
this.scanType = scanType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫描结果,即二维码对应的字符串信息
|
||||
*/
|
||||
public String getScanResult() {
|
||||
return this.scanResult;
|
||||
}
|
||||
|
||||
public void setScanResult(String scanResult) {
|
||||
this.scanResult = scanResult;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@XStreamAlias("SendPicsInfo")
|
||||
public static class SendPicsInfo {
|
||||
@XStreamAlias("PicList")
|
||||
protected final List<Item> picList = new ArrayList<>();
|
||||
|
||||
@XStreamAlias("Count")
|
||||
private Long count;
|
||||
|
||||
public Long getCount() {
|
||||
return this.count;
|
||||
}
|
||||
|
||||
public void setCount(Long count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public List<Item> getPicList() {
|
||||
return this.picList;
|
||||
}
|
||||
|
||||
@XStreamAlias("item")
|
||||
@Data
|
||||
public static class Item {
|
||||
|
||||
@XStreamAlias("PicMd5Sum")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String PicMd5Sum;
|
||||
|
||||
public String getPicMd5Sum() {
|
||||
return this.PicMd5Sum;
|
||||
}
|
||||
|
||||
public void setPicMd5Sum(String picMd5Sum) {
|
||||
this.PicMd5Sum = picMd5Sum;
|
||||
}
|
||||
private String picMd5Sum;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
@XStreamAlias("SendLocationInfo")
|
||||
public static class SendLocationInfo {
|
||||
|
||||
@@ -584,47 +295,8 @@ public class WxCpXmlMessage implements Serializable {
|
||||
|
||||
@XStreamAlias("Poiname")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String poiname;
|
||||
private String poiName;
|
||||
|
||||
public String getLocationX() {
|
||||
return this.locationX;
|
||||
}
|
||||
|
||||
public void setLocationX(String locationX) {
|
||||
this.locationX = locationX;
|
||||
}
|
||||
|
||||
public String getLocationY() {
|
||||
return this.locationY;
|
||||
}
|
||||
|
||||
public void setLocationY(String locationY) {
|
||||
this.locationY = locationY;
|
||||
}
|
||||
|
||||
public String getScale() {
|
||||
return this.scale;
|
||||
}
|
||||
|
||||
public void setScale(String scale) {
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return this.label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getPoiname() {
|
||||
return this.poiname;
|
||||
}
|
||||
|
||||
public void setPoiname(String poiname) {
|
||||
this.poiname = poiname;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,10 +2,12 @@ package me.chanjar.weixin.cp.bean;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamMediaIdConverter;
|
||||
|
||||
@XStreamAlias("xml")
|
||||
@Data
|
||||
public class WxCpXmlOutImageMessage extends WxCpXmlOutMessage {
|
||||
private static final long serialVersionUID = -1099446240667237313L;
|
||||
|
||||
@@ -17,12 +19,4 @@ public class WxCpXmlOutImageMessage extends WxCpXmlOutMessage {
|
||||
this.msgType = WxConsts.XmlMsgType.IMAGE;
|
||||
}
|
||||
|
||||
public String getMediaId() {
|
||||
return this.mediaId;
|
||||
}
|
||||
|
||||
public void setMediaId(String mediaId) {
|
||||
this.mediaId = mediaId;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package me.chanjar.weixin.cp.bean;
|
||||
|
||||
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.cp.config.WxCpConfigStorage;
|
||||
import me.chanjar.weixin.cp.bean.outxmlbuilder.*;
|
||||
@@ -11,8 +12,8 @@ import me.chanjar.weixin.cp.util.xml.XStreamTransformer;
|
||||
import java.io.Serializable;
|
||||
|
||||
@XStreamAlias("xml")
|
||||
@Data
|
||||
public abstract class WxCpXmlOutMessage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1418629839964153110L;
|
||||
|
||||
@XStreamAlias("ToUserName")
|
||||
@@ -31,78 +32,46 @@ public abstract class WxCpXmlOutMessage implements Serializable {
|
||||
protected String msgType;
|
||||
|
||||
/**
|
||||
* 获得文本消息builder
|
||||
* 获得文本消息builder.
|
||||
*/
|
||||
public static TextBuilder TEXT() {
|
||||
return new TextBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得图片消息builder
|
||||
* 获得图片消息builder.
|
||||
*/
|
||||
public static ImageBuilder IMAGE() {
|
||||
return new ImageBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得语音消息builder
|
||||
* 获得语音消息builder.
|
||||
*/
|
||||
public static VoiceBuilder VOICE() {
|
||||
return new VoiceBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得视频消息builder
|
||||
* 获得视频消息builder.
|
||||
*/
|
||||
public static VideoBuilder VIDEO() {
|
||||
return new VideoBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得图文消息builder
|
||||
* 获得图文消息builder.
|
||||
*/
|
||||
public static NewsBuilder NEWS() {
|
||||
return new NewsBuilder();
|
||||
}
|
||||
|
||||
public String getToUserName() {
|
||||
return this.toUserName;
|
||||
}
|
||||
|
||||
public void setToUserName(String toUserName) {
|
||||
this.toUserName = toUserName;
|
||||
}
|
||||
|
||||
public String getFromUserName() {
|
||||
return this.fromUserName;
|
||||
}
|
||||
|
||||
public void setFromUserName(String fromUserName) {
|
||||
this.fromUserName = fromUserName;
|
||||
}
|
||||
|
||||
public Long getCreateTime() {
|
||||
return this.createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getMsgType() {
|
||||
return this.msgType;
|
||||
}
|
||||
|
||||
public void setMsgType(String msgType) {
|
||||
this.msgType = msgType;
|
||||
}
|
||||
|
||||
protected String toXml() {
|
||||
return XStreamTransformer.toXml((Class) this.getClass(), this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换成加密的xml格式
|
||||
* 转换成加密的xml格式.
|
||||
*/
|
||||
public String toEncryptedXml(WxCpConfigStorage wxCpConfigStorage) {
|
||||
String plainXml = toXml();
|
||||
|
@@ -2,6 +2,7 @@ package me.chanjar.weixin.cp.bean;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
||||
|
||||
@@ -9,11 +10,13 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@XStreamAlias("xml")
|
||||
@Data
|
||||
public class WxCpXmlOutNewsMessage extends WxCpXmlOutMessage {
|
||||
private static final long serialVersionUID = -5796178637883178826L;
|
||||
|
||||
@XStreamAlias("Articles")
|
||||
protected final List<Item> articles = new ArrayList<>();
|
||||
|
||||
@XStreamAlias("ArticleCount")
|
||||
protected int articleCount;
|
||||
|
||||
@@ -21,72 +24,32 @@ public class WxCpXmlOutNewsMessage extends WxCpXmlOutMessage {
|
||||
this.msgType = WxConsts.XmlMsgType.NEWS;
|
||||
}
|
||||
|
||||
public int getArticleCount() {
|
||||
return this.articleCount;
|
||||
}
|
||||
|
||||
public void addArticle(Item item) {
|
||||
this.articles.add(item);
|
||||
this.articleCount = this.articles.size();
|
||||
}
|
||||
|
||||
public List<Item> getArticles() {
|
||||
return this.articles;
|
||||
}
|
||||
|
||||
|
||||
@XStreamAlias("item")
|
||||
@Data
|
||||
public static class Item {
|
||||
|
||||
@XStreamAlias("Title")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String Title;
|
||||
private String title;
|
||||
|
||||
@XStreamAlias("Description")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String Description;
|
||||
private String description;
|
||||
|
||||
@XStreamAlias("PicUrl")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String PicUrl;
|
||||
private String picUrl;
|
||||
|
||||
@XStreamAlias("Url")
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String Url;
|
||||
|
||||
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 getPicUrl() {
|
||||
return this.PicUrl;
|
||||
}
|
||||
|
||||
public void setPicUrl(String picUrl) {
|
||||
this.PicUrl = picUrl;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return this.Url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.Url = url;
|
||||
}
|
||||
private String url;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -2,10 +2,12 @@ package me.chanjar.weixin.cp.bean;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
||||
|
||||
@XStreamAlias("xml")
|
||||
@Data
|
||||
public class WxCpXmlOutTextMessage extends WxCpXmlOutMessage {
|
||||
private static final long serialVersionUID = 2569239617185930232L;
|
||||
|
||||
@@ -17,13 +19,4 @@ public class WxCpXmlOutTextMessage extends WxCpXmlOutMessage {
|
||||
this.msgType = WxConsts.XmlMsgType.TEXT;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -2,10 +2,12 @@ package me.chanjar.weixin.cp.bean;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
||||
|
||||
@XStreamAlias("xml")
|
||||
@Data
|
||||
public class WxCpXmlOutVideoMessage extends WxCpXmlOutMessage {
|
||||
private static final long serialVersionUID = -8672761162722733622L;
|
||||
|
||||
@@ -40,7 +42,7 @@ public class WxCpXmlOutVideoMessage extends WxCpXmlOutMessage {
|
||||
this.video.setDescription(description);
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@XStreamAlias("Video")
|
||||
public static class Video {
|
||||
|
||||
@@ -56,30 +58,6 @@ public class WxCpXmlOutVideoMessage extends WxCpXmlOutMessage {
|
||||
@XStreamConverter(value = XStreamCDataConverter.class)
|
||||
private String description;
|
||||
|
||||
public String getMediaId() {
|
||||
return this.mediaId;
|
||||
}
|
||||
|
||||
public void setMediaId(String mediaId) {
|
||||
this.mediaId = mediaId;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,10 +2,12 @@ package me.chanjar.weixin.cp.bean;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamMediaIdConverter;
|
||||
|
||||
@XStreamAlias("xml")
|
||||
@Data
|
||||
public class WxCpXmlOutVoiceMessage extends WxCpXmlOutMessage {
|
||||
private static final long serialVersionUID = -7947384031546099340L;
|
||||
|
||||
@@ -17,12 +19,4 @@ public class WxCpXmlOutVoiceMessage extends WxCpXmlOutMessage {
|
||||
this.msgType = WxConsts.XmlMsgType.VOICE;
|
||||
}
|
||||
|
||||
public String getMediaId() {
|
||||
return this.mediaId;
|
||||
}
|
||||
|
||||
public void setMediaId(String mediaId) {
|
||||
this.mediaId = mediaId;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,8 @@
|
||||
package me.chanjar.weixin.cp.bean.article;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -9,6 +12,8 @@ import java.io.Serializable;
|
||||
*
|
||||
* @author Binary Wang
|
||||
*/
|
||||
@Data
|
||||
@Builder(builderMethodName = "newBuilder")
|
||||
public class MpnewsArticle implements Serializable {
|
||||
private static final long serialVersionUID = 6985871812170756481L;
|
||||
|
||||
@@ -20,125 +25,4 @@ public class MpnewsArticle implements Serializable {
|
||||
private String digest;
|
||||
private String showCoverPic;
|
||||
|
||||
private MpnewsArticle(Builder builder) {
|
||||
setTitle(builder.title);
|
||||
setThumbMediaId(builder.thumbMediaId);
|
||||
setAuthor(builder.author);
|
||||
setContentSourceUrl(builder.contentSourceUrl);
|
||||
setContent(builder.content);
|
||||
setDigest(builder.digest);
|
||||
setShowCoverPic(builder.showCoverPic);
|
||||
}
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getThumbMediaId() {
|
||||
return thumbMediaId;
|
||||
}
|
||||
|
||||
public void setThumbMediaId(String thumbMediaId) {
|
||||
this.thumbMediaId = thumbMediaId;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
public void setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public String getContentSourceUrl() {
|
||||
return contentSourceUrl;
|
||||
}
|
||||
|
||||
public void setContentSourceUrl(String contentSourceUrl) {
|
||||
this.contentSourceUrl = contentSourceUrl;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getDigest() {
|
||||
return digest;
|
||||
}
|
||||
|
||||
public void setDigest(String digest) {
|
||||
this.digest = digest;
|
||||
}
|
||||
|
||||
public String getShowCoverPic() {
|
||||
return showCoverPic;
|
||||
}
|
||||
|
||||
public void setShowCoverPic(String showCoverPic) {
|
||||
this.showCoverPic = showCoverPic;
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
private String title;
|
||||
private String thumbMediaId;
|
||||
private String author;
|
||||
private String contentSourceUrl;
|
||||
private String content;
|
||||
private String digest;
|
||||
private String showCoverPic;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder title(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder thumbMediaId(String thumbMediaId) {
|
||||
this.thumbMediaId = thumbMediaId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder author(String author) {
|
||||
this.author = author;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder contentSourceUrl(String contentSourceUrl) {
|
||||
this.contentSourceUrl = contentSourceUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder content(String content) {
|
||||
this.content = content;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder digest(String digest) {
|
||||
this.digest = digest;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder showCoverPic(String showCoverPic) {
|
||||
this.showCoverPic = showCoverPic;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MpnewsArticle build() {
|
||||
return new MpnewsArticle(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package me.chanjar.weixin.cp.bean.article;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -9,6 +11,7 @@ import java.io.Serializable;
|
||||
*
|
||||
* @author Binary Wang
|
||||
*/
|
||||
@Data
|
||||
public class NewArticle implements Serializable {
|
||||
private static final long serialVersionUID = 4087852055781140659L;
|
||||
|
||||
@@ -17,36 +20,4 @@ public class NewArticle implements Serializable {
|
||||
private String url;
|
||||
private String picUrl;
|
||||
|
||||
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 getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getPicUrl() {
|
||||
return this.picUrl;
|
||||
}
|
||||
|
||||
public void setPicUrl(String picUrl) {
|
||||
this.picUrl = picUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -86,7 +86,7 @@ public class WxCpXmlMessageTest {
|
||||
assertEquals(wxMessage.getSendLocationInfo().getLocationY(), "113");
|
||||
assertEquals(wxMessage.getSendLocationInfo().getScale(), "15");
|
||||
assertEquals(wxMessage.getSendLocationInfo().getLabel(), " 广州市海珠区客村艺苑路 106号");
|
||||
assertEquals(wxMessage.getSendLocationInfo().getPoiname(), "wo de poi");
|
||||
assertEquals(wxMessage.getSendLocationInfo().getPoiName(), "wo de poi");
|
||||
}
|
||||
|
||||
public void testSendPicsInfo() {
|
||||
|
Reference in New Issue
Block a user