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

📄 statistics.java

📁 短信网关发送接受平台。
💻 JAVA
字号:
package orderapp;/** * Title: * Description:Mo统计线程,写statistics表,按月 * Copyright:    Copyright (c) 2002 * Company: * @author * @version 1.0 */import utilities.Engine;import xml.getLabel;import java.sql.*;import data.*;import java.util.StringTokenizer;public class statistics extends Engine{       public String Mo;       public String msg_id;       public String service_type;       public String gateway;       public String www_order;       public int mo_order;       public String create_date;       public String content,contentOne,contentTwo;       public StringTokenizer StringT;       public String tmp;       public ConnectionPool data;       public ResultSet rs,rsTmp;       public boolean haveRs;  //     public String subcode;//       //public data.ConnectionPool data;       public String sql;       public String sqlQuery;       //public ResultSet rs;       public boolean hasRs;       public getLabel GetLabel;	public statistics() {	       data=new data.ConnectionPool();	       GetLabel=new getLabel();	}	public void run(){	/*		二级代码 msg_id : 11 13112312312或11			    service_type 598801 或0598801		非二级代码msg_id : 01 11 13112312312或 01 11			    service_type 5988 或05988	*/	       while(true){			if(!Config.MoStatistics.isEmpty()){				Mo=(String)Config.MoStatistics.pop();				//System.out.print(Mo+"||||||||");				//msg_id=toLowerCaseString(GetLabel.getString("msg_content",Mo),15);//内容\				content=toLowerCaseString(GetLabel.getString("msg_content",Mo),15);				StringT=new StringTokenizer(content," ");				tmp=GetLabel.getString("cmpp_deliver/destination_id",Mo);//目标号(特符号)			   if( tmp.length()== 6 || tmp.length()==7){			       //二级代码				if(tmp.startsWith("0")){					service_type=tmp.substring(5);				}else{					service_type=tmp.substring(4);				}				msg_id=content;			   }else{				//非二级代码				if(StringT.hasMoreElements()){					service_type=(String)StringT.nextElement();					msg_id =(String)StringT.nextElement();				}			   }			   System.out.println("\r\n"+"统计"+service_type+"%%%%%"+msg_id);				try{					rsTmp=data.executeQuery("select * from mobile_content where service_type='"+service_type+"' and msg_id="+msg_id+"");					if(rsTmp.next()){hasRs=true;}					else{hasRs=false;}					rsTmp=null;				}				catch(Exception e){						hasRs=false;				}				if(hasRs){					gateway=GetLabel.getString("cmpp_deliver/source/name",Mo);					mo_order=1;					create_date=utilities.Utility.getDateString();					//create_date=create_date.substring(0,7);					sqlQuery="select www_order,mo_order from mobile_content_statistics where service_type='"+service_type+"' and msg_id='"+msg_id+"' and create_date='"+create_date+"'and mo_order>0";					rs=data.executeQuery(sqlQuery);					try{						haveRs=rs.next();						//System.out.println(haveRs);					}catch(Exception e){						e.printStackTrace();					}					if(!haveRs){						sql="insert into mobile_content_statistics (msg_id,service_type,gateway,mo_order,create_date)values("+msg_id+",'"+service_type+"','"+gateway+"',"+mo_order+",'"+create_date+"')";						Config.sql_queue.push(sql);					}else{						sql="update mobile_content_statistics set mo_order=mo_order+1 where service_type='"+service_type+"' and msg_id='"+msg_id+"' and www_order=0 and create_date='"+create_date+"'";						Config.sql_queue.push(sql);					}				}			}			try{				rs=null;				Thread.sleep(100);			}			catch(Exception e){					e.printStackTrace();			}	       }	}	public static String toLowerCaseString(String hexStr,int msg_fmt){		String result="";		String temp;		int len=hexStr.length();		if (hexStr.startsWith("00")){			len=len/4;			for (int i=0;i<len;i++){				temp=hexStr.substring(i*4+2,i*4+4);				if (Integer.parseInt(temp,16) > 0x7a)					return result;				result+=(char)Byte.parseByte(temp,16);			}		}else{			len=len/2;			for (int i=0;i<len;i++){				temp=hexStr.substring(i*2,i*2+2);				if (Integer.parseInt(temp,16) > 0x7a)					return result;				result+=(char)Byte.parseByte(temp,16);			}		}		return result.toLowerCase();	}}

⌨️ 快捷键说明

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