...
|
...
|
@@ -14,6 +14,7 @@ import com.tianbo.warehouse.model.USERS; |
|
|
import com.tianbo.warehouse.service.PermissionService;
|
|
|
import com.tianbo.warehouse.util.RedisUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
...
|
...
|
@@ -180,7 +181,7 @@ public class PermissionServiceImp implements PermissionService { |
|
|
}
|
|
|
/** 批量删除
|
|
|
*
|
|
|
* @param permissionId
|
|
|
* @param permissionIds
|
|
|
* @return
|
|
|
*/
|
|
|
@RedisCacheDelTarget(cacheKey = "com.tianbo.warehouse.service.imp.PermissionServiceImp")
|
...
|
...
|
@@ -237,26 +238,23 @@ public class PermissionServiceImp implements PermissionService { |
|
|
if(token != null && token.startsWith("Bearer ")) {
|
|
|
token = token.substring(7); // 7 是 "Bearer " 的长度
|
|
|
String userJsonStr = redisUtils.get(token);
|
|
|
USERS user = JSONObject.parseObject(userJsonStr, USERS.class);
|
|
|
PERMISSION result = user.getPermissions().stream()
|
|
|
.filter(permission -> "转关运抵申报申报".equals(permission.getName()) || url.equals(permission.getUrl()))
|
|
|
.findFirst()
|
|
|
.orElse(null);
|
|
|
// 输出查询结果
|
|
|
if (result != null) {
|
|
|
System.out.println("匹配到对应权限");
|
|
|
return true;
|
|
|
} else {
|
|
|
return false;
|
|
|
if (StringUtils.isNotEmpty(userJsonStr)) {
|
|
|
USERS user = JSONObject.parseObject(userJsonStr, USERS.class);
|
|
|
PERMISSION result = user.getPermissions().stream()
|
|
|
.filter(permission -> name.equals(permission.getName()) || url.equals(permission.getUrl()))
|
|
|
.findFirst()
|
|
|
.orElse(null);
|
|
|
// 输出查询结果
|
|
|
if (result != null) {
|
|
|
System.out.println("匹配到对应权限");
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
// 处理未包含Bearer前缀的情况
|
|
|
return false;
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
return false;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|