📄 scanbillthread.java
字号:
package orderapp;/** * Title: * Description: * 补发线程,扫描bill表 * Copyright: Copyright (c) 2002 * Company: * @author * @version 1.0 */import utilities.*;import data.ConnectionPool;import java.sql.*;import data.*;public class scanBillThread extends Engine{ public ConnectionPool database; public ConnectionPool dataUpdate; public ResultSet rs; public ResultSet rsUpdate; public String sqlQuery,sqlUpdate; //public getContent pushSubmit; public XmlString xml; public long time; Utility Timer; public String submit; //----------------- public long row_id; public String bill_type; public String service_id; public String src_terminal_id; public int registered_delivery; public int fee_user_type; public int fee_type; public String fee_code; public int agent_flag; public String given_value; public int mo_relate_to_mt; public int pk_total; public int pk_number; public String dest_terminal_id; public int msg_type; public String msg_content; public String gateway_route; public String gateway_msg_id; public int gateway_result; public int gateway_confirmed; public int gateway_status; public int ih_process; public int ih_retry; public String create_time; //----------------- public int msg_fmt; public int tp_pid; public int tp_udhi; public scanBillThread() { setDaemon(true); database=new ConnectionPool(); dataUpdate=new ConnectionPool(); Timer=new Utility(); // pushSubmit=new getContent(); } public void run(){ while(true){ try{ time=Timer.createTime()-Config.resendTime*1000; //System.out.print(time+"biao"); Thread.sleep(6000); }catch(Exception e){ e.printStackTrace(); } try{ /* 创建时间 是MT 无Response 在重发次数内 是包月 无Response 要收条 以确认 但未成功 在重发次数内 要收条 未确认 在重发次数内 */ sqlQuery="select * from mobile_bill where (create_time <"+time+") and (bill_type='mt') and ((gateway_result <> 0 and ih_retry>0) or (registered_delivery = 2 and gateway_result <> 0 ) or (registered_delivery = 1 and gateway_confirmed = 0 and gateway_status<>0 and ih_retry>0) or (registered_delivery = 1 and gateway_confirmed <> 0 and ih_retry>0))"; rs=database.executeQuery(sqlQuery); sqlUpdate="update mobile_bill set ih_retry = ih_retry-1,create_time="+time+" where row_id ="; while(rs.next()){ System.out.println("resend"); row_id=rs.getLong("row_id"); bill_type=rs.getString("bill_type"); service_id=rs.getString("service_id"); src_terminal_id = rs.getString("src_terminal_id"); registered_delivery = rs.getInt("registered_delivery"); fee_user_type=rs.getInt("fee_user_type"); fee_type=rs.getInt("fee_type"); fee_code=rs.getString("fee_code"); agent_flag=rs.getInt("agent_flag"); given_value=rs.getString("given_value"); mo_relate_to_mt=rs.getInt("mo_relate_to_mt"); pk_total=rs.getInt("pk_total"); pk_number=rs.getInt("pk_number"); dest_terminal_id=rs.getString("dest_terminal_id"); msg_type=rs.getInt("msg_type"); msg_content=rs.getString("msg_content"); gateway_route=rs.getString("gateway_route"); gateway_msg_id=rs.getString("gateway_msg_id"); gateway_result=rs.getInt("gateway_result"); gateway_confirmed=rs.getInt("gateway_confirmed"); gateway_status=rs.getInt("gateway_status"); msg_fmt=rs.getInt("msg_fmt"); tp_pid=rs.getInt("tp_pid"); tp_udhi=rs.getInt("tp_udhi"); // public int ih_process=rs.getInt("ih_p"); // public int ih_retry; //public String create_time; //pushSubmit.getParameter(String.valueOf(wwwOrder.msg_id),wwwOrder.service_type,"ww",wwwOrder.order_id,wwwOrder.dest_number,wwwOrder.gateway,wwwOrder.mobile_number,wwwOrder.dest_number); //pushSubmit.insertSubmit(); //更新mobile_www_order表 submit="<cmpp_submit><source><name>1</name><guid>"+row_id+"</guid></source><destination><name>"+gateway_route+"</name></destination><src_terminal_id>"+src_terminal_id+"</src_terminal_id><dest_terminal_id>"+dest_terminal_id+"</dest_terminal_id><msg_fmt>"+msg_fmt+"</msg_fmt><tp_pid>"+tp_pid+"</tp_pid><tp_udhi>"+tp_udhi+"</tp_udhi><registered_delivery>"+registered_delivery+"</registered_delivery><service_id>"+service_id+"</service_id><fee_user_type>"+fee_user_type+"</fee_user_type><fee_type>"+fee_type+"</fee_type><fee_code>"+fee_code+"</fee_code><msg_content>"+msg_content+"</msg_content></cmpp_submit>\r\n"; Config.submit_queue.push(submit); //System.out.println(submit); //更新数据库应在回应后,在get_response中更新 sqlUpdate+=row_id; dataUpdate.executeUpdate(sqlUpdate); } rs.close(); } catch(Exception e){ e.printStackTrace(); } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -