Java项目:ssh酒店管理系统

作者主页:源码空间站2022

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

ssh酒店管理系统。分管理员与普通员工两种角色;

管理员主要功能有:
员工管理:员工列表;
客户基本信息:客户基本信息
客房基本信息:楼层设置、客房设置、客房信息、客房维护;
客房预定信息:客房预定信息
客户入住信息:办理入住、客户入住;
客户换房信息:客户换房;
客户退房信息:客户退房信息
酒店商品信息:商品分类设置、商品基本信息、已售商品信息;
结账管理信息:结账管理列表;

普通员工主要功能有:
客户基本信息:客户基本信息
客房基本信息:客房维护;
客房预定信息:客房预定信息
客户入住信息:办理入住、客户入住;
客户换房信息:客户换房;
客户退房信息:客户退房信息
酒店商品信息:已售商品信息;

结账管理信息:结账管理列表;

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 

6.数据库:MySql 5.7版本;

技术栈

1. 后端:Spring+Structs2+Hibernate

2. 前端:JSP+bootstrap+jQuery+easyUI

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置;
3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;

4. 运行项目,输入登录页面 http://localhost:8085/login_login.do 登录

运行截图

 

相关代码 

BuyCartAction

package com.xznu.edu.leave.action;

/**
 * 用户新增
 */

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.xznu.edu.leave.model.*;
import com.xznu.edu.leave.service.*;
import com.xznu.edu.leave.utils.JsonUtils;
import com.xznu.edu.leave.utils.Pager;
import com.xznu.edu.leave.utils.UserUtils;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import java.io.IOException;
import java.util.List;

@Controller("buycartAction")
@Scope("prototype")
public class BuyCartAction extends ActionSupport implements ModelDriven<BuyCart> {

    @Autowired
    private BuyCartService service;
    @Autowired
    private GoodsService goodsService;
    @Autowired
    private RoomLogService roomlogs;
    @Autowired
    private GoodsTypeService goodstypeService;
    private BuyCart buyCart;
    private Integer roomlogId;


    /**
     * list
     *
     * @return
     */
    public String list() throws IOException {
        User user1 = UserUtils.getUser();
        if (user1 == null || user1.getId() == null) {
            ActionContext.getContext().put("login", 1);
            return SUCCESS;
        }
        buyCart.setUser(user1);
        Pager<BuyCart> pagers = service.getList(buyCart);
        Pager<GoodsType> list = goodstypeService.getList(null);
        ActionContext.getContext().put("list", list);
        ActionContext.getContext().put("pagers", pagers);
        ActionContext.getContext().put("user", user1);
        return SUCCESS;
    }

    /**
     * 后台客户购买商品列表
     * @return
     * @throws IOException
     */
    public String khlist() throws IOException {
        User user1 = UserUtils.getUser();
        if (user1 == null || user1.getId() == null) {
            ActionContext.getContext().put("login", 1);
            return SUCCESS;
        }
        Pager<BuyCart> pagers = service.getList2(buyCart);
        Pager<GoodsType> list = goodstypeService.getList(null);
        ActionContext.getContext().put("list", list);
        ActionContext.getContext().put("pagers", pagers);
        ActionContext.getContext().put("user", user1);
        ActionContext.getContext().put("bean", buyCart);
        return SUCCESS;
    }

    /**
     * 跳转add
     *
     * @return
     */
    public String add() {
        return SUCCESS;
    }

    /**
     * 查询修改
     *
     * @return
     */
    public void edit() throws IOException {
        BuyCart bean = service.findById(buyCart.getId());
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("bean", bean);
        jsonObject.put("flag", true);
        JsonUtils.jsonObject(jsonObject);
    }

    public String updatesl() throws IOException {
        BuyCart bean = service.findById(buyCart.getId());
        bean.setSl(buyCart.getSl());
        service.update(bean);
        ActionContext.getContext().put("url", "buycart_khlist.do");
        return "redirect";
    }

    /**
     * 更新
     *
     * @return
     */
    public void update() throws IOException {
        service.updates(buyCart);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("flag", true);
        jsonObject.put("message", "更新成功");
        JsonUtils.jsonObject(jsonObject);
    }

    /**
     * 保存
     *
     * @return
     */
    public void save() throws IOException {
        User user = UserUtils.getUser();
        Integer id = roomlogId;
        if (id == null || id.equals("")){
            id = user.getRoomlogId();
        }
        JSONObject jsonObject = new JSONObject();
        BuyCart buyCart1 = new BuyCart();
        if (user == null) {
            jsonObject.put("flag", false);
            JsonUtils.jsonObject(jsonObject);
        } else {
            Goods goods = goodsService.findById(buyCart.getId());
            buyCart1.setUser(UserUtils.getUser());
            buyCart1.setGoods(goods);
            RoomLog r = roomlogs.findById(id);
            buyCart1.setRoomLog(r);
            List<BuyCart> list = service.getList(id).getDatas();
            if (list.size() == 0) {
                buyCart1.setSl(1);
                service.save(buyCart1);
                jsonObject.put("flag", true);
                jsonObject.put("roomlogId", id);
                JsonUtils.jsonObject(jsonObject);
            } else {
                boolean flag = true;
                for (int i = 0; i < list.size(); i++) {
                    if (goods.getId() == list.get(i).getGoods().getId()){
                        flag = false;
                        list.get(i).setSl(list.get(i).getSl() + buyCart.getSl());
                        service.updates(list.get(i));
                        jsonObject.put("flag", true);
                        jsonObject.put("roomlogId", id);
                        JsonUtils.jsonObject(jsonObject);
                    }
                }
                if (flag){
                    buyCart1.setSl(1);
                    service.save(buyCart1);
                    jsonObject.put("flag", true);
                    jsonObject.put("roomlogId", id);
                    JsonUtils.jsonObject(jsonObject);
                }
            }
        }
    }

    public void delete() throws IOException {
        service.delete(buyCart.getId());
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("flag", true);
        JsonUtils.jsonObject(jsonObject);
    }

    @Override
    public BuyCart getModel() {
        if (buyCart == null) {
            buyCart = new BuyCart();
        }
        return buyCart;
    }

    public Integer getRoomlogId() {
        return roomlogId;
    }

    public void setRoomlogId(Integer roomlogId) {
        this.roomlogId = roomlogId;
    }
}

如果也想学习本系统,下面领取。关注并回复:009ssh 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值