JAVA-MYSQL-SSH酒店民宿客房管理系统

16 篇文章 0 订阅
14 篇文章 1 订阅

基于SSH的2022精修版,修复了大量bug,

核心功能:用户管理,日志管理,人员权限管理,客房预订管理,预定转入住,客房管理,卫生管理,物品采购,商品管理,建议管理,换房管理,客房类型管理,文件上传下载,自定义文件目录。

开发环境:mysql5.7,tomcat9,jdk8,eclipse,(MyEclipse或者IDEA也可以)

框架技术:Struts2 + Spring + Hibernate

上传文件的目录可以设置,独立于项目之外,这样每次部署以及迁移的时候就不会受到影响。

运行截图

管理员首页

用户管理

日志管理

客服预定管理

工作人员权限分配

客房管理

卫生管理

物品采购

商品管理

换房管理

客房类型管理

源码分享:

ItemCatAction

package com.hotel.action;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.hotel.model.Item_cat;
import com.hotel.model.Room_cat;
import com.hotel.service.ItemCatService;
import com.hotel.service.LogService;
import com.hotel.utils.Pager;
import com.hotel.utils.UUIDUtils;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

@Controller("itemCatAction")
@Scope("prototype")
public class ItemCatAction extends ActionSupport implements ModelDriven<Item_cat>{
   private Item_cat item_cat;
   private int itemCatId;

   @Autowired
   private LogService logService;
   
    public int getItemCatId() {
	return itemCatId;
}

	public void setItemCatId(int itemCatId) {
		this.itemCatId = itemCatId;
	}

	//========================图片上传
    private File file;
    
    //提交过来的file的名字
    private String fileFileName;
    
    //提交过来的file的MIME类型
    private String fileContentType;
    

    
    public File getFile() {
        return file;
    }
    public void setFile(File file) {
        this.file = file;
    }
    public String getFileFileName() {
        return fileFileName;
    }
    public void setFileFileName(String fileFileName) {
        this.fileFileName = fileFileName;
    }
    public String getFileContentType() {
        return fileContentType;
    }
    public void setFileContentType(String fileContentType) {
        this.fileContentType = fileContentType;
    }
    //========================图片上传

	@Override
	public Item_cat getModel() {
		if(item_cat==null) item_cat = new Item_cat();
		return item_cat;
	}
	@Autowired
	private ItemCatService itemCatService;
	
	/**
     * 获取类别信息列表
     * @return
     */
    public String itemCatList(){
      Pager<Item_cat> pagers = itemCatService.listAll();
    ActionContext.getContext().put("pagers", pagers);
    return SUCCESS;
    }
	
    /**
     * 删除商品类别信息
     * @return
     */
    public String delItemCat(){
    	itemCatService.delItemCat(itemCatId);
        ActionContext.getContext().put("url", "/itemCat_itemCatList.do");
        return "redirect";
    }
    
    /**
     * 新增商品类别页面
     * @Description (TODO这里用一句话描述这个方法的作用)
     * @return
     */
    public String addItemCat() {
        return "success";
    }
    
    public String itemCatAdd() throws Exception{
        //图片上传
        String root  = "D:/my/upload";
        InputStream is = new FileInputStream(file);
        fileFileName = UUIDUtils.create()+fileFileName;
        OutputStream os = new FileOutputStream(new File(root, fileFileName));
        System.out.println("fileFileName: " + fileFileName);
        System.out.println("file: " + file.getName());
        System.out.println("file: " + file.getPath());
        byte[] buffer = new byte[500];
        int length = 0;
        while(-1 != (length = is.read(buffer, 0, buffer.length)))
        {
            os.write(buffer);
        }
        os.close();
        is.close();
        item_cat.setImage("\\upload\\"+fileFileName);
        itemCatService.add(item_cat);
        String content="新增商品类型";
        HttpSession session =ServletActionContext.getRequest().getSession();
        int userId = Integer.parseInt( session.getAttribute("userId").toString());
        //插入日志
        logService.addLog(content,userId);
        ActionContext.getContext().put("url", "/itemCat_itemCatList.do");
      return "redirect";
     }
    
    /**
     * 初始化修改页面
     * @Description (TODO这里用一句话描述这个方法的作用)
     * @return
     */
    public String updateItemCat(){
    	Item_cat item_cat =itemCatService.itemCatDetail(itemCatId);
        ActionContext.getContext().put("item_cat", item_cat);
         return "success";
     }
    
    /**
     * 修改商品类别
     * @Description (TODO这里用一句话描述这个方法的作用)
     * @return
     * @throws Exception 
     */
    public String ItemCatUpdate() throws Exception{
        if(file!=null){
            //图片上传
          String root  = "D:/my/upload";
          InputStream is = new FileInputStream(file);
          fileFileName = UUIDUtils.create()+fileFileName;
          OutputStream os = new FileOutputStream(new File(root, fileFileName));
          System.out.println("fileFileName: " + fileFileName);
          System.out.println("file: " + file.getName());
          System.out.println("file: " + file.getPath());
          byte[] buffer = new byte[500];
          int length = 0;
          while(-1 != (length = is.read(buffer, 0, buffer.length)))
          {
              os.write(buffer);
          }
          os.close();
          is.close();
          item_cat.setImage("\\upload\\"+fileFileName);
          }else{
              Item_cat  i =itemCatService.itemCatDetail(item_cat.getCid());
              item_cat.setImage(i.getImage());
          }
          itemCatService.update(item_cat);
          String content="修改商品类型";
          HttpSession session =ServletActionContext.getRequest().getSession();
          int userId = Integer.parseInt( session.getAttribute("userId").toString());
          //插入日志
          logService.addLog(content,userId);
          ActionContext.getContext().put("url", "/itemCat_itemCatList.do");
          return "redirect";
     }
}

ManageAction

package com.hotel.action;

import java.lang.reflect.InvocationTargetException;
import java.util.Date;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.hotel.model.Manage;
import com.hotel.model.Suggest;
import com.hotel.model.User;
import com.hotel.service.LogService;
import com.hotel.service.ManageService;
import com.hotel.service.SuggestService;
import com.hotel.service.UserService;
import com.hotel.utils.Pager;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

@Controller("manageAction")
@Scope("prototype")
public class ManageAction extends ActionSupport implements ModelDriven<Manage>{

   private Manage manage;
   private int userId;
   private int manageId;
    public int getUserId() {
        return userId;
    }
    
    public void setUserId(int userId) {
        this.userId = userId;
    }

    public int getManageId() {
        return manageId;
    }

    
    public void setManageId(int manageId) {
        this.manageId = manageId;
    }

    @Override
	public Manage getModel() {
		if(manage==null) manage = new Manage();
		return manage;
	}
	
	@Autowired
	private ManageService manageService;
	
	@Autowired
	private UserService  userService;
	
	@Autowired
	private LogService logService;
	/**
	 * 登陆以后进入首页
	 * @return
	 */
	public String index(){
		Manage ma =	manageService.login(manage);
		if(ma == null){
			return "login";
		}
		HttpSession session =ServletActionContext.getRequest().getSession();
		session.setAttribute("userName", ma.getName());
		session.setAttribute("userId", ma.getId());
		session.setAttribute("type1", ma.getType());
	    return SUCCESS;  //返回成功后默认为你提交需要跳转的方法中去
	}
	
	
	/**    
     * 获取用户列表
     * @return
     */
    public String userList(){
      Pager<User> pagers = userService.listAll();
    ActionContext.getContext().put("pagers", pagers);
    return SUCCESS;
    }
	
    /**
     * 删除用户
     * @return
     */
    public String delUser(){
        userService.delUse(userId);
        String content="删除用户";
        HttpSession session =ServletActionContext.getRequest().getSession();
        int userId = Integer.parseInt( session.getAttribute("userId").toString());
        //插入日志
        logService.addLog(content,userId);
        ActionContext.getContext().put("url", "/manage_userList.do");
        return "redirect";
    }
    
    /**
     * 用户详情
     * @return
     */
    public String userDetail(){
        User user =userService.userDetail(userId);
        ActionContext.getContext().put("user", user);
        return SUCCESS;
    }
    
    /**
     * 获取权限管理员列表
     * @return
     */
    public String authList(){
      Pager<Manage> pagers = manageService.listAll();
    ActionContext.getContext().put("pagers", pagers);
    return SUCCESS;
    }
    
    /**
     * 删除管理员
     * @return
     */
    public String delManage(){
        manageService.delManage(manageId);
        String content="删除管理员";
        HttpSession session =ServletActionContext.getRequest().getSession();
        int userId = Integer.parseInt( session.getAttribute("userId").toString());
        //插入日志
        logService.addLog(content,userId);
        ActionContext.getContext().put("url", "/manage_authList.do");
        return "redirect";
    }
    
    /**
     * 管理员详情
     * @return
     */
    public String authDetail(){
        Manage manage =manageService.manageDetail(manageId);
        ActionContext.getContext().put("manage", manage);
        return SUCCESS;
    }
    
    /**
     * 管理员新增页面
     * @Description (TODO这里用一句话描述这个方法的作用)
     * @return
     */
    public String addAuth() {
        return "success";
    }
    
    
    /**
     * 新增管理员
     * @Description (TODO这里用一句话描述这个方法的作用)
     * @return
     */
    public String addManage(){
       manage.setCreateTime(new Date());
       manage.setIsDelete(2);
        manageService.add(manage);
        String content="新增管理员";
        HttpSession session =ServletActionContext.getRequest().getSession();
        int userId = Integer.parseInt( session.getAttribute("userId").toString());
        //插入日志
        logService.addLog(content,userId);
        ActionContext.getContext().put("url", "/manage_authList.do");
        return "redirect";
    }
    
    /**
     * 初始化修改页面
     * @Description (TODO这里用一句话描述这个方法的作用)
     * @return
     */
    public String updateManage(){
        Manage manage =manageService.manageDetail(manageId);
        ActionContext.getContext().put("manage", manage);
         return "success";
     }
    
    /**
     * 修改管理员
     * @Description (TODO这里用一句话描述这个方法的作用)
     * @return
     */
    public String updateAuth(){
        manageService.update(manage);
        String content="修改管理员";
        HttpSession session =ServletActionContext.getRequest().getSession();
        int userId = Integer.parseInt( session.getAttribute("userId").toString());
        //插入日志
        logService.addLog(content,userId);
        ActionContext.getContext().put("url", "/manage_authList.do");
        return "redirect";
     }
    
    

    @Autowired
    private SuggestService suggestService;
     /**
     * 获取建议信息列表
     * @return
     */
    public String suggestList() {
      Pager<Suggest> pagers = suggestService.listAll();
      ActionContext.getContext().put("pagers", pagers);
    return SUCCESS;
    }
}

RoomCatAction

package com.hotel.action;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.hotel.model.Room_cat;
import com.hotel.service.LogService;
import com.hotel.service.RoomCatService;
import com.hotel.utils.Pager;
import com.hotel.utils.UUIDUtils;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

@Controller("roomCatAction")
@Scope("prototype")
public class RoomCatAction extends ActionSupport implements ModelDriven<Room_cat>{
   private Room_cat room_cat;
   private String rName2;
   private int roomCatId;

    
public String getrName2() {
    return rName2;
}

public void setrName2(String rName2) {
    this.rName2 = rName2;
}
    @Override
	public Room_cat getModel() {
		if(room_cat==null) room_cat = new Room_cat();
		return room_cat;
	}
	
	@Autowired
	private RoomCatService roomCatService;
	
	@Autowired
	private LogService logService;
	//========================图片上传
    private File file;
    
    //提交过来的file的名字
    private String fileFileName;
    
    //提交过来的file的MIME类型
    private String fileContentType;

    
    public File getFile() {
        return file;
    }
    public void setFile(File file) {
        this.file = file;
    }
    public String getFileFileName() {
        return fileFileName;
    }
    public void setFileFileName(String fileFileName) {
        this.fileFileName = fileFileName;
    }
    public String getFileContentType() {
        return fileContentType;
    }
    public void setFileContentType(String fileContentType) {
        this.fileContentType = fileContentType;
    }
    //========================图片上传

    
    public int getRoomCatId() {
        return roomCatId;
    }
    
    public void setRoomCatId(int roomCatId) {
        this.roomCatId = roomCatId;
    }
    
	/**
     * 获取客房类型信息列表
     * @return
     */
    public String roomCatList(){
      Pager<Room_cat> pagers = roomCatService.listAll();
    ActionContext.getContext().put("pagers", pagers);
    return SUCCESS;
    }
    
  
    /**
     * 初始化客房类型新增页面
     * @return
     */
    public String addRoomCat(){
       return SUCCESS;
    }
    
    /**
     * 新增类型
     * @return
     */
    public String roomAddCat()throws Exception{
        //图片上传
        String root  = "D:/my/upload";
        InputStream is = new FileInputStream(file);
        fileFileName = UUIDUtils.create()+fileFileName;
        OutputStream os = new FileOutputStream(new File(root, fileFileName));
        System.out.println("fileFileName: " + fileFileName);
        System.out.println("file: " + file.getName());
        System.out.println("file: " + file.getPath());
        byte[] buffer = new byte[500];
        int length = 0;
        while(-1 != (length = is.read(buffer, 0, buffer.length)))
        {
            os.write(buffer);
        }
        os.close();
        is.close();
        room_cat.setImage("\\upload\\"+fileFileName);
        roomCatService.add(room_cat);
        String content="新增客房类型";
        HttpSession session =ServletActionContext.getRequest().getSession();
        int userId = Integer.parseInt( session.getAttribute("userId").toString());
        //插入日志
        logService.addLog(content,userId);
      ActionContext.getContext().put("url", "/roomCat_roomCatList.do");
      return "redirect";
    }
    
    /**
     * 初始化修改页面
     * @Description (TODO这里用一句话描述这个方法的作用)
     * @return
     */
    public String updateRoomCat(){
        Room_cat  room_cat =roomCatService.roomCatDetail(roomCatId);
        ActionContext.getContext().put("room_cat", room_cat);
         return "success";
     }
    
    /**
     * 修改客房类别
     * @return
     */
    public String roomCatUpdate()throws Exception{
        if(file!=null){
          //图片上传
        String root  = "D:/my/upload";
        InputStream is = new FileInputStream(file);
        fileFileName = UUIDUtils.create()+fileFileName;
        OutputStream os = new FileOutputStream(new File(root, fileFileName));
        System.out.println("fileFileName: " + fileFileName);
        System.out.println("file: " + file.getName());
        System.out.println("file: " + file.getPath());
        byte[] buffer = new byte[500];
        int length = 0;
        while(-1 != (length = is.read(buffer, 0, buffer.length)))
        {
            os.write(buffer);
        }
        os.close();
        is.close();
        room_cat.setImage("\\upload\\"+fileFileName);
        }else{
            Room_cat  r =roomCatService.roomCatDetail(room_cat.getId());
            room_cat.setImage(r.getImage());
        }
        roomCatService.update(room_cat);
        String content="修改客房类型";
        HttpSession session =ServletActionContext.getRequest().getSession();
        int userId = Integer.parseInt( session.getAttribute("userId").toString());
        //插入日志
        logService.addLog(content,userId);
        ActionContext.getContext().put("url", "/roomCat_roomCatList.do");
      return "redirect";
    }
    
}

 完整源码 :JAVA-MYSQL-SSH酒店客房管理系统毕业设计全套源码-Java文档类资源-CSDN下载基于SSH的毕业设计全套源码,2022精修版,修复了大量bug,用户管理,日志管理,人员权限管理更多下载资源、学习资料请访问CSDN下载频道.https://download.csdn.net/download/xia15000506007/85122484

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
酒店管理系统使用说明书 主要功能 本系统中包含如下6大功能模块: q 前台服务:该模块主要包括开台点菜、维护菜品、签单、结账等功能,其中维护菜品功能包括添加和取消菜品,能够取消菜品的前提条件是尚未签单,即处于开单状态,结账时则要求所有商品都要签单,否则不允许结账。 q 后台管理:该模块主要包括台号管理、菜系管理和菜品管理功能,其中菜系用来对菜品进行分类。 q 销售统计:该模块用来分段统计营业额,可以按日、月和年进行统计,其中日统计是按消费单和销售的商品统计销售额,月统计是按日期和每日的销售额统计销售额,年统计是按日期和月份统计销售额。 q 系统安全:该模块主要包括交接班、锁定系统和修改密码功能,其中交接班功能在操作员换岗时使用,锁定系统在操作员临时离开时使用。 q 人员管理:该模块主要包括档案管理、管理员管理和操作权限管理功能,其中管理员管理功能用来管理系统的操作员,权限管理功能用来管理系统操作员具有的操作权限。 q 初始化系统:该功能用来对系统进行初始化,初始化后系统数据将全部被删除。 操作注意事项 用户在使用《酒店管理系统》之前,应注意以下事项: (1)管理员用户名和密码为:mr、mrsoft。 (2)当鼠标经过主界面右下角时,会弹出菜单,在这里可

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

编程大玩家

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

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

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

打赏作者

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

抵扣说明:

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

余额充值