Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (null == auth) return;
log.setOperator(auth.getName());
Object details = auth.getDetails();
if ((details instanceof WebAuthenticationDetails)) {
WebAuthenticationDetails webDetails = (WebAuthenticationDetails) details;
log.setIp(webDetails.getAgent().getIp());
log.setAgent(webDetails.getAgent().getOs() + " " + webDetails.getAgent().getBrowser());
log.setEntry(sessionRegistry.getResource(webDetails.getSessionId()));
}
if (null != event.getDetail()) {
log.setDetail(new BusinessLogDetailBean(log, event.getDetail()));
}
entityDao.saveOrUpdate(log);