信息变更,文件名称格式化

This commit is contained in:
dxfeng 2025-08-08 13:52:09 +08:00
parent 6d7a9177f1
commit 46d0950bed
2 changed files with 10 additions and 8 deletions

View File

@ -71,6 +71,8 @@ public class FormatChangeFilesAction implements EsbServerlessRpcRemoteInterface
renameFile(Convert.toStr(entryRecord.get("jkz")), prefix, "健康证");
renameFile(Convert.toStr(entryRecord.get("sjdwlzzm")), prefix, "离职证明");
renameFile(Convert.toStr(entryRecord.get("qtfj")), prefix, "其他附件");
renameFile(Convert.toStr(entryRecord.get("sbzmwj")), prefix, "社保证明");
renameFile(Convert.toStr(entryRecord.get("xwzszp")), prefix, "学位证书照片");
return WeaResult.success(params);
@ -109,10 +111,9 @@ public class FormatChangeFilesAction implements EsbServerlessRpcRemoteInterface
localDate = DateUtil.toLocalDateTime(new Date());
}
String formatDate = DateUtil.formatDateTime(localDate, DateTimeFormatter.ofPattern("yyyyMMddHHmm"));
int lastDotIndex = fileName.lastIndexOf(".");
String suffix = fileName.substring(lastDotIndex);
String fileNameWithoutSuffix = fileName.substring(0, lastDotIndex);
String newFileName = prefix + "-" + fileNameWithoutSuffix + "-" + formatDate + suffix;
int lastDotIndex = fileObj.getName().lastIndexOf(".");
String suffix = fileObj.getName().substring(lastDotIndex);
String newFileName = prefix + "-" + fileName + "-" + formatDate + suffix;
fileObj.setName(newFileName);
fileClientService.update(fileObj);
}

View File

@ -73,6 +73,8 @@ public class FormatEntryFilesAction implements EsbServerlessRpcRemoteInterface {
renameFile(Convert.toStr(entryRecord.get("jkz")), prefix, "健康证");
renameFile(Convert.toStr(entryRecord.get("sjdwlzzm")), prefix, "离职证明");
renameFile(Convert.toStr(entryRecord.get("qtfj")), prefix, "其他附件");
renameFile(Convert.toStr(entryRecord.get("sbzmwj")), prefix, "社保证明");
renameFile(Convert.toStr(entryRecord.get("xwzszp")), prefix, "学位证书照片");
return WeaResult.success(params);
@ -111,10 +113,9 @@ public class FormatEntryFilesAction implements EsbServerlessRpcRemoteInterface {
localDate = DateUtil.toLocalDateTime(new Date());
}
String formatDate = DateUtil.formatDateTime(localDate, DateTimeFormatter.ofPattern("yyyyMMddHHmm"));
int lastDotIndex = fileName.lastIndexOf(".");
String suffix = fileName.substring(lastDotIndex);
String fileNameWithoutSuffix = fileName.substring(0, lastDotIndex);
String newFileName = prefix + "-" + fileNameWithoutSuffix + "-" + formatDate + suffix;
int lastDotIndex = fileObj.getName().lastIndexOf(".");
String suffix = fileObj.getName().substring(lastDotIndex);
String newFileName = prefix + "-" + fileName + "-" + formatDate + suffix;
fileObj.setName(newFileName);
fileClientService.update(fileObj);
}