基于web的酒店客房管理系统

news2024/9/22 1:18:30

目录

前言

 一、技术栈

二、系统功能介绍

用户信息管理

会员信息管理

客房信息管理

收藏客房管理

用户入住管理

客房清扫管理

三、核心代码

1、登录模块

 2、文件上传模块

3、代码封装


前言

随着信息技术在管理上越来越深入而广泛的应用,管理信息系统的实施在技术上已逐步成熟。本文介绍了酒店客房管理系统的开发全过程。通过分析酒店客房管理系统管理的不足,创建了一个计算机管理酒店客房管理系统的方案。文章介绍了酒店客房管理系统的系统分析部分,包括可行性分析等,系统设计部分主要介绍了系统功能设计和数据库设计。

本酒店客房管理系统有管理员,用户,会员,清洁人员。管理员功能有个人中心,用户管理,会员管理,清洁人员管理,客房信息管理,用户预约管理,会员预约管理,用户取消管理,会员取消管理,用户入住管理,会员入住管理,用户退房管理,会员退房管理,清扫房间管理,留言板管理,系统管理等。因而具有一定的实用性。

本站是一个B/S模式系统,后台采用Spring Boot框架,前台采用VUE框架,MYSQL数据库设计开发,充分保证系统的稳定性。系统具有界面清晰、操作简单,功能齐全的特点,使得酒店客房管理系统管理工作系统化、规范化。本系统的使用使管理人员从繁重的工作中解脱出来,实现无纸化办公,能够有效的提高酒店客房管理系统管理效率。

 一、技术栈

末尾获取源码
SpringBoot+Vue+JS+ jQuery+Ajax...

二、系统功能介绍

用户信息管理

酒店客房管理系统的系统管理员可以管理用户信息,可以对用户信息信息添加修改删除以及查询操作。

会员信息管理

系统管理员可以查看对会员信息信息进行添加,修改,删除以及查询操作。

 

客房信息管理

管理员可以对客房信息信息进行修改,删除以及查询操作。

收藏客房管理

用户登录后可以对客房信息进行收藏,预定。

 

用户入住管理

管理员可以对用户入住信息进行管理,可以添加,修改,删除以及清扫。

客房清扫管理

清洁人员登录可以对用户入住的客房进行清扫。

 

三、核心代码

1、登录模块

 
package com.controller;
 
 
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;
 
/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UserController{
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private TokenService tokenService;
 
	/**
	 * 登录
	 */
	@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}
	
	/**
	 * 注册
	 */
	@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }
 
	/**
	 * 退出
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
	
	/**
     * 列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UserEntity user){
        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
    	PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
        return R.ok().put("data", page);
    }
 
	/**
     * 列表
     */
    @RequestMapping("/list")
    public R list( UserEntity user){
       	EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
      	ew.allEq(MPUtil.allEQMapPre( user, "user")); 
        return R.ok().put("data", userService.selectListView(ew));
    }
 
    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
 
    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }
 
    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//全部更新
        return R.ok();
    }
 
    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

 2、文件上传模块

package com.controller;
 
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
 
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
 
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;
 
/**
 * 上传文件映射表
 */
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File path = new File(ResourceUtils.getURL("classpath:static").getPath());
		if(!path.exists()) {
		    path = new File("");
		}
		File upload = new File(path.getAbsolutePath(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}
	
	/**
	 * 下载文件
	 */
	@IgnoreAuth
	@RequestMapping("/download")
	public ResponseEntity<byte[]> download(@RequestParam String fileName) {
		try {
			File path = new File(ResourceUtils.getURL("classpath:static").getPath());
			if(!path.exists()) {
			    path = new File("");
			}
			File upload = new File(path.getAbsolutePath(),"/upload/");
			if(!upload.exists()) {
			    upload.mkdirs();
			}
			File file = new File(upload.getAbsolutePath()+"/"+fileName);
			if(file.exists()){
				/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
					getResponse().sendError(403);
				}*/
				HttpHeaders headers = new HttpHeaders();
			    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    
			    headers.setContentDispositionFormData("attachment", fileName);    
			    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

3、代码封装

package com.utils;
 
import java.util.HashMap;
import java.util.Map;
 
/**
 * 返回数据
 */
public class R extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	
	public R() {
		put("code", 0);
	}
	
	public static R error() {
		return error(500, "未知异常,请联系管理员");
	}
	
	public static R error(String msg) {
		return error(500, msg);
	}
	
	public static R error(int code, String msg) {
		R r = new R();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}
 
	public static R ok(String msg) {
		R r = new R();
		r.put("msg", msg);
		return r;
	}
	
	public static R ok(Map<String, Object> map) {
		R r = new R();
		r.putAll(map);
		return r;
	}
	
	public static R ok() {
		return new R();
	}
 
	public R put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1075546.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

数据结构———— 堆

(一)基础补充 满二叉树是每一层节点都放满的二叉树。 完全二叉树是只有最后一层节点右边不放满的二叉树。 满二叉树(Perfect Binary Tree) 如果二叉树中除了叶子结点,每个结点的度都为 2,则此二叉树称为满二叉树。另一种说法:一个深度为k(>=-1)且有2^(k+1) - 1个结…

拼多多商品链接获取拼多多商品详情数据(用 Python实现拼多多商品信息抓取)

在网页抓取方面&#xff0c;可以使用 Python、Java 等编程语言编写程序&#xff0c;通过模拟 HTTP 请求&#xff0c;获取拼多多网站上的商品页面。在数据提取方面&#xff0c;可以使用正则表达式、XPath 等方式从 HTML 代码中提取出有用的信息。值得注意的是&#xff0c;拼多多…

Bootstrap-初始

响应式布局&#xff1a; 一个网站可以兼容多个终端&#xff08;PC、移动端&#xff09; >框架使用的版本是根据公司的产品所面向的是什么样的客户来决定的&#xff01;&#xff01;&#xff01; 官网&#xff1a;Bootstrap

iMovie for Mac:专业级的视频剪辑体验!

如果你是一位视频爱好者&#xff0c;那么你一定不能错过iMovie for Mac这款专业视频剪辑工具。它不仅拥有简单易用的界面&#xff0c;而且功能强大&#xff0c;可以让你轻松完成复杂的视频剪辑任务。 一、界面友好&#xff0c;上手容易 iMovie for Mac的界面设计简洁明了&…

深度解析locked勒索病毒,勒索病毒解密,数据恢复

locked勒索病毒曾经消失了一段时间&#xff0c;但是从今年6月份以来&#xff0c;这种类型的勒索病毒又“重出江湖”&#xff0c;被感染的服务器和企业越来越多&#xff0c;这让很多企业和安全运维人员都非常头疼。为了减少这种情况的发生&#xff0c;云天数据恢复中心将对locke…

为什么说,网络安全工程师是网安行业的天花板?

为什么说&#xff0c;网络安全工程师是网安行业的天花板&#xff1f; 最近看到网上有很多人在问诸如&#xff1a;“怎样成为网络信息安全工程师”等相关问题&#xff0c;甚至还有人说“网络安全工程师已经成为这个行业的天花板”&#xff0c;这可能与近几年网络安全事件频发&a…

阿里云 腾讯云 配置二级域名并解析指向非80端口操作指南

目标&#xff1a;主域名 imps.com 已完成配置&#xff0c;新增配置 kpi.imps.com 等二级域名并指向 8083 端口。 &#xff08;此操作需要主域名已经通过备案3天后&#xff0c;最好指向的IP地址网站也通过了备案申请&#xff0c;否则会提示域名没有备案。&#xff09; 操作流程…

C++标准模板(STL)- 类型支持 (数值极限,is_exact,has_infinity,has_quiet_NaN)

数值极限 定义于头文件 <limits> template< class T > class numeric_limits; numeric_limits 类模板提供查询各种算术类型属性的标准化方式&#xff08;例如 int 类型的最大可能值是 std::numeric_limits<int>::max() &#xff09;。 鉴别准确表示的类…

在Kubernetes中实现gRPC流量负载均衡

在尝试将gRPC服务部署到Kubernetes集群中时&#xff0c;一些用户&#xff08;包括我&#xff09;面临的挑战之一是实现适当的负载均衡。在深入了解如何平衡gRPC的方式之前&#xff0c;我们首先需要回答一个问题&#xff0c;即为什么需要平衡流量&#xff0c;如果Kubernetes已经…

【技能树笔记】网络篇——练习题解析(五)

目录 前言 一、应用层的作用 1.1 应用层的作用 二、HTTP协议 2.1 HTTP协议 三、FTP协议 3.1 FTP协议 四、DNS协议 4.1 DNS协议 五、DHCP协议 5.1 DHCP协议 六、邮件协议 6.1 电子邮件协议 总结 前言 本篇文章给出了CSDN网络技能树中的部分练习题解析&#xff0c…

检验检疫系统(LIS)源码:C# + MVC + SQLserver + Redis

LIS系统源码技术特点&#xff1a;采用.Net Core新的技术框架、DEV报表、前端js封装、分布式文件存储、分布式缓存等&#xff0c;支持LIS独立部署&#xff0c;Docker部署等多种方式。 技术架构&#xff1a;ASP.NET CORE 3.1 MVC SQLserver Redis等 开发语言&#xff1a;C…

每日一题——数据分析题

2023年上海市高等学校信息技术水平考试模拟题&#xff1a;数据分析题 读取csv文件这里可以使用pd.read_csv() import pandas as pd# 读取CSV文件 fileroad r素材\city_GDP.csv data pd.read_csv(fileroad, encodinggbk)# 输入地区城市名 city input("请输入城市&#…

SpringBoot之实现Web消息实时消息推送

文章目录 1 实时消息推送1.1 消息推送1.2 准备sql1.3 短轮询1.4 长轮询1.4.1 简介1.4.2 代码示例 1.5 iframe流1.6 SSE1.6.1 简介1.6.2 与 WebSocket 区别1.6.3 代码示例 1.7 MQTT1.7.1 简介1.7.2 为什么要用 MQTT协议 1.8 WebSocket 1 实时消息推送 1.1 消息推送 推送的场景…

[NCTF2019]SQLi regexp 盲注

/robots.txt 访问一下 $black_list "/limit|by|substr|mid|,|admin|benchmark|like|or|char|union|substring|select|greatest|%00|\|| |in|<|>|-|\.|\(\)|#|and|if|database|users|where|table|concat|insert|join|having|sleep/i";If $_POST[passwd] admi…

Vue的MVVM模型

MVVM模型代表三个东西&#xff1a; 1. M : 模型&#xff08;model&#xff09; --> data中的数据 2. V : 视图&#xff08;view) --> 模版代码 3. VM : 视图模型&#xff08;viewmodel&#xff09; --> Vue实例 我们用代码来展示上图中的关系&#xff1a; 也就…

激光除草距离我们实际的农业生活还有多远,结合近期所见所感基于yolov8开发构建田间作物杂草检测识别系统

最近的中秋、国庆双节相信很多朋友都会回家和家人团聚&#xff0c;我也一样&#xff0c;我的家乡是比较小众偏远的乡村&#xff0c;童年给我的最大的记忆就是干不完的农活&#xff0c;而这农活中很大一部分就是蹲在田间地头去人力拔草、撒肥料等&#xff0c;人力终究是很慢效率…

【Linux】 vi / vim 使用

天天用vim 或者vi 。看着大佬用的很6 。我们却用的很少。今天咱们一起系统学习一下。 vi / vim 发展史 vi 是一款由加州大学伯克利分校&#xff0c;Bill Joy研究开发的文本编辑器。 vim Vim是一个类似于Vi的高度可定制的文本编辑器&#xff0c;在Vi的基础上改进和增加了很多…

京东商品链接获取京东商品详情数据接口(用 Python 实现京东商品信息抓取)

在网页抓取方面&#xff0c;可以使用 Python、Java 等编程语言编写程序&#xff0c;通过模拟 HTTP 请求&#xff0c;获取京东网站上的商品页面。在数据提取方面&#xff0c;可以使用正则表达式、XPath 等方式从 HTML 代码中提取出有用的信息。值得注意的是&#xff0c;京东网站…

iTunes是什么意思?iTunes详细使用教程来了!

很多使用苹果设备的小伙伴听说过iTunes&#xff0c;但却很少接触这个软件。就像小编一样&#xff0c;一开始感觉自己根本用不上iTunes。但是当了解到iTunes的知识与使用技巧后&#xff0c;小编才意识到它有多好用。那么&#xff0c;itunes是什么意思&#xff1f;iTunes到底有什…

python爬虫:多线程收集/验证IP从而搭建有效IP代理池

目录 一、前言 二、IP池的实现 1. 收集代理IP 2. 验证代理IP可用性 3. 搭建IP代理池 三、多线程实现 四、代理IP的使用 五、总结 一、前言 在网络爬虫中&#xff0c;IP代理池的作用非常重要。网络爬虫需要大量的IP地址来发送请求&#xff0c;同时为了降低被封禁的风险…