手持机

This commit is contained in:
张怡蓉
2025-09-10 15:03:51 +08:00
parent 94e3a9d000
commit 0e82934fc3
38 changed files with 905 additions and 131 deletions

View File

@@ -34,6 +34,7 @@ public class I18nConfig implements WebMvcConfigurer
LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
// 参数名
lci.setParamName("lang");
//获取修改完后的语言
return lci;
}

View File

@@ -115,7 +115,7 @@ public class SecurityConfig
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html","/changeLanguage", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/pda/**").permitAll()
.antMatchers("/api/**","/api2wms/**","/api2wcs/**").permitAll()
.antMatchers("/api/**","/api2wms/**","/api2wcs/**","/common/download").permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated();
})

View File

@@ -2,6 +2,7 @@ package com.ruoyi.framework.web.service;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -28,6 +29,13 @@ import com.ruoyi.framework.manager.factory.AsyncFactory;
import com.ruoyi.framework.security.context.AuthenticationContextHolder;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
/**
* 登录校验方法
@@ -96,6 +104,7 @@ public class SysLoginService
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
recordLoginInfo(loginUser.getUserId());
// 生成token
return tokenService.createToken(loginUser);
}