基于JAVA WEB SpringBoot框架的民宿酒店管理系统

运行环境: 最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
IDE环境:idea
硬件环境: windows 10 2G内存以上(推荐4G,4G以上更好)
用了技术框架: CSS+JavaScript+jsp+mysql+SSM+spring boot
所用的数据库: Mysql数据库,任意版本均可,也可使用各种数据库工具,例如Navicat等。
tips: 需要链接数据库的jsp程序,用到的数据库保存在源码码头的数据库平台上,为了防止童鞋们不注意删除数据,会每24小时还原一次,有较低的概率在你们演示的时候,刚插入或者刚更新,数据库就被还原了,是正常现象,你们下载到本地后,用你们自己的数据库就可以了~^_^。
适用于: 由于本程序规模不大,可供课程设计,毕业设计学习演示之用。

系统角色:管理员和酒店前台人员

管理员功能:住宿管理,房间管理,系统管理,财务管理,房间预定,员工管理,入账管理,结算管理等

前台管理:住宿管理,房间管理,系统管理,财务管理,房间预定,入账管理,结算管理,房客管理等

系统实现截图:

主页:

<div>
    <!--BEGIN BACK TO TOP-->
    <a id="totop" href="#"><i class="fa fa-angle-up"></i></a>
    <!-- 引用头部 -->
    <div th:replace="common/top::topFragment"></div>
    <!--END TOPBAR-->
    <div id="wrapper">
        <!-- 引用左菜单导航栏 -->
        <div th:replace="common/leftToolBar::leftToolbar"></div>
        <!--END CHAT FORM-->
        <!--BEGIN PAGE WRAPPER-->
        <div id="page-wrapper">
            <!-- 引用工具条 -->
            <div th:replace="common/toolBar::toolBar"></div>
            <!--END TITLE & BREADCRUMB PAGE-->
            <!--BEGIN CONTENT-->
            <!--右侧区内容的编写 -->

            <div class="page-content">
                <!-- 功能操作内容 -->
                <div class="img1">
                    <img src="/images/main/a.jpg" >
                </div>
                <div class="div1">
               <a href="/main.html" style="color: white">欢迎来到旅游景点民宿管理系统</a>
            </div>

            </div>
            <!--END CONTENT-->
        </div>
        <!-- 引用底部 -->
        <div th:replace="common/bottom::bottom"></div>
        <!--END FOOTER-->
        <!--END PAGE WRAPPER-->
    </div>
</div>

房间预定:

@RequestMapping("/getOrdersList")
public String getOrdersList(@ModelAttribute(name = "name",binding = false) String name,
                             @ModelAttribute(name = "idNumber",binding = false) String idNumber,
                             @ModelAttribute(name = "typeName",binding = false) String typeName,
                             @ModelAttribute(name = "roomId",binding = false) String roomId,
                             @ModelAttribute(name = "orderStatus",binding = false) String orderStatus,
                             @RequestParam("pageNum") Integer pageNum,
                             @RequestParam("orderState") String orderState,
                             Model model, HttpSession session){
    Employee emp = null;
    Map<String,Object> map = null;
    List<Orders> ordersList = null;
    try {
        //设置当前页和每页数量
        PageHelper.startPage(pageNum,4);
        //设置查询条件
        map = new HashMap<>();
        map.put("name",name);
        map.put("idNumber",idNumber);
        map.put("typeName",typeName);
        map.put("roomId",roomId);
        map.put("status", orderState.equals("预订中") ? Arrays.asList("2"): orderStatus.equals("0") ? Arrays.asList("1","2","8","9"):Arrays.asList(orderStatus));
        ordersList = ordersService.list(map);
        //获取PageInfo对象,该对象封装的分页的相关信息
        PageInfo<Orders> pageInfo = new PageInfo<>(ordersList);
        model.addAttribute("pageInfo",pageInfo);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return orderState.equals("预订中") ? "stay/reserve/reserveList" : orderState.equals("入住结算") ? "stay/settleAccounts/settleAccounts":"stay/checkIn/checkInList";
}

入住登记:

@RequestMapping("/addCheckInRegisterOrders")
@ResponseBody
public Boolean addCheckInRegisterOrders(Orders orders,OrderDetail orderDetail,HttpSession session){
    Boolean result = null;
    try {
        Integer count = ordersService.insertCheckInRegister(orders,orderDetail);//添加订单
        result = count > 0 ? true : false;
    } catch (Exception e) {
        e.printStackTrace();
        result = false;
    }
    return result;
}

账单结算:

@PostMapping("/addOrderDetail")
@ResponseBody
public Boolean addOrderDetail(OrderDetail orderDetail,HttpSession session){
    Integer result = 0;
    try {
        result = orderDetailService.insert(orderDetail);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return result > 0 ? true : false;
}

@PostMapping("/payment")
@ResponseBody
public Boolean payment(@RequestParam("ordersId") String ordersId){
    Integer result = 0;
    try {
        //获取原来数据修改已支付金额为总金额
        Orders orders = ordersService.listByOrdersId(ordersId).get(0);
        orders.setRepayMoney(orders.getTotalMoney());
        result = ordersService.updateAll(orders);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return result > 0 ? true : false;
}

房间管理:

@RequestMapping("/toRoomType")
public String roomType(RoomType roomType, Integer pageNum, Model model) {

    try {
        //设置当前页和每页数量
        PageHelper.startPage(pageNum,5);
        //在这里看看是否有值
        System.out.println("是否有值"+roomType);
        //设置查询条件
         List<RoomType> roomTypeList = roomTypeService.getRoomTypesByRoomType(roomType);
        //获取PageInfo对象,该对象封装的分页的相关信息
        PageInfo<RoomType> pageInfo = new PageInfo<>(roomTypeList);
        //查询分页
        model.addAttribute("pageInfo",pageInfo);
        //数据回显
        System.out.println("roomType----"+roomType);
        model.addAttribute("roomType",roomType);
    } catch (Exception e) {
        e.printStackTrace();
        /*message = "查询房间状态信息时出现异常:" + e.getMessage();*/
    }
    return "room/typeRoomSet/roomType";
}

房间设置:

@RequestMapping("/getRoomInfo")
@ResponseBody
public Object getRoomInfoWithId(String roomId){
    try {
        return roomService.getRoomInfoWithId(roomId);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

员工管理:

@RequestMapping("/toEmployee")
public String toEmployeeInfo(Employee employee, Integer pageNum, Model model,Integer roleId){
        try {
            //设置当前页和每页数量
            PageHelper.startPage(pageNum,5);
            //设置查询条件
            if (roleId != null)
                employee.getRole().setRoleId(roleId);
            List<Employee> employees = employeeService.getAllEmployeeByEmployee(employee);
            //获取PageInfo对象,该对象封装的分页的相关信息
            PageInfo<Employee> pageInfo = new PageInfo<>(employees);
            //查询分页
            model.addAttribute("pageInfo",pageInfo);
            //显示列表值
            List<Role> roles = roleService.getAllRoleInfo();
            model.addAttribute("roles",roles);
            //数据回显
            model.addAttribute("employee",employee);
        } catch (Exception e) {
            e.printStackTrace();
        }
    return "system/employee/employeeInfo";
}

房客管理:

@RequestMapping("/list")
public String findCustomerList(Customer customer, @RequestParam("pageNum")Integer pageNum, Model model, HttpSession session){
    try {
        //设置分页的页数和每页数量
        PageHelper.startPage(pageNum,5);
        //查询条件
        //创建map集合
        Map<String,Object> map = new HashMap<String, Object>();
        map.put("name",customer.getName());
        map.put("sex",customer.getSex());
        map.put("phone",customer.getPhone());
        map.put("idNumber",customer.getIdNumber());
        List<Customer> list = customerService.findCustomerList(map);
        //添加一条模拟数据,(用来点击修改模态框的时候不为空)
        model.addAttribute("emp",new Customer(null,"sss","","18625893214","广白云区州市",new Date(),"542222199902145896","二代身份证","汉族",null,2));
        model.addAttribute("map",map);
        //model.addAttribute("list",list);
        //获取pageInfo对象
        PageInfo<Customer> pageInfo = new PageInfo<>(list);
        model.addAttribute("pageInfo",pageInfo);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return "system/tenantPage/tenantList";
}

修改个人密码:

@ResponseBody
@RequestMapping("/updatePassword")
public Map<String, Object> updatePassword(Integer empId, String newPassword, Model model, HttpSession session) {
    Map<String,Object> map = new HashMap<String, Object>();
    try {
        Employee employee = (Employee) session.getAttribute(ConstantValue.LOGIN_USER);
        if (employee != null) {
            employeeService.update(empId, newPassword);
            map.put("success", true);
        } else {
            map.put("success", false);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return map;
}

日志查看:

@RequestMapping("/toLogging")
public String toLogging(LoggingQueryVo loggingQueryVo,Integer pageNum,Model model) {
    //2019-07-10 22:38:10.0
     try {
        //设置当前页和每页数量
        PageHelper.startPage(pageNum,5);
        //设置查询条件
        List<Logging> loggingLists = loggingService.getAllLoggingLists(loggingQueryVo);
        //获取PageInfo对象,该对象封装的分页的相关信息
        PageInfo<Logging> pageInfo = new PageInfo<>(loggingLists);
        //查询分页
         model.addAttribute("pageInfo",pageInfo);
        //数据回显
        model.addAttribute("loggingQueryVo",loggingQueryVo);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return "room/logging/loggingInfo";
}

财务查看:

// 指定图表的配置项和数据
var option = {
    title: {
        text: '收入'
    },
    tooltip: {
        trigger: 'axis'
    },
    toolbox: {
        show: true,
        feature: {
            dataZoom: {
                yAxisIndex: 'none'
            }, //区域缩放,区域缩放还原
            dataView: {
                readOnly: false
            }, //数据视图
            magicType: {
                type: ['line', 'bar']
            },  //切换为折线图,切换为柱状图
            restore: {},  //还原
            saveAsImage: {}   //保存为图片
        }
    },

民宿系统运行视频

系统适用于课程设计或者毕业设计参考学习使用,如有需要,可联系博主详聊

### Intellij IDEA下酒店管理系统的实现教程 #### 开发环境准备 在开发基于Intellij IDEA的酒店管理系统之前,需先配置好开发环境。建议安装最新版本的IntelliJ IDEA社区版或Ultimate版[^5]。此外,还需下载并安装Java JDK(推荐使用JDK 8或更高版本),因为大多数酒店管理系统会依赖于Java SE平台。 完成IDEA和JDK的安装后,在IDEA中创建一个新的Maven项目,并设置项目的编码标准为UTF-8。通过引入必要的依赖项来支持Web框架(如Spring Boot)、前端框架(如Vue.js)以及数据库连接池(如HikariCP)。以下是典型的`pom.xml`文件中的部分依赖: ```xml <dependencies> <!-- Spring Boot Starter Web --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- MySQL Connector Java --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <!-- Thymeleaf Template Engine (optional, for server-side rendering) --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <!-- HikariCP Connection Pool --> <dependency> <groupId>com.zaxxer</groupId> <artifactId>HikariCP</artifactId> </dependency> </dependencies> ``` #### 功能模块设计 根据已有的参考资料[^2],一个完整的酒店管理系统应至少具备以下核心功能模块:用户管理、客房信息管理、客房类型管理、预订管理、入住登记、退房结算、账单处理等。这些功能可以通过前后端分离的方式实现,即后台采用Spring Boot构建RESTful API接口,前台利用Vue.js进行页面渲染与交互逻辑编写。 #### 数据库建模 对于数据库的设计,可以参考提供的SQL脚本路径下的`hotel_management.sql`文件[^5]。此脚本定义了多个表结构及其关系映射,例如`users`, `rooms`, `reservations`等等。确保按照实际需求调整字段属性及约束条件后再导入至MySQL或其他兼容的关系型数据库中。 #### 前台界面开发 如果选择Vue作为前端技术栈,则需要初始化一个Vue CLI项目并与后端API对接。下面是一个简单的登录页组件示例代码片段: ```vue <template> <div class="login-container"> <h1>Login to Hotel Management System</h1> <form @submit.prevent="handleLogin"> <label>Email:</label><br/> <input type="email" v-model="credentials.email"/><br/><br/> <label>Password:</label><br/> <input type="password" v-model="credentials.password"/><br/><br/> <button type="submit">Log In</button> </form> </div> </template> <script> export default { data() { return { credentials: { email:'', password:'' } }; }, methods:{ handleLogin(){ fetch('/api/auth/login', { method:'POST', headers:{ 'Content-Type':'application/json' }, body:JSON.stringify(this.credentials) }).then(response => response.json()) .then(data => console.log('Success:',data)) .catch(error=>console.error('Error:',error)); } } } </script> ``` 以上代码展示了如何通过Fetch API向服务器发送认证请求[^3]。 #### 后端服务搭建 后端主要负责业务逻辑处理和数据持久化存储工作。以Spring Boot为例,可通过注解方式快速定义控制器层方法响应HTTP请求。比如针对用户的增删改查操作可如下所示: ```java @RestController @RequestMapping("/api/users") public class UserController { private final UserService userService; public UserController(UserService userService){ this.userService=userService; } @GetMapping("") public List<UserDto> getAllUsers(){ return userService.findAll(); } @PostMapping("") public ResponseEntity<?> createUser(@RequestBody UserCreateRequest request){ try{ Long id=service.save(request); return new ResponseEntity<>(id.toString(), HttpStatus.CREATED); } catch(Exception e){ return new ResponseEntity<>("Failed",HttpStatus.INTERNAL_SERVER_ERROR); } } ... } ``` 这里运用到了分层架构模式,将具体的数据访问细节封装进独立的服务类里[^4]。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

等天晴i

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值