You've already forked FrameTour-BE
支持用户切换景区账号,单账号多景区权限
This commit is contained in:
@@ -6,11 +6,13 @@ import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.JwtBuilder;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author yangchen
|
||||
@@ -73,15 +75,13 @@ public class JwtAnalysisUtil {
|
||||
}
|
||||
Long userId = null;
|
||||
if (body.get("userId")!=null) {
|
||||
String strUserId = StringUtil.a(body.get("userId"));
|
||||
userId= Long.parseLong(strUserId);
|
||||
userId= Long.parseLong(Objects.requireNonNullElse(body.get("userId"), "").toString());
|
||||
}
|
||||
return new JwtInfo(StringUtil.a(body.get("name")),
|
||||
return new JwtInfo(Objects.requireNonNullElse(body.get("name"), "").toString(),
|
||||
userId,
|
||||
StringUtil.a(body.get("roleId")),
|
||||
Objects.requireNonNullElse(body.get("roleId"), "").toString(),
|
||||
body.getSubject(),
|
||||
StringUtil.a(body.get("phone")),
|
||||
body.get("scenicId") == null ? null : Long.valueOf(body.get("scenicId").toString()),
|
||||
Objects.requireNonNullElse(body.get("phone"), "").toString(),
|
||||
expireTime);
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +0,0 @@
|
||||
package com.ycwl.basic.utils;
|
||||
|
||||
public final class StringUtil {
|
||||
|
||||
public StringUtil() {
|
||||
}
|
||||
|
||||
public static String a(Object obj) {
|
||||
return obj == null ? "" : obj.toString();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user