[agent-pipeline] pipe-20260328055039-5mki round-1
This commit is contained in:
@@ -45,7 +45,7 @@ public class MultilangService extends BaseService {
|
||||
if (current == null) {
|
||||
throw new IllegalArgumentException("언어를 찾을 수 없습니다: " + langCode);
|
||||
}
|
||||
String newStatus = "Y".equals(current.get("isActive")) ? "N" : "Y";
|
||||
String newStatus = "Y".equals(current.get("is_active")) ? "N" : "Y";
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("langCode", langCode);
|
||||
params.put("newStatus", newStatus);
|
||||
@@ -119,7 +119,7 @@ public class MultilangService extends BaseService {
|
||||
if (current == null) {
|
||||
throw new IllegalArgumentException("다국어 키를 찾을 수 없습니다: " + keyId);
|
||||
}
|
||||
String newStatus = "Y".equals(current.get("isActive")) ? "N" : "Y";
|
||||
String newStatus = "Y".equals(current.get("is_active")) ? "N" : "Y";
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("keyId", keyId);
|
||||
params.put("newStatus", newStatus);
|
||||
@@ -147,14 +147,14 @@ public class MultilangService extends BaseService {
|
||||
"companyCode", companyCode, "menuCode", menuCode,
|
||||
"langKey", langKey, "userLang", userLang);
|
||||
Map<String, Object> result = sqlSession.selectOne(NS + "getMultilangUserText", params);
|
||||
return result != null ? str(result.get("langText")) : langKey;
|
||||
return result != null ? str(result.get("lang_text")) : langKey;
|
||||
}
|
||||
|
||||
public String getLangText(String companyCode, String langKey, String langCode) {
|
||||
Map<String, Object> params = Map.of(
|
||||
"companyCode", companyCode, "langKey", langKey, "langCode", langCode);
|
||||
Map<String, Object> result = sqlSession.selectOne(NS + "getMultilangSingleText", params);
|
||||
return result != null ? str(result.get("langText")) : langKey;
|
||||
return result != null ? str(result.get("lang_text")) : langKey;
|
||||
}
|
||||
|
||||
public Map<String, String> getBatchTranslations(String companyCode, String menuCode,
|
||||
@@ -169,9 +169,9 @@ public class MultilangService extends BaseService {
|
||||
Map<String, String> result = new LinkedHashMap<>();
|
||||
Set<String> processed = new HashSet<>();
|
||||
for (Map<String, Object> t : translations) {
|
||||
String key = str(t.get("langKey"));
|
||||
String key = str(t.get("lang_key"));
|
||||
if (langKeys.contains(key) && !processed.contains(key)) {
|
||||
result.put(key, str(t.get("langText")));
|
||||
result.put(key, str(t.get("lang_text")));
|
||||
processed.add(key);
|
||||
}
|
||||
}
|
||||
@@ -183,9 +183,9 @@ public class MultilangService extends BaseService {
|
||||
List<Map<String, Object>> fallback = sqlSession.selectList(NS + "getMultilangFallbackTranslationList", fallbackParams);
|
||||
Set<String> fbProcessed = new HashSet<>();
|
||||
for (Map<String, Object> t : fallback) {
|
||||
String key = str(t.get("langKey"));
|
||||
String key = str(t.get("lang_key"));
|
||||
if (!result.containsKey(key) && !fbProcessed.contains(key)) {
|
||||
result.put(key, str(t.get("langText")));
|
||||
result.put(key, str(t.get("lang_text")));
|
||||
fbProcessed.add(key);
|
||||
}
|
||||
}
|
||||
@@ -212,11 +212,11 @@ public class MultilangService extends BaseService {
|
||||
for (Map<String, Object> cat : flat) {
|
||||
Map<String, Object> node = new LinkedHashMap<>(cat);
|
||||
node.put("children", new ArrayList<>());
|
||||
byId.put(toInt(cat.get("categoryId")), node);
|
||||
byId.put(toInt(cat.get("category_id")), node);
|
||||
}
|
||||
List<Map<String, Object>> roots = new ArrayList<>();
|
||||
for (Map<String, Object> node : byId.values()) {
|
||||
Object parentIdObj = node.get("parentId");
|
||||
Object parentIdObj = node.get("parent_id");
|
||||
if (parentIdObj == null) {
|
||||
roots.add(node);
|
||||
} else {
|
||||
@@ -280,7 +280,7 @@ public class MultilangService extends BaseService {
|
||||
result.put("langKey", langKey);
|
||||
result.put("exists", companyKey != null);
|
||||
result.put("isOverride", commonKey != null && companyKey == null);
|
||||
if (commonKey != null) result.put("baseKeyId", toInt(commonKey.get("keyId")));
|
||||
if (commonKey != null) result.put("baseKeyId", toInt(commonKey.get("key_id")));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -290,16 +290,16 @@ public class MultilangService extends BaseService {
|
||||
String companyCode = str(params.get("companyCode"));
|
||||
Map<String, Object> baseKey = sqlSession.selectOne(NS + "getMultilangBaseKeyInfo", Map.of("keyId", baseKeyId));
|
||||
if (baseKey == null) throw new IllegalArgumentException("원본 키를 찾을 수 없습니다");
|
||||
if (!"*".equals(str(baseKey.get("companyCode")))) throw new IllegalArgumentException("공통 키(*)만 오버라이드 할 수 있습니다");
|
||||
String langKey = str(baseKey.get("langKey"));
|
||||
if (!"*".equals(str(baseKey.get("company_code")))) throw new IllegalArgumentException("공통 키(*)만 오버라이드 할 수 있습니다");
|
||||
String langKey = str(baseKey.get("lang_key"));
|
||||
if (sqlSession.selectOne(NS + "getMultilangKeyByCompanyAndKey", Map.of("companyCode", companyCode, "langKey", langKey)) != null) {
|
||||
throw new IllegalArgumentException("이미 해당 회사의 오버라이드 키가 존재합니다");
|
||||
}
|
||||
Map<String, Object> insertParams = new HashMap<>();
|
||||
insertParams.put("companyCode", companyCode);
|
||||
insertParams.put("langKey", langKey);
|
||||
insertParams.put("categoryId", baseKey.get("categoryId"));
|
||||
insertParams.put("keyMeaning", baseKey.get("keyMeaning"));
|
||||
insertParams.put("categoryId", baseKey.get("category_id"));
|
||||
insertParams.put("keyMeaning", baseKey.get("key_meaning"));
|
||||
insertParams.put("baseKeyId", baseKeyId);
|
||||
insertParams.put("createdBy", params.getOrDefault("createdBy", "system"));
|
||||
sqlSession.insert(NS + "insertMultilangOverrideKey", insertParams);
|
||||
@@ -327,20 +327,20 @@ public class MultilangService extends BaseService {
|
||||
public List<Map<String, Object>> generateScreenLabelKeys(Map<String, Object> params) {
|
||||
int screenId = toInt(params.get("screenId"));
|
||||
Map<String, Object> screenInfo = sqlSession.selectOne(NS + "getMultilangScreenCompanyCode", Map.of("screenId", screenId));
|
||||
String companyCode = (screenInfo != null && !str(screenInfo.get("companyCode")).isEmpty())
|
||||
? str(screenInfo.get("companyCode")) : str(params.getOrDefault("companyCode", "*"));
|
||||
String companyCode = (screenInfo != null && !str(screenInfo.get("company_code")).isEmpty())
|
||||
? str(screenInfo.get("company_code")) : str(params.getOrDefault("companyCode", "*"));
|
||||
String companyName;
|
||||
if ("*".equals(companyCode)) {
|
||||
companyName = "공통";
|
||||
} else {
|
||||
Map<String, Object> companyInfo = sqlSession.selectOne(NS + "getMultilangCompanyName", Map.of("companyCode", companyCode));
|
||||
companyName = (companyInfo != null) ? str(companyInfo.get("companyName")) : companyCode;
|
||||
companyName = (companyInfo != null) ? str(companyInfo.get("company_name")) : companyCode;
|
||||
}
|
||||
List<String> groupPath = getScreenGroupPath(screenId);
|
||||
int categoryId = ensureScreenGroupCategory(companyCode, companyName, groupPath);
|
||||
List<Map<String, Object>> categoryPath = getCategoryPath(categoryId);
|
||||
List<String> keyPrefixParts = new ArrayList<>();
|
||||
for (Map<String, Object> c : categoryPath) keyPrefixParts.add(str(c.get("keyPrefix")));
|
||||
for (Map<String, Object> c : categoryPath) keyPrefixParts.add(str(c.get("key_prefix")));
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Map<String, Object>> labels = (List<Map<String, Object>>) params.get("labels");
|
||||
List<Map<String, Object>> results = new ArrayList<>();
|
||||
@@ -354,7 +354,7 @@ public class MultilangService extends BaseService {
|
||||
Map<String, Object> existing = sqlSession.selectOne(NS + "getMultilangKeyByCompanyAndKey", Map.of("companyCode", companyCode, "langKey", langKey));
|
||||
int keyId;
|
||||
if (existing != null) {
|
||||
keyId = toInt(existing.get("keyId"));
|
||||
keyId = toInt(existing.get("key_id"));
|
||||
} else {
|
||||
Map<String, Object> insertParams = new HashMap<>();
|
||||
insertParams.put("companyCode", companyCode);
|
||||
@@ -379,10 +379,10 @@ public class MultilangService extends BaseService {
|
||||
private List<String> getScreenGroupPath(int screenId) {
|
||||
Map<String, Object> groupRow = sqlSession.selectOne(NS + "getMultilangScreenGroupId", Map.of("screenId", screenId));
|
||||
if (groupRow == null) return Collections.emptyList();
|
||||
int groupId = toInt(groupRow.get("groupId"));
|
||||
int groupId = toInt(groupRow.get("group_id"));
|
||||
List<Map<String, Object>> groups = sqlSession.selectList(NS + "getMultilangScreenGroupPath", Map.of("groupId", groupId));
|
||||
List<String> path = new ArrayList<>();
|
||||
for (Map<String, Object> g : groups) path.add(str(g.get("groupName")));
|
||||
for (Map<String, Object> g : groups) path.add(str(g.get("group_name")));
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ public class MultilangService extends BaseService {
|
||||
for (String groupName : groupPath) {
|
||||
Map<String, Object> existing = sqlSession.selectOne(NS + "getMultilangCategoryByNameAndParent", Map.of("categoryName", groupName, "parentId", parentId));
|
||||
if (existing != null) {
|
||||
parentId = toInt(existing.get("categoryId"));
|
||||
parentId = toInt(existing.get("category_id"));
|
||||
} else {
|
||||
Map<String, Object> insertParams = new HashMap<>();
|
||||
insertParams.put("categoryCode", (companyCode + "_GROUP_" + groupName).replace("\\s+", "_"));
|
||||
@@ -414,7 +414,7 @@ public class MultilangService extends BaseService {
|
||||
private int ensureCompanyCategory(String companyCode, String companyName) {
|
||||
int screenRootId = ensureScreenRootCategory();
|
||||
Map<String, Object> existing = sqlSession.selectOne(NS + "getMultilangCategoryByCodeAndParent", Map.of("categoryCode", companyCode, "parentId", screenRootId));
|
||||
if (existing != null) return toInt(existing.get("categoryId"));
|
||||
if (existing != null) return toInt(existing.get("category_id"));
|
||||
String displayName = "*".equals(companyCode) ? "공통" : companyName;
|
||||
String keyPrefix = "*".equals(companyCode) ? "common" : companyCode.toLowerCase();
|
||||
Map<String, Object> insertParams = new HashMap<>();
|
||||
@@ -431,7 +431,7 @@ public class MultilangService extends BaseService {
|
||||
|
||||
private int ensureScreenRootCategory() {
|
||||
Map<String, Object> existing = sqlSession.selectOne(NS + "getMultilangRootCategoryByCode", Map.of("categoryCode", "screen"));
|
||||
if (existing != null) return toInt(existing.get("categoryId"));
|
||||
if (existing != null) return toInt(existing.get("category_id"));
|
||||
Map<String, Object> insertParams = new HashMap<>();
|
||||
insertParams.put("categoryCode", "screen");
|
||||
insertParams.put("categoryName", "화면");
|
||||
@@ -446,7 +446,7 @@ public class MultilangService extends BaseService {
|
||||
|
||||
private String buildLangKey(List<Map<String, Object>> categoryPath, String keyMeaning) {
|
||||
List<String> parts = new ArrayList<>();
|
||||
for (Map<String, Object> c : categoryPath) parts.add(str(c.get("keyPrefix")));
|
||||
for (Map<String, Object> c : categoryPath) parts.add(str(c.get("key_prefix")));
|
||||
parts.add(keyMeaning);
|
||||
return String.join(".", parts);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user