/** * 获取当前虚中心id <功能详细描述> * * @return [参数说明] * @return String [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ private String getVcid() { ServiceLoggerSessionContext context = ServiceLoggerSessionContext.getContext(); if (context.getRequest() == null || context.getRequest().getSession(false) == null) { return ""; } else { HttpSession session = context.getRequest().getSession(false); Object vcidObj = session.getAttribute("vcid"); if (vcidObj != null && vcidObj instanceof String) { String vcid = (String) vcidObj; return vcid; } else { return ""; } } }
/** * 获取当前组织id <功能详细描述> * * @return [参数说明] * @return String [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ private String getOrganizationId() { ServiceLoggerSessionContext context = ServiceLoggerSessionContext.getContext(); if (context.getRequest() == null || context.getRequest().getSession(false) == null) { return ""; } else { HttpSession session = context.getRequest().getSession(false); Object orgIdObj = session.getAttribute("organizationId"); if (orgIdObj != null && orgIdObj instanceof String) { String organizationId = (String) orgIdObj; return organizationId; } else { return ""; } } }
/** * 获取调用客户端ip<br> * <功能详细描述> * * @return [参数说明] * @return String [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ private String getClientIpAddress() { ServiceLoggerSessionContext context = ServiceLoggerSessionContext.getContext(); if (context.getRequest() == null) { return ""; } else { HttpServletRequest request = context.getRequest(); String ip = request.getHeader("x-forwarded-for"); if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("Proxy-Client-IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("WL-Proxy-Client-IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getRemoteAddr(); } return ip; } }
/** * 获取操作员id <功能详细描述> * * @return [参数说明] * @return String [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ private void setOperatorInfo(Map<String, Object> attributes) { ServiceLoggerSessionContext context = ServiceLoggerSessionContext.getContext(); if (context.getRequest() == null || context.getRequest().getSession(false) == null) { attributes.put("operatorLoginName", ""); attributes.put("operatorName", ""); } else { HttpSession session = context.getRequest().getSession(false); Object operatorObj = session.getAttribute("operator"); if (operatorObj != null) { MetaObject metaObject = MetaObject.forObject(operatorObj); Object loginName = metaObject.getValue("loginName"); Object userName = metaObject.getValue("userName"); attributes.put("operatorLoginName", loginName == null ? "" : (String) loginName); attributes.put("operatorName", userName == null ? "" : (String) userName); } else { attributes.put("operatorLoginName", ""); attributes.put("operatorName", ""); } } }