⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 personbean.java

📁 这是一个很好用的软件
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/*******************************************************************************
 * Version 1.0 Date:2003-10-17 Description:组织机构中的人员表:列表查询、单条信息查询、增加记录、修改记录、删除记录
 * Other: Variable List: 1.String strOrgNO = "-1"//部门编号 2.String strPersonNO =
 * "-1";//职工编号 3.int intDelType = -1;//删除方式
 * 
 * Function List: 1.public PersonBean()//构造函数 2.public void setPersonNO(String
 * d)//设置职工编号 3.public void setOrgNO(String OrgNO)//设置职工部门编号
 * 
 * 
 * 4.public void setType(String t)//设置删除方式(离职或退休)
 * 
 * 5.public Vector getData()//取得人员记录列表 6.public Hashtable
 * getOneData()//取得当前人员的信息 7.public Vector getData(boolean isfather,String
 * pxzd,boolean isdesc,String srchzd,String srchzdval,boolean
 * isexact)//取得人员记录列表display.jsp排序搜索用
 * 
 * 7.public String getBmName()//取得当前人员所在的部门名称 7.public String getZgName(String
 * str)//取得某人员的名字 8.public String getMaxzgNo()//取得某部门的最大职工编号+1 9.public Vector
 * getMZ()//从字典表取得民族 10.public Vector getZzmm()//从字典表取得政治面目 11.public Vector
 * getXL()//从字典表取得学历 12.public Vector getZC()//从字典表取得职称
 * 
 * 8.public int addPerson(Hashtable hash)//增加人员数据记录 9.public int
 * modPerson(Hashtable hash)//修改人员数据记录 10.public void delPerson()//删除当前人员数据记录
 * 
 * 11.public String getOper()//通过职工编号得到当前职务的操作权限,并且转化为汉字 12.public String
 * getFlow()//通过职工编号得到当前职务的流程权限,并且转化为汉字 13.public String
 * getConf()//通过职工编号得到当前职工的配置参数OK
 * 
 * 14.public String toOperNo(String on)//根据填写的操作权限转化为存储字符???????可以不用了 15.public
 * String toFlowNo(String on)//根据填写的流程权限转化为存储字符OK
 * 
 * 16.public boolean verifyPwd(String pwd)//验证人员秘密 17.public String
 * getOrgName(String strOrgNo)//通过部门编号得到部门名称
 * 
 * 18.public Vector getOnePage(int page,int records)//分页时取得一页的数据量
 * 
 * 19.public String getBMBH()//取得当前职工的部门编号 new 陈 20.public String
 * getZGMC()//取得当前职工的职工名称 new 陈 21.public String getBgColor()//取得需要必填项目之背景色 new
 * 陈
 * 
 * 22.public boolean isUsed(gh)//判断工号是否已经有人用
 * 
 * 23.public Vector getAllData()//取得ZGB中的所有数据(许晓昕) 24.public Vector getData(str
 * strLCQX)//取得拥有此流程权限的人员记录列表
 * 
 * 25.public String getApartName(String bmno)//取得某部门的部门名称 26.public String
 * getFatherName(String bmno)//返回父部门的名称串 27. public Vector getWastePs(boolean
 * isfather) //返回所有退休、离职、挂起的人员信息 28.public void delDBPs()//从数据库中永久删除离退休等人员信息 29.
 * public String getBmName()//取得当前人员的部门名称 30.public String getZGGH(string
 * zgno)//取得当前人员的工号
 * 
 * 11-30 lbh 31.public boolean isFlowRight(String strLCQX) //是否有流程权限 32. public
 * String getFlowIdPart() //取得某人再某个部门的流程权限 33. public Vector getFlowBM(String
 * strLCQX) //取得所有有某个流程权限的人的部门 34. public DefaultMutableTreeNode
 * CutBMTree(DefaultMutableTreeNode root,String strLCQX) //对部门树进行剪枝 added by 许晓昕
 * 12-1 lbh 35.public int modBasisPsInf(Hashtable hash)//登陆者修改自己的基本信息 12-6 lbh
 * 35.public int modPswInf(Hashtable hash)//登陆者修改自己的密码信息
 * 
 * 
 * 
 * History: 1. Date:2003-10-30,11-1 Author:李伯华
 * Modification:函数getConf;getOnePage;getData(boolean isfather,String
 * pxzd,boolean isdesc,String srchzd,String srchzdval,boolean isexact);等等 2.
 * Date:2003-11-16 Author:李伯华 Modification:修改函数addPerson(Hashtable
 * hash)//增加人员数据记录 3. Date:2003-11-22 Author:李伯华
 * Modification:修改函数delPerson(Hashtable hash)//删除人员数据记录 public Vector
 * getData(boolean isfather,String pxzd,boolean isdesc,String srchzd,String
 * srchzdval,boolean isexact) 增加函数public String getFatherName(String
 * bmno)//返回父部门的名称串 public String getApartName(String bmno)//取得某部门的部门名称 3.
 * Date:2003-11-23 Author:李伯华 Modification:增加函数 public Vector getWastePs(boolean
 * isfather) //返回所有退休、离职、挂起的人员信息 public void delDBPs()//从数据库中永久删除离退休等人员信息 4.
 * Date:2003-11-24 Author:李伯华 Modification: 大改public String getOper()
 * //通过职工编号得到当前职务的操作权限,没转化为汉字 增加函数public String toOperName(String
 * strOperNo)//将getOper返回的操作权限编号转为汉字new
 * 
 * 大改public String getFlow() //通过职工编号得到当前职务的流程权限,没转化为汉字 public String
 * toFlowName(String strFlowNo)//将getFlow返回的流程权限编号转为汉字new 11-30 lbh 31.public
 * boolean isFlowRight(String strLCQX) //是否有流程权限 32. public String
 * getFlowIdPart() //取得某人再某个部门的流程权限 33. public Vector getFlowBM(String strLCQX)
 * //取得所有有某个流程权限的人的部门 34. public DefaultMutableTreeNode
 * CutBMTree(DefaultMutableTreeNode root,String strLCQX) //对部门树进行剪枝 added by 许晓昕
 * 12-1 lbh 35.public int modBasisPsInf(Hashtable hash)//登陆者修改自己的基本信息
 * 
 * 12-12. public String getOrgNO()
 * 
 * 2004-3-28: public String getMyFlow() //从静态向量中取得流程权限 2004-4-1: public String
 * getMyOper() //从静态向量中取得操作权限 2004-6-21 public int resumePs() //恢复挂起人员
 ******************************************************************************/
package oa.bean;

import java.util.*;
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 news.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 news.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 news.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 news.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 news.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 news.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;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -