From af9ceafb15c1c6e4abb3b3e4626e5ccc5d10b464 Mon Sep 17 00:00:00 2001 From: lijiaqi Date: Mon, 6 Feb 2023 15:38:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8C=85dist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ .../ydool/platform/saToken/config/SaTokenConfig.java | 12 ++++++++---- .../platform/saToken/config/StpInterfaceImpl.java | 2 ++ .../ydool/system/service/impl/AuthServiceImpl.java | 11 +++++++++++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 1848206..f0a368c 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,5 @@ tests/**/coverage/ logs/ upload/ +/src/main/resources/html/ +/src/main/resources/templates/ \ No newline at end of file diff --git a/src/main/java/com/ydool/platform/saToken/config/SaTokenConfig.java b/src/main/java/com/ydool/platform/saToken/config/SaTokenConfig.java index ee973e3..2fc8ad5 100644 --- a/src/main/java/com/ydool/platform/saToken/config/SaTokenConfig.java +++ b/src/main/java/com/ydool/platform/saToken/config/SaTokenConfig.java @@ -4,10 +4,7 @@ import cn.dev33.satoken.interceptor.SaInterceptor; import cn.dev33.satoken.stp.StpUtil; import com.ydool.common.constant.UrlConstant; import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.CorsRegistry; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import org.springframework.web.servlet.config.annotation.*; @Configuration public class SaTokenConfig implements WebMvcConfigurer { @@ -22,9 +19,16 @@ public class SaTokenConfig implements WebMvcConfigurer { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("/assets/**").addResourceLocations("classpath:/html/dist/assets/"); registry.addResourceHandler("/upload/**").addResourceLocations("file:" + System.getProperty("user.dir") + "/upload/"); } + @Override + public void addViewControllers(ViewControllerRegistry registry) { + registry.addViewController("/").setViewName("dist/index.html"); + } + + @Override public void addCorsMappings(CorsRegistry registry) { diff --git a/src/main/java/com/ydool/platform/saToken/config/StpInterfaceImpl.java b/src/main/java/com/ydool/platform/saToken/config/StpInterfaceImpl.java index 9d13f35..2abcfdd 100644 --- a/src/main/java/com/ydool/platform/saToken/config/StpInterfaceImpl.java +++ b/src/main/java/com/ydool/platform/saToken/config/StpInterfaceImpl.java @@ -7,6 +7,7 @@ import com.ydool.system.entity.Menu; import com.ydool.system.entity.Role; import com.ydool.system.service.impl.UserServiceImpl; import org.springframework.stereotype.Component; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import java.util.ArrayList; import java.util.List; @@ -33,6 +34,7 @@ public class StpInterfaceImpl implements StpInterface { return list; } + /** * 返回一个账号所拥有的角色标识集合 (权限与角色可分开校验) */ diff --git a/src/main/java/com/ydool/system/service/impl/AuthServiceImpl.java b/src/main/java/com/ydool/system/service/impl/AuthServiceImpl.java index 219950d..06017ee 100644 --- a/src/main/java/com/ydool/system/service/impl/AuthServiceImpl.java +++ b/src/main/java/com/ydool/system/service/impl/AuthServiceImpl.java @@ -13,6 +13,7 @@ import com.ydool.common.cache.ConfigCache; import com.ydool.common.data.dto.AjaxResult; import com.ydool.common.utils.HttpServletUtil; import com.ydool.common.utils.PasswordUtil; +import com.ydool.system.entity.Dept; import com.ydool.system.entity.Menu; import com.ydool.system.entity.Role; import com.ydool.system.entity.User; @@ -39,6 +40,9 @@ public class AuthServiceImpl extends BaseService implements IA @Autowired private IUserService userService; + @Autowired + private DeptServiceImpl deptService; + /** * 登录接口 @@ -102,6 +106,13 @@ public class AuthServiceImpl extends BaseService implements IA } result.set("perms", perms); + String deptName = ""; + Dept dept = deptService.getById(loginUser.getDept()); + if (ObjectUtil.isNotNull(dept)) { + deptName = dept.getName(); + } + result.set("deptName", deptName); + //是否需要强制修改密码 result.set("need_init_password", password.equals(ConfigCache.getStr(ConfigCache.USER_INIT_PASSWORD, "888888")) ? true : false);