我的编程空间,编程开发者的网络收藏夹
学习永远不晚

Java 实战练手项目之酒店管理系统的实现流程

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

Java 实战练手项目之酒店管理系统的实现流程

一、项目简述

功能包括(管理员和用户角色): 酒店预订,酒店管理,员工管理,入住原理,订单管理, 楼层管理,退房管理,营业额报表等等。

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)

项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。

管理员控制器层:



@Controller
@CrossOrigin
@RequestMapping("/admin")
public class AdminController {
 
	@Autowired
	private AdminService adminService;
	
	@Autowired
	BCryptPasswordEncoder encoder;
 
	
	@ResponseBody
	@RequestMapping(method= RequestMethod.GET)
	public Result findAll(){
		return new Result(true, StatusCode.OK,"查询成功",adminService.findAll());
	}
	
	
	@ResponseBody
	@RequestMapping(value="/{id}",method= RequestMethod.GET)
	public Result findById(@PathVariable Long id){
		return new Result(true,StatusCode.OK,"查询成功",adminService.findById(id));
	}
 
 
	
	@ResponseBody
	@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
	public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
		Page<Admin> pageList = adminService.findSearch(searchMap, page, size);
		return  new Result(true,StatusCode.OK,"查询成功",  new PageResult<Admin>(pageList.getTotalElements(), pageList.getContent()) );
	}
 
	
	@ResponseBody
    @RequestMapping(value="/search",method = RequestMethod.POST)
    public Result findSearch( @RequestBody Map searchMap){
        return new Result(true,StatusCode.OK,"查询成功",adminService.findSearch(searchMap));
    }
	
	
	@ResponseBody
	@RequestMapping(method=RequestMethod.POST)
	public Result add(@RequestBody Admin admin  ){
		adminService.add(admin);
		return new Result(true,StatusCode.OK,"增加成功");
	}
	
	
	@ResponseBody
	@RequestMapping(value="/{id}",method= RequestMethod.PUT)
	public Result update(@RequestBody Admin admin, @PathVariable Long id ){
		admin.setId(id);
		adminService.update(admin);		
		return new Result(true,StatusCode.OK,"修改成功");
	}
	
	
	@ResponseBody
	@RequestMapping(value="/{id}",method= RequestMethod.DELETE)
	public Result delete(@PathVariable String id ){
		adminService.deleteById(id);
		return new Result(true,StatusCode.OK,"删除成功");
	}
 
	
	@RequestMapping(value = "/adminlogin")
	public String adminlogin()
	{
		return "admin/login/login";
	}
 
 
	
	@ResponseBody
	@RequestMapping(value="/login",method= RequestMethod.POST)
	public Result login(@RequestParam Map<String,String> loginMap,HttpServletRequest request){
		Admin admin = adminService.finbyNameAndPassword(loginMap.get("name"),loginMap.get("password"));
		if (admin!=null){
 
			request.getSession().setAttribute("admin",admin);
			Map map=new HashMap();
			map.put("name",admin.getName());
			return new Result(true,StatusCode.OK,"登录成功");
		}else {
			return new Result(false,StatusCode.ERROR,"账号密码错误");
		}
	}
 
	
	@RequestMapping(value = "/index")
	public String success(){
		return "admin/index";
	}
 
 
	
	@RequestMapping(value = "/userList")
	public String user(){
		return "admin/usermanage/userList";
	}
 
	@RequestMapping(value = "/echars")
	public String analysis(){
		return "admin/echars/console";
	}
 
 
	
	@RequestMapping(value = "/logout")
	public String logout(HttpSession session){
		session.removeAttribute("admin");
		return "admin/login/login";
	}
 
 
	
	@ResponseBody
	@RequestMapping(value = "/passwd")
	public Result passwd(HttpSession session,String passwd,String oldpad){
 
		Admin admindmin= (Admin) session.getAttribute("admin");
		Admin admins=adminService.findById(admindmin.getId());
		boolean old=encoder.matches(oldpad,admins.getPassword());
		if (old){
			String newPassd=encoder.encode(passwd);
			admins.setPassword(newPassd);
			adminService.update(admins);
			return new Result(true,StatusCode.OK,"成功");
		}else {
			return new Result(false,StatusCode.ERROR,"更新失败");
		}
	}
 
}

轮播内容控制器层:



@Controller
@CrossOrigin
@RequestMapping("/carousel")
public class CarouselController {
 
	@Autowired
	private CarouselService carouselService;
	
	
	
	@ResponseBody
	@RequestMapping(value = "/list",method= RequestMethod.GET)
	public Result findAll(){
		List<Carousel> all = carouselService.findAll();
		return new Result(true, StatusCode.OK,"查询成功",all,all.size());
	}
	
	
	@ResponseBody
	@RequestMapping(value="/{id}",method= RequestMethod.GET)
	public Result findById(@PathVariable Long id){
		return new Result(true,StatusCode.OK,"查询成功",carouselService.findById(id));
	}
 
 
	
	@ResponseBody
	@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
	public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
		Page<Carousel> pageList = carouselService.findSearch(searchMap, page, size);
		return  new Result(true,StatusCode.OK,"查询成功",  new PageResult<Carousel>(pageList.getTotalElements(), pageList.getContent()) );
	}
 
	
	@ResponseBody
    @RequestMapping(value="/search",method = RequestMethod.POST)
    public Result findSearch( @RequestBody Map searchMap){
        return new Result(true,StatusCode.OK,"查询成功",carouselService.findSearch(searchMap));
    }
	
	
	@ResponseBody
	@RequestMapping(value = "/add",method=RequestMethod.POST)
	public Result add(Carousel carousel){
		if(StringUtils.isEmpty(carousel.getTitle())){
			return new Result(false,StatusCode.ERROR,"请填写第一行内容");
		}
		if(StringUtils.isEmpty(carousel.getScenictime())){
			return new Result(false,StatusCode.ERROR,"请填写第二行内容");
		}
		if(StringUtils.isEmpty(carousel.getComment())){
			return new Result(false,StatusCode.ERROR,"请填写第三行内容");
		}
		if(carouselService.add(carousel)==null){
			return new Result(false,StatusCode.ERROR,"轮播信息添加失败");
		}
		return new Result(true,StatusCode.OK,"添加成功");
	}
	
	
	@ResponseBody
	@RequestMapping(value="/edit",method= RequestMethod.PUT)
	public Result update(Carousel carousel){
		if(StringUtils.isEmpty(carousel.getTitle())){
			return new Result(false,StatusCode.ERROR,"请填写第一行内容");
		}
		if(StringUtils.isEmpty(carousel.getScenictime())){
			return new Result(false,StatusCode.ERROR,"请填写第二行内容");
		}
		if(StringUtils.isEmpty(carousel.getComment())){
			return new Result(false,StatusCode.ERROR,"请填写第三行内容");
		}
	if(carouselService.update(carousel)==null){
		return new Result(false,StatusCode.ERROR,"轮播信息修改成功!");
	}
		return new Result(true,StatusCode.OK,"修改成功");
	}
	
	
	@ResponseBody
	@RequestMapping(value="/{id}",method= RequestMethod.DELETE)
	public Result delete(@PathVariable Long id ){
		try{
			carouselService.deleteById(id);
		}catch (Exception e){
			e.printStackTrace();
			new Result(false,StatusCode.ERROR,"删除失败");
		}
		return new Result(true,StatusCode.OK,"删除成功");
	}
 
	
	@RequestMapping(value = "/carouselList")
	public String carouselList(){
		return "admin/carouselmanage/carouselList";
	}
 
 
 
}

景点控制器层:



@Controller
@CrossOrigin
@RequestMapping("/scenic")
public class ScenicController {
 
	@Autowired
	private ScenicService scenicService;
 
 
	
	@ResponseBody
	@RequestMapping(value = "list",method= RequestMethod.GET)
	public Result findAll(){
		List<Scenic> all = scenicService.findAll();
		return new Result(true, StatusCode.OK,"查询成功",all,all.size());
	}
	
	
	@ResponseBody
	@RequestMapping(value="/{id}",method= RequestMethod.GET)
	public Result findById(@PathVariable Long id){
		return new Result(true,StatusCode.OK,"查询成功",scenicService.findById(id));
	}
 
 
	
	@ResponseBody
	@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
	public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
		Page<Scenic> pageList = scenicService.findSearch(searchMap, page, size);
		return  new Result(true,StatusCode.OK,"查询成功",  new PageResult<Scenic>(pageList.getTotalElements(), pageList.getContent()) );
	}
 
 
	
	@ResponseBody
    @RequestMapping(value="/search",method = RequestMethod.POST)
    public Result findSearch( @RequestBody Map searchMap){
        return new Result(true,StatusCode.OK,"查询成功",scenicService.findSearch(searchMap));
    }
	
	
	@ResponseBody
	@RequestMapping(method=RequestMethod.POST)
	public Result add(@RequestBody Scenic scenic){
		if(StringUtils.isEmpty(scenic.getName())){
			return new Result(false,StatusCode.ERROR,"请填写景点名称");
		}
		if(StringUtils.isEmpty(scenic.getContry())){
			return new Result(false,StatusCode.ERROR,"请填写景点所在地");
		}
		if(StringUtils.isEmpty(scenic.getComment())){
			return new Result(false,StatusCode.ERROR,"请填写景点概述");
		}
		if(StringUtils.isEmpty(scenic.getMiaoshu())){
			return new Result(false,StatusCode.ERROR,"请填写详细描述");
		}
		scenic.setCommentCount(0);
		scenic.setStart(0);
		if(scenicService.add(scenic)==null){
			return new Result(false,StatusCode.ERROR,"景点添加失败");
		}
		return new Result(true,StatusCode.OK,"景点添加成功");
	}
	
	
	@ResponseBody
	@RequestMapping(value="/{id}",method= RequestMethod.PUT)
	public Result update(@RequestBody Scenic scenic, @PathVariable Long id ){
		if(StringUtils.isEmpty(scenic.getName())){
			return new Result(false,StatusCode.ERROR,"请填写景点名称");
		}
		if(StringUtils.isEmpty(scenic.getContry())){
			return new Result(false,StatusCode.ERROR,"请填写景点所在地");
		}
		if(StringUtils.isEmpty(scenic.getComment())){
			return new Result(false,StatusCode.ERROR,"请填写景点概述");
		}
		if(StringUtils.isEmpty(scenic.getMiaoshu())){
			return new Result(false,StatusCode.ERROR,"请填写详细描述");
		}
		Scenic scenic1ById = scenicService.findById(id);
		if(scenic1ById==null){
			return new Result(false,StatusCode.ERROR,"该景点不存在");
		}
		BeanUtils.copyProperties(scenic,scenic1ById,"id","startdate","img","commentCount");
		if(scenicService.update(scenic1ById)==null){
			return new Result(false,StatusCode.ERROR,"景点修改失败");
		}
		return new Result(true,StatusCode.OK,"修改成功");
	}
	
	
	@ResponseBody
	@RequestMapping(value="/{id}",method= RequestMethod.DELETE)
	public Result delete(@PathVariable String id ){
		scenicService.deleteById(id);
		return new Result(true,StatusCode.OK,"删除成功");
	}
 
	@RequestMapping(value = "/scenicList")
	public String scenicList(){
		return "admin/scenicmanage/scenicList";
	}
 
	@RequestMapping(value = "/scenicAdd")
	public String scenicAdd(){
		return "admin/scenicmanage/scenicAdd";
	}
 
}

用户控制器层:



@RestController
@CrossOrigin
@RequestMapping("/user")
public class UserController {
 
	@Autowired
	private UserService userService;
 
	@Autowired
	private RedisTemplate redisTemplate;
 
	@Autowired
	private HttpServletRequest request;
 
	@Autowired
    BCryptPasswordEncoder encoder;
 
 
 
    
    @RequestMapping(value = "userList",method = RequestMethod.GET)
    public Result findAll() {
		List<User> all = userService.findAll();
		return new Result(true, StatusCode.OK, "查询成功",all,all.size());
    }
 
    
    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    public Result findById(@PathVariable Long id) {
        return new Result(true, StatusCode.OK, "查询成功", userService.findById(id));
    }
 
 
	
	@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
	public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
		Page<User> pageList = userService.findSearch(searchMap, page, size);
		return  new Result(true,StatusCode.OK,"查询成功",  new PageResult<User>(pageList.getTotalElements(), pageList.getContent()) );
	}
 
	
    @RequestMapping(value="/search",method = RequestMethod.POST)
    public Result findSearch( @RequestBody Map searchMap){
        return new Result(true,StatusCode.OK,"查询成功",userService.findSearch(searchMap));
    }
	
	
	@RequestMapping(method=RequestMethod.POST)
	public Result add(@RequestBody User user  ){
		userService.add(user);
		return new Result(true,StatusCode.OK,"增加成功");
	}
	
	
	@ResponseBody
	@RequestMapping(value="/{id}",method= RequestMethod.PUT)
	public Result update(User user, @PathVariable Long id ){
		User oldUser=userService.findById(id);
		user.setId(id);
		user.setPassword(oldUser.getPassword());
		userService.update(user);
		return new Result(true,StatusCode.OK,"修改成功");
	}
 
	
	@RequestMapping(value="/change",method= RequestMethod.POST,consumes = "application/json")
	public Result update(@RequestBody User user, HttpSession session){
		User us= (User) session.getAttribute("user");
		user.setId(us.getId());
		user.setPassword(us.getPassword());
		userService.update(user);
		return new Result(true,StatusCode.OK,"修改成功");
	}
	
	@RequestMapping(value="/{id}",method= RequestMethod.DELETE)
	public Result delete(@PathVariable String id ){
		userService.deleteById(id);
		return new Result(true,StatusCode.OK,"删除成功");
	}
	
	@ResponseBody
	@RequestMapping(value = "/register/",method = RequestMethod.POST)
	public Result regist(@RequestParam(name = "code") String code,User user,HttpServletRequest request){
		String sCode = (String) request.getSession().getAttribute("user_register_email_code");
		if(!sCode.equalsIgnoreCase(code)){
			return new Result(false,StatusCode.ERROR,"验证码错误!");
		}
			userService.add(user);
			return new Result(true,StatusCode.OK,"注册成功");
	}
 
	
    @RequestMapping(value = "/checkPhone",method = RequestMethod.POST)
	@ResponseBody
    public Result checkPhone(User user){
		String phone = user.getMobile();
		if(!StringUtil.isMobile(phone)){
			return new Result(false,StatusCode.ERROR,"请填写正确的手机号!");
		}
		User userphone= userService.findByMobile(phone);
		if (userphone == null){
			return new Result(true,StatusCode.OK,"该手机号可以注册");
		}
		return new Result(false,StatusCode.ERROR,"该手机号已经被注册");
	}
 
 
	
	@RequestMapping(value = "/email",method = RequestMethod.POST)
	@ResponseBody
	public Result findemail(User user){
		String email = user.getEmail();
		if(!StringUtil.emailFormat(email)){
			return new Result(true,StatusCode.ERROR,"请填写正确的邮箱格式");
		}
		User useremail= userService.findByEmail(email);
		if (useremail == null){
			return new Result(true,StatusCode.OK,"该邮箱可以注册");
		}
		return new Result(false,StatusCode.ERROR,"该邮箱已经被注册");
	}
 
 
 
 
 
	
	@ResponseBody
	@RequestMapping(value="/login",method=RequestMethod.POST)
	public Result login(@RequestParam Map<String,String> loginMap,HttpServletRequest request){
		  String mobile = loginMap.get("login");
		if (StringUtil.isMobile(mobile)){
			User user = userService.findByMobileAndPassword(loginMap.get("login"),loginMap.get("password"));
			if(user!=null){
				request.getSession().setAttribute("user",user);
				Map map=new HashMap();
				return new Result(true,StatusCode.OK,"登陆成功");
			}else{
				return new Result(false,StatusCode.LOGINERROR,"用户名或密码错误");
			}
		}else {
			User user =  userService.findByNameAndPassword(loginMap.get("login"),loginMap.get("password"));
			if(user!=null){
				request.getSession().setAttribute("user",user);
				Map map=new HashMap();
				map.put("name",user.getName());//姓名
				return new Result(true,StatusCode.OK,"登陆成功",map);
 
			}else{
				return new Result(false,StatusCode.LOGINERROR,"用户名或密码错误");
			}
		}
	}
 
 
	
	@RequestMapping(value="/logout",method=RequestMethod.GET)
	public void logout(HttpServletRequest request,HttpServletResponse response) throws IOException {
        request.getSession().setAttribute("user", null);
        response.sendRedirect(request.getContextPath() + "/dist/view");
 
    }
 
}

以上就是Java 实战练手项目之酒店管理系统的实现流程的详细内容,更多关于Java 酒店管理系统的资料请关注编程网其它相关文章!

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

Java 实战练手项目之酒店管理系统的实现流程

下载Word文档到电脑,方便收藏和打印~

下载Word文档

编程热搜

  • Python 学习之路 - Python
    一、安装Python34Windows在Python官网(https://www.python.org/downloads/)下载安装包并安装。Python的默认安装路径是:C:\Python34配置环境变量:【右键计算机】--》【属性】-
    Python 学习之路 - Python
  • chatgpt的中文全称是什么
    chatgpt的中文全称是生成型预训练变换模型。ChatGPT是什么ChatGPT是美国人工智能研究实验室OpenAI开发的一种全新聊天机器人模型,它能够通过学习和理解人类的语言来进行对话,还能根据聊天的上下文进行互动,并协助人类完成一系列
    chatgpt的中文全称是什么
  • C/C++中extern函数使用详解
  • C/C++可变参数的使用
    可变参数的使用方法远远不止以下几种,不过在C,C++中使用可变参数时要小心,在使用printf()等函数时传入的参数个数一定不能比前面的格式化字符串中的’%’符号个数少,否则会产生访问越界,运气不好的话还会导致程序崩溃
    C/C++可变参数的使用
  • css样式文件该放在哪里
  • php中数组下标必须是连续的吗
  • Python 3 教程
    Python 3 教程 Python 的 3.0 版本,常被称为 Python 3000,或简称 Py3k。相对于 Python 的早期版本,这是一个较大的升级。为了不带入过多的累赘,Python 3.0 在设计的时候没有考虑向下兼容。 Python
    Python 3 教程
  • Python pip包管理
    一、前言    在Python中, 安装第三方模块是通过 setuptools 这个工具完成的。 Python有两个封装了 setuptools的包管理工具: easy_install  和  pip , 目前官方推荐使用 pip。    
    Python pip包管理
  • ubuntu如何重新编译内核
  • 改善Java代码之慎用java动态编译

目录