View Javadoc
1   package com.foxinmy.weixin4j.qy.chat;
2   
3   import java.io.Serializable;
4   import java.util.List;
5   
6   import javax.xml.bind.annotation.XmlAccessType;
7   import javax.xml.bind.annotation.XmlAccessorType;
8   import javax.xml.bind.annotation.XmlElement;
9   import javax.xml.bind.annotation.XmlRootElement;
10  import javax.xml.bind.annotation.XmlTransient;
11  
12  import com.foxinmy.weixin4j.type.AgentType;
13  
14  /**
15   * 企业号聊天服务回调消息
16   * 
17   * @className WeixinChatMessage
18   * @author jinyu(foxinmy@gmail.com)
19   * @date 2015年8月1日
20   * @since JDK 1.6
21   * @see
22   */
23  @XmlRootElement(name = "xml")
24  @XmlAccessorType(XmlAccessType.FIELD)
25  public class WeixinChatMessage implements Serializable {
26  
27  	private static final long serialVersionUID = 6788124387186831643L;
28  
29  	/**
30  	 * 企业号CorpID
31  	 */
32  	@XmlElement(name = "ToUserName")
33  	private String corpId;
34  	/**
35  	 * 应用类型
36  	 */
37  	@XmlElement(name = "AgentType")
38  	private String agentType;
39  	/**
40  	 * 消息数量
41  	 */
42  	@XmlElement(name = "ItemCount")
43  	private int itemCount;
44  	/**
45  	 * 会话事件或消息
46  	 */
47  	@XmlElement(name = "Item")
48  	public List<ChatItem> items;
49  	/**
50  	 * 回调包ID,uint64类型,企业内唯一
51  	 */
52  	@XmlElement(name = "PackageId")
53  	private String packageId;
54  
55  	public String getCorpId() {
56  		return corpId;
57  	}
58  
59  	public String getAgentType() {
60  		return agentType;
61  	}
62  
63  	@XmlTransient
64  	public AgentType getFormatAgentType() {
65  		return AgentType.valueOf(agentType);
66  	}
67  
68  	public int getItemCount() {
69  		return itemCount;
70  	}
71  
72  	public List<ChatItem> getItems() {
73  		return items;
74  	}
75  
76  	public String getPackageId() {
77  		return packageId;
78  	}
79  
80  	@Override
81  	public String toString() {
82  		return "WeixinChatMessage [corpId=" + corpId + ", agentType="
83  				+ agentType + ", itemCount=" + itemCount + ", items=" + items
84  				+ ", packageId=" + packageId + "]";
85  	}
86  }