فهرست منبع

promote(log): 优化输出

songdandan 2 سال پیش
والد
کامیت
3e626a2fc5

+ 8 - 3
tongfei_river_data_transfer/src/main/java/com/ublinkage/transfer/send/SendDataHandlerTask.java

@@ -143,6 +143,10 @@ public class SendDataHandlerTask {
 
     private void sendFile(List<Path> list) {
         for (Path filePath : list) {
+            if (!this.serverIsOnline()) {
+                log.error("请求网络{}异常.", sendToIp);
+                return;
+            }
             String suffix = FileUtil.getSuffix(filePath.toFile());
             if (!"zip".equals(suffix)) {
                 continue;
@@ -169,13 +173,14 @@ public class SendDataHandlerTask {
                     }
                 } else {
                     if (needBackup) {
-                        String errorPath = backupPath + "error" + File.pathSeparator;
+                        Path path = Paths.get(backupPath);
+                        Path errorPath = path.resolve("error");
                         //移动到目标目录
-                        File backupFile = new File(errorPath);
+                        File backupFile = errorPath.toFile();
                         if (!backupFile.exists()) {
                             backupFile.mkdirs();
                         }
-                        FileUtil.move(filePath.toFile(), new File(errorPath + FileUtil.getName(filePath)), true);
+                        FileUtil.move(filePath.toFile(), errorPath.resolve(FileUtil.getName(filePath)).toFile(), true);
                     }
                 }
             } catch (Exception e) {