View Javadoc
1   package com.foxinmy.weixin4j.qy.message;
2   
3   import java.io.Serializable;
4   
5   import com.alibaba.fastjson.annotation.JSONField;
6   import com.foxinmy.weixin4j.tuple.NotifyTuple;
7   
8   /**
9    * 客服消息对象
10   * 
11   * @className CustomeMessage
12   * @author jinyu(foxinmy@gmail.com)
13   * @date 2015年11月20日
14   * @since JDK 1.6
15   * @see com.foxinmy.weixin4j.tuple.Text
16   * @see com.foxinmy.weixin4j.tuple.Image
17   * @see com.foxinmy.weixin4j.tuple.Voice
18   * @see com.foxinmy.weixin4j.tuple.Video
19   * @see com.foxinmy.weixin4j.tuple.File
20   */
21  public class CustomeMessage implements Serializable {
22  
23  	private static final long serialVersionUID = -3620361273175868681L;
24  
25  	private CustomeTarget sender;
26  	private CustomeTarget receiver;
27  	/**
28  	 * 消息对象
29  	 */
30  	@JSONField(serialize = false)
31  	private NotifyTuple tuple;
32  
33  	public CustomeMessage(CustomeTarget sender, CustomeTarget receiver,
34  			NotifyTuple tuple) {
35  		this.sender = sender;
36  		this.receiver = receiver;
37  		this.tuple = tuple;
38  	}
39  
40  	public CustomeTarget getSender() {
41  		return sender;
42  	}
43  
44  	public CustomeTarget getReceiver() {
45  		return receiver;
46  	}
47  
48  	public NotifyTuple getTuple() {
49  		return tuple;
50  	}
51  
52  	/**
53  	 * 用户类型
54  	 * 
55  	 * @className CustomeIdType
56  	 * @author jinyu(foxinmy@gmail.com)
57  	 * @date 2015年11月20日
58  	 * @since JDK 1.6
59  	 * @see
60  	 */
61  	public enum CustomeIdType {
62  		/**
63  		 * 客服
64  		 */
65  		kf,
66  		/**
67  		 * 企业员工userid
68  		 */
69  		userid,
70  		/**
71  		 * 公众号openid
72  		 */
73  		openid
74  	}
75  
76  	/**
77  	 * 消息对象
78  	 * 
79  	 * @className CustomeTarget
80  	 * @author jinyu(foxinmy@gmail.com)
81  	 * @date 2015年11月20日
82  	 * @since JDK 1.6
83  	 * @see
84  	 */
85  	public static class CustomeTarget implements Serializable {
86  
87  		private static final long serialVersionUID = 1L;
88  
89  		private CustomeIdType type;
90  		private String id;
91  
92  		public CustomeTarget(CustomeIdType type, String id) {
93  			this.type = type;
94  			this.id = id;
95  		}
96  
97  		public CustomeIdType getType() {
98  			return type;
99  		}
100 
101 		public String getId() {
102 			return id;
103 		}
104 	}
105 
106 	@Override
107 	public String toString() {
108 		return "CustomeMessage [sender=" + sender + ", receiver=" + receiver
109 				+ ", tuple=" + tuple + "]";
110 	}
111 }