|
@@ -16,6 +16,9 @@ import cn.com.qmth.examcloud.app.core.utils.ThreadUtils;
|
|
|
import cn.com.qmth.examcloud.app.model.*;
|
|
|
import cn.com.qmth.examcloud.app.service.CoreAuthService;
|
|
|
import cn.com.qmth.examcloud.app.service.RedisService;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.StudentCloudService;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.request.GetStudentReq;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.response.GetStudentResp;
|
|
|
import cn.com.qmth.examcloud.support.cache.CacheHelper;
|
|
|
import cn.com.qmth.examcloud.support.cache.bean.OrgPropertyCacheBean;
|
|
|
import okhttp3.*;
|
|
@@ -48,6 +51,9 @@ public class CoreAuthServiceImpl implements CoreAuthService {
|
|
|
@Autowired
|
|
|
private RedisService redisService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StudentCloudService studentCloudService;
|
|
|
+
|
|
|
@Override
|
|
|
public boolean isDoingExam(Long rootOrgId, String accountType, String account) {
|
|
|
if (rootOrgId == null) {
|
|
@@ -99,6 +105,11 @@ public class CoreAuthServiceImpl implements CoreAuthService {
|
|
|
|
|
|
@Override
|
|
|
public boolean isOpenApp(Long rootOrgId) {
|
|
|
+ if (rootOrgId == null) {
|
|
|
+ log.warn("[Check Open APP] rootOrgId is null");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
try {
|
|
|
OrgPropertyCacheBean property = CacheHelper.getOrgProperty(rootOrgId, "APP_ENABLED");
|
|
|
|
|
@@ -111,6 +122,21 @@ public class CoreAuthServiceImpl implements CoreAuthService {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Long getRootOrgIdBySecurityPhone(String securityPhone) {
|
|
|
+ GetStudentReq req = new GetStudentReq();
|
|
|
+ req.setSecurityPhone(securityPhone);
|
|
|
+
|
|
|
+ try {
|
|
|
+ GetStudentResp resp = studentCloudService.getStudent(req);
|
|
|
+ return resp.getStudentInfo().getRootOrgId();
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Result<UserInfo> login(LoginInfo loginInfo) {
|
|
|
Assert.notNull(loginInfo, "LoginInfo must be not null.");
|