servicedetailaction.java

来自「电信计费项目 该系统在Sun Solaris下开发,运行于Apache Tom」· Java 代码 · 共 102 行

JAVA
102
字号
package com.tarena.netctoss.controller.actions;import org.apache.struts.actions.MappingDispatchAction;import org.apache.struts.action.*;import java.util.*;import com.tarena.netctoss.model.biz.IServerDetailService;import com.tarena.netctoss.model.biz.ServiceFactory;import com.tarena.netctoss.model.biz.entity.Admin;import com.tarena.netctoss.model.biz.entity.ManagerModel;import javax.servlet.http.*;public class ServiceDetailAction extends MappingDispatchAction {		public ActionForward findAllByMonth(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response){		ActionForward forward = mapping.findForward("fail");		IServerDetailService service = ServiceFactory.getServerDetailServiceImpl();		int year = Integer.parseInt(request.getParameter("year"));		int month = Integer.parseInt(request.getParameter("month"));		HttpSession session = request.getSession(false);		try {//			if(session.getAttribute("type").equals("admin") && getAdminModel((Admin)session.getAttribute("login_user"))){//                    if(session.getAttribute("type").equals("admin")){                    List list = service.findAllByMonth(year, month);				request.setAttribute("list", list);				request.setAttribute("year", year);				request.setAttribute("month", month);				forward = mapping.findForward("success");//			}		} catch (RuntimeException e) {			e.printStackTrace();			throw new ServiceDetaiException();		}		return forward;	}		public ActionForward findByMonth(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response){		ActionForward forward = null;		IServerDetailService service = ServiceFactory.getServerDetailServiceImpl();		int year = Integer.parseInt(request.getParameter("year"));		int month= Integer.parseInt(request.getParameter("month"));		String lab_ip = request.getParameter("lab_ip");		try {			List list = service.findByMonth(year, month, lab_ip);			request.setAttribute("list", list);			request.setAttribute("month", month);			request.setAttribute("year", year);			request.setAttribute("lab_ip", lab_ip);			forward = mapping.findForward("success");		} catch (RuntimeException e) {			e.printStackTrace();			throw new ServiceDetaiException();		}		return forward;	}		public ActionForward findALlByYear(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response){		ActionForward forward = null;		IServerDetailService service = ServiceFactory.getServerDetailServiceImpl();		int year = Integer.parseInt(request.getParameter("year"));		try {			List list = service.findAllByYear(year);			request.setAttribute("list", list);			request.setAttribute("year", year);			forward = mapping.findForward("success");		} catch (RuntimeException e) {			e.printStackTrace();			throw new ServiceDetaiException();		}		return forward;	}		public ActionForward findByYear(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response){		ActionForward forward = null;		IServerDetailService service = ServiceFactory.getServerDetailServiceImpl();		int year = Integer.parseInt(request.getParameter("year"));		String lab_ip=request.getParameter("lab_ip");		try {			List list = service.findByYear(year,lab_ip);			request.setAttribute("list", list);			request.setAttribute("year", year);			request.setAttribute("lab_ip", lab_ip);			forward = mapping.findForward("success");		} catch (RuntimeException e) {			e.printStackTrace();			throw new ServiceDetaiException();		}		return forward;	}		private boolean getAdminModel(Admin admin){		Set<ManagerModel> models = admin.getModels();		for(ManagerModel model:models){			if(model.getName().equals("�ʵ�����")){				return true;			}		}		return false;	}}

⌨️ 快捷键说明

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