📄 logbo.java
字号:
} 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 platformflag 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 platformflag 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 where platformflag=1 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;
}
public String getWorkGroupByUserId(String UserId) throws Exception {
String[][] data = null;
String workgroup="";
try {
String sql = "select UserGroup from userinfo where userId='"+UserId+"'";
data = DBManager.getNewInstance("szhtp160").query(sql, -1, 1);
if (data.length>0)
{
workgroup=Tools.getRsString("UserGroup", data, 1, "");
}
System.out.println("获取工作组:" + UserId+":"+workgroup);
} catch (Exception e) {
System.out.println("Error in getWorkGroupByUserId:" + e);
return "无";
}
return workgroup;
}
//获取平台版本号
public String getVersion(String platformflag) throws Exception {
String[][] data = null;
String verno="";
try {
String sql = "select verno from b_ftpconfig where platformflag="+platformflag+"";
data = DBManager.getNewInstance("szhtp160").query(sql, -1, 1);
if (data.length>0)
{
verno=Tools.getRsString("verno", data, 1, "");
}
System.out.println("获取版本:" + platformflag+":"+verno);
} catch (Exception e) {
System.out.println("Error in getVersion:" + e);
return "";
}
return verno;
}
//比较平台版本号
public String checkVersion(String platformflag, String oldVerNo) throws Exception {
String[][] data = null;
String verno="";
String flag="FALSE";
try {
String sql = "select verno from b_ftpconfig where platformflag="+platformflag+"";
data = DBManager.getNewInstance("szhtp160").query(sql, -1, 1);
if (data.length>0)
{
verno=Tools.getRsString("verno", data, 1, "");
}
if (!"".equals(oldVerNo)&&!"".equals(verno)&&!verno.equals(oldVerNo)){
flag="TRUE";
}
else
{
flag="FALSE";
}
System.out.println("比较版本:" + oldVerNo+":"+verno+":"+flag);
} catch (Exception e) {
System.out.println("Error in checkVersion:" + e);
return "FALSE";
}
return flag;
}
//校验权限
public String checkRight(String userid, String roleid) throws Exception {
String[][] data = null;
String flag="FALSE";
try {
String sql = "select * from s_userroleid where userid='"+userid+"' and roleid="+roleid;
data = DBManager.getNewInstance("szhtp160").query(sql, -1, 1);
if (data.length>0)
{
flag="TRUE";
}
else
{
flag="FALSE";
}
System.out.println("校验权限:" + userid+":"+roleid+":"+flag);
} catch (Exception e) {
System.out.println("Error in checkRight:" + e);
return "FALSE";
}
return flag;
}
//加载快餐总机数据,用于便利中国
public String loadData() throws Exception {
String[][] data = null;
String str="";
try {
String sql = "select * from t_comphone where transtype=1";
data = DBManager.getNewInstance("szhtp160").query(sql, -1, 1);
for (int i = 1; i < data.length; i++)
{
str+=Tools.getRsString("centrexid", data, i, "")+",";
}
System.out.println("快餐企业总机:"+str);
} catch (Exception e) {
System.out.println("Error in loadComphoneData:" + e);
return "";
}
return str;
}
//获取主叫被叫地址,用于便利中国
public String getAddressByPhone(String Phone) throws Exception {
String[][] data = null;
String str="";
try {
String sql = "select * from GetIbData@ibss TB where acc_nbr ='"+Phone+"'";
data = DBManager.getNewInstance("szhtp160").query(sql, -1, 1);
if (data.length>0)
{
str=Tools.getRsString("addr_all", data, 1, "");
}
System.out.println("便利中国 电话:"+Phone+" 地址:"+str);
} catch (Exception e) {
System.out.println("Error in getAddressByPhone:" + e);
return "获取地址失败!";
}
return str;
}
//获取录音文件名,通过流水号
public String getRecordFileBySerialNo(String SerialNo) throws Exception {
String[][] data = null;
String str="";
try {
String sql = "select recordfilename from v_calllog_all where SerialNo ='"+SerialNo+"'";
data = DBManager.getNewInstance("szhtp160").query(sql, -1, 1);
if (data.length>0)
{
str=Tools.getRsString("recordfilename", data, 1, "");
}
System.out.println("录音文件 流水号:"+SerialNo+" 录音文件:"+str);
} catch (Exception e) {
System.out.println("Error in getRecordFileBySerialNo:" + e);
return "";
}
return str;
}
// 查找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 + -