——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明







基于javaweb的SSM+Maven员工考勤请假管理系统(java+ssm+jsp+bootstrap+mysql)
项目介绍
本项目包含管理员、部门经理、员工三种角色;
部门经理角色包含以下功能: 个人信息管理,请假信息审批,部门考勤记录,考勤系统管理等功能。
管理员角色包含以下功能: 管理员登录,员工管理,请假统计等功能。
员工角色包含以下功能: 员工登录,员工签到,考勤记录,请假,请假记录查询等功能。
环境需要
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项目:是;
技术栈
- 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+CSS+JavaScript+jquery+bootstrap
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中mysql.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| String departmentIdStr = request.getParameter("departmentId"); if (departmentIdStr != null && !departmentIdStr.isEmpty() && intPattern.matcher(departmentIdStr).matches()) { departmentId = Integer.parseInt(departmentIdStr); }
String roleStr = request.getParameter("role"); if (roleStr != null && !roleStr.isEmpty() && intPattern.matcher(roleStr).matches()) { role = Integer.parseInt(roleStr); }
String gradeStr = request.getParameter("grade"); if (gradeStr != null && !gradeStr.isEmpty() && datePattern.matcher(gradeStr).matches()) { grade = new SimpleDateFormat("yyyy-MM-dd").parse(gradeStr); }
String birthdayStr = request.getParameter("birthday"); if (birthdayStr != null && !birthdayStr.isEmpty() && datePattern.matcher(birthdayStr).matches()) { birthday = new SimpleDateFormat("yyyy-MM-dd").parse(birthdayStr); }
Staff staff = new Staff(); staff.setStaffId(staffId); staff.setStaffName(staffName); staff.setSex(sex); staff.setDepartmentId(departmentId); staff.setRole(role); staff.setGrade(grade); staff.setBirthday(birthday); staff.setTel(tel); staff.setEmail(email); staff.setHobby(hobby); staff.setPassword(password);
staffService.updateById(staff);
return "redirect:/staff/showMassage"; }
@RequestMapping(value = "/signRecord") public String signRecordShow(Model model, Integer page) throws Exception {
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| @RequestMapping(value = "/addStaff", method = {RequestMethod.POST}) public String addStudent(StaffCustom staffCustom, Model model) throws Exception {
Boolean result = staffCustomService.save(staffCustom);
if (!result) { model.addAttribute("message", "员工编号重复"); return "/error"; }
return "redirect:/admin/showStaff"; }
@RequestMapping(value = "/editStaff", method = {RequestMethod.POST}) @ResponseBody public boolean editStaff(int role,int department,String staffId) throws Exception { Map<String,Object> paramMap = new HashMap<String, Object>(); paramMap.put("staffId",staffId); paramMap.put("department",department); paramMap.put("role",role);
staffCustomService.editStaff(paramMap); return true; }
@RequestMapping(value = "/removeStaff"/*, method = {RequestMethod.GET} */) public String removeStaff(String id) throws Exception { if (id == null) { return "/admin/showStaff"; } staffCustomService.removeById(id); loginService.removeById(id);
return "redirect:/admin/showStaff"; }
@RequestMapping(value = "/selectStaff") public String selectStaff(String findByName, Model model) throws Exception {
List<StaffCustom> list = staffCustomService.findByName(findByName);
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
@Controller @RequestMapping("/admin") public class AdminController {
@Resource(name = "staffCustomServiceImpl") private StaffCustomService staffCustomService;
@Resource(name = "departmentServiceImpl") private DepartmentService departmentService;
@Resource(name = "loginServiceImpl") private LoginService loginService;
@Resource(name = "adminServiceImpl") private AdminService adminService;
@RequestMapping("/showStaff") public String showStudent(Model model, Integer page) throws Exception {
List<StaffCustom> list = null; PagingVO pagingVO = new PagingVO(); pagingVO.setTotalCount(staffCustomService.getStaffCount()); if (page == null || page == 0) {
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| Subject subject = SecurityUtils.getSubject(); String id = (String) subject.getPrincipal(); Staff staff = staffService.findById(id);
int departmentId = staff.getDepartmentId(); int unHandled = leaveService.getUnhandledCount(departmentId); String result = String.valueOf(unHandled);
return result; }
@RequestMapping(value = "/leaveRecord") public String leaveRecordShow(Model model, Integer page) throws Exception { Subject subject = SecurityUtils.getSubject(); String id = (String) subject.getPrincipal(); Staff staff = staffService.findById(id);
int departmentId = staff.getDepartmentId(); List<Leave> list = null; PagingVO pagingVO = new PagingVO(); pagingVO.setTotalCount(leaveService.getDepartmentLeaveCount(departmentId)); if (page == null || page == 0) { pagingVO.setToPageNo(1); Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put("toPageNo", pagingVO.getTopageNo()); paramMap.put("pageSize", pagingVO.getPageSize()); paramMap.put("departmentId",staff.getDepartmentId()); list = leaveService.findByPagingD(paramMap); } else { pagingVO.setToPageNo(page); Map<String, Object> paramMap = new HashMap<String, Object>(); paramMap.put("toPageNo", pagingVO.getTopageNo()); paramMap.put("pageSize", pagingVO.getPageSize()); paramMap.put("departmentId",staff.getDepartmentId()); list = leaveService.findByPagingD(paramMap); }
model.addAttribute("leaveList", list); model.addAttribute("pagingVO", pagingVO);
return "/managers/leaveRecord"; }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| modelAndView.addObject("message", "没有该用户"); modelAndView.setViewName("/error"); return modelAndView; } else if (e instanceof IncorrectCredentialsException) { modelAndView.addObject("message", "密码错误"); modelAndView.setViewName("/error"); return modelAndView; } else { customException = new CustomException(e.getMessage()); }
String message = customException.getMessage();
modelAndView.addObject("message", message); modelAndView.setViewName("/error");
return modelAndView; } } package com.system.controller;
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
@Controller @RequestMapping("/admin") public class AdminController {
@Resource(name = "staffCustomServiceImpl") private StaffCustomService staffCustomService;
@Resource(name = "departmentServiceImpl") private DepartmentService departmentService;
@Resource(name = "loginServiceImpl") private LoginService loginService;
@Resource(name = "adminServiceImpl") private AdminService adminService;
@RequestMapping("/showStaff") public String showStudent(Model model, Integer page) throws Exception {
List<StaffCustom> list = null; PagingVO pagingVO = new PagingVO(); pagingVO.setTotalCount(staffCustomService.getStaffCount()); if (page == null || page == 0) { pagingVO.setToPageNo(1);
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=201122572008200te
https://javayms.pages.dev?id=201122572008200te