基于javaweb的SpringBoot访客管理系统(java+springboot+layui+jsp+maven+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

220023302402

230023302402

240023302402

260023302402

270023302402

280023302402

482024163108

基于javaweb的SpringBoot访客管理系统(java+springboot+layui+jsp+maven+mysql)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
技术栈
1. springboot
2. mybatis
3. layUi
4. JSP

登录:
admin 123456

功能:

管理员:
登录
子管理员管理
用户管理
预约管理、分享预约地址
历史预约记录管理(该数据是由定时任务VisitorTimeOutJob,每分钟检查预约列表,将所有过期的记录转移到该列表中)
修改个人资料
预约提醒

访客:
填写预约信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

@Api(tags="历史预约记录管理")
@Controller
@RequestMapping(value = "visitorRecordManager")
public class VisitorRecordController {
@Autowired
private VisitorRecordService smartUserService;

@ApiOperation(value="按照编号删除预约信息",notes="按照编号删除预约信息")
@ApiImplicitParam(name="id",value="预约编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/delVisitorRecord/{id}")
public Response<String> delUser(@PathVariable("id")Long id){
smartUserService.deleteUserById(id);
return Response.ok("success");
}


@GetMapping("/visitorList")
public ModelAndView visitorList(@RequestParam(name = "pageNum",defaultValue = "1") int pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
String appointmentTime,
ModelAndView modelAndView) {
PageInfo<VisitorRecord> data= smartUserService.getAllByPage(pageNum, pageSize,appointmentTime);
modelAndView.addObject("page",data);
modelAndView.setViewName("visitorRecord/visitor-list");
return modelAndView;
}


//到处访客记录
@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);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
		modelAndView.setViewName("visitor/visitor-edit");
return modelAndView;
}

}
package com.visitor.web.controller;



@Api(tags="用户模块")
@Controller
@RequestMapping(value = "userManager")
public class SmartUserController {
@Autowired
private SmartUserService smartUserService;


@ApiOperation(value="添加用户",notes="添加用户")
@ResponseBody
@PostMapping("/addUser")
public Response<String> addUser(SmartUser user){
return smartUserService.saveOrUpdate(user);
}

@ApiOperation(value="按照编号删除用户信息",notes="按照编号删除用户信息")
@ApiImplicitParam(name="id",value="用户编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/delUser/{id}")
public Response<String> delUser(@PathVariable("id")Long id){
smartUserService.deleteUserById(id);
return Response.ok("success");
}

@ApiOperation(value="按照编号删除用户信息",notes="按照编号删除用户信息")
@ApiImplicitParam(name="id",value="用户编号",paramType="path",required=true)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
@ApiImplicitParam(name="id",value="预约编号",paramType="path",required=true)
@ResponseBody
@PostMapping("/updateVisitor")
public Response<String> updateAdmin(Visitor visitor){
return visitorService.saveOrUpdate(visitor);
}
@ApiOperation(value="分页查找所有预约",notes="分页查找所有预约")
@ApiImplicitParams({
@ApiImplicitParam(name="pageNum",value="当前页码",defaultValue="1"),
@ApiImplicitParam(name="pageSize",value="每页显示数据个数(0是全部)",defaultValue="10")
})
@GetMapping("/visitorList")
public ModelAndView visitorList(@RequestParam(name = "pageNum",defaultValue = "1") int pageNum,
@RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
String shows,ModelAndView modelAndView) {
PageInfo<Visitor> data= visitorService.getAllByPage(pageNum, pageSize);
if(null!=shows&&!"".equals(shows)){
visitorService.updateShow();
modelAndView.addObject("num",0);
}
modelAndView.addObject("page",data);
modelAndView.setViewName("visitor/visitor-list");
return modelAndView;
}

/**
* @Description(功能描述): 预约访客地址
**/
@ResponseBody
@GetMapping("/visitorUrl")
public Response<String> visitorUrl() {
String port=environment.getProperty("server.port");
String url="http://"+IpUtils.getLocalIpAddr()+":"+port+"/visitorManager/subscribe";
return Response.ok(url);
}
/**
* @Description(功能描述): 预约页面
**/
@GetMapping("/subscribe")
public ModelAndView visitorUrl(ModelAndView modelAndView) {
modelAndView.setViewName("visitor/subscribe");
return modelAndView;
}
@GetMapping("/subscribeList/{phone}")
public ModelAndView subscribeList(@PathVariable("phone")String phone, ModelAndView modelAndView) {
List<Visitor> list= visitorService.findVisitorList(phone);
modelAndView.addObject("list",list);
modelAndView.setViewName("visitor/subscribeList");
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
			modelAndView.addObject("num",num);
}else{
modelAndView.setViewName("login");
}
return modelAndView;
}
/**
* @Description(功能描述): 登录
**/
@GetMapping({"login","logout"})
public ModelAndView login(HttpSession session,ModelAndView modelAndView){
modelAndView.setViewName("login");
return modelAndView;
}

@ResponseBody
@PostMapping("/uploadImg")
public Response<String> uploadImg(){
return Response.ok();
}

@ResponseBody
@PostMapping("/doLogin")
public Response<String> doLogin(HttpSession session, Admin admin){
if("admin".equalsIgnoreCase(admin.getRole())){
Admin result= adminService.login(admin);
if(null!=result){
session.setAttribute("loginAdmin",result);
return Response.ok("index");
}else {
return Response.error(300);
}
}else{
SmartUser user=new SmartUser();
user.setAccount(admin.getAccount());
user.setPassword(admin.getPasswd());
user=userService.login(user);
if(null!=user){
session.setAttribute("loginUser",user);
return Response.ok("userIndex");
}else {
return Response.error(300);
}
}
}
}
package com.visitor.web.controller;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
			modelAndView.setViewName("login");
}
return modelAndView;
}
/**
* @Description(功能描述): 登录
**/
@GetMapping({"login","logout"})
public ModelAndView login(HttpSession session,ModelAndView modelAndView){
modelAndView.setViewName("login");
return modelAndView;
}

@ResponseBody
@PostMapping("/uploadImg")
public Response<String> uploadImg(){
return Response.ok();
}

@ResponseBody
@PostMapping("/doLogin")
public Response<String> doLogin(HttpSession session, Admin admin){
if("admin".equalsIgnoreCase(admin.getRole())){
Admin result= adminService.login(admin);
if(null!=result){
session.setAttribute("loginAdmin",result);
return Response.ok("index");
}else {
return Response.error(300);
}
}else{
SmartUser user=new SmartUser();
user.setAccount(admin.getAccount());
user.setPassword(admin.getPasswd());
user=userService.login(user);
if(null!=user){
session.setAttribute("loginUser",user);
return Response.ok("userIndex");
}else {
return Response.error(300);
}
}
}
}
package com.visitor.web.controller;


项目链接:
https://javayms.github.io?id=361422322105200kp
https://javayms.pages.dev?id=361422322105200kp