|
|
@ -28,6 +28,7 @@ import cn.estsh.i3plus.pojo.platform.repository.SysUserInfoRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.SysUserRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.repository.SysUserRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack;
|
|
|
|
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack;
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
|
|
|
|
import cn.estsh.impp.framework.boot.auth.filter.UserFilter;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
import cn.estsh.impp.framework.boot.util.*;
|
|
|
|
import cn.estsh.impp.framework.boot.util.*;
|
|
|
@ -130,7 +131,6 @@ public class SysUserService implements ISysUserService {
|
|
|
|
SysUser user = null;
|
|
|
|
SysUser user = null;
|
|
|
|
ResultBean resultBean = ResultBean.fail();
|
|
|
|
ResultBean resultBean = ResultBean.fail();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
BaseToken token = getToken(loginName, password, languageCode, loginPlatform);
|
|
|
|
|
|
|
|
user = this.getSysUserByLoginName(loginName);
|
|
|
|
user = this.getSysUserByLoginName(loginName);
|
|
|
|
if (user == null) {
|
|
|
|
if (user == null) {
|
|
|
|
throw new CredentialsException("用户不存在");
|
|
|
|
throw new CredentialsException("用户不存在");
|
|
|
@ -144,10 +144,13 @@ public class SysUserService implements ISysUserService {
|
|
|
|
resultBean = result;
|
|
|
|
resultBean = result;
|
|
|
|
return resultBean;
|
|
|
|
return resultBean;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BaseToken token = getToken(loginName, password, languageCode, loginPlatform);
|
|
|
|
sessionUser = AuthUtil.login(token);
|
|
|
|
sessionUser = AuthUtil.login(token);
|
|
|
|
|
|
|
|
|
|
|
|
// 判断会话模式
|
|
|
|
// 判断会话模式
|
|
|
|
checkSessionMode(loginPlatform, user.getId());
|
|
|
|
// checkSessionMode(loginPlatform, user.getId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
checkSessionMode(loginPlatform, user);
|
|
|
|
|
|
|
|
|
|
|
|
packSessionUser(sessionUser, user, user.getUserType(), loginPlatform, languageCode, deviceId);
|
|
|
|
packSessionUser(sessionUser, user, user.getUserType(), loginPlatform, languageCode, deviceId);
|
|
|
|
packConfigSessionUser(sessionUser, user);
|
|
|
|
packConfigSessionUser(sessionUser, user);
|
|
|
@ -233,6 +236,27 @@ public class SysUserService implements ISysUserService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void checkSessionMode(Integer loginPlatform, SysUser sysUser) {
|
|
|
|
|
|
|
|
// int sessionMode = RedisCacheTool.getSysConfigIntVal(CommonConstWords.CONFIG_SESSION_MODE, CommonConstWords.CONFIG_SESSION_MODE_DEFAULT);
|
|
|
|
|
|
|
|
int sessionMode = UserFilter.getSessionModeByUserAccountType(sysUser.getUserAccountType());
|
|
|
|
|
|
|
|
String redisKey;
|
|
|
|
|
|
|
|
if (sessionMode == CommonEnumUtil.SESSION_MODE.SEIZE.getValue()) {
|
|
|
|
|
|
|
|
redisKey = CommonConstWords.SESSION_USER + ":*_" + sysUser.getId();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Object> ds = redisSession.findObject(redisKey);
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(ds)) {
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.LOGIN_EXCEPTION_LOGGED.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("用户已在其他设备登录,无法同时登录!")
|
|
|
|
|
|
|
|
.setErrorSolution("请联系管理员")
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public BaseToken getToken(String loginName, String password, String languageCode, Integer loginPlatform) {
|
|
|
|
public BaseToken getToken(String loginName, String password, String languageCode, Integer loginPlatform) {
|
|
|
|
SysUser user = this.getSysUserByLoginName(loginName);
|
|
|
|
SysUser user = this.getSysUserByLoginName(loginName);
|
|
|
|