| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.core.annotation.AnnotationUtils; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.sql.Statement; |
| | |
| | | @ConditionalOnProperty(value = "domain.decrypt", havingValue = "true") |
| | | @Component |
| | | @Slf4j |
| | | @Order(110) |
| | | public class ResultInterceptor implements Interceptor { |
| | | |
| | | @Autowired |
| | |
| | | |
| | | @Override |
| | | public Object intercept(Invocation invocation) throws Throwable { |
| | | log.debug("解密拦截器"); |
| | | Object result = invocation.proceed(); |
| | | if (Objects.isNull(result)){ |
| | | return null; |
| | |
| | | } |
| | | |
| | | public boolean needToDecrypt(Object object){ |
| | | Class<?> objectClass = object.getClass(); |
| | | EncryptDecryptClass encryptDecryptClass = AnnotationUtils.findAnnotation(objectClass, EncryptDecryptClass.class); |
| | | if (Objects.nonNull(encryptDecryptClass)){ |
| | | return true; |
| | | if(object!=null) { |
| | | Class<?> objectClass = object.getClass(); |
| | | EncryptDecryptClass encryptDecryptClass = AnnotationUtils.findAnnotation(objectClass, EncryptDecryptClass.class); |
| | | if (Objects.nonNull(encryptDecryptClass)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |