feat: 标准入库流程测试实例提交 及 项目token固定用户admin

This commit is contained in:
super_liu
2021-06-09 17:34:42 +08:00
parent fe786eec40
commit 19c7a56d73
6 changed files with 62 additions and 51 deletions
@@ -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) {