|
@@ -48,6 +48,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.nio.file.*;
|
|
|
|
+import java.nio.file.attribute.BasicFileAttributes;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
@@ -315,6 +318,12 @@ public class MachineNodeServiceImpl implements NodeOperationService {
|
|
filePathList.addAll(subFileList);
|
|
filePathList.addAll(subFileList);
|
|
|
|
|
|
data.put("subFileList", filePathList);
|
|
data.put("subFileList", filePathList);
|
|
|
|
+ List<String> toolFileList=new ArrayList<>();
|
|
|
|
+ String ip = productionresource.getIp();
|
|
|
|
+ //getSharedFilePath(toolFileList,ip);
|
|
|
|
+ data.put("toolFileList", toolFileList);
|
|
|
|
+
|
|
|
|
+
|
|
map.put("data", data);
|
|
map.put("data", data);
|
|
map.put("result", true);
|
|
map.put("result", true);
|
|
}
|
|
}
|
|
@@ -515,4 +524,35 @@ public class MachineNodeServiceImpl implements NodeOperationService {
|
|
return deviceList.get(0);
|
|
return deviceList.get(0);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ public void getSharedFilePath(List<String> list,String ip){
|
|
|
|
+ String sharedFolderPath = "\\\\Win-b6h3n3fgd72\\"+ip;
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ Path folderPath = Paths.get(sharedFolderPath);
|
|
|
|
+
|
|
|
|
+ if (!Files.exists(folderPath)) {
|
|
|
|
+ log.error("共享文件夹不存在:" + sharedFolderPath);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // 遍历共享文件夹中的所有文件
|
|
|
|
+ Files.walkFileTree(folderPath, new SimpleFileVisitor<Path>() {
|
|
|
|
+ @Override
|
|
|
|
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
|
|
|
|
+ log.info("文件路径: " + file.toString().replace("/", "\\"));
|
|
|
|
+ list.add(file.toString().replace("/", "\\"));
|
|
|
|
+ return FileVisitResult.CONTINUE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public FileVisitResult visitFileFailed(Path file, IOException exc) {
|
|
|
|
+ log.error("无法访问文件: " + file.toString());
|
|
|
|
+ return FileVisitResult.CONTINUE;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ log.error("上传对刀仪文件出错:",e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|