⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lostaction.java

📁 做的是一个客户关系管理系统
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.accp.struts.action;

import java.io.IOException;
import java.sql.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.actions.DispatchAction;

import com.accp.dao.CstLost;
import com.accp.dao.SysUser;
import com.accp.inf.LostInf;

/** 
 * MyEclipse Struts
 * Creation date: 11-16-2008
 * 
 * XDoclet definition:
 * @struts.action path="/lost" name="lostForm" input="/form/lost.jsp" parameter="op" scope="request" validate="true"
 */
public class LostAction extends DispatchAction {
	/*
	 * Generated Methods
	 */

	/** 
	 * Method execute
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
private LostInf lostDAO;
	
	public LostInf getLostDAO() {
		return lostDAO;
	}
	public void setLostDAO(LostInf lostDAO) {
		this.lostDAO = lostDAO;
	}
	public ActionForward GetLost(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DynaActionForm lostsForm = (DynaActionForm) form;// TODO Auto-generated method stub
		HttpSession session = request.getSession();
		SysUser user = (SysUser)session.getAttribute("user");
		List list = null;
		//if(user.getSysRole().getRoleId() == 2 || user.getSysRole().getRoleId() == 4)
		//{
/*要修改的地方*/			list = lostDAO.GetLostByManagerId(1);
			if(list.size() != 0)
			{
				request.setAttribute("lost",list);
			}
			else
			{
				request.setAttribute("message","*暂时无流失客户信息可显示!*");
			}
	//	}
		//else
		//{
		//	request.setAttribute("message","*对不起,您没有查看流失客户信息的权限!*");
	//	}
		return mapping.findForward("lost");
	}
	public ActionForward ModifyLost(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DynaActionForm lostsForm = (DynaActionForm) form;// TODO Auto-generated method stub
		String id = request.getParameter("lostId");
		CstLost lost = lostDAO.GetLostById(id);
		String delay = request.getParameter("delay");
		lost.setLstDelay(lost.getLstDelay()+"</br>"+delay);
		lost.setLstLostDate(null);
		lost.setLstStatus("2");
		lostDAO.ModifyLost(lost);		
		try {
			response.sendRedirect("/CrmPrj/lost.do?op=GetLost");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
	public ActionForward GetLostById(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DynaActionForm lostsForm = (DynaActionForm) form;// TODO Auto-generated method stub
		String id = request.getParameter("lostId");
		String status = request.getParameter("status");
		CstLost lost = lostDAO.GetLostById(id);
		if(lost != null)
		{
			request.setAttribute("lost", lost);
		}
		if(status.equals("0"))
		{
			return mapping.findForward("lostRelay");
		}
		else
		{
			return mapping.findForward("lostConfirm");
		}
		
	}
	
	public ActionForward ModifyConfirm(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		// TODO Auto-generated method stub
		String id = request.getParameter("lostId");
		CstLost lost = lostDAO.GetLostById(id);
		String reason = request.getParameter("confirm");
		lost.setLstReason(reason);
		java.util.Date date = new java.util.Date();
		lost.setLstLostDate(date);
		lost.setLstStatus("3");
		lostDAO.ModifyLost(lost);		
		try {
			response.sendRedirect("/CrmPrj/lost.do?op=GetLost");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
	
	public ActionForward GetLostByLost(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		// TODO Auto-generated method stub
		DynaActionForm lostForm = (DynaActionForm) form;
		CstLost lost = (CstLost)lostForm.get("lost");
		if(lost != null)
		{
			List list = lostDAO.GetLostByLost(lost);
			if(list.size() > 0)
			{
				request.setAttribute("lost",list);
			}
			else
			{
				request.setAttribute("message","*暂时无流失客户信息可显示!*");
			}
		}
		else
		{
			this.GetLost(mapping, form, request, response);
		}
		return mapping.findForward("lost");
		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -