!85 feat(excel): Excel导入校验和翻译支持逗号分隔多值
* feat(excel): Excel导入校验和翻译支持逗号分隔多值 * fix(xispeak): 移除完成状态Excel导入导出注解,避免导入时覆盖系统自动维护的状态 * fix(xispeak): 修复密级Excel列名typo 非秘→非密 * fix(xispeak,partymatter,dq): 移除实体类 bpmStatus 字段默认值,改为 service 层设置,避免 Q… * fix(xispeak,partymatter,dq): 实体类 bpmStatus 默认值设为"未开始"
This commit is contained in:
+29
@@ -220,6 +220,24 @@ public final class ExcelAnnotationUtils {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// 逗号分隔多值:逐个验证每个部分是否在字典范围内
|
||||
if (value.contains(",")) {
|
||||
String[] parts = value.split(",");
|
||||
for (String part : parts) {
|
||||
String trimmed = part.trim();
|
||||
if (trimmed.isEmpty()) continue;
|
||||
boolean found = false;
|
||||
for (String s : replace) {
|
||||
String[] arr = s.split(",");
|
||||
if (arr.length >= 2 && arr[0].equals(trimmed)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -231,6 +249,17 @@ public final class ExcelAnnotationUtils {
|
||||
String resolved = displayToCode.getOrDefault(value, value);
|
||||
|
||||
if (type == String.class) {
|
||||
// 逗号分隔多值:逐个翻译后再拼回(如 "部门A,部门B" → "id_a,id_b")
|
||||
if (resolved.equals(value) && value.contains(",")) {
|
||||
String[] parts = value.split(",");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
if (i > 0) sb.append(",");
|
||||
String trimmed = parts[i].trim();
|
||||
sb.append(displayToCode.getOrDefault(trimmed, trimmed));
|
||||
}
|
||||
resolved = sb.toString();
|
||||
}
|
||||
field.set(obj, resolved);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user