feat: 标准入库流程测试实例提交 及 项目token固定用户admin
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.adc.da.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.UnavailableSecurityManagerException;
|
||||
import org.apache.shiro.session.InvalidSessionException;
|
||||
@@ -14,16 +15,18 @@ public class LoginUserUtil {
|
||||
*
|
||||
*/
|
||||
public static String getUserId() {
|
||||
String userId = null;
|
||||
String userId = "WY8J26MH23";
|
||||
try {
|
||||
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();
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (UnavailableSecurityManagerException e) {
|
||||
} catch (InvalidSessionException e) {
|
||||
|
||||
Reference in New Issue
Block a user