Skip to content

Commit 4c79eec

Browse files
committed
使用lombok的@DaTa注解简化mp模块的所有bean类
1 parent 590b8c4 commit 4c79eec

File tree

96 files changed

+319
-4958
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+319
-4958
lines changed

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpCard.java

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package me.chanjar.weixin.mp.bean;
22

33

4+
import lombok.Data;
45
import me.chanjar.weixin.common.util.ToStringUtils;
56

67
import java.io.Serializable;
@@ -11,6 +12,7 @@
1112
* @author YuJian
1213
* @version 15/11/11
1314
*/
15+
@Data
1416
public class WxMpCard implements Serializable{
1517
private static final long serialVersionUID = 9214301870017772921L;
1618

@@ -24,46 +26,6 @@ public class WxMpCard implements Serializable{
2426

2527
private Boolean canConsume;
2628

27-
public String getCardId() {
28-
return this.cardId;
29-
}
30-
31-
public void setCardId(String cardId) {
32-
this.cardId = cardId;
33-
}
34-
35-
public Long getBeginTime() {
36-
return this.beginTime;
37-
}
38-
39-
public void setBeginTime(Long beginTime) {
40-
this.beginTime = beginTime;
41-
}
42-
43-
public Long getEndTime() {
44-
return this.endTime;
45-
}
46-
47-
public void setEndTime(Long endTime) {
48-
this.endTime = endTime;
49-
}
50-
51-
public String getUserCardStatus() {
52-
return this.userCardStatus;
53-
}
54-
55-
public void setUserCardStatus(String userCardStatus) {
56-
this.userCardStatus = userCardStatus;
57-
}
58-
59-
public Boolean getCanConsume() {
60-
return this.canConsume;
61-
}
62-
63-
public void setCanConsume(Boolean canConsume) {
64-
this.canConsume = canConsume;
65-
}
66-
6729
@Override
6830
public String toString() {
6931
return ToStringUtils.toSimpleString(this);

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpMassNews.java

Lines changed: 3 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package me.chanjar.weixin.mp.bean;
22

3+
import lombok.Data;
34
import me.chanjar.weixin.common.util.ToStringUtils;
45
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
56

@@ -12,15 +13,12 @@
1213
*
1314
* @author chanjarster
1415
*/
16+
@Data
1517
public class WxMpMassNews implements Serializable {
1618
private static final long serialVersionUID = 565937155013581016L;
1719

1820
private List<WxMpMassNewsArticle> articles = new ArrayList<>();
1921

20-
public List<WxMpMassNewsArticle> getArticles() {
21-
return this.articles;
22-
}
23-
2422
public void addArticle(WxMpMassNewsArticle article) {
2523
this.articles.add(article);
2624
}
@@ -52,6 +50,7 @@ public String toString() {
5250
*
5351
* @author chanjarster
5452
*/
53+
@Data
5554
public static class WxMpMassNewsArticle {
5655
/**
5756
* (必填) 图文消息缩略图的media_id,可以在基础支持-上传多媒体文件接口中获得
@@ -82,62 +81,6 @@ public static class WxMpMassNewsArticle {
8281
*/
8382
private boolean showCoverPic;
8483

85-
public String getThumbMediaId() {
86-
return this.thumbMediaId;
87-
}
88-
89-
public void setThumbMediaId(String thumbMediaId) {
90-
this.thumbMediaId = thumbMediaId;
91-
}
92-
93-
public String getAuthor() {
94-
return this.author;
95-
}
96-
97-
public void setAuthor(String author) {
98-
this.author = author;
99-
}
100-
101-
public String getTitle() {
102-
return this.title;
103-
}
104-
105-
public void setTitle(String title) {
106-
this.title = title;
107-
}
108-
109-
public String getContentSourceUrl() {
110-
return this.contentSourceUrl;
111-
}
112-
113-
public void setContentSourceUrl(String contentSourceUrl) {
114-
this.contentSourceUrl = contentSourceUrl;
115-
}
116-
117-
public String getContent() {
118-
return this.content;
119-
}
120-
121-
public void setContent(String content) {
122-
this.content = content;
123-
}
124-
125-
public String getDigest() {
126-
return this.digest;
127-
}
128-
129-
public void setDigest(String digest) {
130-
this.digest = digest;
131-
}
132-
133-
public boolean isShowCoverPic() {
134-
return this.showCoverPic;
135-
}
136-
137-
public void setShowCoverPic(boolean showCoverPic) {
138-
this.showCoverPic = showCoverPic;
139-
}
140-
14184
@Override
14285
public String toString() {
14386
return ToStringUtils.toSimpleString(this);
Lines changed: 14 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package me.chanjar.weixin.mp.bean;
22

3+
import lombok.Data;
34
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
45

56
import java.io.Serializable;
@@ -11,22 +12,14 @@
1112
*
1213
* @author chanjarster
1314
*/
15+
@Data
1416
public class WxMpMassOpenIdsMessage implements Serializable {
1517
private static final long serialVersionUID = -8022910911104788999L;
1618

19+
/**
20+
* openid列表,最多支持10,000个
21+
*/
1722
private List<String> toUsers = new ArrayList<>();
18-
private String msgType;
19-
private String content;
20-
private String mediaId;
21-
private boolean sendIgnoreReprint = false;
22-
23-
public WxMpMassOpenIdsMessage() {
24-
super();
25-
}
26-
27-
public String getMsgType() {
28-
return this.msgType;
29-
}
3023

3124
/**
3225
* <pre>
@@ -38,66 +31,28 @@ public String getMsgType() {
3831
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_VOICE}
3932
* 如果msgtype和media_id不匹配的话,会返回系统繁忙的错误
4033
* </pre>
41-
*
42-
* @param msgType
4334
*/
44-
public void setMsgType(String msgType) {
45-
this.msgType = msgType;
46-
}
47-
48-
public String getContent() {
49-
return this.content;
50-
}
51-
52-
public void setContent(String content) {
53-
this.content = content;
54-
}
55-
56-
public String getMediaId() {
57-
return this.mediaId;
58-
}
35+
private String msgType;
36+
private String content;
37+
private String mediaId;
38+
/**
39+
* 文章被判定为转载时,是否继续进行群发操作。
40+
*/
41+
private boolean sendIgnoreReprint = false;
5942

60-
public void setMediaId(String mediaId) {
61-
this.mediaId = mediaId;
43+
public WxMpMassOpenIdsMessage() {
44+
super();
6245
}
6346

6447
public String toJson() {
6548
return WxMpGsonBuilder.INSTANCE.create().toJson(this);
6649
}
6750

68-
/**
69-
* openid列表,最多支持10,000个
70-
*/
71-
public List<String> getToUsers() {
72-
return this.toUsers;
73-
}
74-
75-
/**
76-
* 提供set方法,方便客户端直接设置所有群发对象的openid列表
77-
*
78-
* @param toUsers
79-
*/
80-
public void setToUsers(List<String> toUsers) {
81-
this.toUsers = toUsers;
82-
}
83-
8451
/**
8552
* 添加openid,最多支持10,000个
86-
*
87-
* @param openid
8853
*/
8954
public void addUser(String openid) {
9055
this.toUsers.add(openid);
9156
}
9257

93-
public boolean isSendIgnoreReprint() {
94-
return sendIgnoreReprint;
95-
}
96-
97-
/**
98-
* @param sendIgnoreReprint 文章被判定为转载时,是否继续进行群发操作。
99-
*/
100-
public void setSendIgnoreReprint(boolean sendIgnoreReprint) {
101-
this.sendIgnoreReprint = sendIgnoreReprint;
102-
}
10358
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpMassPreviewMessage.java

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,22 @@
11
package me.chanjar.weixin.mp.bean;
22

3+
import lombok.Data;
34
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
45

56
import java.io.Serializable;
67

78
/**
89
* @author miller
910
*/
11+
@Data
1012
public class WxMpMassPreviewMessage implements Serializable {
1113
private static final long serialVersionUID = 9095211638358424020L;
1214

1315
private String toWxUserName;
1416
private String toWxUserOpenid;
15-
private String msgType;
16-
private String content;
17-
private String mediaId;
18-
19-
public WxMpMassPreviewMessage() {
20-
super();
21-
}
22-
23-
public String getToWxUserName() {
24-
return this.toWxUserName;
25-
}
26-
27-
public void setToWxUserName(String toWxUserName) {
28-
this.toWxUserName = toWxUserName;
29-
}
30-
31-
public String getMsgType() {
32-
return this.msgType;
33-
}
34-
3517
/**
3618
* <pre>
19+
* 消息类型
3720
* 请使用
3821
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_IMAGE}
3922
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_NEWS}
@@ -42,35 +25,13 @@ public String getMsgType() {
4225
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_VOICE}
4326
* 如果msgtype和media_id不匹配的话,会返回系统繁忙的错误
4427
* </pre>
45-
*
46-
* @param msgType 消息类型
4728
*/
48-
public void setMsgType(String msgType) {
49-
this.msgType = msgType;
50-
}
51-
52-
public String getContent() {
53-
return this.content;
54-
}
55-
56-
public void setContent(String content) {
57-
this.content = content;
58-
}
59-
60-
public String getMediaId() {
61-
return this.mediaId;
62-
}
63-
64-
public void setMediaId(String mediaId) {
65-
this.mediaId = mediaId;
66-
}
67-
68-
public String getToWxUserOpenid() {
69-
return this.toWxUserOpenid;
70-
}
29+
private String msgType;
30+
private String content;
31+
private String mediaId;
7132

72-
public void setToWxUserOpenid(String toWxUserOpenid) {
73-
this.toWxUserOpenid = toWxUserOpenid;
33+
public WxMpMassPreviewMessage() {
34+
super();
7435
}
7536

7637
public String toJson() {

0 commit comments

Comments
 (0)