Browse Source

fix auth空指针异常

Eric 1 month ago
parent
commit
b2ec4b4522

+ 4 - 0
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/web/controller/TokenController.java

@@ -49,6 +49,7 @@ import java.util.Base64;
 import java.util.Calendar;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Objects;
 import java.util.UUID;
 import java.util.concurrent.TimeUnit;
 
@@ -97,6 +98,9 @@ public class TokenController extends BaseController {
         if (authUser != null) {
             // 获取用户信息
             SysUser sysUser = userService.get(authUser.getUserId());
+            if (Objects.isNull(sysUser)) {
+                return null;
+            }
             // 获取用户机构信息
             sysUser.setTenantId(userService.getTenantByClient(authUser.getUserId(),authUser.getClientId()));
             return sysUser;