📄 moenginetwo.java~7~
字号:
package data;/** * Title: * Description: * Copyright: Copyright (c) 2002 * Company: * @author * @version 1.0 */import java.sql.*;import orderapp.*;import utilities.Utility;public class getContent { public long id; public ConnectionPool database; public String msg_id; public String service_type; public String bill_type; public String gateway_msg_id; public String src_terminal_id; public String source_name; public String registered_delivery; public String sqlQuery; public String sql; public String submitStr; public submit billContent; public int order_id; public String msg_fmt; public Utility Time; public String dest_number; public String wwwGateway; public String wwwSrcNumber; public String wwwDestNumber; public boolean result=false; public boolean rsBool=false; public boolean msg_idRight=false;//点播的msg_id是否正确 public String MaxRow; public ResultSet rsTmp; //获得费率 public getFee GetFee; public fee Fee; public getContent(){ Time=new Utility(); database=new ConnectionPool(); //获得最大row_id号 MaxRow="select row_id from mobile_bill order by row_id"; GetFee=new getFee(); } //www型 public synchronized void getParameter(String msg_id,String service_type,String bill_type,int order_id,String dest_number,String gateway,String wwwSrcNumber,String wwwDestNumber) { this.msg_id=msg_id; this.service_type=service_type; this.bill_type=bill_type; this.order_id=order_id;//没用了 this.dest_number=dest_number; this.wwwGateway=gateway; this.wwwSrcNumber =wwwSrcNumber; this.wwwDestNumber=wwwDestNumber; //费率 this.Fee=GetFee.get(service_type); try{ sqlQuery="select msg_type ,msg_content, pk_total,pk_number from mobile_content where service_type like '"+this.service_type+"' and msg_id = "+Integer.parseInt(this.msg_id) +" order by pk_number"; //System.out.println(this.msg_id); msg_idRight=true; } catch(Exception e){ msg_idRight=false; } } //非www型 public synchronized void getParameter(String msg_id,String service_type,String bill_type,String gateway_msg_id,String src_terminal_id,String registered_delivery,String source_name,String msg_fmt) { this.msg_id=msg_id; this.service_type=service_type; this.bill_type=bill_type; this.src_terminal_id =src_terminal_id; this.registered_delivery = registered_delivery; this.source_name=source_name; this.gateway_msg_id = gateway_msg_id;//MO中的msg_id,写mobile_bill表的gateway_msg_id 注 Mo中的msg_content中的内容为mobile_content表中的msg_id this.msg_fmt=msg_fmt; //this.order_id=order_id; //费率 this.Fee=GetFee.get(service_type); //System.out.println(service_type+"::::"); //System.out.println(this.Fee.fee_user_type+"::::"); try{ sqlQuery="select msg_type ,msg_content ,pk_total,pk_number from mobile_content where service_type like '"+this.service_type+"' and msg_id = "+Integer.parseInt(this.msg_id) +" order by pk_number"; //System.out.print(this.msg_id); msg_idRight=true; }catch(Exception e){ msg_idRight=false; } } public synchronized boolean insertSubmit(){ ResultSet rs=null; /* try{ rsTmp=database.executeQuery(MaxRow); rsTmp.last(); id=(long)rsTmp.getInt("row_id"); System.out.println("---"+id); rsTmp.close(); } catch(Exception e){ id=0; e.printStackTrace(); } */ //id++; try{ rs=database.executeQuery(sqlQuery); rsBool=rs.next();//sure have rs rs.beforeFirst(); //System.out.print(rsBool); } catch(Exception e){ rsBool=false; } if(!rsBool||!msg_idRight){//MO信息点播错误的内容(包括www的)不加入mobile_bill表 submitStr="<cmpp_submit><source><name>1</name><guid>1001</guid></source><destination><name>standard</name></destination><src_terminal_id>5988</src_terminal_id><dest_terminal_id>13910139946</dest_terminal_id><msg_fmt>15</msg_fmt><tp_pid>0</tp_pid><tp_udhi>0</tp_udhi><registered_delivery>0</registered_delivery><service_id>DJSD</service_id><fee_user_type>0</fee_user_type><fee_type>02</fee_type><fee_code>000010</fee_code><msg_content>"+Config.error+"</msg_content></cmpp_submit>\r\n"; Config.submit_queue.push(submitStr); result=false; } if(rsBool&&msg_idRight){//点播正确的内容 try{ while(rs.next()){ Content.msg_fmt=rs.getString("msg_type"); Content.msg_content =rs.getString("msg_content"); Content.pk_t=rs.getInt("pk_total"); Content.pk_n =rs.getInt("pk_number"); //如果是www型定单 if(this.bill_type.equals("ww")){ //回写mobile_www_order的Sql语句****************************有错误!!!!!重发 //sql="update mobile_www_order set process_flag = 0 where order_id = "+this.order_id; //Config.sql_queue.push(sql); //要根据guid判断是否发送成功! //submitStr="<cmpp_submit><source><name></name><guid>"+(++id)+"</guid></source><destination><name>"+this.source_name+"</name></destination><src_terminal_id>"+Config.service_code+"</src_terminal_id><dest_terminal_id>"+this.src_terminal_id+"</dest_terminal_id><msg_fmt>"+Content.msg_fmt+"</msg_fmt><tp_pid>0</tp_pid><tp_udhi>0</tp_udhi><registered_delivery>"+this.registered_delivery+"</registered_delivery><service_id>DJSD</service_id><fee_user_type>0</fee_user_type><fee_type>02</fee_type><fee_code>000010</fee_code><msg_content>"+Content.msg_content+"</msg_content></cmpp_submit>\r\n"; submitStr="<cmpp_submit><source><name>1</name><guid>"+(++Config.id)+"</guid></source><destination><name>"+this.wwwGateway+"</name></destination><src_terminal_id>"+Config.service_code+"</src_terminal_id><dest_terminal_id>"+this.dest_number+"</dest_terminal_id><msg_fmt>"+Content.msg_fmt+"</msg_fmt><tp_pid>0</tp_pid><tp_udhi>0</tp_udhi><registered_delivery>0</registered_delivery><service_id>"+Fee.service_id+"</service_id><fee_user_type>"+Fee.fee_user_type+"</fee_user_type><fee_type>"+Fee.fee_type+"</fee_type><fee_code>"+Fee.fee_code+"</fee_code><msg_content>"+Content.msg_content+"</msg_content></cmpp_submit>\r\n"; Config.submit_queue.push(submitStr); //System.out.println(submitStr+"<<<<<<<"); billContent.msg_content=Content.msg_content; //billContent.dest_terminal_id ="13123123123"; //生成写mobile_content表的sql语句MT**不要收条 sql="insert into mobile_bill (row_id,msg_content,dest_terminal_id,bill_type,registered_delivery,gateway_route,src_terminal_id,msg_type,create_date,fee_user_type,fee_type,fee_code,pk_total,pk_number,service_id)values('"+(Config.id)+"','"+billContent.msg_content+"','"+this.wwwDestNumber+"','"+this.bill_type+"','"+"0"+"','"+this.wwwGateway+"','"+this.wwwSrcNumber+"','"+Content.msg_fmt+"','"+Time.getDateString()+" "+Time.getTimeString()+"',"+Fee.fee_user_type+","+Fee.fee_type+",'"+Fee.fee_code+"',"+Content.pk_t+","+Content.pk_n+",'"+Fee.service_id+"')"; Config.sql_queue.push(sql); /* //if(!this.bill_type.equals("ww")){ //生成写mobile_content表的sql语句MO sql="insert into mobile_bill (row_id,msg_content,dest_terminal_id,bill_type,gateway_msg_id,src_terminal_id,registered_delivery,gateway_route,msg_type,create_date)values('"+(++id)+"','"+this.msg_id+"','"+billContent.dest_terminal_id+"','Mo','"+this.gateway_msg_id+"','"+this.src_terminal_id+"','"+this.registered_delivery+"','"+this.source_name+"','"+this.msg_fmt+"','"+Time.getDateString()+" "+Time.getTimeString()+"')"; //Config.sql_queue.push(sql); //---------------------------------------------------------------------------- System.out.print(Time.getDateString()+" "+Time.getTimeString()); */ } else{ //要根据guid判断是否发送成功! //submitStr="<cmpp_submit><source><name></name><guid>"+(++id)+"</guid></source><destination><name>"+this.source_name+"</name></destination><src_terminal_id>"+Config.service_code+"</src_terminal_id><dest_terminal_id>"+this.src_terminal_id+"</dest_terminal_id><msg_fmt>"+Content.msg_fmt+"</msg_fmt><tp_pid>0</tp_pid><tp_udhi>0</tp_udhi><registered_delivery>"+this.registered_delivery+"</registered_delivery><service_id>DJSD</service_id><fee_user_type>0</fee_user_type><fee_type>02</fee_type><fee_code>000010</fee_code><msg_content>"+Content.msg_content+"</msg_content></cmpp_submit>\r\n"; submitStr="<cmpp_submit><source><name>1</name><guid>"+(++Config.id)+"</guid></source><destination><name>"+this.source_name+"</name></destination><src_terminal_id>"+Config.service_code+"</src_terminal_id><dest_terminal_id>"+this.src_terminal_id+"</dest_terminal_id><msg_fmt>"+Content.msg_fmt+"</msg_fmt><tp_pid>0</tp_pid><tp_udhi>0</tp_udhi><registered_delivery>"+this.registered_delivery+"</registered_delivery><service_id>"+Fee.service_id+"</service_id><fee_user_type>0</fee_user_type><fee_type>02</fee_type><fee_code>000010</fee_code><msg_content>"+Content.msg_content+"</msg_content></cmpp_submit>\r\n"; Config.submit_queue.push(submitStr); //System.out.println(submitStr+">>>>>>"); billContent.msg_content=Content.msg_content; //billContent.dest_terminal_id ="13123123123"; //生成写mobile_content表的sql语句MT sql="insert into mobile_bill (row_id,msg_content,dest_terminal_id,bill_type,registered_delivery,gateway_route,src_terminal_id,msg_type,create_date,fee_user_type,fee_type,fee_code,service_id,pk_total,pk_number,create_time)values('"+(Config.id)+"','"+billContent.msg_content+"','"+this.src_terminal_id+"','"+this.bill_type+"','"+this.registered_delivery+"','"+this.source_name+"','"+Config.service_code+"','"+Content.msg_fmt+"','"+Time.getDateString()+" "+Time.getTimeString()+"',"+Fee.fee_user_type+","+Fee.fee_type+",'"+Fee.fee_code+"','"+Fee.service_id+"',"+Content.pk_t+","+Content.pk_n+","+Time.createTime()+")"; Config.sql_queue.push(sql); billContent.msg_content=Content.msg_content; //billContent.dest_terminal_id ="13123123123"; //生成写mobile_content表的sql语句MT ////ql="insert into mobile_bill (row_id,msg_content,dest_terminal_id,bill_type,registered_delivery,gateway_route,src_terminal_id,msg_type,create_date)values('"+(id)+"','"+billContent.msg_content+"','"+this.src_terminal_id+"','"+this.bill_type+"','"+this.registered_delivery+"','"+this.source_name+"','"+Config.service_code+"','"+Content.msg_fmt+"','"+Time.getDateString()+" "+Time.getTimeString()+"')"; ////Config.sql_queue.push(sql); //if(!this.bill_type.equals("ww")){ //生成写mobile_content表的sql语句MO sql="insert into mobile_bill (row_id,msg_content,dest_terminal_id,bill_type,gateway_msg_id,src_terminal_id,registered_delivery,gateway_route,msg_type,create_date,pk_total,pk_number)values('"+(++Config.id)+"','"+this.msg_id+"','"+Config.service_code+"','Mo','"+this.gateway_msg_id+"','"+this.src_terminal_id+"','"+this.registered_delivery+"','"+this.source_name+"','"+this.msg_fmt+"','"+Time.getDateString()+" "+Time.getTimeString()+"',"+Content.pk_t+","+Content.pk_n+")"; Config.sql_queue.push(sql); //System.out.println(Config.service_code+"<><>"); //---------------------------------------------------------------------------- //System.out.print(Time.getDateString()+" "+Time.getTimeString()); } //打印mt内容 //System.out.print(submitStr+"submitStr"); } rs.close(); rs=null; //database.release() ; //database=null; result=true; } catch(Exception e){ e.printStackTrace(); } } return result; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -