📄 changebusinessdaoimpl.java
字号:
}
//将法定代表人、负责人信息拷贝到外网
public void copyChairmanFromInToOut(String SN,String OLDSN,ArrayList tableList) throws Exception{
String sql = "";
//外网子表名
String SUB = "";
//内网子表名
String OLDSUB = "";
try{
sqlExecProxy.openProxy();
sqlExecProxy.setAutoCommit(false);
for(int i = 0;i < tableList.size();i++){
//外网子表名
SUB = (String) tableList.get(i);
//内网子表名
OLDSUB = "sub02" + SUB.substring(SUB.indexOf("sub01") + 5);
//将外网的数据清空
sql = " delete from " + TableNameUtil.GSGSJOUT_SUB01 + " where field001='" + SN + "' and field002='" + SUB + "'";
Debug.println("[ChangeBusinessDAOImpl-->copyChairmanFromInToOut]sql1=" + sql);
sqlExecProxy.executeUpdate(sql);
//将内网的法定代表人、负责人拷贝到外网
sql = " insert into " + TableNameUtil.GSGSJOUT_SUB01 + " select * from " + TableNameUtil.GSGSJIN_SUB02 + " where field001='" + OLDSN +
"' and field002='" + OLDSUB + "'";
Debug.println("[ChangeBusinessDAOImpl-->copyChairmanFromInToOut]sql2=" + sql);
sqlExecProxy.executeUpdate(sql);
//更新外网子表
sql = " update " + TableNameUtil.GSGSJOUT_SUB01 + " set field001='" + SN + "' ,field002='" + SUB + "' where field001='" + OLDSN +
"' and field002='" + OLDSUB + "'";
Debug.println("[ChangeBusinessDAOImpl-->copyChairmanFromInToOut]sql3=" + sql);
sqlExecProxy.executeUpdate(sql);
}
sqlExecProxy.commitProxy();
} catch(Exception e){
throw new Exception("[ChangeBusinessDAOImpl-->copyChairmanFromInToOut]Exception:" + e.toString());
} finally{
try{
sqlExecProxy.closeProxy();
} catch(Exception e){
Debug.println("[ChangeBusinessDAOImpl-->>moveChairmanToIn]exception:" + e.toString());
}
}
}
//删除gsgsjout_coding_page表中的记录
public void delPageCoding(String BID,String SUB) throws Exception{
String sql = " delete from " + TableNameUtil.GSGSJOUT_CODING_PAGE + " where coding1='" + BID + "' and basissub='" + SUB + "'";
Debug.println("[ChangeBusinessDAOImpl-->delPageCoding]sql=" + sql);
try{
sqlExecProxy.openProxy();
sqlExecProxy.setAutoCommit(false);
sqlExecProxy.executeUpdate(sql);
sqlExecProxy.commitProxy();
} catch(Exception e){
throw new Exception("[ChangeBusinessDAOImpl-->delPageCoding]exception:" + e.toString());
} finally{
try{
sqlExecProxy.closeProxy();
} catch(Exception e){
Debug.println("[ChangeBusinessDAOImpl-->>moveChairmanToIn]exception:" + e.toString());
}
}
}
//插入gsgsjout_coding_page表中的记录
public void insertPageCoding(String coding1,String coding2,String content,String basissub,String flag) throws Exception{
String sql = " insert into " + TableNameUtil.GSGSJOUT_CODING_PAGE + " (coding1,coding2,content,basissub,flag) values('" + coding1 + "','" +
coding2 + "','" + content + "','" + basissub + "'," + flag + ")";
Debug.println("[ChangeBusinessDAOImpl-->insertPageCoding]sql=" + sql);
try{
sqlExecProxy.openProxy();
sqlExecProxy.setAutoCommit(false);
sqlExecProxy.executeUpdate(sql);
sqlExecProxy.commitProxy();
} catch(Exception e){
throw new Exception("[ChangeBusinessDAOImpl-->insertPageCoding]exception:" + e.toString());
} finally{
try{
sqlExecProxy.closeProxy();
} catch(Exception e){
Debug.println("[ChangeBusinessDAOImpl-->>moveChairmanToIn]exception:" + e.toString());
}
}
}
//删除外网记录
public void delOutSub(String SN,String SUB) throws Exception{
String sql = " delete from " + TableNameUtil.GSGSJOUT_SUB01 + " where field001='" + SN + "' and field002='" + SUB + "'";
Debug.println("[ChangeBusinessDAOImpl-->delOutSub]sql=" + sql);
try{
sqlExecProxy.openProxy();
sqlExecProxy.setAutoCommit(false);
sqlExecProxy.executeUpdate(sql);
sqlExecProxy.commitProxy();
} catch(Exception e){
throw new Exception("[ChangeBusinessDAOImpl-->delOutSub]exception:" + e.toString());
} finally{
try{
sqlExecProxy.closeProxy();
} catch(Exception e){
Debug.println("[ChangeBusinessDAOImpl-->>moveChairmanToIn]exception:" + e.toString());
}
}
}
//选择子表记录是否存在
public boolean isExistPage(String BID,String SUB) throws Exception{
boolean bl = false;
String sql = " select coding1 from " + TableNameUtil.GSGSJOUT_CODING_PAGE + " where coding1='" + BID + "' and basissub='" + SUB + "'";
Debug.println("[ChangeBusinessDAOImpl-->isExistPag]sql=" + sql);
try{
sqlExecProxy.openProxy();
sqlExecProxy.executeQuery(sql);
if(sqlExecProxy.nextRow()){
bl = true;
}
} catch(Exception e){
throw new Exception("[ChangeBusinessDAOImpl-->isExistPage]exception:" + e.toString());
} finally{
try{
sqlExecProxy.closeProxy();
} catch(Exception e){
Debug.println("[ChangeBusinessDAOImpl-->>moveChairmanToIn]exception:" + e.toString());
}
return bl;
}
}
//判断子表记录是否存在
public boolean isExistSub(String SN,String SUB) throws Exception{
boolean bl = false;
String sql = "select field001 from " + TableNameUtil.GSGSJOUT_SUB01 + " where field001='" + SN + "' and field002='" + SUB + "'";
Debug.println("[ChangeBusinessDAOImpl-->isExistSub]sql=" + sql);
try{
sqlExecProxy.openProxy();
sqlExecProxy.executeQuery(sql);
if(sqlExecProxy.nextRow()){
bl = true;
}
} catch(Exception e){
throw new Exception("[ChangeBusinessDAOImpl-->isExistSub]exception:" + e.toString());
} finally{
try{
sqlExecProxy.closeProxy();
} catch(Exception e){
Debug.println("[ChangeBusinessDAOImpl-->>isExistSub]exception:" + e.toString());
}
return bl;
}
}
//判断某一字段是否为空
public boolean isNullField(String SN,String tableName,String fieldName) throws Exception{
boolean bl = true;
String temp = "";
String sql = " select " + fieldName + " from " + tableName + " where field001='" + SN + "'";
try{
sqlExecProxy.openProxy();
sqlExecProxy.executeQuery(sql);
if(sqlExecProxy.nextRow()){
temp = sqlExecProxy.getFieldString(fieldName);
}
if(temp != null && !temp.trim().equals("")){
bl = false;
}
} catch(Exception e){
throw new Exception("[ChangeBusinessDAOImpl-->isNullField]exception:" + e.toString());
} finally{
try{
sqlExecProxy.closeProxy();
} catch(Exception e){
Debug.println("[ChangeBusinessDAOImpl-->>isNullField]exception:" + e.toString());
}
return bl;
}
}
//得到主表的记录值(唯一)
public HashMap getRecordValue(String SN) throws Exception{
HashMap hm = null;
String sql = null;
try{
sql = " select * from " + TableNameUtil.GSGSJIN_BASIS02 + " where field001='" + SN + "'";
Debug.println("[ChangeBusinessDAOImpl-->getRecordValue]sql=" + sql);
sqlExecProxy.openProxy();
sqlExecProxy.executeQuery(sql);
if(sqlExecProxy.nextRow()){
hm = sqlExecProxy.getRecordValue();
}
} catch(Exception e){
throw new Exception("[ChangeBusinessDAOImpl-->getRecordValue]exception:" + e.toString());
} finally{
try{
sqlExecProxy.closeProxy();
} catch(Exception e){
Debug.println("[ChangeBusinessDAOImpl-->>getRecordValue]exception:" + e.toString());
}
if(hm == null){
hm = new HashMap();
}
return hm;
}
}
//得到子表的所有记录
public ArrayList getSubRecordValue(String SN,String subTable) throws Exception{
HashMap hm = new HashMap();
ArrayList al = new ArrayList();
String sql = null;
try{
sql = " select * from " + subTable + " where field001='" + SN + "'";
sqlExecProxy.openProxy();
sqlExecProxy.executeQuery(sql);
while(sqlExecProxy.nextRow()){
hm = sqlExecProxy.getRecordValue();
al.add(hm);
}
} catch(Exception e){
throw new Exception("[ChangeBusinessDAOImpl-->getSubRecordValue]exception:" + e.toString());
}
finally{
try{
sqlExecProxy.closeProxy();
} catch(Exception e){
Debug.println("[ChangeBusinessDAOImpl-->>getSubRecordValue]exception:" + e.toString());
}
return al;
}
}
//从变化记录中得到内部序号
public String getINNERID(String SN) throws Exception{
String temp = "";
String sql = null;
try{
sql = " select field003 from " + TableNameUtil.OUT_CHANGE + " where field001='" + SN + "'";
Debug.println("[ChangeBusinessDAOImpl-->getINNERID]sql=" + sql);
sqlExecProxy.openProxy();
sqlExecProxy.executeQuery(sql);
if(sqlExecProxy.nextRow()){
temp = sqlExecProxy.getFieldString("field003");
}
} catch(Exception e){
throw new Exception("[ChangeBusinessDAOImpl-->getINNERID]exception:" + e.toString());
} finally{
try{
sqlExecProxy.closeProxy();
} catch(Exception e){
Debug.println("[ChangeBusinessDAOImpl-->>getINNERID]exception:" + e.toString());
}
return temp;
}
}
//为迁入、迁出增加标记
public void setMoveMarker(String SN,String marker) throws Exception{
String sql = null;
try{
sql = " update " + TableNameUtil.GSGSJIN_BASIS02 + " set field006='" + marker + "',field119='" + ChangeUtil.getCurrentTime() +
"' where field001='" + SN + "'";
Debug.println("[ChangeBusinessDAOImpl-->setMoveMarker]sql=" + sql);
sqlExecProxy.openProxy();
sqlExecProxy.setAutoCommit(false);
sqlExecProxy.executeUpdate(sql);
sqlExecProxy.commitProxy();
} catch(Exception e){
throw new Exception("[ChangeBusinessDAOImpl-->setMoveMarker]exception:" + e.toString());
} finally{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -