基于Sprngboot+Vue的分布式酒店管理系统

 使用技术:dubbo+zookeeper实现分布式

开发技术:springboot+springmvc+mybatis+shiro(权限管理)

开发工具:IDEA、ECLIPSE

数据库:MYSQL

第三方存储:阿里云OSS存储照片

依赖管理:Maven

前端技术:Vue

开发方式:前后端分离

项目编号:BS-XX-028

本系统功能完整,运行无误,页面交互性强,使用技术先进,适合做毕业设计使用。

部分功能展示:

登陆界面

宾客管理

客房管理

客人登记入住:

历史记录

角色管理

权限管理

本项目功能强大,技术先进,适合做毕业设计使用。

部分实现代码:

package gmail.zxm.dubboz1jdglweb.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import d.z1.entity.Authority;
import d.z1.entity.Message;
import d.z1.jdgl.api.IAuthorityService;
import gmail.zxm.dubboz1jdglweb.oss.OSSUtil;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.websocket.server.PathParam;

@RestController
@RequestMapping("/authority")
public class AuthorityController {

    @Reference
    private IAuthorityService authorityService;

    private Message msg = new Message();

    private static Logger log = LoggerFactory.getLogger(AuthorityController.class);


    @PostMapping("/add")
    public Message add(Authority authority, @RequestParam(value = "file",required = false) MultipartFile file) throws Exception {
        try {
//            文件不为null时,添加文件
            if (!file.isEmpty()) {
                String fileType = file.getContentType().replace("/", "_");
                authority.setPicture(OSSUtil.uploadDocument(file, fileType));
            }
            msg.setData(authorityService.add(authority));
            msg.setPageSizes(1);
            msg.setStatus(200);
        } catch (Exception e) {
            throw e;
        }
        return msg;
    }

    @PostMapping("/del")
    public Message del(Authority authority) throws Exception {
        if (authority == null)
            return msg;
        try {
//            获取文件的url访问地址
            String fileName = authority.getPicture().substring(authority.getPicture().indexOf("images"));
            msg.setData(authorityService.del(authority));
//            对象删除成功,删除图片
            OSSUtil.deleteDocument(fileName);
            msg.setPageSizes(1);
            msg.setStatus(200);
        } catch (Exception e) {
            throw e;
        }
        return msg;
    }


    @RequiresAuthentication
    @PostMapping("/rep")
    public Message rep(Authority authority,
                       @RequestParam(value = "file", required = false) MultipartFile file) throws Exception {
        try {
//            删除旧文件,并上传新文件
            if (file != null) {
                authority.setPicture(OSSUtil.updateDocument(file,
                        file.getContentType().replace("/", "_"),
                        authority.getPicture().substring(authority.getPicture().indexOf("images"))));
            }
            msg.setData(authorityService.rep(authority));
            msg.setPageSizes(1);
            msg.setStatus(200);
        } catch (Exception e) {
            throw e;
        }
        return msg;
    }


    @RequiresAuthentication
    @GetMapping("/getAll/{startIndex}/{endSize}")
    public Message getAll(@PathVariable Integer startIndex,
                          @PathVariable Integer endSize) throws Exception {
        try {
            msg.setData(authorityService.getAll(startIndex, endSize));
            msg.setPageSizes(authorityService.getSize());
            msg.setStatus(200);
            System.out.println(authorityService.getAll(startIndex, endSize));
        } catch (Exception e) {
            throw e;
        }
        return msg;
    }

    @PostMapping("/getT")
    public Message getT(Authority authority, @RequestParam("startIndex") Integer startIndex,
                        @RequestParam("endSize") Integer endSize) throws Exception {
        try {

            msg.setData(authorityService.getT(authority, startIndex, endSize));
            msg.setPageSizes(authorityService.getSize());
            msg.setStatus(200);
        } catch (Exception e) {
            throw e;
        }
        return msg;
    }

    /**
     * 接口默认方法,根据权限名,返回,该权限的状态,是否启用权限
     *
     * @param auth 权限名
     * @return 返回满足条件的一个字段
     */
    @GetMapping("/getAuthority/{auth}")
    public Message getAuthority(@PathVariable String[] auth) throws Exception {

        try {
            msg.setData(authorityService.getAuthority(auth));
            msg.setStatus(200);
            System.out.println(msg);
        } catch (Exception e) {
            throw e;
        }
        return msg;
    }
}

package gmail.zxm.dubboz1jdglweb.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import d.z1.entity.Book;
import d.z1.entity.Message;
import d.z1.jdgl.api.IBookService;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import javax.websocket.server.PathParam;

@RestController
@RequestMapping("/book")
public class BookController {

    @Reference
    private IBookService bookService;

    private Message msg = new Message();

    @PostMapping("/add")
    @RequiresPermissions("book:add")
    public Message add(Book book)throws Exception {
        try {
            msg.setData(bookService.add(book));
            msg.setPageSizes(1);
            msg.setStatus(200);

        } catch (Exception e) {
            throw e;
        }
        return msg;
    }

    @PostMapping("/del")
    @RequiresPermissions("book:del")
    public Message del(Book book)throws Exception {
        System.out.println(book.getRecord());
            
        if (book == null)
            return msg;
        try {
            msg.setData(bookService.del(book));
            msg.setPageSizes(1);
            msg.setStatus(200);

        } catch (Exception e) {
            throw e;
        }
        return msg;
    }

    @PostMapping("/rep")
    @RequiresPermissions("book:rep")
    public Message rep(Book book)throws Exception {
        try {
            msg.setData(bookService.rep(book));
            msg.setPageSizes(1);
            msg.setStatus(200);

        } catch (Exception e) {
            throw e;
        }
        return msg;
    }

    @GetMapping("/getAll/{startIndex}/{endSize}")
    @RequiresAuthentication
    public Message getAll(@PathVariable Integer startIndex, @PathVariable Integer endSize)throws Exception {
        try {
            
            msg.setData(bookService.getAll(startIndex,endSize));
            msg.setPageSizes(bookService.getSize());
            msg.setStatus(200);
            System.out.println(bookService.getAll(startIndex,endSize));
        } catch (Exception e) {
            throw e;
        }
        return msg;
    }

    @PostMapping("/getT")
    @RequiresAuthentication
    public Message getT(Book book, @RequestParam("startIndex") Integer startIndex,
                        @RequestParam("endSize") Integer endSize)throws Exception {
        try {
            
            msg.setData(bookService.getT(book,startIndex,endSize));
            msg.setPageSizes(bookService.getSize());
            msg.setStatus(200);
        } catch (Exception e) {
            throw e;
        }
        return msg;
    }


}

package gmail.zxm.dubboz1jdglweb.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import d.z1.entity.Message;
import d.z1.jdgl.api.ICustomerService;
import d.z1.entity.Customer;
import gmail.zxm.dubboz1jdglweb.oss.OSSUtil;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.websocket.server.PathParam;


@RestController
@RequestMapping("/customer")
public class CustomerController {

    @Reference
    private ICustomerService customerService;

    private Message msg = new Message();

    @PostMapping("/add")
    @RequiresPermissions("customer:add")
    public Message add(Customer customer, @RequestParam(value = "file",required = false) MultipartFile file) throws Exception {
        try {
//            文件不为null时,添加新文件
            if (file != null)
                customer.setCustomerPicture(OSSUtil.uploadDocument(file, file.getContentType().replace("/","_")));
            msg.setData(customerService.add(customer));
            msg.setPageSizes(1);
            msg.setStatus(200);

        } catch (Exception e) {
            throw e;
        }
        return msg;
    }

    @PostMapping("/del")
    @RequiresPermissions("customer:del")
    public Message del(Customer customer) throws Exception {
        if (customer == null)
            return msg;
        try {
//            获取文件url访问地址
            String fileName = customer.getCustomerPicture().substring(customer.getCustomerPicture().indexOf("images"));
            msg.setData(customerService.del(customer));
//            对象删除成功时,根据文件名删除文件
            OSSUtil.deleteDocument(fileName);
            msg.setPageSizes(1);
            msg.setStatus(200);

        } catch (Exception e) {
            throw e;
        }
        return msg;
    }

    @PostMapping("/rep")
    @RequiresPermissions("customer:rep")
    public Message rep(Customer customer, @RequestParam(value = "file",required = false) MultipartFile file) throws Exception {
        try {
//            删除旧文件,并上传新文件
            if (file != null){
                customer.setCustomerPicture(OSSUtil.updateDocument(file,
                        file.getContentType().replace("/","_"),
                        customer.getCustomerPicture().substring(customer.getCustomerPicture().indexOf("upload"))));
            }
            msg.setData(customerService.rep(customer));
            msg.setPageSizes(1);
            msg.setStatus(200);

        } catch (Exception e) {
            throw e;
        }
        return msg;
    }

    @RequiresAuthentication
    @GetMapping("/getAll/{startIndex}/{endSize}")
    public Message getAll(@PathVariable Integer startIndex,
                          @PathVariable Integer endSize) throws Exception {
        try {
            msg.setData(customerService.getAll(startIndex, endSize));
            msg.setPageSizes(customerService.getSize());
            msg.setStatus(200);
        } catch (Exception e) {
            throw e;
        }
        return msg;
    }

    @PostMapping("/getT")
    @RequiresAuthentication
    public Message getT(Customer customer, @RequestParam("startIndex") Integer startIndex,
                        @RequestParam("endSize") Integer endSize) throws Exception {
        try {
            msg.setData(customerService.getT(customer, startIndex, endSize));
            msg.setPageSizes(customerService.getSize());
            msg.setStatus(200);
        } catch (Exception e) {
            throw e;
        }
        return msg;
    }
}

猜你喜欢

转载自blog.csdn.net/BS009/article/details/125421802