/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.itstar.email.struts.action;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.actions.DispatchAction;
import com.itstar.email.dao.SendEmailDao;
import com.itstar.email.dao.TxunluDao;
import com.itstar.email.dao.UserDao;
import com.itstar.email.dao.imple.CallbackDaoImple;
import com.itstar.email.dao.imple.RecEmailDaoImple;
import com.itstar.email.dao.imple.SendEmailDaoImple;
import com.itstar.email.dao.imple.SaveBoxDaoImple;
import com.itstar.email.dao.imple.TxunluDaoImple;
import com.itstar.email.dao.imple.UserDaoImple;
import com.itstar.email.po.RecEmailBean;
import com.itstar.email.po.SendEmailBean;
import com.itstar.email.po.TxunluBean;
import com.itstar.email.po.UserBeen;
import com.itstar.email.util.Calculate;
import com.itstar.email.util.Pagination;
/**
* MyEclipse Struts
* Creation date: 08-06-2008
*
* XDoclet definition:
* @struts.action validate="true"
*/
public class RecAction extends DispatchAction {
private SendEmailDaoImple dao = new SendEmailDaoImple();
private RecEmailDaoImple Re=new RecEmailDaoImple();
private SaveBoxDaoImple save1=new SaveBoxDaoImple();
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward all(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
String z=request.getParameter("z");
String S_id=request.getParameter("r_id");
Map map=new HashMap();
if(z.equals("1")){
map.put("R_id", S_id);
RecEmailDaoImple recEmailDaoImple=new RecEmailDaoImple();
recEmailDaoImple.stat(S_id);
List userlist=recEmailDaoImple.queryArray(map);
request.setAttribute("userlist", userlist);
return mapping.findForward("fff");
}else if(z.equals("2")){
map.put("S_id", S_id);
SendEmailDaoImple sendEmailDaoImple=new SendEmailDaoImple();
List userlist=sendEmailDaoImple.queryArray(map);
request.setAttribute("userlist", userlist);
return mapping.findForward("ggg");
}else if(z.equals("3")){
map.put("C_id", S_id);
CallbackDaoImple callbackDaoImple=new CallbackDaoImple();
List userlist=callbackDaoImple.queryArray(map);
request.setAttribute("userlist", userlist);
return mapping.findForward("hhh");
}else if(z.equals("4")){
map.put("sid", S_id);
SaveBoxDaoImple saveBoxDaoImple=new SaveBoxDaoImple();
List userlist=saveBoxDaoImple.queryArray(map);
request.setAttribute("userlist", userlist);
return mapping.findForward("iii");
}
return null;
}
public ActionForward xin(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
HttpSession sess = request.getSession();
String username = (String)sess.getAttribute("session_uname");
//System.out.println(username);
if(username.equals("")||username==null)
{
request.setAttribute("info", "操作失败!");
return mapping.findForward("fail");
}
Map map=new HashMap();
map.put("r_name",username);
map.put("R_stat", "1");
RecEmailDaoImple recdao = new RecEmailDaoImple();
//总记录数
int size = recdao.findCountByMap(map);
//System.out.println(size+"****************2");
//创建Pagination的对象
Pagination pagination = new Pagination();
// 设置每页显示数
pagination.setMessage_pagesize(10);
// 查询数据总数
pagination.setMessageCount(size);
// 将request参数设值到pagination对象中去
pagination.setPageNo(request);
//System.out.println(pagination.getPageNo()+"****************3");
List recList = new ArrayList();
//获取分页查询结果userList
recList = recdao.findByMap(map,pagination.getPageNo(),pagination.getMessage_pagesize());
//把查询结果userList放在request
System.out.println(recList.size()+"==========");
request.setAttribute("recList", recList);
//把pagination对象 放在request
request.setAttribute("pagination", pagination);
return mapping.findForward("mmm");
}
public ActionForward query(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
HttpSession sess = request.getSession();
String username = (String)sess.getAttribute("session_uname");
//System.out.println(username);
if(username.equals("")||username==null)
{
request.setAttribute("info", "操作失败!");
return mapping.findForward("fail");
}
Map map=new HashMap();
map.put("r_name",username);
RecEmailDaoImple recdao = new RecEmailDaoImple();
//总记录数
int size = recdao.findCountByMap(map);
//System.out.println(size+"****************2");
//创建Pagination的对象
Pagination pagination = new Pagination();
// 设置每页显示数
pagination.setMessage_pagesize(10);
// 查询数据总数
pagination.setMessageCount(size);
// 将request参数设值到pagination对象中去
pagination.setPageNo(request);
//System.out.println(pagination.getPageNo()+"****************3");
List recList = new ArrayList();
//获取分页查询结果userList
recList = recdao.findByMap(map,pagination.getPageNo(),pagination.getMessage_pagesize());
//把查询结果userList放在request
System.out.println(recList.size()+"==========");
request.setAttribute("recList", recList);
//把pagination对象 放在request
request.setAttribute("pagination", pagination);
return mapping.findForward("sss");
}
public ActionForward caogao(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
HttpSession sess = request.getSession();
String username = (String)sess.getAttribute("session_uname");
//System.out.println(username+"****************");
//判断用户名是否为空
if(username.equals("")||username==null)
{
request.setAttribute("info", "操作失败!");
return mapping.findForward("fail");
}
Map map=new HashMap();
map.put("ssender",username);
SaveBoxDaoImple sendao = new SaveBoxDaoImple();
//总记录数
int size = sendao.findCountByMap(map);
//System.out.println(size+"****************2");
//创建Pagination的对象
Pagination pagination = new Pagination();
// 设置每页显示数
pagination.setMessage_pagesize(10);
// 查询数据总数
pagination.setMessageCount(size);
// 将request参数设值到pagination对象中去
pagination.setPageNo(request);
//System.out.println(pagination.getPageNo()+"****************3");
List caogaoList = new ArrayList();
//获取分页查询结果userList
caogaoList = sendao.findByMap(map,pagination.getPageNo(),pagination.getMessage_pagesize());
//把查询结果userList放在request
request.setAttribute("caogaoList", caogaoList);
//把pagination对象 放在request
request.setAttribute("pagination", pagination);
//把数据返回到查询页
return mapping.findForward("eee");
}
public ActionForward yifasong(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
HttpSession sess = request.getSession();
String username = (String)sess.getAttribute("session_uname");