📄 personbean.java
字号:
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();
}
//构造函数
public PersonBean()
{
}
//设置职工编号
public void setPersonNO(String d)
{
strPersonNO = d;
}
//设置职工部门编号
public void setOrgNO(String OrgNO)
{
strOrgNO = OrgNO;
}
//设置删除方式(离职或退休)
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{
//取得列数和列名
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("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+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{
//取得列数和列名
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("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
return vect;
}
//取得某人再某个部门的流程权限
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表找此职工所有职务的权限
{
String strX = ds.toString(rs.getString("LCQX"));//取得某一职务的权限
if (!strX.equals(""))
{
strMax+=strX+str2;
}
}
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
if(strMax.equals(""))//如果ZZ_ZGZWB中的操作权限为空
{
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())//把此职工的所有职务的权限用(@)分割存储
{
String strX = ds.toString(rs.getString("LCQX"));//取得某一职务的权限
if (!strX.equals(""))
{
strMax+=strX+str2;
}
}
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
if(strMax.equals(""))//判断是否启用默认权限,空则用默认权限
{
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("运行时出错:"+e);}
finally{
if(r!=null)try{ stmt = r.getStatement(); r.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+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++)//取得此职工最大权限集合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;
}
//取得所有有某个流程权限的人的部门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);//取得某一职工的权限
if(strFlow)
{
if(!vt.contains(bmno))vt.add(bmno);
}
}
}catch(Exception e){System.out.println("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}
}
return vt;
}
//是否有流程权限
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;
}
//是否有流程权限
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{
//取得列数和列名
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("运行时出错:"+e);}
finally{
if(rs!=null)try{ stmt = rs.getStatement(); rs.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+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{
//取得列数和列名
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")) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -