package com.union.ai.api.aspect;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * Created by IntelliJ IDEA.
 * Author: xingxin.jing
 * Date: 2018/12/15
 * Time: 上午8:44
 * 监控点controller
 */
@Slf4j
@Component
@Aspect
public class FaceSecurityAspect extends CommonSecurityAspect {

	/**
	 * 前置通知
	 * @param joinPoint
	 */
	@Override
	@Around("execution(* com.union.ai.api.controller.face..*(..))") //该标签声明次方法是一个前置通知：在目标方法开始之前执行
	public Object beforeMethod(ProceedingJoinPoint joinPoint) throws Throwable {

		Object[] args = joinPoint.getArgs();
		Object arg = args[0];
		String param = JSON.toJSONString(arg);
		return this.proceed(joinPoint, param);
	}
}