编程知识 cdmana.com

Distributed hotel management system based on sprngboot+vue

  Using technology :dubbo+zookeeper Implement distributed

Development technology :springboot+springmvc+mybatis+shiro( Rights management )

development tool :IDEA、ECLIPSE

database :MYSQL

Third party storage : Alibaba cloud OSS Store photos

Dependency management :Maven

The front-end technology :Vue

The development way : Fore and aft end separation

Item number :BS-XX-028

The system has complete functions , The operation is correct , Strong page interaction , Use advanced technology , Suitable for graduation design .

Part of the function display :

Login interface

Guest management

Guest room management

Guests check in :

Historical record

Role management

Rights management

This project has powerful functions , Advanced technology , Suitable for graduation design .

Partial implementation code :

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 {
//             The file is not null when , Add files 
            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 {
//             retrievable url Access address 
            String fileName = authority.getPicture().substring(authority.getPicture().indexOf("images"));
            msg.setData(authorityService.del(authority));
//             Object deleted successfully , Delete pictures 
            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 {
//             Delete old files , And upload new files 
            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;
    }

    /**
     *  Interface default method , According to permission name , return , Status of the permission , Whether to enable permissions 
     *
     * @param auth  Authority Name 
     * @return  Return a field that meets the condition 
     */
    @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 {
//             The file is not null when , Add new file 
            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 {
//             get files url Access address 
            String fileName = customer.getCustomerPicture().substring(customer.getCustomerPicture().indexOf("images"));
            msg.setData(customerService.del(customer));
//             When the object is deleted successfully , Delete a file by its name 
            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 {
//             Delete old files , And upload new files 
            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;
    }
}

版权声明
本文为[Programming thousand paper cranes]所创,转载请带上原文链接,感谢
https://cdmana.com/2022/174/202206231837560990.html

Scroll to Top