Java项目:HR人事管理系统(计算机毕业设计)

作者主页:Java毕设网

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

一、项目介绍

本项目为基于SSH的HR人事管理系统,可以完美运行。
主要分为超级管理员与普通管理员两种角色;
管理员主要功能包括:
系统管理员:管理员管理、修改密码;
部门信息管理:部门信息添加、部门信息查询;
员工信息管理:新员工登记、员工信息查询;
合同信息管理:合同信息添加、合同信息查询;
考勤信息管理:员工请假信息查询审核、考勤信息添加、考勤信息查询;
工资信息管理:工资信息添加、工资信息查询;
应聘信息管理:应聘信息添加、应聘信息查询;
调职信息管理:调职信息添加、调职信息查询;
离职信息管理:离职信息添加、离职信息查询;
复职信息管理:复职信息添加、复职信息查询;
系统管理;

普通管理员无法对管理员账号信息修改,其它功能类似;

二、环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 

5.数据库:MySql 5.7版本;

6.是否Maven项目:否;

三、技术栈

1. 后端:Spring Struts2 Hibernate

2. 前端:JSP+css+javascript+jQuery+easyUI+ztree

四、使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中db.properties配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入http://localhost:8080/login.jsp 登录

五、运行截图


六、相关代码

登录控制器

public class MainCtrl extends HttpServlet {

	public MainCtrl() {
		super();
	}

	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

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

	public void go(String url,HttpServletRequest request, HttpServletResponse response)
	{
		try {
			request.getRequestDispatcher(url).forward(request, response);
		} catch (ServletException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public void gor(String url,HttpServletRequest request, HttpServletResponse response)
	{
		try {
			response.sendRedirect(url);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("text/html");
		PrintWriter out = response.getWriter();
		String ac = request.getParameter("ac");
		if(ac==null)ac="";
		CommDAO dao = new CommDAO();
		String date = Info.getDateStr();
		String today = date.substring(0,10);
		String tomonth = date.substring(0,7);

		if(ac.equals("login"))
		{
			String username = request.getParameter("username");
			String password = request.getParameter("pwd1");
			String utype = request.getParameter("cx");
			String pagerandom = request.getParameter("pagerandom")==null?"":request.getParameter("pagerandom");
			String random = (String)request.getSession().getAttribute("random");
			if(!pagerandom.equals(random)&&request.getParameter("a")!=null)
			{
				request.setAttribute("random", "");
				go("/index.jsp", request, response);
			}
			else{
				String sql1="";
				if (utype.equals("ע���û�"))
				{
					sql1 = "select * from yonghuzhuce where yonghuming='"+username+"' and mima='"+password+"' and issh='��'";

				}
				else
				{
					sql1 = "select * from yuangongxinxi where gonghao='"+username+"' and mima='"+password+"'";
				}
				List<HashMap> userlist1 = dao.select(sql1);
				if(userlist1.size()==1)
				{
					if (utype.equals("ע���û�"))
					{
						request.getSession(). setAttribute("username", userlist1.get(0).get("yonghuming"));
					}
					else
					{
						request.getSession(). setAttribute("username", userlist1.get(0).get("gonghao"));
					}
					request.getSession(). setAttribute("cx", utype);
					gor("index.jsp", request, response);
				}else{
					request.setAttribute("error", "");
					go("/index.jsp", request, response);
				}
			}
		}

		if(ac.equals("adminlogin"))
		{
			String username = request.getParameter("username");
			String password = request.getParameter("pwd");
			String utype = request.getParameter("cx");
			String pagerandom = request.getParameter("pagerandom")==null?"":request.getParameter("pagerandom");
			String random = (String)request.getSession().getAttribute("random");
			if(!pagerandom.equals(random)&&request.getParameter("a")!=null)
			{
				request.setAttribute("random", "");
				go("/login.jsp", request, response);
			}
			else{
				String sql1="";
				if (utype.equals("Ա��"))
				{
					sql1 = "select * from yuangongxinxi where yuangongbianhao='"+username+"' and mima='"+password+"'";
				}
				else
				{
					if (utype.equals("���ž���"))
					{
						sql1 = "select * from bumenjingli where bumenbianhao='"+username+"' and mima='"+password+"'";

					}
					else
					{
						sql1 = "select * from allusers where username='"+username+"' and pwd='"+password+"'";
					}
				}

				List<HashMap> userlist1 = dao.select(sql1);
				if(userlist1.size()==1)
				{
					if (utype.equals("Ա��"))
					{
						request.getSession(). setAttribute("username", userlist1.get(0).get("yuangongbianhao"));
						request.getSession(). setAttribute("cx", utype);
					}
					else

					{	if (utype.equals("���ž���"))
					{
						request.getSession(). setAttribute("username", userlist1.get(0).get("bumenbianhao"));
						request.getSession(). setAttribute("cx", utype);

					}
					else
					{
						request.getSession(). setAttribute("username", userlist1.get(0).get("username"));
						request.getSession(). setAttribute("cx",  userlist1.get(0).get("cx"));
					}
					}

					gor("main.jsp", request, response);
				}else{
					request.setAttribute("error", "");
					go("/login.jsp", request, response);
				}
			}
		}

		if(ac.equals("uppass"))
		{
			String olduserpass = request.getParameter("ymm");
			String userpass = request.getParameter("xmm1");
			String copyuserpass = request.getParameter("xmm2");
			HashMap m = dao.getmaps("yonghuming",(String)request.getSession().getAttribute("username"), "yonghuzhuce");
			if(!(((String)m.get("mima")).equals(olduserpass)))
			{
				request.setAttribute("error", "");
				go("mod2.jsp", request, response);
			}else{
				//String id = (String)user.get("id");
				String sql = "update yonghuzhuce set mima='"+userpass+"' where yonghuming='"+(String)request.getSession().getAttribute("username")+"'";
				dao.commOper(sql);
				request.setAttribute("suc", "");
				go("mod2.jsp", request, response);
			}
		}

上传管理控制器

public class Upload extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public Upload() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		this.doPost(request, response);
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		StringBuffer   sb   =   new   StringBuffer(50);   
		 response.setContentType("application/x-msdownload;charset=GB2312");   
        try {
			response.setHeader("Content-Disposition",   new   String(sb.toString()   
			         .getBytes(),   "ISO8859-1"));
		} catch (UnsupportedEncodingException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		 String filename = request.getParameter("filename");
		  if (request.getHeader("User-Agent").toLowerCase().indexOf("firefox") > 0){
		     try {
				filename = new String(filename.getBytes("gb2312"), "ISO8859-1");
			} catch (UnsupportedEncodingException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		 }
		 else 
		      if (request.getHeader("User-Agent").toUpperCase().indexOf("MSIE") > 0){
		           try {
					filename = URLEncoder.encode(filename, "gb2312");
				} catch (UnsupportedEncodingException e) {
					// TODO Auto-generated catch block
					 
				}
		      }
		 response.setContentType("text/plain");
		 response.setHeader("Location",filename);
		 response.reset();
		 response.setHeader("Cache-Control", "max-age=0" );
		 response.setHeader("Content-Disposition", "attachment; filename=" + filename);
		   

		    try {
				       BufferedInputStream bis = null;
					   BufferedOutputStream bos = null;
					   OutputStream fos = null;
					  // File f = new File(request.getRealPath("/upfile/")+"/"+filename);
					   //System.out.println(f);
					   bis = new BufferedInputStream((InputStream)new FileInputStream(request.getRealPath("/upfile/")+"/"+filename));
					    fos = response.getOutputStream();
					    bos = new BufferedOutputStream(fos);

					    int bytesRead = 0;
					    byte[] buffer = new byte[5 * 1024];
					    while ((bytesRead = bis.read(buffer)) != -1) {
					     bos.write(buffer, 0, bytesRead);
					    }
					    bos.close();
					    bis.close();
					    fos.close();
				
		               new Info().delPic(request.getRealPath("/upfile/")+"/", filename);
		     } catch (Exception e) {
				 
			}finally{
			}
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException {
		// Put your code here
	}

}

七、如果也想学习本系统,下面领取。关注并回复:140jsp

  • 19
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
spring+spring mvc+mybatis开发java医院HR人事管理系统(加强版本+ shiro) 项目描述 java web医院HR后台管理系统(增加shiro) 运行环境 jdk7+tomcat7+mysql+MyEclipse+maven 项目技术(必填) spring+spring mvc+mybatis+bootstrap+jquery+jsp+shiro #权限相关的表在tab.sql中 **项目说明** - 想学习spring mvc 在《最代码》中找到了一个,程序比较简单,正好适合我,但后面一看,系统应该也是一个初学者写的,没有权限管理,没有认证,漏洞也很多,所以我加了shiro权限和认证管理,完成后应该可以使用基本功能了。后面我想再把菜单动态生成这块改改,再加上防注入攻击等,呵呵,要改的地方真的很多,所以找简单的代码就得这样,完整的系统代码又比较深,不适合我这种初学者。继续加油吧,如果有其它人加上一些功能,希望一定共享出来,毕竟我这四十多岁的程序员,写代码效率真的很差了。 **增加的内容** 1、后台密码采用md5方式,修改相关注册程序,修改用户表password长度 2、前台登陆采用增加图片认证码 3、登陆认证采用shiro安全方式 4、各功能菜单使用了shiro权限管理 5、增加了一套权限管理表,角色表,权限表,用户与角色,用户与权限,角色与权限,菜单表,里面逻辑不多说了应该大家都懂得。后续想增加的,菜单根据权限和菜单来动态展现,工作流,防注入攻击等等 数据库文件 链接:https://pan.baidu.com/s/1TVsLc1iKkTfFndiJYG57qg 提取码:q727 jar包文件 maven搭建 链接:https://pan.baidu.com/s/1er4pBMoY1hQhaqyobFuflw 提取码:ii4b

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值