|
|
@@ -8,6 +8,8 @@ import com.sckw.auth.model.vo.res.EntInfoResVo;
|
|
|
import com.sckw.auth.model.vo.res.LoginResVo;
|
|
|
import com.sckw.auth.model.vo.res.LoginResVo1;
|
|
|
import com.sckw.auth.util.AsyncFactory;
|
|
|
+import com.sckw.core.model.enums.ClientTypeEnum;
|
|
|
+import com.sckw.core.model.enums.LoginMethodEnum;
|
|
|
import com.sckw.core.model.enums.SystemTypeEnum;
|
|
|
import com.sckw.core.utils.*;
|
|
|
import com.sckw.core.web.model.EntCertificateInfo;
|
|
|
@@ -372,11 +374,12 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
if (driver == null) {
|
|
|
return HttpResult.error(HttpStatus.QUERY_FAIL_CODE, "账号不存在,请检查并重新输入!");
|
|
|
}
|
|
|
- if (!PasswordUtils.validatePassword(loginBase.getPassword(), driver.getPassword())) {
|
|
|
+ if (loginBase.getLoginMethod() == LoginMethodEnum.ORDINARY.getValue()
|
|
|
+ && !PasswordUtils.validatePassword(loginBase.getPassword(), driver.getPassword())) {
|
|
|
return HttpResult.error(HttpStatus.CODE_10301, "密码不正确,请检查并重新输入!");
|
|
|
}
|
|
|
if (driver.getStatus() == Global.YES) {
|
|
|
- return HttpResult.error(HttpStatus.CODE_10301, "您的账号已冻结,如需帮助,请致电平台客服:400-803-6377!");
|
|
|
+ return HttpResult.error(HttpStatus.CODE_10301, "您的账号已冻结,如需帮助,请致电平台客服!");
|
|
|
}
|
|
|
//企业信息
|
|
|
REnterpriseVo enterprise = systemService.queryEntDetails(driver.getEntId());
|
|
|
@@ -421,11 +424,12 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
if (user == null) {
|
|
|
return HttpResult.error(HttpStatus.QUERY_FAIL_CODE, "账号不存在,请检查并重新输入!");
|
|
|
}
|
|
|
- if (!PasswordUtils.validatePassword(loginBase.getPassword(), user.getPassword())) {
|
|
|
+ if (loginBase.getLoginMethod() == LoginMethodEnum.ORDINARY.getValue()
|
|
|
+ && !PasswordUtils.validatePassword(loginBase.getPassword(), user.getPassword())) {
|
|
|
return HttpResult.error(HttpStatus.CODE_10301, "密码不正确,请检查并重新输入!");
|
|
|
}
|
|
|
if (user.getStatus() == Global.YES) {
|
|
|
- return HttpResult.error(HttpStatus.CODE_10301, "您的账号已冻结,如需帮助,请致电平台客服:400-803-6377!");
|
|
|
+ return HttpResult.error(HttpStatus.CODE_10301, "您的账号已冻结,如需帮助,请致电平台客服!");
|
|
|
}
|
|
|
//企业信息
|
|
|
REnterpriseVo enterprise = systemService.queryEntDetails(user.getEntId());
|
|
|
@@ -433,7 +437,7 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
return HttpResult.error(HttpStatus.QUERY_FAIL_CODE, "账号没有归属企业,请检查并重新输入!");
|
|
|
}
|
|
|
if (enterprise != null && enterprise.getStatus() == Global.YES) {
|
|
|
- return HttpResult.error(HttpStatus.QUERY_FAIL_CODE, "企业已冻结,如需帮助,请致电平台客服:400-803-6377!");
|
|
|
+ return HttpResult.error(HttpStatus.QUERY_FAIL_CODE, "企业已冻结,如需帮助,请致电平台客服!");
|
|
|
}
|
|
|
|
|
|
/**生成token**/
|
|
|
@@ -457,15 +461,17 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
loginRes.setRoleName(user.getRoleName());
|
|
|
loginRes.setClientId(user.getClientId());
|
|
|
loginRes.setEntId(user.getEntId());
|
|
|
- loginRes.setFirmName(enterprise == null ? enterprise.getFirmName() : null);
|
|
|
- loginRes.setApproval(enterprise == null ? enterprise.getApproval() : null);
|
|
|
- loginRes.setEntTypeNames(enterprise == null ? enterprise.getEntTypeNames() : null);
|
|
|
+ loginRes.setFirmName(enterprise != null ? enterprise.getFirmName() : null);
|
|
|
+ loginRes.setApproval(enterprise != null ? enterprise.getApproval() : null);
|
|
|
+ loginRes.setEntTypeNames(enterprise != null ? enterprise.getEntTypeNames() : null);
|
|
|
loginRes.setClientType(loginBase.getClientType());
|
|
|
loginRes.setSystemType(loginBase.getSystemType());
|
|
|
loginRes.setToken(token);
|
|
|
return HttpResult.ok(loginRes);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
static class AsyncProcess1 implements Runnable {
|
|
|
private final LoginBase loginBase;
|
|
|
|
|
|
@@ -511,7 +517,7 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
LoginEntInfo loginEntInfo = new LoginEntInfo();
|
|
|
BeanUtils.copyProperties(ent, loginEntInfo);
|
|
|
String key = Global.REDIS_ENTERPRISE_PREFIX + ent.getId();
|
|
|
- RedissonUtils.putString(key, JSON.toJSONString(loginEntInfo), Global.PC_TOKEN_EXPIRE);
|
|
|
+ RedissonUtils.putString(key, JSON.toJSONString(loginEntInfo), Global.APP_TOKEN_EXPIRE);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -537,7 +543,7 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
loginUserInfo.setEntName(enterprise != null ? enterprise.getFirmName() : null);
|
|
|
loginUserInfo.setClientType(loginBase.getClientType());
|
|
|
String key = Global.getFullUserLoginKey(loginUserInfo.getSystemType(), loginUserInfo.getId(), loginBase.getClientType());
|
|
|
- RedissonUtils.putString(key, JSON.toJSONString(loginUserInfo), Global.PC_TOKEN_EXPIRE);
|
|
|
+ RedissonUtils.putString(key, JSON.toJSONString(loginUserInfo), Global.APP_TOKEN_EXPIRE);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -563,7 +569,8 @@ public class AuthServiceImpl implements IAuthService {
|
|
|
loginUserInfo.setEntId(user.getEntId());
|
|
|
loginUserInfo.setEntName(enterprise != null ? enterprise.getFirmName() : null);
|
|
|
String key = Global.getFullUserLoginKey(loginUserInfo.getSystemType(), loginUserInfo.getId(), loginBase.getClientType());
|
|
|
- RedissonUtils.putString(key, JSON.toJSONString(loginUserInfo), Global.PC_TOKEN_EXPIRE);
|
|
|
+ RedissonUtils.putString(key, JSON.toJSONString(loginUserInfo),
|
|
|
+ loginBase.getClientType().equals(ClientTypeEnum.pc.getValue()) ? Global.PC_TOKEN_EXPIRE : Global.APP_TOKEN_EXPIRE);
|
|
|
|
|
|
//存缓存请求地址
|
|
|
SaveMenusToCache(user);
|