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

📄 personbean.java

📁 企业员工信息管理系统
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
		String strMRCZ = "1";
		String strSYZT = "0";
		String str1 = ",";
		String str2 = "@";
		String strBMBH = "";
		String strZWBH = "";
		String strMax = "";
		int i,j;

		sql = "select LCQX from ZZ_ZGZWB where ZGBH = '"+strPersonNO+"'";
		ResultSet rs = null;	
		Statement stmt = null;
		try{
		rs = selectRecord(sql);

		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  ";
			ResultSet rs1 = selectRecord(sql);
			try{
				while(rs1.next())//把此职工的所有职务的权限用(@)分割存储
				{
					String strX = ds.toString(rs1.getString("LCQX"));//取得某一职务的权限
					//System.out.println("\r\nwwwwwwwwwwwwwwwww zgbh = "+strPersonNO+" lcqx="+strX);
					if (!strX.equals(""))
					{						
						strMax+=strX+str2;
					}
				}
			}catch(Exception e){System.out.println("运行时出错:"+e);}
			finally{
				if(rs1!=null)try{ stmt = rs1.getStatement(); rs1.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);
		/*	String strFlows[] = strFlow.split(",");
			for(i=0;i<strFlows.length;i++)//根据分割后的编号取得模块名称
			{
				strFlow+=db.toName("CODE_ANCZQXB","MKBH","MKMC",strFlows[i])+str1;
			}
			strFlow = strFlow.substring(0,strFlow.length()-1);*/
	
		return strFlow;
	}

	//通过职工编号得到当前职务的流程权限,没转化为汉字
	public boolean getFlow_new(String bmno,String qx)
	{
		boolean strFlow = false;
		String sql = "";

		String sql1 = " select distinct LCQX as AAA from ZZ_ZGZWB where LCQX is not null and ZGBH in (select ZGBH from ZZ_ZGB where BMBH='"+bmno+"')";
		String sql2 = " select distinct a.LCQX from ZZ_ZWB a,ZZ_ZGZWB b where a.LCQX is not null and a.zwzt<>1 and a.BMBH=b.BMBH and a.ZWBH=b.ZWBH and b.ZGBH in (select ZGBH from ZZ_ZGB where BMBH ='"+bmno+"')";
		String sql3 = " select to_char(MKBH) as AAA from CODE_LCQXB where MRCZ = 1 and SYZT = 0";
		sql = sql1 + " union " + sql2 + " union "+ sql3;
		

		ResultSet rs = selectRecord(sql1);
		Statement stmt = null;
		String t = "";
		try{
		while(rs.next())
		{
			t = rs.getString(1);
			if(t.equals(qx)||t.indexOf(","+qx)!=-1||t.indexOf(","+qx+",")!=-1||t.indexOf(qx+",")!=-1)
			{
				strFlow = true;
				break;
			}
		}
		}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(!strFlow)
		{

			ResultSet rs2 = selectRecord(sql2);
			try{
			while(rs2.next())
			{
				t = rs2.getString(1);
				//System.out.println("b"+t+"b");
				if(t.equals(qx)||t.indexOf(","+qx)!=-1||t.indexOf(","+qx+",")!=-1||t.indexOf(qx+",")!=-1)
				{
					strFlow = true;
					break;
				}
			}
			}catch(Exception e){System.out.println("运行时出错:"+e);}
			finally{
				if(rs2!=null)try{ stmt = rs2.getStatement(); rs2.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)
		{
			ResultSet rs3 = selectRecord(sql3);
			try{
			while(rs3.next())
			{
				t = rs3.getString(1);
				if(t.equals(qx)||t.indexOf(","+qx)!=-1||t.indexOf(","+qx+",")!=-1||t.indexOf(qx+",")!=-1)
				{
					strFlow = true;
					break;
				}
			}
			}catch(Exception e){System.out.println("运行时出错:"+e);}
			finally{
				if(rs3!=null)try{ stmt = rs3.getStatement(); rs3.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
				if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}		
			}
		}		
		return strFlow;
	}

	//通过职工编号得到当前职工的配置参数
	public String getConf()
	{
		String strConf = "";
		String sql = "";
		String str1 = ",";
		String str2 = "@";
		String strBMBH = "";
		String strZWBH = "";
		String strMax = "";
		int i,j,num=0;
		String []xm = new String[10];//{"邮箱空间:","附件大小:","个人通讯录数目:","文件柜大小:",""};//
		String []unit = new String[10];//{"MB","MB","条","MB",""};//

		sql = "select PZBH,PZMC,PZSZ,PZSM from CODE_XTPZ order by PZBH ";
		ResultSet rs = selectRecord(sql);
		Statement stmt = null;
		try{
		while(rs.next())
		{
			xm[num] = ds.toString(rs.getString("PZMC"));
			unit[num] = ds.toString(rs.getString("PZSM"));
			num++;
		}

		sql = "select PZCS from ZZ_ZGB where ZGBH = '"+strPersonNO+"'";
		stmt = rs.getStatement(); rs.close(); stmt.close();
		rs = selectRecord(sql);
		if(rs.next())
		{
			strConf = ds.toString(rs.getString("PZCS"));
			if (!strConf.equals(""))//如果职工中的配置参数不空
			{
				String sglemt[] = strConf.split(",");
				
				for(i=0;i<sglemt.length;i++)
				{
					if(!strMax.equals(""))
						strMax+=str1+xm[i]+sglemt[i]+unit[i];
					if(strMax.equals(""))
						strMax = xm[i]+sglemt[i]+unit[i];
				}

				strConf = strMax;
				return strConf;	//ok			
			}

			if (strConf.equals(""))//如果职工中的配置参数为空
			{
				sql = "select BMBH,ZWBH from ZZ_ZGZWB where ZGBH = '"+strPersonNO+"'";
				ResultSet res = selectRecord(sql);
				try{
				while(res.next())//找此职工所有职务的配置参数
				{
					strBMBH = ds.toString(res.getString("BMBH"));
					strZWBH = ds.toString(res.getString("ZWBH"));
					sql = "select PZCS from ZZ_ZWB where BMBH = '"+strBMBH+"' and ZWBH = '"+strZWBH+"'";
					ResultSet rest = selectRecord(sql);
					try{
					if(rest.next())//把此职工的所有配置参数用(@)分割存储
					{
						String strX = ds.toString(rest.getString("PZCS"));//取得某一职务的权限
						if (!strX.equals(""))
						{						
							strMax+=strX+str2;
						}
					}
					}catch(Exception e){System.out.println("运行时出错:"+e);}
					finally{
						if(rest!=null)try{ stmt = rest.getStatement(); rest.close();}catch(Exception e){System.out.println("关闭记录集rs时出错"+e);}
						if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("关闭声明时statement出错"+e);}		
					}
				}
				}catch(Exception e){System.out.println("运行时出错:"+e);}
				finally{
					if(res!=null)try{ stmt = res.getStatement(); res.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 PZBH,PZSZ from CODE_XTPZ order by PZBH ";
					ResultSet r = selectRecord(sql);
					try{
					while(r.next())
					{
						strConf+=ds.toString(r.getString("PZSZ"))+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);}		
					}
					strConf = strConf.substring(0,strConf.length()-1);
					String sglelement[] = strConf.split(",");
					
					for(i=0;i<sglelement.length;i++)
					{
						if(!strMax.equals(""))
							strMax+=str1+xm[i]+sglelement[i]+unit[i];
						if(strMax.equals(""))
							strMax = xm[i]+sglelement[i]+unit[i];
					}

					strConf = strMax;
					return strConf;	//ok			
				}
				strMax = strMax.substring(0,strMax.length()-1);

				String strMaxConf[] = strMax.split("@");
				strMax = "";

				for (int k=0;k<num;k++ )//配置参数有几个字段项 num是需要配置的资源种类数
				{
					int singleMax=0;
					for(i=0;i<strMaxConf.length;i++)//取得此职工最大权限集合strMax
					{
						String strEp[] = strMaxConf[i].split(",");//@最小的'数'组了
						
						if(singleMax<Integer.parseInt(strEp[k]))
							singleMax = Integer.parseInt(strEp[k]);
					}
					if(!strMax.equals(""))
						strMax+=str1+xm[k]+String.valueOf(singleMax)+unit[k];
					if(strMax.equals(""))
						strMax = xm[k]+String.valueOf(singleMax)+unit[k];
				}

				//strMax=strMax.substring(0,strMax.length()-1);
				strConf = strMax;
			}
		}
		}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 strConf;
	}

	//根据填写的操作权限转化为存储字符
	public String toOperNo(String strOper)
	{
		String strOperNo = "";
		String str = ",";

		if(strOper.equals(""))//默认操作权限
		{
			return strOperNo;
		}
		String strOpers[] = strOper.split(",");
		for(int i=0;i<strOpers.length;i++)
		{	
			strOperNo+= db.toID("CODE_CZQXB","MKMC","MKBH",strOpers[i])+str;
		}
		strOperNo = strOperNo.substring(0,strOperNo.length()-1);	
		
		return strOperNo;
	}

	//根据填写的流程权限转化为存储字符
	public String toFlowNo(String strFlow)
	{
		String strFlowNo = "";
		String str = ",";

		if(strFlow.equals(""))//默认流程权限
		{
			return strFlowNo;
		}
		String strFlows[] = strFlow.split(",");
		for(int i=0;i<strFlows.length;i++)
		{
			if(!strFlows[i].equals(""))
			strFlowNo+= db.toID("CODE_LCQXB","MKMC","MKBH",strFlows[i])+str;
		}
		if(!strFlowNo.equals(""))
		 strFlowNo = strFlowNo.substring(0,strFlowNo.length()-1);		
		return strFlowNo;
	}


	//分页时取得一页的数据量
	public String getCZQXID(String mkmc,String anmc){
		String sql="select id from code_anczqxb where mkmc='"+mkmc+"' and anmc='"+anmc+"'";
		ResultSet rs=selectRecord(sql);
		Statement stmt = null;
		String CZQXID="0";
		try{
			if(rs.next()){
				CZQXID=rs.getString("id");
			}
		}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 CZQXID;
	}

    //分页时取得一页的数据量
	public Vector getOnePage(String sql,int page,int records)
	{
		return db.getOnePage(sql,page,records);
	}

	//验证人员秘密
	public boolean verifyPwd(String pwd)
	{
		String sql = "";
		sql = "select MM from ZZ_ZGB where ZGBH = '"+strPersonNO+"'";
		ResultSet rs =selectRecord(sql);
		Statement stmt = null;
		try{
			if(rs.next())
			{
				String strPassword = ds.toString(rs.getString("MM"));
				pwd = (new MD5()).toMD5(pw

⌨️ 快捷键说明

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