プロジェクト紹介
springbootによって構築された訪問者管理システムは、ハイエンドベースの訪問者情報管理の厳密な制御を実装します。ユーザーバックエンドは、さまざまな部門の管理のために複数の管理者アカウントを設定できます。訪問するには、入場手続きを経て、訪問者の予約で予約申請書を提出する必要があります。予約後、管理者は予約レコードと訪問者の入退場レコードを照会できます。
対象者
プロジェクトの完全なセットを実行している学生、または実践的なプロジェクトの実践を必要とするJava学習者
開発環境
- jdk 8
- インテリジアイデア
- Tomcat 8.5.40
- mysql 5.7
使用したテクノロジー
- スプリングブーツ
- 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()));
}
}
}
}
予防
- 予約アドレスは管理端末でホストと共有する必要があり、ホストは予約登録のために訪問者と共有します
- 後の期間にホスト端末を追加し、レコードを表示するホストを追加します