diff --git a/core/core-backend/src/main/java/io/dataease/substitute/permissions/user/SubstituteUserServer.java b/core/core-backend/src/main/java/io/dataease/substitute/permissions/user/SubstituteUserServer.java
index 1b64d68531..345255cf22 100644
--- a/core/core-backend/src/main/java/io/dataease/substitute/permissions/user/SubstituteUserServer.java
+++ b/core/core-backend/src/main/java/io/dataease/substitute/permissions/user/SubstituteUserServer.java
@@ -1,18 +1,24 @@
package io.dataease.substitute.permissions.user;
+import io.dataease.api.permissions.user.dto.LangSwitchRequest;
import io.dataease.api.permissions.user.vo.CurIpVO;
import io.dataease.api.permissions.user.vo.UserFormVO;
+import io.dataease.exception.DEException;
+import io.dataease.i18n.Lang;
+import io.dataease.utils.CacheUtils;
import io.dataease.utils.IPUtils;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.stereotype.Component;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
+import static io.dataease.constant.CacheConstant.UserCacheConstant.USER_COMMUNITY_LANGUAGE;
+
@Component
@ConditionalOnMissingBean(name = "userServer")
@RestController
@@ -26,6 +32,10 @@ public class SubstituteUserServer {
result.put("name", "管理员");
result.put("oid", "1");
result.put("language", "zh-CN");
+ Object langObj = CacheUtils.get(USER_COMMUNITY_LANGUAGE, "de");
+ if (ObjectUtils.isNotEmpty(langObj) && StringUtils.isNotBlank(langObj.toString())) {
+ result.put("language", langObj.toString());
+ }
return result;
}
@@ -49,4 +59,17 @@ public class SubstituteUserServer {
curIpVO.setIp(IPUtils.get());
return curIpVO;
}
+
+ @PostMapping("/switchLanguage")
+ public void switchLanguage(@RequestBody LangSwitchRequest request) {
+ String lang = request.getLang();
+ if (StringUtils.equalsIgnoreCase(Lang.zh_CN.getDesc(), lang)) {
+ lang = Lang.zh_CN.getDesc();
+ } else if (StringUtils.equalsAnyIgnoreCase(lang, "en", "tw")) {
+ lang = lang.toLowerCase();
+ } else {
+ DEException.throwException("无效language");
+ }
+ CacheUtils.put(USER_COMMUNITY_LANGUAGE, "de", lang);
+ }
}
diff --git a/core/core-backend/src/main/resources/ehcache/ehcache.xml b/core/core-backend/src/main/resources/ehcache/ehcache.xml
index 566d008260..58918c8888 100644
--- a/core/core-backend/src/main/resources/ehcache/ehcache.xml
+++ b/core/core-backend/src/main/resources/ehcache/ehcache.xml
@@ -98,6 +98,10 @@
java.lang.String
java.lang.Object
+
+ java.lang.String
+ java.lang.Object
+
java.lang.String
diff --git a/de-xpack b/de-xpack
index cb6d275109..b814bd2cbe 160000
--- a/de-xpack
+++ b/de-xpack
@@ -1 +1 @@
-Subproject commit cb6d275109949c33f1474054908d961f1e9f0e2d
+Subproject commit b814bd2cbe6d8108875ea7df1cd7c45ff07c0634
diff --git a/sdk/common/src/main/java/io/dataease/constant/CacheConstant.java b/sdk/common/src/main/java/io/dataease/constant/CacheConstant.java
index 87f1152da0..d277b4f75b 100644
--- a/sdk/common/src/main/java/io/dataease/constant/CacheConstant.java
+++ b/sdk/common/src/main/java/io/dataease/constant/CacheConstant.java
@@ -8,6 +8,7 @@ public class CacheConstant {
public static final String USER_ROLES_CACHE = "de_v2_user_roles";
public static final String USER_BUSI_PERS_CACHE = "de_v2_user_busi_pers";
public static final String USER_BUSI_PERS_INTERACTIVE_CACHE = "de_v2_user_busi_pers_interactive";
+ public static final String USER_COMMUNITY_LANGUAGE = "de_v2_user_community_language";
}
public static class RoleCacheConstant {