yangys
2025-07-07 4301ffcfa7d715d7341cb77ba29dee24366fb2a3
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/MdmProgramImportService.java
@@ -54,7 +54,7 @@
         InputStream zipFileInputStream = file.getInputStream();//test
         byte[] bytes = FileUtil.copyToByteArray(zipFileInputStream);
         list = parseDncZipFromByteArray(bytes);
         list = parseMdmZipFromByteArray(bytes);
      } catch (IOException e) {
@@ -89,10 +89,8 @@
      System.out.println("创建的临时文件: " + tempFile);
      return tempFile.toFile();
   }
   public static List<MdmProgramImportVO> parseDncZipFromByteArray(byte[] zipData) throws IOException {
   public static List<MdmProgramImportVO> parseMdmZipFromByteArray(byte[] zipData) throws IOException {
      List<MdmProgramImportVO> list = new ArrayList<>();
      //List<DncSendBackData> datas  = ZipFileDirectoryScanner.getFilesInDirectoryRecursive(zipData, "");
      Map<String,String> fileMd5Map = new HashMap<>();
      Map<String,MdmProgramImportVO> fileDataMap = new HashMap<>();
      try (SeekableInMemoryByteChannel channel = new SeekableInMemoryByteChannel(zipData);
@@ -101,9 +99,8 @@
         ZipArchiveEntry entry;
         Enumeration<ZipArchiveEntry> entries = zipFile.getEntries();
         while (entries.hasMoreElements()) {
         //while ((entry = zis.getNextZipEntry()) != null) {
            entry = entries.nextElement();
            DncSendBackData prog = new DncSendBackData();
            String entryName = entry.getName();
            if (!entry.isDirectory()) {
@@ -120,9 +117,19 @@
                        d.setName(jsonObject.getString("name"));
                        d.setId(jsonObject.getLong("id"));
                        d.setCode(jsonObject.getString("code"));
                        //d.setFileBackTime(LocalDateTime.now());//到达时间
                        d.setDescription(jsonObject.getString("description"));
                        d.setCategory(jsonObject.getString("category"));
                        d.setBindNcNodeId(jsonObject.getLong("bindNcNodeId"));
                        d.setIsLastEdition(jsonObject.getInteger("isLastEdition"));
                        d.setIsLocked(jsonObject.getInteger("isLocked"));
                        d.setIsTest(jsonObject.getInteger("isTest"));
                        d.setMachineCode(jsonObject.getString("machineCode"));
                        d.setNcNodeId(jsonObject.getLong("ncNodeId"));
                        d.setPartNo(jsonObject.getString("partNo"));
                        d.setProcessEdition(jsonObject.getString("processEdition"));
                        fileDataMap.put(d.getName(),d);
                        list.add(d);
                     }
@@ -133,11 +140,6 @@
                  }
               }
               System.out.println("文件名: " + entry.getName());
               System.out.println("大小: " + entry.getSize());
               // 读取文件内容到字节数组
               ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
            }