View Javadoc
1   package com.foxinmy.weixin4j.mp.model;
2   
3   import java.io.Serializable;
4   import java.util.Date;
5   import java.util.List;
6   
7   import com.alibaba.fastjson.annotation.JSONField;
8   import com.foxinmy.weixin4j.mp.type.AutomatchMode;
9   import com.foxinmy.weixin4j.mp.type.AutoreplyMode;
10  import com.foxinmy.weixin4j.type.ButtonType;
11  
12  /**
13   * 自动回复设置
14   *
15   * @className AutoReplySetting
16   * @author jinyu(foxinmy@gmail.com)
17   * @date 2015年4月15日
18   * @since JDK 1.6
19   * @see
20   */
21  public class AutoReplySetting implements Serializable {
22  
23  	private static final long serialVersionUID = 8164017927864497009L;
24  
25  	/**
26  	 * 关注后自动回复是否开启
27  	 */
28  	@JSONField(name = "is_add_friend_reply_open")
29  	private boolean isAddFriendReplyOpen;
30  	/**
31  	 * 消息自动回复是否开启
32  	 */
33  	@JSONField(name = "is_autoreply_open")
34  	private boolean isAutoreplyOpen;
35  
36  	/**
37  	 * 关注后自动回复的信息
38  	 *
39  	 * @see com.foxinmy.weixin4j.mp.model.AutoReplySetting.Entry
40  	 */
41  	@JSONField(name = "add_friend_autoreply_info")
42  	private Entry addFriendReply;
43  
44  	/**
45  	 * 默认自动回复的信息
46  	 *
47  	 * @see com.foxinmy.weixin4j.mp.model.AutoReplySetting.Entry
48  	 */
49  	@JSONField(name = "message_default_autoreply_info")
50  	private Entry defaultReply;
51  
52  	/**
53  	 * 关键词自动回复的信息
54  	 *
55  	 * @see com.foxinmy.weixin4j.mp.model.AutoReplySetting.Rule
56  	 */
57  	private List<Rule> keywordReplyList;
58  
59  	public boolean isAddFriendReplyOpen() {
60  		return isAddFriendReplyOpen;
61  	}
62  
63  	public void setAddFriendReplyOpen(boolean isAddFriendReplyOpen) {
64  		this.isAddFriendReplyOpen = isAddFriendReplyOpen;
65  	}
66  
67  	public boolean isAutoreplyOpen() {
68  		return isAutoreplyOpen;
69  	}
70  
71  	public void setAutoreplyOpen(boolean isAutoreplyOpen) {
72  		this.isAutoreplyOpen = isAutoreplyOpen;
73  	}
74  
75  	public Entry getAddFriendReply() {
76  		return addFriendReply;
77  	}
78  
79  	public void setAddFriendReply(Entry addFriendReply) {
80  		this.addFriendReply = addFriendReply;
81  	}
82  
83  	public Entry getDefaultReply() {
84  		return defaultReply;
85  	}
86  
87  	public void setDefaultReply(Entry defaultReply) {
88  		this.defaultReply = defaultReply;
89  	}
90  
91  	public List<Rule> getKeywordReplyList() {
92  		return keywordReplyList;
93  	}
94  
95  	public void setKeywordReplyList(List<Rule> keywordReplyList) {
96  		this.keywordReplyList = keywordReplyList;
97  	}
98  
99  	@Override
100 	public String toString() {
101 		return "AutoReplySetting [isAddFriendReplyOpen=" + isAddFriendReplyOpen
102 				+ ", isAutoreplyOpen=" + isAutoreplyOpen + ", addFriendReply="
103 				+ addFriendReply + ", defaultReply=" + defaultReply
104 				+ ", keywordReplyList=" + keywordReplyList + "]";
105 	}
106 
107 	/**
108 	 * 关键字规则
109 	 *
110 	 * @className Rule
111 	 * @author jinyu(foxinmy@gmail.com)
112 	 * @date 2015年4月15日
113 	 * @since JDK 1.6
114 	 * @see
115 	 */
116 	public static class Rule implements Serializable {
117 
118 		private static final long serialVersionUID = -7299903545861946025L;
119 		/**
120 		 * 规则名称
121 		 */
122 		@JSONField(name = "rule_name")
123 		private String ruleName;
124 		/**
125 		 * 创建时间
126 		 */
127 		@JSONField(name = "create_time")
128 		private Date createTime;
129 		/**
130 		 * 回复模式
131 		 *
132 		 * @see com.foxinmy.weixin4j.mp.type.AutoreplyMode
133 		 */
134 		@JSONField(name = "reply_mode")
135 		private AutoreplyMode replyMode;
136 		/**
137 		 * 匹配的关键词列表
138 		 *
139 		 * @see com.foxinmy.weixin4j.mp.model.AutoReplySetting.Entry
140 		 */
141 		@JSONField(name = "keyword_list_info")
142 		private List<Entry> keywordList;
143 		/**
144 		 * 回复的信息列表
145 		 *
146 		 * @see com.foxinmy.weixin4j.mp.model.AutoReplySetting.Entry
147 		 */
148 		@JSONField(name = "reply_list_info")
149 		private List<Entry> replyList;
150 
151 		public String getRuleName() {
152 			return ruleName;
153 		}
154 
155 		public void setRuleName(String ruleName) {
156 			this.ruleName = ruleName;
157 		}
158 
159 		public Date getCreateTime() {
160 			return createTime;
161 		}
162 
163 		public void setCreateTime(Date createTime) {
164 			this.createTime = createTime;
165 		}
166 
167 		public AutoreplyMode getReplyMode() {
168 			return replyMode;
169 		}
170 
171 		public void setReplyMode(AutoreplyMode replyMode) {
172 			this.replyMode = replyMode;
173 		}
174 
175 		public List<Entry> getKeywordList() {
176 			return keywordList;
177 		}
178 
179 		public void setKeywordList(List<Entry> keywordList) {
180 			this.keywordList = keywordList;
181 		}
182 
183 		public List<Entry> getReplyList() {
184 			return replyList;
185 		}
186 
187 		public void setReplyList(List<Entry> replyList) {
188 			this.replyList = replyList;
189 		}
190 
191 		@Override
192 		public String toString() {
193 			return "Rule [ruleName=" + ruleName + ", createTime=" + createTime
194 					+ ", replyMode=" + replyMode + ", keywordList="
195 					+ keywordList + ", replyList=" + replyList + "]";
196 		}
197 	}
198 
199 	/**
200 	 * 数据项
201 	 *
202 	 * @className Entry
203 	 * @author jinyu(foxinmy@gmail.com)
204 	 * @date 2015年4月15日
205 	 * @since JDK 1.6
206 	 * @see
207 	 */
208 	public static class Entry implements Serializable {
209 
210 		private static final long serialVersionUID = -187922224547974025L;
211 		/**
212 		 * 自动回复的类型。关注后自动回复和消息自动回复的类型仅支持文本(text)、图片(img)、语音(voice)、视频(video),
213 		 * 关键词自动回复则还多了图文消息(news)
214 		 */
215 		private ButtonType type;
216 		/**
217 		 * 对于文本类型,content是文本内容,对于图片、语音、视频类型,content是mediaID,news是article
218 		 *
219 		 * @see com.foxinmy.weixin4j.tuple.MpArticle
220 		 */
221 		private Serializable content;
222 		/**
223 		 * 匹配模式(仅但关键字列表)
224 		 *
225 		 * @see com.foxinmy.weixin4j.mp.type.AutomatchMode
226 		 */
227 		@JSONField(name = "match_mode")
228 		private AutomatchMode matchMode;
229 
230 		public ButtonType getType() {
231 			return type;
232 		}
233 
234 		public void setType(ButtonType type) {
235 			this.type = type;
236 		}
237 
238 		public Serializable getContent() {
239 			return content;
240 		}
241 
242 		public void setContent(Serializable content) {
243 			this.content = content;
244 		}
245 
246 		public AutomatchMode getMatchMode() {
247 			return matchMode;
248 		}
249 
250 		public void setMatchMode(AutomatchMode matchMode) {
251 			this.matchMode = matchMode;
252 		}
253 
254 		@Override
255 		public String toString() {
256 			return "Entry [type=" + type + ", content=" + content
257 					+ ", matchMode=" + matchMode + "]";
258 		}
259 	}
260 }