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

📄 queinfobo.java

📁 日志管理源代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		}
		return flag;
	}
	public boolean addLogInfoEx(String logType, String content, String logUser,
			String ipAdd, String macAdd) throws Exception {
		boolean flag = false;
		try {
			String sql = "exec sp_InsertSysLogInfoEx '" + logType + "','"
					+ content + "','" + logUser + "','" + ipAdd + "','"
					+ macAdd + "'";
			flag = DBManager.getNewInstance("szhtp").update(sql);
		} catch (Exception e) {
			System.out.println("Error in addLogInfoEx:" + e);
		}
		return flag;
	}

	public boolean addLevel(String serial_no, String phone_nbr,
			String staff_id, int state) throws Exception {
		boolean flag = false;
		try {
			String sql = "exec sp_InsertSatisfyLevel '" + serial_no + "','"
					+ phone_nbr + "','" + staff_id + "'," + state;

			// System.out.println("sql:"+sql);
			flag = DBManager.getNewInstance("szhtp").update(sql);
		} catch (Exception e) {
			System.out.println("Error in addLevel:" + e);
		}
		return flag;
	}

	public boolean addLevelEx(String serial_no, String phone_nbr,
			String staff_id, int state, String serialno, String recordfilename,
			int findtime) throws Exception {
		boolean flag = false;
		try {
			String sql = "exec sp_InsertSatisfyLevelEx '" + serial_no + "','"
					+ phone_nbr + "','" + staff_id + "'," + state + ",'"
					+ serialno + "','" + recordfilename + "'," + findtime;

			//System.out.println("sql:"+sql);
			flag = DBManager.getNewInstance("szhtp").update(sql);
		} catch (Exception e) {
			System.out.println("Error in addLevelEx:" + e);
		}
		return flag;
	}

	public String getLogInfoSql(String sysType, String searchName,
			String searchType, String timeBegin, String timeEnd,String content,String ipAdd,String macAdd)
			throws Exception {
		String sql = "select a.*,b.name from V_SysLogInfo a ,logType b where a.logtype=b.code ";
		try {
			if (!searchType.equals("")
					|| (null != sysType && !sysType.equals(""))
					|| !searchName.equals("") || !timeBegin.equals("")
					|| !timeEnd.equals("")) {
				String querySql = "";
				if (!searchType.equals("")) {
					querySql += "and a.logtype ='" + searchType + "' ";
				}
				if (!searchName.equals("")) {
					querySql += "and a.logUser ='" + searchName + "' ";
				}
				if (!content.equals("")) {
					querySql += "and a.logcontent like '%" + content + "%' ";
				}
				if (!ipAdd.equals("")) {
					querySql += "and a.ipAdd like '%" + ipAdd + "%' ";
				}
				if (!macAdd.equals("")) {
					querySql += "and a.macAdd like '%" + macAdd + "%' ";
				}
				if (!timeBegin.equals("") && !timeEnd.equals("")) {
					timeEnd = DateUtil.addlongDate(timeEnd, 1);
					querySql += "and a.logtime between '" + timeBegin
							+ "' and '" + timeEnd + "' ";
				}
				if (!timeBegin.equals("") && timeEnd.equals("")) {
					querySql += "and a.logtime > '" + timeBegin + "' ";
				}
				if (timeBegin.equals("") && !timeEnd.equals("")) {
					timeEnd = DateUtil.addlongDate(timeEnd, 1);
					querySql += "and a.logtime < '" + timeEnd + "' ";
				}

				if (null != sysType && !sysType.equals("")) {
					if (sysType.equals("member")) {
						querySql += "and a.logtype in ('"
								+ Constant.HOTELDESTINE + "','"
								+ Constant.BIRDIICKETSPEAK + "') ";
					}
					if (sysType.equals("line")) {
						querySql += "and a.logtype between "
								+ Constant.ADD_GOVAFFINFO + " and "
								+ Constant.DEL_VOLUNTEERINFO + " ";
					}
					if (sysType.equals("destine")) {
						querySql += "and a.logtype in ('"
								+ Constant.SPORTDESTINE + "','"
								+ Constant.TICKETDESTINE + "') ";
					}
				}
				if (!querySql.equals("")) {
					sql = sql + querySql;
				}
			}
			if (timeBegin.equals("") && timeEnd.equals("")) {
				String time = DateUtil.getCurrentDateString();
				// time = DateUtil.addDate(time, -1);
				sql += " and a.logtime > '" + time + "' ";
			}
			sql += " order by logtime desc";

			//System.out.println("sql:" + sql);
		} catch (Exception e) {
			System.out.println("Error in getLogInfoSql:" + e);
		}
		return sql;
	}
	public String getLogInfoSqlEx(String sysType, String searchName,
			String searchType, String timeBegin, String timeEnd,String content,String ipAdd,String macAdd)
			throws Exception {
		String sql = "select a.*,b.name from V_SysLogInfo a ,logType b where a.logtype=b.code ";
		try {
			if (!searchType.equals("")
					|| (null != sysType && !sysType.equals(""))
					|| !searchName.equals("") || !timeBegin.equals("")
					|| !timeEnd.equals("")) {
				String querySql = "";
				if (!searchType.equals("")) {
					querySql += "and a.logtype ='" + searchType + "' ";
				}
				if (!searchName.equals("")) {
					querySql += "and a.logUser ='" + searchName + "' ";
				}
				if (!content.equals("")) {
					querySql += "and a.logcontent like '%" + content + "%' ";
				}
				if (!ipAdd.equals("")) {
					querySql += "and a.ipAdd like '%" + ipAdd + "%' ";
				}
				if (!macAdd.equals("")) {
					querySql += "and a.macAdd like '%" + macAdd + "%' ";
				}
				if (!timeBegin.equals("") && !timeEnd.equals("")) {
					timeEnd = DateUtil.addlongDate(timeEnd, 1);
					querySql += "and a.logtime between '" + timeBegin
							+ "' and '" + timeEnd + "' ";
				}
				if (!timeBegin.equals("") && timeEnd.equals("")) {
					querySql += "and a.logtime > '" + timeBegin + "' ";
				}
				if (timeBegin.equals("") && !timeEnd.equals("")) {
					timeEnd = DateUtil.addlongDate(timeEnd, 1);
					querySql += "and a.logtime < '" + timeEnd + "' ";
				}

				if (null != sysType && !sysType.equals("")) {
					if (sysType.equals("member")) {
						querySql += "and a.logtype in ('"
								+ Constant.HOTELDESTINE + "','"
								+ Constant.BIRDIICKETSPEAK + "') ";
					}
					if (sysType.equals("line")) {
						querySql += "and a.logtype between "
								+ Constant.ADD_GOVAFFINFO + " and "
								+ Constant.DEL_VOLUNTEERINFO + " ";
					}
					if (sysType.equals("destine")) {
						querySql += "and a.logtype in ('"
								+ Constant.SPORTDESTINE + "','"
								+ Constant.TICKETDESTINE + "') ";
					}
				}
				if (!querySql.equals("")) {
					sql = sql + querySql;
				}
			}
			if (timeBegin.equals("") && timeEnd.equals("")) {
				String time = DateUtil.getCurrentDateString();
				// time = DateUtil.addDate(time, -1);
				sql += " and a.logtime > '" + time + "' ";
			}
			//sql += " order by logtime desc";

			//System.out.println("sql:" + sql);
		} catch (Exception e) {
			System.out.println("Error in getLogInfoSqlEx:" + e);
		}
		return sql;
	}
	public String getLogInfoSqlToOutFile(String sysType, String searchName,
			String searchType, String timeBegin, String timeEnd,String content,String ipAdd,String macAdd)
			throws Exception {
		String sql = "select a.logcontent 日志内容,a.loguser 操作人," +
				"a.ipadd ip地址,a.macadd mac地址,a.logtime 时间,b.name 所属模块 from V_SysLogInfo a ,logType b where a.logtype=b.code ";
		try {
			if (!searchType.equals("")
					|| (null != sysType && !sysType.equals(""))
					|| !searchName.equals("") || !timeBegin.equals("")
					|| !timeEnd.equals("")) {
				String querySql = "";
				if (!searchType.equals("")) {
					querySql += "and a.logtype ='" + searchType + "' ";
				}
				if (!searchName.equals("")) {
					querySql += "and a.logUser ='" + searchName + "' ";
				}
				if (!content.equals("")) {
					querySql += "and a.logcontent like '%" + content + "%' ";
				}
				if (!ipAdd.equals("")) {
					querySql += "and a.ipAdd like '%" + ipAdd + "%' ";
				}
				if (!macAdd.equals("")) {
					querySql += "and a.macAdd like '%" + macAdd + "%' ";
				}
				if (!timeBegin.equals("") && !timeEnd.equals("")) {
					timeEnd = DateUtil.addlongDate(timeEnd, 1);
					querySql += "and a.logtime between '" + timeBegin
							+ "' and '" + timeEnd + "' ";
				}
				if (!timeBegin.equals("") && timeEnd.equals("")) {
					querySql += "and a.logtime > '" + timeBegin + "' ";
				}
				if (timeBegin.equals("") && !timeEnd.equals("")) {
					timeEnd = DateUtil.addlongDate(timeEnd, 1);
					querySql += "and a.logtime < '" + timeEnd + "' ";
				}

				if (null != sysType && !sysType.equals("")) {
					if (sysType.equals("member")) {
						querySql += "and a.logtype in ('"
								+ Constant.HOTELDESTINE + "','"
								+ Constant.BIRDIICKETSPEAK + "') ";
					}
					if (sysType.equals("line")) {
						querySql += "and a.logtype between "
								+ Constant.ADD_GOVAFFINFO + " and "
								+ Constant.DEL_VOLUNTEERINFO + " ";
					}
					if (sysType.equals("destine")) {
						querySql += "and a.logtype in ('"
								+ Constant.SPORTDESTINE + "','"
								+ Constant.TICKETDESTINE + "') ";
					}
				}
				if (!querySql.equals("")) {
					sql = sql + querySql;
				}
			}
			if (timeBegin.equals("") && timeEnd.equals("")) {
				String time = DateUtil.getCurrentDateString();
				// time = DateUtil.addDate(time, -1);
				sql += " and a.logtime > '" + time + "' ";
			}
			//sql += " order by logtime desc";

			// System.out.println("sql:" + sql);
		} catch (Exception e) {
			System.out.println("Error in getLogInfoSql:" + e);
		}
		return sql;
	}

	public String[][] getUserGroup() throws Exception {
		String[][] data = null;
		try {
			String sql = "select distinct usergroup from userinfo order by usergroup desc";
			data = DBManager.getNewInstance("szhtp").query(sql, -1, 1);
		} catch (Exception e) {
			System.out.println("Error in getUserGroup:" + e);
			return null;
		}
		return data;
	}

	public String[][] getUserType() throws Exception {
		String[][] data = null;
		try {
			String sql = "select distinct usertype from userinfo order by usertype desc";
			data = DBManager.getNewInstance("szhtp").query(sql, -1, 1);
		} catch (Exception e) {
			System.out.println("Error in getUserType:" + e);
			return null;
		}
		return data;
	}

	public String[][] getUserSkill() throws Exception {
		String[][] data = null;
		try {
			String sql = "select distinct userskill from userinfo order by userskill desc";
			data = DBManager.getNewInstance("szhtp").query(sql, -1, 1);
		} catch (Exception e) {
			System.out.println("Error in getUserSkill:" + e);
			return null;
		}
		return data;
	}

	// 查找sysloginfo表
	public String getSysLogInfoSql(String logContent, String logUser,
			String timeBegin, String timeEnd) throws Exception {
		String sql = "select * from V_SysLogInfo where logtype=1101 ";
		try {
			String querySql = "";
			if (!logContent.equals("")) {
				querySql += "and logcontent like '%" + logContent + "%' ";
			}
			if (!logUser.equals("")) {
				querySql += "and loguser ='" + logUser + "' ";
			}
			if (!timeBegin.equals("") && !timeEnd.equals("")) {
				querySql += "and logtime between '" + timeBegin + "' and '"
						+ timeEnd + "' ";
			}
			if (!timeBegin.equals("") && timeEnd.equals("")) {
				querySql += "and logtime > '" + timeBegin + "' ";
			}
			if (timeBegin.equals("") && !timeEnd.equals("")) {
				querySql += "and logtime < '" + timeEnd + "' ";
			}

			if (!querySql.equals("")) {
				// querySql=querySql.substring(4, querySql.length());
				// querySql=" where "+querySql;
				sql = sql + querySql;
			}
			sql += " order by logtime desc";
		} catch (Exception e) {
			System.out.println("Error in getSysLogInfoSql:" + e);
		}
		return sql;
	}

}

⌨️ 快捷键说明

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