Project Introduction
The visitor management system built by springboot implements strict control of visitor information management for high-end bases. The user backend can set up multiple administrator accounts for management of different departments. User management can add/modify basic information of internal members. Those who need to visit must go through the entry procedure and submit an appointment application in the visitor appointment. After the appointment, the administrator can query the appointment record and the visitor's entry and exit records.
Applicable people
Students who are doing a complete set of projects, or Java learners who need practical project practice
Development environment
- jdk 8
- intellij idea
- tomcat 8.5.40
- mysql 5.7
Technology used
- springboot
- mybatis
- layUi
- JSP
Project visit address
http://localhost:8090
帐号:admin 密码:admin
Project screenshot
-
log in
-
Sub-account management
- Add member
- Appointment list
- Historical appointment
- Entry and exit video records
- Form export
- Visitor appointment application
Key code:
-
User Info
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; }
-
Add visitor record
@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);//查无一人 } }
- Visitor record export
@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.过期预约做定时清理
```diff
@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()));
}
}
}
}
Precautions
- The appointment address needs to be shared by the management terminal with the host, and the host will share it with the visitors for appointment registration
- Later, add the homeowner terminal and add homeowner viewing records.
Remarks: The basic version is relatively simple. Students with conditions can connect to the hardware equipment and run the complete process. If there is a problem with the program , contact the program help