?? personbean.java
字號(hào):
package oa.bean;
import java.text.*;
import java.util.*;
import java.lang.*;
import java.io.*;
import java.sql.*;
import javax.swing.tree.*;
import oa.main.*;
public class PersonBean extends ParentBean
{
String strOrgNO = "-1";
String strPersonNO = "-1";
int intDelType = -1;
static
{
PublicData.rebuildFlowVector();
PublicData.rebuildRightVector();
}
//構(gòu)造函數(shù)
public PersonBean()
{
}
//設(shè)置職工編號(hào)
public void setPersonNO(String d)
{
strPersonNO = d;
}
//設(shè)置職工部門編號(hào)
public void setOrgNO(String OrgNO)
{
strOrgNO = OrgNO;
}
//設(shè)置刪除方式(離職或退休)
public void setType(String t)
{
if(t.equals("離職"))
{
intDelType = 1;
}
else if(t.equals("退休"))
{
intDelType = 2;
}
}
//取得所有人員列表(不包括職能用戶)
public Vector getAllData(){
Vector vect = new Vector();
String sql = "";
sql =
" select * From ZZ_ZGB where ZZ_ZGB.ZGBH<>'1' and ZZZT=0 and ZNYH=0"
+ " order by ZGBH ";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
//取得列數(shù)和列名
ResultSetMetaData rsmd = rs.getMetaData();
int cols = rsmd.getColumnCount();
while (rs.next()) {
Hashtable hash = new Hashtable();
for (int i = 1; i <= cols; i++) {
String field = ds.toString(rsmd.getColumnName(i));
String value = ds.toString(rs.getString(i));
if (field.equals("BMBH")) {
value = getApartName(value);
}
if (field.equals("ZZZT")) {
if (value.equals("0"))
value = "正常";
if (value.equals("1"))
value = "離職";
if (value.equals("2"))
value = "退休";
}
if (value == null)
value = "";
hash.put(field, value);
}
vect.add(hash);
}
}catch(Exception e){System.out.println("運(yùn)行時(shí)出錯(cuò):"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("關(guān)閉記錄集rs時(shí)出錯(cuò)"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("關(guān)閉聲明時(shí)statement出錯(cuò)"+e);}
}
return vect;
}
//取得所有人員列表(包括職能用戶)
public Vector getAllZNData(){
Vector vect = new Vector();
String sql = "";
sql =
" select * From ZZ_ZGB where ZZ_ZGB.ZGBH<>'1' and ZZZT=0 "
+ " order by ZGBH ";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
//取得列數(shù)和列名
ResultSetMetaData rsmd = rs.getMetaData();
int cols = rsmd.getColumnCount();
while (rs.next()) {
Hashtable hash = new Hashtable();
for (int i = 1; i <= cols; i++) {
String field = ds.toString(rsmd.getColumnName(i));
String value = ds.toString(rs.getString(i));
if (field.equals("BMBH")) {
value = getApartName(value);
}
if (field.equals("ZZZT")) {
if (value.equals("0"))
value = "正常";
if (value.equals("1"))
value = "離職";
if (value.equals("2"))
value = "退休";
}
if (value == null)
value = "";
hash.put(field, value);
}
vect.add(hash);
}
}catch(Exception e){System.out.println("運(yùn)行時(shí)出錯(cuò):"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("關(guān)閉記錄集rs時(shí)出錯(cuò)"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("關(guān)閉聲明時(shí)statement出錯(cuò)"+e);}
}
return vect;
}
//取得某人再某個(gè)部門的流程權(quán)限
public String getFlowIdPart()
{
String strFlow = "";
String sql = "";
String strMRCZ = "1";
String strSYZT = "0";
String str1 = ",";
String str2 = "@";
String strBMBH = "";
String strZWBH = "";
String strMax = "";
int i,j;
sql = "select BMBH,ZWBH,LCQX from ZZ_ZGZWB where ZGBH = '"+strPersonNO+"' and BMBH='"+strOrgNO+"'";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
while(rs.next())//在ZZ_ZGZWB表找此職工所有職務(wù)的權(quán)限
{
String strX = ds.toString(rs.getString("LCQX"));//取得某一職務(wù)的權(quán)限
if (!strX.equals(""))
{
strMax+=strX+str2;
}
}
}catch(Exception e){System.out.println("運(yùn)行時(shí)出錯(cuò):"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("關(guān)閉記錄集rs時(shí)出錯(cuò)"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("關(guān)閉聲明時(shí)statement出錯(cuò)"+e);}
}
if(strMax.equals(""))//如果ZZ_ZGZWB中的操作權(quán)限為空
{
sql = "select a.LCQX from ZZ_ZWB a,ZZ_ZGZWB b where ZGBH = '"+strPersonNO+"' and a.zwzt<>1 and a.BMBH = b.BMBH and a.ZWBH = b.ZWBH ";
rs = selectRecord(sql);
try{
while(rs.next())//把此職工的所有職務(wù)的權(quán)限用(@)分割存儲(chǔ)
{
String strX = ds.toString(rs.getString("LCQX"));//取得某一職務(wù)的權(quán)限
if (!strX.equals(""))
{
strMax+=strX+str2;
}
}
}catch(Exception e){System.out.println("運(yùn)行時(shí)出錯(cuò):"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("關(guān)閉記錄集rs時(shí)出錯(cuò)"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("關(guān)閉聲明時(shí)statement出錯(cuò)"+e);}
}
if(strMax.equals(""))//判斷是否啟用默認(rèn)權(quán)限,空則用默認(rèn)權(quán)限
{
sql = "select MKBH from CODE_LCQXB where MRCZ = "+strMRCZ+" and SYZT = "+strSYZT+"";
ResultSet r = selectRecord(sql);
try{
while(r.next())
{
strFlow+=ds.toString(r.getString("MKBH"))+str1;
}
}catch(Exception e){System.out.println("運(yùn)行時(shí)出錯(cuò):"+e);}
finally{
if(r!=null)try{ stmt = r.getStatement(); r.close();}catch(Exception e){System.out.println("關(guān)閉記錄集rs時(shí)出錯(cuò)"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("關(guān)閉聲明時(shí)statement出錯(cuò)"+e);}
}
if(strFlow.length()!=0)
strFlow = strFlow.substring(0,strFlow.length()-1);
if(strFlow.length()==0)
strFlow = "";
return strFlow;
}
}
strMax = strMax.substring(0,strMax.length()-1);
String strMaxOper[] = strMax.split("@");
strMax = "";
for(i=0;i<strMaxOper.length;i++)//取得此職工最大權(quán)限集合strMax
{
String strEp[] = strMaxOper[i].split(",");
for(j=0;j<strEp.length;j++)
{
if(strMax.indexOf(strEp[j])==-1)
{
strMax+=strEp[j]+str1;
}
}
}
strFlow = strMax;
strFlow = strFlow.substring(0,strFlow.length()-1);
return strFlow;
}
//取得所有有某個(gè)流程權(quán)限的人的部門lbh new
public Vector getFlowBM(String strLCQX)
{
String sql="";
boolean strFlow = false;
Vector vt = new Vector();
ResultSet rs = null;
String bmno="";
String []flows = null;
String zgno = "";
sql = "select BMBH from ZZ_BMB order by BMBH";
rs = selectRecord(sql);
Statement stmt = null;
try{
while(rs.next())
{
bmno = ds.toString(rs.getString("BMBH"));
strFlow = getFlow_new(bmno,strLCQX);//取得某一職工的權(quán)限
if(strFlow)
{
if(!vt.contains(bmno))vt.add(bmno);
}
}
}catch(Exception e){System.out.println("運(yùn)行時(shí)出錯(cuò):"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("關(guān)閉記錄集rs時(shí)出錯(cuò)"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("關(guān)閉聲明時(shí)statement出錯(cuò)"+e);}
}
return vt;
}
//是否有流程權(quán)限
public boolean isFlowRight(String strLCQX)
{
boolean bool = false;
String strFlow = getMyFlow();//getFlow();
String []flows = strFlow.split(",");
for(int i=0;i<flows.length;i++)
{
if(flows[i].equals(strLCQX))
{
bool = true;
break;
}
}
return bool;
}
//是否有流程權(quán)限
public boolean isOperRight(String strCZQX)
{
boolean bool = false;
String strOper = getMyOper();//getOper();
String []opers = strOper.split(",");
for(int i=0;i<opers.length;i++)
{
if(opers[i].equals(strCZQX))
{
bool = true;
break;
}
}
return bool;
}
//取得人員記錄列表
public Vector getDataFilterByCZQZ_LCQX(String strLCQX,String strCZQX)
{
strCZQX=ds.toString(strCZQX);
strLCQX=ds.toString(strLCQX);
if (strLCQX.equals("")) return null;
if (strCZQX.equals("")) return null;
Vector vect = new Vector();
// DealBean db = new DealBean();
String sql = "";
//String strFormatedLCQX ="," + ds.toString(strLCQX) + ",";
sql =" select * from ZZ_ZGB where bmbh='"+strOrgNO+"' and ZZZT=0 "
+" and ZZ_ZGB.ZGBH<>'1'"
+ " order by ZZ_ZGB.ZGBH ,ZNYH";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
//取得列數(shù)和列名
ResultSetMetaData rsmd = rs.getMetaData();
int cols = rsmd.getColumnCount();
while (rs.next()) {
String strPersonNo_Temp=ds.toString(rs.getString("ZGBH"));
if(strPersonNo_Temp.equals("")) continue;
setPersonNO(strPersonNo_Temp);
if(!isFlowRight(strLCQX)) continue;
if(!isOperRight(strCZQX)) continue;
Hashtable hash = new Hashtable();
for (int i = 1; i <= cols; i++) {
String field = ds.toString(rsmd.getColumnName(i));
String value = ds.toString(rs.getString(i));
if (field.equals("BMBH")) {
value = getApartName(value);
}
if (field.equals("ZZZT")) {
if (value.equals("0"))
value = "正常";
if (value.equals("1"))
value = "離職";
if (value.equals("2"))
value = "退休";
}
if (value == null)
value = "";
hash.put(field, value);
}
vect.add(hash);
}
}catch(Exception e){System.out.println("運(yùn)行時(shí)出錯(cuò):"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("關(guān)閉記錄集rs時(shí)出錯(cuò)"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("關(guān)閉聲明時(shí)statement出錯(cuò)"+e);}
}
return vect;
}
//取得人員記錄列表
public Vector getDataFilterByCZQZ(String strCZQX){
strCZQX=ds.toString(strCZQX);
if (strCZQX.equals("")) return null;
Vector vect = new Vector();
// DealBean db = new DealBean();
String sql = "";
//String strFormatedLCQX ="," + ds.toString(strLCQX) + ",";
sql =" select * from ZZ_ZGB where bmbh='"+strOrgNO+"' and ZZZT=0 "
+" and ZZ_ZGB.ZGBH<>'1'"
+ " order by ZZ_ZGB.ZGBH ";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
//取得列數(shù)和列名
ResultSetMetaData rsmd = rs.getMetaData();
int cols = rsmd.getColumnCount();
while (rs.next()) {
String strPersonNo_Temp=ds.toString(rs.getString("ZGBH"));
if(strPersonNo_Temp.equals("")) continue;
setPersonNO(strPersonNo_Temp);
if(!isOperRight(strCZQX)) continue;
Hashtable hash = new Hashtable();
for (int i = 1; i <= cols; i++) {
String field = ds.toString(rsmd.getColumnName(i));
String value = ds.toString(rs.getString(i));
if (field.equals("BMBH")) {
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -