小秦哥 发表于 2023-5-8 11:21:11

30基于java的酒店管理系统设计与实现

本章节给给大家介绍一个简单的基于java的酒店管理系统设计与实现。
系统概要

以往的酒店管理系统相关信息管理,都是工作人员手工统计。这种方式不但时效性低,而且需要查找和变更的时候很不方便。随着科学的进步,技术的成熟,计算机信息化也日新月异的发展,如今计算机已经进入了人类社会发展的各个领域,并且发挥着十分重要的作用。本系统充分利用网络的便捷,在工作效率上,得到极大地提高,延伸至服务水平也会有好的收获,有了网络,酒店管理系统的各方面的管理更加科学和系统,更加规范和简便。为用户提供酒店管理系统,方便管理员及时高效的管理所有的信息,给用户提供简单方便快捷的方式,并且数据准确,用户可以足不出户就可以对酒店管理系统相关信息进行查询等操作,而且还能节省用户查询信息的等待时间,所以开发酒店管理系统给工作人员带来很大的方便,可以大大的提高系统人员工作效率。
主要实现的功能有:
住客管理
房间管理
会员管理
系统设置
数据导出
等等
系统使用的架构

采用B/S的架构实现,整体遵循MVC的设计思想。
> 后端:java,spring,springmvc,mybatis,tomcat等
> 数据库:mysql
> 开发工具:idea或者eclipse
> 前端:jsp,html,css,javascript,jquery,layui等
> 更多详细内容可查看:http://projecthelp.top项目实现


[*]HomeController实现
@Controller
@RequestMapping("/home")

public class HomeController {
    @Autowired
    HomeServiceImpl homeService;

    // 定义文件保存的本地路径,用户需要自己修改这个文件上传的路径
    private String uploadPath = "E:\\ebm\\Hotel_Manage";

    @RequestMapping("/add")
    public String add(Home home, Model model) throws IOException{

      String sqlPath = null;
      //定义文件保存的本地路径
      String localPath=uploadPath;
      //定义 文件名
      String filename=null;
      if(!home.getFile().isEmpty()){
            //生成uuid作为文件名称
            String uuid = UUID.randomUUID().toString().replaceAll("-","");
            //获得文件类型(可以判断如果不是图片,禁止上传)
            String contentType=home.getFile().getContentType();
            //获得文件后缀名
            String suffixName=contentType.substring(contentType.indexOf("/")+1);
            //得到 文件名
            filename=uuid+"."+suffixName;
            System.out.println(filename);
            //文件保存路径
            home.getFile().transferTo(new File(localPath+filename));
      }
      //把图片的相对路径保存至数据库
      sqlPath = "/upload/"+filename;
      System.out.println(sqlPath);
      home.setImg(sqlPath);

      homeService.addHome(home);
      model.addAttribute("home",home);
      return "home_show";
    }

    @RequestMapping("/delete")
    public String delete(Integerid){
      homeService.deleteHomeById(id);
      return "redirect:/home/list";
    }

    @RequestMapping("/list")
    public ModelAndView list(){
      ModelAndView mv = new ModelAndView();
      List<Home> homeList=homeService.queryAllHome();
      mv.addObject("list",homeList);
      mv.setViewName("home_list");
      return mv;
    }

    @RequestMapping("/update1")
    public ModelAndView update1(Integerid){
      ModelAndView mv = new ModelAndView();
      Home home = homeService.queryHomeById(id);
      mv.addObject("h",home);
      mv.setViewName("home_update");
      return mv;
    }

    @RequestMapping("/update2")
    public String update2(Home h)throws IOException{
      String sqlPath = null;
      //定义文件保存的本地路径
      String localPath=uploadPath;
      //定义 文件名
      String filename=null;
      if(!h.getFile().isEmpty()){
            //生成uuid作为文件名称
            String uuid = UUID.randomUUID().toString().replaceAll("-","");
            //获得文件类型(可以判断如果不是图片,禁止上传)
            String contentType=h.getFile().getContentType();
            //获得文件后缀名
            String suffixName=contentType.substring(contentType.indexOf("/")+1);
            //得到 文件名
            filename=uuid+"."+suffixName;
            System.out.println(filename);
            //文件保存路径
            h.getFile().transferTo(new File(localPath+filename));
      }
      //把图片的相对路径保存至数据库
      sqlPath = "/upload/"+filename;
      System.out.println(sqlPath);
      h.setImg(sqlPath);

      homeService.updateHomeById(h);
      return ("redirect:/home/list");
    }

    @RequestMapping("/show")
    public ModelAndView show(Integerid){
      ModelAndView mv = new ModelAndView();
      Home home=homeService.queryHomeById(id);
      mv.addObject("home",home);
      mv.setViewName("home_show");
      return mv;
    }

    @RequestMapping("/find")
    public ModelAndView find(int findByNum ){
      ModelAndView mv = new ModelAndView();
      Home home = homeService.queryHomeByNum(findByNum);
      List<Home> homeList=new ArrayList<Home>();
      homeList.add(home);
      if (home==null){
            homeList=homeService.queryAllHome();
            mv.addObject("error","未查询出结果");
      }
      mv.addObject("list",homeList);
      mv.setViewName("home_list");
      return mv;
    }
}

[*]登录页面实现
<html lang="zh">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>后台管理登陆</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/common/layui/css/layui.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/admin/css/login.css">
   
</head>

<body id="login">


    <h2> <strong><font face="仿宋" >xxx酒店后台登陆</font></strong></h2>

    <formmethod="post" target="_blank" action="${pageContext.request.contextPath}/admin/login" >

      
            <input type="text" name="username"id="username" placeholder="用户名"required>
            <i ></i>
      

      
            <input type="password" name="password" id="password" placeholder="密码"   required>
            <i ></i>
      

      
            <button   lay-submit lay-filter="login" >立即登录</button>
      
      <br>
      
            <p >ps:如忘记密码,请尽快联系管理人员更正密码</p>
      
    </form>


</body>
</html>部分功能展示

登录页面展示

https://img-blog.csdnimg.cn/dc87b8692e36420a94a4eac269cdf4c1.png
管理页面首页

https://img-blog.csdnimg.cn/50d72452ec0a40c891c579d030c507bd.png
住客管理

添加住客

https://img-blog.csdnimg.cn/f3fe91cc10c94a98a01baf0a79e9ab5c.png
住客列表统计

在客房类型管理页面可以查看客房类型等信息,并可根据需要进行删除,修改等操作
https://img-blog.csdnimg.cn/efaa55b8cdc84301b0d30b0217b54e95.png
房间管理

https://img-blog.csdnimg.cn/2c1b8e259d3041859f7cd31afb11e796.png
会员管理

新增会员

https://img-blog.csdnimg.cn/de18b61fcf89499abd83433ac8df5172.png
会员列表

https://img-blog.csdnimg.cn/f04cc0c141d84ee99c6c397f2396fb36.png
系统设置

https://img-blog.csdnimg.cn/923ae24ad02a4901972dfec2c89b2050.png
数据导出

https://img-blog.csdnimg.cn/40bfa59ff08347dfbe8f32ef0f92b10a.png
https://img-blog.csdnimg.cn/b56bdfe454c94ad29bd691292c5d66a0.png
以上是大部分功能展示,所有的功能都是正常运行,没有bug,导入到idea或者eclipse即可运行,没有套路,具体细节大家下载后自己慢慢研究,欢迎大家一起交流学习

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
页: [1]
查看完整版本: 30基于java的酒店管理系统设计与实现