feat: 登陆修改

This commit is contained in:
super_liu
2021-06-23 15:25:41 +08:00
parent bd01b11ea8
commit fa985d2d58
2 changed files with 21 additions and 13 deletions
@@ -15,17 +15,15 @@ public class LoginUserUtil {
*
*/
public static String getUserId() {
String userId = "WY8J26MH23";
String userId = null;
try {
if(!StringUtils.isNotBlank(userId)){
Subject subject = SecurityUtils.getSubject();
Object object=subject.getPrincipal();
if(object!=null){
String json = JSONObject.toJSONString(object);
if(json!=null && json.length()>0){
Map<String, Object> userInfo=JSONObject.parseObject(json, Map.class);
userId=userInfo.get("id").toString();
}
Subject subject = SecurityUtils.getSubject();
Object object=subject.getPrincipal();
if(object!=null){
String json = JSONObject.toJSONString(object);
if(json!=null && json.length()>0){
Map<String, Object> userInfo=JSONObject.parseObject(json, Map.class);
userId=userInfo.get("id").toString();
}
}
} catch (UnavailableSecurityManagerException e) {