| | |
| | | package com.lf.server.aspect; |
| | | |
| | | import com.lf.server.annotation.SysLog; |
| | | import com.lf.server.entity.sys.OperateEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.WebHelper; |
| | |
| | | @Autowired |
| | | private OperateService operateService; |
| | | |
| | | private final static String SELECT = "select"; |
| | | private final static String SELECT = "/select"; |
| | | |
| | | private final static String INSERT = "insert"; |
| | | private final static String INSERT = "/insert"; |
| | | |
| | | private final static String UPDATE = "update"; |
| | | private final static String UPDATE = "/update"; |
| | | |
| | | private final static String DELETE = "delete"; |
| | | private final static String DELETE = "/delete"; |
| | | |
| | | private final static String UPLOAD = "upload"; |
| | | private final static String UPLOAD = "/upload"; |
| | | |
| | | private final static String DOWNLOAD = "download"; |
| | | private final static String DOWNLOAD = "/download"; |
| | | |
| | | private final static String COUNT = "/count"; |
| | | |
| | | private final static String SPLIT = "\\\\"; |
| | | |
| | | private static final Log log = LogFactory.getLog(LogAspect.class); |
| | | |
| | | @Pointcut("@annotation(com.lf.server.aspect.SysLog)") |
| | | @Pointcut("@annotation(com.lf.server.annotation.SysLog)") |
| | | public void logPointCut() { |
| | | // |
| | | } |
| | |
| | | if (api != null) { |
| | | String[] strs = api.tags()[0].split(SPLIT); |
| | | oe.setModular1(strs[0]); |
| | | oe.setModular1(strs[1]); |
| | | oe.setModular2(strs[1]); |
| | | } |
| | | |
| | | // 设置类名\方法名、类别 |
| | |
| | | |
| | | operateService.insertOperate(oe); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage() + ex.getStackTrace() + "\n"); |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | |
| | |
| | | * 获取操作类型 |
| | | */ |
| | | private static int getType(String methodName) { |
| | | if (methodName.indexOf(SELECT) > -1) { |
| | | if (methodName.contains(SELECT)) { |
| | | return 1; |
| | | } |
| | | if (methodName.indexOf(INSERT) > -1) { |
| | | if (methodName.contains(INSERT)) { |
| | | return 2; |
| | | } |
| | | if (methodName.indexOf(UPDATE) > -1) { |
| | | if (methodName.contains(UPDATE)) { |
| | | return 3; |
| | | } |
| | | if (methodName.indexOf(DELETE) > -1) { |
| | | if (methodName.contains(DELETE)) { |
| | | return 4; |
| | | } |
| | | if (methodName.indexOf(UPLOAD) > -1) { |
| | | if (methodName.contains(UPLOAD)) { |
| | | return 5; |
| | | } |
| | | if (methodName.indexOf(DOWNLOAD) > -1) { |
| | | if (methodName.contains(DOWNLOAD)) { |
| | | return 6; |
| | | } |
| | | // methodName.indexOf(COUNT) > -1 |
| | | if (methodName.contains(COUNT)) { |
| | | return 7; |
| | | } |
| | | |
| | | return 0; |
| | | } |