8d0e998b545479156b6f830f681d78032fc82b10.svn-base
8.3 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
package yxy.timer.service.impl;
import java.util.List;
import yxy.timer.dao.YxyMailNumCountDao;
import yxy.timer.dao.YxyMailNumCountInfoSaleDao;
import yxy.timer.dao.YxyReadDao;
import yxy.timer.dao.YxyReadInfoSaleDao;
import yxy.timer.dao.YxyReadingDayInfoDao;
import yxy.timer.dao.YxyUnsubscribeDao;
import yxy.timer.dao.YxyUnsubscribeInfoSaleDao;
import yxy.timer.pojo.YxyMailNumCount;
import yxy.timer.pojo.YxyReadingDayInfo;
import yxy.timer.pojo.YxyReadingInfo;
import yxy.timer.service.YxyReadService;
public class YxyReadServiceImpl implements YxyReadService{
/**查询所有点读信息*/
public List<YxyReadingInfo> findAllReadinfo(String nowdate)
throws Exception {
String hql="from YxyReadingInfo where yxy_reading_date >'"+nowdate+"'";
return yxyreaddao.findByHql(hql);
}
/**查询所有点读信息1000条*/
public List<YxyReadingInfo> findAllRead() throws Exception {
String hql="from YxyReadingInfo where yxy_reading_area=null";
return yxyreaddao.findByHqlNum(hql);
}
/**批量插入*/
public void insertReadPi(List<YxyReadingInfo> o) throws Exception {
//获取各IP的所属地区
// try {
// String ip="";
// String area="";
// for(int i=0;i<o.size();i++){
// ip=o.get(i).getYxy_reading_ip();
// if(!ip.equals("")&&(o.get(i).getYxy_reading_area()==null||o.get(i).getYxy_reading_area().equals(""))){
// area=getArea.getArea(ip).split(" ")[0];
// o.get(i).setYxy_reading_area(area);
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
yxyreaddao.insertReadPi(o);
}
/**插入点读信息*/
public int insertRead(YxyReadingInfo o)throws Exception{
int id=yxyreaddao.insertRead(o);
//查询历史邮件点读量
String hql="select reading_tol from YxySendMailMasterBase where mail_uid='"+o.getYxy_reading_mailuid()+"'";
int clicknum=yxyreaddao.findByHqlCount(hql);
if(clicknum>0){
clicknum=clicknum+1;
}else{
clicknum=1;
}
//更新
String mailhql="update YxySendMailMasterBase set reading_tol="+clicknum+" where mail_uid='"+o.getYxy_reading_mailuid()+"'";
yxyreaddao.updateByHql(mailhql);
return id;
}
/**插入退订信息*/
public int insertUn(yxy.timer.pojo.YxyUnsubscribeInfo o)throws Exception{
int id=yxyunsubscribedao.insertUn(o);
//查询历史邮件退订量
String hql="select un_person from YxySendMailMasterBase where mail_uid='"+o.getUnsubscribe_mail_uid()+"'";
int unnum=yxyunsubscribedao.findByHqlCount(hql);
if(unnum>0){
unnum=unnum+1;
}else{
unnum=1;
}
//更新
String mailhql="update YxySendMailMasterBase set un_person="+unnum+" where mail_uid='"+o.getUnsubscribe_mail_uid()+"'";
yxyunsubscribedao.updateByHql(mailhql);
return id;
}
/**查询退订信息*/
public List<yxy.timer.pojo.YxyUnsubscribeInfo> findUnInfoSet(String hql,int num) throws Exception {
return yxyunsubscribedao.findByHqlSet(hql, num);
}
/**批量插入退订信息*/
public void insertUnPi(List<yxy.timer.pojo.YxyUnsubscribeInfo> o) throws Exception {
yxyunsubscribedao.insertUnPi(o);
}
/**查询今日点读信息表*/
public List<YxyReadingDayInfo> findDayRead(int day)throws Exception{
String hql="from YxyReadingDayInfo where day_read_day="+day;
return yxydayreaddao.findByHql(hql);
}
/**清除今日点读信息表*/
public void updateDayRead()throws Exception{
String sql="TRUNCATE TABLE yxy_reading_day_info";
yxydayreaddao.updateBySql(sql);
}
/**今日批量插入*/
public void insertDayReadPi(List<YxyReadingDayInfo> list)throws Exception{
yxydayreaddao.addPojoPi(list);
}
/**sql更新*/
public void updateBySql(String sql)throws Exception{
yxyreaddao.updateSql(sql);
}
/**sql查询*/
public List<Object> findBySqlQuery(String sql)throws Exception{
return yxyreaddao.findBySql(sql);
}
/**查询是否有记录*/
public int findisRecode(String hql)throws Exception{
return yxyreaddao.findByHqlCount(hql);
}
/**查询邮件对应的统计数据*/
public YxyMailNumCount getYxyMailNumCount(String mail_uid)throws Exception{
String hql = "from YxyMailNumCount where mail_uid = '"+mail_uid+"'";
List<YxyMailNumCount> counts = yxymailnumcountdao.findByHql(hql);
if(counts.size() > 0){
return counts.get(0);
}else{
return null;
}
}
/**添加或更新邮件对应的统计数据*/
public void addEditYxyMailNumCount(YxyMailNumCount count)throws Exception{
if(count.getId() == 0){//添加
yxymailnumcountdao.addPojo(count);
}else{//编辑
yxymailnumcountdao.updatePojo(count);
}
}
/**查询邮件对应的统计数据(个人版sale100)*/
public yxy.timer.sale.YxyMailNumCountInfo getYxyMailNumCount2(String mail_uid)throws Exception{
String hql = "from YxyMailNumCountInfo where mail_uid = '"+mail_uid+"'";
List<yxy.timer.sale.YxyMailNumCountInfo> counts = yxymailnumcountinfosaledao.findByHql(hql);
if(counts.size() > 0){
return counts.get(0);
}else{
return null;
}
}
/**查询是否有记录(个人版sale100)*/
public int findisRecode2(String hql)throws Exception{
return yxyreadinfosaledao.findByHqlCount(hql);
}
/**实体插入(个人版sale100)*/
public int insertRead2(yxy.timer.sale.YxyReadingInfo o) throws Exception {
int id=yxyreadinfosaledao.insertRead(o);
//查询历史邮件点读量
String hql="select reading_tol from YxySendMailMasterBase where mail_uid='"+o.getYxy_reading_mailuid()+"'";
int clicknum=yxyreadinfosaledao.findByHqlCount(hql);
if(clicknum>0){
clicknum=clicknum+1;
}else{
clicknum=1;
}
String mailhql="update YxySendMailMasterBase set reading_tol="+clicknum+" where mail_uid='"+o.getYxy_reading_mailuid()+"'";
yxyreadinfosaledao.updateByHql(mailhql);
return id;
}
/**添加或更新邮件对应的统计数据(个人版sale100)*/
public void addEditYxyMailNumCount2(yxy.timer.sale.YxyMailNumCountInfo count)throws Exception{
if(count.getId() == 0){//添加
yxymailnumcountinfosaledao.addPojo(count);
}else{//编辑
yxymailnumcountinfosaledao.updatePojo(count);
}
}
/**插入退订信息*/
public int insertUn2(yxy.timer.sale.YxyUnsubscribeInfo o)throws Exception{
int id=yxyunsubscribeinfosaledao.insertUn(o);
//查询历史邮件退订量
String hql="select un_person from YxySendMailMasterBase where mail_uid='"+o.getUnsubscribe_mail_uid()+"'";
int unnum=yxyunsubscribeinfosaledao.findByHqlCount(hql);
if(unnum>0){
unnum=unnum+1;
}else{
unnum=1;
}
//更新
String mailhql="update YxySendMailMasterBase set un_person="+unnum+" where mail_uid='"+o.getUnsubscribe_mail_uid()+"'";
yxyunsubscribeinfosaledao.updateByHql(mailhql);
return id;
}
private YxyReadDao yxyreaddao;//点读dao
private YxyUnsubscribeDao yxyunsubscribedao;//退订dao
private YxyReadingDayInfoDao yxydayreaddao;//今日点读dao
private YxyMailNumCountDao yxymailnumcountdao;//链接数dao
private YxyReadInfoSaleDao yxyreadinfosaledao;
private YxyUnsubscribeInfoSaleDao yxyunsubscribeinfosaledao;
private YxyMailNumCountInfoSaleDao yxymailnumcountinfosaledao;
public YxyReadInfoSaleDao getYxyreadinfosaledao() {
return yxyreadinfosaledao;
}
public void setYxyreadinfosaledao(YxyReadInfoSaleDao yxyreadinfosaledao) {
this.yxyreadinfosaledao = yxyreadinfosaledao;
}
public YxyUnsubscribeInfoSaleDao getYxyunsubscribeinfosaledao() {
return yxyunsubscribeinfosaledao;
}
public void setYxyunsubscribeinfosaledao(
YxyUnsubscribeInfoSaleDao yxyunsubscribeinfosaledao) {
this.yxyunsubscribeinfosaledao = yxyunsubscribeinfosaledao;
}
public YxyMailNumCountInfoSaleDao getYxymailnumcountinfosaledao() {
return yxymailnumcountinfosaledao;
}
public void setYxymailnumcountinfosaledao(
YxyMailNumCountInfoSaleDao yxymailnumcountinfosaledao) {
this.yxymailnumcountinfosaledao = yxymailnumcountinfosaledao;
}
public YxyReadDao getYxyreaddao() {
return yxyreaddao;
}
public void setYxyreaddao(YxyReadDao yxyreaddao) {
this.yxyreaddao = yxyreaddao;
}
public YxyUnsubscribeDao getYxyunsubscribedao() {
return yxyunsubscribedao;
}
public void setYxyunsubscribedao(YxyUnsubscribeDao yxyunsubscribedao) {
this.yxyunsubscribedao = yxyunsubscribedao;
}
public YxyReadingDayInfoDao getYxydayreaddao() {
return yxydayreaddao;
}
public void setYxydayreaddao(YxyReadingDayInfoDao yxydayreaddao) {
this.yxydayreaddao = yxydayreaddao;
}
public YxyMailNumCountDao getYxymailnumcountdao() {
return yxymailnumcountdao;
}
public void setYxymailnumcountdao(YxyMailNumCountDao yxymailnumcountdao) {
this.yxymailnumcountdao = yxymailnumcountdao;
}
}