📄 togetherbean.java
字号:
+ " group by a.PROGRESSSTATE,c.areacode)Rpt"
+ " where Area.Citycode=City.Citycode"
+ " and Area.Areacode=Rpt.areacode"
+ str
+ " order By City.Cityname";
Object[] _object = new Object[6];
_object[0] = start;
_object[1] = end;
_object[2] = start;
_object[3] = realend;
_object[4] = start;
_object[5] = realend;
dt = _dac.executeQuery(sqlstr, _object);
}
} catch (Exception ex) {
FileLogger.getLogger().warn("数据库查询出错!", ex);
dt = null;
}
return dt;
}
/*
* 该函数用于查询系统的访问量
*/
public DataTable queryVisit(String start, String end, int pageNo) {
dt = null;
if (start == "" && end == "") {
start = "20050101";
end = "20080110";
}
try {
String sqlstr = "";
if (start != "" && end != "") {
String realend = checkDay(end);
sqlstr = " select r.cnt,r.logintype,r.siteid,r.NAMET,to_date(?,'YYYYMMDDHH24mi')||'~'||to_date(?,'YYYYMMDDHH24mi') btime "
+ " from (select t.*,rownum num from "
+ " (select count(*) cnt, a.logintype ,a.siteid,b.NAMET "
+ " from tl_clientlogin a ,td_tree b"
+ " where a.operatetime between to_date(?,'YYYYMMDDHH24mi') and to_date(?,'YYYYMMDDHH24mi') and a.siteid=b.treeid "
+ " group by a.logintype,a.siteid,b.NAMET order by a.siteid,b.namet)t)r where num>"
+ (pageNo - 1)
* pageSize
+ " and num<="
+ pageNo
* pageSize;
Object[] _object = new Object[4];
_object[0] = start;
_object[1] = end;
_object[2] = start;
_object[3] = realend;
dt = _dac.executeQuery(sqlstr, _object);
}
else {
String realend = checkDay(start);
sqlstr = "Select * From ( Select r.*,Rownum num,to_date(?,'YYMMDD') btime From (Select count(*) cnt, a.logintype ,a.siteid From TL_CLIENTLOGIN a"
+ " Where a.OPERATETIME Between to_date(?,'YYMMDD') And to_date(?,'YYMMDD')"
+ " group by a.logintype,a.siteid)r)t where num>"
+ (pageNo - 1)
* pageSize
+ " and num<="
+ pageNo
* pageSize;
Object[] _object = new Object[3];
_object[0] = start;
_object[1] = start;
//_object[2] = realend;
dt = _dac.executeQuery(sqlstr, _object);
}
} catch (Exception ex1) {
FileLogger.getLogger().warn("数据库查询出错!", ex1);
}
return dt;
}
public DataTable _queryVisit(String start,int pageNo) {
dt = null;
if (start == "" ) {
start = "20050101";
}
try {
String sqlstr = "";
if (start != "") {
//String realend = checkDay(end);
sqlstr = " select r.cnt,r.logintype,r.siteid,r.NAMET "
+ " from (select t.*,rownum num from "
+ " (select count(*) cnt, a.logintype ,a.siteid,b.NAMET "
+ " from tl_clientlogin a ,td_tree b"
+ " where a.siteid=b.treeid and to_char(a.operatetime,'YYYYMMDD')=? "
+ " group by a.logintype,a.siteid,b.NAMET order by a.siteid,b.namet)t)r where num>"
+ (pageNo - 1)
* pageSize
+ " and num<="
+ pageNo
* pageSize;
Object[] _object = new Object[1];
_object[0] = start;
//_object[1] = end;
//_object[2] = start;
//_object[3] = realend;
//System.out.println("sqlstr==>"+sqlstr);
dt = _dac.executeQuery(sqlstr, _object);
}
else {
String realend = checkDay(start);
sqlstr = "Select * From ( Select r.*,Rownum num From (Select count(*) cnt, a.logintype ,a.siteid From TL_CLIENTLOGIN a"
+ " Where to_char(a.operatetime,'YYYYMMDD')=?"
+ " group by a.logintype,a.siteid)r)t where num>"
+ (pageNo - 1)
* pageSize
+ " and num<="
+ pageNo
* pageSize;
Object[] _object = new Object[1];
_object[0] = start;
//_object[1] = start;
//_object[2] = realend;
dt = _dac.executeQuery(sqlstr, _object);
}
} catch (Exception ex1) {
FileLogger.getLogger().warn("数据库查询出错!", ex1);
}
return dt;
}
/**
* 该函数用于系统的时间段访问量页数查询
*/
public int getPageCount(String tablename, String start, String end) {
String sqlstr = "";
if (start == "" || end == "") {
start = "20050101";
end = "20080101";
}
if ("tl_clientlogin".equals(tablename)) {
sqlstr = "select count(*) count from"
+ " (select a.logintype ,a.siteid "
+ " from tl_clientlogin a "
+ " where a.operatetime between to_date(?,'YYYYMMDDHH24mi') and to_date(?,'YYYYMMDDHH24mi')"
+ " group by a.logintype,a.siteid)t ";
}
String realend = checkDay(end);
Object[] _object = new Object[2];
_object[0] = start;
_object[1] = realend;
dt = null;
try {
dt = _dac.executeQuery(sqlstr, _object);
int rowCount = 0;
rowCount = dt.getRow(0).getInt("count");
if (rowCount % pageSize == 0)
{pageCount = rowCount / pageSize;}
else
{pageCount = rowCount / pageSize + 1;}
} catch (Exception ex) {
FileLogger.getLogger().error(ex.getMessage().toString());
}
return pageCount;
}
/**
* 该函数用于系统的时间点访问量页数查询
*/
// public int _getPageCount(String tablename, String start) {
// String sqlstr = "";
// if (start == "" ) {
// start = "20050101";
// //end = "20080101";
// }
//
// if ("tl_clientlogin".equals(tablename)) {
// sqlstr = "select count(*) count from"
// + " (select a.logintype ,a.siteid "
// + " from tl_clientlogin a "
// + " where to_char(a.operatetime,'YYYYMMDD')=? "
// + " group by a.logintype,a.siteid)t ";
// }
// //String realend = checkDay(end);
// Object[] _object = new Object[2];
// _object[0] = start;
// //_object[1] = realend;
//
// dt = null;
// try {
//
// dt = _dac.executeQuery(sqlstr, _object);
// int rowCount = 0;
// rowCount = dt.getRow(0).getInt("count");
// if (rowCount % pageSize == 0)
// {pageCount = rowCount / pageSize;}
//
// else
// {pageCount = rowCount / pageSize + 1;}
//
// } catch (Exception ex) {
//
//
// FileLogger.getLogger().error(ex.getMessage().toString());
//
//
// }
// return pageCount;
// }
public String buildPageOptions(int pageCount, int pageNo) {
String optionHTML = "";
for (int i = 1; i <= pageCount; i++) {
if (pageNo == i || pageNo == 0)
optionHTML += "<option value='" + i + "' selected/>" + i;
else
optionHTML += "<option value='" + i + "'/>" + i;
}
return optionHTML;
}
/**
*
* @param enddate 是要加一天的日期String (YYYYMMDD)
* @return Date String
*/
public String checkDay(String enddate) {
String realdate = "";
int year = Integer.parseInt(enddate.substring(0, 4));
int month = Integer.parseInt(enddate.substring(4, 6));
int day = Integer.parseInt(enddate.substring(6, 8));
if (day >= 28) {
if (day == 28) {
if (month == 2 && year % 4 == 0
|| (year % 4 == 0 && year % 100 == 0))
day = day + 1;
else if (month == 2)
{month = month + 1;
day=1;
}
if (month != 2)
day = day + 1;
} else if (day == 29) {
if (month == 2 && year % 4 == 0
|| (year % 4 == 0 && year % 100 == 0))
{month = month + 1;
day=1;
}
else
day = day + 1;
} else if (day == 30) {
if (month == 1 || month == 3 || month == 5 || month == 7
|| month == 8 || month == 10 || month == 12)
day = day + 1;
else
{month = month + 1;
day=1;
}
} else {
if (month == 12) {
year = year + 1;
month = 1;
day = 1;
} else
{month = month + 1;
day=1;
}
}
}
else
day = day + 1;
realdate = String.valueOf(year);
if (month < 10)
realdate = realdate + "0" + String.valueOf(month);
else
realdate = realdate + String.valueOf(month);
if (day < 10)
realdate = realdate + "0" + String.valueOf(day);
else
realdate = realdate + String.valueOf(day);
return realdate;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -