deason 2 жил өмнө
parent
commit
a627135ab9

+ 4 - 5
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/CryptoConfigServiceImpl.java

@@ -3,6 +3,7 @@ package cn.com.qmth.examcloud.core.basic.service.impl;
 import cn.com.qmth.examcloud.core.basic.service.CryptoConfigService;
 import cn.com.qmth.examcloud.core.basic.service.bean.CryptoConfigInfo;
 import cn.com.qmth.examcloud.starters.crypto.CryptoProperties;
+import cn.com.qmth.examcloud.support.CacheConstants;
 import cn.com.qmth.examcloud.web.redis.RedisClient;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.ArrayUtils;
@@ -26,8 +27,6 @@ public class CryptoConfigServiceImpl implements CryptoConfigService {
 
     private static final Logger log = LoggerFactory.getLogger(CryptoConfigServiceImpl.class);
 
-    private static final String CRYPTO_CONFIG_CACHE_KEY = "$CRYPTO_CONFIG";
-
     @Autowired
     private CryptoProperties cryptoProperties;
 
@@ -58,7 +57,7 @@ public class CryptoConfigServiceImpl implements CryptoConfigService {
             newConfigCaches.add(new CryptoConfigInfo(group, true, System.currentTimeMillis()));
         }
 
-        redisClient.set(CRYPTO_CONFIG_CACHE_KEY, newConfigCaches);
+        redisClient.set(CacheConstants.CACHE_B_CRYPTO_CONFIG, newConfigCaches);
     }
 
     /**
@@ -66,7 +65,7 @@ public class CryptoConfigServiceImpl implements CryptoConfigService {
      */
     @Override
     public List<CryptoConfigInfo> getAllCryptoConfigs() {
-        return redisClient.get(CRYPTO_CONFIG_CACHE_KEY, List.class);
+        return redisClient.get(CacheConstants.CACHE_B_CRYPTO_CONFIG, List.class);
     }
 
     /**
@@ -99,7 +98,7 @@ public class CryptoConfigServiceImpl implements CryptoConfigService {
         }
 
         if (needUpdate) {
-            redisClient.set(CRYPTO_CONFIG_CACHE_KEY, configCaches);
+            redisClient.set(CacheConstants.CACHE_B_CRYPTO_CONFIG, configCaches);
         }
     }
 

+ 3 - 7
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/LoginRuleServiceImpl.java

@@ -15,6 +15,7 @@ import cn.com.qmth.examcloud.core.basic.service.OrgService;
 import cn.com.qmth.examcloud.core.basic.service.bean.LoginRuleForm;
 import cn.com.qmth.examcloud.core.basic.service.bean.LoginRuleInfo;
 import cn.com.qmth.examcloud.core.basic.service.bean.LoginRuleQuery;
+import cn.com.qmth.examcloud.support.CacheConstants;
 import cn.com.qmth.examcloud.support.filestorage.FileStorageUtil;
 import cn.com.qmth.examcloud.web.filestorage.FileStoragePathEnvInfo;
 import cn.com.qmth.examcloud.web.filestorage.YunPathInfo;
@@ -37,11 +38,6 @@ public class LoginRuleServiceImpl implements LoginRuleService {
 
     private static final Logger LOG = LoggerFactory.getLogger(LoginRuleServiceImpl.class);
 
-    /**
-     * “登录规则”的缓存KEY前缀
-     */
-    private static final String LOGIN_RULE_CACHE_KEY_PREFIX = "$LOGIN_RULE:";
-
     /**
      * ../resources/aliyun.xml siteId
      */
@@ -179,7 +175,7 @@ public class LoginRuleServiceImpl implements LoginRuleService {
             }
         }
 
-        String cacheKey = LOGIN_RULE_CACHE_KEY_PREFIX + type.name();
+        String cacheKey = CacheConstants.CACHE_B_LOGIN_RULE + type.name();
         redisClient.set(cacheKey, values);
 
         if (LoginRuleType.GEETEST_LOGIN == type) {
@@ -217,7 +213,7 @@ public class LoginRuleServiceImpl implements LoginRuleService {
             throw new StatusException("400400", "规则类型不能为空");
         }
 
-        String cacheKey = LOGIN_RULE_CACHE_KEY_PREFIX + type.name();
+        String cacheKey = CacheConstants.CACHE_B_LOGIN_RULE + type.name();
         Map<String, Boolean> values = redisClient.get(cacheKey, HashMap.class);
         if (MapUtils.isEmpty(values)) {
             LOG.warn(String.format("LoginRule not exist, type = %s, rootOrgId = %s", rootOrgId, type.name()));