parent
3416b0ef7f
commit
2ea9a4d813
|
|
@ -0,0 +1,51 @@
|
|||
package com.sqx.common.aspect;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.sqx.common.utils.HttpContextUtils;
|
||||
import com.sqx.common.utils.IPUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 方法调用统一切面处理
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AppApiMethodAspect {
|
||||
@Pointcut("execution(public * (" +
|
||||
"com.sqx.modules.*.controller.* " +
|
||||
").*(..))")
|
||||
public void pkg() {
|
||||
}
|
||||
|
||||
@Around("pkg()")
|
||||
// @SuppressWarnings("unchecked")
|
||||
public Object around(ProceedingJoinPoint pjp) throws Throwable {
|
||||
// 执行被拦截的方法
|
||||
Object result = pjp.proceed();
|
||||
//请求的参数
|
||||
Object[] args = pjp.getArgs();
|
||||
String params = new Gson().toJson(args);
|
||||
//获取request
|
||||
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
|
||||
|
||||
MethodSignature signature = (MethodSignature) pjp.getSignature();
|
||||
// String className = pjp.getTarget().getClass().getName();
|
||||
String methodName = signature.getName();
|
||||
|
||||
log.info("\n>>>>>>{} {}\n>>>>>>{}\n>>>>>>Request: {}\n>>>>>>Response: {}"
|
||||
, methodName, request.getRequestURL(), IPUtils.getIpAddr(request),
|
||||
params,
|
||||
result
|
||||
);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ public interface UserMoneyDao extends BaseMapper<UserMoney> {
|
|||
|
||||
void updateMayMoney(@Param("type") Integer type, @Param("userId")Long userId, @Param("money") Double money);
|
||||
|
||||
void updateMayAmount(@Param("type") Integer type, @Param("userId")Long userId, @Param("money") Double amount);
|
||||
void updateMayAmount(@Param("type") Integer type, @Param("userId")Long userId, @Param("amount") Double amount);
|
||||
|
||||
void updateSysMoney(@Param("type") Integer type, @Param("sysUserId")Long sysUserId, @Param("money") Double money);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue