📄 smsdao.java
字号:
package gov.gdlt.ssgly.taxcore.taxdao.rwgl;
import java.sql.*;
import java.util.*;
import com.ibatis.sqlmap.client.*;
import gov.gdlt.ssgly.taxcore.comm.config.*;
import gov.gdlt.ssgly.taxcore.comm.servicelocator.*;
import java.math.BigDecimal;
import gov.gdlt.ssgly.taxcore.taxevent.rwgl.RWGLrwmxVO;
import gov.gdlt.ssgly.taxweb.comm.util.WebUtil;
import gov.gdlt.ssgly.taxcore.taxevent.rwgl.RWGLclrwReqEvent;
public class SmsDao {
public String i_ToNetID;
public String i_RawMsg;
public String o_CutedMsg;
public BigDecimal o_ErrCode;
public String o_ErrMsg;
public SqlMapClient sqlMap;
private String fs_zt="成功";
public SmsDao() {
}
protected SqlMapClient getSqlMapClient() {
this.sqlMap = SqlMapLocator.getInstance().getSqlMapClient();
return this.sqlMap;
}
/**
* 取得当前SqlMap使用的连接
* @return Connection
* 非空:当前的连接
* NULL:当前还没有可用连接
* @throws SQLException
*/
protected Connection getSmsConnection() throws SQLException {
Connection conn = JDBCLocator.getInstance().getSmsJDBCConnection();
this.getSqlMapClient();
sqlMap.setUserConnection(conn);
return conn;
}
protected Connection getJDBCConnection() throws SQLException {
Connection conn = JDBCLocator.getInstance().getJDBCConnection();
this.getSqlMapClient();
sqlMap.setUserConnection(conn);
return conn;
}
protected List selectAll(String id, Object paramObj) throws Exception {
List list = null;
Connection connection = null;
try {
connection = this.getJDBCConnection();
list = sqlMap.queryForList(id, paramObj);
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (connection != null) {
connection.close();
}
} catch (SQLException e) {
}
}
return list;
}
protected Object save(String id, Object o) throws Exception {
Object generatedKey = null;
Connection connection = null;
try {
connection = this.getSmsConnection();
generatedKey = sqlMap.insert(id, o);
connection.commit();
} catch (SQLException e) {
e.printStackTrace();
try {
if (connection != null) {
connection.rollback();
}
} catch (SQLException ex) {
}
return new Integer(ApplicationContext.RET_FAIL);
} finally {
try {
if (connection != null) {
connection.close();
}
} catch (SQLException e) {
}
}
return generatedKey;
}
protected Object save2(String id, Object o) throws Exception {
Object generatedKey = null;
Connection connection = null;
try {
connection = this.getJDBCConnection();
generatedKey = sqlMap.insert(id, o);
connection.commit();
} catch (SQLException e) {
e.printStackTrace();
try {
if (connection != null) {
connection.rollback();
}
} catch (SQLException ex) {
}
return new Integer(ApplicationContext.RET_FAIL);
} finally {
try {
if (connection != null) {
connection.close();
}
} catch (SQLException e) {
}
}
return generatedKey;
}
protected Object select(String id, Object paramObj) throws Exception {
Object obj = null;
this.getSqlMapClient(); //获取SqlMap对象
Connection connection = null;
try {
connection = this.getSmsConnection();
obj = sqlMap.queryForObject(id, paramObj);
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (connection != null) {
connection.close();
}
} catch (SQLException e) {
}
}
return obj;
}
public String[] cutSms(String netType, String msg) {
String proc = "{call proc_smstax_cutmsg(?,?,?,?,?)}";
String[] retuslt = null;
Connection conn = null;
try {
conn = this.getSmsConnection();
CallableStatement cstmt = conn.prepareCall(proc);
cstmt.setString(1, netType);
cstmt.setString(2, msg);
cstmt.registerOutParameter(3, Types.VARCHAR);
cstmt.registerOutParameter(4, Types.NUMERIC);
cstmt.registerOutParameter(5, Types.VARCHAR);
cstmt.execute();
String cutMsg = cstmt.getString(3);
int errCode = cstmt.getInt(4);
String errMsg = cstmt.getString(5);
retuslt = cutMsg.split("<cut>");
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (conn != null) {
conn.close();
}
} catch (SQLException e) {
}
}
return retuslt;
}
public String getI_RawMsg() {
return i_RawMsg;
}
public String getI_ToNetID() {
return i_ToNetID;
}
public String getO_CutedMsg() {
return o_CutedMsg;
}
public BigDecimal getO_ErrCode() {
return o_ErrCode;
}
public String getO_ErrMsg() {
return o_ErrMsg;
}
public void setO_ErrMsg(String O_ErrMsg) {
this.o_ErrMsg = O_ErrMsg;
}
public void setO_ErrCode(BigDecimal o_ErrCode) {
this.o_ErrCode = o_ErrCode;
}
public void setO_CutedMsg(String O_CutedMsg) {
this.o_CutedMsg = O_CutedMsg;
}
public void setI_ToNetID(String I_ToNetID) {
this.i_ToNetID = I_ToNetID;
}
public void setI_RawMsg(String I_RawMsg) {
this.i_RawMsg = I_RawMsg;
}
public String[] getSplitString(String NetID, String Msg) throws Exception {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -