|
@@ -11,6 +11,7 @@ import com.github.pagehelper.Page;
|
|
import com.zhongzheng.common.core.redis.RedisCache;
|
|
import com.zhongzheng.common.core.redis.RedisCache;
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
|
+import com.zhongzheng.modules.top.goods.domain.TopGoodsSpecAttributeRelation;
|
|
import com.zhongzheng.modules.user.bo.UserLoginKeyAddBo;
|
|
import com.zhongzheng.modules.user.bo.UserLoginKeyAddBo;
|
|
import com.zhongzheng.modules.user.bo.UserLoginKeyEditBo;
|
|
import com.zhongzheng.modules.user.bo.UserLoginKeyEditBo;
|
|
import com.zhongzheng.modules.user.bo.UserLoginKeyQueryBo;
|
|
import com.zhongzheng.modules.user.bo.UserLoginKeyQueryBo;
|
|
@@ -23,6 +24,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Collection;
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -45,8 +47,23 @@ public class UserLoginKeyServiceImpl extends ServiceImpl<UserLoginKeyMapper, Use
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Boolean queryByUserKey(String userKey) {
|
|
public Boolean queryByUserKey(String userKey) {
|
|
|
|
+ String redisKey = "loginKey:"+userKey;
|
|
|
|
+ Integer value = redisCache.getCacheObject(redisKey);
|
|
|
|
+ if(Validator.isNotEmpty(value)){
|
|
|
|
+ if(value==1){
|
|
|
|
+ return true;
|
|
|
|
+ }else{
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
UserLoginKey loginKey = getOne(new LambdaQueryWrapper<UserLoginKey>()
|
|
UserLoginKey loginKey = getOne(new LambdaQueryWrapper<UserLoginKey>()
|
|
.eq(UserLoginKey::getUserKey, userKey).last("limit 1"));
|
|
.eq(UserLoginKey::getUserKey, userKey).last("limit 1"));
|
|
|
|
+ if(Validator.isNotEmpty(loginKey)){
|
|
|
|
+ redisCache.setCacheObject(redisKey,loginKey.getStatus(),600, TimeUnit.SECONDS);
|
|
|
|
+ }else{
|
|
|
|
+ redisCache.deleteObject(redisKey);
|
|
|
|
+ }
|
|
if(Validator.isNotEmpty(loginKey)&&loginKey.getStatus()==0){
|
|
if(Validator.isNotEmpty(loginKey)&&loginKey.getStatus()==0){
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -128,6 +145,14 @@ public class UserLoginKeyServiceImpl extends ServiceImpl<UserLoginKeyMapper, Use
|
|
objectLambdaUpdateWrapper.ne(UserLoginKey::getUserKey, bo.getUserKey());
|
|
objectLambdaUpdateWrapper.ne(UserLoginKey::getUserKey, bo.getUserKey());
|
|
objectLambdaUpdateWrapper.set(UserLoginKey::getStatus, 0);
|
|
objectLambdaUpdateWrapper.set(UserLoginKey::getStatus, 0);
|
|
this.update(null, objectLambdaUpdateWrapper);
|
|
this.update(null, objectLambdaUpdateWrapper);
|
|
|
|
+ List<UserLoginKey> list = list(new LambdaQueryWrapper<UserLoginKey>()
|
|
|
|
+ .eq(UserLoginKey::getUserId,bo.getUserId()));
|
|
|
|
+ for(UserLoginKey item: list){
|
|
|
|
+ if(!item.getUserKey().equals(bo.getUserKey())){
|
|
|
|
+ String redisKey = "loginKey:"+item.getUserKey();
|
|
|
|
+ redisCache.deleteObject(redisKey);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
String key = "LockAppAction_"+"bank"+"-"+bo.getUserId();
|
|
String key = "LockAppAction_"+"bank"+"-"+bo.getUserId();
|
|
String key2 = "LockAppAction_"+"jxjy"+"-"+bo.getUserId();
|
|
String key2 = "LockAppAction_"+"jxjy"+"-"+bo.getUserId();
|
|
redisCache.deleteObject(key);
|
|
redisCache.deleteObject(key);
|