fuint-framework/fuint-base/src/main/java/com/fuint/base/config/LogAspect.java

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.fuint.base.config;

import com.fuint.base.annoation.OperationServiceLog;
import com.fuint.base.dao.entities.TActionLog;
import com.fuint.base.service.log.TActionLogService;
import com.fuint.base.shiro.ShiroUser;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.util.Date;

/**
 * 操作日志AOP实现
 * s
 *
 * @author FSQ
 * Contact wx fsq_better
 * @version $Id: LogAspect.java
 */
@Component
@Aspect
public class LogAspect {

    private Logger LOGGER = LoggerFactory.getLogger(LogAspect.class);

    @Lazy
    @Autowired
    private TActionLogService tActionLogService;

    private String userName = ""; // 用户名
    private Long startTimeMillis = 0l; // 开始时间
    private Long endTimeMillis = 0l; // 结束时间
    private String clientIp = "";
    private Integer clientPort = 0;
    private String module = "";
    private String url = "";
    private String userAgent = "";

    //Service层切点
    @Pointcut("@annotation(com.fuint.base.annoation.OperationServiceLog)")
    public void serviceAspect() {
        // empty
    }

    /**
     * service 方法前调用
     *
     * @param joinPoint
     */
    @Before("serviceAspect()")
    public void doBeforeService(JoinPoint joinPoint) {
        startTimeMillis = System.currentTimeMillis(); // 记录方法开始执行的时间
后面还有 61 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。