基于ssm+mysql+maven+html实现的员工绩效管理系统。该系统只有后台页面,后台前端框架使用的是layui官网推荐后台界面。
角色分为管理员和员工
管理员功能有:员工管理、职位管理、部门管理、岗位管理、工资管理、工龄管理、考勤管理、工资项管理等。
员工功能有:考勤管理、工资管理、个人信息。
运行环境:jdk1.8、tomcat7.0\8.5、maven3.5\3.6、eclip、mysql5.x。
后台员工管理控制器代码:
/*** 后台员工管理控制器* @author administrator**/@requestmapping("/admin/staff")@controllerpublic class staffcontroller {@autowiredprivate staffrvice staffrvice;@autowiredprivate jobtitlervice jobtitlervice;@autowiredprivate rolervice rolervice;@autowiredprivate positionrvice positionrvice;@autowiredprivate departmentrvice departmentrvice;@autowiredpri则是什么意思vate operaterlogrvice operaterlogrvice;@autowiredprivate attendancervice attendancervice;/*** 员工列表页面* @param model* @param staff* @param pagebean* @return*/@requestmapping(value="/list")public string list(model model, staff staff, pagebean<staff> pagebean){model.addattribute("title", "员工列表");model.addattribute("jobnumber", staff.getjobnumber()==null?"":staff.getjobnumber());model.addattribute("pagebean", staffrvice.findlist(staff, pagebean));return "admin/staff/list";}/*** 新增员工页面* @param model* @return*/@requestmapping(value="/add",method=requestmethod.get)public string add(model model){model.addattribute("roles", rolervice.findall());model.addattribute("educationenum",educationenum.values());model.addattribute("jobtitlelist",jobtitlervice.findall());model.addattribute("positionlist",positionrvice.findall());model.addattribute("departmentlist",departmentrvice.findall());return "admin/staff/add";}/*** 员工添加表单提交处理* @param staff* @return*/@requestmapping(value="/add",method=requestmethod.post)@responbodypublic result<boolean> add(staff staff){//用统一验证实体方法验证是否合法codemsg validate = validateentityutil.validate(staff);if(validate.getcode() != codemsg.success.getcode()){return result.error(validate);}if(staff.getrole() == null || staff.getrole().getid() == null){return result.error(codemsg.admin_staff_role_error);}if(!stringutil.ismobile(staff.getmobile())){return result.error(codemsg.admin_staff_mobile_error);}if(!stringutil.ismobile(staff.getemergencymobile())){return result.error(codemsg.admin_staff_emergency_mobile_error);}//自动生成工号int maxid = staffrvice.findmaxid()+1;string jobnumber = dateutil.getcurrentdatetime("yyyymmdd");if(maxid<10){jobnumber=jobnumber+"0"+maxid;}el{jobnumber=jobnumber+maxid;}staff.tjobnumber(jobnumber);//到这说明一切符合条件,进行数据库新增if(staffrvice.save(staff) == null){return result.error(codemsg.admin_staff_add_error);}operaterlogrvice.add("添加员工,员工名:" + staff.getname());return result.success(true);}@requestmapping(value="/edit_lf",method=requestmethod.post)@responbodypublic result<boolean> edit_lf(staff staff, httprvletrequest request){//用统一验证实体方法验证是否合法codemsg validate = validateentityutil.validate(staff);if(validate.getcode() != codemsg.success.getcode()){return result.error(validate);}if(!stringutil.ismobile(staff.getmobile())){return result.error(codemsg.admin_staff_mobile_error);}if(!stringutil.ismobile(staff.getemergencymobile())){return result.error(codemsg.admin_staff_emergency_mobile_error);}if(staff.getid() == null || staff.getid().longvalue() <= 0){return result.error(codemsg.admin_staff_not_exist_error);}//到这说明一切符合条件,进行数据库保存staff findbyid = staffrvice.find(staff.getid());//讲提交的员工信息指定字段复制到已存在的staff对象中,该方法会覆盖新字段内容beanutils.copyproperties(staff, findbyid, "id","createtime","updatetime","jobnumber","role","educationenum","jobtitle","position","department","entrytime");staff savestaff = staffrvice.save(findbyid);if(savestaff == null){return result.error(codemsg.admin_staff_edit_error);}staff loginedstaff = ssionutil.getloginedstaff();if(loginedstaff != null){if(loginedstaff.getid().longvalue() == findbyid.getid().longvalue()){loginedstaff.theadpic(savestaff.getheadpic());loginedstaff.tname(savestaff.getname());loginedstaff.tmobile(savestaff.getmobile());loginedstaff.temergencycontact(savestaff.getemergencycontact());loginedstaff.temergencymobile(savestaff.getemergencymobile());loginedstaff.tage(savestaff.getage());loginedstaff.tx(savestaff.getx());ssionutil.t(ssionconstant.ssion_staff_login_key,loginedstaff);}}operaterlogrvice.add("编辑员工,员工名:" + staff.getname());return result.success(true);}/*** 员工编辑页面* @param model* @return*/@requestmap白色情人节礼物ping(value="/edit",method=requestmethod.get)public string edit(model model,@requestparam(name="id",required=true)long id){model.addattribute("staff", staffrvice.find(id));model.addattribute("roles", rolervice.findall());model.addattribute("educationenum",educationenum.values());model.addattribute("jobtitlelist",jobtitlervice.findall());model.addattribute("positionlist",positionrvice.findall());model.addattribute("departmentlist",departmentrvice.findall());return "admin/staff/edit";}/*** 编辑员工信息表单提交处理* @param staff* @return*/@requestmapping(value="/edit",method=requestmethod.post)@responbodypublic result<boolean> edit(staff staff, httprvletrequest request){//用统一验证实体方法验证是否合法codemsg validate = validateentityutil.validate(staff);if(validate.getcode() != codemsg.success.getcode()){return result.error(validate);}if(staff.getrole() == null || staff.getrole().getid() == null){return result.error(codemsg.admin_staff_role_error);}if(!stringutil.ismobile(staff.getmobile())){return result.error(codemsg.admin_staff_mobile_error);}if(!stringutil.ismobile(staff.getemergencymobile())){return result.error(codemsg.admin_staff_emergency_mobile_error);}if(staff.getid() == null || staff.getid().longvalue() <= 0){return result.error(codemsg.admin_staff_not_exist_error);}//到这说明一切符合条件,进行数据库保存staff findbyid = staffrvice.find(staff.getid());//讲提交的员工信息指定字段复制到已存在的staff对象中,该方法会覆盖新字段内容beanutils.copyproperties(staff, findbyid, "id","createtime","updatetime","jobnumber");staff savestaff = staffrvice.save(findbyid);if(savestaff == null){return result.error(codemsg.admin_staff_edit_error);}staff loginedstaff = ssionutil.getloginedstaff();if(loginedstaff != null){if(loginedstaff.getid().longvalue() == findbyid.getid().longvalue()){loginedstaff.theadpic(savestaff.getheadpic());loginedstaff.tname(savestaff.getname());loginedstaff.tmobile(savestaff.getmobile());loginedstaff.temergencycontact(savestaff.getemergencycontact());loginedstaff.temergencymobile(savestaff.getemergencymobile());loginedstaff.tage(savestaff.getage());loginedstaff.tx(savestaff.getx());ssionutil.t(ssionconstant.ssion_staff_login_key,loginedstaff);}}operaterlogrvice.add("编辑员工,员工名:" + staff.getname());return result.success(true);}/*** 离职员工* @param id*花想衣裳云想容 @return*/@requestmapping(value="/delete",method=requestmethod.post)@responbodypublic result<boolean> delete(@requestparam(name="id",required=true)long id){if(staffrvice.updatestatus(staff直线与圆的位置关系status.quit.getcode(), id)<=0){return result.error(codemsg.admin_staff_status_error);}operaterlogrvice.add("员工离职,员工id:" + id);return result.success(true);}/*** 修改个人信息* @param model* @return*/@requestmapping("/lf")public string lf(model model){staff loginedstaff = ssionutil.getloginedstaff();staff staff = staffrvice.find(loginedstaff.getid());model.addattribute("roles", rolervice.findall());model.addattribute("educationenum",educationenum.values());model.addattribute("jobtitlelist",jobtitlervice.findall());model.addattribute("positionlist",positionrvice.findall());model.addattribute("departmentlist",departmentrvice.findall());model.addattribute("staff",staff);return "admin/staff/lf";}}
后台角色管理控制器:
/*** 后台角色管理控制器* @author yy**/@requestmapping("/admin/role")@controllerpublic class rolecontroller {private logger log = loggerfactory.getlogger(rolecontroller.class);@autowiredprivate menurvice menurvice;@autowiredprivate operaterlogrvice operaterlogrvice;@autowiredprivate rolervice rolervice;/*** 分页搜索角色列表* @param model* @param role* @param pagebean* @return*/@requestmapping(value="/list")public string list(model model,role role,pagebean<role> pagebean){model.addattribute("title", "角色列表");model.addattribute("name", role.getname());model.addattribute("pagebean", rolervice.findbyname(role, pagebean));return "admin/role/list";}/*** 角色添加页面* @param model* @return*/@requestmapping(value="/add",method=requestmethod.get)public string add(model model){list<menu> findall = menurvice.findall();model.addattribute("topmenus",menuutil.gettopmenus(findall));model.addattribute("condmenus",menuutil.getcondmenus(findall));model.addattribute("thirdmenus",menuutil.getthirdmenus(findall));return "admin/role/add";}/*** 角色添加表单提交处理* @param role* @return*/@requestmapping(value="/add",method=requestmethod.post)@responbodypublic result<boolean> add(role role){//用统一验证实体方法验证是否合法codemsg validate = validateentityutil.validate(role);if(validate.getcode() != codemsg.success.getcode()){return result.error(validate);}if(rolervice.save(role) == null){return result.error(codemsg.admin_role_add_error);}log.info("添加角色【"+role+"】");operaterlogrvice.add("添加角色【"+role.getname()+"】");return result.success(true);}/*** 角色编辑页面* @param id* @param model* @return*/@requestmapping(value="/edit",method=requestmethod.get)public string edit(@requestparam(name="id",required=true)long id,model model){list<menu> findall = menurvice.findall();model.addattribute("topmenus",menuutil.gettopmenus(findall));model.addattribute("condmenus",menuutil.getcondmenus(findall));model.addattribute("thirdmenus",menuutil.getthirdmenus(findall));role role = rolervice.find(id);model.addattribute("role", role);model.addattribute("authorities",jsonarray.tojson(role.getauthorities()).tostring());return "admin/role/edit";}/*** 角色修改表单提交处理* @param request* @param role* @return*/@requestmapping(value="/edit",method=requestmethod.post)@responbodypublic result<boolean> edit(role role){//用统一验证实体方法验证是否合法codemsg validate = validateentityutil.validate(role);if(validate.getcode() != codemsg.success.getcode()){return result.error(validate);}role existrole = rolervice.find(role.getid());if(existrole == null){return result.error(codemsg.admin_role_no_exist);}existrole.tname(role.getname());existrole.tremark(role.getremark());existrole.tstatus(role.getstatus());existrole.tauthorities(role.getauthorities());if(rolervice.save(existrole) == null){return result.error(codemsg.admin_role_edit_error);}log.info("编辑角色【"+role+"】");operaterlogrvice.add("编辑角色【"+role.getname()+"】");return result.success(true);}/*** 删除角色* @param request* @param id* @return*/@requestmapping(value="delete",method=requestmethod.post)@responbodypublic result<boolean> delete(@requestparam(name="id",required=true)long id){try {rolervice.delete(id);} catch (exception e) {// todo: handle exceptionreturn result.error(codemsg.admin_role_delete_error);}log.info("编辑角色id【"+id+"】");operaterlogrvice.add("删除角色id【"+id+"】");return result.success(true);}}
后台工龄管理controller:
/*** 后台工龄管理controller*/@controller@requestmapping("/admin/work_years")public class workingyearscontroller {@autowiredprivate workingyearsrvice workingyearsrvice;@autowiredprivate operaterlogrvice operaterlogrvice;/*** 分页查询工龄列表* @param model* @param pagebean* @param workingyears* @return*/@requestmapping("/list")public string list(model model, pagebean<workingyears> pagebean, workingyears workingyears){model.addattribute("title","工龄列表");model.addattribute("years",workingyears.getyears());model.addattribute("pagebean",workingyearsrvice.findlist(workingyears, pagebean));return "/admin/working_years/list";}/*** 添加页面* @return*/@requestmapping("/add")public string add(){return "/admin/working_years/add";}/*** 工龄添加提交处理* @param workingyears* @return*/@requestmapping(value = "/add",method = requestmethod.post)@responbod一代宗师台词ypublic result<boolean> add(workingyears workingyears){//用统一验证实体方法验证是否合法codemsg validate = validateentityutil.validate(workingyears);if(validate.getcode() != codemsg.success.getcode()){return result.error(validate);}if(workingyearsrvice.findbyyears(workingyears.getyears())!=null){return result.error(codemsg.admin_working_years_exist_error);}if(workingyearsrvice.save(workingyears) == null){return result.error(codemsg.admin_working_years_add_error);}operaterlogrvice.add("添加工龄,工龄补贴为:" + workingyears.getsubsidy());return result.success(true);}/*** 编辑页面* @param model* @param id* @return*/@requestmapping("/edit")public string edit(model model,@requestparam(name="id",required=true)long id){model.addattribute("workyears",workingyearsrvice.find(id));return "/admin/working_years/edit";}/*** 编辑表单提交处理* @param workingyears* @return*/@requestmapping(value = "/edit",method = requestmethod.post)@responbodypublic result<boolean> edit(workingyears workingyears){//用统一验证实体方法验证是否合法codemsg validate = validateentityutil.validate(workingyears);if(validate.getcode() != codemsg.success.getcode()){return result.error(validate);}if(workingyearsrvice.ixistyear(workingyears.getyears(),workingyears.getid())){return result.error(codemsg.admin_working_years_exist_error);}//到这说明一切符合条件,进行数据库保存workingyears findbyid = workingyearsrvice.find(workingyears.getid());//讲提交的用户信息指定字段复制到已存在的department对象中,该方法会覆盖新字段内容beanutils.copyproperties(workingyears, findbyid, "id","createtime","updatetime");if(workingyearsrvice.save(findbyid) == null){return result.error(codemsg.admin_working_years_edit_error);}operaterlogrvice.add("编辑工龄,工龄补贴为:" + workingyears.getsubsidy());return result.success(true);}/*** 工龄删除操作* @param id* @return*/@requestmapping(value = "delete",method = requestmethod.post)@responbodypublic result<boolean> delete(@requestparam(name="id",required=true)long id){try{workingyearsrvice.delete(id);}catch (exception e){return result.error(codemsg.admin_working_years_delete_error);}operaterlogrvice.add("删除工龄补贴,工龄id:" + id);return result.success(true);}}
到此这篇关于java实战员工绩效管理系统的实现流程的文章就介绍到这了,更多相关java 员工绩效管理系统内容请搜索www.887551.com以前的文章或继续浏览下面的相关文章希望大家以后多多支持www.887551.com!
本文发布于:2023-04-04 09:31:20,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/7327baf3ae643e252d02c5015bbc07d4.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:Java实战员工绩效管理系统的实现流程.doc
本文 PDF 下载地址:Java实战员工绩效管理系统的实现流程.pdf
留言与评论(共有 0 条评论) |