📄 logmanagelisttag.java
字号:
/**
*
*/
package com.seavision.PermissionManage.tag;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
import com.seavision.PermissionManage.common.BaseTag;
import com.seavision.PermissionManage.components.CompanyManage;
import com.seavision.PermissionManage.components.DepartmentManage;
import com.seavision.PermissionManage.components.LogManage;
import com.seavision.PermissionManage.components.UserManage;
import com.seavision.PermissionManage.help.DaoFectory;
import com.seavision.PermissionManage.vo.CompanyVO;
import com.seavision.PermissionManage.vo.DepartmentVO;
import com.seavision.PermissionManage.vo.LogVO;
import com.seavision.PermissionManage.vo.UserVO;
/**
* @author qiao rong
* @date 2007-05-10
* @param null
* @function 日志列表tag
* 循环打印日志表内所有信息
* 循环打印公司列表,部门列表,操作者列表(放入下拉框以供选择)
*
*/
public class LogManageListTag extends BaseTag{
public int doStartTag() throws JspException {
this.initializeTag("LogManageListTag"); // 初始化类
try {
this.appendMessage("<root>");
UserVO loguser = (UserVO) this.getAttribute("loginUserBean"); // 得到登陆用户的信息
String message = (String) this.getAttribute("message"); // 得到request中的message对象
this.removeAttribute("message"); // 删除session中message的信息
if (!this.check(loguser)) { // 判断用户登陆信息是否存在
message = "您还没有登录或您离开系统时间太久,请重新登录";
String ResultMsg = "登陆失败";
// --系统提示信息--
this.appendMessage("<system>");
this.appendMessage("<appMessage>");
this.appendMessage("<message>" + message + "</message>");
this.appendMessage("<ResultMsg>" + ResultMsg + "</ResultMsg>");
this.appendMessage("</appMessage>");
this.appendMessage("</system>");
} // end if
else {
CompanyVO companyVO = new CompanyVO(); //公司vo,用于从list中取vo时的暂存
DepartmentVO departmentVO = new DepartmentVO(); //部门vo,用于从list中取vo时的暂存
UserVO userVO = new UserVO();
LogVO logVO_temp = null; //用于从list中取值的暂存,类型转换
List list_comp = new ArrayList();; //存放公司列表
List list_depart = new ArrayList();; //存放部门列表
List list_log = new ArrayList(); //存放用户列表
List list_user = new ArrayList();//存放操作者
//以下几个参数用于得到log列表,放入map中
String operator = ""; //操作者姓名
String companyId = ""; //公司ID
String departmentId = ""; //部门ID
String date = ""; //日期
String ip = ""; //ip
DepartmentManage departmentManage = DaoFectory.getDepantManage();
CompanyManage companyManage = DaoFectory.getCompanyManage();
UserManage userManage = DaoFectory.getUserManage();
list_comp = companyManage.getCompanyList();
System.out.println("list_comp=========================="+list_comp.size());
String params0 = " selected=\"0\"";
String params1 = " selected=\"1\"";
String companyID = this.getParameter("company");
departmentId = this.getParameter("department");
String userId = this.getParameter("user");
// System.out.println("companyID=====定============================"+companyID);
// System.out.println("departmentId=====定============================"+departmentId);
// System.out.println("userId=====定============================"+userId);
//
this.appendMessage("<companyList>");
for (int i = 0; i < list_comp.size(); i++) {
companyVO = (CompanyVO)list_comp.get(i);
if (companyVO == null)
companyVO = new CompanyVO();
this.appendMessage("<company>");
//System.out.println("companyID=====外============================"+companyID);
if (companyID.trim().equalsIgnoreCase(String.valueOf(companyVO.getCompanyId()))) {
System.out.println("companyID================================="+companyID);
System.out.println("companyID================================="+companyVO.getCompanyId());
this.appendMessage("<companyId" + params1 + ">" + companyID + "</companyId>");
} else {
this.appendMessage("<companyId" + params0 + ">" + companyVO.getCompanyId() + "</companyId>");
}
this.appendMessage("<companyName >" + companyVO.getCompanyName() + "</companyName>");
list_depart = departmentManage.getDepartmentList(String.valueOf(companyVO.getCompanyId()));
this.appendMessage("<departmentList>");
for (int j = 0; j < list_depart.size(); j++) {
departmentVO = (DepartmentVO)list_depart.get(j);
if (departmentVO == null)
departmentVO = new DepartmentVO();
this.appendMessage("<department>");
this.appendMessage(" <departmentId" + params0 + ">" + departmentVO.getDepartmentId() + "</departmentId>");
this.appendMessage("<departmentName >" + departmentVO.getDepartmentName() + "</departmentName>");
this.appendMessage("</department>");
}
this.appendMessage("</departmentList>");
this.appendMessage("</company>");
}
this.appendMessage("</companyList>");
this.appendMessage("<departmentList>");
for (int i = 0; i < list_comp.size(); i++) {
companyVO = (CompanyVO)list_comp.get(i);
//String str="";
list_depart = departmentManage.getDepartmentList(String.valueOf(companyVO.getCompanyId()));
//list_depart = departmentManage.getDepartmentList(str);
for (int j = 0; j < list_depart.size(); j++) {
departmentVO = (DepartmentVO)list_depart.get(j);
if (departmentVO == null)
departmentVO = new DepartmentVO();
departmentId = departmentId.trim();
this.appendMessage("<department>");
if (departmentId.equalsIgnoreCase(String.valueOf(departmentVO.getDepartmentId()))) {
// System.out.println("departmentId================================="+departmentId);
// System.out.println("departmentVO.getDepartmentId()================================="+departmentVO.getDepartmentId());
this.appendMessage("<departmentId" + " selected=\"1\""+">" + departmentVO.getDepartmentId() + "</departmentId>");
} else {
this.appendMessage("<departmentId" + " selected=\"0\""+">" + departmentVO.getDepartmentId() + "</departmentId>");
}
this.appendMessage("<departmentName>" + departmentVO.getDepartmentName() + "</departmentName>");
// System.out.println("companyVO.getCompanyId()========================="+companyVO.getCompanyId());
// System.out.println("departmentVO.getDepartmentId()========================="+departmentVO.getDepartmentId());
list_user = userManage.getUserList(String.valueOf(companyVO.getCompanyId()),String.valueOf(departmentVO.getDepartmentId()));
this.appendMessage("<userList>");
for (int ii = 0; ii < list_user.size(); ii++) {
userVO = (UserVO)list_user.get(ii);
if (userVO == null)
userVO = new UserVO();
this.appendMessage("<user>");
this.appendMessage(" <userId" + params0 + ">" + userVO.getUserId() + "</userId>");
this.appendMessage("<userName >" + userVO.getUserName() + "</userName>");
this.appendMessage("</user>");
}
this.appendMessage("</userList>");
this.appendMessage("</department>");
}}
this.appendMessage("</departmentList>");
this.appendMessage("<userList>");
for (int i = 0; i < list_comp.size(); i++) {
companyVO = (CompanyVO)list_comp.get(i);
list_depart = departmentManage.getDepartmentList(String.valueOf(companyVO.getCompanyId()));
for (int j = 0; j < list_depart.size(); j++) {
departmentVO = (DepartmentVO)list_depart.get(j);
list_user = userManage.getUserList(String.valueOf(companyVO.getCompanyId()),String.valueOf(departmentVO.getDepartmentId()));
for (int jj = 0; jj < list_user.size(); jj++) {
userVO = (UserVO)list_user.get(jj);
if (userVO == null)
userVO = new UserVO();
userId = userId.trim();
this.appendMessage("<user>");
// System.out.println("userId======外==========================="+userId);
// System.out.println("userVO.getUserId()==============外==================="+userVO.getUserId());
if (userId.trim().equalsIgnoreCase(String.valueOf(userVO.getUserId()))) {
// System.out.println("userId================================="+userId);
// System.out.println("userVO.getUserId()================================="+userVO.getUserId());
this.appendMessage("<userId" + " selected=\"1\""+">" + userVO.getUserId() + "</userId>");
} else {
this.appendMessage("<userId" + " selected=\"0\""+">" + userVO.getUserId() + "</userId>");
}
this.appendMessage("<userName>" + userVO.getUserName() + "</userName>");
this.appendMessage("</user>");
}
}
}
this.appendMessage("</userList>");
// operator = this.getParameter("user");
// companyId = this.getParameter("companyId");
// departmentId = this.getParameter("departmentId");
// this.setAttribute("operator",this.getParameter("user"));
// this.setAttribute("companyId",this.getParameter("companyId"));
// this.setAttribute("departmentId",this.getParameter("departmentId"));
//循环打印日志列表
String yy = (String)this.requestGetAttribute("yy");
// 循环打印日志列表
Map map=new HashMap();
operator = this.getParameter("user");
System.out.println("operator================================"+operator);
if(!operator.trim().equals("")){
userVO = userManage.getUser(operator);
operator = userVO.getUserName();
System.out.println("userVO.getUserName()================================"+operator);
}
// operator = this.getParameter("user");
companyId = this.getParameter("company");
departmentId = this.getParameter("department");
date = this.getParameter("data");
ip = this.getParameter("ip");
//Map map = new HashMap();
map.put("operator", operator);
map.put("companyId", companyId);
map.put("departmentId", departmentId);
map.put("logDate", date);
map.put("ipAddress", ip);
LogManage lg=DaoFectory.getLogManage();
list_log=lg.getLogListByCondition(map);
if (yy!=null&&yy!=""){
this.appendMessage("<orderList>");
for (int i = 0; i < list_log.size(); i++)
{
logVO_temp = (LogVO) list_log.get(i);
this.appendMessage("<order>");
this.appendMessage("<id>" + (i + 1) + "</id>"); //序号
this.appendMessage("<operator>"
+ logVO_temp.getOperator() + "</operator>");//操作者
this.appendMessage("<date>"
+ logVO_temp.getLogDate() + "</date>"); //date
this.appendMessage("<actionName>"
+ logVO_temp.getActionName() + "</actionName>");
this.appendMessage("<ip>"
+ logVO_temp.getIpAddress() + "</ip>");
this.appendMessage("<url>"
+ logVO_temp.getUrl() + "</url>");
this.appendMessage("</order>");
}
this.appendMessage("</orderList>");
}
else{
this.appendMessage("<orderList>");
this.appendMessage("<order>");
this.appendMessage("<id>" + "" + "</id>"); //序号
this.appendMessage("<operator>"
+ "" + "</operator>");//操作者
this.appendMessage("<date>"
+ "" + "</date>"); //date
this.appendMessage("<actionName>"
+ "" + "</actionName>");
this.appendMessage("<ip>"
+ "" + "</ip>");
this.appendMessage("<url>"
+ "" + "</url>");
this.appendMessage("</order>");
this.appendMessage("</orderList>");
}
}//end else
this.appendMessage("</root>");
this.outputMessage();
} catch (Exception ex) {
this.outputStandardErrorMessage();
ex.printStackTrace();
print("userlistTag出现异常");
} // end catch
return TagSupport.EVAL_BODY_INCLUDE; // 继续计算BODY体
} // end doStartTag method
public int doEndTag() throws JspException {
return EVAL_PAGE;
}// doEndTag method
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -