예제 #1
0
 /**
  * 获取session中的用户企业ID
  *
  * @param request
  * @return
  */
 public static String getSessionUserTenantId(HttpServletRequest request) {
   Map<String, Object> userMap = getSessionUser(request);
   String tenantId = null;
   if (CommonUtil.notEmptyCollections(userMap)) {
     String sessionUserType = userMap.get(Constant.SESSION_USER_TYPE).toString();
     if (sessionUserType.equals(Constant.SESSION_USER_TYPE_USER)) {
       tenantId = userMap.get("tenant_id").toString();
     } else if (sessionUserType.equals(Constant.SESSION_USER_TYPE_TENANT)) {
       tenantId = userMap.get("id").toString();
     }
   }
   return tenantId;
 }
예제 #2
0
 /**
  * 将企业ID加入到参数中
  *
  * @param paramsMap
  * @param request
  */
 public static void setUserId2ParamsMap(
     Map<String, Object> paramsMap, HttpServletRequest request) {
   Map<String, Object> userMap = getSessionUser(request);
   String userId = null;
   if (CommonUtil.notEmptyCollections(userMap)) {
     String sessionUserType = userMap.get(Constant.SESSION_USER_TYPE).toString();
     if (sessionUserType.equals(Constant.SESSION_USER_TYPE_USER)) {
       userId = userMap.get("id").toString();
     } else if (sessionUserType.equals(Constant.SESSION_USER_TYPE_TENANT)) {
       userId = userMap.get("id").toString(); // 企业ID
     }
   }
   paramsMap.put("user_id", userId);
 }