基于Javaweb实现的人脸识别考勤系统
Posted 编程指南针
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了基于Javaweb实现的人脸识别考勤系统相关的知识,希望对你有一定的参考价值。
人脸识别考勤系统使用说明书
此系统是人脸识别考勤系统的后台管理系统,考勤数据从人脸识别机器上获取,自动识别员工信息记录考勤。系统基于JSP/SERVLET来开发实现,开发工具采用IDEA或ECLIPSE,数据库采用MYSQL数据库。Util包中jdbcinfo.properties文件进行数据库连接的相关配置修改。
访问路径为:faceattendsystem为发布的虚拟目录
1. 进入主页,点击未登录。如下图:
2. 输入工号和密码,点击【登录】按钮。管理员默认工号是admin,密码是111111。如下图:
3. 登录成功后,进入后台管理页面。如下图:
4. 点击【机构管理】,进入机构详情页面。该页面可添加机构、搜索机构、修改机构、删除机构和设置机构的作息管理。
5. 点击【添加机构】按钮,进入添加机构页面。根据文本框提示的信息进行输入信息,点击【添加】按钮。(*是必填项)如下图:
6. 添加成功后,输入1111,点击【搜索】按钮。如下图:
7. 点击【修改】,进入修改机构页面。修改信息后,点击【修改】按钮。(机构号不能修改)如下图:
8. 点击【删除】,删除该机构。
9. 点击【作息管理】,进入作息时间页面。该页面可添加作息和搜索日期。如下图:
10. 点击【添加作息】,进入添加作息页面。根据文本框提示输入信息,点击【添加】按钮。如下图:
11. 添加成功后,输入2017-12-05,点击【搜索】按钮。如下图:
12. 点击【员工管理】,进入查询员工页面。选择刚添加的机构,点击【查询】按钮。如下图:
13. 查询成功后,进入员工信息页面。该页面可添加员工、搜索员工、修改员工和删除员工。如下图:
14. 点击【添加员工】按钮,进入添加员工页面。根据文本框的提示输入信息,点击【添加】按钮。如下图:
15. 添加员工成功后,在搜索框输入2222,点击【搜索】按钮。如下图:
16. 点击【详情】,进入员工详情页面。如下图:
17. 点击【修改】,进入员工修改页面。修改信息后,点击【修改】按钮。如下图:
18. 点击【删除】,删除该员工。
19. 点击【节假日管理】,进入节假日页面。该页面可添加节假日和搜索日期。如下图:
20. 点击【添加节假日】按钮,进入添加节假日页面。根据文本框提示输入信息,点击【添加】按钮。如下图:
21. 添加成功后,在搜索框输入2018-01-01,点击【搜索】按钮。如下图:
22. 点击【考勤管理】,进入查询考勤页面。如下图:
23. 点击【存在异常日期,点击查看详情】,进入异常日期页面。点击【开始统计】,则服务器会跑当前的日期的考勤。如下图:
24. 若根据文本框提示输入信息,选择异常,点击【查询】按钮。进入异常的考勤统计页面。如下图:
25. 若要把查询数据导出,则点击【导出excel】按钮。如下图:
25. 若根据文本框提示输入信息,选择流水,点击【查询】按钮。如下图:
26. 进入流水的考勤统计页面。如下图:
27. 点击【修改密码】,进入修改密码页面。根据文本框提示输入信息后,点击【修改】按钮。如下图:
以上是基于人脸识别的考勤系统的说明
package faceattendsystem.serviceImpl;
import java.sql.Date;
import java.util.List;
import faceattendsystem.dao.IDaytimeDao;
import faceattendsystem.dao.IMechanismDao;
import faceattendsystem.daoImpl.DaytimeDaoImpl;
import faceattendsystem.daoImpl.MechanismDaoImpl;
import faceattendsystem.entity.Daytime;
import faceattendsystem.entity.PageBean;
import faceattendsystem.service.IDaytimeService;
public class DaytimeServiceImpl implements IDaytimeService
private IDaytimeDao daytimeDao = new DaytimeDaoImpl();
private IMechanismDao mechanismDao = new MechanismDaoImpl();
@Override
public int add(Daytime daytime)
return daytimeDao.add(daytime);
@Override
public int update(Daytime daytime)
return daytimeDao.update(daytime);
@Override
public PageBean<Daytime> queryByMechid(String mechid, int pc, int ps)
PageBean<Daytime> pb =daytimeDao.queryByMechid(mechid, pc, ps);
List<Daytime> daytimeList = pb.getBeanList();
for(Daytime daytime:daytimeList)
daytime.setMechanism(mechanismDao.queryByMechid(mechid));
daytime.setBegintime(getRealTime(daytime.getBegintime()));
daytime.setEndtime(getRealTime(daytime.getEndtime()));
return pb;
private String getRealTime(String time)
while(time.length()<6)
time = "0"+time;
time = time.substring(0,2)+":"+time.substring(2,4)+":"+time.substring(4,6);
return time;
@Override
public int isRepeatDate(Daytime daytime)
return daytimeDao.isRepeatDate(daytime);
@Override
public Daytime queryByMechid(String mechid, Date nowdate)
Daytime daytime = daytimeDao.queryByMechid(mechid, nowdate);
daytime.setMechanism(mechanismDao.queryByMechid(mechid));
return daytime;
@Override
public PageBean<Daytime> query(Daytime daytime, int pc, int ps)
PageBean<Daytime> pb =daytimeDao.query(daytime, pc, ps);
List<Daytime> daytimeList = pb.getBeanList();
for(Daytime d:daytimeList)
d.setMechanism(mechanismDao.queryByMechid(d.getMechanism().getMechid()));
d.setBegintime(getRealTime(d.getBegintime()));
d.setEndtime(getRealTime(d.getEndtime()));
return pb;
package faceattendsystem.serviceImpl;
import java.util.List;
import faceattendsystem.dao.IEmployeeDao;
import faceattendsystem.dao.IMechanismDao;
import faceattendsystem.daoImpl.EmployeeDaoImpl;
import faceattendsystem.daoImpl.MechanismDaoImpl;
import faceattendsystem.entity.Employee;
import faceattendsystem.entity.Mechanism;
import faceattendsystem.entity.PageBean;
import faceattendsystem.service.IEmployeeService;
public class EmployeeServiceImpl implements IEmployeeService
private IEmployeeDao employeeDao = new EmployeeDaoImpl();
private IMechanismDao mechanismDao = new MechanismDaoImpl();
@Override
public int add(Employee employee)
return employeeDao.add(employee);
@Override
public int delete(String empid)
return employeeDao.delete(empid);
@Override
public int update(Employee employee)
return employeeDao.update(employee);
@Override
public int updatePw(String empid,String npw)
return employeeDao.updatePw(empid,npw);
@Override
public Employee queryByEmpid(String empid)
Employee employee = employeeDao.queryByEmpid(empid);
employee.setMechanism(mechanismDao.queryByMechid(employee.getMechanism().getMechid()));
return employee;
@Override
public PageBean<Employee> queryByMechid(String mechid, int pc, int ps)
return employeeDao.queryByMechid(mechid, pc, ps);
@Override
public List<Employee> queryAll()
return employeeDao.queryAll();
@Override
public PageBean<Employee> query(Employee employee, int pc, int ps)
PageBean<Employee> pb = employeeDao.query(employee,pc,ps);
List<Employee> employeeList = pb.getBeanList();
for(Employee e : employeeList)
e.setMechanism(mechanismDao.queryByMechid(e.getMechanism().getMechid()));
pb.setBeanList(employeeList);
return pb;
@Override
public List<Employee> queryByMechid(String mechid)
List<Employee> employeeList = employeeDao.queryByMechid(mechid);
for(Employee emp : employeeList)
Mechanism mechanism = mechanismDao.queryByMechid(emp.getMechanism().getMechid());
emp.setMechanism(mechanism);
return employeeList;
@Override
public boolean isRepeatEmpid(String empid)
Employee employee = employeeDao.queryByEmpid(empid);
return employee!=null?true:false;
@Override
public Employee isEmployee(String empid)
Employee employee = employeeDao.queryByEmpid(empid);
if(employee!=null)
employee.setMechanism(mechanismDao.queryByMechid(employee.getMechanism().getMechid()));
return employee;
@Override
public Employee isRepeatIdnumber(String idnumber)
return employeeDao.queryByIdnumber(idnumber);
package faceattendsystem.serviceImpl;
import java.util.List;
import faceattendsystem.dao.IEmployeeDao;
import faceattendsystem.dao.IErrorsheetDao;
import faceattendsystem.dao.IMechanismDao;
import faceattendsystem.daoImpl.EmployeeDaoImpl;
import faceattendsystem.daoImpl.ErrorsheetDaoImpl;
import faceattendsystem.daoImpl.MechanismDaoImpl;
import faceattendsystem.entity.Errorsheet;
import faceattendsystem.entity.PageBean;
import faceattendsystem.service.IErrorsheetService;
public class ErrorsheetServiceImpl implements IErrorsheetService
IErrorsheetDao errorsheetDao = new ErrorsheetDaoImpl();
IMechanismDao mechanismDao = new MechanismDaoImpl();
IEmployeeDao employeeDao = new EmployeeDaoImpl();
@Override
public PageBean<Errorsheet> query(Errorsheet errorsheet, String bdate, String edate, int pc, int ps)
PageBean<Errorsheet> pb = errorsheetDao.query(errorsheet, bdate, edate, pc, ps);
List<Errorsheet> errorsheetList = pb.getBeanList();
for (Errorsheet e : errorsheetList)
e.setMechanism(mechanismDao.queryByMechid(e.getMechanism().getMechid()));
e.setEmployee(employeeDao.queryByEmpid(e.getEmployee().getEmpid()));
pb.setBeanList(errorsheetList);
return pb;
@Override
public int add(Errorsheet errorsheet)
return errorsheetDao.add(errorsheet);
@Override
public List<Errorsheet> queryAll()
return errorsheetDao.queryAll();
@Override
public PageBean<Errorsheet> queryAll(Errorsheet errorsheet, String bdate, String edate)
PageBean<Errorsheet> pb = errorsheetDao.queryAll(errorsheet, bdate, edate);
List<Errorsheet> errorsheetList = pb.getBeanList();
for (Errorsheet e : errorsheetList)
e.setMechanism(mechanismDao.queryByMechid(e.getMechanism().getMechid()));
e.setEmployee(employeeDao.queryByEmpid(e.getEmployee().getEmpid()));
pb.setBeanList(errorsheetList);
return pb;
package faceattendsystem.serviceImpl;
import java.sql.Date;
import java.util.List;
import faceattendsystem.dao.IEmployeeDao;
import faceattendsystem.dao.IFlowsheetDao;
import faceattendsystem.daoImpl.EmployeeDaoImpl;
import faceattendsystem.daoImpl.FlowsheetDaoImpl;
import faceattendsystem.entity.Employee;
import faceattendsystem.entity.Flowsheet;
import faceattendsystem.entity.PageBean;
import faceattendsystem.service.IFlowsheetService;
public class FlowsheetServiceImpl implements IFlowsheetService
IFlowsheetDao flowsheetDao = new FlowsheetDaoImpl();
IEmployeeDao employeeDao = new EmployeeDaoImpl();
@Override
public List<Flowsheet> query(Date date, String empid)
return flowsheetDao.query(date,empid);
@Override
public Date getMindate(Employee employee)
return flowsheetDao.getMindate(employee);
@Override
public PageBean<Flowsheet> query(String empid, String bdate, String edate, int pc, int ps)
PageBean<Flowsheet> pb = flowsheetDao.query(empid,bdate,edate,pc,ps);
List<Flowsheet> flowsheetList = pb.getBeanList();
for(Flowsheet fs:flowsheetList)
fs.setEmployee(employeeDao.queryByEmpid(fs.getEmployee().getEmpid()));
fs.setLogtime(getRealTime(fs.getLogtime()));
fs.setClientdatetime(getDatetime(fs.getClientdatetime()));
//fs.setSimilarity(getExactValue(fs.getSimilarity()));
return pb;
@Override
public PageBean<Flowsheet> queryAll(String empid, String bdate, String edate)
PageBean<Flowsheet> pb = flowsheetDao.queryAll(empid,bdate,edate);
List<Flowsheet> flowsheetList = pb.getBeanList();
for(Flowsheet fs:flowsheetList)
fs.setEmployee(employeeDao.queryByEmpid(fs.getEmployee().getEmpid()));
fs.setLogtime(getRealTime(fs.getLogtime()));
fs.setClientdatetime(getDatetime(fs.getClientdatetime()));
return pb;
/**
* 添加打卡记录
* @param flowsheet
*/
public void addSheet(Flowsheet flowsheet)
flowsheetDao.addSheet(flowsheet);
/* private float getExactValue(float similarity)
return (Math.round(similarity*100)/100);
*/
private String getDatetime(String datetime)
String date = datetime.substring(0,8);
date = date.substring(0,4)+"-"+date.substring(4,6)+"-"+date.substring(6);
String time = datetime.substring(8);
time = getRealTime(time);
datetime = date+" "+time;
return datetime;
private String getRealTime(String time)
while(time.length()<6)
time = "0"+time;
time = time.substring(0,2)+":"+time.substring(2,4)+":"+time.substring(4);
return time;
以上是关于基于Javaweb实现的人脸识别考勤系统的主要内容,如果未能解决你的问题,请参考以下文章
python实现人脸识别系统设计_基于ROS的人脸识别系统设计与实现