赞
踩
大家好,我是java1234_小锋老师,看到一个不错的SpringBoot+Vue酒店客房预定(预约)管理系统,分享下哈。
【免费】SpringBoot+Vue酒店客房预定(预约)管理系统 Java毕业设计_哔哩哔哩_bilibili
在数字化转型的浪潮中,酒店业正积极采用先进的信息技术来优化客户体验和运营效率。本研究旨在开发一款基于Spring Boot后端框架和Vue.js前端框架的酒店客房预订管理系统,以满足现代酒店对高效、便捷、安全的预订管理需求。
系统采用Spring Boot作为后端技术栈的核心,负责处理业务逻辑、数据存储与安全控制,利用其内置的Spring Security进行权限管理和用户认证。数据库采用关系型数据库MySQL,以确保数据的一致性和事务性。此外,使用Redis作为缓存层,提高数据读取速度,减少数据库压力。
前端界面采用Vue.js构建,提供直观、响应式的用户界面,包括客房查询、预订、取消、支付等功能。通过Axios与后端API进行交互,实现动态数据展示和实时更新。系统还集成了地图服务API,为用户提供酒店位置信息及周边设施详情,增强用户体验。
安全性方面,系统采用JWT(JSON Web Token)进行身份验证,确保通信过程中的数据安全。
本系统的实施不仅提升了酒店的预订管理效率,也极大地改善了顾客的在线预订体验。通过性能测试和用户反馈,证明了该系统在响应时间、易用性和安全性方面的优越性,为酒店业提供了有力的技术支撑,推动了行业的数字化进程。
- package com.rabbiter.hotel.controller.user;
-
- import cn.hutool.crypto.SecureUtil;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.rabbiter.hotel.common.CommonResult;
- import com.rabbiter.hotel.common.StatusCode;
- import com.rabbiter.hotel.domain.User;
- import com.rabbiter.hotel.dto.LoginDTO;
- import com.rabbiter.hotel.dto.PasswordDTO;
- import com.rabbiter.hotel.dto.RegisterDTO;
- import com.rabbiter.hotel.dto.ReturnUserDTO;
- import com.rabbiter.hotel.service.UserService;
- import com.rabbiter.hotel.util.WebUtils;
- import org.springframework.beans.BeanUtils;
- import org.springframework.web.bind.annotation.*;
-
- import javax.annotation.Resource;
-
-
- @RestController
- @RequestMapping("/user")
- public class UserController {
-
- @Resource
- private UserService userService;
-
- @PostMapping(value = "/register")
- public CommonResult<String> register(@RequestBody RegisterDTO registerDTO) {
- // 邮箱唯一验证
- long count = userService.count(new QueryWrapper<User>().eq("email", registerDTO.getEmail()));
- if(count > 0) {
- // 邮箱重复
-
- CommonResult<String> commonResult = new CommonResult<>();
- commonResult.setData("邮箱已存在");
- commonResult.setCode(StatusCode.COMMON_FAIL.getCode());
- commonResult.setMessage(StatusCode.COMMON_FAIL.getMessage());
- return commonResult;
- }
- CommonResult<String> commonResult = new CommonResult<>();
-
- User user = new User();
- BeanUtils.copyProperties(registerDTO, user);
- user.setPassword(SecureUtil.md5(registerDTO.getPassword()));
- // System.out.println(user);
-
- userService.save(user);
-
- commonResult.setData("注册成功");
- commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());
- commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());
- return commonResult;
- }
-
- @PostMapping(value = "/login")
- public CommonResult<String> login(@RequestBody LoginDTO loginDTO) {
- CommonResult<String> commonResult = new CommonResult<>();
- QueryWrapper queryWrapper = new QueryWrapper();
- queryWrapper.eq("email", loginDTO.getEmail());
- String md5Password = SecureUtil.md5(loginDTO.getPassword());
- queryWrapper.eq("password", md5Password);
- User user = userService.getBaseMapper().selectOne(queryWrapper);
-
- if (null != user) {
-
- WebUtils.getSession().setAttribute("loginUser", user);
- // System.out.println(WebUtils.getSession().getId());
-
- commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());
- commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());
- commonResult.setData("登录成功");
- } else {
- commonResult.setCode(StatusCode.COMMON_FAIL.getCode());
- commonResult.setMessage(StatusCode.COMMON_FAIL.getMessage());
- commonResult.setData("账号密码错误,请重试");
- }
-
- System.out.println(commonResult);
- return commonResult;
- }
-
- @GetMapping("/logout")
- public CommonResult<String> logout(){
- CommonResult<String> commonResult = new CommonResult<>();
-
- WebUtils.getSession().removeAttribute("loginUser");
-
- commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());
- commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());
- commonResult.setData("登出成功!");
-
- return commonResult;
- }
-
- @GetMapping("/userDetail")
- public CommonResult<ReturnUserDTO> userDetail() {
- CommonResult<ReturnUserDTO> commonResult = new CommonResult();
- ReturnUserDTO returnUser = new ReturnUserDTO();
-
- // User user1 = new User();
- // user1.setId(6);
- // // user1.setCreateTime(new Date());
- // // user1.setEmail("1066261401@qq.com");
- // // user1.setUserName("水墨清尘");
- // // user1.setPassword("e10adc3949ba59abbe56e057f20f883e");
- // // user1.setSex(0);
- // // user1.setPhone("19861407837");
- // WebUtils.getSession().setAttribute("loginUser", user1);
-
- User user2 = (User) WebUtils.getSession().getAttribute("loginUser");
- // System.out.println(WebUtils.getSession().getId());
- User user = userService.getById(user2.getId());
- // System.out.println(user);
- BeanUtils.copyProperties(user, returnUser);
-
- commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());
- commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());
- commonResult.setData(returnUser);
-
- return commonResult;
- }
-
- @PostMapping("/updatePassword")
- public CommonResult<String> updatePassword(@RequestBody PasswordDTO passwordDTO) {
- CommonResult<String> commonResult = new CommonResult<>();
- QueryWrapper queryWrapper = new QueryWrapper();
- System.out.println(passwordDTO);
-
- // User user1 = new User();
- // user1.setId(10);
- // // user1.setCreateTime(new Date());
- // // user1.setEmail("1066261401@qq.com");
- // // user1.setUserName("水墨清尘");
- // // user1.setPassword("e10adc3949ba59abbe56e057f20f883e");
- // // user1.setSex(0);
- // // user1.setPhone("19861407837");
- // WebUtils.getSession().setAttribute("loginUser", user1);
-
- User user2 = (User) WebUtils.getSession().getAttribute("loginUser");
- User user = userService.getById(user2.getId());
-
- String md5OldPassword = SecureUtil.md5(passwordDTO.getOldPassword());
-
- if (!user.getPassword().equals(md5OldPassword)) {
- commonResult.setCode(StatusCode.COMMON_FAIL.getCode());
- commonResult.setMessage(StatusCode.COMMON_FAIL.getMessage());
- commonResult.setData("密码错误");
-
- return commonResult;
- }
-
- String md5NewPassword = SecureUtil.md5(passwordDTO.getNewPassword());
- user.setPassword(md5NewPassword);
- userService.updateById(user);
-
- commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());
- commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());
- commonResult.setData("修改密码成功");
-
- return commonResult;
- }
-
- }
- <template>
- <div>
- <el-container class="wrapper">
- <el-main class="section text-center">
- <div class="login-bg"></div>
- <el-card class="box-card login-card">
- <div class="text item">
- <p class="login-title">
- <i
- class="iconfont icon-r-yes"
- style="font-size: 32px"
- ></i>
- 酒店客房预订系统
- </p>
- <el-form
- :model="login"
- status-icon
- ref="login"
- label-width="80px"
- >
- <el-form-item label="账户邮箱" prop="email">
- <el-input
- type="text"
- v-model="login.email"
- autocomplete="off"
- ></el-input>
- </el-form-item>
- <el-form-item label="密码" prop="pass">
- <el-input
- type="password"
- v-model="login.password"
- autocomplete="off"
- ></el-input>
- </el-form-item>
- </el-form>
- </div>
- </el-card>
- <el-button
- circle
- :type="btnType"
- @click="loginBtn"
- class="loginbtn"
- :disabled="disabled"
- >
- <i :class="iconstyle" style="font-size: 54px"></i>
- </el-button>
- <div class="register">
- <p>
- <router-link to="/register" style="color: black"
- >注册账号</router-link
- >
- </p>
- </div>
- <a href="http://www.java1234.com/a/bysj/javaweb/" target='_blank'><font color=red>Java1234收藏整理</font></a>
-
- </el-main>
- </el-container>
- <el-footer class="footer text-center">
- <copyright></copyright>
- </el-footer>
- </div>
- </template>
-
- <script>
- import copyright from "@/components/copyright.vue";
- import store from "./../store";
- export default {
- data() {
- return {
- login: {
- email: "",
- password: "",
- },
- iconstyle: "iconfont icon-r-right",
- disabled: false,
- btnType: "primary",
- isRealLogin: true,
- };
- },
- components: {
- copyright,
- },
- methods: {
- loginBtn() {
- if (
- this.login.email.trim() == "" ||
- this.login.password.trim() == ""
- ) {
- this.$message({
- message: "账号或密码不能为空",
- type: "error",
- });
- return;
- }
- this.iconstyle = "el-icon-loading";
- this.disabled = true;
-
- this.axios
- .post("http://localhost:9151/user/login", {
- email: this.login.email,
- password: this.login.password,
- })
- .then((res) => {
- if (res.data.code == 200) {
- this.iconstyle = "el-icon-check";
- this.btnType = "success";
- this.$message({
- message: "登录成功,正在跳转",
- type: "success",
- });
- setTimeout(() => {
- this.disabled = false;
- this.$store.commit("setFind");
- this.$router.push("/findroom");
- }, 2000);
- } else {
- this.iconstyle = "el-icon-close";
- this.btnType = "danger";
- this.$message({
- message: "登录失败,账号或密码错误",
- type: "error",
- });
- setTimeout(() => {
- this.disabled = false;
- this.iconstyle = "iconfont icon-r-right";
- this.btnType = "primary";
- }, 2000);
- }
- })
- .catch((e) => {
- this.iconstyle = "el-icon-close";
- this.btnType = "danger";
- setTimeout(() => {
- this.disabled = false;
- this.iconstyle = "iconfont icon-r-right";
- this.btnType = "primary";
- }, 2000);
-
- if (e.response == undefined || e.response.data == undefined) {
- this.$message({
- showClose: true,
- message: e,
- type: "error",
- duration: 0,
- });
- } else {
- this.$message({
- showClose: true,
- message: e.response.data,
- type: "error",
- duration: 0,
- });
- }
- });
- },
- nologinBtn() {
- this.$store.commit("setFind");
- this.$router.push("/findroom");
- },
- },
- };
- </script>
-
- <style scoped="scoped">
- .login-bg {
- background: rgb(65, 105, 225);
- height: 30vh;
- background-size: 100%;
- border: 0px solid transparent;
- border-bottom-left-radius: 10px;
- border-bottom-right-radius: 10px;
- }
-
- .text {
- font-size: 14px;
- }
-
- .item {
- /* padding: 18px 0; */
- }
-
- .login-card {
- margin: -7rem 1rem 1rem 1rem;
- }
-
- .login-title {
- font-size: 2rem;
- font-weight: lighter;
- margin-top: 1rem;
- }
-
- .wrapper {
- min-height: 90vh;
- }
-
- .el-main {
- max-height: 90vh;
- }
-
- #app {
- overflow: hidden;
- }
-
- .loginbtn {
- width: 7rem;
- height: 7rem;
- font-size: 1.5rem;
- margin-top: 2rem;
- }
-
- .register {
- margin-top: 5vh;
- }
-
- .register a,
- .register div {
- color: #409eff;
- }
-
- .register p {
- margin: 0.5rem;
- }
- </style>
下载地址:
链接:https://pan.baidu.com/s/1AKqVPmoYeF-qllmsDWetWg
提取码:1234
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。