Merge remote-tracking branch 'origin/dev' into satoken
# Conflicts:
# ruoyi-system/src/main/java/com/ruoyi/system/service/PermissionService.java
# ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java
# ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TokenServiceImpl.java
# ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserDetailsServiceImpl.java
| | |
| | | [](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/blob/master/LICENSE) |
| | | [](https://www.jetbrains.com/?from=RuoYi-Vue-Plus) |
| | | <br> |
| | | [](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus) |
| | | [](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus) |
| | | []() |
| | | []() |
| | | []() |
| | |
| | | ipv4_address: 172.30.0.54 |
| | | |
| | | ruoyi-server1: |
| | | image: "ruoyi/ruoyi-server:3.1.0" |
| | | image: "ruoyi/ruoyi-server:3.2.0" |
| | | container_name: ruoyi-server1 |
| | | environment: |
| | | # 时区上海 |
| | |
| | | ipv4_address: 172.30.0.60 |
| | | |
| | | ruoyi-server2: |
| | | image: "ruoyi/ruoyi-server:3.1.0" |
| | | image: "ruoyi/ruoyi-server:3.2.0" |
| | | container_name: ruoyi-server2 |
| | | environment: |
| | | # 时区上海 |
| | |
| | | ipv4_address: 172.30.0.61 |
| | | |
| | | ruoyi-monitor-admin: |
| | | image: "ruoyi/ruoyi-monitor-admin:3.1.0" |
| | | image: "ruoyi/ruoyi-monitor-admin:3.2.0" |
| | | container_name: ruoyi-monitor-admin |
| | | environment: |
| | | # 时区上海 |
| | |
| | | |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-vue-plus</artifactId> |
| | | <version>3.1.0</version> |
| | | <version>3.2.0</version> |
| | | |
| | | <name>RuoYi-Vue-Plus</name> |
| | | <url>https://gitee.com/JavaLionLi/RuoYi-Vue-Plus</url> |
| | | <description>RuoYi-Vue-Plus后台管理系统</description> |
| | | |
| | | <properties> |
| | | <ruoyi-vue-plus.version>3.1.0</ruoyi-vue-plus.version> |
| | | <ruoyi-vue-plus.version>3.2.0</ruoyi-vue-plus.version> |
| | | <spring-boot.version>2.5.5</spring-boot.version> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
| | |
| | | <parent> |
| | | <artifactId>ruoyi-vue-plus</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.1.0</version> |
| | | <version>3.2.0</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <packaging>jar</packaging> |
| | |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-war-plugin</artifactId> |
| | | <version>3.1.0</version> |
| | | <version>3.2.0</version> |
| | | <configuration> |
| | | <failOnMissingWebXml>false</failOnMissingWebXml> |
| | | <warName>${project.artifactId}</warName> |
| | |
| | | response.reset(); |
| | | response.addHeader("Access-Control-Allow-Origin", "*"); |
| | | response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
| | | FileUtils.setAttachmentResponseHeader(response, URLEncoder.encode(sysOss.getOriginalName(), StandardCharsets.UTF_8.toString())); |
| | | FileUtils.setAttachmentResponseHeader(response, sysOss.getOriginalName()); |
| | | response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8"); |
| | | long data; |
| | | try { |
| | |
| | | <parent> |
| | | <artifactId>ruoyi-vue-plus</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.1.0</version> |
| | | <version>3.2.0</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | |
| | | response.reset(); |
| | | response.addHeader("Access-Control-Allow-Origin", "*"); |
| | | response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
| | | FileUtils.setAttachmentResponseHeader(response, URLEncoder.encode(filename, StandardCharsets.UTF_8.toString())); |
| | | FileUtils.setAttachmentResponseHeader(response, filename); |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"); |
| | | ServletOutputStream os = response.getOutputStream(); |
| | | EasyExcel.write(os, clazz) |
| | |
| | | <parent> |
| | | <artifactId>ruoyi-vue-plus</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.1.0</version> |
| | | <version>3.2.0</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | |
| | | <parent> |
| | | <artifactId>ruoyi-vue-plus</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.1.0</version> |
| | | <version>3.2.0</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <artifactId>ruoyi-extend</artifactId> |
| | |
| | | <parent> |
| | | <artifactId>ruoyi-extend</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.1.0</version> |
| | | <version>3.2.0</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <packaging>jar</packaging> |
| | |
| | | <parent> |
| | | <artifactId>ruoyi-vue-plus</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.1.0</version> |
| | | <version>3.2.0</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | |
| | | <parent> |
| | | <artifactId>ruoyi-vue-plus</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.1.0</version> |
| | | <version>3.2.0</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | |
| | | <parent> |
| | | <artifactId>ruoyi-vue-plus</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.1.0</version> |
| | | <version>3.2.0</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | |
| | | <parent> |
| | | <artifactId>ruoyi-vue-plus</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.1.0</version> |
| | | <version>3.2.0</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | |
| | | <parent> |
| | | <artifactId>ruoyi-vue-plus</artifactId> |
| | | <groupId>com.ruoyi</groupId> |
| | | <version>3.1.0</version> |
| | | <version>3.2.0</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | |
| | | * @author ruoyi |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class SysLoginService |
| | | { |
| | | @Service |
| | | public class SysLoginService { |
| | | |
| | | @Autowired |
| | | private ISysUserService userService; |
| | |
| | | * @param uuid 唯一标识 |
| | | * @return 结果 |
| | | */ |
| | | public String login(String username, String password, String code, String uuid) |
| | | { |
| | | public String login(String username, String password, String code, String uuid) { |
| | | HttpServletRequest request = ServletUtils.getRequest(); |
| | | boolean captchaOnOff = configService.selectCaptchaOnOff(); |
| | | // 验证码开关 |
| | | if (captchaOnOff) |
| | | { |
| | | if (captchaOnOff) { |
| | | validateCaptcha(username, code, uuid, request); |
| | | } |
| | | SysUser user = userService.selectUserByUserName(username); |
| | | if (StringUtils.isNull(user)) |
| | | { |
| | | if (StringUtils.isNull(user)) { |
| | | log.info("登录用户:{} 不存在.", username); |
| | | throw new ServiceException("登录用户:" + username + " 不存在"); |
| | | } |
| | | else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) |
| | | { |
| | | } else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) { |
| | | log.info("登录用户:{} 已被删除.", username); |
| | | throw new ServiceException("对不起,您的账号:" + username + " 已被删除"); |
| | | } |
| | | else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) |
| | | { |
| | | } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { |
| | | log.info("登录用户:{} 已被停用.", username); |
| | | throw new ServiceException("对不起,您的账号:" + username + " 已停用"); |
| | | } |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | String encodePassword = passwordEncoder.encode(password); |
| | | if (SecurityUtils.matchesPassword(user.getPassword(), encodePassword)) |
| | | { |
| | | if (SecurityUtils.matchesPassword(user.getPassword(), encodePassword)) { |
| | | asyncService.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"), request); |
| | | throw new UserPasswordNotMatchException(); |
| | | } |
| | |
| | | * |
| | | * @param userId 用户ID |
| | | */ |
| | | public void recordLoginInfo(Long userId) |
| | | { |
| | | public void recordLoginInfo(Long userId) { |
| | | SysUser sysUser = new SysUser(); |
| | | sysUser.setUserId(userId); |
| | | sysUser.setLoginIp(ServletUtils.getClientIP()); |
| | |
| | | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class SysPermissionService |
| | | { |
| | | @Service |
| | | public class SysPermissionService { |
| | | |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | |
| | |
| | | * @param user 用户信息 |
| | | * @return 角色权限信息 |
| | | */ |
| | | public Set<String> getRolePermission(SysUser user) |
| | | { |
| | | public Set<String> getRolePermission(SysUser user) { |
| | | Set<String> roles = new HashSet<String>(); |
| | | // 管理员拥有所有权限 |
| | | if (user.isAdmin()) |
| | | { |
| | | if (user.isAdmin()) { |
| | | roles.add("admin"); |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId())); |
| | | } |
| | | return roles; |
| | |
| | | * @param user 用户信息 |
| | | * @return 菜单权限信息 |
| | | */ |
| | | public Set<String> getMenuPermission(SysUser user) |
| | | { |
| | | public Set<String> getMenuPermission(SysUser user) { |
| | | Set<String> perms = new HashSet<String>(); |
| | | // 管理员拥有所有权限 |
| | | if (user.isAdmin()) |
| | | { |
| | | if (user.isAdmin()) { |
| | | perms.add("*:*:*"); |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId())); |
| | | } |
| | | return perms; |
| | |
| | | import com.ruoyi.common.exception.user.CaptchaExpireException; |
| | | import com.ruoyi.common.utils.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 注册校验方法 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class SysRegisterService |
| | | { |
| | | @Service |
| | | public class SysRegisterService { |
| | | |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | |
| | | /** |
| | | * 注册 |
| | | */ |
| | | public String register(RegisterBody registerBody) |
| | | { |
| | | public String register(RegisterBody registerBody) { |
| | | String msg = "", username = registerBody.getUsername(), password = registerBody.getPassword(); |
| | | |
| | | boolean captchaOnOff = configService.selectCaptchaOnOff(); |
| | | // 验证码开关 |
| | | if (captchaOnOff) |
| | | { |
| | | if (captchaOnOff) { |
| | | validateCaptcha(username, registerBody.getCode(), registerBody.getUuid()); |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(username)) |
| | | { |
| | | if (StringUtils.isEmpty(username)) { |
| | | msg = "用户名不能为空"; |
| | | } |
| | | else if (StringUtils.isEmpty(password)) |
| | | { |
| | | } else if (StringUtils.isEmpty(password)) { |
| | | msg = "用户密码不能为空"; |
| | | } |
| | | else if (username.length() < UserConstants.USERNAME_MIN_LENGTH |
| | | || username.length() > UserConstants.USERNAME_MAX_LENGTH) |
| | | { |
| | | } else if (username.length() < UserConstants.USERNAME_MIN_LENGTH |
| | | || username.length() > UserConstants.USERNAME_MAX_LENGTH) { |
| | | msg = "账户长度必须在2到20个字符之间"; |
| | | } |
| | | else if (password.length() < UserConstants.PASSWORD_MIN_LENGTH |
| | | || password.length() > UserConstants.PASSWORD_MAX_LENGTH) |
| | | { |
| | | } else if (password.length() < UserConstants.PASSWORD_MIN_LENGTH |
| | | || password.length() > UserConstants.PASSWORD_MAX_LENGTH) { |
| | | msg = "密码长度必须在5到20个字符之间"; |
| | | } |
| | | else if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(username))) |
| | | { |
| | | } else if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(username))) { |
| | | msg = "保存用户'" + username + "'失败,注册账号已存在"; |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | SysUser sysUser = new SysUser(); |
| | | sysUser.setUserName(username); |
| | | sysUser.setNickName(username); |
| | | sysUser.setPassword(SecurityUtils.encryptPassword(registerBody.getPassword())); |
| | | boolean regFlag = userService.registerUser(sysUser); |
| | | if (!regFlag) |
| | | { |
| | | if (!regFlag) { |
| | | msg = "注册失败,请联系系统管理人员"; |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | asyncService.recordLogininfor(username, Constants.REGISTER, |
| | | MessageUtils.message("user.register.success"), ServletUtils.getRequest()); |
| | | } |
| | |
| | | * @param uuid 唯一标识 |
| | | * @return 结果 |
| | | */ |
| | | public void validateCaptcha(String username, String code, String uuid) |
| | | { |
| | | public void validateCaptcha(String username, String code, String uuid) { |
| | | String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; |
| | | String captcha = RedisUtils.getCacheObject(verifyKey); |
| | | RedisUtils.deleteObject(verifyKey); |
| | | if (captcha == null) |
| | | { |
| | | if (captcha == null) { |
| | | throw new CaptchaExpireException(); |
| | | } |
| | | if (!code.equalsIgnoreCase(captcha)) |
| | | { |
| | | if (!code.equalsIgnoreCase(captcha)) { |
| | | throw new CaptchaException(); |
| | | } |
| | | } |
| | |
| | | { |
| | | "name": "ruoyi-vue-plus", |
| | | "version": "3.1.0", |
| | | "version": "3.2.0", |
| | | "description": "RuoYi-Vue-Plus后台管理系统", |
| | | "author": "LionLi", |
| | | "license": "MIT", |
| | |
| | | "eslint-plugin-vue": "7.2.0", |
| | | "lint-staged": "10.5.3", |
| | | "runjs": "4.4.2", |
| | | "sass": "1.42.1", |
| | | "sass-loader": "10.1.0", |
| | | "sass": "1.32.13", |
| | | "sass-loader": "10.1.1", |
| | | "script-ext-html-webpack-plugin": "2.1.5", |
| | | "svg-sprite-loader": "5.1.1", |
| | | "vue-template-compiler": "2.6.12" |
| | |
| | | this.saveAs(blob, decodeURI(res.headers['download-filename'])) |
| | | }) |
| | | }, |
| | | oss(ossId, name) { |
| | | oss(ossId) { |
| | | var url = baseURL + '/system/oss/download/' + ossId |
| | | axios({ |
| | | method: 'get', |
| | |
| | | headers: { 'Authorization': 'Bearer ' + getToken() } |
| | | }).then(res => { |
| | | const blob = new Blob([res.data], { type: 'application/octet-stream' }) |
| | | this.saveAs(blob, name) |
| | | this.saveAs(blob, decodeURI(res.headers['download-filename'])) |
| | | }) |
| | | }, |
| | | zip(url, name) { |
| | |
| | | <span>更新日志</span> |
| | | </div> |
| | | <el-collapse accordion> |
| | | <el-collapse-item title="v3.2.0 - 2021-9-28"> |
| | | <ol> |
| | | <li>update [重大改动]接口文档 支持分组配置</li> |
| | | <li>update [重大改动]security 路径配置抽取到配置文件</li> |
| | | <li>update [重大改动] 将 framework 与 system 模块 解耦 调整依赖结构 解决依赖冲突</li> |
| | | <li>update [重大改动]重写 防重提交实现 使用分布式锁 解决并发问题 压测通过</li> |
| | | <li>update springboot 2.5.4 => 2.5.5 bugfix版本</li> |
| | | <li>update mybatis-plus 3.4.3.3 => 3.4.3.4 bugfix版本</li> |
| | | <li>update redisson 3.16.2 => 3.16.3 bugfix版本</li> |
| | | <li>update easyexcel 2.2.10 => 2.2.11</li> |
| | | <li>update hutool 5.7.11 => 5.7.13</li> |
| | | <li>update file-saver 2.0.4 => 2.0.5</li> |
| | | <li>update dart-sass 1.32.0 => 1.32.13</li> |
| | | <li>update sass-loader 10.1.0 => 10.1.1</li> |
| | | <li>update 优化代码生成 根据MP生成特性 调整导入表结构默认值合理化</li> |
| | | <li>update 将所有 云存储字样 改为 对象存储 避免误解</li> |
| | | <li>update 更新 @Cacheable 错误用法 注意事项</li> |
| | | <li>update 优化 AddressUtils 空校验处理</li> |
| | | <li>update 菜单管理支持配置路由参数</li> |
| | | <li>update 优化aop语法 使用spring自动注入注解</li> |
| | | <li>update 使用 Redisson 限流工具 重写限流实现</li> |
| | | <li>update 使用 vue-data-dict 简化数据字典使用</li> |
| | | <li>update 增加日志注解新增是否保存响应参数开关</li> |
| | | <li>update 用户未登录日志改为 warn 级别</li> |
| | | <li>update OSS模块 关于下载403报错信息优化</li> |
| | | <li>update 更新 Actuator prod 默认暴漏端点 增加暴漏 logfile 日志端点</li> |
| | | <li>update 默认适配jdk11 测试 jdk17 无异常</li> |
| | | <li>update 封装通用下载方法简化下载使用</li> |
| | | <li>add 新增通用方法简化模态/缓存使用</li> |
| | | <li>add 增加 限流演示案例</li> |
| | | <li>add 增加 redis redisson 集群配置</li> |
| | | <li>fix Cron表达式生成器关闭时销毁,避免再次打开时存在上一次修改的数据</li> |
| | | <li>fix 全局限流key会多出一个"-" 将其移动到IP后面 去除多余的空格</li> |
| | | <li>fix 修复多主键代码生成bug</li> |
| | | <li>fix 修复 @Cacheable 与 @DataScope 冲突问题</li> |
| | | <li>fix 修复代码生成页面数据编辑保存之后总是跳转第一页的问题</li> |
| | | <li>remove 移除过期工具 RedisCache</li> |
| | | <li>remove 移除无用配置类 ServerConfig</li> |
| | | <li>remove 移除 SysUser 无用字段 salt</li> |
| | | </ol> |
| | | </el-collapse-item> |
| | | <el-collapse-item title="v3.1.0 - 2021-9-7"> |
| | | <ol> |
| | | <li>add [重大改动] 过期 RedisCache 新增 RedisUtils 工具类 新增 发布订阅功能 更灵巧便于使用</li> |