From 21362fd048558832cdcaca8ee957d2d7aa753be2 Mon Sep 17 00:00:00 2001
From: zhangf <1603559716@qq.com>
Date: Mon, 24 Jun 2024 09:04:41 +0800
Subject: [PATCH] 三方接口
---
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java
index 74fb93e..915e327 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java
@@ -1,7 +1,11 @@
package com.ruoyi.framework.config;
+import java.io.File;
import java.util.concurrent.TimeUnit;
+
+import com.ruoyi.framework.interceptor.ThreeInstitutionInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.CacheControl;
@@ -23,20 +27,31 @@
@Configuration
public class ResourcesConfig implements WebMvcConfigurer
{
+ @Value("${file.path.dcPath}")
+ private String dcPath;
+
@Autowired
private RepeatSubmitInterceptor repeatSubmitInterceptor;
+
+ @Autowired
+ private ThreeInstitutionInterceptor threeInstitutionInterceptor;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry)
{
+ String systemDir=System.getProperty("user.dir");
/** 本地文件上传路径 */
registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**")
.addResourceLocations("file:" + RuoYiConfig.getProfile() + "/");
+
/** swagger配置 */
registry.addResourceHandler("/swagger-ui/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
- .setCacheControl(CacheControl.maxAge(5, TimeUnit.HOURS).cachePublic());;
+ .setCacheControl(CacheControl.maxAge(5, TimeUnit.HOURS).cachePublic());
+ //文件访问路径
+ registry.addResourceHandler("/uploadfile/**")
+ .addResourceLocations("file:" + systemDir+ File.separator+dcPath+File.separator);
}
/**
@@ -46,6 +61,7 @@
public void addInterceptors(InterceptorRegistry registry)
{
registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**");
+ registry.addInterceptor(threeInstitutionInterceptor).addPathPatterns("/gov-server/receive/**");
}
/**
--
Gitblit v1.9.2