dsx 1 年之前
父節點
當前提交
c8d945b43e

+ 5 - 1
src/main/java/com/fdkankan/external/service/impl/SceneOfflinePackagePushServiceImpl.java

@@ -345,6 +345,7 @@ public class SceneOfflinePackagePushServiceImpl extends ServiceImpl<SceneOffline
             String cmd = "cd " + dirPath + " && zip -r " + volumeName + " " + num + " -s 500M";
             log.info("压缩命令:{}", cmd);
             CmdUtils.callLineSh(cmd, 200);
+            log.info("分卷压缩完成");
 
             List<String> fileList = FileUtil.listFileNames(zipDir);
             if(CollUtil.isEmpty(fileList)){
@@ -352,14 +353,17 @@ public class SceneOfflinePackagePushServiceImpl extends ServiceImpl<SceneOffline
             }
 
             String id = UUID.fastUUID().toString();
+            int index = 1;
             for (String file : fileList) {
                 Map<String, Object> params = new HashMap<>();
                 params.put("id", id);
                 params.put("action", "upload");
                 params.put("fileName", file);
                 params.put("file", FileUtil.file(zipDir.concat(file)));
+                log.info("开发发送第{}个压缩包", index);
                 String post = HttpUtil.post(push.getDestUrl(), params, 60 * 60 * 1000);
-                log.info("场景推送成功,接收端返回结果:{}", post);
+                log.info("第{}个场景推送成功,接收端返回结果:{}", index, post);
+                ++index;
             }
 
             ScenePlus scenePlus = scenePlusService.getByNum(num);

+ 11 - 15
src/main/java/com/fdkankan/external/util/CmdUtils.java

@@ -29,7 +29,7 @@ public class CmdUtils {
 
 
 
-    public static void callLineSh(String command){
+    public static void callLineSh(String command) throws Exception {
         callLineSh(command, null);
 
     }
@@ -68,21 +68,17 @@ public class CmdUtils {
      * @param command 命令
      * @param lineSize 日志输出行数 ,可以为null
      */
-    public static void callLineSh(String command, Integer lineSize){
+    public static void callLineSh(String command, Integer lineSize) throws Exception {
         log.info("cmd: " + command);
-        try {
-            String[] cmd = new String[]{"/bin/sh", "-c", command};
-            Process process = Runtime.getRuntime().exec(cmd);
-            log.info("开始运行");
-            StreamGobblerLine errorGobbler = new StreamGobblerLine(process.getErrorStream(), "ERROR");
-            errorGobbler.start();
-            // 200行打印一次日志
-            StreamGobblerLine outGobbler = new StreamGobblerLine(process.getInputStream(), "STDOUT", lineSize);
-            outGobbler.start();
-            process.waitFor();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
+        String[] cmd = new String[]{"/bin/sh", "-c", command};
+        Process process = Runtime.getRuntime().exec(cmd);
+        log.info("开始运行");
+        StreamGobblerLine errorGobbler = new StreamGobblerLine(process.getErrorStream(), "ERROR");
+        errorGobbler.start();
+        // 200行打印一次日志
+        StreamGobblerLine outGobbler = new StreamGobblerLine(process.getInputStream(), "STDOUT", lineSize);
+        outGobbler.start();
+        process.waitFor();
     }
 
     /**