huanghongfa
2021-05-28 54ad966d0b142c97fc659263b51d1ea5d7b5c7c6
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/helper/encrypt/ResultInterceptor.java
@@ -8,6 +8,7 @@
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;
@@ -27,6 +28,7 @@
@ConditionalOnProperty(value = "domain.decrypt", havingValue = "true")
@Component
@Slf4j
@Order(110)
public class ResultInterceptor implements Interceptor {
    @Autowired
@@ -34,7 +36,6 @@
    @Override
    public Object intercept(Invocation invocation) throws Throwable {
        log.debug("解密拦截器");
        Object result = invocation.proceed();
        if (Objects.isNull(result)){
            return null;
@@ -56,10 +57,12 @@
    }
    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;
    }