springboot搭建访客管理系统的实现示例
- 作者: 来壁咚
- 来源: 51数据库
- 2021-08-08
项目介绍
springboot搭建的访客管理系统,针对高端基地做严格把控来访人员信息管理,用户后端可以设置多个管理员帐号,给予不同部门的管理层使用,用户管理可以增加/修改内部成员的基本信息,需要到访的人员必须通过进入程序,在访客预约里面提交预约申请,预约后管理员可查询预约记录以及访客出入记录。
项目适用人群
正在做毕设的学生,或者需要项目实战练习的java学习者
开发环境
- jdk 8
- intellij idea
- tomcat 8.5.40
- mysql 5.7
所用技术
- springboot
- mybatis
- layui
- jsp
项目访问地址
http://localhost:8090
帐号:admin 密码:admin
项目截图
登录

子账号管理

新增成员

预约列表

历史预约

出入影像记录

表格导出

访客预约申请

关键代码:
用户信息
public class smartuser {
@apimodelproperty(value="用户编号",datatype="string",name="password")
private long id;
@apimodelproperty(value="登录帐号",datatype="string",name="account")
private string account;
@apimodelproperty(value="用户名称",datatype="string",name="name")
private string name;
@apimodelproperty(value="用户年龄",datatype="integer",name="age")
private int age;
@apimodelproperty(value="手机号",datatype="string",name="phone")
private string phone;
@apimodelproperty(value="密码",datatype="string",name="password")
private string password;
@apimodelproperty(value="mac",datatype="string",name="mac")
private string mac;
@apimodelproperty(value="备注",datatype="string",name="remark")
private string remark ;
@apimodelproperty(value="创建时间",datatype="string",name="createtime")
private string createtime;
private string headpic;
}
添加访客记录
@apioperation(value="添加预约",notes="添加预约")
@responsebody
@postmapping("/addvisitor")
public response<string> addvisitor(visitor visitor){
smartuser smartuser=new smartuser();
smartuser.setphone(visitor.getuserphone());
smartuser.setname(visitor.getusername());
smartuser=smartuserservice.login(smartuser);
if(null!=smartuser){
return visitorservice.saveorupdate(visitor);
}else{
return response.error(300);//查无一人
}
}
访客记录导出
@getmapping("/exportexcel")
public void exportexcel(httpservletresponse response) {
try{
list<list<string>> rows =new arraylist<>();
list<string> row1 = collutil.newarraylist("访客姓名", "访客手机号", "被访人姓名", "被访人电话", "预约日期", "访问事由");
rows.add(row1);
list<visitorrecord> list=smartuserservice.getall();
for(visitorrecord vr:list){
rows.add(collutil.newarraylist(vr.getvisitorname(), vr.getphone(),vr.getuserphone(),vr.getusername(),vr.getappointmenttime(),vr.getreasons()));
}
excelwriter writer = excelutil.getwriter();
writer.write(rows);
response.setcontenttype("application/vnd.ms-excel;charset=utf-8");
response.setheader("content-disposition","attachment;filename="+ dateutils.gettime3()+"visitorrecord.xls");
servletoutputstream out=response.getoutputstream();
writer.flush(out);
writer.close();
ioutil.close(out);
}catch (exception e){
e.printstacktrace();
}
}
4.过期预约做定时清理
@scheduled(cron = "0 0/1 * * * ?")
private void configuretasks() {
list<visitor> list=visitorservice.findvisitorlist("");
if(list.size()>0){
for(visitor v:list){
long now=long.valueof(dateutils.gettime2());
long appointmenttime=long.valueof(v.getappointmenttime().replaceall("-","").replaceall(" ",""));
if(appointmenttime-now<=0){
visitorrecord visitorrecord=new visitorrecord();
beanutils.copyproperties(v,visitorrecord);
visitorrecordservice.save(visitorrecord);
visitorservice.deleteuserbyid(long.valueof(v.getid()));
}
}
}
}
注意事项
- 预约地址需要有管理端分享地址给房主,由房主分享给到访的做预约登记
- 后期增加房主端,新增房主查看记录
备注:基础版做的比较简单,有条件的同学可以对接硬件设备,跑完整体流程
到此这篇关于springboot搭建访客管理系统的实现示例的文章就介绍到这了,更多相关springboot搭建访客管理系统内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!
推荐阅读
