管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-10-21 d692b45b22f985aff4635a5bb8b8958ae9bcd6dd
src/main/java/com/lf/server/aspect/LogAspect.java
@@ -1,7 +1,7 @@
package com.lf.server.aspect;
import com.lf.server.entity.sys.OperateEntity;
import com.lf.server.entity.sys.UsersEntity;
import com.lf.server.entity.sys.UserEntity;
import com.lf.server.helper.WebHelper;
import com.lf.server.service.sys.OperateService;
import com.lf.server.service.sys.TokenService;
@@ -32,17 +32,21 @@
    @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);
@@ -90,7 +94,9 @@
            // 设置模块
            Api api = clazz.getAnnotation(Api.class);
            if (api != null) {
                oe.setModular(api.tags()[0]);
                String[] strs = api.tags()[0].split(SPLIT);
                oe.setModular1(strs[0]);
                oe.setModular2(strs[1]);
            }
            // 设置类名\方法名、类别
@@ -103,14 +109,14 @@
                oe.setBak(sysLog.value());
            }
            UsersEntity ue = tokenService.getCurrentUser(req);
            UserEntity ue = tokenService.getCurrentUser(req);
            if (ue != null) {
                oe.setUserid(ue.getId());
            }
            operateService.insertOperate(oe);
        } catch (Exception ex) {
            log.error(ex.getStackTrace());
            log.error(ex.getMessage(), ex);
        }
    }
@@ -136,6 +142,9 @@
        if (methodName.indexOf(DOWNLOAD) > -1) {
            return 6;
        }
        if (methodName.indexOf(COUNT) > -1) {
            return 7;
        }
        return 0;
    }