ソースを参照

feat: 修正一些bug

WANGKANG 9 ヶ月 前
コミット
b0efb0ae00

+ 12 - 7
taais-modules/taais-biz/src/main/java/com/taais/biz/service/impl/VideoStableServiceImpl.java

@@ -227,15 +227,16 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
 
         videoStable.setStartTime(new Date());
 
+        videoStable.setStatus(BizConstant.VideoStatus.RUNNING);
+        updateById(videoStable);
+
         boolean flag = sendMsg(videoStable);
-        if (flag) {
-            videoStable.setStatus(BizConstant.VideoStatus.RUNNING);
-        } else {
-            videoStable.setEndTime(new Date());
+        if (!flag) {
             videoStable.setStatus(BizConstant.VideoStatus.FAILED);
+            updateById(videoStable);
+            return CommonResult.fail("start video_stable failed");
         }
 
-        updateById(videoStable);
         return CommonResult.success("start video_stable success");
     }
 
@@ -270,7 +271,11 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
         videoStable.setLog(msg);
         videoStable.setStatus("200".equals(status) ? BizConstant.VideoStatus.END : BizConstant.VideoStatus.FAILED);
         videoStable.setEndTime(new Date());
-        videoStable.setCostSecond((videoStable.getEndTime().getTime() - videoStable.getStartTime().getTime()) / 1000);
+        try {
+            videoStable.setCostSecond((videoStable.getEndTime().getTime() - videoStable.getStartTime().getTime()) / 1000);
+        }catch(Exception e) {
+            videoStable.setCostSecond(null);
+        }
         updateById(videoStable);
         return CommonResult.success();
     }
@@ -309,7 +314,7 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
         return map;
     }
 
-        /**
+    /**
      * 递归统计文件夹中的文件数量
      *
      * @param directory 文件夹对象