📄 outdaoimpl.java
字号:
package com.gs.component.out.dao;
import java.sql.*;
import java.text.*;
import java.util.*;
import com.gs.component.out.*;
import com.gs.util.*;
import javax.servlet.http.*;
import com.gs.component.out.dao.*;
import com.gs.control.event.*;
import com.gs.control.exceptions.*;
import com.gs.control.handlers.*;
import com.gs.util.*;
import com.gs.control.exceptions.WebException;
/**
* 得到已经完成的业务
* @param String BID 业务号
* @param String eName 公司名称
* @param String zch 注册号
* @return ArrayList
* @exception AppException
*/
public class OutDAOImpl implements OutDAO{
public OutDAOImpl(){
super();}
public String getField003(String sql1) throws AppException{
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String field003 = null;
try{
conn = Common.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(sql1);
if(rs.next()){
field003 = rs.getString(1);
}
} catch(Exception e){
Debug.println("[EnterpriseDAOImpl-->getFinishedBusiness]Exception-->!" + e.getMessage());
throw new AppException("获得已完成业务出错: " + e.getMessage());
} finally{
Common.clearUp(rs,stmt,conn);
}
Debug.println("[OutDAOImpl-->getFinishedBusiness]---->END!");
return field003;
}
public ArrayList getFinishedBusiness(String SN,String BID,String eName,String zch,String areaCode) throws AppException{
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
ArrayList returnAL = null;
try{
conn = Common.getConnection();
stmt = conn.createStatement();
Debug.println("[OutDAOImpl--->queryMatureEntity]Connection Database is ok!");
StringBuffer sqlBuf = new StringBuffer();
if(BID.startsWith("060201")){
sqlBuf.append("select * from gsgsjin_basis02 where field002 like '0201%' and");
sqlBuf.append(" (field004 = '" + zch + "'");
sqlBuf.append(" or field009 = '" + PubFunc.toSql(eName) + "') and field104 like '" + areaCode + "%'");
}
if(BID.startsWith("060202")){
sqlBuf.append("select * from gsgsjin_basis02 where field002 like '0202%' and");
sqlBuf.append("( field004 = '" + zch + "'");
sqlBuf.append(" or field009 = '" + PubFunc.toSql(eName) + "') and field104 like '" + areaCode + "%'");
}
if(BID.startsWith("060203")){
sqlBuf.append("select * from gsgsjin_basis02 where field002 like '0203%' and");
sqlBuf.append(" (field004 = '" + zch + "'");
sqlBuf.append(" or field009 = '" + PubFunc.toSql(eName) + "') and field104 like '" + areaCode + "%'");
}
Debug.println(
"[OutDAOImpl--->queryMatureEntity]查询企业的名称期限-->" + sqlBuf.toString());
rs = stmt.executeQuery(sqlBuf.toString());
returnAL = new ArrayList();
while(rs.next()){
HashMap hashMap = new HashMap();
HashMap rsMap = new HashMap();
HashMap tableMap = new HashMap();
ArrayList al = new ArrayList();
hashMap.put("field004",rs.getString("field004"));
hashMap.put("field006",rs.getString("field006"));
hashMap.put("field009",rs.getString("field009"));
hashMap.put("field033",rs.getString("field033"));
hashMap.put("field067",rs.getString("field067"));
hashMap.put("field098",rs.getString("field098"));
hashMap.put("field097",rs.getString("field097"));
hashMap.put("field019",rs.getString("field019"));
hashMap.put("field049",rs.getString("field049"));
hashMap.put("field155",rs.getString("field155"));
tableMap.put(rsMap,hashMap);
al.add(tableMap.get(rsMap));
returnAL.add(al);
}
} catch(Exception e){
Debug.println("[EnterpriseDAOImpl-->getFinishedBusiness]Exception-->!" + e.getMessage());
throw new AppException("获得已完成业务出错: " + e.getMessage());
} finally{
Common.clearUp(rs,stmt,conn);
}
Debug.println("[OutDAOImpl-->getFinishedBusiness]---->END!");
return returnAL;
}
public ArrayList getQianchu(String SN,String BID,String zch,String eName,String areaCode,String field003) throws AppException{
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
ArrayList returnAL = null;
try{
conn = Common.getConnection();
stmt = conn.createStatement();
Debug.println("[OutDAOImpl--->queryMatureEntity]Connection Database is ok!");
String sql="";
if(BID.startsWith("060201")){
sql = "select * from in_goout where field004='"+field003+"'";
}
if(BID.startsWith("060202")){
sql = "select * from in_goout where field004='"+field003+"'";
}
if(BID.startsWith("060203")){
sql = "select * from in_goout where field004='"+field003+"'";
}
rs = stmt.executeQuery(sql);
returnAL = new ArrayList();
while(rs.next()){
HashMap hashMap = new HashMap();
HashMap rsMap = new HashMap();
HashMap tableMap = new HashMap();
ArrayList al = new ArrayList();
hashMap.put("field004",rs.getString("field004"));
hashMap.put("field012",rs.getString("field012"));
hashMap.put("field013",rs.getString("field013"));
hashMap.put("field014",rs.getString("field014"));
hashMap.put("field015",rs.getString("field015"));
hashMap.put("field019",rs.getString("field019"));
tableMap.put(rsMap,hashMap);
al.add(tableMap.get(rsMap));
returnAL.add(al);
}
} catch(Exception e){
Debug.println("[EnterpriseDAOImpl-->getQianchu]Exception-->!" + e.getMessage());
throw new AppException("获得已完成业务出错: " + e.getMessage());
} finally{
Common.clearUp(rs,stmt,conn);
}
Debug.println("[OutDAOImpl-->getFinishedBusiness]---->END!");
return returnAL;
}
public ArrayList addNewBusiness(String sql) throws AppException{
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
ArrayList al = null;
try{
conn = Common.getConnection();
stmt = conn.createStatement();
stmt.executeUpdate(sql);
// conn.commit();
} catch(Exception e){
Debug.println("[OutDAOImpl-->getFinishedBusiness]Exception-->!" + e.getMessage());
throw new AppException("获得已完成业务出错: " + e.getMessage());
} finally{
Common.clearUp(rs,stmt,conn);
}
Debug.println("[OutDAOImpl-->getFinishedBusiness]---->END!");
return al;
}
public ArrayList updateBusiness(String SN,String BID,String sql) throws AppException{
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
ArrayList al = null;
try{
conn = Common.getConnection();
stmt = conn.createStatement();
stmt.executeUpdate(sql);
// conn.commit();
} catch(Exception e){
Debug.println("[EnterpriseDAOImpl-->getFinishedBusiness]Exception-->!" + e.getMessage());
throw new AppException("获得已完成业务出错: " + e.getMessage());
} finally{
Common.clearUp(rs,stmt,conn);
}
Debug.println("[OutDAOImpl-->getFinishedBusiness]---->END!");
return al;
}
public ArrayList updateDateBusiness(String SN,String BID,String sql) throws AppException{
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
ArrayList al = null;
try{
conn = Common.getConnection();
stmt = conn.createStatement();
stmt.executeUpdate(sql);
// conn.commit();
} catch(Exception e){
Debug.println("[EnterpriseDAOImpl-->getFinishedBusiness]Exception-->!" + e.getMessage());
throw new AppException("获得已完成业务出错: " + e.getMessage());
} finally{
Common.clearUp(rs,stmt,conn);
}
Debug.println("[OutDAOImpl-->getFinishedBusiness]---->END!");
return al;
}
public String getEname(String sql) throws AppException{
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String eName = null;
try{
conn = Common.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
if(rs.next()){
eName = rs.getString(1);
}
} catch(Exception e){
Debug.println("[EnterpriseDAOImpl-->getFinishedBusiness]Exception-->!" + e.getMessage());
throw new AppException("获得已完成业务出错: " + e.getMessage());
} finally{
Common.clearUp(rs,stmt,conn);
}
Debug.println("[OutDAOImpl-->getFinishedBusiness]---->END!");
return eName;
}
public String getNbxh(String sql1) throws AppException{
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String nbxh = null;
try{
conn = Common.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(sql1);
if(rs.next()){
nbxh = rs.getString(1);
}
} catch(Exception e){
Debug.println("[EnterpriseDAOImpl-->getFinishedBusiness]Exception-->!" + e.getMessage());
throw new AppException("获得已完成业务出错: " + e.getMessage());
} finally{
Common.clearUp(rs,stmt,conn);
}
Debug.println("[OutDAOImpl-->getFinishedBusiness]---->END!");
return nbxh;
}
public String getBm(String sql1) throws AppException{
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String BM = null;
try{
conn = Common.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(sql1);
if(rs.next()){
BM = rs.getString(1);
}
} catch(Exception e){
Debug.println("[EnterpriseDAOImpl-->getFinishedBusiness]Exception-->!" + e.getMessage());
throw new AppException("获得已完成业务出错: " + e.getMessage());
} finally{
Common.clearUp(rs,stmt,conn);
}
Debug.println("[OutDAOImpl-->getFinishedBusiness]---->END!");
return BM;
}
public String getValuee(String sql1) throws AppException{
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String valuee = null;
try{
conn = Common.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(sql1);
if(rs.next()){
valuee = rs.getString(1);
}
} catch(Exception e){
Debug.println("[EnterpriseDAOImpl-->getFinishedBusiness]Exception-->!" + e.getMessage());
throw new AppException("获得已完成业务出错: " + e.getMessage());
} finally{
Common.clearUp(rs,stmt,conn);
}
Debug.println("[OutDAOImpl-->getFinishedBusiness]---->END!");
return valuee;
}
public ArrayList getYouhui(String sql) throws AppException{
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
ArrayList returnAL = null;
try{
conn = Common.getConnection();
stmt = conn.createStatement();
Debug.println("[OutDAOImpl--->queryMatureEntity]Connection Database is ok!");
rs = stmt.executeQuery(sql);
returnAL = new ArrayList();
while(rs.next()){
HashMap hashMap = new HashMap();
HashMap rsMap = new HashMap();
HashMap tableMap = new HashMap();
ArrayList al = new ArrayList();
hashMap.put("field012",rs.getString("field012"));
hashMap.put("field053",rs.getString("field053"));
hashMap.put("field054",rs.getString("field054"));
hashMap.put("field043",rs.getString("field043"));
hashMap.put("field099",rs.getString("field099"));
hashMap.put("field009",rs.getString("field009"));
//tableMap.put(rsMap,hashMap);
//al.add(tableMap.get(rsMap));
returnAL.add(hashMap);
}
} catch(Exception e){
Debug.println("[EnterpriseDAOImpl-->getFinishedBusiness]Exception-->!" + e.getMessage());
throw new AppException("获得已完成业务出错: " + e.getMessage());
} finally{
Common.clearUp(rs,stmt,conn);
}
Debug.println("[OutDAOImpl-->getFinishedBusiness]---->END!");
return returnAL;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -