View Javadoc
1   package com.foxinmy.weixin4j.mp.datacube;
2   
3   import java.io.Serializable;
4   import java.util.Date;
5   
6   import com.alibaba.fastjson.annotation.JSONField;
7   import com.foxinmy.weixin4j.mp.type.UserSourceType;
8   
9   /**
10   * 数据统计:用户增减
11   * 
12   * @className UserSummary
13   * @author jinyu(foxinmy@gmail.com)
14   * @date 2015年1月25日
15   * @since JDK 1.6
16   * @see
17   */
18  public class UserSummary implements Serializable {
19  
20  	private static final long serialVersionUID = 5303181828798568052L;
21  	/**
22  	 * 数据的日期
23  	 */
24  	@JSONField(name = "ref_date")
25  	private Date refDate;
26  	/**
27  	 * 用户的渠道
28  	 */
29  	@JSONField(name = "user_source")
30  	private int userSource;
31  	/**
32  	 * 新增的用户数量
33  	 */
34  	@JSONField(name = "new_user")
35  	private int newUser;
36  	/**
37  	 * 取消关注的用户数量,new_user减去cancel_user即为净增用户数量
38  	 */
39  	@JSONField(name = "cancel_user")
40  	private int cancelUser;
41  	/**
42  	 * 总用户量
43  	 */
44  	@JSONField(name = "cumulate_user")
45  	private int cumulateUser;
46  
47  	public Date getRefDate() {
48  		return refDate;
49  	}
50  
51  	public void setRefDate(Date refDate) {
52  		this.refDate = refDate;
53  	}
54  
55  	public int getUserSource() {
56  		return userSource;
57  	}
58  
59  	@JSONField(serialize = false)
60  	public UserSourceType getFormatUserSource() {
61  		if (userSource == 30) {
62  			return UserSourceType.QRCODE;
63  		} else if (userSource == 17) {
64  			return UserSourceType.CARDSHARE;
65  		} else if (userSource == 35) {
66  			return UserSourceType.SONUMBER;
67  		} else if (userSource == 39) {
68  			return UserSourceType.SOMPACCOUNT;
69  		} else if (userSource == 43) {
70  			return UserSourceType.ARTICLEMENU;
71  		} else {
72  			return UserSourceType.OTHER;
73  		}
74  	}
75  
76  	public void setUserSource(int userSource) {
77  		this.userSource = userSource;
78  	}
79  
80  	public int getNewUser() {
81  		return newUser;
82  	}
83  
84  	public void setNewUser(int newUser) {
85  		this.newUser = newUser;
86  	}
87  
88  	public int getCancelUser() {
89  		return cancelUser;
90  	}
91  
92  	public void setCancelUser(int cancelUser) {
93  		this.cancelUser = cancelUser;
94  	}
95  
96  	public int getCumulateUser() {
97  		return cumulateUser;
98  	}
99  
100 	public void setCumulateUser(int cumulateUser) {
101 		this.cumulateUser = cumulateUser;
102 	}
103 
104 	@Override
105 	public String toString() {
106 		return "UserSummary [refDate=" + refDate + ", userSource=" + userSource
107 				+ ", newUser=" + newUser + ", cancelUser=" + cancelUser
108 				+ ", cumulateUser=" + cumulateUser + "]";
109 	}
110 }