酒店管理系统的设计与实现 (含源码+sql+视频导入教程+文档+PPT)

👉文末查看项目功能视频演示+获取源码+sql脚本+视频导入教程视频

1 、功能描述

  酒店管理系统7实现了管理员对房间、房子类型、房间预定、入住消费、餐饮的增删改查功能,具体如下:
项目功能图

1.1 背景描述

  酒店管理系统是一种专门设计用于帮助酒店管理日常运营的软件系统。该系统通常包括预订管理、客房分配、客户信息管理、账单结算、库存管理和员工排班等功能。通过酒店管理系统,员工可以轻松地处理客人的预订请求,检查客房可用性,并实时更新客房状态。此外,系统还能够跟踪客户信息和偏好,从而提供更个性化的服务。对于酒店财务管理方面,系统也能够有效地管理账单和支付流程,最大限度地减少错误和延误。库存管理功能有助于确保酒店的各种物品充足,并在需要时及时补充。最后,酒店管理系统还能协助管理员工排班和考勤,以确保酒店的各项工作都能有条不紊地进行。这些功能共同帮助酒店提高效率、优化客户体验,并实现良好的经营管理。

2、项目技术

后端框架: Servlet、mvc模式

前端技术:jsp、css、JavaScript、JQuery

2.1 MVC

  MVC(Model-View-Controller)框架是一种用于构建Web应用程序的软件架构模式。它将应用程序分为三个核心部分:模型(Model)、视图(View)和控制器(Controller)。模型负责处理数据逻辑,包括数据库交互、数据处理和业务规则。视图负责用户界面的呈现,将数据以易于理解的形式展示给用户。控制器充当中间人,接收用户输入并调用相应的模型和视图来完成用户请求。MVC框架使代码分离,提高了应用程序的可维护性和扩展性。开发人员可以独立地修改模型、视图或控制器,而不会影响其他部分。这种分离也有助于多人合作开发项目。MVC框架还促进了前后端的分离,使前端工程师和后端工程师能够更好地协同工作,从而提高了开发效率。

2.2 mysql

  MySQL是一款Relational Database Management System,直译过来的意思就是关系型数据库管理系统,MySQL有着它独特的特点,这些特点使他成为目前最流行的RDBMS之一,MySQL想比与其他数据库如ORACLE、DB2等,它属于一款体积小、速度快的数据库,重点是它符合本次毕业设计的真实租赁环境,拥有成本低,开发源码这些特点,这也是选择它的主要原因。

3、开发环境

  • JAVA版本:JDK1.8
  • IDE类型:IDEA、Eclipse都可运行
  • tomcat版本:Tomcat 7-10版本均可
  • 数据库类型:MySql(5.x和8.x版本都可)
  • maven项目:否
  • 硬件环境:Windows 或者 Mac OS

4、功能截图+视频演示+文档目录

4.1 登录

登录

4.2 其他模块

管理员信息修改

客房类型管理

客房信息管理

客房预定

客户管理

入住消费

餐饮管理

消费管理

4.3 文档目录

文档目录

5 、核心代码实现

5.1 客户订房代码

package com.action;

import com.orm.kehu;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class kehu_servlet extends HttpServlet {

   public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
      String type = req.getParameter("type");
      if(type.endsWith("kehuAdd")) {
         this.kehuAdd(req, res);
      }

      if(type.endsWith("kehuMana")) {
         this.kehuMana(req, res);
      }

      if(type.endsWith("kehuDel")) {
         this.kehuDel(req, res);
      }

      if(type.endsWith("kehuEdit")) {
         this.kehuEdit(req, res);
      }

      if(type.endsWith("kehuSearch")) {
         this.kehuSearch(req, res);
      }

      if(type.endsWith("kehuXinxi")) {
         this.kehuXinxi(req, res);
      }

   }

   public void kehuAdd(HttpServletRequest req, HttpServletResponse res) {
      String mingcheng = req.getParameter("mingcheng");
      String dizhi = req.getParameter("dizhi");
      String lianxiren = req.getParameter("lianxiren");
      String dianhua = req.getParameter("dianhua");
      String youbian = req.getParameter("youbian");
      String chuanzhen = req.getParameter("chuanzhen");
      String youxiang = req.getParameter("youxiang");
      String sql = "insert into t_kehu(mingcheng,dizhi,lianxiren,dianhua,youbian,chuanzhen,youxiang,kahuhang,zhanghao,type,del) values(?,?,?,?,?,?,?,?,?,?,?)";
      Object[] params = new Object[]{mingcheng, dizhi, lianxiren, dianhua, youbian, chuanzhen, youxiang, "", "", "kehu", "no"};
      DB mydb = new DB();
      mydb.doPstm(sql, params);
      mydb.closed();
      req.setAttribute("message", "操作成功");
      req.setAttribute("path", "kehu?type=kehuMana");
      String targetURL = "/common/success.jsp";
      this.dispatch(targetURL, req, res);
   }

   public void kehuDel(HttpServletRequest req, HttpServletResponse res) {
      int id = Integer.parseInt(req.getParameter("id"));
      String sql = "update t_kehu set del=\'yes\' where id=?";
      Object[] params = new Object[]{Integer.valueOf(id)};
      DB mydb = new DB();
      mydb.doPstm(sql, params);
      mydb.closed();
      req.setAttribute("message", "操作成功");
      req.setAttribute("path", "kehu?type=kehuMana");
      String targetURL = "/common/success.jsp";
      this.dispatch(targetURL, req, res);
   }

   public void kehuMana(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
      ArrayList kehuList = new ArrayList();
      String sql = "select * from t_kehu where type=\'kehu\' and del=\'no\'";
      Object[] params = new Object[0];
      DB mydb = new DB();

      try {
         mydb.doPstm(sql, params);
         ResultSet e = mydb.getRs();

         while(e.next()) {
            kehu kehu = new kehu();
            kehu.setId(e.getInt("id"));
            kehu.setMingcheng(e.getString("mingcheng"));
            kehu.setDizhi(e.getString("dizhi"));
            kehu.setLianxiren(e.getString("lianxiren"));
            kehu.setDianhua(e.getString("dianhua"));
            kehu.setYoubian(e.getString("youbian"));
            kehu.setChuanzhen(e.getString("chuanzhen"));
            kehu.setYouxiang(e.getString("youxiang"));
            kehuList.add(kehu);
         }

         e.close();
      } catch (Exception var9) {
         var9.printStackTrace();
      }

      mydb.closed();
      req.setAttribute("kehuList", kehuList);
      req.getRequestDispatcher("admin/kehu/kehuMana.jsp").forward(req, res);
   }

   public void kehuXinxi(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
      ArrayList kehuList = new ArrayList();
      String sql = "select * from t_kehu where type=\'kehu\' and id=?";
      Object[] params = new Object[]{Integer.valueOf(Integer.parseInt(req.getParameter("kehu_id")))};
      DB mydb = new DB();

      try {
         mydb.doPstm(sql, params);
         ResultSet e = mydb.getRs();

         while(e.next()) {
            kehu kehu = new kehu();
            kehu.setId(e.getInt("id"));
            kehu.setMingcheng(e.getString("mingcheng"));
            kehu.setDizhi(e.getString("dizhi"));
            kehu.setLianxiren(e.getString("lianxiren"));
            kehu.setDianhua(e.getString("dianhua"));
            kehu.setYoubian(e.getString("youbian"));
            kehu.setChuanzhen(e.getString("chuanzhen"));
            kehu.setYouxiang(e.getString("youxiang"));
            kehuList.add(kehu);
         }

         e.close();
      } catch (Exception var9) {
         var9.printStackTrace();
      }

      mydb.closed();
      req.setAttribute("kehuList", kehuList);
      req.getRequestDispatcher("admin/kehu/kehuXinxi.jsp").forward(req, res);
   }

   public void kehuEdit(HttpServletRequest req, HttpServletResponse res) {
      int id = Integer.parseInt(req.getParameter("id"));
      String mingcheng = req.getParameter("mingcheng");
      String dizhi = req.getParameter("dizhi");
      String lianxiren = req.getParameter("lianxiren");
      String dianhua = req.getParameter("dianhua");
      String youbian = req.getParameter("youbian");
      String chuanzhen = req.getParameter("chuanzhen");
      String youxiang = req.getParameter("youxiang");
      String sql = "update t_kehu set mingcheng=?,dizhi=?,lianxiren=?,dianhua=?,youbian=?,chuanzhen=?,youxiang=? where id=" + id;
      Object[] params = new Object[]{mingcheng, dizhi, lianxiren, dianhua, youbian, chuanzhen, youxiang};
      DB mydb = new DB();
      mydb.doPstm(sql, params);
      mydb.closed();
      req.setAttribute("message", "操作成功");
      req.setAttribute("path", "kehu?type=kehuMana");
      String targetURL = "/common/success.jsp";
      this.dispatch(targetURL, req, res);
   }

   public void kehuSearch(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
      ArrayList kehuList = new ArrayList();
      String sql = "select * from t_kehu where type=\'kehu\' and del=\'no\' and mingcheng like \'%" + req.getParameter("mingcheng").trim() + "%\'";
      System.out.println(sql);
      Object[] params = new Object[0];
      DB mydb = new DB();

      try {
         mydb.doPstm(sql, params);
         ResultSet e = mydb.getRs();

         while(e.next()) {
            kehu kehu = new kehu();
            kehu.setId(e.getInt("id"));
            kehu.setMingcheng(e.getString("mingcheng"));
            kehu.setDizhi(e.getString("dizhi"));
            kehu.setLianxiren(e.getString("lianxiren"));
            kehu.setDianhua(e.getString("dianhua"));
            kehu.setYoubian(e.getString("youbian"));
            kehu.setChuanzhen(e.getString("chuanzhen"));
            kehu.setYouxiang(e.getString("youxiang"));
            kehuList.add(kehu);
         }

         e.close();
      } catch (Exception var9) {
         var9.printStackTrace();
      }

      mydb.closed();
      req.setAttribute("kehuList", kehuList);
      req.getRequestDispatcher("admin/kehu/kehuMana.jsp").forward(req, res);
   }

   public void dispatch(String targetURI, HttpServletRequest request, HttpServletResponse response) {
      RequestDispatcher dispatch = this.getServletContext().getRequestDispatcher(targetURI);

      try {
         dispatch.forward(request, response);
         return;
      } catch (ServletException var6) {
         var6.printStackTrace();
      } catch (IOException var7) {
         var7.printStackTrace();
      }

   }

   public void init(ServletConfig config) throws ServletException {
      super.init(config);
   }

   public void destroy() {}
}

5.2 其它核心代码

package com.action;

import com.orm.TAdmin;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class admin_servlet extends HttpServlet {

   public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
      String type = req.getParameter("type");
      if(type.endsWith("adminMana")) {
         this.adminMana(req, res);
      }

      if(type.endsWith("adminAdd")) {
         this.adminAdd(req, res);
      }

      if(type.endsWith("adminDel")) {
         this.adminDel(req, res);
      }

   }

   public void adminMana(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
      ArrayList adminList = new ArrayList();
      String sql = "select * from t_admin";
      Object[] params = new Object[0];
      DB mydb = new DB();

      try {
         mydb.doPstm(sql, params);
         ResultSet e = mydb.getRs();

         while(e.next()) {
            TAdmin admin = new TAdmin();
            admin.setUserId(e.getInt("userId"));
            admin.setUserName(e.getString("userName"));
            admin.setUserPw(e.getString("userPw"));
            adminList.add(admin);
         }

         e.close();
      } catch (Exception var9) {
         var9.printStackTrace();
      }

      mydb.closed();
      req.setAttribute("adminList", adminList);
      req.getRequestDispatcher("admin/admin/adminMana.jsp").forward(req, res);
   }

   public void adminAdd(HttpServletRequest req, HttpServletResponse res) {
      String userName = req.getParameter("userName");
      String userPw = req.getParameter("userPw");
      String sql = "insert into t_admin(userName,userPw) values(?,?)";
      Object[] params = new Object[]{userName, userPw};
      DB mydb = new DB();
      mydb.doPstm(sql, params);
      mydb.closed();
      req.setAttribute("message", "操作成功");
      req.setAttribute("path", "admin?type=adminMana");
      String targetURL = "/common/success.jsp";
      this.dispatch(targetURL, req, res);
   }

   public void adminDel(HttpServletRequest req, HttpServletResponse res) {
      System.out.println(req.getParameter("userId") + "**");
      String sql = "delete from t_admin where userId=" + Integer.parseInt(req.getParameter("userId"));
      Object[] params = new Object[0];
      DB mydb = new DB();
      mydb.doPstm(sql, params);
      mydb.closed();
      req.setAttribute("message", "操作成功");
      req.setAttribute("path", "admin?type=adminMana");
      String targetURL = "/common/success.jsp";
      this.dispatch(targetURL, req, res);
   }

   public void dispatch(String targetURI, HttpServletRequest request, HttpServletResponse response) {
      RequestDispatcher dispatch = this.getServletContext().getRequestDispatcher(targetURI);

      try {
         dispatch.forward(request, response);
         return;
      } catch (ServletException var6) {
         var6.printStackTrace();
      } catch (IOException var7) {
         var7.printStackTrace();
      }

   }

   public void init(ServletConfig config) throws ServletException {
      super.init(config);
   }

   public void destroy() {}
}

6 、功能视频演示

酒店管理系统1

7 、 获取方式

👇 大家点赞、收藏、关注、评论啦 👇🏻获取联系方式,后台回复关键词:酒店👇🏻

请添加图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值