# falser-cloud **Repository Path**: gubin0814/falser-cloud ## Basic Information - **Project Name**: falser-cloud - **Description**: No description available - **Primary Language**: Java - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 16 - **Created**: 2022-08-27 - **Last Updated**: 2022-08-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # falser-cloud #### 介绍 基于用户角色权限完成得后台管理框架,使用docker部署,前端基于[vue-admin-template](https://gitee.com/panjiachen/vue-admin-template),权限认证采用[sa-Token](https://sa-token.dev33.cn/doc/index.html#/)使用docker+nginx部署 #### 系统模块 - 系统管理 1. 菜单管理 2. 角色管理 3. 用户管理 4. 数据字典 - 停车场系统 1. 会员管理 2. 停车位管理 3. 模拟出入场 4. 进出停车场信息 5. 停车订单信息 #### 前端代码在这儿 https://gitee.com/falser/f-backstage #### 后台管理系统体验 https://falser.top #### 软件架构 本项目基于Sa-token、Redis、Nacos、RabbitMq、Mybatis-plus、Mysql、SpringCloud-Alibaba-2.2.1.RELEASE、VUE #### 使用说明 1. 执行初始化sql 2. 安装Nacos、RabbitMQ、Redis 3. 修改配置文件 #### 权限配置代码 SaTokenConfigure.java ```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 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 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 ```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 ```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