|
|
|
@ -151,6 +151,9 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
if(user == null){
|
|
|
|
|
throw new CredentialsException("用户不存在");
|
|
|
|
|
}
|
|
|
|
|
// 判断会话模式
|
|
|
|
|
checkSessionMode(user.getId());
|
|
|
|
|
|
|
|
|
|
packSessionUser(sessionUser, user, user.getUserType(),loginPlatform, languageCode,deviceId);
|
|
|
|
|
packConfigSessionUser(sessionUser, user);
|
|
|
|
|
AuthUtil.setSessionUser(sessionUser);
|
|
|
|
@ -160,6 +163,24 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
return sessionUser;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void checkSessionMode(Long userId){
|
|
|
|
|
int sessionMode = RedisCacheTool.getSysConfigIntVal(CommonConstWords.CONFIG_SESSION_MODE,
|
|
|
|
|
CommonEnumUtil.SESSION_MODE.OVERWRITE.getValue());
|
|
|
|
|
if (sessionMode == CommonEnumUtil.SESSION_MODE.SEIZE.getValue()) {
|
|
|
|
|
String redisKey = CommonConstWords.SESSION_USER + ":*_" + userId;
|
|
|
|
|
List<Object> ds = redisSession.scan(redisKey);
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(ds)) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.LOGIN_EXCEPTION_LOGGED.getCode())
|
|
|
|
|
.setErrorDetail("用户已在其他设备登录,无法同时登录!")
|
|
|
|
|
.setErrorSolution("请联系管理员")
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseToken getToken(String loginName, String password, String languageCode, Integer loginPlatform) {
|
|
|
|
|
SysUser user = this.getSysUserByLoginName(loginName);
|
|
|
|
@ -670,7 +691,7 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
if(configPageSize != null && StringUtils.isNotBlank(configPageSize.getConfigValue())){
|
|
|
|
|
sessionUser.setPageDefaultSize(Integer.parseInt(configPageSize.getConfigValue()));
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
}catch (Exception ignored){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(sessionUser.getPageDefaultSize() == null || sessionUser.getPageDefaultSize() <= 0){
|
|
|
|
@ -781,7 +802,11 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
List<SysRole> roleList = roleService.findByIdList(ids);
|
|
|
|
|
roleList.forEach(role -> menuIdList.addAll(role.getMenuIdList()));
|
|
|
|
|
roleList.forEach(role -> {
|
|
|
|
|
if (role.getMenuIdList() != null) {
|
|
|
|
|
menuIdList.addAll(role.getMenuIdList());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
List<SysMenu> menuList = menuService.findByIdList(new ArrayList<>(menuIdList));
|
|
|
|
|
if(CollectionUtils.isNotEmpty(menuList)){
|
|
|
|
|
for (SysMenu menu : menuList) {
|
|
|
|
|