人员上传问题修改

This commit is contained in:
tqzhang 2025-01-20 18:34:23 +08:00
parent a4380c4309
commit a25fd6b832
1 changed files with 6 additions and 10 deletions

View File

@ -414,7 +414,7 @@ public class ImportServiceImpl implements ImportService {
nameList = new ArrayList<>();
namePhoneList = new ArrayList<>();
map = new HashMap<>();
String encoding = "UTF-8";
String encoding = "GBK";
ZipFile zipFile = new ZipFile(path);
zipFile.setFileNameCharset(encoding);
List<FileHeader> list = zipFile.getFileHeaders();
@ -440,7 +440,6 @@ public class ImportServiceImpl implements ImportService {
String name = fileName.split("/")[_index + 1];
map.put(beforeName, "其他文件".equals(fileName.split("/")[_index + 1]) ? "" : fileName.split("/")[_index + 1]);
}
// 设置编码
if (isMessyCode(fileName)) {
encoding = "UTF-8";
@ -450,9 +449,6 @@ public class ImportServiceImpl implements ImportService {
nameList.add(fileName);
try {
if (i == (list.size() - 1)) {
map.put(beforeName, folderName.toString());
}
String currentName = fileName.split("/")[_index].split("_")[1];
if (!beforeName.equals(currentName)) {
// 不相同名称时对map进行赋值
@ -460,7 +456,9 @@ public class ImportServiceImpl implements ImportService {
beforeName = currentName;
folderName = new StringBuilder();
}
if (i == (list.size() - 1)) {
map.put(beforeName, folderName.toString());
}
if (!"其他文件".equals(fileName.split("/")[_index + 1])) {
folderName.append(fileName.split("/")[_index + 1]).append(",");
}
@ -468,10 +466,6 @@ public class ImportServiceImpl implements ImportService {
folderName.append(fileName.split("/")[_index + 1]).append(",");
}
if (i == list.size() - 1) {
map.put(beforeName, folderName.toString());
}
// 使用set方法对名称进行过滤 保持namePhoneList数据的唯一性
if (uniqueNames.add(currentName)) {
namePhoneList.add(currentName);
@ -479,6 +473,8 @@ public class ImportServiceImpl implements ImportService {
} catch (ArrayIndexOutOfBoundsException e) {
log.error("文件导入识别到不存在文件夹的文件");
}
}else if (i == (list.size() - 1)){
map.put(beforeName, folderName.toString());
}
i++;
}