5 Star 28 Fork 11

falser / 智能化停车场系统

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Unlicense

falser-cloud

介绍

基于用户角色权限完成得后台管理框架,以及多级数据字典,前端动态菜单权限,接口权限,使用docker部署、前端基于vue-admin-template,权限认证采用sa-Token 模拟汽车出入场,使用支付宝沙箱模拟支付

前端代码在这儿

https://gitee.com/falser/f-backstage

后台体验

http://120.48.3.180

软件架构

本项目是基于sa-token、Redis、nacos、RabbitMq、SpringCloud-Alibaba-2.2.1.RELEASE

使用说明

  1. 执行初始化sql
  2. 安装nacos,RabbitMQ、Redis
  3. 修改配置文件

权限配置代码

SaTokenConfigure.java

@Configuration
@Slf4j
public class SaTokenConfigure implements WebMvcConfigurer {

    @Autowired
    private RequestMappingHandlerMapping requestMappingHandlerMapping;

    /**
     * 注册拦截器
     *
     * @param registry 注册表
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        // 注册Sa-Token的路由拦截器,并排除登录接口或其他可匿名访问的接口地址 (与注解拦截器无关)
        registry
                .addInterceptor(new SaRouteInterceptor((req, res, handler) -> {
                    Map<RequestMappingInfo, HandlerMethod> handlerMethods = requestMappingHandlerMapping.getHandlerMethods();
                    log.info("请求地址:{},请求方法:{}", req.getRequestPath(), req.getMethod());
                    // 登录验证 -- 拦截所有路由,并排除/user/doLogin 用于开放登录
                    SaRouter.match("/**").notMatch(Arrays.asList("/api/auth/login",
                            "/api/auth/register",
                            "/doc.html",
                            "/swagger-ui.html",
                            "/favicon.ico",
                            "/**/*.html",
                            "/**/*.css",
                            "/**/*.js",
                            "/swagger-resources/**",
                            "/swagger-resources/**/**",
                            "/v2/api-docs",
                            "/v2/api-docs/**")).check(StpUtil::checkLogin);

                    // 终止过滤器链
                    SaRouter.match(Arrays.asList("/api/auth/login",
                            "/api/auth/register",
                            "/doc.html",
                            "/swagger-ui.html",
                            "/favicon.ico",
                            "/**/*.html",
                            "/**/*.css",
                            "/**/*.js",
                            "/swagger-resources/**",
                            "/swagger-resources/**/**",
                            "/v2/api-docs",
                            "/v2/api-docs/**")).stop();

                    handlerMethods.forEach(((requestMappingInfo, handlerMethod) -> {
                        Set<RequestMethod> methods = requestMappingInfo.getMethodsCondition().getMethods();
                        methods.forEach(requestMethod -> {
                            SaRouter.match(SaHttpMethod.valueOf(requestMethod.name()))
                                    .match(new ArrayList<>(requestMappingInfo.getPatternsCondition().getPatterns()))
                                    .check(() -> {
                                        log.info("请求地址:{}", req.getMethod() + "#" + requestMappingInfo.getPatternsCondition().getPatterns().toArray()[0]);
                                        StpUtil.checkPermission(req.getMethod() + "#" + requestMappingInfo.getPatternsCondition().getPatterns().toArray()[0]);
                                    });
                        });
                    }));

                })).addPathPatterns("/**");
    }
}

nacos配置

gateway.yml

spring:
  cloud:
    gateway:
      discovery:
        locator:
          enabled: true # 开启网关自动映射处理逻辑
      routes:
        - id: user
          uri: lb://user
          predicates:
            - Path=/user/api/** #  http://127.0.0.1:7000/api/getArgs 转换为 http://userservice/api/getArgs
          filter:
            - StripPrefix=1 # 删除/api      http://userservice/api/getArgs

user.yml

spring:
  redis:
    # Redis数据库索引(默认为0)
    database: 1
    # Redis服务器地址
    host: 
    # Redis服务器连接端口
    port: 
    password: 
    # 连接超时时间
    timeout: 10s
    lettuce:
      pool:
        # 连接池最大连接数
        max-active: 200
        # 连接池最大阻塞等待时间(使用负值表示没有限制)
        max-wait: -1ms
        # 连接池中的最大空闲连接
        max-idle: 10
        # 连接池中的最小空闲连接
        min-idle: 0

  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: 
    username: 
    password: 

# Sa-Token配置
sa-token:
  # token名称 (同时也是cookie名称)
  token-name: satoken
  # token有效期,单位s 默认30天, -1代表永不过期
  timeout: 2592000
  # token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
  activity-timeout: -1
  # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
  is-concurrent: true
  # 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
  is-share: false
  # token风格
  token-style: uuid
  # 是否输出操作日志
  is-log: false

mybatis-plus:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request
This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <http://unlicense.org>

简介

SpringCloud-gateway、SpringBoot、Mybatis-plus、Nacos、Rabbit Mq、Redis、Sa-token、vue、element-ui、RBAC接口鉴权、动态菜单、数据字典、docker部署 展开 收起
Java 等 5 种语言
Unlicense
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/falser/parking_system.git
git@gitee.com:falser/parking_system.git
falser
parking_system
智能化停车场系统
master

搜索帮助