|
@@ -6,8 +6,6 @@
|
|
package cn.com.qmth.examcloud.core.basic.service.impl;
|
|
package cn.com.qmth.examcloud.core.basic.service.impl;
|
|
|
|
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
|
|
|
|
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
|
|
|
|
import cn.com.qmth.examcloud.commons.util.JsonUtil;
|
|
import cn.com.qmth.examcloud.commons.util.JsonUtil;
|
|
import cn.com.qmth.examcloud.core.basic.dao.LoginRuleRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.LoginRuleRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.LoginRuleEntity;
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.LoginRuleEntity;
|
|
@@ -23,6 +21,8 @@ import cn.com.qmth.examcloud.web.filestorage.YunPathInfo;
|
|
import cn.com.qmth.examcloud.web.redis.RedisClient;
|
|
import cn.com.qmth.examcloud.web.redis.RedisClient;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.MapUtils;
|
|
import org.apache.commons.collections.MapUtils;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.domain.*;
|
|
import org.springframework.data.domain.*;
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
@@ -35,7 +35,7 @@ import java.util.stream.Collectors;
|
|
@Service
|
|
@Service
|
|
public class LoginRuleServiceImpl implements LoginRuleService {
|
|
public class LoginRuleServiceImpl implements LoginRuleService {
|
|
|
|
|
|
- private static final ExamCloudLog log = ExamCloudLogFactory.getLog("INTERFACE_LOGGER");
|
|
|
|
|
|
+ private static final Logger LOG = LoggerFactory.getLogger(LoginRuleServiceImpl.class);
|
|
|
|
|
|
/**
|
|
/**
|
|
* “登录规则”的缓存KEY前缀
|
|
* “登录规则”的缓存KEY前缀
|
|
@@ -187,7 +187,7 @@ public class LoginRuleServiceImpl implements LoginRuleService {
|
|
this.uploadJsonFile(json);
|
|
this.uploadJsonFile(json);
|
|
}
|
|
}
|
|
|
|
|
|
- log.info("refreshLoginRule " + type.name());
|
|
|
|
|
|
+ LOG.info("refreshLoginRule " + type.name());
|
|
}
|
|
}
|
|
|
|
|
|
private void uploadJsonFile(String json) {
|
|
private void uploadJsonFile(String json) {
|
|
@@ -196,9 +196,9 @@ public class LoginRuleServiceImpl implements LoginRuleService {
|
|
FileStoragePathEnvInfo env = new FileStoragePathEnvInfo();
|
|
FileStoragePathEnvInfo env = new FileStoragePathEnvInfo();
|
|
env.setExt1("geetestConfig");
|
|
env.setExt1("geetestConfig");
|
|
YunPathInfo oss = FileStorageUtil.saveFile(LOGIN_RULE_SITE_ID, env, json.getBytes(), true);
|
|
YunPathInfo oss = FileStorageUtil.saveFile(LOGIN_RULE_SITE_ID, env, json.getBytes(), true);
|
|
- log.debug(oss.getRelativePath());
|
|
|
|
|
|
+ LOG.debug(oss.getRelativePath());
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- log.error(e.getMessage(), e);
|
|
|
|
|
|
+ LOG.error(e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -220,7 +220,7 @@ public class LoginRuleServiceImpl implements LoginRuleService {
|
|
String cacheKey = LOGIN_RULE_CACHE_KEY_PREFIX + type.name();
|
|
String cacheKey = LOGIN_RULE_CACHE_KEY_PREFIX + type.name();
|
|
Map<String, Boolean> values = redisClient.get(cacheKey, HashMap.class);
|
|
Map<String, Boolean> values = redisClient.get(cacheKey, HashMap.class);
|
|
if (MapUtils.isEmpty(values)) {
|
|
if (MapUtils.isEmpty(values)) {
|
|
- log.warn(String.format("LoginRule not exist, type = %s, rootOrgId = %s", rootOrgId, type.name()));
|
|
|
|
|
|
+ LOG.warn(String.format("LoginRule not exist, type = %s, rootOrgId = %s", rootOrgId, type.name()));
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -231,17 +231,17 @@ public class LoginRuleServiceImpl implements LoginRuleService {
|
|
|
|
|
|
if (globalAllow == null || globalAllow) {
|
|
if (globalAllow == null || globalAllow) {
|
|
if (allow == null || allow) {
|
|
if (allow == null || allow) {
|
|
- log.info(String.format("LoginRule allow, rootOrgId = %s, type = %s", rootOrgId, type.name()));
|
|
|
|
|
|
+ LOG.info(String.format("LoginRule allow, rootOrgId = %s, type = %s", rootOrgId, type.name()));
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
if (allow != null && allow) {
|
|
if (allow != null && allow) {
|
|
- log.info(String.format("LoginRule allow, rootOrgId = %s, type = %s", rootOrgId, type.name()));
|
|
|
|
|
|
+ LOG.info(String.format("LoginRule allow, rootOrgId = %s, type = %s", rootOrgId, type.name()));
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- log.info(String.format("LoginRule unAllow, rootOrgId = %s, type = %s", rootOrgId, type.name()));
|
|
|
|
|
|
+ LOG.info(String.format("LoginRule unAllow, rootOrgId = %s, type = %s", rootOrgId, type.name()));
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|