feat: 添加slrs业务子项目 修改问题文件

This commit is contained in:
super_liu
2021-05-31 17:18:43 +08:00
parent dd50eaebf4
commit 230889c3ff
92 changed files with 6765 additions and 31 deletions
@@ -0,0 +1,53 @@
package com.adc.da.util;
import com.alibaba.fastjson.JSONObject;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.UnavailableSecurityManagerException;
import org.apache.shiro.session.InvalidSessionException;
import org.apache.shiro.subject.Subject;
import java.util.Map;
public class LoginUserUtil {
/**
* 获取当前登录用户ID
*
*/
public static String getUserId() {
String userId = null;
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();
}
}
} catch (UnavailableSecurityManagerException e) {
} catch (InvalidSessionException e) {
}
return userId;
}
public static String getUserParamValue() {
String paramValue = null;
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);
paramValue=userInfo.get("paramValue").toString();
}
}
} catch (UnavailableSecurityManagerException e) {
} catch (InvalidSessionException e) {
}
return paramValue;
}
}