Browse Source

视频抽帧

yumeng 5 years ago
parent
commit
197a26a30f

+ 249 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialCutFrameController.java

@@ -0,0 +1,249 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.entity.MaterialCutFrame;
+import cn.com.ctop.common.module.service.IMaterialCutFrameService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+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.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 截屏
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-25
+ */
+@Slf4j
+@Api(tags = "截屏")
+@RestController
+@RequestMapping("/123/materialCutFrame")
+public class MaterialCutFrameController {
+    @Autowired
+    private IMaterialCutFrameService materialCutFrameService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param materialCutFrame
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "截屏-分页列表查询")
+    @ApiOperation(value = "截屏-分页列表查询", notes = "截屏-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<MaterialCutFrame>> queryPageList(MaterialCutFrame materialCutFrame,
+                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                         HttpServletRequest req) {
+        Result<IPage<MaterialCutFrame>> result = new Result<IPage<MaterialCutFrame>>();
+        QueryWrapper<MaterialCutFrame> queryWrapper = QueryGenerator.initQueryWrapper(materialCutFrame, req.getParameterMap());
+        Page<MaterialCutFrame> page = new Page<MaterialCutFrame>(pageNo, pageSize);
+        IPage<MaterialCutFrame> pageList = materialCutFrameService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param materialCutFrame
+     * @return
+     */
+    @AutoLog(value = "截屏-添加")
+    @ApiOperation(value = "截屏-添加", notes = "截屏-添加")
+    @PostMapping(value = "/add")
+    public Result<MaterialCutFrame> add(@RequestBody MaterialCutFrame materialCutFrame) {
+        Result<MaterialCutFrame> result = new Result<MaterialCutFrame>();
+        try {
+            materialCutFrameService.save(materialCutFrame);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param materialCutFrame
+     * @return
+     */
+    @AutoLog(value = "截屏-编辑")
+    @ApiOperation(value = "截屏-编辑", notes = "截屏-编辑")
+    @PutMapping(value = "/edit")
+    public Result<MaterialCutFrame> edit(@RequestBody MaterialCutFrame materialCutFrame) {
+        Result<MaterialCutFrame> result = new Result<MaterialCutFrame>();
+        MaterialCutFrame materialCutFrameEntity = materialCutFrameService.getById(materialCutFrame.getId());
+        if (materialCutFrameEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = materialCutFrameService.updateById(materialCutFrame);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "截屏-通过id删除")
+    @ApiOperation(value = "截屏-通过id删除", notes = "截屏-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            materialCutFrameService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "截屏-批量删除")
+    @ApiOperation(value = "截屏-批量删除", notes = "截屏-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<MaterialCutFrame> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<MaterialCutFrame> result = new Result<MaterialCutFrame>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.materialCutFrameService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "截屏-通过id查询")
+    @ApiOperation(value = "截屏-通过id查询", notes = "截屏-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<MaterialCutFrame> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<MaterialCutFrame> result = new Result<MaterialCutFrame>();
+        MaterialCutFrame materialCutFrame = materialCutFrameService.getById(id);
+        if (materialCutFrame == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(materialCutFrame);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<MaterialCutFrame> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                MaterialCutFrame materialCutFrame = JSON.parseObject(deString, MaterialCutFrame.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(materialCutFrame, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<MaterialCutFrame> pageList = materialCutFrameService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "截屏列表");
+        mv.addObject(NormalExcelConstants.CLASS, MaterialCutFrame.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("截屏列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<MaterialCutFrame> listMaterialCutFrames = ExcelImportUtil.importExcel(file.getInputStream(), MaterialCutFrame.class, params);
+                materialCutFrameService.saveBatch(listMaterialCutFrames);
+                return Result.ok("文件导入成功!数据行数:" + listMaterialCutFrames.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

+ 71 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialCutFrame.java

@@ -0,0 +1,71 @@
+package cn.com.ctop.common.module.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+
+/**
+ * 截屏
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-25
+ */
+@Data
+@TableName("ctop_material_cut_frame")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_material_cut_frame对象", description = "截屏")
+public class MaterialCutFrame {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 素材库id
+     */
+    @Excel(name = "素材库id", width = 15)
+    @ApiModelProperty(value = "素材库id")
+    private String materialMd5;
+    /**
+     * url
+     */
+    @Excel(name = "url", width = 15)
+    @ApiModelProperty(value = "url")
+    private String url;
+    /**
+     * md5
+     */
+    @Excel(name = "md5", width = 15)
+    @ApiModelProperty(value = "md5")
+    private String code;
+    /**
+     * 素材标
+     */
+    @Excel(name = "素材标", width = 15)
+    @ApiModelProperty(value = "素材标")
+    private Integer cutFrameIndex;
+
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 16 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialCutFrameMapper.java

@@ -0,0 +1,16 @@
+package cn.com.ctop.common.module.mapper;
+
+import cn.com.ctop.common.module.entity.MaterialCutFrame;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+
+/**
+ * 截屏
+ *
+ * @author: jeecg-boot
+ * @date: 2019-12-25
+ * @cersion: V1.0
+ */
+public interface MaterialCutFrameMapper extends BaseMapper<MaterialCutFrame> {
+
+}

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialCutFrameMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.common.module.mapper.MaterialCutFrameMapper">
+
+</mapper>

+ 19 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialCutFrameService.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.common.module.service;
+
+
+import cn.com.ctop.common.module.entity.MaterialCutFrame;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.io.IOException;
+
+/**
+ * 截屏
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-25
+ */
+public interface IMaterialCutFrameService extends IService<MaterialCutFrame> {
+    void getCutFrame(String url, String materialId, String height, String width) throws IOException;
+
+}

+ 173 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialCutFrameServiceImpl.java

@@ -0,0 +1,173 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.MaterialCutFrame;
+import cn.com.ctop.common.module.mapper.MaterialCutFrameMapper;
+import cn.com.ctop.common.module.service.IMaterialCutFrameService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.LoadFileUtil;
+import cn.com.ctop.common.module.utils.MpsUtils;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.aliyuncs.DefaultAcsClient;
+import com.aliyuncs.IAcsClient;
+import com.aliyuncs.mts.model.v20140618.QuerySnapshotJobListRequest;
+import com.aliyuncs.mts.model.v20140618.QuerySnapshotJobListResponse;
+import com.aliyuncs.mts.model.v20140618.SubmitSnapshotJobRequest;
+import com.aliyuncs.mts.model.v20140618.SubmitSnapshotJobResponse;
+import com.aliyuncs.profile.DefaultProfile;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.net.URLEncoder;
+
+
+/**
+ * 截屏
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-12-25
+ */
+@Service
+public class MaterialCutFrameServiceImpl extends ServiceImpl<MaterialCutFrameMapper, MaterialCutFrame> implements IMaterialCutFrameService {
+
+    private static String ossLocation = "oss-cn-beijing";
+    private static String ossBucket = "ctop-media";
+    private static String ossOutputObject = "output_{Count}.jpg";
+
+    /**
+     * 获取素材关键帧
+     *
+     * @param url
+     */
+    @Override
+    public void getCutFrame(String url, String materialId, String height, String width) throws IOException {
+
+
+        try {
+
+
+            String zeroFrameUrl = url + "?x-oss-process=video/snapshot,t_00000,m_fast";
+
+            // String localPath = LoadFileUtil.downLoadFromUrl(zeroFrameUrl, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
+            String localPath = LoadFileUtil.downLoadFromUrl(zeroFrameUrl, "D:\\tets1");
+            String md5 = LoadFileUtil.getMD5(localPath);
+            LoadFileUtil.delFile(localPath);
+
+            MaterialCutFrame cutFrame = new MaterialCutFrame();
+            cutFrame.setCode(md5);
+            cutFrame.setUrl(zeroFrameUrl);
+            cutFrame.setMaterialMd5(materialId);
+            cutFrame.setCutFrameIndex(0);
+            this.save(cutFrame);
+
+
+            // DefaultAcsClient
+            // 地域ID // RAM账号的AccessKey ID // RAM账号Access Key Secret
+            String ossOutputObject1 = "cutFrame/" + materialId + "/";
+            DefaultProfile profile = DefaultProfile.getProfile(
+                    "cn-beijing",
+                    "LTAIbNbqWzSOklQV",
+                    "1rkPz7JNoXk8sJevPaeYHWqfkQXBGh");
+            IAcsClient client = new DefaultAcsClient(profile);
+            // request
+            SubmitSnapshotJobRequest request = new SubmitSnapshotJobRequest();
+            // Input
+            JSONObject input = new JSONObject();
+            input.put("Location", ossLocation);
+            input.put("Bucket", ossBucket);
+
+            String replaceUrl = url.replace("https://ctop-media.oss-cn-beijing.aliyuncs.com/", "");
+            input.put("Object", replaceUrl);
+
+            request.setInput(input.toJSONString());
+            // SnapshotConfig
+            JSONObject snapshotConfig = new JSONObject();
+            // SnapshotConfig->OutputFile
+            JSONObject output = new JSONObject();
+            output.put("Location", ossLocation);
+            output.put("Bucket", ossBucket);
+
+
+            output.put("Object", URLEncoder.encode(ossOutputObject1 + ossOutputObject, "utf-8"));
+
+            snapshotConfig.put("OutputFile", output.toJSONString());
+            // SnapshotConfig->Time
+            snapshotConfig.put("Time", "3");
+            // SnapshotConfig->Interval/Num
+            snapshotConfig.put("Interval", "2");
+            snapshotConfig.put("Num", "9");
+            // SnapshotConfig->Width/Height
+            snapshotConfig.put("Height", height);
+            snapshotConfig.put("Width", width);
+            // SnapshotConfig
+            request.setSnapshotConfig(snapshotConfig.toJSONString());
+            // PipelineId
+            String pipelineId = MpsUtils.getPipelineId(client);
+            request.setPipelineId(pipelineId);
+            // call api
+            SubmitSnapshotJobResponse response;
+
+            response = client.getAcsResponse(request);
+
+        /*    String requestId = response.getRequestId();
+            String jobId = response.getSnapshotJob().getId();
+*/
+            for (int i = 0; i < 100; i++) {
+
+                Thread.sleep(5 * 1000);
+                QuerySnapshotJobListRequest request1 = new QuerySnapshotJobListRequest();
+                request1.setSnapshotJobIds(response.getSnapshotJob().getId());
+                QuerySnapshotJobListResponse response1 = client.getAcsResponse(request1);
+                String s = JSON.toJSONString(response1);
+                JSONObject jsonObject = JSONObject.parseObject(s);
+                if (!Check.isNull(jsonObject)) {
+                    JSONObject json = (JSONObject) jsonObject.getJSONArray("snapshotJobList").get(0);
+                    String state = json.getString("state");
+                    if ("Success".equals(state)) {
+                        Integer count = json.getInteger("count");
+                        for (int j = 1; j <= count; j++) {
+                            String urlStr = "";
+                            if (j < 10) {
+                                urlStr = String.format(
+                                        "https://%s.%s.aliyuncs.com/" + ossOutputObject1 + "output_0000" + j + ".jpg",
+                                        ossBucket,
+                                        ossLocation);
+                            } else if (j >= 10 && j < 100) {
+                                urlStr = String.format(
+                                        "https://%s.%s.aliyuncs.com/" + ossOutputObject1 + "output_000" + j + ".jpg",
+                                        ossBucket,
+                                        ossLocation);
+                            } else if (j > 100) {
+                                urlStr = String.format(
+                                        "https://%s.%s.aliyuncs.com/" + ossOutputObject1 + "output_00" + j + ".jpg",
+                                        ossBucket,
+                                        ossLocation);
+                            }
+                            String cutFramePath = LoadFileUtil.downLoadFromUrl(urlStr, "D:\\tets1");
+                            String cutFrameMd5 = LoadFileUtil.getMD5(cutFramePath);
+                            LoadFileUtil.delFile(cutFramePath);
+                            cutFrame = new MaterialCutFrame();
+                            cutFrame.setCode(cutFrameMd5);
+                            cutFrame.setUrl(urlStr);
+                            cutFrame.setMaterialMd5(materialId);
+                            cutFrame.setCutFrameIndex(j);
+                            this.save(cutFrame);
+                        }
+
+                        break;
+                    }
+                }
+
+
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+
+    }
+
+
+}

+ 21 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.mapper.MaterialAscriptionMapper;
 import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
 import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
 import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
 import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
 import cn.com.ctop.common.module.mapper.MaterialTagMapper;
 import cn.com.ctop.common.module.mapper.MaterialTagMapper;
+import cn.com.ctop.common.module.service.IMaterialCutFrameService;
 import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.common.module.service.IVideoWatermarkTaskService;
 import cn.com.ctop.common.module.service.IVideoWatermarkTaskService;
 import cn.com.ctop.common.module.service.IVideoWatermarkTemplateService;
 import cn.com.ctop.common.module.service.IVideoWatermarkTemplateService;
@@ -160,6 +161,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         return resultMap;
         return resultMap;
     }
     }
 
 
+    @Autowired
+    private IMaterialCutFrameService materialCutFrameService;
 
 
     private void insertMaterialInfo(String url, String type, JSONObject jsonObject) {
     private void insertMaterialInfo(String url, String type, JSONObject jsonObject) {
         MaterialInfo info = new MaterialInfo();
         MaterialInfo info = new MaterialInfo();
@@ -202,6 +205,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             if (i > 0) {
             if (i > 0) {
                 log.info("素材归属信息入库完成,MaterialId:{}", info.getId());
                 log.info("素材归属信息入库完成,MaterialId:{}", info.getId());
             }
             }
+
         }
         }
 
 
         JSONArray tag = jsonObject.getJSONArray("tag");
         JSONArray tag = jsonObject.getJSONArray("tag");
@@ -338,9 +342,11 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                             // 视频格式
                             // 视频格式
                             materialParameter.setFormat(m.getFormat());
                             materialParameter.setFormat(m.getFormat());
                             // 视频宽
                             // 视频宽
-                            materialParameter.setWidth(String.valueOf(m.getVideo().getSize().getWidth()));
+                            String width = String.valueOf(m.getVideo().getSize().getWidth());
+                            materialParameter.setWidth(width);
                             // 视频高
                             // 视频高
-                            materialParameter.setHeight(String.valueOf(m.getVideo().getSize().getHeight()));
+                            String height = String.valueOf(m.getVideo().getSize().getHeight());
+                            materialParameter.setHeight(height);
                             FileInputStream fis = new FileInputStream(file);
                             FileInputStream fis = new FileInputStream(file);
                             FileChannel fc = fis.getChannel();
                             FileChannel fc = fis.getChannel();
                             BigDecimal fileSize = new BigDecimal(fc.size());
                             BigDecimal fileSize = new BigDecimal(fc.size());
@@ -356,6 +362,19 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                                 log.info("素材基本信息入库完成,用时:{} s", (System.currentTimeMillis() - l) / 1000);
                                 log.info("素材基本信息入库完成,用时:{} s", (System.currentTimeMillis() - l) / 1000);
 
 
                             }
                             }
+                            Thread thread = new Thread() {
+                                @Override
+                                public void run() {
+                                    try {
+                                        Thread.sleep(5 * 1000);
+                                        materialCutFrameService.getCutFrame(url, materialInfo.getCode(), height, width);
+                                    } catch (Exception e) {
+                                        e.printStackTrace();
+                                    }
+                                }
+                            };
+                            thread.start();
+
                         } catch (Exception e) {
                         } catch (Exception e) {
                             e.printStackTrace();
                             e.printStackTrace();
                         } finally {
                         } finally {

+ 8 - 6
module-common/src/main/java/cn/com/ctop/common/module/utils/MpsUtils.java

@@ -22,7 +22,7 @@ import java.util.*;
 public class MpsUtils {
 public class MpsUtils {
     public static final String ossLocation = "oss-cn-beijing";
     public static final String ossLocation = "oss-cn-beijing";
     public static final String ossBucket = "ctop-part";
     public static final String ossBucket = "ctop-part";
-    public static void main(String[] args){
+    public static void main(String[] args) throws ClientException {
 //        String[] a = {"1","2","3","4","5"};
 //        String[] a = {"1","2","3","4","5"};
 //        combinationSelect(a,3);
 //        combinationSelect(a,3);
 //        arrangementSelect(a,3);
 //        arrangementSelect(a,3);
@@ -30,8 +30,8 @@ public class MpsUtils {
 //        int i = t.indexOf("/",10);
 //        int i = t.indexOf("/",10);
 //        System.out.println(t.substring(i+1,t.length()-1));
 //        System.out.println(t.substring(i+1,t.length()-1));
 
 
-        MpsUtils mpsUtils = new MpsUtils();
-        mpsUtils.videoWaterMark("video/2019-12-20/20%E7%BD%91%E6%9C%8D-1576822566069.mp4","watermark/water1080-1920.png","8bcf0c98021c40fc96a95d60f55b1f10",720);
+       // MpsUtils mpsUtils = new MpsUtils();
+       // mpsUtils.videoWaterMark("video/2019-12-20/20%E7%BD%91%E6%9C%8D-1576822566069.mp4","watermark/water1080-1920.png","8bcf0c98021c40fc96a95d60f55b1f10",720);
 //        List<String> list = new ArrayList<>();
 //        List<String> list = new ArrayList<>();
 //        list.add("v1.mp4");
 //        list.add("v1.mp4");
 //        String jobId = mpsUtils.mergeOneVideo("v1.mp4",list,"v1.mp4");
 //        String jobId = mpsUtils.mergeOneVideo("v1.mp4",list,"v1.mp4");
@@ -48,7 +48,9 @@ public class MpsUtils {
 
 
     }
     }
 
 
-    public QueryJobListResponse.Job getJobStatus(String jobId){
+
+
+    public static QueryJobListResponse.Job getJobStatus(String jobId){
         QueryJobListResponse.Job job = null;
         QueryJobListResponse.Job job = null;
         IAcsClient client = getClient();
         IAcsClient client = getClient();
         QueryJobListRequest request = new QueryJobListRequest();
         QueryJobListRequest request = new QueryJobListRequest();
@@ -172,7 +174,7 @@ public class MpsUtils {
         }
         }
     }
     }
 
 
-    public IAcsClient getClient(){
+    public static IAcsClient getClient(){
         // 地域ID // RAM账号的AccessKey ID // RAM账号Access Key Secret
         // 地域ID // RAM账号的AccessKey ID // RAM账号Access Key Secret
         DefaultProfile profile = DefaultProfile.getProfile(
         DefaultProfile profile = DefaultProfile.getProfile(
                 "cn-beijing",
                 "cn-beijing",
@@ -327,7 +329,7 @@ public class MpsUtils {
     }
     }
 
 
 
 
-    public String getPipelineId(IAcsClient client){
+    public static String getPipelineId(IAcsClient client){
         String pipelineId = null;
         String pipelineId = null;
         // 创建API请求并设置参数
         // 创建API请求并设置参数
         SearchPipelineRequest request = new SearchPipelineRequest();
         SearchPipelineRequest request = new SearchPipelineRequest();