📄 wdscwdmbdao.java
字号:
//Source file: D:\\OLLA\\DS_WORK\\gzds-uml\\gov\\gdlt\\taxcore\\taxdao\\ssgly\\wdsc\\WDSCwdmbDAO.java
package gov.gdlt.ssgly.taxcore.taxdao.wdsc;
import java.sql.*;
import java.util.*;
import java.util.Date;
import com.ibatis.sqlmap.client.*;
import gov.gdlt.ssgly.taxcore.comm.config.*;
import gov.gdlt.ssgly.taxcore.comm.dao.*;
import gov.gdlt.ssgly.taxcore.comm.exception.*;
import gov.gdlt.ssgly.taxcore.comm.servicelocator.*;
import gov.gdlt.ssgly.taxcore.comm.log.LogWritter;
/**
* 文档模板
* 文档模板确定:模板名称、模板编码(主键)、模板内容、模板指标信息
* 模板取模板指标所执行的存储过程名称
*/
public class WDSCwdmbDAO extends BaseDataAccessObject
{
/*
MB_DM VARCHAR2(4) NOT NULL,
MB_MC VARCHAR2(80) NULL,
MB_NR BLOB NULL,
MB_LB VARCHAR2(1) NULL,
MB_ENABLE CHAR(1) NULL,
SCSJ TIMESTAMP(6) NULL,
MB_CZY VARCHAR2(11) NULL
*/
//private SqlMapClient sqlMap;
private String MB_DM, NEW_MB_DM;
private String MB_MC;
private Object MB_NR;
private String MB_LB, NEW_MB_LB;
private String MB_ENABLE;
private Date SCSJ;
private String MB_CZY;
private Vector MB_ZB_MSG;
private String MB_SWJG, NEW_MB_SWJG;
private StringBuffer MB_NR_BUFFER;
private int IS_EXIST;
LogWritter log = new LogWritter();
/**
* 模板名称
*/
private String m_mbmc;
/**
* 模板编码
*/
private String m_mbbm;
/**
* 模板内容
*/
private Object m_mbnr;
/**
* 文档模板指标信息
*/
private Vector m_mbzbmsg;
/**
* 模板文档指标的sql语句或存储过程名称
* 一个模板对应一条sql语句或一个存储过程,参数固定为纳税人编码
*/
private Object m_mbsql;
/**
* 模板类别。确定该文档的类别:1、一户式文档模板 2、其他文档模板
*/
private String m_mblb;
private Date m_mbscsj;
private String m_mbczy;
private String m_mbenable;
/**
* @roseuid 42D3371C0261
*/
public WDSCwdmbDAO()
{
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public List getWdMb(String swjg) throws Exception {
this.setMB_SWJG(swjg);
List list = new Vector();
Connection conn = null;
String sql = "";
try {
//sqlMap = this.getSqlMapClient();
//sqlMap.startTransaction();
//Connection conn = sqlMap.getCurrentConnection();
conn = JDBCLocator.getInstance().getJDBCConnection();
Statement stam = conn.createStatement();
try {
sql = "SELECT " +
" MB_DM, MB_MC, MB_NR, MB_LB, MB_ENABLE, SCSJ, MB_CZY, MB_SWJG " +
" FROM T_WDSC_WDMB " +
" WHERE MB_SWJG like '" + this.getMB_SWJG() + "'" +
" ORDER BY MB_DM, MB_LB ";
log.sysDebug("通过税务机关得到模板,sql=" + sql);
ResultSet res = stam.executeQuery(sql);
while (res.next()) {
WDSCwdmbDAO wdmb = new WDSCwdmbDAO();
wdmb.setMB_DM(res.getString("MB_DM"));
wdmb.setMB_MC(res.getString("MB_MC"));
wdmb.setMB_LB(res.getString("MB_LB"));
wdmb.setMB_ENABLE(res.getString("MB_ENABLE"));
wdmb.setSCSJ(res.getDate("SCSJ"));
wdmb.setMB_CZY(res.getString("MB_CZY"));
wdmb.setMB_SWJG(res.getString("MB_SWJG"));
list.add(wdmb);
}
res.close();
stam.close();
//sqlMap.commitTransaction();
} catch (Exception e) {
e.printStackTrace();
log.sysError(sql);
throw new Exception("YCWDSC21003");//:取文档模板失败!" + e.getMessage());
} finally {
//sqlMap.endTransaction();
conn.close();
}
//list = this.selectAll("WDSC.selectWdMbAll", this);
} catch(Exception e) {
e.printStackTrace();
throw new Exception("YCWDSC21003");//:取文档模板失败!" + e.getMessage());
}
return list;
}
/*
public List getWdMb() throws Exception {
List list = null;
try {
list = this.selectAll("WDSC.selectWdMbAll", this);
} catch(Exception e) {
e.printStackTrace();
throw new TaxBaseSystemException(e.getMessage());
}
return list;
}
*/
//通过模板编码和税务机关,得到模板信息,包括模板指标的相关信息
public WDSCwdmbDAO getWdMbByBm(String mbbm, String mblb, String swjg) throws Exception {
WDSCwdmbDAO wdmb = new WDSCwdmbDAO();
this.setMB_DM(mbbm);
this.setMB_SWJG(swjg);
this.setMB_LB(mblb);
try {
wdmb = getWdMbByBmWithOutZbMsg(this.getMB_DM(), this.getMB_LB(), this.getMB_SWJG());
wdmb.getWdMbZb(this); //得到模板指标信息
} catch(Exception e) {
e.printStackTrace();
throw new TaxBaseSystemException("YCWDSC21003");//:取文档模板失败!" + e.getMessage());
}
return wdmb;
}
//add by zch 2005-10-26
//该方法通过模板编码得到模板相关信息
public Vector getWdMbByBm(String mbbm, String swjg) throws Exception {
WDSCwdmbDAO wdmb = null;
Vector vMb = new Vector();
Connection conn = null;
Statement stam = null;
ResultSet rs = null;
String sql = "";
try {
//取得模板信息
conn = JDBCLocator.getInstance().getJDBCConnection();
stam = conn.createStatement();
sql = "SELECT " +
" MB_DM, MB_MC, MB_NR, MB_LB, MB_ENABLE, SCSJ, MB_CZY, MB_SWJG " +
" FROM T_WDSC_WDMB " +
" WHERE MB_DM = '" + mbbm + "' AND MB_ENABLE = '1' ";
if (!swjg.equals(""))
sql += " AND MB_SWJG like '" + swjg + "'" ;
log.sysDebug("sql=" + sql);
rs = stam.executeQuery(sql);
while (rs.next()) {
wdmb = new WDSCwdmbDAO();
wdmb.setMB_DM(rs.getString("MB_DM"));
wdmb.setMB_MC(rs.getString("MB_MC"));
wdmb.setMB_NR((java.sql.Blob)rs.getBlob("MB_NR"));
wdmb.setMB_LB(rs.getString("MB_LB"));
wdmb.setMB_ENABLE(rs.getString("MB_ENABLE"));
wdmb.setSCSJ(rs.getDate("SCSJ"));
wdmb.setMB_CZY(rs.getString("MB_CZY"));
wdmb.setMB_SWJG(rs.getString("MB_SWJG"));
wdmb.setMB_ZB_MSG(wdmb.getWdMbZb(wdmb));
vMb.add(wdmb);
}
rs.close();
stam.close();
} catch(Exception e) {
e.printStackTrace();
log.sysError(sql);
throw new TaxBaseSystemException("YCWDSC21003");//:取文档模板失败!" + e.getMessage());
} finally {
conn.close();
}
return vMb;
}
//通过模板编码,模板类别和税务机关,得到模板信息,包括模板指标的相关信息
public WDSCwdmbDAO getWdMbByBm() throws Exception {
WDSCwdmbDAO wdmb = new WDSCwdmbDAO();
try {
//this.select("WDSC.selectWdMb", this);
wdmb = getWdMbByBmWithOutZbMsg(this.getMB_DM(), this.getMB_LB(), this.getMB_SWJG());
if (wdmb != null) {
wdmb.setMB_ZB_MSG(wdmb.getWdMbZb(this)); //得到模板指标信息
} else {
throw new TaxBaseSystemException("YCWDSC21003");//:取文档模板失败!");
}
} catch(Exception e) {
e.printStackTrace();
throw new TaxBaseSystemException("YCWDSC21003");//:取文档模板失败!" + e.getMessage());
}
return wdmb;
}
//通过模板编码, 模板类别和税务机关,得到模板信息,但不取模板指标的相关信息
public WDSCwdmbDAO getWdMbByBmWithOutZbMsg(String mbbm, String mblb, String swjg) throws Exception {
this.setMB_DM(mbbm);
this.setMB_SWJG(swjg);
this.setMB_LB(mblb);
Connection conn=null;
WDSCwdmbDAO wdmb = new WDSCwdmbDAO();
String sql = "";
try {
//sqlMap = this.getSqlMapClient();
//sqlMap.startTransaction();
//Connection conn = sqlMap.getCurrentConnection();
conn = JDBCLocator.getInstance().getJDBCConnection();
Statement stam = conn.createStatement();
ResultSet res = null;
try {
sql = "SELECT " +
" MB_DM, MB_MC, MB_NR, MB_LB, MB_ENABLE, SCSJ, MB_CZY, MB_SWJG " +
" FROM T_WDSC_WDMB " +
" WHERE MB_DM = '" + mbbm + "' AND MB_LB = '" + mblb + "' AND MB_ENABLE = '1' ";
if (!swjg.equals(""))
sql += " AND MB_SWJG like '" + swjg + "' " ;
log.sysDebug(sql);
res = stam.executeQuery(sql);
if (res.next()) {
wdmb.setMB_DM(res.getString("MB_DM"));
wdmb.setMB_MC(res.getString("MB_MC"));
wdmb.setMB_NR((java.sql.Blob)res.getBlob("MB_NR"));
wdmb.setMB_LB(res.getString("MB_LB"));
wdmb.setMB_ENABLE(res.getString("MB_ENABLE"));
wdmb.setSCSJ(res.getDate("SCSJ"));
wdmb.setMB_CZY(res.getString("MB_CZY"));
wdmb.setMB_SWJG(res.getString("MB_SWJG"));
} else {
return null;
}
//sqlMap.commitTransaction();
} catch (Exception e) {
e.printStackTrace();
log.sysError(sql);
throw new TaxBaseSystemException("YCWDSC21003");//:取文档模板失败!" + e.getMessage());
} finally {
//sqlMap.endTransaction();
res.close();
stam.close();
conn.close();
}
//this.select("WDSC.selectWdMb", this);
} catch(Exception e) {
e.printStackTrace();
throw new TaxBaseSystemException(e.getMessage());
}
return wdmb;
}
//通过模板编码和税务机关,得到模板信息,但不取模板指标的相关信息
public WDSCwdmbDAO getWdMbByBmWithOutZbMsg() throws Exception {
try {
this.select("WDSC.selectWdMb", this);
} catch(Exception e) {
e.printStackTrace();
throw new TaxBaseSystemException("YCWDSC21003");//:取文档模板失败!" + e.getMessage());
}
return this;
}
/////////////////////////////////////////////////////////////////////////////
public void insertWdMb() throws Exception {
String table = "T_WDSC_WDMB";
String colName = "MB_NR";
String mbbm = this.getMB_DM();
String key = " MB_DM = '" + mbbm + "' AND MB_LB = '" + this.getMB_LB() +
"' AND MB_SWJG like '" + this.getMB_SWJG() + "' ";
try {
OracleBlobOperation.insertOracleBlob(this, table, colName, key);
} catch (Exception e) {
e.printStackTrace();
throw new TaxBaseSystemException("YCWDSC21004");//:插入文档模板失败!" + e.getMessage());
}
}
/////////////////////////////////////////////////////////////////////////////
public void updateWdMbNr() throws Exception {
String table = "T_WDSC_WDMB";
String colName = "MB_NR";
String mbbm = this.getMB_DM();
String key = " MB_DM = '" + mbbm + "' AND MB_LB = '" + this.getMB_LB() + "' AND MB_SWJG like '" + this.getMB_SWJG() + "' ";
try {
this.getSqlMapClient();
OracleBlobOperation.updateOracleBlob(this, table, colName, key);
} catch (Exception e) {
e.printStackTrace();
throw new TaxBaseSystemException("YCWDSC21005");//:更新文档模板内容失败!" + e.getMessage());
} finally {
}
}
public void execProc() throws SQLException, Exception {
Connection conn = null;
Statement stmt = null;
String sql = "";
try {
conn = JDBCLocator.getInstance().getJDBCConnection();
sql = " call PK_SSGLY_WDSC.P_GZDA_MBSC() ";
stmt = conn.createStatement();
stmt.execute(sql);
stmt.close();
} catch (Exception e) {
throw new Exception(e.getMessage());
} finally {
if (conn != null) conn.close();
}
}
/*
public void updateWdMbNrBlob(WDSCwdmbDAO wdmb) throws Exception {
if (wdmb == null) return;
try {
this.update("WDSC.updateWdMbNrBlob", wdmb);
} catch(Exception e) {
e.printStackTrace();
throw new TaxBaseSystemException(e.getMessage());
}
}
public void updateWdMbNrBlob() throws Exception {
try {
this.update("WDSC.updateWdMbNrBlob", this);
} catch(Exception e) {
e.printStackTrace();
throw new TaxBaseSystemException(e.getMessage());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -