0b3d567f0c6076d11b0feac27a51d05ad8d7bf71.svn-base 21.6 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 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484
package com.espeed.service.impl;
  
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

import com.espeed.centre.pojo.YxyUserInfo;
import com.espeed.dao.YxyReadingCountDao;
import com.espeed.dao.YxyReadingInfoDao;
import com.espeed.dao.YxySendMailDetailDao;
import com.espeed.dao.YxySendMailMasterBaseDao;
import com.espeed.dao.YxyUnsubscribeInfoDao;
import com.espeed.dao.YxyUserInfoDao;
import com.espeed.pojo.YxyReadingInfo;
import com.espeed.pojo.YxySendMailMasterBase;
import com.espeed.service.YxyReadingInfoService;
import com.espeed.vo.PageBean;
/**
 * 程序名称:    	EspeedMail_时速邮箱
 * 程序版本:    	V1.0
 * 作    者:    	深圳市科飞时速网络技术有限公司(0755-88843776)
 * 版权所有:    	深圳市科飞时速网络技术有限公司
 * 技术支持:    	Tech@21gmail.com
 * 单元名称:     邮件点读service实现类(营销游)
 * 开始时间:    	2013.12.09
 * 程 序 员:    	谢勇
 * 最后修改:    
 * 备    注:		如需修改请通知程序员    
 */
public class YxyReadingInfoServiceImpl implements YxyReadingInfoService{
	
	/**条件查询点读信息*/
	public List<YxyReadingInfo> findRedingByCondition(String loginid,String domain,PageBean pb,int condition,
			String conditionvalue,YxyUserInfo user)throws Exception {
		String hql="from YxyReadingInfo where 1=1";
		String hqlcount="select count(*) from YxyReadingInfo where 1=1";
		if(condition==0){//用户所有查询
			hql+=" and yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"'";
			hqlcount+=" and yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"'";
		}else if(condition==1){//用户时间段查询
			hql+=" and yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"'";
			hqlcount+=" and yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"'";
			//时间
			String[] timer=conditionvalue.split("#");
			if(!timer[0].equals("-1")){
				hql+=" and yxy_reading_year="+timer[0];
				hqlcount+=" and yxy_reading_year="+timer[0];
			}
			if(!timer[1].equals("-1")){
				hql+=" and yxy_reading_month="+timer[1];
				hqlcount+=" and yxy_reading_month="+timer[1];
			}
		}else if(condition==2){//域下所有点读
			if(user.getUser_role()==1)//系统管理员
			{
				hql+=" and yxy_reading_domain='"+domain+"'";
				hqlcount+=" and yxy_reading_domain='"+domain+"'";
			}
			else if(user.getUser_role()==2){//部门管理员
				String ids = "";
				//获取子部门
				String sql="select dept_id from centre_department where parent_dept_id = "+user.getDept_id();
				List<Object> objects = yxyuserinfodao.findBySqlQuery(sql);
				if(objects.size() > 0){
					for(Object obj : objects){
						ids += obj.toString() + ",";
					}
					ids += String.valueOf(user.getDept_id());
				}else{
					ids = String.valueOf(user.getDept_id());
				}
				String hql1="from YxyUserInfo where company_id="+user.getCompany_id()+" and dept_id in("+ids+") ORDER BY enrol_time desc";
				List<YxyUserInfo> users = yxyuserinfodao.findByHql(hql1);
				String loginids = "";
				for(YxyUserInfo pojo : users){
					loginids += "'"+pojo.getLogin_id()+"'"+",";
				}
				loginids=loginids.substring(0,loginids.length()-1);
				hql+=" and yxy_reading_domain='"+domain+"' and yxy_reading_loginid in("+loginids+")";
				hqlcount+=" and yxy_reading_domain='"+domain+"' and yxy_reading_loginid in("+loginids+")";
			}
			else//非系统管理员查询自己
			{
				hql+=" and yxy_reading_domain='"+domain+"' and yxy_reading_loginid ='"+user.getLogin_id()+"'";
				hqlcount+=" and yxy_reading_domain='"+domain+"' and yxy_reading_loginid ='"+user.getLogin_id()+"'";
			}
		}else if(condition==3){//域根据用户查询
			hql+=" and yxy_reading_loginid='"+conditionvalue+"' and yxy_reading_domain='"+domain+"'";
			hqlcount+=" and yxy_reading_loginid='"+conditionvalue+"' and yxy_reading_domain='"+domain+"'";
		}else if(condition==4){//域时间段查询
			if(user.getUser_role()==1)//系统管理员
			{
				hql+=" and yxy_reading_domain='"+domain+"'";
				hqlcount+=" and yxy_reading_domain='"+domain+"'";
			}
			else if(user.getUser_role()==2){//部门管理员
				String ids = "";
				//获取子部门
				String sql="select dept_id from centre_department where parent_dept_id = "+user.getDept_id();
				List<Object> objects = yxyuserinfodao.findBySqlQuery(sql);
				if(objects.size() > 0){
					for(Object obj : objects){
						ids += obj.toString() + ",";
					}
					ids += String.valueOf(user.getDept_id());
				}else{
					ids = String.valueOf(user.getDept_id());
				}
				String hql1="from YxyUserInfo where company_id="+user.getCompany_id()+" and dept_id in("+ids+") ORDER BY enrol_time desc";
				List<YxyUserInfo> users = yxyuserinfodao.findByHql(hql1);
				String loginids = "";
				for(YxyUserInfo pojo : users){
					loginids += "'"+pojo.getLogin_id()+"'"+",";
				}
				loginids=loginids.substring(0,loginids.length()-1);
				hql+=" and yxy_reading_domain='"+domain+"' and yxy_reading_loginid in("+loginids+")";
				hqlcount+=" and yxy_reading_domain='"+domain+"' and yxy_reading_loginid in("+loginids+")";
			}
			else//非系统管理员查询自己
			{
				hql+=" and yxy_reading_domain='"+domain+"' and yxy_reading_loginid ='"+user.getLogin_id()+"'";
				hqlcount+=" and yxy_reading_domain='"+domain+"' and yxy_reading_loginid ='"+user.getLogin_id()+"'";
			}
			//时间
			String[] timer=conditionvalue.split("#");
			if(!timer[0].equals("-1")){
				hql+=" and yxy_reading_year="+timer[0];
				hqlcount+=" and yxy_reading_year="+timer[0];
			}
			if(!timer[1].equals("-1")){
				hql+=" and yxy_reading_month="+timer[1];
				hqlcount+=" and yxy_reading_month="+timer[1];
			}
		}
		hql+=" order by yxy_reading_date DESC";
		hqlcount+=" order by yxy_reading_date DESC";
		return yxyreadinginfodao.findByHqlPage(hql, hqlcount, pb);
	}
	
	/**用户点读导出生成txt文件*/
	public int importUserReadList(String loginid,String domain,int isrepeat,int condition,
			String conditionvalue,YxyUserInfo user)throws Exception {
		String hql="from YxyReadingInfo where 1=1";
		String updatehql="update YxyReadingInfo set yxy_is_export=1 where 1=1";
		if(condition==0){//指定ID导出
			if(isrepeat==1){//重复导出
				hql+=" and yxy_reading_id in("+conditionvalue+")";
				updatehql+=" and yxy_reading_id in("+conditionvalue+")";
			}else{//重复不导出
				hql+=" and yxy_is_export=0 and yxy_reading_id in("+conditionvalue+")";
				updatehql+=" and yxy_is_export=0 and yxy_reading_id in("+conditionvalue+")";
			}
		}else if(condition==1){//根据年月导出
			String[] timer=conditionvalue.split("#");
			int year=Integer.parseInt(timer[0]);
			int month=Integer.parseInt(timer[1]);
			if(year==0){//年导出
				if(isrepeat==1){//重复导出
					hql+=" and yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"' and  yxy_reading_year="+year;
					updatehql+=" and yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"' and  yxy_reading_year="+year;
				}else{//重复不导出
					hql+=" and yxy_is_export=0 and yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"' and  yxy_reading_year="+year;
					updatehql+=" and yxy_is_export=0 and yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"' and  yxy_reading_year="+year;
				}
			}else{//年月导出
				if(isrepeat==1){//重复导出
					hql+=" and yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"' and  yxy_reading_year="+year+" and yxy_reading_month="+month;
					updatehql+=" and yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"' and  yxy_reading_year="+year+" and yxy_reading_month="+month;
				}else{//重复不导出
					hql+=" and yxy_is_export=0 and yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"' and  yxy_reading_year="+year+" and yxy_reading_month="+month;
					updatehql+=" and yxy_is_export=0 and yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"' and  yxy_reading_year="+year+" and yxy_reading_month="+month;
				}
			}
		}else if(condition==2){//域根据年月导出(域)
			String[] timer=conditionvalue.split("#");
			int year=0;
			int month=0;
			if(timer.length==1){//年导出
				year=Integer.parseInt(timer[0]);
				if(isrepeat==1){//重复导出
					if(user.getUser_role()==1)//系统管理员
					{
						hql+=" and yxy_reading_domain='"+domain+"' and  yxy_reading_year="+year;
						updatehql+=" and yxy_reading_domain='"+domain+"' and  yxy_reading_year="+year;
					}
					else if(user.getUser_role()==2){//部门管理员
						String ids = "";
						//获取子部门
						String sql="select dept_id from centre_department where parent_dept_id = "+user.getDept_id();
						List<Object> objects = yxyuserinfodao.findBySqlQuery(sql);
						if(objects.size() > 0){
							for(Object obj : objects){
								ids += obj.toString() + ",";
							}
							ids += String.valueOf(user.getDept_id());
						}else{
							ids = String.valueOf(user.getDept_id());
						}
						String hql1="from YxyUserInfo where company_id="+user.getCompany_id()+" and dept_id in("+ids+") ORDER BY enrol_time desc";
						List<YxyUserInfo> users = yxyuserinfodao.findByHql(hql1);
						String loginids = "";
						for(YxyUserInfo pojo : users){
							loginids += "'"+pojo.getLogin_id()+"'"+",";
						}
						loginids=loginids.substring(0,loginids.length()-1);
						hql+=" and yxy_reading_domain='"+domain+"' and yxy_reading_loginid in("+loginids+") and  yxy_reading_year="+year;
						updatehql+=" and yxy_reading_domain='"+domain+"' and yxy_reading_loginid in("+loginids+") and  yxy_reading_year="+year;
					}
					else//非系统管理员查询自己
					{
						hql+=" and yxy_reading_domain='"+domain+"' and yxy_reading_loginid ='"+user.getLogin_id()+"' and  yxy_reading_year="+year;
						updatehql+=" and yxy_reading_domain='"+domain+"' and yxy_reading_loginid ='"+user.getLogin_id()+"' and  yxy_reading_year="+year;
					}
				}else{//重复不导出
				}
			}else if(timer.length==2){//年月导出
				year=Integer.parseInt(timer[0]);
				month=Integer.parseInt(timer[1]);
				if(isrepeat==1){//重复导出
					if(user.getUser_role()==1)//系统管理员
					{
						hql+=" and yxy_reading_domain='"+domain+"' and  yxy_reading_year="+year+" and yxy_reading_month="+month;
						updatehql+=" and yxy_reading_domain='"+domain+"' and  yxy_reading_year="+year+" and yxy_reading_month="+month;
					}
					else if(user.getUser_role()==2){//部门管理员
						String ids = "";
						//获取子部门
						String sql="select dept_id from centre_department where parent_dept_id = "+user.getDept_id();
						List<Object> objects = yxyuserinfodao.findBySqlQuery(sql);
						if(objects.size() > 0){
							for(Object obj : objects){
								ids += obj.toString() + ",";
							}
							ids += String.valueOf(user.getDept_id());
						}else{
							ids = String.valueOf(user.getDept_id());
						}
						String hql1="from YxyUserInfo where company_id="+user.getCompany_id()+" and dept_id in("+ids+") ORDER BY enrol_time desc";
						List<YxyUserInfo> users = yxyuserinfodao.findByHql(hql1);
						String loginids = "";
						for(YxyUserInfo pojo : users){
							loginids += "'"+pojo.getLogin_id()+"'"+",";
						}
						loginids=loginids.substring(0,loginids.length()-1);
						hql+=" and yxy_reading_domain='"+domain+"' and yxy_reading_loginid in("+loginids+") and  yxy_reading_year="+year+" and yxy_reading_month="+month;
						updatehql+=" and yxy_reading_domain='"+domain+"' and yxy_reading_loginid in("+loginids+") and  yxy_reading_year="+year+" and yxy_reading_month="+month;
					}
					else//非系统管理查询自己
					{
						hql+=" and yxy_reading_domain='"+domain+"' and yxy_reading_loginid ='"+user.getLogin_id()+"' and  yxy_reading_year="+year+" and yxy_reading_month="+month;
						updatehql+=" and yxy_reading_domain='"+domain+"' and yxy_reading_loginid ='"+user.getLogin_id()+"' and  yxy_reading_year="+year+" and yxy_reading_month="+month;
					}
				}else{//重复不导出
					if(user.getUser_role()==1)//系统管理员
					{
						hql+=" and yxy_is_export=0 and yxy_reading_domain='"+domain+"' and  yxy_reading_year="+year+" and yxy_reading_month="+month;
						updatehql+=" and yxy_is_export=0 and yxy_reading_domain='"+domain+"' and  yxy_reading_year="+year+" and yxy_reading_month="+month;
					}
					else if(user.getUser_role()==2){//部门管理员
						String ids = "";
						//获取子部门
						String sql="select dept_id from centre_department where parent_dept_id = "+user.getDept_id();
						List<Object> objects = yxyuserinfodao.findBySqlQuery(sql);
						if(objects.size() > 0){
							for(Object obj : objects){
								ids += obj.toString() + ",";
							}
							ids += String.valueOf(user.getDept_id());
						}else{
							ids = String.valueOf(user.getDept_id());
						}
						String hql1="from YxyUserInfo where company_id="+user.getCompany_id()+" and dept_id in("+ids+") ORDER BY enrol_time desc";
						List<YxyUserInfo> users = yxyuserinfodao.findByHql(hql1);
						String loginids = "";
						for(YxyUserInfo pojo : users){
							loginids += "'"+pojo.getLogin_id()+"'"+",";
						}
						loginids=loginids.substring(0,loginids.length()-1);
						hql+=" and yxy_is_export=0 and yxy_reading_domain='"+domain+"' and yxy_reading_loginid in("+loginids+") and  yxy_reading_year="+year+" and yxy_reading_month="+month;
						updatehql+=" and yxy_is_export=0 and yxy_reading_domain='"+domain+"' and yxy_reading_loginid in("+loginids+") and  yxy_reading_year="+year+" and yxy_reading_month="+month;
					}
					else//非系统管理查询自己
					{
						hql+=" and yxy_is_export=0 and yxy_reading_domain='"+domain+"' and yxy_reading_loginid ='"+user.getLogin_id()+"' and  yxy_reading_year="+year+" and yxy_reading_month="+month;
						updatehql+=" and yxy_is_export=0 and yxy_reading_domain='"+domain+"' and yxy_reading_loginid ='"+user.getLogin_id()+"' and  yxy_reading_year="+year+" and yxy_reading_month="+month;
					}
				}
			}
		}else if(condition==3){//根据邮件导出
			hql+=" and yxy_reading_mailuid='"+conditionvalue+"'";
			updatehql+=" and yxy_reading_mailuid='"+conditionvalue+"'";
		}
		List<YxyReadingInfo> readlist=yxyreadinginfodao.findByHql(hql);
		//处理数据
		if(readlist.size()>0){
			//获取项目路径
			String pathew = this.getClass().getClassLoader().getResource("/").getPath();
			pathew = pathew.substring(1, pathew.length());
			pathew = pathew.replace("/WEB-INF/classes/","");

			String dir=pathew+"\\tempUserFile\\"+domain+"\\"+loginid;
			//生成文件
			File file=new File(dir);
			file.mkdirs();
			
			HSSFWorkbook workbook = new HSSFWorkbook();
			HSSFSheet sheet = workbook.createSheet("ExportEmail");//在Excel工作簿中建一工作表
			
			HSSFCell cell = null;//创建列
			HSSFRow row =null;//创建行
			row = sheet.createRow((short) 0);
			//加入文件头
			//String [] str={"E-mail","点读时间","点读总数","点读地区","点读IP"};
			String [] str={"E-mail","点读时间","点读设备","点读地区","点读IP"};
			for(int begin=0;begin<str.length;begin++){
				cell = row.createCell((short) begin);
				cell.setEncoding(HSSFCell.ENCODING_UTF_16);//如果内容有中文件,则要设置这里
				cell.setCellType(HSSFCell.CELL_TYPE_STRING);// 定义单元格为字符串类型
				cell.setCellValue(str[begin]);
			}
			//加入详细信息
			for(int i=0;i<readlist.size();i++){
				row = sheet.createRow((short) i+1);
				for(int j = 0; j < 5; j++) {
				  cell = row.createCell((short) j);//创建列
				  cell.setEncoding(HSSFCell.ENCODING_UTF_16);//如果内容有中文件,则要设置这里
				  cell.setCellType(HSSFCell.CELL_TYPE_STRING);// 定义单元格为字符串类型
				  //在单元格中输入一些内容
				  if(j==0){
				      cell.setCellValue(readlist.get(i).getYxy_reading_email());
				  }else if(j==1){
					  cell.setCellValue(readlist.get(i).getYxy_reading_date());
				  }else if(j==2){
					  if(readlist.get(i).getYxy_useragent()!=null&&!"".equals(readlist.get(i).getYxy_useragent())){
						  cell.setCellValue(readlist.get(i).getYxy_useragent());
					  }else{
						  cell.setCellValue("PC设备谷歌浏览器");
					  }
					  //cell.setCellValue(readlist.get(i).getYxy_reading_num());
				  }else if(j==3){
					  cell.setCellValue(readlist.get(i).getYxy_reading_area());
				  }else if(j==4){
					  cell.setCellValue(readlist.get(i).getYxy_reading_ip());
				  }
				}  
			}
			// 新建一输出文件流
			FileOutputStream fOut = new FileOutputStream(dir+"\\readinfo.xls");		
			workbook.write(fOut);
			fOut.flush();
			fOut.close();
			
			//更新邮件导出过
			yxyreadinginfodao.updateByHql(updatehql);
			return 1;
		}else{
			return 0;
		}
	}
	
	/**根据邮件唯一码查询点读信息*/
	public List<YxyReadingInfo> findReadByMailUID(String loginid, String domain,String mailuid) throws Exception {		
		String hql="from YxyReadingInfo where yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"' and yxy_reading_mailuid='"+mailuid+"'";
		return yxyreadinginfodao.findByHql(hql);
	}
	
	/**查询用户点读地址*/
	public List<Object> findUserReadAddress(String loginid,String domain)throws Exception{
		String sql="select yxy_reading_email from yxy_reading_info where yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"'";
		return yxyreadinginfodao.findBySqlQuery(sql);
	}
	
	/**更新为已导出过*/
	public void updateIsExport(String readid,String loginid,String domain) throws Exception {
		String hql="";
		if(readid.equals("all")){//更新所有
			hql="update YxyReadingInfo set yxy_is_export=1 where yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"'";
		}else{
			//readid=readid.substring(0,readid.length()-1);
			hql="update YxyReadingInfo set yxy_is_export=1 where yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"' and yxy_reading_id in("+readid+")";
		}
		yxyreadinginfodao.updateByHql(hql);
	}
	
	/**查询邮件点读地址*/
	public List<Object> findMailReadAddress(String loginid,String domain,int mailid)throws Exception{
		String sql1="select mail_uid from yxy_send_mail_master_base where send_mail_id="+mailid+" or mainid="+mailid;
		List<Object> list=yxyreadinginfodao.findBySqlQuery(sql1);
		if(list!=null&&list.size()>0){
			String idstr="";
			for(int i=0;i<list.size();i++){
				idstr+="'"+list.get(i).toString()+"',";
			}
			if(!"".equals(idstr)){
				idstr=idstr.substring(0,idstr.length()-1);
				String sql2="select yxy_reading_email from yxy_reading_info where yxy_reading_mailuid in("+idstr+") and yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"'";
				return yxyreadinginfodao.findBySqlQuery(sql2);
			}else{
				return null;
			}
		}else{
			return null;
		}
		
	}
	
	/**根据唯一码导文件*/
	public List<YxyReadingInfo> exportReadMail(String loginid, String domain,String mailuid) throws Exception {
		String hql="from YxyReadingInfo where yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"' and yxy_reading_mailuid='"+mailuid+"'";
		return yxyreadinginfodao.findByHql(hql);
	}
	
	/**导出所有点读文件*/
	public List<YxyReadingInfo> exportAllMail(String loginid, String domain)
			throws Exception {
		String hql = "from YxyReadingInfo where yxy_reading_loginid='"+loginid+"' and yxy_reading_domain='"+domain+"'";
		return yxyreadinginfodao.findByHql(hql);
	}
	
	/**根据该邮件地址查询点读过的邮件*/
	public List<YxyReadingInfo> findMailAddress(String loginid, String domain,String mail) throws Exception {
		String hql = "from YxyReadingInfo where  yxy_reading_email='"+mail+"' AND yxy_reading_loginid ='"+loginid+"' AND yxy_reading_domain='"+domain+"'";
		return yxyreadinginfodao.findByHql(hql);
	}
	
	/**根据邮件地址来反查地址信息*/
	public List<YxySendMailMasterBase> findMailInfo(String mailUId) throws Exception {
		String hql = "from YxySendMailMasterBase where mail_uid = '"+mailUId+"'";
		return yxysendmailmasterbasedao.findByHql(hql);
		
	}
	
	private YxyUserInfoDao yxyuserinfodao;
	private YxyReadingInfoDao yxyreadinginfodao;//点读dao
	private YxyReadingCountDao yxyreadingcountdao;//统计dao
	private YxyUnsubscribeInfoDao yxyunsubscribeinfodao;//退订dao
	private YxySendMailMasterBaseDao yxysendmailmasterbasedao;//邮件基本信息dao
	private YxySendMailDetailDao yxysendmaildetaildao;//邮件地址实体dao
	public YxyUserInfoDao getYxyuserinfodao() {
		return yxyuserinfodao;
	}
	public void setYxyuserinfodao(YxyUserInfoDao yxyuserinfodao) {
		this.yxyuserinfodao = yxyuserinfodao;
	}
	public YxySendMailDetailDao getYxysendmaildetaildao() {
		return yxysendmaildetaildao;
	}
	public void setYxysendmaildetaildao(YxySendMailDetailDao yxysendmaildetaildao) {
		this.yxysendmaildetaildao = yxysendmaildetaildao;
	}
	public YxyReadingInfoDao getYxyreadinginfodao() {
		return yxyreadinginfodao;
	}
	public void setYxyreadinginfodao(YxyReadingInfoDao yxyreadinginfodao) {
		this.yxyreadinginfodao = yxyreadinginfodao;
	}
	public YxyReadingCountDao getYxyreadingcountdao() {
		return yxyreadingcountdao;
	}
	public void setYxyreadingcountdao(YxyReadingCountDao yxyreadingcountdao) {
		this.yxyreadingcountdao = yxyreadingcountdao;
	}
	public YxyUnsubscribeInfoDao getYxyunsubscribeinfodao() {
		return yxyunsubscribeinfodao;
	}
	public void setYxyunsubscribeinfodao(YxyUnsubscribeInfoDao yxyunsubscribeinfodao) {
		this.yxyunsubscribeinfodao = yxyunsubscribeinfodao;
	}
	public ArrayList<Object> findReadCount() throws Exception {
		return null;
	}
	public YxySendMailMasterBaseDao getYxysendmailmasterbasedao() {
		return yxysendmailmasterbasedao;
	}
	public void setYxysendmailmasterbasedao(
			YxySendMailMasterBaseDao yxysendmailmasterbasedao) {
		this.yxysendmailmasterbasedao = yxysendmailmasterbasedao;
	}
}