dengsixing 1 месяц назад
Родитель
Сommit
31faea5c92

+ 6 - 3
src/main/java/com/fdkankan/scene/service/impl/CommonServiceImpl.java

@@ -1,5 +1,6 @@
 package com.fdkankan.scene.service.impl;
 
+import cn.hutool.core.io.FileUtil;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.model.constants.ConstantFilePath;
@@ -37,11 +38,13 @@ public class CommonServiceImpl implements ICommonService {
         String filePath = userEditPath + fileName;
         fYunFileService.downloadFile(bucket, filePath, localImagesPath + fileName);
 
+        String extName = FileUtil.extName(fileName);
+
         //视频格式转换
-        CreateObjUtil.mp4ToFlv(localFilePath, localFilePath.replace("mp4", "flv"));
+        CreateObjUtil.mp4ToFlv(localFilePath, localFilePath.replace(extName, "flv"));
 
         //上传
-        String flvFileName = fileName.replace("mp4", "flv");
-        fYunFileService.uploadFile(bucket, localFilePath.replace("mp4", "flv"), userEditPath+flvFileName);
+        String flvFileName = fileName.replace(extName, "flv");
+        fYunFileService.uploadFile(bucket, localFilePath.replace(extName, "flv"), userEditPath+flvFileName);
     }
 }