package com.winsun.intercept;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @date 2022-03-15 14:58
 */
@Slf4j
@Configuration
public class AuthConfigurationSupport extends WebMvcConfigurationSupport {

    @Autowired
    private AuthIntercept authIntercept;

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        log.info("配置拦截中");
        List<String> s = new ArrayList<>();
        s.add("/login");
        s.add("/logout");
        s.add("/getPhoneCode");
        s.add("/hhrUser/getOrderList");
        s.add("/hhrUser/getSallesList");
        s.add("/PersonalCenter/**");
        s.add("/recordNumber/getLatelySchool");
        s.add("/recordNumber/register");
        s.add("/mobile/salesList/**");
        s.add("/supervisor/**");
        s.add("/order/importDate");
        s.add("/order/importExpressDelivery");
        s.add("/order/importPrefabrication");
        s.add("/order/importPackageOrder");
        s.add("/salesList/importOrder");
        s.add("/salesList/importRechargeData");
        s.add("/salesList/importAuditLock");
        s.add("/salesList/importBatchUpdate");
        s.add("/school/schoolManagement/importDate");
        s.add("/networkPlace/importDate");
        s.add("/school/schoolManagement/qrcodeUpload");
        s.add("/packageManagement/package/backgroundUpload");
        s.add("/packageManagement/package/xiaotuUpload");


        registry.addInterceptor(authIntercept).excludePathPatterns(s);
        super.addInterceptors(registry);
    }
}
