parent
5e79ce0b9c
commit
25e827cefe
60 changed files with 692 additions and 308 deletions
@ -1,18 +1,18 @@ |
|||||||
package com.daqing.financial.guarantee.config; |
//package com.daqing.financial.guarantee.config;
|
||||||
|
//
|
||||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; |
//import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||||
import org.springframework.context.annotation.Bean; |
//import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration; |
//import org.springframework.context.annotation.Configuration;
|
||||||
|
//
|
||||||
/** |
///**
|
||||||
* @auther River |
// * @auther River
|
||||||
* @date 2020/11/5 14:38 |
// * @date 2020/11/5 14:38
|
||||||
*/ |
// */
|
||||||
|
//
|
||||||
@Configuration |
//@Configuration
|
||||||
public class IPageConfig { |
//public class IPageConfig {
|
||||||
@Bean |
// @Bean
|
||||||
public PaginationInterceptor paginationInterceptor() { |
// public PaginationInterceptor paginationInterceptor() {
|
||||||
return new PaginationInterceptor(); |
// return new PaginationInterceptor();
|
||||||
} |
// }
|
||||||
} |
//}
|
||||||
|
@ -0,0 +1,48 @@ |
|||||||
|
package com.daqing.financial.hrauth.config; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper; |
||||||
|
import org.springframework.security.web.DefaultRedirectStrategy; |
||||||
|
import org.springframework.security.web.RedirectStrategy; |
||||||
|
import org.springframework.security.web.session.SessionInformationExpiredEvent; |
||||||
|
import org.springframework.security.web.session.SessionInformationExpiredStrategy; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import javax.servlet.ServletException; |
||||||
|
import java.io.IOException; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
@Component |
||||||
|
public class CustomExpiredSessionStrategy implements SessionInformationExpiredStrategy { |
||||||
|
|
||||||
|
//前后端分离返回JSON的方式
|
||||||
|
//jackson的JSON处理对象
|
||||||
|
private ObjectMapper objectMapper = new ObjectMapper(); |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public void onExpiredSessionDetected(SessionInformationExpiredEvent event) |
||||||
|
throws IOException, ServletException { |
||||||
|
|
||||||
|
Map<String, Object> map = new HashMap<>(); |
||||||
|
map.put("code", 403); |
||||||
|
map.put("msg", "您的登陆已经超时或者已经在另一台机器登陆,您被迫下线!" |
||||||
|
+ event.getSessionInformation().getLastRequest()); |
||||||
|
|
||||||
|
String json = objectMapper.writeValueAsString(map); |
||||||
|
|
||||||
|
event.getResponse().setContentType("application/json;charset=utf-8"); |
||||||
|
event.getResponse().getWriter().write(json); |
||||||
|
} |
||||||
|
|
||||||
|
//页面跳转的方式
|
||||||
|
//页面跳转的处理逻辑
|
||||||
|
// private RedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onExpiredSessionDetected(SessionInformationExpiredEvent event)
|
||||||
|
// throws IOException, ServletException {
|
||||||
|
// redirectStrategy.sendRedirect(event.getRequest(), event.getResponse(), "踢下线后跳转的路径");
|
||||||
|
// }
|
||||||
|
|
||||||
|
} |
@ -1,13 +1,13 @@ |
|||||||
package com.daqing.financial.hrms.config; |
//package com.daqing.financial.hrms.config;
|
||||||
|
//
|
||||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; |
//import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||||
import org.springframework.context.annotation.Bean; |
//import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration; |
//import org.springframework.context.annotation.Configuration;
|
||||||
|
//
|
||||||
@Configuration |
//@Configuration
|
||||||
public class IPageConfig { |
//public class IPageConfig {
|
||||||
@Bean |
// @Bean
|
||||||
public PaginationInterceptor paginationInterceptor() { |
// public PaginationInterceptor paginationInterceptor() {
|
||||||
return new PaginationInterceptor(); |
// return new PaginationInterceptor();
|
||||||
} |
// }
|
||||||
} |
//}
|
||||||
|
@ -1,48 +1,48 @@ |
|||||||
#服务名称 |
#服务名称 |
||||||
spring.application.name=dq-govern-gateway |
#spring.application.name=dq-govern-gateway |
||||||
#配置中心地址 |
##配置中心地址 |
||||||
spring.cloud.nacos.config.server-addr=192.168.31.140:8848 |
#spring.cloud.nacos.config.server-addr=192.168.31.140:8848 |
||||||
spring.cloud.nacos.config.file-extension=yml |
#spring.cloud.nacos.config.file-extension=yml |
||||||
#redis配置 |
##redis配置 |
||||||
spring.redis.host=127.0.0.1 |
#spring.redis.host=127.0.0.1 |
||||||
spring.redis.port=6379 |
#spring.redis.port=6379 |
||||||
spring.redis.password= |
#spring.redis.password= |
||||||
spring.redis.database=0 |
#spring.redis.database=0 |
||||||
spring.redis.timeout=30000 |
#spring.redis.timeout=30000 |
||||||
spring.redis.jedis.pool.max-active=8 |
#spring.redis.jedis.pool.max-active=8 |
||||||
spring.redis.jedis.pool.max-wait=-1 |
#spring.redis.jedis.pool.max-wait=-1 |
||||||
spring.redis.jedis.pool.max-idle=8 |
#spring.redis.jedis.pool.max-idle=8 |
||||||
spring.redis.jedis.pool.min-idle=0 |
#spring.redis.jedis.pool.min-idle=0 |
||||||
|
# |
||||||
#本地测试环境 |
##本地测试环境 |
||||||
#spring.cloud.nacos.config.namespace=1520c5ea-5f15-4ac1-9eb1-d25924825b99 |
#spring.cloud.nacos.config.namespace=1520c5ea-5f15-4ac1-9eb1-d25924825b99 |
||||||
|
|
||||||
#线上测试环境 |
#线上测试环境 |
||||||
#spring.cloud.nacos.config.namespace=5698e60a-9d0b-433f-a69f-12b0a2d23128 |
#spring.cloud.nacos.config.namespace=5698e60a-9d0b-433f-a69f-12b0a2d23128 |
||||||
|
|
||||||
#线上生产环境 |
#线上生产环境 |
||||||
spring.cloud.nacos.config.namespace=6054a175-069a-492d-8679-820758416406 |
#spring.cloud.nacos.config.namespace=6054a175-069a-492d-8679-820758416406 |
||||||
|
|
||||||
spring.servlet.multipart.max-file-size=10MB |
spring.servlet.multipart.max-file-size=10MB |
||||||
spring.servlet.multipart.max-request-size=10MB |
spring.servlet.multipart.max-request-size=10MB |
||||||
|
|
||||||
# 正式环境(prod) |
# 正式环境(prod) |
||||||
#服务名称 |
#服务名称 |
||||||
#spring.application.name=dq-govern-gateway |
spring.application.name=dq-govern-gateway |
||||||
##配置中心地址 |
#配置中心地址 |
||||||
#spring.cloud.nacos.config.server-addr=120.78.127.12:8848 |
spring.cloud.nacos.config.server-addr=120.78.127.12:8848 |
||||||
#spring.cloud.nacos.config.namespace=68738215-903f-426c-8658-2dcd99b20009 |
spring.cloud.nacos.config.namespace=68738215-903f-426c-8658-2dcd99b20009 |
||||||
# |
|
||||||
#spring.cloud.nacos.config.ext-config[0].data-id=dq-govern-gateway.yml |
spring.cloud.nacos.config.ext-config[0].data-id=dq-govern-gateway.yml |
||||||
#spring.cloud.nacos.config.ext-config[0].group=prod |
spring.cloud.nacos.config.ext-config[0].group=prod |
||||||
#spring.cloud.nacos.config.ext-config[0].refresh=true |
spring.cloud.nacos.config.ext-config[0].refresh=true |
||||||
# |
|
||||||
#spring.redis.host=127.0.0.1 |
spring.redis.host=127.0.0.1 |
||||||
#spring.redis.port=6379 |
spring.redis.port=6379 |
||||||
#spring.redis.password=dq123456 |
spring.redis.password=dq123456 |
||||||
#spring.redis.database=0 |
spring.redis.database=0 |
||||||
#spring.redis.timeout=30000 |
spring.redis.timeout=30000 |
||||||
#spring.redis.jedis.pool.max-active=8 |
spring.redis.jedis.pool.max-active=8 |
||||||
#spring.redis.jedis.pool.max-wait=-1 |
spring.redis.jedis.pool.max-wait=-1 |
||||||
#spring.redis.jedis.pool.max-idle=8 |
spring.redis.jedis.pool.max-idle=8 |
||||||
#spring.redis.jedis.pool.min-idle=0 |
spring.redis.jedis.pool.min-idle=0 |
Loading…
Reference in new issue