添加首页统计图
This commit is contained in:
@@ -10,32 +10,32 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class HttpConnectorConfig {
|
||||
/**
|
||||
* 获取Http连接器
|
||||
* @return Connector
|
||||
*/
|
||||
public Connector getHttpConnector() {
|
||||
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
|
||||
connector.setScheme("http"); // 使用http协议
|
||||
connector.setSecure(false); // 非安全传输
|
||||
connector.setPort(8080); // HTTP监听端口
|
||||
connector.setRedirectPort(443); // 重定向端口
|
||||
return connector;
|
||||
}
|
||||
@Bean
|
||||
public TomcatServletWebServerFactory tomcatServletWebServerFactory() {
|
||||
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() {
|
||||
@Override
|
||||
protected void postProcessContext(Context context) {
|
||||
SecurityConstraint securityConstraint = new SecurityConstraint();
|
||||
securityConstraint.setUserConstraint("CONFIDENTIAL"); // 设置约束
|
||||
SecurityCollection collection = new SecurityCollection();
|
||||
collection.addPattern("/*"); // 所有的路径全部进行重定向处理
|
||||
securityConstraint.addCollection(collection);
|
||||
context.addConstraint(securityConstraint);
|
||||
}
|
||||
};
|
||||
tomcat.addAdditionalTomcatConnectors(getHttpConnector()); // 添加连接器
|
||||
return tomcat;
|
||||
}
|
||||
// /**
|
||||
// * 获取Http连接器
|
||||
// * @return Connector
|
||||
// */
|
||||
// public Connector getHttpConnector() {
|
||||
// Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
|
||||
// connector.setScheme("http"); // 使用http协议
|
||||
// connector.setSecure(false); // 非安全传输
|
||||
// connector.setPort(8080); // HTTP监听端口
|
||||
// connector.setRedirectPort(443); // 重定向端口
|
||||
// return connector;
|
||||
// }
|
||||
// @Bean
|
||||
// public TomcatServletWebServerFactory tomcatServletWebServerFactory() {
|
||||
// TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() {
|
||||
// @Override
|
||||
// protected void postProcessContext(Context context) {
|
||||
// SecurityConstraint securityConstraint = new SecurityConstraint();
|
||||
// securityConstraint.setUserConstraint("CONFIDENTIAL"); // 设置约束
|
||||
// SecurityCollection collection = new SecurityCollection();
|
||||
// collection.addPattern("/*"); // 所有的路径全部进行重定向处理
|
||||
// securityConstraint.addCollection(collection);
|
||||
// context.addConstraint(securityConstraint);
|
||||
// }
|
||||
// };
|
||||
// tomcat.addAdditionalTomcatConnectors(getHttpConnector()); // 添加连接器
|
||||
// return tomcat;
|
||||
// }
|
||||
}
|
||||
@@ -115,7 +115,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
|
||||
// 静态资源,可匿名访问
|
||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||
.antMatchers("/cxxm/app/version/**","/cxxm/app/type/**","/cxxm/app/user/**").permitAll()
|
||||
.antMatchers("/cxxm/api/version/**","/cxxm/api/type/**","/cxxm/api/user/**").permitAll()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
|
||||
@@ -19,9 +19,10 @@ public class AutoFillMetaObjectHandler implements MetaObjectHandler {
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
log.info("start insert fill ....");
|
||||
// 获取当前登录用户
|
||||
String userName = SecurityUtils.getUsername();
|
||||
// String userName = SecurityUtils.getUsername();
|
||||
String nickName = SecurityUtils.getLoginUser().getUser().getNickName();
|
||||
Long deptId = SecurityUtils.getDeptId();
|
||||
fillValue("createBy", userName, metaObject);
|
||||
fillValue("createBy", nickName, metaObject);
|
||||
fillValue("createTime", DateUtils.getNowDate(), metaObject);
|
||||
fillValue("deptId", deptId, metaObject);
|
||||
}
|
||||
@@ -30,13 +31,15 @@ public class AutoFillMetaObjectHandler implements MetaObjectHandler {
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
log.info("start update fill ....");
|
||||
// 获取当前登录用户
|
||||
String userName = null;
|
||||
// String userName = null;
|
||||
String nickName = null;
|
||||
try{
|
||||
userName = SecurityUtils.getUsername();
|
||||
// userName = SecurityUtils.getUsername();
|
||||
nickName = SecurityUtils.getLoginUser().getUser().getNickName();
|
||||
}catch (Exception e){
|
||||
|
||||
}finally{
|
||||
fillValue("updateBy", userName, metaObject);
|
||||
fillValue("updateBy", nickName, metaObject);
|
||||
fillValue("updateTime", DateUtils.getNowDate(), metaObject);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user