|
@@ -367,10 +367,16 @@ public class SmbShareFileUtil {
|
|
return returnFileName;
|
|
return returnFileName;
|
|
}
|
|
}
|
|
|
|
|
|
- public static Map<String, List<String>> processExcelFiles(String folderPath) {
|
|
|
|
|
|
+ /**
|
|
|
|
+ *
|
|
|
|
+ * @param folderPath 文件夹
|
|
|
|
+ * @param containsName 需要匹配的名字
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static Map<String, List<String>> processExcelFiles(String folderPath,String containsName) {
|
|
Map<String, List<String>> resultMap = new HashMap<>();
|
|
Map<String, List<String>> resultMap = new HashMap<>();
|
|
File folder = new File(folderPath);
|
|
File folder = new File(folderPath);
|
|
- File[] files = folder.listFiles((dir, name) -> (name.endsWith(".xlsx") || name.endsWith(".xls")) && name.indexOf("processed") == -1);
|
|
|
|
|
|
+ File[] files = folder.listFiles((dir, name) -> (name.endsWith(".xlsx") || name.endsWith(".xls")) && name.contains(containsName));
|
|
|
|
|
|
if (files == null || files.length == 0) {
|
|
if (files == null || files.length == 0) {
|
|
logger.info("没有找到需要处理的 Excel 文件。");
|
|
logger.info("没有找到需要处理的 Excel 文件。");
|
|
@@ -433,7 +439,7 @@ public class SmbShareFileUtil {
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
String folderPath = "D:\\CeShi"; // 替换为您的文件夹路径
|
|
String folderPath = "D:\\CeShi"; // 替换为您的文件夹路径
|
|
- Map<String, List<String>> resultMap = processExcelFiles(folderPath);
|
|
|
|
|
|
+ Map<String, List<String>> resultMap = processExcelFiles(folderPath,"processed");
|
|
|
|
|
|
// 打印结果
|
|
// 打印结果
|
|
resultMap.forEach((key, value) -> {
|
|
resultMap.forEach((key, value) -> {
|