Spring Boot升级到V3.1.5、redisson升级到V3.23.5
This commit is contained in:
parent
a81387422f
commit
f6d699ce2e
4
pom.xml
4
pom.xml
@ -17,7 +17,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>17</java.version>
|
<java.version>17</java.version>
|
||||||
<spring-boot.version>3.1.4</spring-boot.version>
|
<spring-boot.version>3.1.5</spring-boot.version>
|
||||||
<mybatis-flex.version>1.7.2</mybatis-flex.version>
|
<mybatis-flex.version>1.7.2</mybatis-flex.version>
|
||||||
<satoken.version>1.37.0</satoken.version>
|
<satoken.version>1.37.0</satoken.version>
|
||||||
<mysql.version>8.0.33</mysql.version>
|
<mysql.version>8.0.33</mysql.version>
|
||||||
@ -45,7 +45,7 @@
|
|||||||
<mapstruct-plus.version>1.3.5</mapstruct-plus.version>
|
<mapstruct-plus.version>1.3.5</mapstruct-plus.version>
|
||||||
<mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version>
|
<mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version>
|
||||||
<hutool.version>5.8.22</hutool.version>
|
<hutool.version>5.8.22</hutool.version>
|
||||||
<redisson.version>3.23.3</redisson.version>
|
<redisson.version>3.23.5</redisson.version>
|
||||||
<lock4j.version>2.2.4</lock4j.version>
|
<lock4j.version>2.2.4</lock4j.version>
|
||||||
<alibaba-ttl.version>2.14.3</alibaba-ttl.version>
|
<alibaba-ttl.version>2.14.3</alibaba-ttl.version>
|
||||||
<spring-boot-admin.version>3.1.6</spring-boot-admin.version>
|
<spring-boot-admin.version>3.1.6</spring-boot-admin.version>
|
||||||
|
@ -40,7 +40,6 @@ public class LoginBody
|
|||||||
/**
|
/**
|
||||||
* 租户ID
|
* 租户ID
|
||||||
*/
|
*/
|
||||||
//@NotBlank(message = "{tenant.number.not.blank}")
|
|
||||||
private Long tenantId;
|
private Long tenantId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,6 +26,7 @@ public class RedisUtils {
|
|||||||
|
|
||||||
private static final RedissonClient CLIENT = SpringUtils.getBean(RedissonClient.class);
|
private static final RedissonClient CLIENT = SpringUtils.getBean(RedissonClient.class);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 限流
|
* 限流
|
||||||
*
|
*
|
||||||
|
@ -34,6 +34,7 @@ public class LoginHelper {
|
|||||||
public static final String LOGIN_USER_KEY = "loginUser";
|
public static final String LOGIN_USER_KEY = "loginUser";
|
||||||
public static final String TENANT_KEY = "tenantId";
|
public static final String TENANT_KEY = "tenantId";
|
||||||
public static final String USER_KEY = "userId";
|
public static final String USER_KEY = "userId";
|
||||||
|
public static final String DEPT_KEY = "deptId";
|
||||||
public static final String CLIENT_KEY = "clientid";
|
public static final String CLIENT_KEY = "clientid";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,11 +49,13 @@ public class LoginHelper {
|
|||||||
storage.set(LOGIN_USER_KEY, loginUser);
|
storage.set(LOGIN_USER_KEY, loginUser);
|
||||||
storage.set(TENANT_KEY, loginUser.getTenantId());
|
storage.set(TENANT_KEY, loginUser.getTenantId());
|
||||||
storage.set(USER_KEY, loginUser.getUserId());
|
storage.set(USER_KEY, loginUser.getUserId());
|
||||||
|
storage.set(DEPT_KEY, loginUser.getDeptId());
|
||||||
model = ObjectUtil.defaultIfNull(model, new SaLoginModel());
|
model = ObjectUtil.defaultIfNull(model, new SaLoginModel());
|
||||||
//登录,生成token
|
//登录,生成token
|
||||||
StpUtil.login(loginUser.getLoginId(),
|
StpUtil.login(loginUser.getLoginId(),
|
||||||
model.setExtra(TENANT_KEY, loginUser.getTenantId())
|
model.setExtra(TENANT_KEY, loginUser.getTenantId())
|
||||||
.setExtra(USER_KEY, loginUser.getUserId()));
|
.setExtra(USER_KEY, loginUser.getUserId())
|
||||||
|
.setExtra(DEPT_KEY, loginUser.getDeptId()));
|
||||||
StpUtil.getSession().set(LOGIN_USER_KEY, loginUser);
|
StpUtil.getSession().set(LOGIN_USER_KEY, loginUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,41 +92,35 @@ public class LoginHelper {
|
|||||||
* 获取用户id
|
* 获取用户id
|
||||||
*/
|
*/
|
||||||
public static Long getUserId() {
|
public static Long getUserId() {
|
||||||
Long userId;
|
return Convert.toLong(getExtra(USER_KEY));
|
||||||
try {
|
|
||||||
userId = Convert.toLong(SaHolder.getStorage().get(USER_KEY));
|
|
||||||
if (ObjectUtil.isNull(userId)) {
|
|
||||||
userId = Convert.toLong(StpUtil.getExtra(USER_KEY));
|
|
||||||
SaHolder.getStorage().set(USER_KEY, userId);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return userId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取租户ID
|
* 获取租户ID
|
||||||
*/
|
*/
|
||||||
public static String getTenantId() {
|
public static String getTenantId() {
|
||||||
String tenantId;
|
return Convert.toStr(getExtra(TENANT_KEY));
|
||||||
try {
|
|
||||||
tenantId = (String) SaHolder.getStorage().get(TENANT_KEY);
|
|
||||||
if (ObjectUtil.isNull(tenantId)) {
|
|
||||||
tenantId = (String) StpUtil.getExtra(TENANT_KEY);
|
|
||||||
SaHolder.getStorage().set(TENANT_KEY, tenantId);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return tenantId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取部门ID
|
* 获取部门ID
|
||||||
*/
|
*/
|
||||||
public static Long getDeptId() {
|
public static Long getDeptId() {
|
||||||
return getLoginUser().getDeptId();
|
return Convert.toLong(getExtra(DEPT_KEY));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Object getExtra(String key) {
|
||||||
|
Object obj;
|
||||||
|
try {
|
||||||
|
obj = SaHolder.getStorage().get(key);
|
||||||
|
if (ObjectUtil.isNull(obj)) {
|
||||||
|
obj = StpUtil.getExtra(key);
|
||||||
|
SaHolder.getStorage().set(key, obj);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,8 +72,8 @@ public class SysConfigController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:config:query")
|
@SaCheckPermission("system:config:query")
|
||||||
@GetMapping(value = "/configKey/{configKey}")
|
@GetMapping(value = "/configKey/{configKey}")
|
||||||
public R<Void> getConfigKey(@PathVariable String configKey) {
|
public R<String> getConfigKey(@PathVariable String configKey) {
|
||||||
return R.ok(configService.selectConfigByKey(configKey));
|
return R.ok("操作成功", configService.selectConfigByKey(configKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -175,6 +175,7 @@ public class SysUserController extends BaseController {
|
|||||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public R<Void> add(@Validated @RequestBody SysUserBo userBo) {
|
public R<Void> add(@Validated @RequestBody SysUserBo userBo) {
|
||||||
|
deptService.checkDeptDataScope(userBo.getDeptId());
|
||||||
if (!userService.checkUserNameUnique(userBo)) {
|
if (!userService.checkUserNameUnique(userBo)) {
|
||||||
return R.fail("新增用户'" + userBo.getUserName() + "'失败,登录账号已存在");
|
return R.fail("新增用户'" + userBo.getUserName() + "'失败,登录账号已存在");
|
||||||
} else if (StringUtils.isNotEmpty(userBo.getPhonenumber()) && !userService.checkPhoneUnique(userBo)) {
|
} else if (StringUtils.isNotEmpty(userBo.getPhonenumber()) && !userService.checkPhoneUnique(userBo)) {
|
||||||
@ -199,6 +200,7 @@ public class SysUserController extends BaseController {
|
|||||||
public R<Void> edit(@Validated @RequestBody SysUserBo userBo) {
|
public R<Void> edit(@Validated @RequestBody SysUserBo userBo) {
|
||||||
userService.checkUserAllowed(userBo.getUserId());
|
userService.checkUserAllowed(userBo.getUserId());
|
||||||
userService.checkUserDataScope(userBo.getUserId());
|
userService.checkUserDataScope(userBo.getUserId());
|
||||||
|
deptService.checkDeptDataScope(userBo.getDeptId());
|
||||||
if (!userService.checkUserNameUnique(userBo)) {
|
if (!userService.checkUserNameUnique(userBo)) {
|
||||||
return R.fail("修改用户'" + userBo.getUserName() + "'失败,登录账号已存在");
|
return R.fail("修改用户'" + userBo.getUserName() + "'失败,登录账号已存在");
|
||||||
} else if (StringUtils.isNotEmpty(userBo.getPhonenumber()) && !userService.checkPhoneUnique(userBo)) {
|
} else if (StringUtils.isNotEmpty(userBo.getPhonenumber()) && !userService.checkPhoneUnique(userBo)) {
|
||||||
|
@ -21,6 +21,7 @@ import com.ruoyi.common.orm.core.service.impl.BaseServiceImpl;
|
|||||||
import com.ruoyi.common.security.utils.LoginHelper;
|
import com.ruoyi.common.security.utils.LoginHelper;
|
||||||
import com.ruoyi.system.domain.*;
|
import com.ruoyi.system.domain.*;
|
||||||
import com.ruoyi.system.domain.bo.SysUserBo;
|
import com.ruoyi.system.domain.bo.SysUserBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysDeptVo;
|
||||||
import com.ruoyi.system.domain.vo.SysPostVo;
|
import com.ruoyi.system.domain.vo.SysPostVo;
|
||||||
import com.ruoyi.system.domain.vo.SysRoleVo;
|
import com.ruoyi.system.domain.vo.SysRoleVo;
|
||||||
import com.ruoyi.system.domain.vo.SysUserVo;
|
import com.ruoyi.system.domain.vo.SysUserVo;
|
||||||
|
Loading…
Reference in New Issue
Block a user