diff --git a/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java b/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java index 407b0cb..fcaae57 100644 --- a/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java +++ b/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java @@ -355,6 +355,7 @@ public class BatchImportSupport { // 3.1) 查询当前租户下的 companyId 映射 LinkedHashMap companyIdByName = new LinkedHashMap<>(); LinkedHashMap ambiguousByName = new LinkedHashMap<>(); + // For display: prefer matchName (normalized) then name. HashMap companyNameById = new HashMap<>(); LinkedHashSet nameSet = new LinkedHashSet<>(); for (T row : tenantRows) { @@ -385,8 +386,12 @@ public class BatchImportSupport { if (c == null || c.getId() == null) { continue; } - if (c.getName() != null && !c.getName().trim().isEmpty()) { - companyNameById.putIfAbsent(c.getId(), c.getName().trim()); + String displayName = c.getMatchName(); + if (displayName == null || displayName.trim().isEmpty()) { + displayName = c.getName(); + } + if (displayName != null && !displayName.trim().isEmpty()) { + companyNameById.putIfAbsent(c.getId(), displayName.trim()); } addCompanyNameMapping(companyIdByName, ambiguousByName, normalizeCompanyName(c.getName()), c.getId()); addCompanyNameMapping(companyIdByName, ambiguousByName, normalizeCompanyName(c.getMatchName()), c.getId());