package com.huimv.admin.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Bean
    public JWTInterceptor jwtInterceptor(){
        return new JWTInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(jwtInterceptor()).
                excludePathPatterns("/huatongApi/admin/my/*","/huatongApi/env-nh3-n/send")
                .excludePathPatterns("/huatongApi/receive/feed","/huatongApi/energy-data/importData","/huatongApi/energy-data/getData"
                        ,"/huatongApi/energy-data/getData2" ,"/huatongApi/energy-data/getData3","/huatongApi/energy-data/getData4"
                        ,"/huatongApi/energy-data/getData5"
                        ,"/huatongApi/energy-data/getData6"
                        ,"/huatongApi/energy-data/getData7"
                        ,"/huatongApi/energy-data/getData8"
                        ,"/huatongApi/energy-data/getData9"
                        ,"/huatongApi/energy-data/getData10"
                        ,"/huatongApi/energy-data/getData11"
                        ,"/huatongApi/energy-data/getData12"
                        ,"/huatongApi/energy-data/getData13"
                        ,"/huatongApi/energy-data/getData14"
                        ,"/huatongApi/energy-data/getData15"
                        ,"/huatongApi/energy-data/getData16"
                        ,"/huatongApi/energy-data/getData17"
                        ,"/huatongApi/energy-data/getData18"
                        ,"/huatongApi/energy-data/getData19"
                        ,"/huatongApi/energy-data/getData20"
                        ,"/huatongApi/energy-data/getData21"
                        ,"/huatongApi/energy-data/getData22"
                        ,"/huatongApi/energy-data/getData30"
                        ,"/huatongApi/test/*"
                        ,"/huatongApi/energy-data/getDeviceStatus");
    }
}
