Merge remote-tracking branch 'origin/main'

This commit is contained in:
gaoqr
2024-06-21 14:21:49 +08:00
18 changed files with 170 additions and 131 deletions
@@ -19,6 +19,9 @@ import java.nio.charset.StandardCharsets;
@Slf4j
public class LoginUserRequestInterceptor implements RequestInterceptor {
//数据源编码
private static final String DATA_SOURCE_CODE = "data-code";
@Override
@SneakyThrows
public void apply(RequestTemplate requestTemplate) {
@@ -28,6 +31,7 @@ public class LoginUserRequestInterceptor implements RequestInterceptor {
String userStr = JsonUtils.toJsonString(user);
userStr = URLEncoder.encode(userStr, StandardCharsets.UTF_8.name()); // 编码,避免中文乱码
requestTemplate.header(SecurityFrameworkUtils.LOGIN_USER_HEADER, userStr);
requestTemplate.header(DATA_SOURCE_CODE, user.getDataCode());
} catch (Exception ex) {
log.error("[apply][序列化 LoginUser({}) 发生异常]", user, ex);
throw ex;