Просмотр исходного кода

Merge remote-tracking branch 'origin/test' into test

syh 5 лет назад
Родитель
Сommit
1417ff1461

+ 12 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java

@@ -12,9 +12,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
@@ -66,8 +68,16 @@ public class MaterialInfoController {
         return materialInfoService.getDetail(materialId);
 
     }
-
-
+    @PostMapping("watermark")
+    public Result<Object> watermarkVideo(@RequestParam(name = "id")String id,@RequestParam(name = "watermarkTemplateId")Integer watermarkTemplateId){
+        Result<Object> result = new Result<>();
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        materialInfoService.watermarkVideo(id,watermarkTemplateId,sysUser.getId());
+        result.setCode(200);
+        result.setSuccess(true);
+        result.setMessage("水印合成任务执行成功,请稍后查看");
+        return result;
+    }
     /**
      * 分页列表查询
      *
@@ -77,8 +87,6 @@ public class MaterialInfoController {
      * @param req
      * @return
      */
-
-
     @AutoLog(value = "素材信息-分页列表查询")
     @ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
     @GetMapping(value = "/list")

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/MergeVideoJob.java

@@ -50,6 +50,7 @@ public class MergeVideoJob implements Job {
                         materialInfo.setType("VIDEO");
                         materialInfo.setMaterialName("合成"+ DateUtils.getMillis());
                         materialInfoService.saveOrUpdate(materialInfo);
+                        materialInfoService.getFile(materialInfo);
                         videoMergeTask.setVideoUrl(url);
                         videoMergeTask.setStatus(job.getState());
                         videoMergeTask.setVideoId(materialInfo.getId());

+ 0 - 2
module-common/pom.xml

@@ -23,13 +23,11 @@
     </properties>
 
     <dependencies>
-
         <dependency>
             <groupId>thirtpart</groupId>
             <artifactId>jave</artifactId>
             <version>1.0</version>
         </dependency>
-
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>

+ 6 - 5
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -33,8 +33,6 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.regex.Pattern;
 
-// import it.sauronsoftware.jave.Encoder;
-
 /**
  * 素材信息
  *
@@ -50,13 +48,14 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     private IVideoWatermarkTemplateService videoWatermarkTemplateService;
     @Autowired
     private IVideoWatermarkTaskService videoWatermarkTaskService;
-
     @Override
-    public void watermarkVideo(String materialId, Integer videoWatermarkTemplateId, String userId) {
+    public void watermarkVideo(String materialId,Integer videoWatermarkTemplateId,String userId){
         VideoWatermarkTemplate videoWatermarkTemplate = videoWatermarkTemplateService.getById(videoWatermarkTemplateId);
         MaterialInfo materialInfo = this.getById(materialId);
         MpsUtils mpsUtils = new MpsUtils();
-        String jobId = mpsUtils.videoWaterMark(materialInfo.getUrl(), videoWatermarkTemplate.getTemplatePath(), videoWatermarkTemplate.getTemplateId(), videoWatermarkTemplate.getHeight());
+        String path = materialInfo.getUrl().substring(materialInfo.getUrl().indexOf("/",10)+1,materialInfo.getUrl().length());
+        System.out.println(path);
+        String jobId = mpsUtils.videoWaterMark(path,videoWatermarkTemplate.getTemplatePath(),videoWatermarkTemplate.getTemplateId(),videoWatermarkTemplate.getHeight());
         QueryJobListResponse.Job job = mpsUtils.getJobStatus(jobId);
         VideoWatermarkTask videoWatermarkTask = new VideoWatermarkTask();
         videoWatermarkTask.setJobId(jobId);
@@ -323,6 +322,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                     e.printStackTrace();
                 }
             }
+
+
         });
     }
 

+ 3 - 7
module-common/src/main/java/cn/com/ctop/common/module/utils/MpsUtils.java

@@ -276,12 +276,8 @@ public class MpsUtils {
         SubmitJobsRequest request = new SubmitJobsRequest();
         JSONObject videoWatermarkInput = new JSONObject();
         videoWatermarkInput.put("Location", ossLocation);
-        videoWatermarkInput.put("Bucket", ossBucket);
-        try {
-            videoWatermarkInput.put("Object", URLEncoder.encode(videoPath, "utf-8"));
-        } catch (UnsupportedEncodingException e) {
-            throw new RuntimeException("videoWatetmark Input URL encode failed");
-        }
+        videoWatermarkInput.put("Bucket", "ctop-media");
+        videoWatermarkInput.put("Object", videoPath);
         JSONObject videoWatermark = new JSONObject();
         videoWatermark.put("WaterMarkTemplateId", watermarkTemplateId);
         videoWatermark.put("Type", "Image");
@@ -305,7 +301,7 @@ public class MpsUtils {
         JSONArray outputs = new JSONArray();
         outputs.add(output);
         request.setOutputs(outputs.toJSONString());
-        request.setOutputBucket(ossBucket);
+        request.setOutputBucket("ctop-media");
         request.setOutputLocation(ossLocation);
         // PipelineId
         request.setPipelineId(pipelineId);