Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into 4.X
Browse files Browse the repository at this point in the history
  • Loading branch information
JavaLionLi committed Sep 25, 2023
2 parents 952cd0b + cc40f9c commit e5661a2
Show file tree
Hide file tree
Showing 74 changed files with 398 additions and 269 deletions.
2 changes: 1 addition & 1 deletion .run/ruoyi-monitor-admin.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration default="false" name="ruoyi-monitor-admin" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="ruoyi/ruoyi-monitor-admin:4.8.0" />
<option name="imageTag" value="ruoyi/ruoyi-monitor-admin:4.8.1" />
<option name="buildOnly" value="true" />
<option name="sourceFilePath" value="ruoyi-extend/ruoyi-monitor-admin/Dockerfile" />
</settings>
Expand Down
2 changes: 1 addition & 1 deletion .run/ruoyi-server.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration default="false" name="ruoyi-server" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="ruoyi/ruoyi-server:4.8.0" />
<option name="imageTag" value="ruoyi/ruoyi-server:4.8.1" />
<option name="buildOnly" value="true" />
<option name="sourceFilePath" value="ruoyi-admin/Dockerfile" />
</settings>
Expand Down
2 changes: 1 addition & 1 deletion .run/ruoyi-xxl-job-admin.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration default="false" name="ruoyi-xxl-job-admin" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="ruoyi/ruoyi-xxl-job-admin:4.8.0" />
<option name="imageTag" value="ruoyi/ruoyi-xxl-job-admin:4.8.1" />
<option name="buildOnly" value="true" />
<option name="sourceFilePath" value="ruoyi-extend/ruoyi-xxl-job-admin/Dockerfile" />
</settings>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://gitee.com/dromara/RuoYi-Vue-Plus/blob/master/LICENSE)
[![使用IntelliJ IDEA开发维护](https://img.shields.io/badge/IntelliJ%20IDEA-提供支持-blue.svg)](https://www.jetbrains.com/?from=RuoYi-Vue-Plus)
<br>
[![RuoYi-Vue-Plus](https://img.shields.io/badge/RuoYi_Vue_Plus-4.8.0-success.svg)](https://gitee.com/dromara/RuoYi-Vue-Plus)
[![RuoYi-Vue-Plus](https://img.shields.io/badge/RuoYi_Vue_Plus-4.8.1-success.svg)](https://gitee.com/dromara/RuoYi-Vue-Plus)
[![Spring Boot](https://img.shields.io/badge/Spring%20Boot-2.7-blue.svg)]()
[![JDK-8+](https://img.shields.io/badge/JDK-8-green.svg)]()
[![JDK-11](https://img.shields.io/badge/JDK-11-green.svg)]()
Expand Down
18 changes: 9 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@

<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-vue-plus</artifactId>
<version>4.8.0</version>
<version>4.8.1</version>

<name>RuoYi-Vue-Plus</name>
<url>https://gitee.com/dromara/RuoYi-Vue-Plus</url>
<description>RuoYi-Vue-Plus后台管理系统</description>

<properties>
<ruoyi-vue-plus.version>4.8.0</ruoyi-vue-plus.version>
<spring-boot.version>2.7.13</spring-boot.version>
<ruoyi-vue-plus.version>4.8.1</ruoyi-vue-plus.version>
<spring-boot.version>2.7.16</spring-boot.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
<spring-boot.mybatis>2.2.2</spring-boot.mybatis>
<springdoc.version>1.6.15</springdoc.version>
<poi.version>5.2.3</poi.version>
<easyexcel.version>3.3.1</easyexcel.version>
<easyexcel.version>3.3.2</easyexcel.version>
<velocity.version>2.3</velocity.version>
<satoken.version>1.35.0.RC</satoken.version>
<mybatis-plus.version>3.5.3.1</mybatis-plus.version>
<satoken.version>1.36.0</satoken.version>
<mybatis-plus.version>3.5.3.2</mybatis-plus.version>
<p6spy.version>3.9.1</p6spy.version>
<hutool.version>5.8.18</hutool.version>
<hutool.version>5.8.20</hutool.version>
<okhttp.version>4.10.0</okhttp.version>
<spring-boot-admin.version>2.7.10</spring-boot-admin.version>
<spring-boot-admin.version>2.7.11</spring-boot-admin.version>
<redisson.version>3.20.1</redisson.version>
<lock4j.version>2.2.3</lock4j.version>
<dynamic-ds.version>3.5.2</dynamic-ds.version>
<alibaba-ttl.version>2.14.2</alibaba-ttl.version>
<xxl-job.version>2.4.0</xxl-job.version>
<lombok.version>1.18.26</lombok.version>
<lombok.version>1.18.30</lombok.version>
<bouncycastle.version>1.72</bouncycastle.version>
<!-- 离线IP地址定位库 -->
<ip2region.version>2.7.0</ip2region.version>
Expand Down
2 changes: 1 addition & 1 deletion ruoyi-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ruoyi-vue-plus</artifactId>
<groupId>com.ruoyi</groupId>
<version>4.8.0</version>
<version>4.8.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,12 @@ public R<Void> edit(@Validated @RequestBody SysDept dept) {
return R.fail("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
} else if (dept.getParentId().equals(deptId)) {
return R.fail("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
&& deptService.selectNormalChildrenDeptById(deptId) > 0) {
return R.fail("该部门包含未停用的子部门!");
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())) {
if (deptService.selectNormalChildrenDeptById(deptId) > 0) {
return R.fail("该部门包含未停用的子部门!");
} else if (deptService.checkDeptExistUser(deptId)) {
return R.fail("该部门下存在已分配用户,不能禁用!");
}
}
return toAjax(deptService.updateDept(dept));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ public R<Void> edit(@Validated @RequestBody SysPost post) {
return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
} else if (!postService.checkPostCodeUnique(post)) {
return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
} else if (UserConstants.POST_DISABLE.equals(post.getStatus())
&& postService.countUserPostById(post.getPostId()) > 0) {
return R.fail("该岗位下存在已分配用户,不能禁用!");
}
return toAjax(postService.updatePost(post));
}
Expand All @@ -109,7 +112,9 @@ public R<Void> remove(@PathVariable Long[] postIds) {
*/
@GetMapping("/optionselect")
public R<List<SysPost>> optionselect() {
List<SysPost> posts = postService.selectPostAll();
SysPost post = new SysPost();
post.setStatus(UserConstants.POST_NORMAL);
List<SysPost> posts = postService.selectPostList(post);
return R.ok(posts);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public R<Void> updateProfile(@RequestBody SysUser user) {
/**
* 重置密码
*
* @param newPassword 旧密码
* @param oldPassword 新密码
* @param newPassword 新密码
* @param oldPassword 旧密码
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.ruoyi.common.utils.StreamUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.domain.vo.SysUserExportVo;
import com.ruoyi.system.domain.vo.SysUserImportVo;
import com.ruoyi.system.listener.SysUserImportListener;
Expand Down Expand Up @@ -117,9 +118,13 @@ public void importTemplate(HttpServletResponse response) {
public R<Map<String, Object>> getInfo(@PathVariable(value = "userId", required = false) Long userId) {
userService.checkUserDataScope(userId);
Map<String, Object> ajax = new HashMap<>();
List<SysRole> roles = roleService.selectRoleAll();
SysRole role = new SysRole();
role.setStatus(UserConstants.ROLE_NORMAL);
SysPost post = new SysPost();
post.setStatus(UserConstants.POST_NORMAL);
List<SysRole> roles = roleService.selectRoleList(role);
ajax.put("roles", LoginHelper.isAdmin(userId) ? roles : StreamUtils.filter(roles, r -> !r.isAdmin()));
ajax.put("posts", postService.selectPostAll());
ajax.put("posts", postService.selectPostList(post));
if (ObjectUtil.isNotNull(userId)) {
SysUser sysUser = userService.selectUserById(userId);
ajax.put("user", sysUser);
Expand All @@ -136,6 +141,7 @@ public R<Map<String, Object>> getInfo(@PathVariable(value = "userId", required =
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping
public R<Void> add(@Validated @RequestBody SysUser user) {
deptService.checkDeptDataScope(user.getDeptId());
if (!userService.checkUserNameUnique(user)) {
return R.fail("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
Expand All @@ -156,6 +162,7 @@ public R<Void> add(@Validated @RequestBody SysUser user) {
public R<Void> edit(@Validated @RequestBody SysUser user) {
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
deptService.checkDeptDataScope(user.getDeptId());
if (!userService.checkUserNameUnique(user)) {
return R.fail("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
Expand Down
4 changes: 2 additions & 2 deletions ruoyi-admin/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ xxl.job:
executor:
# 执行器AppName:执行器心跳注册分组依据;为空则关闭自动注册
appname: xxl-job-executor
# 执行器端口号 执行器从9101开始往后写
port: 9101
# 28080 端口 随着主应用端口飘逸 避免集群冲突
port: 2${server.port}
# 执行器注册:默认IP:PORT
address:
# 执行器IP:默认自动获取IP
Expand Down
4 changes: 2 additions & 2 deletions ruoyi-admin/src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ xxl.job:
executor:
# 执行器AppName:执行器心跳注册分组依据;为空则关闭自动注册
appname: xxl-job-executor
# 执行器端口号 执行器从9101开始往后写
port: 9101
# 28080 端口 随着主应用端口飘逸 避免集群冲突
port: 2${server.port}
# 执行器注册:默认IP:PORT
address:
# 执行器IP:默认自动获取IP
Expand Down
8 changes: 3 additions & 5 deletions ruoyi-admin/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ ruoyi:
# 版本
version: ${ruoyi-vue-plus.version}
# 版权年份
copyrightYear: 2022
# 实例演示开关
demoEnabled: true
# 获取ip地址开关
addressEnabled: true
copyrightYear: 2023
# 缓存懒加载
cacheLazy: false

Expand Down Expand Up @@ -107,6 +103,8 @@ sa-token:
# 多端不同 token 有效期 可查看 LoginHelper.loginByDevice 方法自定义
# token最低活跃时间 (指定时间无操作就过期) 单位: 秒
active-timeout: 1800
# 允许动态设置 token 有效期
dynamic-active-timeout: true
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
is-concurrent: true
# 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
Expand Down
2 changes: 1 addition & 1 deletion ruoyi-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ruoyi-vue-plus</artifactId>
<groupId>com.ruoyi</groupId>
<version>4.8.0</version>
<version>4.8.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.ruoyi.common.config;

import lombok.Data;
import lombok.Getter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

Expand Down Expand Up @@ -31,24 +30,9 @@ public class RuoYiConfig {
*/
private String copyrightYear;

/**
* 实例演示开关
*/
private boolean demoEnabled;

/**
* 缓存懒加载
*/
private boolean cacheLazy;

/**
* 获取地址开关
*/
@Getter
private static boolean addressEnabled;

public void setAddressEnabled(boolean addressEnabled) {
RuoYiConfig.addressEnabled = addressEnabled;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ public interface UserConstants {
*/
String DEPT_DISABLE = "1";

/**
* 岗位正常状态
*/
String POST_NORMAL = "0";

/**
* 岗位停用状态
*/
String POST_DISABLE = "1";

/**
* 字典正常状态
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@ default <P extends IPage<V>> P selectVoPage(IPage<T> page, Wrapper<T> wrapper) {
* 分页查询VO
*/
default <C, P extends IPage<C>> P selectVoPage(IPage<T> page, Wrapper<T> wrapper, Class<C> voClass) {
IPage<T> pageData = this.selectPage(page, wrapper);
IPage<C> voPage = new Page<>(pageData.getCurrent(), pageData.getSize(), pageData.getTotal());
if (CollUtil.isEmpty(pageData.getRecords())) {
List<T> list = this.selectList(page, wrapper);
IPage<C> voPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal());
if (CollUtil.isEmpty(list)) {
return (P) voPage;
}
voPage.setRecords(BeanCopyUtils.copyList(pageData.getRecords(), voClass));
voPage.setRecords(BeanCopyUtils.copyList(list, voClass));
return (P) voPage;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
package com.ruoyi.common.encrypt.encryptor;

import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.symmetric.AES;
import com.ruoyi.common.encrypt.EncryptContext;
import com.ruoyi.common.enums.AlgorithmType;
import com.ruoyi.common.enums.EncodeType;

import java.nio.charset.StandardCharsets;
import com.ruoyi.common.utils.EncryptUtils;

/**
* AES算法实现
Expand All @@ -18,20 +13,11 @@
*/
public class AesEncryptor extends AbstractEncryptor {

private final AES aes;
private final EncryptContext context;

public AesEncryptor(EncryptContext context) {
super(context);
String password = context.getPassword();
if (StrUtil.isBlank(password)) {
throw new IllegalArgumentException("AES没有获得秘钥信息");
}
// aes算法的秘钥要求是16位、24位、32位
int[] array = {16, 24, 32};
if (!ArrayUtil.contains(array, password.length())) {
throw new IllegalArgumentException("AES秘钥长度应该为16位、24位、32位,实际为" + password.length() + "位");
}
aes = SecureUtil.aes(context.getPassword().getBytes(StandardCharsets.UTF_8));
this.context = context;
}

/**
Expand All @@ -51,9 +37,9 @@ public AlgorithmType algorithm() {
@Override
public String encrypt(String value, EncodeType encodeType) {
if (encodeType == EncodeType.HEX) {
return aes.encryptHex(value);
return EncryptUtils.encryptByAesHex(value, context.getPassword());
} else {
return aes.encryptBase64(value);
return EncryptUtils.encryptByAes(value, context.getPassword());
}
}

Expand All @@ -64,6 +50,6 @@ public String encrypt(String value, EncodeType encodeType) {
*/
@Override
public String decrypt(String value) {
return this.aes.decryptStr(value);
return EncryptUtils.decryptByAes(value, context.getPassword());
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.ruoyi.common.encrypt.encryptor;

import cn.hutool.core.codec.Base64;
import com.ruoyi.common.encrypt.EncryptContext;
import com.ruoyi.common.enums.AlgorithmType;
import com.ruoyi.common.enums.EncodeType;
import com.ruoyi.common.utils.EncryptUtils;

/**
* Base64算法实现
Expand Down Expand Up @@ -33,7 +33,7 @@ public AlgorithmType algorithm() {
*/
@Override
public String encrypt(String value, EncodeType encodeType) {
return Base64.encode(value);
return EncryptUtils.encryptByBase64(value);
}

/**
Expand All @@ -43,6 +43,6 @@ public String encrypt(String value, EncodeType encodeType) {
*/
@Override
public String decrypt(String value) {
return Base64.decodeStr(value);
return EncryptUtils.decryptByBase64(value);
}
}
Loading

0 comments on commit e5661a2

Please sign in to comment.