基于javaweb+mysql的springboot企业考勤管理系统(java+springboot+layui+jsp+bootstrap+mysql)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot企业考勤管理系统(java+springboot+layui+jsp+bootstrap+mysql)
项目介绍
- 基于SpringBoot-Layui开发的学生版企业考勤管理系统完整代码; - 分别为员工打卡系统和企业考勤管理两个系统 - 其中企业考勤管理系统主要功能包括: 员工信息管理、考勤信息管理、考勤统计、操作日志信息、登录日志信息、系统用户管理等功能。
环境需要
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项目:是
技术栈
-
后端:SpringBoot+Mybatis
-
前端:JSP+Bootstrap+jQuery+LayUI
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入http://localhost:8080/web/jsp/login.jsp 登录 管理端用户名 admin 密码 123456 打卡端用户名 马云 密码 630021197005112121
jobject.put("errorCode", "401");
jobject.put("data", "");
out.print(jobject.toString());
e.printStackTrace();
}
}
/**登录打卡系统*/
@PostMapping("get_StaLogin")
public void get_StaLogin(Sta sta, HttpServletResponse response){
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
PrintWriter out = null;
JSONObject jobject = new JSONObject();
Map<String,Object> map;
try{
out = response.getWriter();
String xm = sta.getXm();
String zjhm = sta.getZjhm();
System.out.println(xm+zjhm);
map = staService.get_StaLogin(xm,zjhm);
System.out.println(map.get("xm"));
if(null!=map){
jobject.put("xm", map.get("xm"));
jobject.put("zjhm", map.get("zjhm"));
jobject.put("gh", map.get("gh"));
jobject.put("ssbm", map.get("ssbm"));
}
out.print(jobject.toString());
}catch (Exception e){
jobject = new JSONObject();
jobject.put("errorCode", "401");
jobject.put("data", "");
out.print(jobject.toString());
e.printStackTrace();
}
}
}
/****
* 查询考勤表
*/
@GetMapping("find_StaAndCheck")
@ResponseBody
public PageInfo<Map<String,Object>> find_StaAndCheck(HttpServletRequest request, String ssk){
try {
List<Map<String,Object>> list = null;
PageHelper.startPage(Integer.valueOf(request.getParameter("page")),Integer.valueOf(request.getParameter("limit")));
list = checkService.find_StaAndCheck(ssk);
PageInfo info = new PageInfo(list);
return info;
}catch (Exception e){
e.printStackTrace();
return null;
}
}
/**通过id删除考勤表信息*/
@GetMapping("delete_CheckById")
@ResponseBody
public int delete_CheckById(String id,String name){
int i = 0;
i = checkService.delete_CheckById(id,name);
if(i>0){
String bz = "删除考勤信息";
czrzxxService.addCzrzxx(bz,name);
}
return i;
}
/**通过id查询考勤表*/
@PostMapping("getCheckById")
@ResponseBody
public Map<String,Object> getCheckById(String id){
Map<String,Object> map = new HashMap<>();
map = checkService.getCheckById(id);
return map;
}
/**新增或修改考勤表*/
@PostMapping("saveOrUpdate_Check")
@ResponseBody
public int saveOrUpdate_Check(Check check,String name){
int i = 0;
try{
i = checkService.saveOrUpdate_Check(check,name);
}catch (Exception e){
e.printStackTrace();
i=0;
}
return i;
}
/**新增考勤表手动打卡*/
@PostMapping("add_ChackByScdk")
@ResponseBody
public int add_ChackByScdk(Check check){
int i = 0;
try{
i = checkService.add_ChackByScdk(check);
}catch (Exception e){
e.printStackTrace();
i=0;
}
return i;
}
/**修改考勤表手动打卡(添加最后打卡)*/
@PostMapping("update_ChackByXbdk")
@ResponseBody
public int update_ChackByXbdk(Check check){
int i = 0;
try{
i = checkService.update_ChackByXbdk(check);
}catch (Exception e){
e.printStackTrace();
i=0;
}
return i;
}
}
@GetMapping("get_UserPasswordById")
@ResponseBody
public int get_UserPasswordById(User user){
List<Map> map = null;
System.out.println(user);
String id = user.getId();
String password = user.getPassword();
map = userService.get_UserPasswordById(id,password);
if (map.size()>0){
return 1;
}else{
return 0;
}
}
/**修改密码*/
@PostMapping("Update_UserPassword")
@ResponseBody
public int Update_UserPassword(User user,String czyh){
int i = userService.Update_UserPassword(user);
if(i>0){
//给操作日志表添加信息
String bz = "用户修改个人密码";
czrzxxService.addCzrzxx(bz,czyh);
}
return i;
}
/**修改用户表信息*/
@PostMapping("Update_User")
@ResponseBody
public int Update_User(User user,String czyh){
int i = userService.Update_User(user);
if(i>0){
//给操作日志表添加信息
String bz = "修改系统用户信息";
czrzxxService.addCzrzxx(bz,czyh);
}
return i;
}
/**通过id查询用户表*/
@PostMapping("get_UserById")
@ResponseBody
public Map<String,Object> get_UserById(String id){
Map<String,Object> map = new HashMap<>();
}
/**删除员工*/
@GetMapping("delete_StaByGh")
@ResponseBody
public int delete_StaByGh(String gh,String name){
int i = 0;
i = staService.delete_StaByGh(gh,name);
if(i>0){
String bz = "删除员工";
System.out.println(name);
czrzxxService.addCzrzxx(bz,name);
}
return i;
}
}
@Controller
@RequestMapping("/check")
public class KqxxglController {
@Autowired
private CheckService checkService;
@Autowired
private CzrzxxService czrzxxService;
/****
* 查询考勤表
public class KqxxglController {
@Autowired
private CheckService checkService;
@Autowired
private CzrzxxService czrzxxService;
/****
* 查询考勤表
*/
@GetMapping("find_StaAndCheck")
@ResponseBody
public PageInfo<Map<String,Object>> find_StaAndCheck(HttpServletRequest request, String ssk){
try {
List<Map<String,Object>> list = null;
PageHelper.startPage(Integer.valueOf(request.getParameter("page")),Integer.valueOf(request.getParameter("limit")));
list = checkService.find_StaAndCheck(ssk);
PageInfo info = new PageInfo(list);
return info;
}catch (Exception e){
e.printStackTrace();
return null;
}
}
/**通过id删除考勤表信息*/
@GetMapping("delete_CheckById")
@ResponseBody
public int delete_CheckById(String id,String name){
int i = 0;
i = checkService.delete_CheckById(id,name);
if(i>0){
String bz = "删除考勤信息";
czrzxxService.addCzrzxx(bz,name);
}
return i;
}
/**通过id查询考勤表*/
@PostMapping("getCheckById")
@ResponseBody
public Map<String,Object> getCheckById(String id){
Map<String,Object> map = new HashMap<>();
map = checkService.getCheckById(id);
return map;
}
}
}
@Controller
@RequestMapping("/sta")
public class StaController {
@Autowired
private StaService staService;
@Autowired
private CzrzxxService czrzxxService;
/****
* 查询员工表
*/
@GetMapping("find_Sta")
@ResponseBody
public PageInfo<Map<String,Object>> find_Sta(HttpServletRequest request,String ssk){
try {
List<Map<String,Object>> list = null;
PageHelper.startPage(Integer.valueOf(request.getParameter("page")),Integer.valueOf(request.getParameter("limit")));
list = staService.find_Sta(ssk);
PageInfo info = new PageInfo(list);
return info;
}catch (Exception e){
e.printStackTrace();
return null;
}
}
/****
* 员工表姓名和证件号码
*/
@GetMapping("getXmAndZjhm_Sta")
@ResponseBody
public PageInfo<Map<String,Object>> find_Dlrzxx(HttpServletRequest request, String ssk){
try {
List<Map<String,Object>> list = null;
PageHelper.startPage(Integer.valueOf(request.getParameter("page")),Integer.valueOf(request.getParameter("limit")));
list = dlrzxxService.find_Dlrzxx(ssk);
PageInfo info = new PageInfo(list);
return info;
}catch (Exception e){
e.printStackTrace();
return null;
}
}
/**删除操作日志信息表*/
@GetMapping("delete_Czrzxx")
@ResponseBody
public int delete_Czrzxx(String czyh){
int i;
try{
i = czrzxxService.delete_Czrzxx();
if(i>0){
//给操作日志表添加信息
String bz = "清除30天前操作日志信息";
czrzxxService.addCzrzxx(bz,czyh);
}
}catch (Exception e){
e.printStackTrace();
i = -1;
}
return i;
}
/**删除登录日志信息表*/
@GetMapping("delete_Dlrzxx")
@ResponseBody
public int delete_Dlrzxx(String czyh){
int i;
try{
i = czrzxxService.delete_Dlrzxx();
if(i>0){
//给操作日志表添加信息
String bz = "清除30天前登录日志信息";
czrzxxService.addCzrzxx(bz,czyh);
}
}catch (Exception e){
e.printStackTrace();
i = -1;
}
return i;
}
@ResponseBody
public int get_UserByZjhm(String id,String zjhm){
int i = 0;
//先判断传来的证件号码是否是自己的
int sum = userService.get_IdByZjhm(id,zjhm);
if(sum>0){
}else{
i = userService.get_UserByZjhm(zjhm);
}
return i;
}
/**通过账号查询用户表*/
@PostMapping("getUserByUserName")
@ResponseBody
public int getUserByUserName(User user){
int i = 0;
i = userService.getUserByUserName(user);
return i;
}
/**查询用户表*/
@GetMapping("find_User")
@ResponseBody
public PageInfo<Map<String,Object>> find_User(HttpServletRequest request, String ssk){
try {
List<Map<String,Object>> list = null;
PageHelper.startPage(Integer.valueOf(request.getParameter("page")),Integer.valueOf(request.getParameter("limit")));
list = userService.find_User(ssk);
PageInfo info = new PageInfo(list);
return info;
}catch (Exception e){
e.printStackTrace();
return null;
}
}
/**新增用户表*/
@PostMapping("add_User")
@ResponseBody
public int add_User(User user,String czyh){
@RequestMapping("/com")
public class GdkqzydhController {
@Autowired
private ComService comService;
@Autowired
private CzrzxxService czrzxxService;
/**查询各地考勤专员信息表*/
@GetMapping("find_Com")
@ResponseBody
public PageInfo<Map<String,Object>> find_Com(HttpServletRequest request, String ssk){
try {
List<Map<String,Object>> list = null;
PageHelper.startPage(Integer.valueOf(request.getParameter("page")),Integer.valueOf(request.getParameter("limit")));
list = comService.find_Com(ssk);
PageInfo info = new PageInfo(list);
return info;
}catch (Exception e){
e.printStackTrace();
return null;
}
}
/**新增或修改各地考勤专员表*/
@PostMapping("saveOrUpdate_Com")
@ResponseBody
public int saveOrUpdate_Com(Com com){
int i = 0;
i = comService.saveOrUpdate_Com(com);
return i;
}
/**通过id查询各地考勤专员表*/
@PostMapping("getComById")
@ResponseBody
public Map<String,Object> getComById(String id){
Map<String,Object> map = new HashMap<>();
map = comService.getComById(id);
return map;
}
/**通过id删除考勤表信息*/
}
/**登录打卡系统*/
@PostMapping("get_StaLogin")
public void get_StaLogin(Sta sta, HttpServletResponse response){
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
PrintWriter out = null;
JSONObject jobject = new JSONObject();
Map<String,Object> map;
try{
out = response.getWriter();
String xm = sta.getXm();
String zjhm = sta.getZjhm();
System.out.println(xm+zjhm);
map = staService.get_StaLogin(xm,zjhm);
System.out.println(map.get("xm"));
if(null!=map){
jobject.put("xm", map.get("xm"));
jobject.put("zjhm", map.get("zjhm"));
jobject.put("gh", map.get("gh"));
jobject.put("ssbm", map.get("ssbm"));
}
out.print(jobject.toString());
}catch (Exception e){
jobject = new JSONObject();
jobject.put("errorCode", "401");
jobject.put("data", "");
out.print(jobject.toString());
e.printStackTrace();
}
}
}
out = response.getWriter();
String username = user.getUsername();
String password = user.getPassword();
System.out.println(username+";"+password);
map = userService.getLogin(username,password);
System.out.println(map);
jobject = new JSONObject();
if(map!=null){
String name = map.get("name")+"";
dlrzxxService.add_Dlrzxx(name);
jobject.put("name", map.get("name"));
jobject.put("id", map.get("id"));
}
out.print(jobject.toString());
}catch (Exception e){
jobject = new JSONObject();
jobject.put("errorCode", "401");
jobject.put("data", "");
out.print(jobject.toString());
e.printStackTrace();
}
}
/**登录打卡系统*/
@PostMapping("get_StaLogin")
public void get_StaLogin(Sta sta, HttpServletResponse response){
response.setContentType("text/html;charset=utf-8");
response.setCharacterEncoding("utf-8");
PrintWriter out = null;
JSONObject jobject = new JSONObject();
Map<String,Object> map;
try{
out = response.getWriter();
String xm = sta.getXm();
String zjhm = sta.getZjhm();
System.out.println(xm+zjhm);
map = staService.get_StaLogin(xm,zjhm);
System.out.println(map.get("xm"));
if(null!=map){
jobject.put("xm", map.get("xm"));
jobject.put("zjhm", map.get("zjhm"));
public List<Map> getXmAndZjhm_Sta(){
List<Map> list = null;
list = staService.getXmAndZjhm_Sta();
return list;
}
/****
* 搜索员工表
*/
@GetMapping("find_StaByZjhmAndXm")
@ResponseBody
public List<Map> find_StaByZjhmAndXm(String ssk){
List<Map> list = null;
list = staService.find_StaByZjhmAndXm(ssk);
System.out.println(list);
return list;
}
/**通过证件号码查询员工表*/
@GetMapping("getStaByZjhm")
@ResponseBody
public int getStaByZjhm(Sta sta){
List<Map> map = null;
String zjhm = sta.getZjhm();
map = staService.getStaByZjhm(zjhm);
if (map.size()<1){
return 1;
}else{
return 0;
}
}
/**通过工号查询员工表*/
@PostMapping("getStaByGh")
@ResponseBody
public Map<String,Object> getStaByGh(String gh){
Map<String,Object> map = new HashMap<>();
map = staService.getStaByGh(gh);
return map;
}
/**查询部门表*/
@GetMapping("getStaSsbm")
@ResponseBody
public List<Map<String,Object>> getStaSsbm(){
List<Map<String,Object>> list = null;
try{
list = staService.getStaSsbm();
}catch (Exception e){
e.printStackTrace();
/**删除用户表*/
@GetMapping("delete_UserById")
@ResponseBody
public int delete_UserById(User user,String czyh){
int i;
try{
i = userService.delete_UserById(user);
if(i>0){
//给操作日志表添加信息
String bz = "删除系统用户";
czrzxxService.addCzrzxx(bz,czyh);
}
}catch (Exception e){
e.printStackTrace();
i = 0;
}
return i;
}
}
@Controller
@RequestMapping("/login")
public class GetLoginController {
@Autowired
private UserService userService;
@Autowired
private StaService staService;
@Autowired
private DlrzxxService dlrzxxService;
}
/**查询操作日志信息表*/
@GetMapping("find_Dlrzxx")
@ResponseBody
public PageInfo<Map<String,Object>> find_Dlrzxx(HttpServletRequest request, String ssk){
try {
List<Map<String,Object>> list = null;
PageHelper.startPage(Integer.valueOf(request.getParameter("page")),Integer.valueOf(request.getParameter("limit")));
list = dlrzxxService.find_Dlrzxx(ssk);
PageInfo info = new PageInfo(list);
return info;
}catch (Exception e){
e.printStackTrace();
return null;
}
}
/**删除操作日志信息表*/
@GetMapping("delete_Czrzxx")
@ResponseBody
public int delete_Czrzxx(String czyh){
int i;
try{
i = czrzxxService.delete_Czrzxx();
if(i>0){
//给操作日志表添加信息
String bz = "清除30天前操作日志信息";
czrzxxService.addCzrzxx(bz,czyh);
}
}catch (Exception e){
e.printStackTrace();
i = -1;
}
return i;
}
@Controller
@RequestMapping("/com")
public class GdkqzydhController {
@Autowired
private ComService comService;
@Autowired
private CzrzxxService czrzxxService;
/**查询各地考勤专员信息表*/
@GetMapping("find_Com")
@ResponseBody
public PageInfo<Map<String,Object>> find_Com(HttpServletRequest request, String ssk){
try {
List<Map<String,Object>> list = null;
PageHelper.startPage(Integer.valueOf(request.getParameter("page")),Integer.valueOf(request.getParameter("limit")));
list = comService.find_Com(ssk);
PageInfo info = new PageInfo(list);
return info;
}catch (Exception e){
e.printStackTrace();
return null;
}
}
/**新增或修改各地考勤专员表*/
@PostMapping("saveOrUpdate_Com")
@ResponseBody
public int saveOrUpdate_Com(Com com){
int i = 0;
i = comService.saveOrUpdate_Com(com);
return i;
}
/**通过id查询各地考勤专员表*/
@PostMapping("getComById")
@ResponseBody
public Map<String,Object> getComById(String id){
@Controller
@RequestMapping("/rzxx")
public class RzxxglController {
@Autowired
private CzrzxxService czrzxxService;
@Autowired
private DlrzxxService dlrzxxService;
/**查询操作日志信息表*/
@GetMapping("find_Czrzxx")
@ResponseBody
public PageInfo<Map<String,Object>> find_Czrzxx(HttpServletRequest request, String ssk){
try {
List<Map<String,Object>> list = null;
PageHelper.startPage(Integer.valueOf(request.getParameter("page")),Integer.valueOf(request.getParameter("limit")));
list = czrzxxService.find_Czrzxx(ssk);
PageInfo info = new PageInfo(list);
return info;
}catch (Exception e){
e.printStackTrace();
return null;
}
}
/**查询操作日志信息表*/
@GetMapping("find_Dlrzxx")
@ResponseBody
public PageInfo<Map<String,Object>> find_Dlrzxx(HttpServletRequest request, String ssk){
try {
List<Map<String,Object>> list = null;
PageHelper.startPage(Integer.valueOf(request.getParameter("page")),Integer.valueOf(request.getParameter("limit")));
list = dlrzxxService.find_Dlrzxx(ssk);
PageInfo info = new PageInfo(list);
return info;
}catch (Exception e){
e.printStackTrace();
return null;
}
}
String bz = "删除考勤信息";
czrzxxService.addCzrzxx(bz,name);
}
return i;
}
/**通过id查询考勤表*/
@PostMapping("getCheckById")
@ResponseBody
public Map<String,Object> getCheckById(String id){
Map<String,Object> map = new HashMap<>();
map = checkService.getCheckById(id);
return map;
}
/**新增或修改考勤表*/
@PostMapping("saveOrUpdate_Check")
@ResponseBody
public int saveOrUpdate_Check(Check check,String name){
int i = 0;
try{
i = checkService.saveOrUpdate_Check(check,name);
}catch (Exception e){
e.printStackTrace();
i=0;
}
return i;
}
/**新增考勤表手动打卡*/
@PostMapping("add_ChackByScdk")
@ResponseBody
public int add_ChackByScdk(Check check){
int i = 0;
try{
i = checkService.add_ChackByScdk(check);
}catch (Exception e){
e.printStackTrace();
i=0;
}
return i;
}
/**修改考勤表手动打卡(添加最后打卡)*/
@PostMapping("update_ChackByXbdk")
@ResponseBody
public int update_ChackByXbdk(Check check){
int i = 0;