JSD-8834 自定义授权&审计
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

694 lines
27 KiB

package com.fr.plugin.teshe.controller;
import com.fr.decision.webservice.Response;
import com.fr.decision.webservice.annotation.LoginStatusChecker;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.teshe.beans.*;
import com.fr.plugin.teshe.entity.*;
import com.fr.plugin.teshe.services.*;
import com.fr.plugin.teshe.task.OrganSyncTask;
import com.fr.plugin.teshe.utils.TeSheUtil;
import com.fr.stable.query.data.DataList;
import com.fr.third.alibaba.druid.support.json.JSONUtils;
import com.fr.third.jodd.util.StringUtil;
import com.fr.third.springframework.stereotype.Controller;
import com.fr.third.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
@Controller
@LoginStatusChecker(
required = false //不需要验证是否登录
)
public class TieSheController {
public static final boolean isLocal = false;
public static final String ROOT_ORGCODE = "00001";
public static final String ROOT_LOCAL_ORGCODE = "00000";
public static final String WORK_AUTHORITY_ID = "decision-management-user-role-assign";
public static final String SYSTEM_LOG_ID = "decision-management-user-role-log";
public static final String WORKD_AUTHORITY_VIEW_ID = "decision-management-user-role-statistics";
public static final String ORGAN_MANAGE_ID = "decision-management-user-role-organization";
public static final String FUNC_MANAGER_ROOT_ID = "decision-management-root";
public static final String HOME_PAGE_ROOT_ID = "decision-homepage-root";
public static final String DIR_MANAGE_ROOT_ID = "decision-directory-root";
public static final String ROLE_AUTHORITY_ROOT_ID = "decision-role-root";
private final int EXPORT_EXCEL_COUNT = 10000000;
public static final String CARRIER_TYPE = "user";//"depost",role;
//当前用户的信息
private HashMap<String, String> userAndRealNameMap = new HashMap<>();
private HashMap<String, String> userAndOrgFullPathMap = new HashMap<>();
/**
* 登陆后获取配置信息以及token信息
*
* @param req
* @param res
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/getConfig"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response getConfigInfo(HttpServletRequest req, HttpServletResponse res) throws Exception {
JSONObject jsonObj = new JSONObject();
String currentUser = TeSheUtil.getCurrentLoginUser(req);
jsonObj.put("currentUser", currentUser);
jsonObj.put("currentUser1", currentUser);
if (!"admin".equals(currentUser)) {
if (isLikeAdminUser(currentUser)) {
jsonObj.put("currentUser1", "likeAdmin");
}
if (currentUser.indexOf("_") != -1) {
String[] temp = currentUser.split("_");
String provinceId = temp[0];
String userId = temp[1];
//查询登录用户的机构信息
HashMap<String, String> userOrgInfo = RemoteReqService.getInstance().getOrganInfoByUserId(provinceId, userId);
String orgCode = userOrgInfo.get("orgCode");
String orgId = userOrgInfo.get("orgId");
String realName = TeSheUtil.getCurrentLoginRealName(req);
//保存当前用户的真实姓名
userAndRealNameMap.put(currentUser, realName);
String userOrganFullPath = RemoteReqService.getInstance().getOrgFullPath(provinceId, orgId, true, true);
//保存当前用户的机构全路径
userAndOrgFullPathMap.put(currentUser, userOrganFullPath);
}
} else {
userAndRealNameMap.put("admin", "admin");
userAndOrgFullPathMap.put("admin", "中国铁建");
}
//登录时先获取token。
TieSheController.tieSheToken = TeSheUtil.getAccessToken();
jsonObj.put("token", TieSheController.tieSheToken);
return Response.ok(jsonObj.toString());
}
/**
* 检查该用户在该组织上是否有增加或者删除授权人员的权限,
* 当用户进入工作授权,左侧组织结构树节点选中时,需要调用该方法来判断该用户是否有管理功能。
*
* @param req
* @param res
* @param orgCode
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/checkCanAddOrDeleteUserInOrgan"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response checkCanAddOrDeleteUserInOrgan(HttpServletRequest req, HttpServletResponse res, @RequestParam("orgCode") String orgCode) throws Exception {
//先看这个人是否是admin或者likeAdmin用户
String currentUser = TeSheUtil.getCurrentLoginUser(req);
if (currentUser.equals("admin")) {
return Response.ok(true);
} else {
if (isLikeAdminUser(currentUser) == true) {
return Response.ok(true);
} else {
//查看传进来的orgcode或者它的上面是否有管理工作授权的权限
//首先获取这个人在工作授权的所有组织的管理权限
//这个人只有在该组织上有工作授权的管理功能才能操作加人,删除人
List<UserRoleMenuItemEntity> entitys = UserRoleMenuDBAUtil.getInstance().getWorkAuthorityManageMenuDatasAndParent(TeSheUtil.getCurrentLoginUserId(currentUser), orgCode);
if (entitys == null || entitys.size() == 0) {
return Response.ok(false);
} else {
return Response.ok(true);
}
}
}
}
/**
* admin或者likeAdmin用户可以获取所有的组织机构数据,所以这里不做限制
*
* @param req
* @param res
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/getAllOragnList"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response getAllOragnList(HttpServletRequest req, HttpServletResponse res) throws Exception {
//检查下人事系统有删除的组织没
OrganSyncTask.taskInstance.syncRemoteOrgan();
ArrayList<SecondOrganModel> infos = RemoteReqService.getInstance().getSecondOrgan(true);
return Response.ok(infos);
}
/**
* 一般用户获取组织机构数据
* 这里需要去重,可能将一个人放到一个组织的下级组织,这就造成了数据重复,所以需要将下级去掉,只保留上级。
*
* @param req
* @param res
* @param currentUser
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/getAllOragnListCommon"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response getAllOragnListCommon(HttpServletRequest req, HttpServletResponse res, @RequestParam("currentUser") String currentUser, @RequestParam("isView") boolean isView) throws Exception {
//检查下人事系统有删除的组织没
OrganSyncTask.taskInstance.syncRemoteOrgan();
//获取当前用户的有权限的组织结构,跟授权有关
ArrayList<Object> allOrgans = TieSheSysOrgService.getInstance().getAllOragnListCommon(currentUser, isView);
return Response.ok(allOrgans);
}
/**
* 获取本地下级组织机构
*
* @param req
* @param res
* @param provinceId
* @param orgId
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/getOrgNextInfo"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response getOrgNextInfo(HttpServletRequest req, HttpServletResponse res, @RequestParam("provinceId") String provinceId, @RequestParam("orgId") String orgId, @RequestParam("from") String from) throws Exception {
//from 1 组织树, 2 加人的组织树
ArrayList<SecondOrganModel> orgs = RemoteReqService.getInstance().getNextOrganInfo(provinceId, orgId, from);
return Response.ok(orgs);
}
@RequestMapping(
value = {"/tieshe/getHrOrgNextInfo"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response getHrOrgNextInfo(HttpServletRequest req, HttpServletResponse res, @RequestParam("provinceId") String provinceId, @RequestParam("orgId") String orgId, @RequestParam("from") String from) throws Exception {
//from 1 组织树, 2 加人的组织树
ArrayList<SecondOrganModel> orgs = RemoteReqService.getInstance().getHrNextOrganInfo(provinceId, orgId, from);
return Response.ok(orgs);
}
/**
* 获取当前用户在某个机构下的所有授权对象
*
* @param req
* @param res
* @param organId
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/getUsersInOrgan"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response getUsersInOrgan(HttpServletRequest req, HttpServletResponse res, @RequestParam("organId") String organId, @RequestParam("searchType") int searchType, @RequestParam("searchUserName") String searchUserName, @RequestParam("orgCode") String orgCode) throws Exception {
FineLoggerFactory.getLogger().info("organId:" + organId);
String currentUser = TeSheUtil.getCurrentLoginUser(req);
//获取该机构下的授权对象, searchType 1 本级 2 所有下级
List<UserInOrganEntity> userOrgans0 = UserInOrganService.getInstance().getUsersInOrgan(searchUserName,orgCode,currentUser,searchType,organId);
return Response.ok(userOrgans0);
}
/**
* 给某个机构组织添加授权对象
*
* @param req
* @param res
* @param param
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/addUsersInOrgan"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response addUsersInOrgan(HttpServletRequest req, HttpServletResponse res, @RequestParam("param") String param) throws Exception {
//解析参数
Object obj = JSONUtils.parse(param);
String provinceId = "";
String organId = "";
String organName = "";
String orgCode = "";
String orgType = "";
if (obj instanceof LinkedHashMap) {
LinkedHashMap itemMap = (LinkedHashMap) obj;
provinceId = itemMap.get("provinceId").toString();
organId = itemMap.get("companyId").toString();
organName = itemMap.get("companyName").toString();
String orgFullPath = "中国铁建";
if ("-1".equals(provinceId) == false) {
TieSheSysOrgEntity entity = TieSheSysOrgDBAUtil.getInstance().getEntityByOrgId(organId);
if (entity != null) {
orgFullPath = entity.getFullPath();
}
}
orgCode = itemMap.get("orgCode").toString();
orgType = itemMap.get("orgType").toString();
ArrayList users = (ArrayList) itemMap.get("users");
String currentUser = TeSheUtil.getCurrentLoginUser(req);
String ipaddress = getIpAddr(req);
String currentFullpath = this.userAndOrgFullPathMap.get(currentUser);
String realUserName = this.getUserRealName(TeSheUtil.getCurrentLoginUser(req));
//参数准备完毕
UserInOrganService.getInstance().addUserInOrgan(users,provinceId,organId,orgCode,currentUser,orgFullPath,organName,orgType,ipaddress,currentFullpath,realUserName);
}
return Response.ok("ok");
}
/**
* 删除某个组织下的某个授权用户
*
* @param req
* @param res
* @param ids
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/deleteUsersInOrgan"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response deleteUsersInOrgan(HttpServletRequest req, HttpServletResponse res, @RequestParam("ids") String ids, @RequestParam("orgCode") String orgCode) throws Exception {
FineLoggerFactory.getLogger().info("ids:" + ids);
String[] idArr = ids.split(",");
String currentUser = TeSheUtil.getCurrentLoginUser(req);
String ipaddress = getIpAddr(req);
String currentFullpath = this.userAndOrgFullPathMap.get(currentUser);
String realUserName = this.getUserRealName(TeSheUtil.getCurrentLoginUser(req));
for (String id : idArr) {
UserInOrganService.getInstance().deleteUsersInOrgan(id,currentUser,ipaddress,currentFullpath,realUserName,orgCode);
}
return Response.ok("ok");
}
/**
* 搜素这些机构下的授权对象有哪些
*
* @param req
* @param res
* @param topIds
* @param username
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/searchUserInOrgan"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response searchUserInOrgan(HttpServletRequest req, HttpServletResponse res, @RequestParam("topIds") String topIds, @RequestParam("username") String username) throws Exception {
ArrayList<OrganUserModelExtend> allOrgans = RemoteReqService.getInstance().searchUserInOrgan(topIds, username);
return Response.ok(allOrgans);
}
/**
* 普通用户从远程获取某个组织机构下的用户
* 当组织机构树点开岗位后,就通过该方法查询岗位下的所有用户。
*
* @param req
* @param res
* @param provinceId
* @param companyId
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/getOrganUserInfos"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response getOrganUserInfos(HttpServletRequest req, HttpServletResponse res, @RequestParam("provinceId") String provinceId, @RequestParam("companyId") String companyId) throws Exception {
//第一步先查出这个人被赋予了几个组织,然后需要把这个组织下的所有人查出来。
String result = RemoteReqService.getInstance().getOragnUserInfo(provinceId, companyId);
ArrayList<OrganUserModel> datas = new ArrayList<>();
if (result.equals("[]")) {
} else {
Object obj = JSONUtils.parse(result);
iterateOrganUser(datas, obj, "-1", provinceId);
for (OrganUserModel model : datas) {
model.setOrginId(companyId);
}
}
return Response.ok(datas);
}
/**
* admin用户获取所有的组织下的用户
* 添加授权对象组织机构树用的
*
* @param req
* @param res
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/getAdminOrganUserInfos"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response getAdminOrganUserInfos(HttpServletRequest req, HttpServletResponse res) throws Exception {
ArrayList<OrganUserModel> datas = TieSheSysOrgService.getInstance().getAdminOrganUserInfos();
FineLoggerFactory.getLogger().info("get datas");
return Response.ok(datas);
}
/**
* 普通用户获取所有的组织下的用户
* 添加授权对象组织机构树用的
*
* @param req
* @param res
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/getCommonOrganUserInfos"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response getCommonOrganUserInfos(HttpServletRequest req, HttpServletResponse res) throws Exception {
String currentUser = TeSheUtil.getCurrentLoginUser(req);
ArrayList<OrganUserModel> datas = UserInOrganService.getInstance().getCommonOrganUserInfos(currentUser);
return Response.ok(datas);
}
/**
* 普通用户获取授权菜单
*
* @param req
* @param res
* @param loginUserName 待授权用户的登录名
* @param view
* @param operatorUserId 待授权用户是谁添加的
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/getCommonAuthorityMenuInfo"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response getCommonAuthorityMenuInfo(HttpServletRequest req, HttpServletResponse res, @RequestParam("loginUserName") String loginUserName, @RequestParam("view") boolean view, @RequestParam("operatorUserId") String operatorUserId, @RequestParam("orgCode") String orgCode) throws Exception {
FineLoggerFactory.getLogger().info("普通用户获取授权菜单项");
//loginUserName待授权用户的id,
//先看下待授权用户是登录用户创建的不,这里有可能不是登陆人创建的,需要去找她的创建人,才能正确找到菜单
if (operatorUserId.equals("admin")) {//如果这个待授权用户是admin添加的,
operatorUserId = TeSheUtil.getCurrentLoginUser(req);
}
ArrayList<UserAuthorityModel> userAuthorityModels = UserRoleMenuService.getInstance().getCommonAuthorityMenuInfo(operatorUserId,loginUserName,orgCode,view);
return Response.ok(userAuthorityModels);
}
/**
* //admin获取授权菜单
*
* @param req
* @param res
* @param loginUserName 表格中选择用户的登录名
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/getAdminAuthorityMenuInfo"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response getAdminAuthorityMenuInfo(HttpServletRequest req, HttpServletResponse res, @RequestParam("loginUserName") String loginUserName, @RequestParam("orgCode") String orgCode) throws Exception {
FineLoggerFactory.getLogger().info("获取授权菜单项");
ArrayList<UserAuthorityModel> userAuthorityModels = UserRoleMenuService.getInstance().getAdminAuthorityMenuInfo(loginUserName,orgCode);
return Response.ok(userAuthorityModels);
}
/**
* 批量授权
*
* @param req
* @param res
* @return
*/
@RequestMapping(
value = {"/tieshe/setUserAuthorityByBatch"},
method = {RequestMethod.POST}
)
@ResponseBody
public Response setUserAuthorityByBatch(HttpServletRequest req, HttpServletResponse res, @RequestBody AuthorityBean authorityBean) throws Exception {
FineLoggerFactory.getLogger().info("开始批量授权");
//获取相关参数
String provinceId = authorityBean.getProvinceId();
String orgId = authorityBean.getOrgId();
String orgName = authorityBean.getOrgName();
String authorityInfos = authorityBean.getAuthorityInfos();
String authorityUserName = authorityBean.getAuthorityUserName();
String userName = authorityBean.getUserName();
String organCode = authorityBean.getOrgCode();
String currentUser = TeSheUtil.getCurrentLoginUser(req);
String ip = getIpAddr(req);
String userFullPath = this.userAndOrgFullPathMap.get(currentUser);
String realName = this.getUserRealName(TeSheUtil.getCurrentLoginUser(req));
UserRoleMenuService.getInstance().setUserAuthorityByBatch(authorityUserName,userName,currentUser,organCode,authorityInfos,provinceId,orgId,orgName,ip,userFullPath,realName);
return Response.ok("ok");
}
/**
* 查询管理日志
* http://localhost:8075/webroot/decision/tieshe/getAllLogs?page=1&count=20
* @param req
* @param res
* @param page
* @param count
* @param startDate
* @param endDate
* @param operateName
* @param operateType
* @param operateIp
* @param operateDescn
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/getAllLogs"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response getAllLogs(HttpServletRequest req, HttpServletResponse res, @RequestParam("page") int page, @RequestParam("count") int count, @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate, @RequestParam("operateName") String operateName, @RequestParam("operateType") String operateType, @RequestParam("operateIp") String operateIp, @RequestParam("operateDescn") String operateDescn) throws Exception {
Map<String, Object> allLogs = getAllLogsUtil(req, page, count, startDate, endDate, operateName, operateType, operateIp, operateDescn);
FineLoggerFactory.getLogger().info("获取所有日志。。。。");
return Response.ok(allLogs);
}
/**
* 导出管理日志
* http://localhost:8075/webroot/decision/tieshe/getAllLogs?page=1&count=20
* @param req
* @param res
* @param page
* @param count
* @param startDate
* @param endDate
* @param operateName
* @param operateType
* @param operateIp
* @param operateDescn
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/exportAllLogs"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response exportAllLogs(HttpServletRequest req, HttpServletResponse res, @RequestParam("page") int page, @RequestParam("count") int count, @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate, @RequestParam("operateName") String operateName, @RequestParam("operateType") String operateType, @RequestParam("operateIp") String operateIp, @RequestParam("operateDescn") String operateDescn) throws Exception {
Map<String, Object> allLogs = getAllLogsUtil(req, page, EXPORT_EXCEL_COUNT, startDate, endDate, operateName, operateType, operateIp, operateDescn);
String excelName = TieSheOperateLogService.getInstance().exportAllLogs(allLogs);
return Response.ok(excelName);
}
/**
* 查询操作日志
*http://localhost:8075/webroot/decision/tieshe/getAllLogs?page=1&count=20
* @param req
* @param res
* @param page
* @param count
* @param startDate
* @param endDate
* @param operateName
* @param operateType
* @param operateIp
* @param operateDescn
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/getAllViewLogs"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response getAllViewLogs(HttpServletRequest req, HttpServletResponse res, @RequestParam("page") int page, @RequestParam("count") int count, @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate, @RequestParam("operateName") String operateName, @RequestParam("operateType") String operateType, @RequestParam("operateIp") String operateIp, @RequestParam("operateDescn") String operateDescn) throws Exception {
DataList dataList = this.searchExecuteMessageLogs(req, page, count, startDate, endDate, operateName, operateType, operateIp, operateDescn);
return Response.ok(dataList);
}
/**
* 导出操作日志
*http://localhost:8075/webroot/decision/tieshe/getAllLogs?page=1&count=20
* @param req
* @param res
* @param page
* @param count
* @param startDate
* @param endDate
* @param operateName
* @param operateType
* @param operateIp
* @param operateDescn
* @return
* @throws Exception
*/
@RequestMapping(
value = {"/tieshe/exportAllViewLogs"},
method = {RequestMethod.GET}
)
@ResponseBody
public Response exportAllViewLogs(HttpServletRequest req, HttpServletResponse res, @RequestParam("page") int page, @RequestParam("count") int count, @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate, @RequestParam("operateName") String operateName, @RequestParam("operateType") String operateType, @RequestParam("operateIp") String operateIp, @RequestParam("operateDescn") String operateDescn) throws Exception {
DataList dataList = this.searchExecuteMessageLogs(req, page, EXPORT_EXCEL_COUNT, startDate, endDate, operateName, operateType, operateIp, operateDescn);
String excelName = TieSheOperateLogService.getInstance().exportAllViewLogs(dataList);
return Response.ok(excelName);
}
private void iterateOrganUser(ArrayList<OrganUserModel> datas, Object obj, String pid, String provinceId) {
if (obj instanceof ArrayList) {
ArrayList<LinkedHashMap> arrs = (ArrayList<LinkedHashMap>) obj;
if (arrs != null && arrs.size() > 0) {
for (LinkedHashMap itemMap : arrs) {
OrganUserModel model = new OrganUserModel();
datas.add(model);
model.setProviderId(provinceId);
model.setId(Integer.parseInt(itemMap.get("id").toString()));
model.setOrder(Integer.parseInt(itemMap.get("order").toString()));
model.setText(itemMap.get("name").toString());
model.setValue(model.getText());
model.setMain((boolean) itemMap.get("mainPosition"));
}
}
}
}
private Map<String, Object> getAllLogsUtil(HttpServletRequest req, int page, int count, String startDate, String endDate, String operateName, String operateType, String operateIp, String operateDescn) throws Exception {
String loginUser = TeSheUtil.getCurrentLoginUser(req);
Map<String, Object> allLogs = TieSheOperateLogService.getInstance().findAllLog(loginUser, page, count, startDate, endDate, operateName, operateType, operateIp, operateDescn);
return allLogs;
}
/**
* 查询系统底层日志
*/
private DataList searchExecuteMessageLogs(HttpServletRequest req, int page, int count, String startDate, String endDate, String operateName, String operateType, String operateIp, String operateDescn) throws Exception {
String currentUser = TeSheUtil.getCurrentLoginUser(req);
return TieSheOperateLogService.getInstance().searchExecuteMessageLogs(currentUser, page, count, startDate, endDate, operateName, operateType, operateIp, operateDescn);
}
/**
* 判断该用户是否是中国铁建下的用户
*
* @param currentUser
* @return
*/
private boolean isLikeAdminUser(String currentUser) {
List<UserInOrganEntity> allDatas = UserInOrganDBAUtil.getInstance().findAllUserInGroupDataByUserId(currentUser); //TieSheDBAcessProvi
// TieSheSysOrgEntity root = TieSheSysOrgService.getInstance().getRoot();
for (UserInOrganEntity entity : allDatas) {
if (entity.getOrganCode().equals(TieSheController.ROOT_ORGCODE)) {//ROOT_ORGCODE)) {
return true;
}
}
return false;
}
private String getIpAddr(HttpServletRequest request) {
String remoteAddr = request.getHeader("X-Forwarded-For");
if (StringUtil.isBlank(remoteAddr)) {
remoteAddr = request.getHeader("Proxy-Client-IP");
}
if (StringUtil.isBlank(remoteAddr)) {
remoteAddr = request.getHeader("WL-Proxy-Client-IP");
}
return remoteAddr != null ? remoteAddr : request.getRemoteAddr();
}
private String getUserRealName(String userId) {
if (userAndRealNameMap.containsKey(userId)) {
return userAndRealNameMap.get(userId);
}
return userId;
}
//铁建请求需要的token
public static String tieSheToken;
}