源码获取:俺的博客首页 "资源" 里下载!
项目介绍
基于SpringBoot酒店管理系统
角色:管理员、前台工作人员、保洁阿姨、客户 四种角色
客户功能:
客户注册、登录、找回密码
留言板查看和留言
浏览客房,根据入住日期和退房日期查询和预定客房
支付订单,支付已对接了支付宝沙箱支付,可可以随时关闭启动
客户可以退房,续订,取消订单等功能
管理员功能:
客房管理
客房类型管理
订单管理
入住登记管理
退房登记管理
客房清洁管理
留言管理(只有管理员可以进行留言删除)
财务管理
人员管理( 前台人员,清洁人员,客户)
角色管理,权限管理
酒店前台人员:
订单管理
入住登记管理
退房登记管理
客房清洁管理(只能查看)
留言管理,(可以留言回复,不能删除留言)
财务管理
人员管理( 只能看客户)
保洁人员
客房清洁管理(可以点击开始打扫和完成打扫)
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7/8.0版本均可;
5.是否Maven项目:是;
技术栈
后端:SpringBoot MyBatis Plus
前端:Html CSS jquery Thymleaf
使用说明
项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,控制台提示运行成功后再去运行前端项目;
5. 管理员用户名密码:admin/admin
普通用户名密码:user/123456
文档介绍(课题背景与意义、系统实现功能、课题研究现状、系统相关技术、java技术、B/S架构、Mysql介绍、Mysql环境配置、Springboot框架、系统需求分析、系统功能、可行性研究、经济可行性、技术可行性、运行可行性、事件可行性、系统业务过程分析、系统业务过程分析、系统用例图、系统设计、数据库设计、系统整体设计、系统设计思想、系统流程图、系统详情设计、系统功能模块、系统功能模块、管理员功能模块):
酒店首页展示:
留言板展示详情:![](https://i-blog.csdnimg.cn/blog_migrate/3b53c6a3851308f140bc20ce2dca9b68.jpeg)
酒店订单管理控制层:
后台财务管理展示:
后台订单管理展示列表:
订单详情管理:
客房管理详情列表:![](https://i-blog.csdnimg.cn/blog_migrate/cc599b21918057eec8a1324be4072b5a.jpeg)
订单管理控制层:
@RestController
public class OrderController
{
private final OrderService orderservice;
private final OrderRoomService orderroomservice;
private final RoomidService roomidservice;
private final RoomService roomservice;
private final OrderHistoryService orderHistoryService;
private final FinanceService financeService;
@Autowired
public OrderController(OrderService orderservice,OrderRoomService orderroomservice,RoomidService roomidservice,
RoomService roomservice,OrderHistoryService orderHistoryService,
FinanceService financeService)
{
this.orderservice=orderservice;
this.orderroomservice=orderroomservice;
this.roomidservice=roomidservice;
this.roomservice=roomservice;
this.orderHistoryService=orderHistoryService;
this.financeService=financeService;
}
/**
* 查找所有订单
*
* @return 返回现有的全部订单
*/
@RequestMapping("/order/orderlist")
public Result<List<Order>> orderList()
{
return ResultReturn.success(orderservice.findAll());
}
/**
* 根据订单号查找对应订单信息
*
* @param orderno 订单号
* @return 返回订单号对应的订单
*/
@RequestMapping("/order/searchOne/{orderno}")
public Result<Order> orderSearchOne(@PathVariable("orderno") int orderno)
{
return ResultReturn.success(orderservice.findByOrderNo(orderno));
}
/**
* 更新订单信息
*
* @param orderno 订单号
* @param name 姓名
* @param id 身份证
* @param phone 电话号码
* @param isenter 是否入住
* @return 返回更新后的订单
*/
@RequestMapping("/order/update/{orderno}")
public Result<Order> orderUpdate(@PathVariable("orderno") int orderno,@RequestParam("name") String name,
@RequestParam("id") String id,@RequestParam("phone") String phone,
@RequestParam("isenter") int isenter)
{
Order o=orderservice.findByOrderNo(orderno);
o.setName(name);
o.setId(id);
o.setPhone(phone);
o.setIsenter(isenter);
return ResultReturn.success(orderservice.save(o));
}
/**
* 插入订单
*
* @param
* @return
*/
@RequestMapping("/order/insert")
public Result orderInsert(@RequestParam("name") String name,
@RequestParam("id") String id, @RequestParam("phone") String phone,
@RequestParam("starttime") String starttime, @RequestParam("endtime") String endtime,
@RequestParam("isenter") int isenter, @RequestParam("ismenber") int ismenber,
@RequestParam("roomcount") int roomcount, @RequestParam("roomnos") String roomnos,
@RequestParam("price") int price)
{
Order o = new Order();
o.setName(name);
o.setId(id);
o.setPhone(phone);
// 将String类型格式化为timestamp
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
Date startT = sdf.parse(starttime);
Date endT = sdf.parse(endtime);
o.setStarttime(new Timestamp(startT.getTime()));
o.setEndtime(new Timestamp(endT.getTime()));
} catch (ParseException e) {
e.printStackTrace();
}
o.setIsenter(isenter);
o.setIsmenber(ismenber);
o.setRoomcount(roomcount);
o.setPrice(price);
Order saveO = orderservice.save(o);
List<Order> orderList = orderservice.findAllSortByOrderNo();
Order lastOrder = orderList.get(0);
// 房间号处理
String roomStrArray[] = roomnos.split("\\|"); //“.”和“|”都是转义字符,必须得加”\\”;
for (int i=0;i<roomStrArray.length;i++){
System.out.println(roomStrArray[i]);
OrderRoom orderRoom = new OrderRoom();
orderRoom.setOrderno(lastOrder.getOrderno());
orderRoom.setRoomno(Integer.parseInt(roomStrArray[i]));
orderroomservice.save(orderRoom);
}
return ResultReturn.success(saveO);
}
/**
* 删除订单
*
* @param orderno 订单号
* @return 返回成功
*/
@RequestMapping("/order/delete/{orderno}")
public Result orderDelete(@PathVariable("orderno") int orderno)
{
Order o=orderservice.findByOrderNo(orderno);
orderservice.delete(o);
return ResultReturn.success();
}
/**
* 根据订单号查找所有的订单中的所有房间
*
* @param orderno 订单号
* @return 返回房间列表
*/
@RequestMapping("/order/orderroom/{orderno}")
public Result<List<OrderRoom>> orderroomList(@PathVariable("orderno") int orderno)
{
return ResultReturn.success(orderroomservice.findAll(orderno));
}
/**
* 根据订单-房间序号查找对应记录
*
* @param orno 订单-房间表的序号
* @return 返回对应的订单-房间信息
*/
@RequestMapping("/order/orderroom/orderroomSearchOne/{orno}")
public Result<OrderRoom> orderroomSearchOne(@PathVariable("orno") int orno)
{
return ResultReturn.success(orderroomservice.findOne(orno));
}
/**
* OrderRoom表更新
*
* @param orno 编号
* @param brand 车牌号
* @param roomnoAfter 之前的房间号
* @param roomnoBefore 现在重新设定的房间号(计算价格需要)
* @param orderno 订单号(保存当前订单的价格需要)
* @return 返回保存的orderroom对象
*/
@RequestMapping("/order/orderroom/update/{orno}")
public Result orderroomUpdate(@PathVariable("orno") int orno,@RequestParam("brand") String brand,
@RequestParam("roomnoAfter") int roomnoAfter,
@RequestParam("roomnoBefore") int roomnoBefore,@RequestParam("orderno") int orderno)
{
OrderRoom or=orderroomservice.findOne(orno);
or.setBrand(brand);
or.setRoomno(roomnoAfter);
List<Roomid> ri=roomidservice.findAll(roomnoBefore);
for (Roomid aRi : ri)
{
aRi.setRoomno(roomnoAfter);
}
roomidservice.saveAll(ri);
Order order=orderservice.findByOrderNo(orderno);
Room roomAfter=roomservice.findByRoom(roomnoAfter);
Room roomBefore=roomservice.findByRoom(roomnoBefore);
order.setPrice(order.getPrice()+roomAfter.getPrice()-roomBefore.getPrice());
orderservice.save(order);
return ResultReturn.success(orderroomservice.save(or));
}
//roomid表查看
@RequestMapping("/order/orderroom/roomid/list/{roomno}")
public Result<List<Roomid>> roomidList(@PathVariable("roomno") int roomno)
{
return ResultReturn.success(roomidservice.findAll(roomno));
}
/**
* 根据房间-身份证表的序号查找对应信息
*
* @param rino 房间-身份证表的序号
* @return 返回对应信息
*/
@RequestMapping("/order/orderroom/roomid/roomidSearchOne/{rino}")
public Result<Roomid> roomidSearchOne(@PathVariable("rino") int rino)
{
return ResultReturn.success(roomidservice.findByRino(rino));
}
/**
* 房间-身份证表更新
*
* @param rino 房间-身份证表的序号
* @param name 姓名
* @param id 身份证
* @return 返回更改后的信息
*/
@RequestMapping("/order/orderroom/roomid/update/{rino}")
public Result roomidUpdate(@PathVariable("rino") int rino,@RequestParam("name") String name,
@RequestParam("id") String id)
{
Roomid ri=roomidservice.findByRino(rino);
ri.setId(id);
ri.setName(name);
return ResultReturn.success(roomidservice.save(ri));
}
/**
* 寻找未入住的房间号列表
*
* @return 返回房间号列表
*/
@RequestMapping("/order/orderroom/roomid/getEmptyRoomno")
public Result<List<Integer>> getEmptyRoomno()
{
List<Roomid> ri=roomidservice.findAllWithoutparam();
List<Integer> q=new ArrayList<>(ri.size());
for (Roomid aRi : ri)
{
q.add(aRi.getRoomno());
}
List<Room> r=roomservice.getEmpty(q);
List<Integer> sum=new ArrayList<>();
for (Room aR : r)
{
sum.add(aR.getRoomno());
}
return ResultReturn.success(sum);
}
/**
* 结算订单
*
* @param orderno 订单号
* @return 返回订单结算结果
* @throws HotelException 抛出订单未入住异常 code: 601
*/
@RequestMapping("/order/settle/{orderno}")
public Result<OrderHistory> orderSettle(@PathVariable("orderno") int orderno) throws HotelException
{
Order order=orderservice.findByOrderNo(orderno);
if(order.getIsenter()==1)
{
Order orderTemp=new Order(order);
orderservice.delete(order);
return new OrderHistoryController(orderHistoryService,financeService).orderHistoryInsert(orderTemp);
}
else
{
throw new HotelException(ExceptionType.ORDER_ISENTER_ERROR.getCode(),
ExceptionType.ORDER_ISENTER_ERROR.getMsg());
}
}
}
房间信息管理控制层:
@RestController
public class RoomInformationController {
private final StandardService standservice;
private final RoomService roomservice;
@Autowired
public RoomInformationController(StandardService standservice,RoomService roomservice)
{
this.standservice=standservice;
this.roomservice=roomservice;
}
//查询房间标准列表
@RequestMapping("/standard")
public Result<List<Standard>> standardList() {
return ResultReturn.success(standservice.getAll());
}
//添加客房标准
@RequestMapping("/standard/add")
public Result standardAdd(@RequestParam("stdname") String stdname,
@RequestParam("roomarea") int roomarea,@RequestParam("bedno") int bedno,
@RequestParam("equip1") String equip1,@RequestParam("equip2") String equip2) {
Standard standard = saveStandard(stdname,roomarea,bedno,equip1,equip2);
return ResultReturn.success(standservice.save(standard));
}
//删除客房标准
@RequestMapping("/standard/deletebystdno")
public Result deleteByStdNo(@RequestParam("stdno") int stdno){
standservice.delete(standservice.findByStandard(stdno));
return ResultReturn.success();
}
//查询客房信息列表
@RequestMapping("/room/roomlist")
public Result<List<Room>> roomList() {
return ResultReturn.success(roomservice.getAll()) ;
}
//添加客房信息
@PostMapping("/room/add")
public Result roomAdd(@RequestParam("roomno") int roomno,@RequestParam("type") int type,
@RequestParam("price") int price,@RequestParam("ifwindow") int ifwindow,
@RequestParam("comment") String comment) {
System.out.println("qian"+roomno+" "+roomservice.findByRoom(roomno));
//需要做检测
if(roomservice.findByRoom(roomno)==null) {
System.out.println(roomno);
Room r = saveRoom(roomno, type, price, ifwindow, comment);
return ResultReturn.success(roomservice.save(r));
}
else
return ResultReturn.error(2,"客房编号已存在!");
}
//更新已有信息
@RequestMapping("/room/update/{roomno}")
public Result roomUpdate(@PathVariable("roomno") int roomno,@RequestParam("type") int type,
@RequestParam("price") int price,@RequestParam("ifwindow") int ifwindow,
@RequestParam("comment") String comment) {
//需要先查询是否存在
if(roomservice.findByRoom(roomno)==null) {
return ResultReturn.error(1,"cant't find roomno!");
}
else {
Room r = saveRoom(roomno, type, price, ifwindow, comment);
return ResultReturn.success(roomservice.save(r));
}
}
@RequestMapping("/room/searchOne/{roomno}")
public Result roomSerchOne(@PathVariable("roomno") int roomno) {
Room r = roomservice.findByRoom(roomno);
if(r == null) {
return ResultReturn.error(1,"it's not exist!");
}
else {
return ResultReturn.success(r);
}
}
@RequestMapping("/room/delete/{roomno}")
public Result roomDelete(@PathVariable("roomno") int roomno) {
//需要先查询是否存在
Room r = roomservice.findByRoom(roomno);
if(r == null) {
return ResultReturn.error(1,"it's not exist, you can't delete!");
}
else {
roomservice.delete(r);
return ResultReturn.success(r);
}
}
public Room saveRoom(int roomno,int type,int price,int ifwindow,String comment) {
Room r = new Room();
r.setRoomno(roomno);
r.setType(type);
r.setPrice(price);
r.setIfwindow(ifwindow);
r.setComment(comment);
return r;
}
public Standard saveStandard(String stdname,int roomarea,int bedno,String equip1,String equip2){
Standard s = new Standard();
s.setStdname(stdname);
s.setRoomerea(roomarea);
s.setBedno(bedno);
s.setEquip1(equip1);
s.setEquip2(equip2);
return s;
}
}
财务管理控制层:
@RestController
public class FinanceController
{
private final FinanceService financeService;
@Autowired
public FinanceController(FinanceService financeService)
{
this.financeService=financeService;
}
/**
* @return 返回全部财务报表
*/
@RequestMapping("/finance/getall")
public Result<Finance> getAll()
{
return ResultReturn.success(financeService.findAll());
}
/**
* @param year 欲查询日财务报表的年份
* @param month 欲查询日财务报表的月份
* @param day 欲查询日财务报表的日数
* @return 返回日财务报表
*/
@RequestMapping("/finance/getbyday")
public Result<Finance> getByDay(@RequestParam("year") int year,@RequestParam("month") int month,
@RequestParam("day") int day)
{
return ResultReturn.success(financeService.findByDay(year,month,day));
}
/**
* @param year 欲查询月财务报表的年份
* @param month 欲查询月财务报表的月份
* @return 返回月财务报表
*/
@RequestMapping("/finance/getbymonth")
public Result<Finance> getByDay(@RequestParam("year") int year,@RequestParam("month") int month)
{
return ResultReturn.success(financeService.findByMonth(year,month));
}
/**
* @param year 欲查询年财务报表的年份
* @return 返回年财务报表
*/
@RequestMapping("/finance/getbyyear")
public Result<Finance> getByDay(@RequestParam("year") int year)
{
return ResultReturn.success(financeService.findByYear(year));
}
/**
* @param object 收入对象
* @throws HotelException 抛出异常收入的错误
*/
void insert(Object object) throws HotelException
{
if(object instanceof OrderHistory)
{
Finance finance=new Finance();
finance.setMoney(((OrderHistory)object).getPrice());
finance.setTime(((OrderHistory)object).getEndtime());
finance.setType("订单");
financeService.save(finance);
}
else if(object instanceof GarageHistory)
{
Finance finance=new Finance();
finance.setMoney(((GarageHistory)object).getPrice());
finance.setTime(((GarageHistory)object).getEndtime());
finance.setType("车库");
financeService.save(finance);
}
else
{
throw new HotelException(ExceptionType.FINANCE_INSERT_TYPE_ERROR.getCode(),
ExceptionType.FINANCE_INSERT_TYPE_ERROR.getMsg());
}
}
}
源码获取:俺的博客首页 "资源" 里下载!