xiongzhu 4 роки тому
батько
коміт
195dcc7942

+ 3 - 1
.gitignore

@@ -32,4 +32,6 @@ build/
 
 .DS_Store
 /upload
-www/
+www/
+src/main/resources/dataCenter
+src/main/resources/admin

+ 0 - 1
src/main/java/com/izouma/awesomeAdmin/config/WebMvcConfig.java

@@ -22,7 +22,6 @@ public class WebMvcConfig implements WebMvcConfigurer {
         // registry.addResourceHandler("/swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
         // registry.addResourceHandler("webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
         registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
-        registry.addResourceHandler("/admin/**").addResourceLocations("classpath:/static/admin/");
         registry.addResourceHandler("/files/**").addResourceLocations("file:" + localPath);
         registry.addResourceHandler("/MP_verify*").addResourceLocations("classpath:/");
     }

+ 2 - 1
src/main/java/com/izouma/awesomeAdmin/security/WebSecurityConfig.java

@@ -67,7 +67,6 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .antMatchers("/static/**").permitAll()
                 .antMatchers("/auth/**").permitAll()
                 .antMatchers("/captcha/**").permitAll()
-                .antMatchers("/admin/**").permitAll()
                 .antMatchers("/systemVariable/all").permitAll()
                 .antMatchers("/**/excel").permitAll()
                 .antMatchers("/wx/**").permitAll()
@@ -77,6 +76,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .antMatchers("/404").permitAll()
                 .antMatchers("/500").permitAll()
                 .antMatchers("/MP_verify*").permitAll()
+                .antMatchers("/admin/**").permitAll()
+                .antMatchers("/dataCenter/**").permitAll()
                 // all other requests need to be authenticated
                 .anyRequest().authenticated().and()
                 // make sure we use stateless session; session won't be used to

+ 11 - 2
src/main/java/com/izouma/awesomeAdmin/web/AppErrorController.java

@@ -1,25 +1,34 @@
 package com.izouma.awesomeAdmin.web;
 
+import org.apache.commons.io.IOUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.web.servlet.error.ErrorController;
+import org.springframework.context.ApplicationContext;
 import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.View;
 
 import javax.servlet.RequestDispatcher;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 
 @Controller
 public class AppErrorController implements ErrorController {
+    @Autowired
+    private ApplicationContext context;
+
     @Override
     public String getErrorPath() {
         return "/error";
     }
 
     @RequestMapping("/error")
-    public String handleError(HttpServletRequest request, Model model) {
+    public Object handleError(HttpServletRequest request, Model model) throws IOException {
         Object status = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
-
         if (status != null) {
             int statusCode = Integer.parseInt(status.toString());