Przeglądaj źródła

Merge branch 'master' of http://39.106.184.70:3000/ctop/adsp-boot

yumeng 5 lat temu
rodzic
commit
7343c34734
15 zmienionych plików z 245 dodań i 71 usunięć
  1. 19 11
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/EduLessonController.java
  2. 3 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouEffectAdInfoController.java
  3. 5 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouHotPhotoInfoController.java
  4. 3 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouInspiredAdController.java
  5. 5 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CrawlerServiceImpl.java
  6. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/opencv/service/IFfmpegService.java
  7. 150 35
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/opencv/service/impl/FfmpegServiceImpl.java
  8. 0 1
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  9. 3 1
      jeecg-boot-module-system/src/main/resources/application-test.yml
  10. 8 5
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  11. 2 1
      module-report/src/main/java/cn/com/ctop/bytedance/controller/BytedanceReportController.java
  12. 14 5
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceReportServiceImpl.java
  13. 18 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/entity/ByteDanceVideoInfo.java
  14. 12 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/xml/ByteDanceVideoInfoMapper.xml
  15. 1 1
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml

+ 19 - 11
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/EduLessonController.java

@@ -3,25 +3,14 @@ package org.jeecg.modules.ctop.controller;
 import cn.com.ctop.manage.modules.edu.entity.EduLesson;
 import cn.com.ctop.manage.modules.edu.service.IEduLessonService;
 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.modules.ctop.entity.DramaInfo;
-import org.jeecg.modules.system.entity.SysCategory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
 import java.util.List;
 
 @Slf4j
@@ -47,6 +36,25 @@ public class EduLessonController {
         result.setSuccess(true);
         return result;
     }
+
+    @GetMapping(value = "/system/lesson")
+    public Result<List<String>> getSystemLessonList() {
+        Result<List<String>> result = new Result<>();
+        List<String> list = eduLessonService.getTitleList("系统操作");
+        result.setResult(list);
+        result.setSuccess(true);
+        return result;
+    }
+
+    @GetMapping(value = "/system/topic")
+    public Result<List<String>> getSystemTopicList(String title) {
+        Result<List<String>> result = new Result<>();
+        List<String> list = eduLessonService.getTopicList("系统操作", title);
+        result.setResult(list);
+        result.setSuccess(true);
+        return result;
+    }
+
     @GetMapping(value = "/ocean/lesson")
     public Result<List<String>> getOceanLessonList(){
         Result<List<String>> result = new Result<>();

+ 3 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouEffectAdInfoController.java

@@ -64,9 +64,10 @@ public class KuaishouEffectAdInfoController {
                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                              HttpServletRequest req) {
-        Result<IPage<KuaishouEffectAdInfo>> result = new Result<IPage<KuaishouEffectAdInfo>>();
+        Result<IPage<KuaishouEffectAdInfo>> result = new Result<>();
         QueryWrapper<KuaishouEffectAdInfo> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouEffectAdInfo, req.getParameterMap());
-        Page<KuaishouEffectAdInfo> page = new Page<KuaishouEffectAdInfo>(pageNo, pageSize);
+        queryWrapper.orderByDesc("create_time");
+        Page<KuaishouEffectAdInfo> page = new Page<>(pageNo, pageSize);
         IPage<KuaishouEffectAdInfo> pageList = kuaishouEffectAdInfoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);

+ 5 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouHotPhotoInfoController.java

@@ -49,16 +49,18 @@ public class KuaishouHotPhotoInfoController {
                                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                              @RequestParam(name = "sortType", defaultValue = "1") Integer sortType,
                                                              HttpServletRequest req) {
-        Result<IPage<KuaishouHotPhotoInfo>> result = new Result<IPage<KuaishouHotPhotoInfo>>();
+        Result<IPage<KuaishouHotPhotoInfo>> result = new Result<>();
         QueryWrapper<KuaishouHotPhotoInfo> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouHotPhotoInfo, req.getParameterMap());
         if (sortType == 1) {
-            queryWrapper.orderByDesc("playing_time");
+            queryWrapper.orderByDesc("create_time");
         } else if (sortType == 2) {
+            queryWrapper.orderByDesc("playing_time");
+        } else if (sortType == 3) {
             queryWrapper.orderByDesc("like_time");
         } else {
             queryWrapper.orderByDesc("comment_time");
         }
-        Page<KuaishouHotPhotoInfo> page = new Page<KuaishouHotPhotoInfo>(pageNo, pageSize);
+        Page<KuaishouHotPhotoInfo> page = new Page<>(pageNo, pageSize);
         IPage<KuaishouHotPhotoInfo> pageList = kuaishouHotPhotoInfoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);

+ 3 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouInspiredAdController.java

@@ -64,9 +64,10 @@ public class KuaishouInspiredAdController {
                                                            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                            HttpServletRequest req) {
-        Result<IPage<KuaishouInspiredAd>> result = new Result<IPage<KuaishouInspiredAd>>();
+        Result<IPage<KuaishouInspiredAd>> result = new Result<>();
         QueryWrapper<KuaishouInspiredAd> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouInspiredAd, req.getParameterMap());
-        Page<KuaishouInspiredAd> page = new Page<KuaishouInspiredAd>(pageNo, pageSize);
+        queryWrapper.orderByDesc("create_time");
+        Page<KuaishouInspiredAd> page = new Page<>(pageNo, pageSize);
         IPage<KuaishouInspiredAd> pageList = kuaishouInspiredAdService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);

+ 5 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CrawlerServiceImpl.java

@@ -217,19 +217,20 @@ public class CrawlerServiceImpl implements ICrawlerService {
             log.info("效果广告数据获取完成");
             return;
         }
-        List<KuaishouEffectAdInfo> adInfos = new ArrayList<>();
+//        List<KuaishouEffectAdInfo> adInfos = new ArrayList<>();
         for (int i = 0; i < effectAds.size(); i++) {
             JSONObject ad = effectAds.getJSONObject(i);
             Long contentId = ad.getLong("contentId");
             if (null != contentId) {
                 JSONObject content = getEffectAdDetail(contentId).getJSONObject("data").getJSONObject("effectAdDetail");
                 KuaishouEffectAdInfo adInfo = new KuaishouEffectAdInfo(content);
-                adInfos.add(adInfo);
+                effectAdInfoService.saveOrUpdate(adInfo);
+                //                adInfos.add(adInfo);
             }
         }
-        if (adInfos.size() > 0) {
+        /*if (adInfos.size() > 0) {
             effectAdInfoService.replaceBatch(adInfos);
-        }
+        }*/
         loadeffectAdByPage(pageSize, pageNum + 1);
     }
 

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/opencv/service/IFfmpegService.java

@@ -16,4 +16,6 @@ public interface IFfmpegService {
     void mergeImageToVideo(String imagePath, Integer frameNumber, String videoFilePath);
 
     Map<String, Object> videoMerge(JSONObject data, String userId);
+
+    void videoSplitToImage(String srcFilePath, String splitSrcPath);
 }

+ 150 - 35
jeecg-boot-module-system/src/main/java/org/jeecg/modules/opencv/service/impl/FfmpegServiceImpl.java

@@ -11,7 +11,6 @@ import org.jeecg.modules.opencv.service.IModelVideoCompositeInfoService;
 import org.jeecg.modules.opencv.service.IModelVideoInfoConfigService;
 import org.jeecg.modules.opencv.service.IModelVideoInfoService;
 import org.jeecg.modules.opencv.utils.ImageUtils;
-import org.jeecg.modules.opencv.utils.VideoProcessing;
 import org.opencv.core.Core;
 import org.opencv.core.Mat;
 import org.opencv.core.Size;
@@ -56,6 +55,7 @@ public class FfmpegServiceImpl implements IFfmpegService {
         command.add("copy");
         command.add(m4apath);
         runCommand(command);
+        log.info("提取音频文件成功:{}", m4apath);
     }
 
     /**
@@ -79,6 +79,7 @@ public class FfmpegServiceImpl implements IFfmpegService {
         command.add(endSecond);
         command.add(targetPath);
         runCommand(command);
+        log.info("音频文件截取成功:{}", targetPath);
     }
 
     /**
@@ -87,18 +88,69 @@ public class FfmpegServiceImpl implements IFfmpegService {
      */
     @Override
     public void audioMosaic(String audioPart1, String audioPart2, String finalAudio) {
-        List<String> command = new ArrayList<>();
-        command.add(FFMPEG_PATH);
-        command.add("-i");
-        command.add(audioPart1);
-        command.add("-i");
-        command.add(audioPart2);
-        command.add("-filter_complex");
-        command.add("\"[0:0] [1:0] concat=n=2:v=0:a=1 [a]\"");
-        command.add("-map");
-        command.add("[a]");
-        command.add(finalAudio);
-        runCommand(command);
+        StringBuffer command = new StringBuffer();
+        command.append(FFMPEG_PATH);
+        command.append(" -i ");
+        command.append(audioPart1);
+        command.append(" -i ");
+        command.append(audioPart2);
+        command.append(" -filter_complex ");
+        command.append("'[0:0] [1:0] concat=n=2:v=0:a=1 [a]'");
+        command.append(" -map ");
+        command.append("[a] ");
+        command.append(finalAudio);
+        Runtime runtime = Runtime.getRuntime();
+        Process pro = null;
+        try {
+            pro = runtime.exec(new String[]{"sh", "-c", command.toString()});
+            printProcessMsg(pro);
+            int status = pro.waitFor();
+            if (status == 0) {
+                log.info("音频文件合成成功:{}", command.toString());
+            } else {
+                log.info("音频文件合成失败:{}", command.toString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 处理process输出流和错误流,防止进程阻塞,在process.waitFor();前调用
+     *
+     * @param exec
+     * @throws IOException
+     */
+    private void printProcessMsg(Process exec) throws IOException {
+        //防止ffmpeg进程塞满缓存造成死锁
+        InputStream error = exec.getErrorStream();
+        InputStream is = exec.getInputStream();
+
+        StringBuffer result = new StringBuffer();
+        String line = null;
+        try {
+            BufferedReader br = new BufferedReader(new InputStreamReader(error));
+            BufferedReader br2 = new BufferedReader(new InputStreamReader(is));
+
+            while ((line = br.readLine()) != null) {
+                result.append(line + "\n");
+            }
+//            log.info("FFMPEG视频转换进程错误信息:" + result.toString());
+
+            result = new StringBuffer();
+            line = null;
+
+            while ((line = br2.readLine()) != null) {
+                result.append(line + "\n");
+            }
+//            log.info("FFMPEG视频转换进程输出内容为:" + result.toString());
+        } catch (IOException e2) {
+            e2.printStackTrace();
+        } finally {
+            error.close();
+            is.close();
+        }
+
     }
 
     /**
@@ -110,20 +162,33 @@ public class FfmpegServiceImpl implements IFfmpegService {
      */
     @Override
     public void mergeAudioAndVideo(String srcVideoPath, String srcAudioPath, String finalVideoPath) {
-        List<String> command = new ArrayList<>();
-        command.add(FFMPEG_PATH);
-        command.add("-i");
-        command.add(srcVideoPath);
-        command.add("-i");
-        command.add(srcAudioPath);
-        command.add("-c:v");
-        command.add("copy");
-        command.add("-c:a");
-        command.add("aac");
-        command.add("-strict");
-        command.add("experimental");
-        command.add(finalVideoPath);
-        runCommand(command);
+        StringBuffer command = new StringBuffer();
+        command.append(FFMPEG_PATH);
+        command.append(" -i ");
+        command.append(srcVideoPath);
+        command.append(" -i ");
+        command.append(srcAudioPath);
+        command.append(" -c:v");
+        command.append(" copy");
+        command.append(" -c:a");
+        command.append(" aac");
+        command.append(" -strict");
+        command.append(" experimental ");
+        command.append(finalVideoPath);
+        Runtime runtime = Runtime.getRuntime();
+        Process pro = null;
+        try {
+            pro = runtime.exec(new String[]{"sh", "-c", command.toString()});
+            printProcessMsg(pro);
+            int status = pro.waitFor();
+            if (status == 0) {
+                log.info("视频合成成功:{}", command.toString());
+            } else {
+                log.info("视频合成失败:{}", command.toString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
 
     /**
@@ -148,6 +213,7 @@ public class FfmpegServiceImpl implements IFfmpegService {
         command.add(frameNumber + "");
         command.add(videoFilePath);
         runCommand(command);
+        log.info("图片合成视频成功:{}", videoFilePath);
     }
 
     private void runCommand(List<String> command) {
@@ -204,7 +270,6 @@ public class FfmpegServiceImpl implements IFfmpegService {
             }.start();
             // 等待进程执行结束
             process.waitFor();
-            process.destroy();
             log.info("ffmpeg命令执行完成");
         } catch (Exception e) {
             e.printStackTrace();
@@ -251,15 +316,24 @@ public class FfmpegServiceImpl implements IFfmpegService {
         String finalVideoPath = PropertiesUtils.getValue("kuaishou_config", "model_video_final_path");
 
         String fillFilePath = LoadFileUtil.downLoadFromUrl(url, fillVideoPath);
+        Long current1 = System.currentTimeMillis();
+        log.info("替换视频下载完成:总时长{}毫秒", current1 - current);
         String srcFilePath = LoadFileUtil.downLoadFromUrl(videoInfo.getModelVideoUrl(), srcVideoPath);
-
+        Long current2 = System.currentTimeMillis();
+        log.info("模板文件下载完成:总时长{}毫秒", current2 - current1);
         String splitSrcPath = srcVideoPath + current + File.separator;
+        LoadFileUtil.checkFile(splitSrcPath);
         String splitFillPath = fillVideoPath + current + File.separator;
+        LoadFileUtil.checkFile(splitFillPath);
         String splitFinalPath = finalVideoPath + current + File.separator;
         LoadFileUtil.checkFile(splitFinalPath);
         //1:切分视频
-        VideoProcessing.grabberVideoFramer(srcFilePath, splitSrcPath);
-        VideoProcessing.grabberVideoFramer(fillFilePath, splitFillPath);
+        videoSplitToImage(srcFilePath, splitSrcPath);
+        Long current3 = System.currentTimeMillis();
+        log.info("模板文件切分完成:总时长{}毫秒", current3 - current2);
+        videoSplitToImage(fillFilePath, splitFillPath);
+        Long current4 = System.currentTimeMillis();
+        log.info("填充文件切分完成:总时长{}毫秒", current4 - current3);
         ModelVideoInfoConfig config = configService.getByModelId(videoInfo.getId());
         if (null == config) {
             log.error("配置文件尚未配置=>modelId:{}", videoInfo.getId());
@@ -273,13 +347,13 @@ public class FfmpegServiceImpl implements IFfmpegService {
             //视频替换结束帧数
             int exchangeEndFrameNum = config.getFullScreenEndFrame();
             //2.1 复制原始视频无变化图片
-            for (int i = 0; i < exchangeStartFrameNum; i++) {
+            for (int i = 1; i < exchangeStartFrameNum; i++) {
                 Mat srcNoChangeImage = Imgcodecs.imread(splitSrcPath + i + ".jpg");
                 Imgcodecs.imwrite(splitFinalPath + i + ".jpg", srcNoChangeImage);
             }
 
             //2.2 转场动画(从fill文件夹的第一帧开始)
-            String getImageName = splitFillPath + "0.jpg";
+            String getImageName = splitFillPath + "1.jpg";
             Mat image = Imgcodecs.imread(getImageName, Imgcodecs.IMREAD_COLOR);
             //(1)径向模糊图片
             Mat radialBlur = ImageUtils.radialBlur(image);
@@ -303,7 +377,7 @@ public class FfmpegServiceImpl implements IFfmpegService {
             Imgcodecs.imwrite(splitFinalPath + exchangeStartFrameNum + ".jpg", wholeImage);
             exchangeStartFrameNum++;
             //2.3复制填充视频无变化图片
-            int checkNum = 1;
+            int checkNum = 2;
             for (int i = exchangeStartFrameNum; i < exchangeEndFrameNum; i++) {
                 String fillImagePath = splitFillPath + checkNum + ".jpg";
                 File file = new File(fillImagePath);
@@ -315,30 +389,45 @@ public class FfmpegServiceImpl implements IFfmpegService {
                 }
                 checkNum++;
             }
+            Long current5 = System.currentTimeMillis();
+            log.info("图片替换完成:总时长{}毫秒", current5 - current4);
             //3开始合成视频
             //3.1 抽取音频文件
             String srcM4aFilePath = splitSrcPath + "src.m4a";
             getM4aFromMp4(srcFilePath, srcM4aFilePath);
+            Long current6 = System.currentTimeMillis();
+            log.info("抽取模板音频文件完成:总时长{}毫秒", current6 - current4);
             String fillM4aFilePath = splitSrcPath + "fill.m4a";
             getM4aFromMp4(fillFilePath, fillM4aFilePath);
+            Long current7 = System.currentTimeMillis();
+            log.info("抽取填充音频文件完成:总时长{}毫秒", current7 - current6);
             //3.2 截取源模板音频文件
             String cutM4aFilePath = splitSrcPath + "cut.m4a";
             //计算需要截取的音频时长
             String secondStr = getSecond(exchangeStartFrameNum);
             cutM4a(srcM4aFilePath, cutM4aFilePath, "00:00:00.000", secondStr);
+            Long current8 = System.currentTimeMillis();
+            log.info("音频文件截取完成:总时长{}毫秒", current8 - current7);
             //3.3 合并两个音频文件
             String finalM4aFilePath = splitSrcPath + "final.m4a";
             audioMosaic(cutM4aFilePath, fillM4aFilePath, finalM4aFilePath);
+            Long current9 = System.currentTimeMillis();
+            log.info("音频文件合成完成:总时长{}毫秒", current9 - current8);
             //3.4 将最终生成的图片合成为视频
             String noVoiceVideoFilePath = splitSrcPath + "novoice.mp4";
             mergeImageToVideo(splitFinalPath, 25, noVoiceVideoFilePath);
+            Long current10 = System.currentTimeMillis();
+            log.info("图片合成视频完成:总时长{}毫秒", current10 - current9);
             //3.5 合并视频和音频
             String finalVideoFilePath = splitSrcPath + "final.mp4";
             mergeAudioAndVideo(noVoiceVideoFilePath, finalM4aFilePath, finalVideoFilePath);
+            Long current11 = System.currentTimeMillis();
+            log.info("视频合成完成:总时长{}毫秒", current11 - current10);
             //3.6 上传视频文件至OSS并返回url存入数据库
             InputStream inputStream = new FileInputStream(finalVideoFilePath);
             String finalUrl = OSSUtils.uploadFile2OSS(inputStream, "model/final/", videoInfo.getId() + "_" + current + ".mp4");
-            System.out.println(finalUrl);
+            Long current12 = System.currentTimeMillis();
+            log.info("文件上传oss完成:总时长{}毫秒", current12 - current11);
             ModelVideoCompositeInfo compositeInfo = new ModelVideoCompositeInfo(userId, videoInfo, finalUrl);
             compositeInfoService.saveOrUpdate(compositeInfo);
             //删除文件
@@ -354,6 +443,32 @@ public class FfmpegServiceImpl implements IFfmpegService {
         return null;
     }
 
+    @Override
+    public void videoSplitToImage(String srcFilePath, String splitSrcPath) {
+        StringBuffer command = new StringBuffer();
+        command.append(FFMPEG_PATH);
+        command.append(" -i ");
+        command.append(srcFilePath);
+        command.append(" -threads 5");
+        command.append(" -preset");
+        command.append(" ultrafast ");
+        command.append(splitSrcPath + "%d.jpg");
+        Runtime runtime = Runtime.getRuntime();
+        Process pro = null;
+        try {
+            pro = runtime.exec(new String[]{"sh", "-c", command.toString()});
+            printProcessMsg(pro);
+            int status = pro.waitFor();
+            if (status == 0) {
+                log.info("视频切分成功:{}", command.toString());
+            } else {
+                log.info("视频切分失败:{}", command.toString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
     private void deleteFile(String splitSrcPath, String splitFillPath, String splitFinalPath, String srcFilePath, String fillFilePath) {
         LoadFileUtil.delFile(splitFillPath);
         LoadFileUtil.delFile(splitSrcPath);

+ 0 - 1
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -143,7 +143,6 @@ mybatis-plus:
 jeecg:
   ffmpeg:
     bin: ffmpeg
-  #    bin: D:\java\ffmpeg\bin\ffmpeg.exe
   path:
     #文件上传根目录 设置
     upload: /mnt/upload

+ 3 - 1
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -139,6 +139,8 @@ mybatis-plus:
       log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 #jeecg专用配置
 jeecg:
+  ffmpeg:
+    bin: D:\java\ffmpeg\bin\ffmpeg.exe
   path:
     #文件上传根目录 设置
     #文件上传根目录 设置
@@ -168,4 +170,4 @@ oss:
   replace:
     replace-value: oss-cn-beijing-internal
     replace-old-value: oss-cn-beijing
-    download: /mnt/file/video/
+    download: /mnt/file/video/

+ 8 - 5
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -7,7 +7,6 @@ import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.HttpUtils;
-import cn.com.ctop.common.module.utils.OSSUtils;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
@@ -21,12 +20,12 @@ import org.jeecg.modules.ctop.service.IBytedanceFundDailyService;
 import org.jeecg.modules.ctop.service.IPerformanceSaleService;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.opencv.core.Mat;
+import org.opencv.videoio.VideoCapture;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
-import java.io.FileInputStream;
-import java.io.InputStream;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
@@ -302,8 +301,12 @@ public class SampleTest {
 
     @Test
     public void test() throws Exception {
-        InputStream file = new FileInputStream("D:\\data\\模板视频\\原始模板4.mp4");
-        OSSUtils.uploadFile2OSS(file, "model/video/", "1234.mp4");
+        VideoCapture capture = new VideoCapture("D:\\data\\模板视频\\模板3\\原始模板3.mp4");
+        int frameCnt = 0;
+        int num = 0;
+        Mat mat = new Mat();
+        capture.read(mat);
+
     }
 
 

+ 2 - 1
module-report/src/main/java/cn/com/ctop/bytedance/controller/BytedanceReportController.java

@@ -143,13 +143,14 @@ public class BytedanceReportController {
                 return result;
             }
             for (CtopOauthToken token : tokens) {
-                //if(token.getAccountId() == 1662649623517198L){
+                //if(token.getAccountId() == 1647352267707396L){
                     bytedanceReportService.bytedanceMaterialReport(token,startDate,endDate);
                 //}
             }
             Long end = System.currentTimeMillis();
             log.info("头条获取素材报表数据任务执行结束,执行耗时:{}秒", (end - start) / 1000);
         } catch (Exception e) {
+            log.error("头条获取素材报表数据任务执行结失败");
             e.printStackTrace();
             result.setSuccess(false);
         }

+ 14 - 5
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceReportServiceImpl.java

@@ -23,6 +23,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
 import org.apache.http.entity.ContentType;
@@ -974,6 +975,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
     public void bytedanceMaterialReport(CtopOauthToken token, String startDate, String endDate){
         //CtopOauthToken token = ctopOauthTokenService.getTokenByAccountId(accountId);
         Long accountId = token.getAccountId();
+        log.info("头条素材报表当前accountId为:" + accountId);
         Integer page = 1;
         Integer pageSize = 500;
         bytedanceMaterialReportByPage(page, pageSize, token, accountId, startDate, endDate);
@@ -1002,10 +1004,6 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
                 put("page",page);
                 put("page_size",pageSize);
                 put("group_by", new String[]{"STAT_GROUP_BY_MATERIAL_ID","STAT_GROUP_BY_INVENTORY","STAT_GROUP_BY_IMAGE_MODE","STAT_GROUP_BY_TIME_DAY"});
-                //put("group_by", new String[]{"STAT_GROUP_BY_MATERIAL_ID"});
-                //put("filtering",filtering);
-                //put("order_field","stat_datetime");
-                //put("order_type","ASC");
             }
         };
 
@@ -1027,6 +1025,12 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
             httpEntity.setURI(URI.create(open_api_domain + path));
             httpEntity.setEntity(new StringEntity(JSONObject.toJSONString(data), ContentType.APPLICATION_JSON));
 
+            //RequestConfig requestConfig = RequestConfig.custom()
+            //        .setConnectTimeout(60000).setConnectionRequestTimeout(60000)
+            //        .setSocketTimeout(60000).build();
+
+            //httpEntity.setConfig(requestConfig);
+
             response = client.execute(httpEntity);
             //System.out.println(response);
             if (response != null && response.getStatusLine().getStatusCode() == 200) {
@@ -1045,7 +1049,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
                 if(!Check.isNull(json)){
                     Integer code = json.getInteger("code");
                     if(code != 0){
-                        log.info("获取任务列表返回信息错误,错误码为:" + code + ",头条accountId:" + accountId );
+                        log.info("获取任务列表返回信息错误,错误码为:" + code + ",头条accountId:" + accountId + ";返回json为:" + jsonString);
                         return;
                     }
 
@@ -1058,6 +1062,10 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
                     Integer currentPage = pageInfo.getInteger("page");
 
                     JSONArray jsonArrayay = jsonData.getJSONArray("list");
+                    if(jsonArrayay.size() == 0){
+                        log.info("accountId:" + accountId + ";没有数据。总页数为:" +  totalPage + "当前页数为:" + currentPage);
+                        return;
+                    }
                     List<BytedanceReportMaterialDaily> bytedanceReportMaterialDailyList = new ArrayList<>();
                     for (int i = 0; i < jsonArrayay.size(); i++) {
                         BytedanceReportMaterialDaily daily = new BytedanceReportMaterialDaily();
@@ -1170,6 +1178,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
 
                     bytedanceReportMaterialDailyMapper.replaceIntoBatch(bytedanceReportMaterialDailyList);
                     if(currentPage >= totalPage){
+                        log.info("accountId:" + accountId + "数据同步完成");
                         return;
                     }else{
                         bytedanceMaterialReportByPage(page + 1, pageSize, token, accountId, startDate, endDate);

+ 18 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/entity/ByteDanceVideoInfo.java

@@ -101,6 +101,18 @@ public class ByteDanceVideoInfo {
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
 
+    private String url;
+
+    private String format;
+
+    private String posterUrl;
+
+    private Long bitRate;
+
+    private Long materialId;
+
+    private String source;
+
     public ByteDanceVideoInfo(JSONObject data, CtopOauthToken token) {
         this.id = data.getString("id");
         this.fileId = data.getString("video_id");
@@ -113,6 +125,12 @@ public class ByteDanceVideoInfo {
         this.videoUrl = "https://aweme.snssdk.com/aweme/v1/playwm/?video_id="+data.getString("id")+"&line=0";
         this.signature = data.getString("signature");
         this.status = 1;
+        this.source = data.getString("source");
+        this.materialId = data.getLong("material_id");
+        this.bitRate = data.getLong("bit_rate");
+        this.posterUrl = data.getString("poster_url");
+        this.format = data.getString("format");
+        this.url = data.getString("url");
         Date now = new Date();
         this.createTime = now;
         this.updateTime = now;

+ 12 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/xml/ByteDanceVideoInfoMapper.xml

@@ -6,6 +6,12 @@
         id,
         advertiser_id,
         account_id,
+        material_id,
+        url,
+        format,
+        poster_url,
+        bit_rate,
+        source,
         file_id,
         width,
         height,
@@ -22,6 +28,12 @@
             #{video.id},
             #{video.advertiserId},
             #{video.accountId},
+            #{video.materialId},
+            #{video.url},
+            #{video.format},
+            #{video.posterUrl},
+            #{video.bitRate},
+            #{video.source},
             #{video.fileId},
             #{video.width},
             #{video.height},

+ 1 - 1
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml

@@ -369,7 +369,7 @@
     <select id="getMaterialAccountInfoByMaterialId" resultType="cn.com.ctop.userefficientvideomap.entity.DesignMaterialInfo">
         select
         a.account_id as accountId,
-        a.account_name as accountName,
+        <!-- a.account_name as accountName, -->
         '快手' as platform,
         sum(charge) as totalCost
         from