|
@@ -204,7 +204,7 @@ public class AuthServiceImpl implements AuthService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 设置安全IP
|
|
|
+ * 设置机构安全IP
|
|
|
*
|
|
|
* @author WANGWEI
|
|
|
* @param user
|
|
@@ -218,18 +218,28 @@ public class AuthServiceImpl implements AuthService {
|
|
|
}
|
|
|
|
|
|
String value = redisClient.get(key, String.class);
|
|
|
- Set<String> userKeyList = null;
|
|
|
+ Set<String> userKeySet = null;
|
|
|
if (null == value) {
|
|
|
- userKeyList = Sets.newHashSet();
|
|
|
+ userKeySet = Sets.newHashSet();
|
|
|
} else {
|
|
|
@SuppressWarnings("unchecked")
|
|
|
Set<String> v = JsonUtil.fromJson(value, Set.class);
|
|
|
- userKeyList = v;
|
|
|
+ userKeySet = v;
|
|
|
}
|
|
|
|
|
|
- userKeyList.add(user.getKey());
|
|
|
+ // 数据清洗
|
|
|
+ Set<String> newUserKeySet = Sets.newHashSet();
|
|
|
+ if (10 < userKeySet.size()) {
|
|
|
+ for (String cur : userKeySet) {
|
|
|
+ User curUser = redisClient.get(cur, User.class);
|
|
|
+ if (null != curUser) {
|
|
|
+ newUserKeySet.add(cur);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- redisClient.set(key, JsonUtil.toJson(userKeyList), 3600 * 12);
|
|
|
+ newUserKeySet.add(user.getKey());
|
|
|
+ redisClient.set(key, JsonUtil.toJson(newUserKeySet), 3600 * 12);
|
|
|
}
|
|
|
|
|
|
/**
|