| | |
| | | package cn.gistack.sm.updaterecord; |
| | | |
| | | import io.geekidea.updaterecord.api.entity.UpdateRecordColumnLog; |
| | | import io.geekidea.updaterecord.api.entity.UpdateRecordLog; |
| | | import io.geekidea.updaterecord.api.entity.UpdateRecordTableLog; |
| | | import io.geekidea.updaterecord.core.aop.UpdateRecordAopSupport; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.aspectj.lang.JoinPoint; |
| | | import org.aspectj.lang.annotation.AfterReturning; |
| | | import org.aspectj.lang.annotation.AfterThrowing; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Before; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @PROJECT_NAME: skjcmanager |
| | | * @DESCRIPTION: |
| | | * @USER: aix |
| | | * @DATE: 2023/7/13 14:16 |
| | | */ |
| | | @Slf4j |
| | | @Aspect |
| | | @Component |
| | | public class UpdateRecordAop extends UpdateRecordAopSupport { |
| | | |
| | | /** |
| | | * 切点 |
| | | */ |
| | | private static final String POINTCUT = "@annotation(io.geekidea.updaterecord.annotation.UpdateRecord)"; |
| | | |
| | | /** |
| | | * 方法执行之前 |
| | | * |
| | | * @param joinPoint |
| | | * @throws Throwable |
| | | */ |
| | | @Before(POINTCUT) |
| | | @Override |
| | | protected void doBefore(JoinPoint joinPoint) throws Throwable { |
| | | super.doBeforeHandle(joinPoint); |
| | | } |
| | | |
| | | /** |
| | | * 方法正常执行并成功返回 |
| | | * |
| | | * @param joinPoint |
| | | * @param result |
| | | * @throws Throwable |
| | | */ |
| | | @AfterReturning(value = POINTCUT, returning = RESULT) |
| | | @Override |
| | | protected void doAfterReturning(JoinPoint joinPoint, Object result) throws Throwable { |
| | | super.doAfterReturningHandle(joinPoint, result); |
| | | } |
| | | |
| | | /** |
| | | * 异常处理 |
| | | * |
| | | * @param exception |
| | | * @throws Throwable |
| | | */ |
| | | @AfterThrowing(value = POINTCUT, throwing = EXCEPTION) |
| | | @Override |
| | | protected void doAfterThrowing(Throwable exception) throws Throwable { |
| | | super.doAfterThrowingHandle(exception); |
| | | } |
| | | |
| | | @Override |
| | | protected String getToken(HttpServletRequest request) { |
| | | return super.getToken(request); |
| | | } |
| | | |
| | | @Override |
| | | protected void handleUpdateRecord(UpdateRecordLog updateRecordLog, List<UpdateRecordTableLog> updateRecordTableLogs, List<UpdateRecordColumnLog> updateRecordColumnLogs) { |
| | | // 需自己完善当前登陆用户ID和用户名称,IP对应的区域,备注信息等 |
| | | updateRecordLog.setUserId(String.valueOf(AuthUtil.getUserId())); |
| | | updateRecordLog.setUserName(AuthUtil.getUserName()); |
| | | updateRecordLog.setArea(""); |
| | | updateRecordLog.setRemark("update..."); |
| | | } |
| | | |
| | | @Async |
| | | @Override |
| | | protected void save(UpdateRecordLog updateRecordLog, List<UpdateRecordTableLog> updateRecordTableLogs, List<UpdateRecordColumnLog> updateRecordColumnLogs) { |
| | | super.save(updateRecordLog, updateRecordTableLogs, updateRecordColumnLogs); |
| | | } |
| | | |
| | | |
| | | } |
| | | //package cn.gistack.sm.updaterecord; |
| | | // |
| | | //import io.geekidea.updaterecord.api.entity.UpdateRecordColumnLog; |
| | | //import io.geekidea.updaterecord.api.entity.UpdateRecordLog; |
| | | //import io.geekidea.updaterecord.api.entity.UpdateRecordTableLog; |
| | | //import io.geekidea.updaterecord.core.aop.UpdateRecordAopSupport; |
| | | //import lombok.extern.slf4j.Slf4j; |
| | | //import org.aspectj.lang.JoinPoint; |
| | | //import org.aspectj.lang.annotation.AfterReturning; |
| | | //import org.aspectj.lang.annotation.AfterThrowing; |
| | | //import org.aspectj.lang.annotation.Aspect; |
| | | //import org.aspectj.lang.annotation.Before; |
| | | //import org.springblade.core.secure.utils.AuthUtil; |
| | | //import org.springblade.core.tool.utils.StringUtil; |
| | | //import org.springframework.scheduling.annotation.Async; |
| | | //import org.springframework.stereotype.Component; |
| | | // |
| | | //import javax.servlet.http.HttpServletRequest; |
| | | //import java.util.List; |
| | | // |
| | | ///** |
| | | // * @PROJECT_NAME: skjcmanager |
| | | // * @DESCRIPTION: |
| | | // * @USER: aix |
| | | // * @DATE: 2023/7/13 14:16 |
| | | // */ |
| | | //@Slf4j |
| | | //@Aspect |
| | | //@Component |
| | | //public class UpdateRecordAop extends UpdateRecordAopSupport { |
| | | // |
| | | // /** |
| | | // * 切点 |
| | | // */ |
| | | // private static final String POINTCUT = "@annotation(io.geekidea.updaterecord.annotation.UpdateRecord)"; |
| | | // |
| | | // /** |
| | | // * 方法执行之前 |
| | | // * |
| | | // * @param joinPoint |
| | | // * @throws Throwable |
| | | // */ |
| | | // @Before(POINTCUT) |
| | | // @Override |
| | | // protected void doBefore(JoinPoint joinPoint) throws Throwable { |
| | | // super.doBeforeHandle(joinPoint); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 方法正常执行并成功返回 |
| | | // * |
| | | // * @param joinPoint |
| | | // * @param result |
| | | // * @throws Throwable |
| | | // */ |
| | | // @AfterReturning(value = POINTCUT, returning = RESULT) |
| | | // @Override |
| | | // protected void doAfterReturning(JoinPoint joinPoint, Object result) throws Throwable { |
| | | // super.doAfterReturningHandle(joinPoint, result); |
| | | // } |
| | | // |
| | | // /** |
| | | // * 异常处理 |
| | | // * |
| | | // * @param exception |
| | | // * @throws Throwable |
| | | // */ |
| | | // @AfterThrowing(value = POINTCUT, throwing = EXCEPTION) |
| | | // @Override |
| | | // protected void doAfterThrowing(Throwable exception) throws Throwable { |
| | | // super.doAfterThrowingHandle(exception); |
| | | // } |
| | | // |
| | | // @Override |
| | | // protected String getToken(HttpServletRequest request) { |
| | | // return super.getToken(request); |
| | | // } |
| | | // |
| | | // @Override |
| | | // protected void handleUpdateRecord(UpdateRecordLog updateRecordLog, List<UpdateRecordTableLog> updateRecordTableLogs, List<UpdateRecordColumnLog> updateRecordColumnLogs) { |
| | | // // 需自己完善当前登陆用户ID和用户名称,IP对应的区域,备注信息等 |
| | | // updateRecordLog.setUserId(String.valueOf(AuthUtil.getUserId())); |
| | | // updateRecordLog.setUserName(AuthUtil.getUserName()); |
| | | // updateRecordLog.setArea(""); |
| | | // updateRecordLog.setRemark("update..."); |
| | | // } |
| | | // |
| | | // @Async |
| | | // @Override |
| | | // protected void save(UpdateRecordLog updateRecordLog, List<UpdateRecordTableLog> updateRecordTableLogs, List<UpdateRecordColumnLog> updateRecordColumnLogs) { |
| | | // super.save(updateRecordLog, updateRecordTableLogs, updateRecordColumnLogs); |
| | | // } |
| | | // |
| | | // |
| | | //} |