chejianzheng пре 3 месеци
родитељ
комит
fe43ec0919
1 измењених фајлова са 7 додато и 7 уклоњено
  1. 7 7
      src/main/java/cn/hfln/framework/gateway/config/StpInterfaceImpl.java

+ 7 - 7
src/main/java/cn/hfln/framework/gateway/config/StpInterfaceImpl.java

@@ -38,12 +38,12 @@ public class StpInterfaceImpl implements StpInterface {
 		long loginId = Long.parseLong(String.valueOf(loginIdObj));
 
 		List<String> roleList = this.getRoleList(loginId, loginType);
-		for (String roleId : roleList) {
+		for (String roleCode : roleList) {
 			String rolePermKeyPre = "hfln:perm:";
-			Set<String> permList = (Set<String>) redisService.get(rolePermKeyPre + roleId);
-			if (permList == null) {
-				log.error("角色权限列表不存在, roleId :{}", roleId);
-				throw new RuntimeException(roleId + "角色权限列表不存在");
+			Set<String> permList = (Set<String>) redisService.get(rolePermKeyPre + roleCode);
+			if (CollectionUtils.isEmpty(permList)) {
+				log.info("当前角色未配置权限, roleCode :{}", roleCode);
+				continue;
 			}
 			list.addAll(permList);
 		}
@@ -61,8 +61,8 @@ public class StpInterfaceImpl implements StpInterface {
 		String roleKeyPre = "hfln:role:";
 		Set<String> roleList = (Set<String>) redisService.get(roleKeyPre + loginId);
 		if (CollectionUtils.isEmpty(roleList)) {
-			log.error("角色配置异常, loginId :{}", loginId);
-			throw new RuntimeException("角色配置异常");
+			log.info("当前账户未配置角色, loginId :{}", loginId);
+			return new ArrayList<>();
 		}
 		return new ArrayList<>(roleList);
 	}