amountnewquery_jsp.java
来自「jsp_javabean+tomcat的web管理系统!」· Java 代码 · 共 580 行 · 第 1/2 页
JAVA
580 行
package org.apache.jsp.query;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import msrv.GBCoding;
import msrv.NDate;
public final class amountNewQuery_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
public String getDateFormat(String str1){
if(str1.length()<2) return "0"+str1;
else return str1;
}
private static java.util.Vector _jspx_dependants;
static {
_jspx_dependants = new java.util.Vector(2);
_jspx_dependants.add("/query/../verifys.inc");
_jspx_dependants.add("/query/area.inc");
}
public java.util.List getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=gb2312");
pageContext = _jspxFactory.getPageContext(this, request, response,
"", true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write('\r');
out.write('\n');
msrv.PurviewVerify pv = null;
synchronized (_jspx_page_context) {
pv = (msrv.PurviewVerify) _jspx_page_context.getAttribute("pv", PageContext.PAGE_SCOPE);
if (pv == null){
pv = new msrv.PurviewVerify();
_jspx_page_context.setAttribute("pv", pv, PageContext.PAGE_SCOPE);
}
}
out.write('\r');
out.write('\n');
String msrvUserID="",projectID="",contextPath="",relativelyURI="",relativelyFile="";
if(session.getAttribute("msrvUserID")==null||session.getAttribute("msrvUserID").equals(""))
{
out.print("<script>alert('非法进入');window.location='main.jsp';window.parent.carnoc.location='left.jsp'</script>");
return;
}else{
msrvUserID=(String)session.getAttribute("msrvUserID");
contextPath=request.getContextPath();
relativelyURI=request.getRequestURI();
relativelyFile=relativelyURI.substring(contextPath.length()+1,relativelyURI.length());
}
pv.init(Integer.parseInt(msrvUserID),relativelyFile);
if(!pv.getViewPurview()){
out.print("<script>alert('你不具有此项权限,请与管理员联系!');</script>");
return;
}
out.write('\r');
out.write('\n');
msrv.NDBConn conn = null;
synchronized (_jspx_page_context) {
conn = (msrv.NDBConn) _jspx_page_context.getAttribute("conn", PageContext.PAGE_SCOPE);
if (conn == null){
conn = new msrv.NDBConn();
_jspx_page_context.setAttribute("conn", conn, PageContext.PAGE_SCOPE);
}
}
out.write('\r');
out.write('\n');
msrv.NewDBConn newconn = null;
synchronized (_jspx_page_context) {
newconn = (msrv.NewDBConn) _jspx_page_context.getAttribute("newconn", PageContext.PAGE_SCOPE);
if (newconn == null){
newconn = new msrv.NewDBConn();
_jspx_page_context.setAttribute("newconn", newconn, PageContext.PAGE_SCOPE);
}
}
out.write("\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
out.write("<title>无标题文档</title>\r\n");
out.write("<style type=\"text/css\">\r\n");
out.write("<!--\r\n");
out.write("body {\r\n");
out.write("\tmargin-left: 0px;\r\n");
out.write("\tmargin-top: 0px;\r\n");
out.write("\tmargin-right: 0px;\r\n");
out.write("\tmargin-bottom: 0px;\r\n");
out.write("}\r\n");
out.write(".style1 {color: #FFFFFF}\r\n");
out.write("-->\r\n");
out.write("</style>\r\n");
out.write("\r\n");
out.write("<script language=\"javascript\">\r\n");
out.write(" function formSub(){\r\n");
out.write(" if(document.srchForm.startDate.value==\"\")\r\n");
out.write("\t {\r\n");
out.write("\t alert(\"请输入起始时间!\");\r\n");
out.write("\t }else if(document.srchForm.endDate.value==\"\"){\r\n");
out.write("\t alert(\"请输入结束时间!\");\r\n");
out.write("\t }else{\r\n");
out.write(" document.srchForm.submit();\r\n");
out.write("\t document.body.innerHTML = \"<center><br><br><br>正在处理,请稍候...</center>\";\r\n");
out.write("\t }\r\n");
out.write(" }\r\n");
out.write("</script>\r\n");
out.write("<link href=\"../css/all.css\" rel=\"stylesheet\" type=\"text/css\">\r\n");
out.write("</head>\r\n");
out.write("\r\n");
out.write("<body>\r\n");
out.write('\r');
out.write('\n');
String startDate="",endDate="",startMinute="0",
endMinute="59",startHour="0",endHour="23",endYear="",
endMonth="",endDay="",gatewayType="",area="",groupBy="",direction="",
longCode="",uTelphone="",msg_content="";
String sDate="",eDate="",gateway="",sql="",subSql="",dataName="log_report.dbo.",mobileTableName="log_mobile_",xltTableName="log_xlt_";
String vTableNameSql="",newDate="",newDateStr="",sDateStr="",newTableName="";
ResultSet rs=null,vTableNameRs=null;
int sendSAmount=0,sendFAmount=0,sendNoSAmount=0,sendAmount=0,noSendAmount=0,
amount=0,days=0,vTableNameRows=0,year=0,month=0,day=0;
//页面默认时间
java.util.Date curDate=new java.util.Date();
year=curDate.getYear()+1900;
month=curDate.getMonth()+1;
day=curDate.getDate();
startDate+=Integer.toString(year);
if(month<10) startDate+="-0"+Integer.toString(month);
else startDate="-"+Integer.toString(month);
if(day<10) startDate+="-0"+Integer.toString(day);
else startDate+="-"+Integer.toString(day);
endDate=startDate;
if(request.getParameter("cntrl")!=null)
{
startDate=request.getParameter("startDate");
endDate=request.getParameter("endDate");
startMinute=request.getParameter("startMinute");
endMinute=request.getParameter("endMinute");
startHour=request.getParameter("startHour");
endHour=request.getParameter("endHour");
sDate=startDate+" "+startHour+":"+startMinute+":0";
eDate=endDate+" "+endHour+":"+endMinute+":59";
endYear=endDate.substring(0,4);
endMonth=endDate.substring(5,7);
endDay=endDate.substring(8,10);
groupBy=request.getParameter("groupBy");
direction=request.getParameter("direction");
longCode=request.getParameter("longCode").trim();
uTelphone=request.getParameter("uTelphone").trim();
gatewayType=request.getParameter("gatewayType");
area=request.getParameter("area");
msg_content=GBCoding.getStrFromISO(request.getParameter("msg_content")).trim();
if(Integer.parseInt(gatewayType)==0) gateway=area+"unicom";
else if(Integer.parseInt(gatewayType)==1) gateway=area+"cmcc";
else if(Integer.parseInt(gatewayType)==2) gateway=area+"xlt";
else if(Integer.parseInt(gatewayType)==3) gateway=area+"wt";
//if(!pv.getHandleGateway(gateway)){
// out.print("<script>alert('你不具有区域权限,请与管理员联系!');window.history.back();</script>");
// return;
//}
if(Integer.parseInt(direction)==1)
{
//下行查询 /////////////////////下行查询////////////////////////下行查询//////////////////////下行查询////////////////下行查询////////
//起止时间相差天数
days=NDate.dateDiff("dd",sDate,eDate);
String sysTableName="";
//验证表名是否存在///////////////////////////////////////////////////
vTableNameSql="select name from log_report.dbo.sysobjects where xtype='U' and PATINDEX('log_%',name)<>0";
try{
vTableNameRs=newconn.executeQuery(vTableNameSql);
}catch(SQLException ex){out.println(ex.getMessage());}
try{
while(vTableNameRs.next()){
sysTableName+=vTableNameRs.getString(1)+"|";
}
}catch(SQLException ex){out.println(ex.getMessage());}
finally{
if(vTableNameRs!=null){
vTableNameRs.close();
vTableNameRs=null;
}
}
//////////////////////////////////////////////////////////////////////
int l=0; //当找到第一个表时设置为一
for(int i=0;i<=days;i++){
vTableNameRows=0;
if(i!=0){
newDate=NDate.dateAdd("dd",i,sDate);
}else newDate=sDate;
newDateStr=Integer.toString(NDate.datePart("yy",newDate))+getDateFormat(Integer.toString(NDate.datePart("mm",newDate)))+getDateFormat(Integer.toString(NDate.datePart("dd",newDate)));
if(Integer.parseInt(gatewayType)==0||Integer.parseInt(gatewayType)==1){
newTableName=mobileTableName+newDateStr;
subSql="select count(case when report_state>0 and log_type=1 then id end),count(case when report_state<0 and log_type=1 then id end),count(case when report_state=0 and log_type=1 then id end),count(case when log_type=2 then id end) from "+dataName+newTableName+" where ih_gateway='"+gateway+"' and insert_time>'"+sDate+"' and insert_time<'"+eDate+"'";
if(!longCode.equals("")) subSql+=" and src_terminal_id='"+longCode+"'";
if(!uTelphone.equals("")) subSql+=" and dest_terminal_id='"+uTelphone+"'";
if(!msg_content.equals("")) subSql+=" and convert(varchar,msg_content) like '%"+msg_content+"%'";
}else if(Integer.parseInt(gatewayType)==2||Integer.parseInt(gatewayType)==3){
newTableName=xltTableName+newDateStr;
subSql="select count(case when report_state>0 and log_type=1 then id end),count(case when report_state<0 and log_type=1 then id end),count(case when report_state=0 and log_type=1 then id end),count(case when log_type=2 then id end) from "+dataName+newTableName+" where sGateway='"+gateway+"' and insert_time>'"+sDate+"' and insert_time<'"+eDate+"'";
if(!longCode.equals("")) subSql+=" and sSrcTermID='"+longCode+"'";
if(!uTelphone.equals("")) subSql+=" and sDestTermID='"+uTelphone+"'";
if(!msg_content.equals("")) subSql+=" and convert(varchar,sMsgContent) like '%"+msg_content+"%'";
}
if(sysTableName.indexOf(newTableName)!=-1) vTableNameRows=1;
if(vTableNameRows>0){
if(l>0) sql+=" union all ";
sql+=subSql;
l++;
}
}
//下行查询 /////////////////////下行查询////////////////////////下行查询//////////////////////下行查询////////////////下行查询////////
}else if(Integer.parseInt(direction)==0){
//上行查询 /////////////////////上行查询////////////////////////上行查询//////////////////////上行查询////////////////上行查询////////
sql="exec proc_amountQuery '"+gateway+"',"+gatewayType+",0,'"+longCode+"','"+uTelphone+"','"+msg_content+"','"+sDate+"','"+eDate+"',0";
//上行查询 /////////////////////上行查询////////////////////////上行查询//////////////////////上行查询////////////////上行查询////////
}
try{
if(Integer.parseInt(direction)==1){
rs=newconn.executeQuery(sql);
}else if(Integer.parseInt(direction)==0){
rs=conn.executeQuery(sql);
}
}catch(SQLException ex){out.println(ex.getMessage());}
if(rs!=null){
try{
while(rs.next()){
try{
if(Integer.parseInt(direction)==1){
sendSAmount+=rs.getInt(1);
sendFAmount+=rs.getInt(2);
sendNoSAmount+=rs.getInt(3);
noSendAmount+=rs.getInt(4);
}else if(Integer.parseInt(direction)==0) amount+=rs.getInt(1);
}catch(SQLException ex){out.println(ex.getMessage());}
}
if(Integer.parseInt(direction)==1) amount=sendSAmount+sendFAmount+sendNoSAmount+noSendAmount;
}catch(SQLException ex){out.println(ex.getMessage());}
finally{
rs.close();
rs=null;
}
}
}
out.write("\r\n");
out.write("<div id=popCal style=\"BORDER-RIGHT: 2px ridge; BORDER-TOP: 2px ridge; VISIBILITY: hidden; BORDER-LEFT: 2px ridge; WIDTH: 10px; BORDER-BOTTOM: 2px ridge; POSITION: absolute;z-index:100\">\r\n");
out.write("<iframe name=popFrame src=\"../common/PopCalendar.htm\" frameBorder=0 width=183 scrolling=no height=188></iframe>\r\n");
out.write("</div>\r\n");
out.write("<table width=\"100%\" height=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#808080\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td height=\"23\"> <span class=\"style1\">后台管理--数据查询--短信量</span></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td align=\"center\" valign=\"top\" bgcolor=\"#FFFFFF\"><br> <br> <table width=\"98%\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#CCCCCC\">\r\n");
out.write(" <tr bgcolor=\"#F2F2F2\">\r\n");
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?