前言
随着大众对入住安全、快节奏的生活方式和智能服务的关注与提升,酒店在线预订系统呈现出更加智能化和个性化服务的趋势。本研究尝试利用 Spring Boot、Vue 及 MySQL 技术,设计并开发一款酒店在线预订系统。通过文献调研、需求分析及系统设计方法,对系统需求进行了梳理,构建了系统框架。该系统主要包含用户、商家和员工三个核心模块。用户模块具备注册登录、我的收藏、个人中心、修改资料、入住信息查询、退房信息查询、商家信息、客房信息、新闻信息、在线留言等功能;商家模块负责用户信息管理、系统内容管理及系统配置;员工模块负责个人资料管理、客房预订管理、入住管理、退房管理、修改密码等服务。测试结果显示,系统功能运行相对稳定,性能基本符合预期,能够为用户提供具有一定个性化的酒店在线预订服务,通过技术赋能与资源整合,酒店在线预订已形成“效率提升—体验升级—成本优化”的良性循环,成为现代出行的核心解决方案,并为后续相关系统的开发提供参考思路。
一、项目介绍
开发语言:Java
框架:springboot
JDK版本:JDK1.8
服务器:tomcat7
数据库:mysql
数据库工具:Navicat11
开发软件:eclipse/myeclipse/idea
Maven包:Maven
二、功能介绍
3.1功能需求分析
3.1.1用户模块
注册登录:或许可尝试通过手机进行注册,设置密码并填写相关信息。登录方式方面,可能支持账号密码、短信验证码等形式,同时也具备找回密码的功能。
个人中心:修改资料(修改资料:用户名、姓名、性别、出生日期、身份证、手机号、人像照片)、入住信息查询(入住人、登记人、入住时间、房间号)、退房信息查询。
商家信息:用户可以查看酒店风格和入住条件,并进行入住酒店的选择
客房信息:客房预订添加(预订人、预约日期、酒店名称、商家号、房间号、价格、天数、总价、员工)
新闻信息:用户可以随时查看关于酒店的信息,帮助用户更好地了解酒店。
在线留言:用户可以留言提出问题和建议,管理员大概会定期查看并回复。
3.1.2员工模块
个人资料管理:可以查看、添加、修改、删除用户信息,也可能会进行分组管理。
客房预订管理:客房预订添加、客房预订查询,运用到了增加、删除、查询功能,添加了支付功能。
入住管理:进行入住查询,对入住情况进行管理和调整
退房管理:进行退房查询,对入住情况进行管理和调整
4.2功能模块设计
4.2.1用户模块
在注册登录环节,前端使用 Vue.js,后端由 Spring Boot 进行验证处理,注册信息存储至 MySQL,登录成功后返回 JWT 令牌。关于酒店入住数据管理,可实现手动输入、设备导入和导出功能,并且能够通过图表进行可视化展示。在入住信息查看方面,后端结合用户信息生成建议存入数据库,之后返回前端展示。入住客户信息、酒店信息,相关信息存储在 MySQL 相应表中。
4.2.2员工模块
管理员具备管理用户信息的能力,能够进行添加、修改、删除和分组等操作;同时可审核用户信息和入住、退房等信息;以及设置系统参数、权限和通知。
如下图
图4.1功能结构图
三、核心代码
部分代码:
package com.example.controller;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import com.example.common.Result;
import com.example.common.ResultCode;
import com.example.entity.Caiwu;
import com.example.exception.CustomException;
import com.example.service.CaiwuService;
import com.example.utils.MapWrapperUtils;
import com.example.utils.jwt.JwtUtil;
import com.example.vo.CaiwuVo;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value = "/caiwu")
public class CaiwuController {
@Resource
private CaiwuService caiwuService;
@PostMapping
public Result<Caiwu> add(@RequestBody CaiwuVo caiwu) {
caiwuService.add(caiwu);
return Result.success(caiwu);
}
@PostMapping("/deleteList")
public Result<Caiwu> deleteList(@RequestBody CaiwuVo caiwu) {
caiwuService.deleteList(caiwu.getList());
return Result.success();
}
@DeleteMapping("/{id}")
public Result delete(@PathVariable Long id) {
caiwuService.delete(id);
return Result.success();
}
@PutMapping
public Result update(@RequestBody CaiwuVo caiwu) {
caiwuService.update(caiwu);
return Result.success();
}
@GetMapping("/{id}")
public Result<Caiwu> detail(@PathVariable Integer id) {
Caiwu caiwu = caiwuService.findById(id);
return Result.success(caiwu);
}
@GetMapping
public Result<List<Caiwu>> all() {
return Result.success(caiwuService.list());
}
@PostMapping("/page")
public Result<CaiwuVo> page(@RequestBody CaiwuVo caiwuVo) {
return Result.success(caiwuService.findPage(caiwuVo));
}
@PostMapping("/login")
public Result login(@RequestBody Caiwu caiwu, HttpServletRequest request) {
if (StrUtil.isBlank(caiwu.getZhanghao()) || StrUtil.isBlank(caiwu.getMima())) {
throw new CustomException(ResultCode.PARAM_LOST_ERROR);
}
Caiwu login = caiwuService.login(caiwu);
// if(!login.getStatus()){
// return Result.error("1001","状态限制,无法登录系统");
// }
if(login != null) {
HashMap hashMap = new HashMap();
hashMap.put("user", login);
Map<String, Object> map = MapWrapperUtils.builder(MapWrapperUtils.KEY_USER_ID,caiwu.getId());
String token = JwtUtil.creatToken(map);
hashMap.put("token", token);
return Result.success(hashMap);
}else {
return Result.error();
}
}
@PutMapping("/updatePassword")
public Result updatePassword(@RequestBody Caiwu info, HttpServletRequest request) {
Caiwu caiwu = caiwuService.findById(info.getId());
String oldPassword = SecureUtil.md5(info.getMima());
if (!oldPassword.equals(caiwu.getMima())) {
return Result.error(ResultCode.PARAM_PASSWORD_ERROR.code, ResultCode.PARAM_PASSWORD_ERROR.msg);
}
info.setMima(SecureUtil.md5(info.getNewPassword()));
Caiwu caiwu1 = new Caiwu();
BeanUtils.copyProperties(info, caiwu1);
caiwuService.update(caiwu1);
return Result.success();
}
}
四、效果图
源码获取
下方名片联系我即可!!
大家点赞、收藏、关注、评论啦 、查看👇🏻获取联系方式👇🏻