qunfaresult_jsp.java
来自「jsp_javabean+tomcat的web管理系统!」· Java 代码 · 共 319 行
JAVA
319 行
package org.apache.jsp.megabusi.qunfa;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import msrv.NDate;
public final class qunfaResult_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("/megabusi/qunfa/../../verifys.inc");
_jspx_dependants.add("/megabusi/qunfa/../../verifyEdit.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("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\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');
//**********ÊÇ·ñ¾ßÓбà¼È¨ÏÞ****************************************************
if(!pv.getEditPurview()){
out.print("<script>alert('Äã²»¾ßÓдËÏîȨÏÞ£¬ÇëÓë¹ÜÀíÔ±ÁªÏµ£¡');</script>");
return;
}
//***************************************************************************
out.write('\r');
out.write('\n');
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\n");
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("<script language=\"javascript\">\r\n");
out.write(" var fLoad=false,nsLoad=false;\r\n");
out.write(" function showSendFailed(sid){\r\n");
out.write(" if(sendFail.style.display==\"none\"){\r\n");
out.write("\t sendFail.style.display=\"\"; \r\n");
out.write(" \t\tif(!fLoad){\r\n");
out.write(" \t window.sendFailFram.location=\"qunfaDetail.jsp?show=1&sid=\"+sid;\r\n");
out.write("\t\t fLoad=true;\r\n");
out.write("\t\t}\r\n");
out.write(" }else if(sendFail.style.display==\"\") sendFail.style.display=\"none\"; \r\n");
out.write(" }\r\n");
out.write(" function showNoSend(sid){\r\n");
out.write(" if(noSend.style.display==\"none\"){\r\n");
out.write(" noSend.style.display=\"\"; \r\n");
out.write("\t if(!nsLoad){\r\n");
out.write(" \t window.noSendFram.location=\"qunfaDetail.jsp?show=2&sid=\"+sid;\r\n");
out.write("\t\t nsLoad=true;\r\n");
out.write("\t\t}\r\n");
out.write("\t}else if(noSend.style.display==\"\") noSend.style.display=\"none\"; \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 qunfaSql="",sid="",longCode="",gateway="",msgContent="",startDate="",endDate="";
ResultSet qunfaRs=null;
if(request.getParameter("sid")!=null&&!request.getParameter("sid").equals("")){
sid=request.getParameter("sid");
}else{ out.println("<script>window.history.back();</script>");return;}
qunfaSql="select send_longcode,send_gateway,send_content,convert(varchar,send_startdate,120),convert(varchar,send_enddate,120) from tb_qunfa where send_id="+sid;
try{
qunfaRs=conn.executeQuery(qunfaSql);
}catch(SQLException ex){out.println(ex.getMessage());}
try{
while(qunfaRs.next()){
longCode=qunfaRs.getString(1);
gateway=qunfaRs.getString(2);
msgContent=qunfaRs.getString(3);
startDate=qunfaRs.getString(4);
endDate=qunfaRs.getString(5);
}
}catch(SQLException ex){out.println(ex.getMessage());}
finally{
if(qunfaRs!=null){
qunfaRs.close();
qunfaRs=null;
}
conn.closeStatement();
}
String sDate="",eDate="",sql="",subSql="",dataName="log_report.dbo.",
mobileTableName="log_mobile_",xltTableName="log_xlt_",mobileDeliverTable="mobile_deliver_",
xltDeliverTable="xlt_deliver_";
String gatewayType="",vTableNameSql="",newDate="",newDateStr="",sDateStr="",newTableName="";
ResultSet rs=null,vTableNameRs=null;
int vTableNameRows=0,sAmount=0,fAmount=0,nAmount=0,tAmount=0,noSendAmount=0,days=0;
sDate=startDate;
eDate=endDate;
//起止时间相差天数
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=conn.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;
}
conn.closeStatement();
}
//////////////////////////////////////////////////////////////////////
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(gateway.endsWith("cmcc")||gateway.endsWith("unicom")){
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(!msgContent.equals("")) subSql+=" and convert(varchar,msg_content) like '%"+msgContent+"%'";
subSql+=" and ih_gateway='"+gateway+"'";
}else if(gateway.indexOf("wt")!=-1||gateway.indexOf("xlt")!=-1){
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(!msgContent.equals("")) subSql+=" and convert(varchar,sMsgContent) like '%"+msgContent+"%'";
subSql+=" and sGateway='"+gateway+"'";
}
if(sysTableName.indexOf(newTableName)!=-1) vTableNameRows=1;
if(vTableNameRows>0){
if(l>0) sql+=" union all ";
sql+=subSql;
l++;
}
}
if(!sql.equals("")){
try{
rs=conn.executeQuery(sql);
}catch(SQLException ex){out.println(ex.getMessage());return;}
try{
while(rs.next()){
sAmount+=rs.getInt(1);
fAmount+=rs.getInt(2);
nAmount+=rs.getInt(3);
noSendAmount+=rs.getInt(4);
}
}catch(SQLException ex){out.println(ex.getMessage());return;}
finally{
if(rs!=null){
rs.close();
rs=null;
}
conn.closeStatement();
}
}else{out.println("<script>alert('你选择了无效的时间段!');</script>");}
out.write("\r\n");
out.write("<table width=\"98%\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#CCCCCC\">\r\n");
out.write(" <tr bgcolor=\"#F2F2F2\">\r\n");
out.write(" <td height=\"20\" colspan=\"3\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td width=\"82%\">群发结果</td>\r\n");
out.write(" <td width=\"18%\" align=\"right\"> </td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td width=\"28%\" height=\"17\" align=\"center\" bgcolor=\"#FFFFFF\">成 功 下发条数</td>\r\n");
out.write(" <td width=\"72%\" colspan=\"2\" align=\"center\" bgcolor=\"#FFFFFF\"> ");
out.print(sAmount);
out.write("</td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td height=\"17\" onClick=\"showSendFailed(");
out.print(sid);
out.write(")\" class=\"mouse\" title=\"点击查看详细错误\" align=\"center\" bgcolor=\"#FFFFFF\">失 败 下发条数</td>\r\n");
out.write(" <td colspan=\"2\" align=\"center\" bgcolor=\"#FFFFFF\"> ");
out.print(fAmount);
out.write("</td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr align=\"left\" bgcolor=\"#F2F2F2\" id=\"sendFail\" style=\"display:none\">\r\n");
out.write(" <td id=\"sendFailTD\" sfLoad=\"no\" height=\"20\" colspan=\"3\"><iframe frameborder=\"0\" height=\"0\" width=\"100%\" name=sendFailFram>Loading......</iframe></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td height=\"17\" align=\"center\" bgcolor=\"#FFFFFF\">不确定下发条数</td>\r\n");
out.write(" <td height=\"17\" colspan=\"2\" align=\"center\" bgcolor=\"#FFFFFF\">");
out.print(nAmount);
out.write("</td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td height=\"17\" onClick=\"showNoSend(");
out.print(sid);
out.write(")\" class=\"mouse\" title=\"点击查看详细错误\" align=\"center\" bgcolor=\"#FFFFFF\">丢弃发送的条数</td>\r\n");
out.write(" <td height=\"17\" colspan=\"2\" align=\"center\" bgcolor=\"#FFFFFF\"> ");
out.print(noSendAmount);
out.write("</td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr align=\"left\" bgcolor=\"#F2F2F2\" id=\"noSend\" style=\"display:none\">\r\n");
out.write(" <td height=\"20\" colspan=\"3\" id=\"noSendTD\"><iframe frameborder=\"0\" height=\"0\" width=\"100%\" name=noSendFram>Loading......</iframe></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td height=\"17\" align=\"center\" bgcolor=\"#FFFFFF\">总 下 行 条 数</td>\r\n");
out.write(" <td height=\"17\" colspan=\"2\" align=\"center\" bgcolor=\"#FFFFFF\"> ");
out.print(sAmount+fAmount+nAmount+noSendAmount);
out.write("</td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr bgcolor=\"F2F2F2\">\r\n");
out.write(" <td height=\"5\" colspan=\"3\"></td>\r\n");
out.write(" </tr>\r\n");
out.write("</table>\r\n");
conn.close();
out.write("\r\n");
out.write("</body>\r\n");
out.write("</html>\r\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?