| | |
| | | MethodSignature signature = (MethodSignature) joinPoint.getSignature(); |
| | | Method method = signature.getMethod(); |
| | | LogSave annotation = method.getAnnotation(LogSave.class); |
| | | AdminUserDetails adminUserDetails = (AdminUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); |
| | | UmsAdminLoginLog loginLog = new UmsAdminLoginLog(); |
| | | loginLog.setAdminId(adminUserDetails.getUserId()); |
| | | try { |
| | | AdminUserDetails adminUserDetails = (AdminUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); |
| | | |
| | | loginLog.setAdminId(adminUserDetails.getUserId()); |
| | | } catch (Exception ex) { |
| | | } |
| | | loginLog.setCreateTime(new Date()); |
| | | ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); |
| | | HttpServletRequest request = attributes.getRequest(); |
| | |
| | | String header = request.getHeader("user-agent"); |
| | | if (header.contains("Windows NT")) { |
| | | loginLog.setUserAgent("Web端"); |
| | | } |
| | | else if(header.contains("Android")) { |
| | | } else if (header.contains("Android")) { |
| | | loginLog.setUserAgent("Android端"); |
| | | } |
| | | else if(header.contains("iPhone")) { |
| | | } else if (header.contains("iPhone")) { |
| | | loginLog.setUserAgent("ios端"); |
| | | } |
| | | else if(header.contains("iPad")) { |
| | | } else if (header.contains("iPad")) { |
| | | loginLog.setUserAgent("iPad端"); |
| | | }else { |
| | | } else { |
| | | loginLog.setUserAgent("Web端"); |
| | | } |
| | | loginLog.setOperationType(annotation.operationType()); |
| | | if (annotation.operationType().equals("")) { |
| | | loginLog.setOperationType("其他操作"); |
| | | } else { |
| | | loginLog.setOperationType(annotation.operationType()); |
| | | } |
| | | loginLog.setContain(annotation.contain()); |
| | | umsAdminLoginLogMapper.insert(loginLog); |
| | | } |