This commit is contained in:
parent
67af9e28ca
commit
dbf3ba0d24
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.framework.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
|
@ -17,7 +18,7 @@ import com.bonus.framework.interceptor.RepeatSubmitInterceptor;
|
|||
|
||||
/**
|
||||
* 通用配置
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
|
|
@ -26,17 +27,26 @@ public class ResourcesConfig implements WebMvcConfigurer
|
|||
@Autowired
|
||||
private RepeatSubmitInterceptor repeatSubmitInterceptor;
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry)
|
||||
{
|
||||
/** 本地文件上传路径 */
|
||||
registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**")
|
||||
.addResourceLocations("file:" + RuoYiConfig.getProfile() + "/");
|
||||
// @Override
|
||||
// public void addResourceHandlers(ResourceHandlerRegistry registry)
|
||||
// {
|
||||
// /** 本地文件上传路径 */
|
||||
// registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**")
|
||||
// .addResourceLocations("file:" + "/usr/local/bonus/uploadPath/" + "/");
|
||||
//
|
||||
// /** swagger配置 */
|
||||
// registry.addResourceHandler("/swagger-ui/**")
|
||||
// .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
|
||||
// .setCacheControl(CacheControl.maxAge(5, TimeUnit.HOURS).cachePublic());
|
||||
// }
|
||||
|
||||
/** swagger配置 */
|
||||
registry.addResourceHandler("/swagger-ui/**")
|
||||
.addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/")
|
||||
.setCacheControl(CacheControl.maxAge(5, TimeUnit.HOURS).cachePublic());
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/files/**").addResourceLocations("file:/usr/local/bonus/uploadPath"+ File.separator);
|
||||
//super.addResourceHandlers(registry);
|
||||
|
||||
// registry.addResourceHandler("/files/**").addResourceLocations("file:E:\\file\\");
|
||||
// super.addResourceHandlers(registry);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -69,4 +79,4 @@ public class ResourcesConfig implements WebMvcConfigurer
|
|||
// 返回新的CorsFilter
|
||||
return new CorsFilter(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import io.jsonwebtoken.SignatureAlgorithm;
|
|||
|
||||
/**
|
||||
* token验证处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
|
|
@ -56,7 +56,7 @@ public class TokenService
|
|||
|
||||
/**
|
||||
* 获取用户身份信息
|
||||
*
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
public LoginUser getLoginUser(HttpServletRequest request)
|
||||
|
|
@ -107,7 +107,7 @@ public class TokenService
|
|||
|
||||
/**
|
||||
* 创建令牌
|
||||
*
|
||||
*
|
||||
* @param loginUser 用户信息
|
||||
* @return 令牌
|
||||
*/
|
||||
|
|
@ -126,7 +126,7 @@ public class TokenService
|
|||
|
||||
/**
|
||||
* 验证令牌有效期,相差不足20分钟,自动刷新缓存
|
||||
*
|
||||
*
|
||||
* @param loginUser 登录信息
|
||||
* @return 令牌
|
||||
*/
|
||||
|
|
@ -142,7 +142,7 @@ public class TokenService
|
|||
|
||||
/**
|
||||
* 刷新令牌有效期
|
||||
*
|
||||
*
|
||||
* @param loginUser 登录信息
|
||||
*/
|
||||
public void refreshToken(LoginUser loginUser)
|
||||
|
|
@ -156,7 +156,7 @@ public class TokenService
|
|||
|
||||
/**
|
||||
* 设置用户代理信息
|
||||
*
|
||||
*
|
||||
* @param loginUser 登录信息
|
||||
*/
|
||||
public void setUserAgent(LoginUser loginUser)
|
||||
|
|
@ -218,6 +218,9 @@ public class TokenService
|
|||
private String getToken(HttpServletRequest request)
|
||||
{
|
||||
String token = request.getHeader(header);
|
||||
if(StringUtils.isEmpty(token)){
|
||||
token=request.getParameter("file_token");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX))
|
||||
{
|
||||
token = token.replace(Constants.TOKEN_PREFIX, "");
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ ruoyi:
|
|||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 58080
|
||||
port: 58089
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
|
|
@ -68,13 +68,13 @@ spring:
|
|||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: localhost
|
||||
host: 192.168.0.7
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
port: 16379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
database: 6
|
||||
# 密码
|
||||
password:
|
||||
password: Bonus@admin123!
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
|
|
@ -87,6 +87,9 @@ spring:
|
|||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
web:
|
||||
resources:
|
||||
static-locations: file:/usr/local/bonus//uploadPath/
|
||||
|
||||
# token配置
|
||||
token:
|
||||
|
|
@ -129,6 +132,6 @@ xss:
|
|||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
||||
file:
|
||||
domain: http://192.168.0.60:58080
|
||||
domain: http://192.168.0.14:58089
|
||||
path: /usr/local/bonus/uploadPath
|
||||
prefix: /statics
|
||||
|
|
|
|||
Loading…
Reference in New Issue