YxyMailCountAction.java
9.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
package com.espeed.action;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.Map;
import com.espeed.centre.pojo.YxyUserInfo;
import com.espeed.log.LogClass;
import com.espeed.service.YxyMailCountService;
import com.espeed.service.YxySysParamaterService;
import com.opensymphony.xwork2.ActionContext;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: 邮件统计action(营销邮)
* 开始时间: 2013.12.09
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 统计邮件发送量(营销邮)
*/
public class YxyMailCountAction extends BaseAction{
private static final long serialVersionUID = 1L;
/**首页统计信息(块块色表)*/
public String findCountHome(){
try {
//获取用户session
ActionContext ac = ActionContext.getContext();
Map<String,Object> sess = ac.getSession();
YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
loginid=user.getLogin_id();//用户账号
domain=user.getDomain();//用户所属域名
countall=yxymailcountservice.findCountHome(loginid,domain);
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
String str = sw.toString();
LogClass.errolog(str,loginid+"@"+domain);
}
return "countmap";
}
/**首页用户月统计图*/
public String findUserMonthCount(){
try {
//获取用户session
ActionContext ac = ActionContext.getContext();
Map<String,Object> sess = ac.getSession();
YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
loginid=user.getLogin_id();//用户账号
domain=user.getDomain();//用户所属域名
countall=yxymailcountservice.findUserMonthCount(loginid, domain);
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
String str = sw.toString();
LogClass.errolog(str,loginid+"@"+domain);
}
return "count";
}
/**用户已发送,设定值统计信息*/
public String findUserSendCount(){
try {
//获取用户session
ActionContext ac = ActionContext.getContext();
Map<String,Object> sess = ac.getSession();
YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
if("".equals(loginid)||"erro".equals(loginid)){
loginid=user.getLogin_id();//用户账号
}
domain=user.getDomain();//用户所属域名
//查询用户控制参数
Map<String,String> usergraph=yxysysparamaterservice.findParamaterByLevel(4,loginid,domain);
//查询已发统计值
countall=yxymailcountservice.findCountPageTop(loginid,domain);
//日发量限制
int daysendBig=0;
if(usergraph.get("yxy_day_send_mail_limit")!=null){
daysendBig=Integer.parseInt(usergraph.get("yxy_day_send_mail_limit").toString());//日最大量
}
countall.put("daymax",daysendBig);
//月发量限制
int monthsendBig=0;
if(usergraph.get("yxy_month_send_mail_limit")!=null){
monthsendBig=Integer.parseInt(usergraph.get("yxy_month_send_mail_limit").toString());//月最大量
}
countall.put("monthmax",monthsendBig);
//总发量限制
int tolsendBig=0;
if(usergraph.get("yxy_sum_send")!=null){
tolsendBig=Integer.parseInt(usergraph.get("yxy_sum_send").toString());//总最大量
}
countall.put("tolmax",tolsendBig);
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
String str = sw.toString();
LogClass.errolog(str,loginid+"@"+domain);
}
return "countmap";
}
/**域统计信息*/
public String findCountDomain(){
try {
//获取用户session
ActionContext ac = ActionContext.getContext();
Map<String,Object> sess = ac.getSession();
YxyUserInfo user=(YxyUserInfo)sess.get("yxyuser");
loginid=user.getLogin_id();//用户账号
domain=user.getDomain();//用户所属域名
countall=yxymailcountservice.findCountDomain(user);
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
String str = sw.toString();
LogClass.errolog(str,loginid+"@"+domain);
}
return "countmap";
}
/**根据年查询每个月统计*/
public String findYearMonthCount(){
try {
//获取用户session
ActionContext ac = ActionContext.getContext();
Map<String,Object> sess = ac.getSession();
YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
if(loginid==null||"".equals(loginid)){
loginid=user.getLogin_id();//用户账号
}
domain=user.getDomain();//用户所属域名
countallmap=yxymailcountservice.findYearMonthCount(loginid, domain, condition, conditionvalue,user);
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
String str = sw.toString();
LogClass.errolog(str,loginid+"@"+domain);
}
return "monthcountmap";
}
/**用户今日统计*/
public String findNowDayCount(){
try {
//获取用户session
ActionContext ac = ActionContext.getContext();
Map<String,Object> sess = ac.getSession();
YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
domain=user.getDomain();//用户所属域名
loginid=user.getLogin_id();//用户账号
countall=yxymailcountservice.findNowDayCount(loginid, domain);
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
String str = sw.toString();
LogClass.errolog(str,loginid+"@"+domain);
}
return "countmap";
}
/**域剩余统计*/
public String findDomainUseCount(){
try {
//获取用户session
ActionContext ac = ActionContext.getContext();
Map<String,Object> sess = ac.getSession();
YxyUserInfo user=(YxyUserInfo) sess.get("yxyuser");
loginid=user.getLogin_id();//用户账号
domain=user.getDomain();//用户所属域名
//域总发送次量tolsendci
//域总发送总量tolsend
//域总点读量clicktol
//域总未读量noclick
//域总回复tolreply
//域总退订tolun
//countall=yxymailcountservice.findCountDomain(domain);
countall=yxymailcountservice.findCountDomain(user);
//查询企业控制参数
Map<String,String> usergraph=yxysysparamaterservice.findParamaterByLevel(1,loginid,domain);
//域分配总量
int tolsendbig=Integer.parseInt(usergraph.get("yxy_domain_send").toString());
countall.put("tolsendbig",tolsendbig);
//已分配
//int usecount=yxysysparamaterservice.findTolFenPeiCount(loginid, domain);
int usecount=yxysysparamaterservice.findTolFenPeiCount(user);
countall.put("usecount",usecount);
//待分配
if(tolsendbig==-1){
countall.put("daifeipei",-1);
}else{
if(tolsendbig-usecount>0)
{
countall.put("daifeipei",tolsendbig-usecount);
}
else
{
countall.put("daifeipei",0);
}
//countall.put("daifeipei",tolsendbig-usecount);
}
return "countmap";
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw, true));
String str = sw.toString();
LogClass.errolog(str,loginid+"@"+domain);
}
return "countmap";
}
private YxySysParamaterService yxysysparamaterservice;//控制参数service
private YxyMailCountService yxymailcountservice;//统计service
private Map<String,Integer> countall=new HashMap<String,Integer>();//域总统计返回值
private Map<String,Map<String,Integer>> countallmap=new HashMap<String,Map<String,Integer>>();//每月统计返回值
private String loginid="erro";
private String domain="erro";
private int condition;//条件
private String conditionvalue;//条件值
public YxySysParamaterService getYxysysparamaterservice() {
return yxysysparamaterservice;
}
public void setYxysysparamaterservice(
YxySysParamaterService yxysysparamaterservice) {
this.yxysysparamaterservice = yxysysparamaterservice;
}
public YxyMailCountService getYxymailcountservice() {
return yxymailcountservice;
}
public void setYxymailcountservice(YxyMailCountService yxymailcountservice) {
this.yxymailcountservice = yxymailcountservice;
}
public Map<String, Integer> getCountall() {
return countall;
}
public void setCountall(Map<String, Integer> countall) {
this.countall = countall;
}
public Map<String, Map<String, Integer>> getCountallmap() {
return countallmap;
}
public void setCountallmap(Map<String, Map<String, Integer>> countallmap) {
this.countallmap = countallmap;
}
public String getLoginid() {
return loginid;
}
public void setLoginid(String loginid) {
this.loginid = loginid;
}
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
public int getCondition() {
return condition;
}
public void setCondition(int condition) {
this.condition = condition;
}
public String getConditionvalue() {
return conditionvalue;
}
public void setConditionvalue(String conditionvalue) {
this.conditionvalue = conditionvalue;
}
}