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

📄 orgservlet.java

📁 “JSP数据库项目案例导航”一书从第一章到第十一章各章实例的源程序文件以及数据库文件。 注意: 1. 本书中的案例提供的数据库环境不同
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
				strOrgNO=ds.toString((String)request.getParameter("txt_bmno"));
				psbean.setOrgNO(strOrgNO);
				psbean.setPersonNO(strPersonNO);
				//String bmNo = strOrgNO;
				String zzZt = ds.toGBK(request.getParameter("txt_zzzt"));
				if(zzZt.equals("正常"))zzZt = "0";
				if(zzZt.equals("离职"))zzZt = "1";
				if(zzZt.equals("退休"))zzZt = "2";
				if(zzZt.equals("挂起"))zzZt = "3";
				//String zgNo = strPersonNO;
				String zgName = ds.toGBK(request.getParameter("txt_xm"));
				String zgGH = ds.toGBK(request.getParameter("txt_gh"));
				String psWord = ds.toGBK(request.getParameter("password_check"));
				String pswQuestion = ds.toGBK(request.getParameter("txt_mmwt"));
				String pswKey = ds.toGBK(request.getParameter("txt_mmda"));
				String Sex = ds.toGBK(request.getParameter("txt_xb"));
				String birthDay = ds.toGBK(request.getParameter("txt_csny"));
				String mz = ds.toGBK(request.getParameter("txt_mz"));
				String zzmm = ds.toGBK(request.getParameter("txt_zzmm"));
				String xli = ds.toGBK(request.getParameter("txt_xl"));
				String zhich = ds.toGBK(request.getParameter("txt_zc"));
				String bgphone = ds.toGBK(request.getParameter("txt_bgdh"));
				String fjphone = ds.toGBK(request.getParameter("txt_fjdh"));
				String jtphone = ds.toGBK(request.getParameter("txt_jtdh"));
				String mobile = ds.toGBK(request.getParameter("txt_mobile"));
				String address = ds.toGBK(request.getParameter("txt_address"));
				String code = ds.toGBK(request.getParameter("txt_yzbm"));
				String qqNo = ds.toGBK(request.getParameter("txt_qq"));
				String email = ds.toGBK(request.getParameter("txt_email"));
				String username = ds.toGBK(request.getParameter("txt_username")).toLowerCase();
				String regdate = ds.toGBK(request.getParameter("txt_regdate"));
				String grjj = ds.toGBK(request.getParameter("txt_grjj"));
				String jbxh = ds.toGBK(request.getParameter("txt_jbxh"));
				String znyh = ds.toGBK(request.getParameter("txt_znyh"));


//				String czqx = ds.toGBK(request.getParameter("txt_doright"));
//				czqx = psbean.toOperNo(czqx);
//				String lcqx = ds.toGBK(request.getParameter("txt_roadright"));
//				lcqx = psbean.toFlowNo(lcqx);

				String confPara = ds.toGBK(request.getParameter("txt_confpara"));

				if(confPara == null) confPara = "";

				Hashtable ht = new Hashtable();
				//ht.put("BMBH",bmNo);
				//ht.put("ZGBH",zgNo);
				ht.put("XM",zgName);
				ht.put("GH",zgGH);
//				ht.put("CZQX",czqx);
//				ht.put("LCQX",lcqx);
				ht.put("PZCS",confPara);
				ht.put("MMWT",pswQuestion);
				ht.put("MMDA",pswKey);
				ht.put("MM",psWord);
				ht.put("XB",Sex);
				ht.put("CSNY",birthDay);
				ht.put("MZ",mz);
				ht.put("ZZMM",zzmm);
				ht.put("XL",xli);
				ht.put("ZC",zhich);
				ht.put("QQ",qqNo);
				ht.put("BGDH",bgphone);
				ht.put("FJDH",fjphone);
				ht.put("YZBM",code);
				ht.put("JTDZ",address);
				ht.put("JTDH",jtphone);
				ht.put("YDDH",mobile);
				ht.put("EMAIL",email);
				ht.put("ZZZT",zzZt);
				ht.put("YHM",username);
				ht.put("ZCRQ",regdate);
			//	ht.put("DJGL",);
//				ht.put("FBWZ","0");
//				ht.put("GLYH","1");
				ht.put("GRJJ",grjj);
				ht.put("JBXH",jbxh);
				ht.put("ZNYH",znyh);
				errcode = psbean.modPerson(ht);
				//返回到查看某部门人员列表的界面    "+strEdit+"

				if(strPage.equals("2")||strPage.equals("4")||strPage.equals("5")) response.sendRedirect("oa/organization/index.jsp?txt_type=3&txt_edit=1&txt_page="+strPage+"&txt_personno="+strPersonNO+"&txt_orgno="+strOrgNO+"&errcode="+errcode);

				else	response.sendRedirect("oa/organization/index.jsp?txt_type=3&txt_page="+strPage+"&txt_personno="+strPersonNO+"&txt_orgno="+strOrgNO+"&errcode="+errcode);
			}

//登陆者修改个人的基本信息
			if(strType!=null && strType.equals("3") && strEdit.equals("6"))
			{
				strOrgNO=ds.toString((String)request.getParameter("txt_bmno"));
				psbean.setOrgNO(strOrgNO);
				psbean.setPersonNO(strPersonNO);

				//String zgName = ds.toGBK(request.getParameter("txt_xm"));
				String oldPsw = ds.toGBK(request.getParameter("old_psw"));
				boolean bool = psbean.verifyPwd(oldPsw);
				if(!bool)
				{
					errcode = 7;
					response.sendRedirect("oa/organization/index.jsp?txt_type=3&txt_edit=6&txt_personno="+strPersonNO+"&txt_orgno="+strOrgNO+"&errcode="+errcode);
				}
				else{
					String newPSWord = ds.toGBK(request.getParameter("password_check"));
					String surePSWord = ds.toGBK(request.getParameter("pass_checkagain"));
					String pswQuestion = ds.toGBK(request.getParameter("txt_mmwt"));
					String pswKey = ds.toGBK(request.getParameter("txt_mmda"));
					String Sex = ds.toGBK(request.getParameter("txt_xb"));
					String birthDay = ds.toGBK(request.getParameter("txt_csny"));
					String mz = ds.toGBK(request.getParameter("txt_mz"));
					String zzmm = ds.toGBK(request.getParameter("txt_zzmm"));
					String xli = ds.toGBK(request.getParameter("txt_xl"));
					String zhich = ds.toGBK(request.getParameter("txt_zc"));
					String bgphone = ds.toGBK(request.getParameter("txt_bgdh"));
					String fjphone = ds.toGBK(request.getParameter("txt_fjdh"));
					String jtphone = ds.toGBK(request.getParameter("txt_jtdh"));
					String mobile = ds.toGBK(request.getParameter("txt_mobile"));
					String address = ds.toGBK(request.getParameter("txt_address"));
					String code = ds.toGBK(request.getParameter("txt_yzbm"));
					String qqNo = ds.toGBK(request.getParameter("txt_qq"));
					String email = ds.toGBK(request.getParameter("txt_email"));
					String username = ds.toGBK(request.getParameter("txt_username")).toLowerCase();
					String photo = ds.toGBK(request.getParameter("txt_pic"));
					String znyh = ds.toGBK(request.getParameter("txt_znyh"));
					if(photo==null || photo.equals(""))photo="0";
					String grjj = ds.toGBK(request.getParameter("txt_grjj"));

					Hashtable ht = new Hashtable();
					//ht.put("XM",zgName);
					if(newPSWord==null || newPSWord.equals(""))
						ht.put("MM",oldPsw);
					else
						ht.put("MM",newPSWord);
					ht.put("MMWT",pswQuestion);
					ht.put("MMDA",pswKey);
					ht.put("XB",Sex);
					ht.put("CSNY",birthDay);
					ht.put("MZ",mz);
					ht.put("ZZMM",zzmm);
					ht.put("XL",xli);
					ht.put("ZC",zhich);
					ht.put("BGDH",bgphone);
					ht.put("FJDH",fjphone);
					ht.put("JTDH",jtphone);
					ht.put("YDDH",mobile);
					ht.put("JTDZ",address);
					ht.put("YZBM",code);
					ht.put("QQ",qqNo);
					ht.put("EMAIL",email);
					ht.put("YHM",username);
					ht.put("PHOTO",photo);
					ht.put("GRJJ",grjj);
					ht.put("ZNYH",znyh);
					errcode = psbean.modBasisPsInf(ht);
					//返回到查看某人基本信息的界面

					response.sendRedirect("oa/organization/index.jsp?txt_type=3&txt_edit=3&txt_personno="+strPersonNO+"&txt_orgno="+strOrgNO+"&errcode="+errcode);
				}
			}
//登陆者修改个人的密码信息
			if(strType!=null && strType.equals("3") && strEdit.equals("7"))
			{
				//strOrgNO=ds.toString((String)request.getParameter("txt_bmno"));
				//psbean.setOrgNO(strOrgNO);
				psbean.setPersonNO(strPersonNO);
				String oldPsw = ds.toGBK(request.getParameter("old_psw"));
				boolean bool = psbean.verifyPwd(oldPsw);
				if(!bool)
				{
					errcode = 7;
					response.sendRedirect("oa/organization/index.jsp?txt_type=3&txt_edit=7&txt_personno="+strPersonNO+"&txt_orgno="+strOrgNO+"&errcode="+errcode);
				}
				else{
					String newPSWord = ds.toGBK(request.getParameter("password_check"));
					String surePSWord = ds.toGBK(request.getParameter("pass_checkagain"));
					String pswQuestion = ds.toGBK(request.getParameter("txt_mmwt"));
					String pswKey = ds.toGBK(request.getParameter("txt_mmda"));
					Hashtable ht = new Hashtable();
					ht.put("MM",newPSWord);
					ht.put("MMWT",pswQuestion);
					ht.put("MMDA",pswKey);
					errcode = psbean.modPswInf(ht);
					//返回到查看某人基本信息的界面

					response.sendRedirect("oa/organization/index.jsp?txt_type=3&txt_edit=3&txt_personno="+strPersonNO+"&txt_orgno="+strOrgNO+"&errcode="+errcode);
				}
			}

//删除人员信息
			if(strType!=null && strType.equals("3") && strEdit.equals("3"))
			{
				psbean.setPersonNO(strPersonNO);
				errcode = psbean.delPerson();  //ZZ_ZGB,ZZ_BMB,ZZ_ZGZWB
				//返回到查看某部门人员列表的界面
				response.sendRedirect("oa/organization/index.jsp?txt_type=3&txt_orgno="+strOrgNO+"&errcode="+errcode);
			}
//从数据库中永久删除离退休等人员信息
			if(strType!=null && strType.equals("3") && strEdit.equals("4"))
			{
				psbean.setPersonNO(strPersonNO);
				psbean.delDBPs();
				//返回到查看某部门人员列表的界面
				response.sendRedirect("oa/organization/index.jsp?txt_type=3&txt_edit=5&txt_orgno="+strOrgNO);
			}
//从数据库中恢复离退休等人员信息
			if(strType!=null && strType.equals("3") && strEdit.equals("5"))
			{
				psbean.setPersonNO(strPersonNO);
				psbean.resumePs();
				//返回到查看某部门人员列表的界面
				response.sendRedirect("oa/organization/index.jsp?txt_type=3&txt_edit=5&txt_orgno="+strOrgNO);
			}

//给个人分配职务--新增
			if(strType!=null && strType.equals("4"))
			{
				String zgno = strPersonNO;
				String bmbo = ds.toGBK(request.getParameter("hid_dutybmno"));
				String zwname = ds.toGBK(request.getParameter("txt_dutyName"));
				String czqx = ds.toGBK(request.getParameter("txt_doright"));
				String lcqx = ds.toGBK(request.getParameter("txt_roadright"));
				if(bmbo==null)bmbo="";
				if(zwname==null)zwname="";
				if(czqx==null)czqx="";
				if(lcqx==null)lcqx="";
				lcqx = psbean.toFlowNo(lcqx);

				psdbn.setDutyOrgNo(bmbo);
				String zwno = psdbn.getDutyNo(zwname);

				psdbn.addRec(zgno,bmbo,zwno,czqx,lcqx);

				//返回到查看某部门人员列表的界面
				if(strEdit.equals("1"))	response.sendRedirect("oa/organization/index.jsp?txt_type=4&txt_edit="+strEdit+"&txt_orgno="+strOrgNO+"&txt_personno="+strPersonNO);
				if(strEdit.equals("4")) response.sendRedirect("oa/organization/index.jsp?txt_type=4&txt_edit="+strEdit+"&txt_orgno="+strOrgNO+"&txt_personno="+strPersonNO);
			}
			if(strType!=null && strType.equals("4") && strEdit.equals("100"))
			{

			}

			 if(strType.equals("5"))//部门子类管理2003.11.29加入
			{
				omb = new OrgMenuBean();

				String strpbh = ds.toString(request.getParameter("txt_pid"));
				if(strpbh.equals("")) strpbh = "0";
				String strbh = ds.toString(request.getParameter("txt_id"));
				String strmc = ds.toString(ds.toGBK(request.getParameter("txt_bmboss")));
				String strjbxh = ds.toString(request.getParameter("txt_viewno"));

				if(strEdit.equals("1"))//新增设置
				{
					Hashtable hash = new Hashtable();
					hash.put("PBH",strbh);
					hash.put("BMBH",strOrgNO);
					hash.put("MC",strmc);
					hash.put("JBXH",strjbxh);

					errcode = omb.addMenu(hash);
				}
				else if(strEdit.equals("2"))//修改设置
				{
					Hashtable hash = new Hashtable();
					hash.put("PBH",strpbh);
					hash.put("BH",strbh);
					hash.put("BMBH",strOrgNO);
					hash.put("MC",strmc);
					hash.put("JBXH",strjbxh);
					errcode = omb.updateMenu(hash);
				}
				else if(strEdit.equals("3"))//删除设置
				{
					int intbh = Integer.parseInt(strbh);
					omb.setID(intbh);
					errcode = omb.delMenu();
				}

				String goen="oa/organization/index.jsp?txt_type="+strType+"&txt_orgno="+strOrgNO+"&errcode="+errcode;
				response.sendRedirect(goen);
			}
			if(strType!=null && strType.equals("6"))//修改个人职务权限
			{
				String zgno = strPersonNO;
				String bmno = ds.toGBK(request.getParameter("hid_dutybmno"));
				String zwno = ds.toGBK(request.getParameter("hid_dutyzwno"));
				String czqx = ds.toGBK(request.getParameter("txt_doright"));
				//czqx = psbean.toOperNo(czqx);
				String lcqx = ds.toGBK(request.getParameter("txt_roadright"));
				String selectedDuty = ds.toString(request.getParameter("selectedDuty"));

				if(bmno==null)bmno="";
				if(zwno==null)zwno="";
				if(czqx==null)czqx="";
				if(lcqx==null)lcqx="";
				lcqx = psbean.toFlowNo(lcqx);

				psdbn.modRec(zgno,bmno,zwno,czqx,lcqx);

				//返回修改人员职务权限界面
				response.sendRedirect("oa/organization/index.jsp?txt_type=6&txt_edit="+strEdit+"&txt_orgno="+strOrgNO+"&txt_personno="+strPersonNO+"&selectedDuty="+selectedDuty);
			}
//分配版面权限
			if(strType!=null && strType.equals("7") && strEdit.equals("1"))
			{
				String eero1 = "";
				String eero2 = "";

				//先删除已有记录
		        String eero3 = "";
				String eero4 = "";
				String deletestr00 = strDutyNO;
				if(!deletestr00.equals(""))
				{
					String deletestr[] = deletestr00.split(",");
					for(int i=0;i<deletestr.length;i++)
					{
						mnbean.setID(Integer.parseInt(deletestr[i]));
						eero3 = eero3 + String.valueOf(mnbean.delNews());
						eero4 = eero4 + "0";
					}

				}


				String strng = strPage;
				Hashtable ht = new Hashtable();

				String str[] = strng.split(";");
				for(int i=0;i<str.length;i++)
				{

					//<%=state%>_<%=whichtable%>_<%=strmenu%>_<%=i%>
					str[i] = str[i] + "_";
					String stg[] = str[i].split("_");

					ht.clear();
					ht.put("ZGBH",strPersonNO);
					ht.put("LB","1");
					ht.put("DXBH",stg[2]);
					ht.put("SF",stg[0]);

					if(stg[0].equals("2")) ht.put("CZ",stg[3]);
					else					ht.put("CZ","");
					ht.put("WHICHTALBE",stg[1]);
					ht.put("BMBH","");
					ht.put("SFGL","");

					errcode = mnbean.addNews(ht);
					eero1 = eero1 + String.valueOf(errcode);
					eero2 = eero2 + "0";
				}
				errcode = 7; //Integer.parseInt(eero1);
				if(!eero1.equals(eero2) && !eero3.equals(eero4)) response.sendRedirect("err.jsp?ip=organization/index.jsp&txt_type="+strType+"&errcode="+7);
				else
				{
					if(!eero1.equals(eero2)) response.sendRedirect("err.jsp?ip=organization/index.jsp&txt_type="+strType+"&errcode="+8);
					if(!eero3.equals(eero4)) response.sendRedirect("err.jsp?ip=organization/index.jsp&txt_type="+strType+"&errcode="+9);

				}
			}
			if(strType!=null&&strType.equals("9")&&strEdit.equals("1"))//部门合并
			{
				String strDepA=ds.toString(request.getParameter("dep1"));
				String strDepB=ds.toString(request.getParameter("dep2"));
				int err = dbean.unit(strDepA,strDepB);
				response.sendRedirect("oa/datamanage/dep_mix.jsp?err="+err);
			}
//...........................可添加其他页面操作....................................//


//...........................可添加其他页面操作....................................//
		}catch (Exception e){System.out.println("OrgServlet处理时出错;错误为:"+e);}
		finally{
			if(dbean != null)	dbean.closeConn();
			if(dutybn != null)	dutybn.closeConn();
			if(psbean != null)	psbean.closeConn();
			if(psdbn != null)	psdbn.closeConn();
			if(dabean != null)	dabean.closeConn();
			if(mnbean != null)	mnbean.closeConn();
			if(omb != null)		omb.closeConn();
		}
	}


	public void doPost(HttpServletRequest request ,HttpServletResponse response)throws IOException, ServletException
	{
		doGet(request,response);
	}
}

⌨️ 快捷键说明

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