Prechádzať zdrojové kódy

读取三坐标检测文件

wudingsheng 2 mesiacov pred
rodič
commit
3920754a0b

+ 9 - 3
imcs-admin-boot/imcs-common/src/main/java/com/github/zuihou/common/util/SmbShareFileUtil.java

@@ -367,10 +367,16 @@ public class SmbShareFileUtil {
         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<>();
         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) {
             logger.info("没有找到需要处理的 Excel 文件。");
@@ -433,7 +439,7 @@ public class SmbShareFileUtil {
 
     public static void main(String[] args) {
         String folderPath = "D:\\CeShi"; // 替换为您的文件夹路径
-        Map<String, List<String>> resultMap = processExcelFiles(folderPath);
+        Map<String, List<String>> resultMap = processExcelFiles(folderPath,"processed");
 
         // 打印结果
         resultMap.forEach((key, value) -> {