فهرست منبع

Merge branch 'master' of http://git.tjyourong.com.cn/ctop/adsp-boot

zhaoxian 4 سال پیش
والد
کامیت
2eb6927d4b
90فایلهای تغییر یافته به همراه1439 افزوده شده و 590 حذف شده
  1. 6 5
      jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/AccountReportConstants.java
  2. 2 1
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MD5Util.java
  3. 0 1
      jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/web/ActivitiProcessController.java
  4. 9 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ImageCostController.java
  5. 39 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  6. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  7. 4 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ByteDanceCleanMaterialJob.java
  8. 11 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IImageReportDailyService.java
  9. 133 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ImageReportDailyServiceImpl.java
  10. 3 0
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  11. 5 1
      jeecg-boot-module-system/src/main/resources/application-test.yml
  12. 4 4
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  13. 2 2
      jeecg-boot-module-system/src/main/resources/jeecg/jeecg_database.properties
  14. 62 106
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  15. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/ByteDanceCleanMaterialReport.java
  16. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaiShouCleanMaterialReport.java
  17. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/ByteDanceCleanMaterialReportMapper.java
  18. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaiShouCleanMaterialReportMapper.java
  19. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java
  20. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/ByteDanceCleanMaterialReportMapper.xml
  21. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouCleanMaterialReportMapper.xml
  22. 35 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  23. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/message/handle/impl/EmailSendMsgHandle.java
  24. 2 7
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IByteDanceCleanMaterialReportService.java
  25. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IKuaiShouCleanMaterialReportService.java
  26. 2 2
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialImageInfoService.java
  27. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  28. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialTagInfoService.java
  29. 26 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/ByteDanceCleanMaterialReportServiceImpl.java
  30. 18 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/KuaiShouCleanMaterialReportServiceImpl.java
  31. 8 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialImageInfoServiceImpl.java
  32. 55 3
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  33. 2 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialTagInfoServiceImpl.java
  34. 10 2
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/douyin/service/impl/DouyinMusicServiceImpl.java
  35. 1 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoJhsbybtServiceImpl.java
  36. 1 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoTttmServiceImpl.java
  37. 0 1
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceCleanMaterialJob.java
  38. 0 5
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceDailyMaterialReportRetryJob.java
  39. 0 3
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceDailyPlayableReportRetryJob.java
  40. 0 1
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouCleanMaterialJob.java
  41. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouDailyReportTaskServiceImpl.java
  42. 17 11
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java
  43. 126 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java
  44. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouCleanMaterialReportController.java
  45. 290 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyImage.java
  46. 13 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KsVideoReportMapper.java
  47. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyCreativeMapper.java
  48. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyImageMapper.java
  49. 39 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml
  50. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyCreativeMapper.xml
  51. 106 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyImageMapper.xml
  52. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKsVideoReportService.java
  53. 0 29
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaiShouCleanMaterialReportService.java
  54. 10 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyCreativeService.java
  55. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyImageService.java
  56. 32 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KsVideoReportServiceImpl.java
  57. 0 41
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaiShouCleanMaterialReportServiceImpl.java
  58. 27 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyCreativeServiceImpl.java
  59. 18 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyImageServiceImpl.java
  60. 15 3
      module-kuaishou/src/main/resources/json_template/kuaishou_filed_mapping.json
  61. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/adlab/controller/CtopAdlabProjectDetailController.java
  62. 2 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/adlab/entity/CtopAdlabProjectDetail.java
  63. 0 23
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IBytedanceCleanMaterialService.java
  64. 0 46
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceCleanMaterialServiceImpl.java
  65. 2 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/DTO/ImageCostVO.java
  66. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/ByteDanceCleanMaterialReportController.java
  67. 9 9
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/ByteDanceVideoReportDailyController.java
  68. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceAccountReportCtrl.java
  69. 0 8
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceInterfaceController.java
  70. 88 13
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceVideoReportCtrl.java
  71. 13 15
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/ByteDanceVideoReportDailyMapper.java
  72. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceCreativeDailyReportMapper.java
  73. 2 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceVideoReportMapper.java
  74. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceCreativeDailyReportMapper.xml
  75. 2 3
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceReportMaterialDailyMapper.xml
  76. 23 74
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml
  77. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IByteDanceVideoReportDailyService.java
  78. 0 3
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceAccountReportService.java
  79. 3 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceCreativeDailyReportService.java
  80. 0 5
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceReportMaterialDailyService.java
  81. 4 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceVideoReportService.java
  82. 0 54
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ByteDanceCleanMaterialReportServiceImpl.java
  83. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceAccountReportServiceImpl.java
  84. 20 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceCreativeDailyReportServiceImpl.java
  85. 0 45
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceReportMaterialDailyServiceImpl.java
  86. 3 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceReportServiceImpl.java
  87. 12 3
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceVideoReportServiceImpl.java
  88. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/tool/controller/ParseInstallPackageController.java
  89. 23 11
      module-toutiao/src/main/resources/json_template/bytedance_video_report_mapping.json
  90. 6 1
      pom.xml

+ 6 - 5
jeecg-boot-base-common/src/main/java/org/jeecg/common/constant/AccountReportConstants.java

@@ -20,7 +20,6 @@ public class AccountReportConstants {
     /** 单体实例 */
     private static AccountReportConstants instance;
 
-
     /**
      * @return 返回 instance
      */
@@ -35,10 +34,11 @@ public class AccountReportConstants {
      * 字典数据
      */
     //头条字段映射
-    public static Map<String, Map<String,Object>> dicMap = new HashMap<>();
+    public static Map<String, Map<String,Object>> dicMapBy = new HashMap<>();
     //快手字段映射
     public static Map<String, Map<String,Object>> dicMapKs = new HashMap<>();
-
+    //头条视频报表字段映射
+    public static Map<String, Map<String,Object>> dicMapByVideo= new HashMap<>();
     /**
      * 初始化字典
      */
@@ -46,9 +46,10 @@ public class AccountReportConstants {
         //加载json文件
         Object jsonBy=JsonResourceUtil.getJsonObjFromResource("/json_template/bytedance_filed_mapping.json");
         Object jsonKs=JsonResourceUtil.getJsonObjFromResource("/json_template/kuaishou_filed_mapping.json");
+        Object jsonByVideo=JsonResourceUtil.getJsonObjFromResource("/json_template/bytedance_video_report_mapping.json");
         //json 转为map存为静态常量
-        dicMap=JsonResourceUtil.jsonToMap(jsonBy);
+        dicMapBy=JsonResourceUtil.jsonToMap(jsonBy);
         dicMapKs=JsonResourceUtil.jsonToMap(jsonKs);
+        dicMapByVideo=JsonResourceUtil.jsonToMap(jsonByVideo);
     }
-
 }

+ 2 - 1
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MD5Util.java

@@ -91,6 +91,7 @@ public class MD5Util {
 	}
 
 	public static void main(String[] args) throws Exception {
-		System.out.println(getFileMd5("D:\\3-1599203419045.jpg"));
+		System.out.println(getFileMd5("D:\\mnt\\0427有缘3-帆楠E打车-同城热恋-1587982341839.mp4"));
+		System.out.println(getFileMd5("D:\\mnt\\0427有缘4-帆楠E洗脚-同城热恋-1593661309704.mp4"));
 	}
 }

+ 0 - 1
jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/web/ActivitiProcessController.java

@@ -95,7 +95,6 @@ public class ActivitiProcessController {
                 }
                 return false;
             }).collect(Collectors.toList());
-
         }
         if(null!=list&&!list.isEmpty()){
             List<ActZprocess> getList = new ArrayList<>();

+ 9 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ImageCostController.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportMaterialDailyService;
 import com.alibaba.fastjson.JSONObject;
+import org.jeecg.modules.ctop.service.IImageReportDailyService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -12,8 +13,15 @@ import java.util.Map;
 public class ImageCostController {
     @Autowired
     private IBytedanceReportMaterialDailyService materialDailyService;
+    @Autowired
+    private IImageReportDailyService imageReportDailyService;
     @PostMapping("bytedance/cost")
     public Map<String,Object> bytedanceImageCost(@RequestBody JSONObject data){
-        return materialDailyService.bytedanceImageCost(data);
+        return imageReportDailyService.bytedanceImageCost(data);
+    }
+
+    @PostMapping("kuaishou/cost")
+    public Map<String,Object> kuaishouImageCost(@RequestBody JSONObject data){
+        return imageReportDailyService.kuaishouImageCost(data);
     }
 }

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

@@ -9,10 +9,6 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CloudVideoProcessUtil;
 import cn.com.ctop.common.module.utils.JsonUtil;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouCleanMaterialReportService;
-import cn.com.ctop.toutiao.modules.report.entity.ByteDanceCleanMaterialReport;
-import cn.com.ctop.toutiao.modules.report.service.IByteDanceCleanMaterialReportService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -35,10 +31,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.net.URLDecoder;
 import java.text.ParseException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 素材信息
@@ -315,6 +308,44 @@ public class MaterialInfoController {
         return result;
     }
 
+    @GetMapping(value = "/listV2")
+    public Map<String,Object> queryPageList(String type,Integer status,Long projectId,String materialName,String code,
+                                                     String startDate,String endDate,String tagCode,
+                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        List<Long>projectIds = null;
+        String userId = user.getId();
+        String roleCode = roleService.getRoleCodeByUserId(userId);
+        if(null == tagCode||tagCode.trim().equals("")){
+            tagCode = null;
+        }
+        if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || roleCode.contains("sale")){
+            //查询所有
+            if(null!=projectId&&projectId!=0){
+                projectIds = new ArrayList<>();
+                projectIds.add(projectId);
+            }
+            return materialInfoService.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate,null,pageNo,pageSize);
+        }else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)){
+            //查询自己所在项目下的数据
+            if(null == projectId||projectId == 0){
+                projectIds = memberService.selectProjectsByUserId(userId);
+            }else{
+                projectIds = new ArrayList<>();
+                projectIds.add(projectId);
+            }
+            return materialInfoService.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate,null,pageNo,pageSize);
+        }else{
+            //查询自己上传的视频
+            if(null!=projectId&&projectId!=0){
+                projectIds = new ArrayList<>();
+                projectIds.add(projectId);
+            }
+            return materialInfoService.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate,userId,pageNo,pageSize);
+        }
+    }
+
 
     @AutoLog(value = "素材信息-分页列表查询")
     @ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")

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

@@ -133,7 +133,7 @@ public class TestController {
 
         List<CrawlerDouyinMusicTask> list = crawlerDouyinMusicTaskService.list(queryWrapper);
 
-        while (list != null) {
+        while (list != null && list.size() > 0) {
             for (CrawlerDouyinMusicTask crawlerDouyinMusicTask : list) {
                 MusicInfo musicInfo = new MusicInfo();
                 musicInfo.setExtId(crawlerDouyinMusicTask.getId());
@@ -157,7 +157,7 @@ public class TestController {
                     QueryWrapper<CrawlerDouyinMusicTask> queryWrapper = new QueryWrapper<>();
                     queryWrapper.eq("status", "init").likeLeft("id", j).orderByDesc("id").last(" limit 20");
                     List<CrawlerDouyinMusicTask> list = crawlerDouyinMusicTaskService.list(queryWrapper);
-                    while (list != null) {
+                    while (list != null && list.size() > 0) {
                         log.info("【同步歌曲】第" + j + "线程正在处理:" + list.size() + "条数据");
                         for (CrawlerDouyinMusicTask crawlerDouyinMusicTask : list) {
                             MusicInfo musicInfo = new MusicInfo();
@@ -184,7 +184,7 @@ public class TestController {
                     QueryWrapper<CrawlerDouyinMusicTask> queryWrapper = new QueryWrapper<>();
                     queryWrapper.eq("status", "done").likeLeft("id", j).orderByDesc("id").last(" limit 20");
                     List<CrawlerDouyinMusicTask> list = crawlerDouyinMusicTaskService.list(queryWrapper);
-                    while (list != null) {
+                    while (list != null && list.size() > 0) {
                         log.info("【解析分类】第" + j + "线程正在处理:" + list.size() + "条数据");
                         for (CrawlerDouyinMusicTask crawlerDouyinMusicTask : list) {
                             QueryWrapper<MusicInfo> queryWrapper1 = new QueryWrapper<>();

+ 4 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ByteDanceCleanMaterialJob.java

@@ -1,7 +1,7 @@
 package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.toutiao.modules.report.service.IByteDanceCleanMaterialReportService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceCreativeDailyReportService;
 import lombok.extern.slf4j.Slf4j;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
@@ -18,7 +18,7 @@ import java.util.concurrent.Executors;
 @Slf4j
 public class ByteDanceCleanMaterialJob implements Job {
     @Autowired
-    private IByteDanceCleanMaterialReportService byteDanceCleanMaterialReportService;
+    private IBytedanceCreativeDailyReportService bytedanceCreativeDailyReportService;
     static ExecutorService executorService = null;
 
     @Override
@@ -26,7 +26,7 @@ public class ByteDanceCleanMaterialJob implements Job {
         Thread thread = new Thread() {
             @Override
             public void run() {
-                List<String> signatureList = byteDanceCleanMaterialReportService.getSignature();
+                List<String> signatureList = bytedanceCreativeDailyReportService.getSignatureList();
                 if (Check.isNull(signatureList)) {
                     log.error("头条素材数据获取为空");
                     return;
@@ -37,7 +37,7 @@ public class ByteDanceCleanMaterialJob implements Job {
                     executorService.submit(new Runnable() {
                         @Override
                         public void run() {
-                            byteDanceCleanMaterialReportService.calculationMaterialReport(signature);
+                            bytedanceCreativeDailyReportService.calculationMaterialReport(signature);
                         }
                     });
                 }

+ 11 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IImageReportDailyService.java

@@ -0,0 +1,11 @@
+package org.jeecg.modules.ctop.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.Map;
+
+public interface IImageReportDailyService {
+    Map<String,Object> bytedanceImageCost(JSONObject data);
+
+    Map<String, Object> kuaishouImageCost(JSONObject data);
+}

+ 133 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ImageReportDailyServiceImpl.java

@@ -0,0 +1,133 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import cn.com.ctop.common.module.entity.MaterialImageInfo;
+import cn.com.ctop.common.module.entity.SysUser;
+import cn.com.ctop.common.module.service.IMaterialImageInfoService;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
+import cn.com.ctop.toutiao.modules.report.DTO.ImageCostVO;
+import cn.com.ctop.toutiao.modules.report.mapper.BytedanceReportMaterialDailyMapper;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.jeecg.modules.ctop.service.IImageReportDailyService;
+import org.jeecg.modules.system.service.ISysUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class ImageReportDailyServiceImpl implements IImageReportDailyService {
+
+    @Override
+    public Map<String,Object> bytedanceImageCost(JSONObject data) {
+        Map<String,Object>result = new HashMap<>();
+        String startDate = data.getString("startDate");
+        if(null == startDate||startDate.trim().equals("")){
+            startDate = null;
+        }
+        String endDate = data.getString("endDate");
+        if(null == endDate||endDate.trim().equals("")){
+            endDate = null;
+        }
+        JSONArray accountList = data.getJSONArray("accountList");
+        if(null==accountList||accountList.isEmpty()){
+            accountList = null;
+        }
+        String code = data.getString("code");
+        if(null == code||code.trim().equals("")){
+            code = null;
+        }
+        Integer pageSize = data.getInteger("pageSize");
+        Integer pageNumber = data.getInteger("pageNumber");
+        if(null == pageNumber||pageNumber ==0){
+            pageNumber = 1;
+        }
+        if(null == pageSize||pageSize ==0){
+            pageSize = 10;
+        }
+        PageHelper.startPage(pageNumber,pageSize);
+        List<ImageCostVO> vos = bytedanceReportMaterialDailyMapper.bytedanceImageCost(startDate,endDate,accountList,code,(pageNumber-1)*pageSize,pageSize);
+        PageInfo<ImageCostVO> pageInfo = new PageInfo<>(vos);
+        if(null!=vos&&!vos.isEmpty()){
+            List<ImageCostVO>setVos = new ArrayList<>();
+            for(ImageCostVO vo:vos){
+                MaterialImageInfo imageInfo = imageInfoService.getByCode(vo.getSignature());
+                if(null!=imageInfo){
+                    vo.setUserId(imageInfo.getUserId());
+                    SysUser user = sysUserService.getById(imageInfo.getUserId());
+                    vo.setUserName(user.getUsername());
+                }else{
+                    vo.setUserName("-");
+                }
+                setVos.add(vo);
+            }
+            pageInfo.setList(setVos);
+        }
+        result.put("data",pageInfo);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        return result;
+    }
+
+    @Override
+    public Map<String, Object> kuaishouImageCost(JSONObject data) {
+        Map<String,Object>result = new HashMap<>();
+        String startDate = data.getString("startDate");
+        if(null == startDate||startDate.trim().equals("")){
+            startDate = null;
+        }
+        String endDate = data.getString("endDate");
+        if(null == endDate||endDate.trim().equals("")){
+            endDate = null;
+        }
+        JSONArray accountList = data.getJSONArray("accountList");
+        if(null==accountList||accountList.isEmpty()){
+            accountList = null;
+        }
+        String code = data.getString("code");
+        if(null == code||code.trim().equals("")){
+            code = null;
+        }
+        Integer pageSize = data.getInteger("pageSize");
+        Integer pageNumber = data.getInteger("pageNumber");
+        if(null == pageNumber||pageNumber ==0){
+            pageNumber = 1;
+        }
+        if(null == pageSize||pageSize ==0){
+            pageSize = 10;
+        }
+        PageHelper.startPage(pageNumber,pageSize);
+        List<ImageCostVO> vos = bytedanceReportMaterialDailyMapper.bytedanceImageCost(startDate,endDate,accountList,code,(pageNumber-1)*pageSize,pageSize);
+        PageInfo<ImageCostVO> pageInfo = new PageInfo<>(vos);
+        if(null!=vos&&!vos.isEmpty()){
+            List<ImageCostVO>setVos = new ArrayList<>();
+            for(ImageCostVO vo:vos){
+                MaterialImageInfo imageInfo = imageInfoService.getByCode(vo.getSignature());
+                if(null!=imageInfo){
+                    vo.setUserId(imageInfo.getUserId());
+                    SysUser user = sysUserService.getById(imageInfo.getUserId());
+                    vo.setUserName(user.getUsername());
+                }else{
+                    vo.setUserName("-");
+                }
+                setVos.add(vo);
+            }
+            pageInfo.setList(setVos);
+        }
+        result.put("data",pageInfo);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        return result;
+    }
+
+    @Autowired
+    private IMaterialImageInfoService imageInfoService;
+    @Autowired
+    private BytedanceReportMaterialDailyMapper bytedanceReportMaterialDailyMapper;
+    @Autowired
+    private ISysUserService sysUserService;
+}

+ 3 - 0
jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -16,6 +16,9 @@ management:
         include: metrics,httptrace
 
 spring:
+  devtools:
+    restart:
+      enabled: true
   servlet:
     multipart:
       max-file-size: 10MB

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

@@ -13,6 +13,9 @@ management:
         include: metrics,httptrace
 
 spring:
+  devtools:
+    restart:
+      enabled: true
   servlet:
     multipart:
       max-file-size: -1
@@ -122,7 +125,8 @@ mybatis-plus:
       id-type: 4
       # 默认数据库表下划线命名
       table-underline: true
-  # configuration:
+#  configuration:
+#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
   #  map-underscore-to-camel-case: false
   #分页pageHelper
 pagehelper:

+ 4 - 4
jeecg-boot-module-system/src/main/resources/application-wps.yml

@@ -126,8 +126,8 @@ mybatis-plus:
       id-type: 4
       # 默认数据库表下划线命名
       table-underline: true
-#  configuration:
-#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+  configuration:
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 #jeecg专用配置
 jeecg:
   elasticsearch:
@@ -162,8 +162,8 @@ jeecg:
     chrome-driver: D://chromedriver.exe
     csv-upload: /mnt/upload/csv/
     bak-database-file: /mnt/data/bak/
-    report-history: /mnt/upload/report/history/
-    report-daily: /mnt/upload/report/daily/
+    report-history: D://mnt//reportKs//
+    report-daily: D://mnt//reportKs//
 kuaishou:
   group-control:
     path: http://39.106.184.70

+ 2 - 2
jeecg-boot-module-system/src/main/resources/jeecg/jeecg_database.properties

@@ -1,8 +1,8 @@
 #mysql
 diver_name=com.mysql.jdbc.Driver
-url=jdbc:mysql://139.186.31.213:3306/jeecg-boot?useUnicode=true&characterEncoding=UTF-8
+url=jdbc:mysql://139.186.27.96:3306/jeecg-boot?useUnicode=true&characterEncoding=UTF-8
 username=hcst
-password=hcst2020
+password=test@20190531
 database_name=jeecg-boot
 #oracle
 #diver_name=oracle.jdbc.driver.OracleDriver

+ 62 - 106
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -5,24 +5,17 @@ import cn.com.ctop.check.entity.CtopCheckTaskList;
 import cn.com.ctop.check.service.ICtopCheckTaskListService;
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.entity.UReportSubscriber;
+import cn.com.ctop.common.module.entity.MaterialImageInfo;
 import cn.com.ctop.common.module.entity.UserAllocation;
-import cn.com.ctop.common.module.message.handle.impl.EmailSendMsgHandle;
-import cn.com.ctop.common.module.service.*;
+import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IMaterialImageInfoService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouRealTimeDataService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
-import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
-import cn.com.ctop.oa.modules.service.IWechatDepartmentService;
-import cn.com.ctop.oa.modules.service.IWechatNoListService;
-import cn.com.ctop.oa.modules.service.IWechatUserListService;
-import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.report.service.IReportService;
-import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
@@ -33,8 +26,6 @@ import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.junit4.SpringRunner;
 
-import java.io.File;
-import java.text.ParseException;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -54,57 +45,26 @@ public class SampleTest {
     @Autowired
     private IReportService reportService;
     @Autowired
-    private IUserAllocationService userAllocationService;
-    @Autowired
-    private IByteDanceAdvertiserDataService advertiserDataService;
-    @Autowired
     private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
     @Autowired
-    private IKuaiShouDailyReportTaskService dailyReportTaskService;
-
-    @Autowired
-    private IWechatDepartmentService wechatDepartment;
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
-    @Autowired
-    private IWechatUserListService wechatUserInfoService;
-    @Autowired
-    private IWechatCheckinDataService wechatCheckinDataService;
-    @Autowired
-    private IWechatNoListService wechatNoListService;
-    @Autowired
-    private ICtopOauthTokenService tokenService;
-    @Autowired
-    private IKuaishouRealTimeDataService realTimeDataService;
-
-
+    private IMaterialImageInfoService imageInfoService;
     @Test
-    public void getDepartment() throws ParseException {
-
-        JSONArray campaignDate = realTimeDataService.getCampaignDate(7865319L, "7abeae7f7708bda8111c62f985da84e7", 20209274L, "2020-09-27", "2020-09-27");
-
-        System.err.println(campaignDate);
-//        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-//        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-//        Date parse1 = simpleDateFormat.parse("2020-09-12");
-//        Date parse2 = simpleDateFormat.parse("2020-09-17");
-//        for (CtopOauthToken token : tokens) {
-//
-//            kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, parse1, parse2);
-//
-//        }
-
-//        wechatDepartment.getDepartment();
-//        wechatUserInfoService.getUserList();
-//        wechatCheckinDataService.getCheckinData();
-//        wechatNoListService.getNoDateByNo("1598889600","1600927780");
-
-       /* Map<String, Object> map = new HashMap<String, Object>();
-        map.put("departId", "9");
-        List<WechatAttendance> wechatAttendances = wechatNoListService.queryAttendanceData(map);
-        System.out.println(wechatAttendances);*/
-        //         kuaishouInterfaceService.getSuZaoList("a34853c230e1b949eddbe569023dbc40", 7022550L, 1, "2020-09-15", "2020-09-16");
+    public void loadBytedanceMatData(){
+        executorService = Executors.newFixedThreadPool(5);
+        List<CtopOauthToken> tokens = oauthTokenService.selectToutiaoToken();
+        for (CtopOauthToken token:tokens) {
+            reportService.getAdvertiserPlanReport(token,new Date(),new Date(),CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+        }
+    }
 
+    @Test
+    public void initImageCode(){
+        QueryWrapper<MaterialImageInfo>queryWrapper = new QueryWrapper<>();
+        queryWrapper.le("update_time","2020-09-23 18:35:00");
+        List<MaterialImageInfo> imageInfos = imageInfoService.list(queryWrapper);
+        for (MaterialImageInfo image:imageInfos) {
+            imageInfoService.initImageCode(image);
+        }
     }
 
 
@@ -113,10 +73,10 @@ public class SampleTest {
         QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("media_id", 2);
         List<CtopOauthToken> list = oauthTokenService.list(queryWrapper);
-        for (CtopOauthToken token : list) {
-            kuaiShouHistoryReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-20", "2020-09-20", "daily");
+         for (CtopOauthToken token : list) {
+        kuaiShouHistoryReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-20", "2020-09-20", "daily");
 
-        }
+         }
 
     }
 
@@ -149,7 +109,6 @@ public class SampleTest {
     }
 
     static ExecutorService executorService = null;
-    //线程计数器/bytedance/bytedanceMaterialReport
     static CountDownLatch countDownLatch = null;
 
     @Test
@@ -183,12 +142,12 @@ public class SampleTest {
 
     @Test
     public void testLoadBytedanceData() {
-        List<UserAllocation> allocations = allocationService.getByParams(435L, null, 0);
+        List<UserAllocation> allocations = allocationService.getByParams(430L, null, 0);
         for (UserAllocation allocation : allocations) {
-            for (int i = 2; i < 10; i++) {
+            for (int i = 0; i < 10; i++) {
                 CtopOauthToken token = oauthTokenService.getTokenByAccountId(allocation.getAccountId());
                 Date getDate = DateUtils.addDay(new Date(), -i);
-                reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+                reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
             }
         }
     }
@@ -196,18 +155,18 @@ public class SampleTest {
     @Test
     public void loadKuaishouAgentData() {
         kuaishouReportDailyAgentService.loginAgent();
-        for (int i = 0; i < 20; i++) {
-            String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -i));
-            kuaishouReportDailyAgentService.getReport(currentDate, DateUtils.getNowDate("yyyy-MM-dd"));
-        }
-//
-//        try {
-//            for (int i = 1; i < 30; i++) {
-//                kuaishouReportDailyAgentService.getAccount(i);
-//            }
-//        } catch (Exception e) {
-//            e.printStackTrace();
+//        for (int i = 0; i < 20; i++) {
+//            String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -i));
+//            kuaishouReportDailyAgentService.getReport(currentDate, DateUtils.getNowDate("yyyy-MM-dd"));
 //        }
+//
+        try {
+            for (int i = 1; i < 30; i++) {
+                kuaishouReportDailyAgentService.getAccount(i);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
 
     @Autowired
@@ -231,35 +190,32 @@ public class SampleTest {
         reportService.getAdvertiserReport(token, DateUtils.parseDate("2020-09-01", "yy-MM-dd"), DateUtils.parseDate("2020-09-01", "yy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
     }
 
-    @Autowired
-    IUReportExportService uReportExportService;
-    @Autowired
-    EmailSendMsgHandle emailSendMsgHandle;
-    @Autowired
-    IUReportService uReportService;
-
     @Test
-    public void sendUReport() {
-        uReportService.uReportList().forEach(uReport -> {
-            List<UReportSubscriber> uReportSubscriber = uReportService.getUReportSubscriberByFileId(uReport.getString("id"));
-            if (!uReportSubscriber.isEmpty()) {
-                String title = uReport.getString("name").replace(".ureport.xml", "");
-                String content = "您订阅的日报在附件中请注意查收》》》";
-                //下载文件到本地
-                uReportExportService.exportExcel(uReport.getString("name"));
-                uReportSubscriber.forEach(sender -> {
-                    emailSendMsgHandle.SendAttachment("bijiequan@c-top.com.cn", title, content,
-                            new File(System.getProperty("user.dir") + File.separator + "uReport" + File.separator + uReport.getString("name").replace("ureport.xml", "") + "xlsx"));
-                });
-            }
-        });
-        //发完全部订阅,删除文件
-        File file = new File(System.getProperty("user.dir") + File.separator + "uReport");
-        File[] files = file.listFiles();
-        if (files != null && files.length > 0) {
-            for (File f : files) {
-                f.delete();
+    public void testBytedanceVideoReport(){
+        List<CtopOauthToken> tokens = oauthTokenService.selectToutiaoToken();
+        for(int i=2;i<100;i++){
+            String date = DateUtils.formatDate(DateUtils.addDay(new Date(),-i));
+            for (CtopOauthToken token:tokens) {
+//                bytedanceReportService.bytedanceVideoMaterialReport(token, date, date);
             }
         }
     }
+
+    @Test
+    public void loadKuaishouReportData() {
+        QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("media_id", 2);
+        List<CtopOauthToken> list = oauthTokenService.list(queryWrapper);
+        for (CtopOauthToken token : list) {
+            kuaiShouHistoryReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-17", "2020-09-19", "history");
+            kuaiShouHistoryReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-20", "2020-09-20", "daily");
+        }
+    }
+
+    @Autowired
+    private IKuaiShouHistoryReportTaskService historyReportTaskService;
+    @Test
+    public void loadHistoryJob(){
+        historyReportTaskService.getTaskList();
+    }
 }

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/ByteDanceCleanMaterialReport.java

@@ -1,4 +1,4 @@
-package cn.com.ctop.toutiao.modules.report.entity;
+package cn.com.ctop.common.module.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaiShouCleanMaterialReport.java

@@ -1,4 +1,4 @@
-package cn.com.ctop.kuaishou.modules.report.entity;
+package cn.com.ctop.common.module.entity;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/ByteDanceCleanMaterialReportMapper.java

@@ -1,6 +1,6 @@
-package cn.com.ctop.toutiao.modules.report.mapper;
+package cn.com.ctop.common.module.mapper;
 
-import cn.com.ctop.toutiao.modules.report.entity.ByteDanceCleanMaterialReport;
+import cn.com.ctop.common.module.entity.ByteDanceCleanMaterialReport;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 /**

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaiShouCleanMaterialReportMapper.java

@@ -1,6 +1,6 @@
-package cn.com.ctop.kuaishou.modules.report.mapper;
+package cn.com.ctop.common.module.mapper;
 
-import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
+import cn.com.ctop.common.module.entity.KuaiShouCleanMaterialReport;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 /**

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java

@@ -34,4 +34,6 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
     Long getProjectIdByAccountId(@Param("accountId") Long accountId);
 
     List<MaterialInfo> getListByDate(@Param("startDate") String startDate,@Param("endDate") String endDate);
+
+    List<MaterialInfo> getListByParams(@Param("tagCode")String tagCode,@Param("type")String type, @Param("status")Integer status, @Param("projectIds")List<Long> projectIds, @Param("materialName")String materialName, @Param("code")String code, @Param("startDate")String startDate, @Param("endDate")String endDate, @Param("userId")String userId);
 }

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/ByteDanceCleanMaterialReportMapper.xml

@@ -1,5 +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.toutiao.modules.report.mapper.ByteDanceCleanMaterialReportMapper">
+<mapper namespace="cn.com.ctop.common.module.mapper.ByteDanceCleanMaterialReportMapper">
 
 </mapper>

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouCleanMaterialReportMapper.xml

@@ -1,5 +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.kuaishou.modules.report.mapper.KuaiShouCleanMaterialReportMapper">
+<mapper namespace="cn.com.ctop.common.module.mapper.KuaiShouCleanMaterialReportMapper">
 
 </mapper>

+ 35 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -113,6 +113,41 @@
         limit 1
     </select>
 
+    <select id="getListByParams" resultType="cn.com.ctop.common.module.entity.MaterialInfo">
+        select
+        distinct matInfo.code,
+        matInfo.project_id,
+        matInfo.id
+        from ctop_material_info matInfo
+        left join ctop_material_tag_info tagInfo on tagInfo.code = matInfo.code
+        where 1=1
+        <if test="tagCode!=null">
+            and tagInfo.tag_code like concat(#{tagCode},'%')
+        </if>
+        <if test="status!=null">
+            and matInfo.status = #{status}
+        </if>
+        <if test="userId!=null">
+            and matInfo.user_id = #{userId}
+        </if>
+        <if test="materialName!=null">
+            and matInfo.material_name like concat('%',#{materialName},'%')
+        </if>
+        <if test="projectIds!=null">
+            and matInfo.project_id in
+            <foreach item="item" index="index" collection="projectIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="startDate!=null">
+            and matInfo.create_time &gt;= #{startDate}
+        </if>
+        <if test="endDate!=null">
+            and matInfo.create_time &lt;= #{endDate}
+        </if>
+        order by matInfo.create_time desc
+
+    </select>
     <select id="getListByDate" resultType="cn.com.ctop.common.module.entity.MaterialInfo">
         select  *  from
         ctop_material_info

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/message/handle/impl/EmailSendMsgHandle.java

@@ -34,6 +34,7 @@ public class EmailSendMsgHandle implements ISendMsgHandle {
             helper.setSubject(es_title);
             helper.setText(es_content, true);
             mailSender.send(message);
+
         } catch (MessagingException e) {
             e.printStackTrace();
         }

+ 2 - 7
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IByteDanceCleanMaterialReportService.java

@@ -1,10 +1,8 @@
-package cn.com.ctop.toutiao.modules.report.service;
+package cn.com.ctop.common.module.service;
 
-import cn.com.ctop.toutiao.modules.report.entity.ByteDanceCleanMaterialReport;
+import cn.com.ctop.common.module.entity.ByteDanceCleanMaterialReport;
 import com.baomidou.mybatisplus.extension.service.IService;
 
-import java.util.List;
-
 /**
  * 头条-数据清洗
  *
@@ -14,8 +12,5 @@ import java.util.List;
  */
 public interface IByteDanceCleanMaterialReportService extends IService<ByteDanceCleanMaterialReport> {
 
-    List<String> getSignature();
-
-
     void calculationMaterialReport(String signature);
 }

+ 15 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IKuaiShouCleanMaterialReportService.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.KuaiShouCleanMaterialReport;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 快手素材清洗数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-02-24
+ */
+public interface IKuaiShouCleanMaterialReportService extends IService<KuaiShouCleanMaterialReport> {
+
+}

+ 2 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialImageInfoService.java

@@ -15,7 +15,6 @@ import java.util.Map;
  * @date 2020-03-16
  */
 public interface IMaterialImageInfoService extends IService<MaterialImageInfo> {
-
     /**
      * 根据视频id  关联封面
      */
@@ -23,10 +22,11 @@ public interface IMaterialImageInfoService extends IService<MaterialImageInfo> {
 
     Map<String, Object> checkMaterialInfo(String code, String videoId);
 
-
     List<String> getCodeList();
 
     List<JSONObject> getUrlList(String videoId);
 
     void initImageCode(MaterialImageInfo image);
+
+    MaterialImageInfo getByCode(String signature);
 }

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java

@@ -73,4 +73,6 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
     List<String> getEffiCode();
 
     List<MaterialInfo> getListByDate(String startDate, String endDate);
+
+    Map<String,Object> getListByParams(String tagCode,String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize);
 }

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialTagInfoService.java

@@ -17,4 +17,6 @@ public interface IMaterialTagInfoService extends IService<MaterialTagInfo> {
     Map<String, Object> mark(JSONObject data, LoginUser loginUser);
 
     Map<String, Object> getTagDetail(MaterialTagInfo materialTagInfo);
+
+    void deleteByCode(String code);
 }

+ 26 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/ByteDanceCleanMaterialReportServiceImpl.java

@@ -0,0 +1,26 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.ByteDanceCleanMaterialReport;
+import cn.com.ctop.common.module.mapper.ByteDanceCleanMaterialReportMapper;
+import cn.com.ctop.common.module.service.IByteDanceCleanMaterialReportService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.context.annotation.Primary;
+import org.springframework.stereotype.Service;
+
+/**
+ * 头条-数据清洗
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-02-25
+ */
+@Service
+@Primary
+
+public class ByteDanceCleanMaterialReportServiceImpl extends ServiceImpl<ByteDanceCleanMaterialReportMapper, ByteDanceCleanMaterialReport> implements IByteDanceCleanMaterialReportService {
+
+    @Override
+    public void calculationMaterialReport(String signature) {
+
+    }
+}

+ 18 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/KuaiShouCleanMaterialReportServiceImpl.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.KuaiShouCleanMaterialReport;
+import cn.com.ctop.common.module.mapper.KuaiShouCleanMaterialReportMapper;
+import cn.com.ctop.common.module.service.IKuaiShouCleanMaterialReportService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 快手素材清洗数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-02-24
+ */
+@Service
+public class KuaiShouCleanMaterialReportServiceImpl extends ServiceImpl<KuaiShouCleanMaterialReportMapper, KuaiShouCleanMaterialReport> implements IKuaiShouCleanMaterialReportService {
+}

+ 8 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialImageInfoServiceImpl.java

@@ -143,4 +143,12 @@ public class MaterialImageInfoServiceImpl extends ServiceImpl<MaterialImageInfoM
         }
     }
 
+    @Override
+    public MaterialImageInfo getByCode(String signature) {
+        QueryWrapper<MaterialImageInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("code",signature);
+        queryWrapper.last("limit 1");
+        return this.getOne(queryWrapper);
+    }
+
 }

+ 55 - 3
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -13,6 +13,8 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.tencentcloudapi.mps.v20190612.models.DescribeTaskDetailResponse;
 import it.sauronsoftware.jave.Encoder;
 import it.sauronsoftware.jave.EncoderException;
@@ -408,7 +410,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                         String height = String.valueOf(m.getVideo().getSize().getHeight());
                         materialParameter.setHeight(height);
 
-
                         fis = new FileInputStream(file);
                         FileChannel fc = fis.getChannel();
                         BigDecimal fileSize = new BigDecimal(fc.size());
@@ -586,7 +587,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                     log.info("素材归属信息入库完成,MaterialId:{}", info.getId());
                 }
             }
-
+            materialTagInfoService.deleteByCode(code);
             JSONArray modalityTagList = json.getJSONArray("modalityTagList");
             insertTagList(code, userId, modalityTagList);
             JSONArray contentTagList = json.getJSONArray("contentTagList");
@@ -647,7 +648,6 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         List<String> effiSignatureList = materialInfoMapper.getEffiSignature();
         for (String code : effiSignatureList) {
             MaterialInfo materialInfo = materialInfoMapper.getMaterialInfoByCode(code);
-
             if (materialInfo == null) {
                 continue;
             }
@@ -675,6 +675,58 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     public List<MaterialInfo> getListByDate(String startDate, String endDate) {
         return materialInfoMapper.getListByDate(startDate, endDate);
     }
+
+    @Override
+    public Map<String,Object> getListByParams(String tagCode,String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize) {
+        Map<String,Object> result = new HashMap<>();
+        PageHelper.startPage(pageNo,pageSize);
+        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate, userId);
+        List<MaterialInfo> setList = new ArrayList<>();
+        PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
+        if(null!=dailyList&&!dailyList.isEmpty()){
+            for(MaterialInfo info:dailyList){
+                MaterialInfo materialInfo = materialInfoMapper.selectById(info.getId());
+                //判断是否已经同步到快手平台
+                Integer kuaishouMaterialUpCount = this.getKuaishouUpVideoCount(info.getCode());
+                if (kuaishouMaterialUpCount > 0) {
+                    materialInfo.setKuaishouVideoIsUp(1);
+                } else {
+                    materialInfo.setKuaishouVideoIsUp(0);
+                }
+                //判断是否已经同步到抖音平台
+                Integer toutiaoMaterialUpCount = this.getToutiaoUpVideoCount(info.getCode());
+                if (toutiaoMaterialUpCount > 0) {
+                    materialInfo.setToutiaoVideoIsUp(1);
+                } else {
+                    materialInfo.setToutiaoVideoIsUp(0);
+                }
+
+                //TODO 消耗统计
+
+                Project project = projectService.getById(info.getProjectId());
+                if (!Check.isNull(project)) {
+                    materialInfo.setMediaId(project.getMediaId());
+                    materialInfo.setProjectName(project.getProjectName());
+                }
+
+                QueryWrapper<MaterialImageInfo> imageInfoQueryWrapper = new QueryWrapper<>();
+                imageInfoQueryWrapper.eq("video_id", info.getCode());
+                imageInfoQueryWrapper.eq("status", 0);
+                List<MaterialImageInfo> imageInfoList = materialImageInfoService.list(imageInfoQueryWrapper);
+                if (Check.isNull(imageInfoList)) {
+                    materialInfo.setWhetherUnaudited(false);
+                } else {
+                    materialInfo.setWhetherUnaudited(true);
+                }
+
+                setList.add(materialInfo);
+            }
+        }
+        pageInfo.setList(setList);
+        result.put("data",pageInfo);
+        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        return result;
+    }
 }
 
 

+ 2 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialTagInfoServiceImpl.java

@@ -96,7 +96,8 @@ public class MaterialTagInfoServiceImpl extends ServiceImpl<MaterialTagInfoMappe
         return this.list(queryWrapper);
     }
 
-    private void deleteByCode(String code) {
+    @Override
+    public void deleteByCode(String code) {
         UpdateWrapper<MaterialTagInfo>updateWrapper = new UpdateWrapper<>();
         updateWrapper.eq("code",code).set("status",0).set("update_time",new Date());
         this.update(updateWrapper);

+ 10 - 2
module-crawler/src/main/java/cn/com/ctop/crawler/modules/douyin/service/impl/DouyinMusicServiceImpl.java

@@ -112,6 +112,10 @@ public class DouyinMusicServiceImpl implements DouyinMusicService {
             crawlerDouyinMusicTask.setStatus("parsed");
             crawlerDouyinMusicTaskService.updateById(crawlerDouyinMusicTask);
         }catch (Exception e){
+            CrawlerDouyinMusicTask crawlerDouyinMusicTask = new CrawlerDouyinMusicTask();
+            crawlerDouyinMusicTask.setId(musicInfo.getExtId());
+            crawlerDouyinMusicTask.setStatus("error");
+            crawlerDouyinMusicTaskService.updateById(crawlerDouyinMusicTask);
             e.printStackTrace();
         }
     }
@@ -153,7 +157,7 @@ public class DouyinMusicServiceImpl implements DouyinMusicService {
                     for (int i = 0; i < size; i++){
                         CrawlerDouyinMusicTask crawlerDouyinMusicTask = crawlerDouyinMusicTaskService.getById(dataNode.get(i).asLong());
                         if(crawlerDouyinMusicTask == null){
-                            crawlerDouyinMusicTask = new CrawlerDouyinMusicTask(); 
+                            crawlerDouyinMusicTask = new CrawlerDouyinMusicTask();
                             crawlerDouyinMusicTask.setId(dataNode.get(i).asLong());
                             crawlerDouyinMusicTask.setStatus("init");
                             crawlerDouyinMusicTaskService.replaceInto(crawlerDouyinMusicTask);
@@ -162,6 +166,10 @@ public class DouyinMusicServiceImpl implements DouyinMusicService {
                 }
             }
         } catch (IOException e) {
+            CrawlerDouyinMusicTask crawlerDouyinMusic = new CrawlerDouyinMusicTask();
+            crawlerDouyinMusic.setId(musicInfo.getExtId());
+            crawlerDouyinMusic.setStatus("error");
+            crawlerDouyinMusicTaskService.updateById(crawlerDouyinMusic);
             e.printStackTrace();
         }
         return musicInfo;
@@ -169,7 +177,7 @@ public class DouyinMusicServiceImpl implements DouyinMusicService {
     public static void main(String[] args){
         DouyinMusicServiceImpl douyinMusicService = new DouyinMusicServiceImpl();
         MusicInfo musicInfo = new MusicInfo();
-        musicInfo.setExtId(6705193173741733889L);
+        musicInfo.setExtId(12646L);
         douyinMusicService.getMusicInfo(musicInfo);
     }
 }

+ 1 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoJhsbybtServiceImpl.java

@@ -58,7 +58,7 @@ public class TaobaoJhsbybtServiceImpl implements TaobaoJhsbybtService {
 
     public static void main(String[] args) {
         try {
-            PrintStream out = new PrintStream("D:/bybt0916.csv");
+            PrintStream out = new PrintStream("D:/bybt0929.csv");
             System.setOut(out);
         } catch (FileNotFoundException e) {
             e.printStackTrace();

+ 1 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoTttmServiceImpl.java

@@ -57,7 +57,7 @@ public class TaobaoTttmServiceImpl implements TaobaoTttmService {
 
     public static void main(String[] args) {
         try {
-            PrintStream out = new PrintStream("D:/tttm0831.csv");
+            PrintStream out = new PrintStream("D:/tttm0903.csv");
             System.setOut(out);
         } catch (FileNotFoundException e) {
             e.printStackTrace();

+ 0 - 1
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ByteDanceCleanMaterialJob.java

@@ -1,7 +1,6 @@
 package cn.com.ctop.job.bytedance.handler;
 
 import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.toutiao.modules.report.service.IByteDanceCleanMaterialReportService;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.core.log.XxlJobLogger;

+ 0 - 5
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceDailyMaterialReportRetryJob.java

@@ -2,21 +2,16 @@ package cn.com.ctop.job.bytedance.handler;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
 import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
-import cn.com.ctop.toutiao.modules.report.service.IReportService;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.core.log.XxlJobLogger;
 import org.jeecg.common.util.DateUtils;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.Date;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;

+ 0 - 3
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceDailyPlayableReportRetryJob.java

@@ -2,11 +2,8 @@ package cn.com.ctop.job.bytedance.handler;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportPlayableRetry;
-import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceInterfaceService;
-import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.core.log.XxlJobLogger;

+ 0 - 1
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouCleanMaterialJob.java

@@ -1,7 +1,6 @@
 package cn.com.ctop.job.kuaishou.handler;
 
 import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouCleanMaterialReportService;
 import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.core.log.XxlJobLogger;

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouDailyReportTaskServiceImpl.java

@@ -154,7 +154,7 @@ public class KuaiShouDailyReportTaskServiceImpl extends ServiceImpl<KuaiShouDail
 
                     };
                     thread.start();
-
+                }else if(task.getViewType() == 7){
 
                 }
             }

+ 17 - 11
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java

@@ -12,10 +12,7 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskServ
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterialVo;
 import cn.com.ctop.kuaishou.modules.report.entity.VideoGetvo;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCampaignMapper;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeMapper;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyGroupMapper;
+import cn.com.ctop.kuaishou.modules.report.mapper.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -159,6 +156,7 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
     public void getTaskList() {
         log.info("开始历史数据文件检查下载");
         QueryWrapper<KuaiShouHistoryReportTask> taskQueryWrapper = new QueryWrapper<>();
+        taskQueryWrapper.eq("view_type",7);
         taskQueryWrapper.eq("task_status", 0);
         taskQueryWrapper.orderByDesc("create_time");
         List<KuaiShouHistoryReportTask> taskList = this.list(taskQueryWrapper);
@@ -251,6 +249,9 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
 
                     };
                     thread.start();
+                }else if (task.getViewType() == 7){
+                    //封面报表
+                    kuaishouReportDailyImageMapper.loadImageDailyReport(task.getAccountId(),localPath);
                 }
 
 
@@ -265,27 +266,32 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
 
     }
 
+    @Autowired
+    private KuaishouReportDailyImageMapper kuaishouReportDailyImageMapper;
+
 
     private void getHistoryTypeList() {
 
         historyTypeList = new ArrayList<>();
-        historyTypeList.add(5);
+       /* historyTypeList.add(5);
         historyTypeList.add(1);
         historyTypeList.add(2);
         historyTypeList.add(3);
         historyTypeList.add(10);
-        historyTypeList.add(4);
+        historyTypeList.add(4);*/
+        historyTypeList.add(7);
 
 
     }
 
     private void getDailyTypeList() {
         dailyTypeList = new ArrayList<>();
-        dailyTypeList.add(2);
-        dailyTypeList.add(3);
-        dailyTypeList.add(4);
-        dailyTypeList.add(5);
-        dailyTypeList.add(10);
+//        dailyTypeList.add(2);
+//        dailyTypeList.add(3);
+//        dailyTypeList.add(4);
+//        dailyTypeList.add(5);
+//        dailyTypeList.add(10);
+        historyTypeList.add(7);
     }
 
 

+ 126 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java

@@ -0,0 +1,126 @@
+package cn.com.ctop.kuaishou.modules.report.controller;
+
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.kuaishou.modules.report.service.IKsVideoReportService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.AccountReportConstants;
+import org.jeecg.common.util.JsonResourceUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by JQ.bi on 2020.09.27
+ */
+@Slf4j
+@RestController
+@RequestMapping("/ctop/kuaishou/videoReport")
+public class KsVideoReportCtrl {
+
+    @Autowired
+    IKsVideoReportService ksVideoReportService;
+
+    @PostMapping("/list")
+    public Result<PageInfo<JSONObject>> getListReport(@RequestBody JSONObject requestBody) {
+
+        Result<PageInfo<JSONObject>> result = new Result<>();
+        if (requestBody.isEmpty()) {
+            log.error("request body is empty");
+            result.setSuccess(false);
+        } else {
+            JSONArray accountIds = requestBody.getJSONArray("accountIds");
+            String startDate = requestBody.getString("startDate");
+            String endDate = requestBody.getString("endDate");
+            String target = requestBody.getString("target");
+            String order = requestBody.getString("order");
+            int pageSize= requestBody.getInteger("pageSize");
+            int pageNo= requestBody.getInteger("pageNo");
+
+            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapKs);
+
+            try {
+                if(accountIds.isEmpty()){
+                    accountIds=null;
+                }
+                PageInfo<JSONObject> listData = ksVideoReportService.getVideoReportBy(accountIds, startDate, endDate, filedAll, target, order,pageSize,pageNo);
+                result.setResult(listData);
+                result.setSuccess(true);
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                result.setSuccess(false);
+            }
+        }
+        return result;
+    }
+
+    @PostMapping("/report/excel")
+    public void getExcelReport(@RequestBody JSONObject requestBody,
+                               HttpServletRequest request,
+                               HttpServletResponse response) {
+        JSONArray columns=requestBody.getJSONArray("columns");
+        if(columns.isEmpty()){
+            log.error("请选择需要导出的字段");
+        }
+        String filed= JsonResourceUtil.joinFiled(AccountReportConstants.dicMapKs,columns);
+        List<String> titles= new ArrayList<>();
+        titles.add("视频");
+        titles.add("视频名称");
+        titles.add("项目名称");
+        titles.add("上传时间");
+        titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapKs,columns));
+        //此处增加两个元素是为了保证数据顺序
+        columns.add(0,"url");
+        columns.add(1,"materialName");
+        columns.add(2,"projectName");
+        columns.add(3,"createTime");
+        JSONArray accountIds = requestBody.getJSONArray("accountIds");
+        if(accountIds.isEmpty()){
+            accountIds=null;
+        }
+        String startDate = requestBody.getString("startDate");
+        String endDate = requestBody.getString("endDate");
+        String target = requestBody.getString("target");
+        String order = requestBody.getString("order");
+        List<JSONObject> excelData= ksVideoReportService.exportExcelReportBy(accountIds,startDate,endDate,filed,target,order);
+        if(excelData.isEmpty()){
+            return;
+        }
+        List<List<Object>> excelList= new ArrayList<>();
+        excelData.forEach(data->{
+            List<Object> temp= new ArrayList<>();
+            columns.forEach(k->{
+                temp.add(data.get(k.toString()));
+            });
+            excelList.add(temp);
+        });
+        try{
+            String[] headers = titles.toArray(new String[titles.size()]);
+            OutputStream os = response.getOutputStream();
+            ExportExcelUtils eeu = new ExportExcelUtils();
+            XSSFWorkbook workbook = new XSSFWorkbook();
+            eeu.exportExcel(workbook, 0, "快手视频报表", headers, excelList);
+            HttpUtils.setResponseHeader(response, "快手视频报表.xlsx");
+            workbook.write(os);
+            os.flush();
+            os.close();
+        }catch (IOException e){
+            log.error(e.getMessage());
+        }
+    }
+
+}

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouCleanMaterialReportController.java

@@ -1,8 +1,8 @@
 package cn.com.ctop.kuaishou.modules.report.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouCleanMaterialReportService;
+import cn.com.ctop.common.module.entity.KuaiShouCleanMaterialReport;
+import cn.com.ctop.common.module.service.IKuaiShouCleanMaterialReportService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

+ 290 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyImage.java

@@ -0,0 +1,290 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+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 org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 快手图片报表
+ * @author jeecg-boot
+ * @date   2020-09-28
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_kuaishou_report_daily_image")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_kuaishou_report_daily_image对象", description="快手图片报表")
+public class KuaishouReportDailyImage {
+
+	/**id*/
+	@TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+	private Integer id;
+	/**账户ID*/
+	@Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+	private Integer coverId;
+	/**计划ID*/
+	@Excel(name = "计划ID", width = 15)
+    @ApiModelProperty(value = "计划ID")
+	private Integer photoId;
+	/**channelType*/
+	@Excel(name = "channelType", width = 15)
+    @ApiModelProperty(value = "channelType")
+	private Integer channelType;
+	/**signature*/
+	@Excel(name = "signature", width = 15)
+    @ApiModelProperty(value = "signature")
+	private String signature;
+	/**封面token*/
+	@Excel(name = "封面token", width = 15)
+    @ApiModelProperty(value = "封面token")
+	private String imageToken;
+	/**封面url*/
+	@Excel(name = "封面url", width = 15)
+    @ApiModelProperty(value = "封面url")
+	private String coverUrl;
+	/**视频uel*/
+	@Excel(name = "视频uel", width = 15)
+    @ApiModelProperty(value = "视频uel")
+	private String photoUrl;
+	/**素材类型*/
+	@Excel(name = "素材类型", width = 15)
+    @ApiModelProperty(value = "素材类型")
+	private String creativeMaterialTypeString;
+	/**场景*/
+	@Excel(name = "场景", width = 15)
+    @ApiModelProperty(value = "场景")
+	private String adScene;
+	/**花费(元)*/
+	@Excel(name = "花费(元)", width = 15)
+    @ApiModelProperty(value = "花费(元)")
+	private java.math.BigDecimal charge;
+	/**曝光数*/
+	@Excel(name = "曝光数", width = 15)
+    @ApiModelProperty(value = "曝光数")
+	private Integer photoShow;
+	/**素材曝光数*/
+	@Excel(name = "素材曝光数", width = 15)
+    @ApiModelProperty(value = "素材曝光数")
+	private Integer aclick;
+	/**行为数*/
+	@Excel(name = "行为数", width = 15)
+    @ApiModelProperty(value = "行为数")
+	private Integer bclick;
+	/**分享数*/
+	@Excel(name = "分享数", width = 15)
+    @ApiModelProperty(value = "分享数")
+	private Integer photoShare;
+	/**评论数*/
+	@Excel(name = "评论数", width = 15)
+    @ApiModelProperty(value = "评论数")
+	private Integer photoComment;
+	/**点赞数*/
+	@Excel(name = "点赞数", width = 15)
+    @ApiModelProperty(value = "点赞数")
+	private Integer photoLike;
+	/**新增关注数*/
+	@Excel(name = "新增关注数", width = 15)
+    @ApiModelProperty(value = "新增关注数")
+	private Integer follow;
+	/**取消关注数*/
+	@Excel(name = "取消关注数", width = 15)
+    @ApiModelProperty(value = "取消关注数")
+	private Integer cancelFollow;
+	/**举报数*/
+	@Excel(name = "举报数", width = 15)
+    @ApiModelProperty(value = "举报数")
+	private Integer report;
+	/**拉黑数*/
+	@Excel(name = "拉黑数", width = 15)
+    @ApiModelProperty(value = "拉黑数")
+	private Integer block;
+	/**减少此类作品数*/
+	@Excel(name = "减少此类作品数", width = 15)
+    @ApiModelProperty(value = "减少此类作品数")
+	private Integer negative;
+	/**应用下载数据-安卓下载开始数*/
+	@Excel(name = "应用下载数据-安卓下载开始数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-安卓下载开始数")
+	private Integer downloadStarted;
+	/**应用下载数据-安卓下载完成数*/
+	@Excel(name = "应用下载数据-安卓下载完成数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-安卓下载完成数")
+	private Integer downloadCompleted;
+	/**应用下载数据-激活数*/
+	@Excel(name = "应用下载数据-激活数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-激活数")
+	private Integer activation;
+	/**提交按钮点击数*/
+	@Excel(name = "提交按钮点击数", width = 15)
+    @ApiModelProperty(value = "提交按钮点击数")
+	private Integer submit;
+	/**日期*/
+	@Excel(name = "日期", width = 15)
+    @ApiModelProperty(value = "日期")
+	private String statDate;
+	/**封面点击数*/
+	@Excel(name = "封面点击数", width = 15)
+    @ApiModelProperty(value = "封面点击数")
+	private Integer photoClick;
+	/**封面点击率*/
+	@Excel(name = "封面点击率", width = 15)
+    @ApiModelProperty(value = "封面点击率")
+	private Double photoClickRatio;
+	/**行为率*/
+	@Excel(name = "行为率", width = 15)
+    @ApiModelProperty(value = "行为率")
+	private Double actionRatio;
+	/**平均千次曝光花费(元)*/
+	@Excel(name = "平均千次曝光花费(元)", width = 15)
+    @ApiModelProperty(value = "平均千次曝光花费(元)")
+	private java.math.BigDecimal impression1kCost;
+	/**平均点击单价(元)*/
+	@Excel(name = "平均点击单价(元)", width = 15)
+    @ApiModelProperty(value = "平均点击单价(元)")
+	private java.math.BigDecimal photoClickCost;
+	/**平均行为单价(元)*/
+	@Excel(name = "平均行为单价(元)", width = 15)
+    @ApiModelProperty(value = "平均行为单价(元)")
+	private java.math.BigDecimal actionCost;
+	/**应用下载数据-首日付费次数*/
+	@Excel(name = "应用下载数据-首日付费次数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-首日付费次数")
+	private Integer eventPayFirstDay;
+	/**应用下载数据-首日付费金额*/
+	@Excel(name = "应用下载数据-首日付费金额", width = 15)
+    @ApiModelProperty(value = "应用下载数据-首日付费金额")
+	private java.math.BigDecimal eventPayPurchaseAmountFirstDay;
+	/**应用下载数据-首日ROI*/
+	@Excel(name = "应用下载数据-首日ROI", width = 15)
+    @ApiModelProperty(value = "应用下载数据-首日ROI")
+	private Double eventPayFirstDayRoi;
+	/**应用下载数据-付费次数*/
+	@Excel(name = "应用下载数据-付费次数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付费次数")
+	private Integer eventPay;
+	/**应用下载数据-付费金额*/
+	@Excel(name = "应用下载数据-付费金额", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付费金额")
+	private java.math.BigDecimal eventPayPurchaseAmount;
+	/**应用下载数据-ROI*/
+	@Excel(name = "应用下载数据-ROI", width = 15)
+    @ApiModelProperty(value = "应用下载数据-ROI")
+	private Double eventPayRoi;
+	/**应用下载数据-注册数*/
+	@Excel(name = "应用下载数据-注册数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-注册数")
+	private Integer eventRegister;
+	/**应用下载数据-注册成本*/
+	@Excel(name = "应用下载数据-注册成本", width = 15)
+    @ApiModelProperty(value = "应用下载数据-注册成本")
+	private java.math.BigDecimal eventRegisterCost;
+	/**应用下载数据-注册率*/
+	@Excel(name = "应用下载数据-注册率", width = 15)
+    @ApiModelProperty(value = "应用下载数据-注册率")
+	private Double eventRegisterRatio;
+	/**应用下载数据-完件数*/
+	@Excel(name = "应用下载数据-完件数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-完件数")
+	private Integer eventJinJianApp;
+	/**应用下载数据-完件成本*/
+	@Excel(name = "应用下载数据-完件成本", width = 15)
+    @ApiModelProperty(value = "应用下载数据-完件成本")
+	private java.math.BigDecimal eventJinJianAppCost;
+	/**应用下载数据-授信数*/
+	@Excel(name = "应用下载数据-授信数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-授信数")
+	private Integer eventCreditGrantApp;
+	/**应用下载数据-授信成本*/
+	@Excel(name = "应用下载数据-授信成本", width = 15)
+    @ApiModelProperty(value = "应用下载数据-授信成本")
+	private java.math.BigDecimal eventCreditGrantAppCost;
+	/**应用下载数据-授信率*/
+	@Excel(name = "应用下载数据-授信率", width = 15)
+    @ApiModelProperty(value = "应用下载数据-授信率")
+	private Double eventCreditGrantAppRatio;
+	/**应用下载数据-付款成功数*/
+	@Excel(name = "应用下载数据-付款成功数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付款成功数")
+	private Integer eventOrderPaid;
+	/**应用下载数据-付款成功金额*/
+	@Excel(name = "应用下载数据-付款成功金额", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付款成功金额")
+	private java.math.BigDecimal eventOrderPaidPurchaseAmount;
+	/**落地页数据-落地页完件数*/
+	@Excel(name = "落地页数据-落地页完件数", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页完件数")
+	private Integer eventJinJianLandingPage;
+	/**落地页数据-落地页完件成本*/
+	@Excel(name = "落地页数据-落地页完件成本", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页完件成本")
+	private java.math.BigDecimal eventJinJianLandingPageCost;
+	/**落地页数据-落地页授信数*/
+	@Excel(name = "落地页数据-落地页授信数", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页授信数")
+	private Integer eventCreditGrantLandingPage;
+	/**落地页数据-落地页授信成本*/
+	@Excel(name = "落地页数据-落地页授信成本", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页授信成本")
+	private java.math.BigDecimal eventCreditGrantLandingPageCost;
+	/**落地页数据-落地页授信率*/
+	@Excel(name = "落地页数据-落地页授信率", width = 15)
+    @ApiModelProperty(value = "落地页数据-落地页授信率")
+	private Double eventCreditGrantLandingRatio;
+	/**应用下载数据-次留成本(仅支持分日查询)*/
+	@Excel(name = "应用下载数据-次留成本(仅支持分日查询)", width = 15)
+    @ApiModelProperty(value = "应用下载数据-次留成本(仅支持分日查询)")
+	private java.math.BigDecimal eventNextDayStayCost;
+	/**应用下载数据-次留率(仅支持分日查询)*/
+	@Excel(name = "应用下载数据-次留率(仅支持分日查询)", width = 15)
+    @ApiModelProperty(value = "应用下载数据-次留率(仅支持分日查询)")
+	private Integer eventNextDayStayRatio;
+	/**落地页数据-表单提交点击率*/
+	@Excel(name = "落地页数据-表单提交点击率", width = 15)
+    @ApiModelProperty(value = "落地页数据-表单提交点击率")
+	private Double formActionRatio;
+	/**应用下载数据-单次付款成本*/
+	@Excel(name = "应用下载数据-单次付款成本", width = 15)
+    @ApiModelProperty(value = "应用下载数据-单次付款成本")
+	private java.math.BigDecimal eventOrderPaidCost;
+	/**应用下载数据-次留数(仅支持分日查询)*/
+	@Excel(name = "应用下载数据-次留数(仅支持分日查询)", width = 15)
+    @ApiModelProperty(value = "应用下载数据-次留数(仅支持分日查询)")
+	private Integer eventNextDayStay;
+	/**落地页数据-表单提交单价*/
+	@Excel(name = "落地页数据-表单提交单价", width = 15)
+    @ApiModelProperty(value = "落地页数据-表单提交单价")
+	private java.math.BigDecimal formCost;
+	/**落地页数据-表单提交数*/
+	@Excel(name = "落地页数据-表单提交数", width = 15)
+    @ApiModelProperty(value = "落地页数据-表单提交数")
+	private Integer formCount;
+	/**3s播放率*/
+	@Excel(name = "3s播放率", width = 15)
+    @ApiModelProperty(value = "3s播放率")
+	private Double play3sRatio;
+	/**创建时间*/
+	@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**修改时间*/
+	@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+	private Date updateTime;
+}

+ 13 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KsVideoReportMapper.java

@@ -0,0 +1,13 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface KsVideoReportMapper {
+
+    List<JSONObject> queryVideoReportBy(@Param("accountIds") JSONArray accountIds, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("filed") String filed, @Param("target") String target, @Param("order") String order);
+
+}

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyCreativeMapper.java

@@ -1,6 +1,6 @@
 package cn.com.ctop.kuaishou.modules.report.mapper;
 
-import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
+import cn.com.ctop.common.module.entity.KuaiShouCleanMaterialReport;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;

+ 15 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyImageMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyImage;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 快手图片报表
+ * @author: jeecg-boot
+ * @date:   2020-09-28
+ * @cersion: V1.0
+ */
+public interface KuaishouReportDailyImageMapper extends BaseMapper<KuaishouReportDailyImage> {
+
+    void loadImageDailyReport(Long accountId, String localPath);
+}

+ 39 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml

@@ -0,0 +1,39 @@
+<?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.kuaishou.modules.report.mapper.KsVideoReportMapper">
+
+    <select id="queryVideoReportBy" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.signature,
+        t2.url,
+        t2.cover_url AS coverUrl,
+        t2.material_name materialName,
+        (
+        SELECT
+        project_name
+        FROM
+        ctop_project t4
+        WHERE
+        t4.id = t3.project_id
+        ) AS projectName,
+        t2.create_time AS createTime,
+        ${filed}
+        FROM
+        ctop_kuaishou_report_daily_material t1
+        LEFT JOIN ctop_material_info t2 ON t1.signature = t2. CODE
+        LEFT JOIN ctop_user_allocation t3 ON t3.account_id=t1.account_id
+        WHERE
+        t1.stat_date >= #{startDate}
+        AND t1.stat_date &lt;= #{endDate}
+        <if test="accountIds != null">
+        AND t1.account_id in
+        <foreach item="item" index="index" collection="accountIds"
+                 open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        </if>
+        AND t2.url!=""
+        GROUP BY t1.signature
+        ORDER BY ${target} ${order}
+    </select>
+</mapper>

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyCreativeMapper.xml

@@ -266,7 +266,7 @@
     </select>
 
     <select id="calculationMaterialReport"
-            resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport">
+            resultType="cn.com.ctop.common.module.entity.KuaiShouCleanMaterialReport">
         select
         signature id,
         sum(charge) charge,

+ 106 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyImageMapper.xml

@@ -0,0 +1,106 @@
+<?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.kuaishou.modules.report.mapper.KuaishouReportDailyImageMapper">
+
+    <insert id="loadImageDailyReport">
+        LOAD DATA local INFILE  #{localPath}
+	    REPLACE INTO TABLE ctop_kuaishou_report_daily_image CHARACTER SET utf8mb4
+		FIELDS TERMINATED BY ',' enclosed by '"' LINES TERMINATED BY '\n'
+		IGNORE 1 LINES
+		(cover_id,
+		image_token,
+		cover_url,
+		@ad_scene,
+        charge,
+        photo_show,
+        aclick,
+        bclick,
+        photo_share,
+        photo_comment,
+        photo_like,
+        follow,
+        cancel_follow,
+        report,
+        block,
+        negative,
+        download_started,
+        download_completed,
+        activation,
+        submit,
+        stat_date,
+        @stat_hour,
+        photo_click,
+        photo_click_ratio,
+        action_ratio,
+        impression_1k_cost,
+        photo_click_cost,
+        @click_1k_cost,
+        action_cost,
+        event_pay_first_day,
+        event_pay_purchase_amount_first_day,
+        event_pay_first_day_roi,
+        event_pay,
+        event_pay_purchase_amount,
+        event_pay_roi,
+        event_register,
+        event_register_cost,
+        event_register_ratio,
+        event_jin_jian_app,
+        event_jin_jian_app_cost,
+        event_credit_grant_app,
+        event_credit_grant_app_cost,
+        event_credit_grant_app_ratio,
+        event_order_paid,
+        event_order_paid_purchase_amount,
+        event_order_paid_cost,
+        form_count,
+        form_cost,
+        form_action_ratio,
+        event_jin_jian_landing_page,
+        event_jin_jian_landing_page_cost,
+        event_credit_grant_landing_page,
+        event_credit_grant_landing_page_cost,
+        event_credit_grant_landing_ratio,
+        event_next_day_stay_cost,
+        event_next_day_stay_ratio,
+        event_next_day_stay,
+        play_3s_ratio,
+        @event_valid_clues,
+        @event_valid_clues_cost,
+        @ad_product_cnt,
+        @event_goods_view,
+        @merchant_reco_fans,
+        @event_order_amount_roi,
+        @event_goods_view_cost,
+        @merchant_reco_fans_cost,
+        @event_new_user_pay,
+        @event_new_user_pay_cost,
+        @event_new_user_pay_ratio,
+        @event_button_click,
+        @event_button_click_cost,
+        @event_button_click_ratio,
+        @play_5s_ratio,
+        @play_end_ratio,
+        @event_order_paid_roi,
+        @event_new_user_jinjian_app,
+        @event_new_user_jinjian_app_cost,
+        @event_new_user_jinjian_app_roi,
+        @event_new_user_credit_grant_app,
+        @event_new_user_credit_grant_app_cost,
+        @event_new_user_credit_grant_app_roi,
+        @event_new_user_jinjian_page,
+        @event_new_user_jinjian_page_cost,
+        @event_new_user_jinjian_page_roi,
+        @event_new_user_credit_grant_page,
+        @event_new_user_credit_grant_page_cost,
+        @event_new_user_credit_grant_page_roi,
+        @event_appoint_form,
+        @event_appoint_form_cost,
+        @event_appoint_form_ratio,
+        @event_appoint_jump_click,
+        @event_appoint_jump_click_cost,
+        @event_appoint_jump_click_ratio
+        )
+          set account_id = #{accountId}
+    </insert>
+</mapper>

+ 14 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKsVideoReportService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
+
+import java.util.List;
+
+public interface IKsVideoReportService {
+
+    PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order, int pageSize, int pageNo);
+
+    List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order);
+}

+ 0 - 29
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaiShouCleanMaterialReportService.java

@@ -1,29 +0,0 @@
-package cn.com.ctop.kuaishou.modules.report.service;
-
-import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-import java.util.List;
-
-/**
- * 快手素材清洗数据
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-02-24
- */
-public interface IKuaiShouCleanMaterialReportService extends IService<KuaiShouCleanMaterialReport> {
-    /**
-     * 快手 唯一素材MD5标识
-     *
-     * @return
-     */
-    List<String> getSignature();
-
-    /**
-     * 计算快手素材报表
-     *
-     * @param signature
-     */
-    void calculationReport(String signature);
-}

+ 10 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyCreativeService.java

@@ -3,5 +3,15 @@ package cn.com.ctop.kuaishou.modules.report.service;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 public interface IKuaishouReportDailyCreativeService extends IService<KuaishouReportDailyCreative> {
+    List<String> getSignature();
+
+    /**
+     * 计算快手素材报表
+     *
+     * @param signature
+     */
+    void calculationReport(String signature);
 }

+ 14 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyImageService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyImage;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 快手图片报表
+ * @Author: jeecg-boot
+ * @Date:   2020-09-28
+ * @Version: V1.0
+ */
+public interface IKuaishouReportDailyImageService extends IService<KuaishouReportDailyImage> {
+
+}

+ 32 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KsVideoReportServiceImpl.java

@@ -0,0 +1,32 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.kuaishou.modules.report.service.IKsVideoReportService;
+import cn.com.ctop.kuaishou.modules.report.mapper.KsVideoReportMapper;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class KsVideoReportServiceImpl implements IKsVideoReportService {
+
+    @Autowired
+    KsVideoReportMapper ksVideoReportMapper;
+
+    @Override
+    public PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order,int pageSize,int pageNo) {
+        PageHelper.startPage(pageNo,pageSize);
+        List<JSONObject> jsonObjectList=ksVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order);
+        return new PageInfo<>(jsonObjectList);
+    }
+
+    @Override
+    public List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order) {
+        return ksVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order);
+    }
+
+}

+ 0 - 41
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaiShouCleanMaterialReportServiceImpl.java

@@ -1,41 +0,0 @@
-package cn.com.ctop.kuaishou.modules.report.service.impl;
-
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouCleanMaterialReportMapper;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeMapper;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouCleanMaterialReportService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * 快手素材清洗数据
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-02-24
- */
-@Service
-public class KuaiShouCleanMaterialReportServiceImpl extends ServiceImpl<KuaiShouCleanMaterialReportMapper, KuaiShouCleanMaterialReport> implements IKuaiShouCleanMaterialReportService {
-    @Autowired
-    private KuaishouReportDailyCreativeMapper kuaishouReportDailyCreativeMapper;
-
-    @Override
-    public List<String> getSignature() {
-        return kuaishouReportDailyCreativeMapper.getSignatureList();
-    }
-
-    @Override
-    public void calculationReport(String signature) {
-        if (Check.isNull(signature)) {
-            return;
-        }
-        KuaiShouCleanMaterialReport calculationMaterialReport = kuaishouReportDailyCreativeMapper.calculationMaterialReport(signature);
-        if (!Check.isNull(calculationMaterialReport)) {
-            this.saveOrUpdate(calculationMaterialReport);
-        }
-    }
-}

+ 27 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyCreativeServiceImpl.java

@@ -1,11 +1,38 @@
 package cn.com.ctop.kuaishou.modules.report.service.impl;
 
+import cn.com.ctop.common.module.entity.KuaiShouCleanMaterialReport;
+import cn.com.ctop.common.module.service.IKuaiShouCleanMaterialReportService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCreativeService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
 public class KuaishouReportDailyCreativeServiceImpl extends ServiceImpl<KuaishouReportDailyCreativeMapper, KuaishouReportDailyCreative> implements IKuaishouReportDailyCreativeService {
+    @Autowired
+    private KuaishouReportDailyCreativeMapper kuaishouReportDailyCreativeMapper;
+    @Autowired
+    private IKuaiShouCleanMaterialReportService cleanMaterialReportService;
+
+    @Override
+    public List<String> getSignature() {
+        return kuaishouReportDailyCreativeMapper.getSignatureList();
+    }
+
+    @Override
+    public void calculationReport(String signature) {
+        if (Check.isNull(signature)) {
+            return;
+        }
+        KuaiShouCleanMaterialReport calculationMaterialReport = kuaishouReportDailyCreativeMapper.calculationMaterialReport(signature);
+        if (!Check.isNull(calculationMaterialReport)) {
+            cleanMaterialReportService.saveOrUpdate(calculationMaterialReport);
+        }
+    }
+
 }

+ 18 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyImageServiceImpl.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyImage;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyImageMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyImageService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 快手图片报表
+ * @author jeecg-boot
+ * @date   2020-09-28
+ * @version V1.0
+ */
+@Service
+public class KuaishouReportDailyImageServiceImpl extends ServiceImpl<KuaishouReportDailyImageMapper, KuaishouReportDailyImage> implements IKuaishouReportDailyImageService {
+
+}

+ 15 - 3
module-kuaishou/src/main/resources/json_template/kuaishou_filed_mapping.json

@@ -148,8 +148,20 @@
     "comment": "表单提交率"
   },
   "formCountCost": {
-    "filed": "CASE WHEN sum(t1.charge) / sum(t1.form_count) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.form_count),3) end as eventCreditGrantAppCost ",
-    "comment": "授信成本"
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.form_count) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.form_count),3) end as formCountCost ",
+    "comment": "表单提交成本"
+  },
+  "nextDayOpen": {
+    "filed": "sum(t1.event_next_day_stay) as nextDayOpen ",
+    "comment": "次留数"
+  },
+  "nextDayOpenCost": {
+    "filed": "CASE WHEN sum(t1.charge) / sum(t1.event_next_day_stay) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.event_next_day_stay),3) end as nextDayOpenCost ",
+    "comment": "次留成本"
+  },
+  "nextDayOpenRate": {
+    "filed": "CASE WHEN sum(t1.event_next_day_stay) / sum(t1.bclick) IS NULL THEN 0 ELSE concat(round(sum(t1.event_next_day_stay) / sum(t1.bclick)*100,2),'%') end as nextDayOpenRate ",
+    "comment": "次留率"
   },
   "eventJinJianLandingPage": {
     "filed": "sum(t1.event_jin_jian_landing_page) as eventJinJianLandingPage ",
@@ -168,7 +180,7 @@
     "comment": "落地页授信成本"
   },
   "eventCreditGrantLandingPageRate": {
-    "filed": "CASE WHEN sum(t1.event_credit_grant_landing_page) / sum(t1.event_jin_jian_landing_page) IS NULL THEN 0 ELSE concat(round(sum(t1.event_credit_grant_landing_page) / sum(t1.event_jin_jian_landing_page)*100,2),'%') end as formCountRate ",
+    "filed": "CASE WHEN sum(t1.event_credit_grant_landing_page) / sum(t1.event_jin_jian_landing_page) IS NULL THEN 0 ELSE concat(round(sum(t1.event_credit_grant_landing_page) / sum(t1.event_jin_jian_landing_page)*100,2),'%') end as eventCreditGrantLandingPageRate ",
     "comment": "落地页授信率"
   },
   "submit": {

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/adlab/controller/CtopAdlabProjectDetailController.java

@@ -61,8 +61,8 @@ public class CtopAdlabProjectDetailController {
             queryWrapper.eq("opt_status", requestBody.getString("optStatus"));
         }
         if (!requestBody.getJSONArray("createTime").isEmpty()) {
-            queryWrapper.ge("create_time", requestBody.getJSONArray("createTime").get(0).toString());
-            queryWrapper.le("create_time", requestBody.getJSONArray("createTime").get(1).toString());
+            queryWrapper.ge("create_time", requestBody.getJSONArray("createTime").get(0));
+            queryWrapper.le("create_time", requestBody.getJSONArray("createTime").get(1));
         }
         Page<CtopAdlabProjectDetail> page = new Page<>(pageNo, pageSize);
         IPage<CtopAdlabProjectDetail> pageList = ctopAdlabProjectDetailService.page(page, queryWrapper);

+ 2 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/adlab/entity/CtopAdlabProjectDetail.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.toutiao.modules.adlab.entity;
 
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -21,6 +22,7 @@ public class CtopAdlabProjectDetail {
 	/**userId*/
 	private String userId;
 	/**accountId*/
+	@Dict(dicCode = "account_id",dictTable="ctop_user_allocation",dicText="auth_name")
 	private Long accountId;
 	/**campaignId*/
 	private Long campaignId;

+ 0 - 23
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IBytedanceCleanMaterialService.java

@@ -1,23 +0,0 @@
-package cn.com.ctop.toutiao.modules.material.service;
-
-import java.util.List;
-
-/**
- * @author 宋英豪
- * @date 2020年5月9日09:52:48
- */
-public interface IBytedanceCleanMaterialService {
-    /**
-     * 头条 唯一素材MD5标识
-     *
-     * @return
-     */
-    List<String> getSignature();
-
-    /**
-     * 计算头条素材报表
-     *
-     * @param signature
-     */
-    void calculationMaterialReport(String signature);
-}

+ 0 - 46
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceCleanMaterialServiceImpl.java

@@ -1,46 +0,0 @@
-package cn.com.ctop.toutiao.modules.material.service.impl;
-
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.toutiao.modules.material.service.IBytedanceCleanMaterialService;
-import cn.com.ctop.toutiao.modules.report.entity.ByteDanceCleanMaterialReport;
-import cn.com.ctop.toutiao.modules.report.mapper.BytedanceCreativeDailyReportMapper;
-import cn.com.ctop.toutiao.modules.report.service.IByteDanceCleanMaterialReportService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Primary;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-@Service
-public class BytedanceCleanMaterialServiceImpl implements IBytedanceCleanMaterialService {
-    @Autowired
-    private BytedanceCreativeDailyReportMapper bytedanceCreativeDailyReportMapper;
-    @Autowired
-    private IByteDanceCleanMaterialReportService byteDanceCleanMaterialReportService;
-
-    /**
-     * MD5 集合
-     *
-     * @return
-     */
-    @Override
-    public List<String> getSignature() {
-        return bytedanceCreativeDailyReportMapper.getSignatureList();
-    }
-
-    /**
-     * 头条素材报表
-     *
-     * @param signature
-     */
-    @Override
-    public void calculationMaterialReport(String signature) {
-        if (Check.isNull(signature)) {
-            return;
-        }
-        ByteDanceCleanMaterialReport calculationMaterialReport = bytedanceCreativeDailyReportMapper.calculationMaterialReport(signature);
-        if (!Check.isNull(calculationMaterialReport)) {
-            byteDanceCleanMaterialReportService.saveOrUpdate(calculationMaterialReport);
-        }
-    }
-}

+ 2 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/DTO/ImageCostVO.java

@@ -15,4 +15,6 @@ public class ImageCostVO implements Serializable {
     private Long click;
     private Long showNum;
     private Long convert;
+    private String userId;
+    private String userName;
 }

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/ByteDanceCleanMaterialReportController.java

@@ -1,9 +1,9 @@
 package cn.com.ctop.toutiao.modules.report.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.entity.ByteDanceCleanMaterialReport;
+import cn.com.ctop.common.module.service.IByteDanceCleanMaterialReportService;
 import cn.com.ctop.common.module.utils.StringUtils;
-import cn.com.ctop.toutiao.modules.report.entity.ByteDanceCleanMaterialReport;
-import cn.com.ctop.toutiao.modules.report.service.IByteDanceCleanMaterialReportService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

+ 9 - 9
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/ByteDanceVideoReportDailyController.java

@@ -46,8 +46,8 @@ public class ByteDanceVideoReportDailyController {
 	 @ApiOperation(value = "头条视频按天汇总", notes = "头条视频按天汇总")
 	 @PostMapping(value = "/bytedanceVideoInfoList")
 	 public Result bytedanceVideoInfoList(@RequestParam(name = "startDate") String startDate,
-										 @RequestParam(name = "endDate") String endDate,
-										 HttpServletRequest req){
+                                          @RequestParam(name = "endDate") String endDate,
+                                          HttpServletRequest req){
 		 Result result = new Result();
 		 int days = DateUtils.dateDiff(startDate, endDate);
 		 List<String> dateList = new ArrayList<>();
@@ -81,9 +81,9 @@ public class ByteDanceVideoReportDailyController {
 	@ApiOperation(value = "头条视频单个账户按天汇总", notes = "头条视频单个账户按天汇总")
 	@GetMapping(value = "/videoInfoListByAccountId")
 	public Result videoInfoListByAccountId(@RequestParam(name = "startDate") String startDate,
-										 @RequestParam(name = "endDate") String endDate,
-										   @RequestParam(name = "accountId") Long accountId,
-										 HttpServletRequest req){
+                                           @RequestParam(name = "endDate") String endDate,
+                                           @RequestParam(name = "accountId") Long accountId,
+                                           HttpServletRequest req){
 		Result result = new Result();
 		int days = DateUtils.dateDiff(startDate, endDate);
 		List<String> dateList = new ArrayList<>();
@@ -144,7 +144,7 @@ public class ByteDanceVideoReportDailyController {
 	 @ApiOperation(value = "头条视频按周汇总", notes = "头条视频按周汇总")
 	 @PostMapping(value = "/bytedanceVideoInfoListWeek")
 	 public Result<PageInfo<ByteDanceVideoReportDaily>> bytedanceVideoInfoListWeek(@RequestBody DateDTO dateDTO,
-																		   HttpServletRequest req){
+                                                                                   HttpServletRequest req){
 		 Result<PageInfo<ByteDanceVideoReportDaily>> result = new Result();
 
 		 Integer pageNo = dateDTO.getPageNo();
@@ -166,7 +166,7 @@ public class ByteDanceVideoReportDailyController {
 	 @ApiOperation(value = "头条视频汇总", notes = "头条视频汇总")
 	 @PostMapping(value = "/videoInfoListTotal")
 	 public Result<PageInfo<ByteDanceVideoReportDaily>> videoInfoListTotal(@RequestBody DateDTO dateDTO,
-																		HttpServletRequest req){
+                                                                           HttpServletRequest req){
 		 Result<PageInfo<ByteDanceVideoReportDaily>> result = new Result();
 		 Integer pageNo = dateDTO.getPageNo();
 		 Integer pageSize = dateDTO.getPageSize();
@@ -186,7 +186,7 @@ public class ByteDanceVideoReportDailyController {
 	 @ApiOperation(value = "头条视频按月汇总", notes = "头条视频按月汇总")
 	 @PostMapping(value = "/bytedanceVideoInfoListMonth")
 	 public Result<PageInfo<ByteDanceVideoReportDaily>> bytedanceVideoInfoListMonth(@RequestBody DateDTO dateDTO,
-																			   HttpServletRequest req){
+                                                                                    HttpServletRequest req){
 		 Result<PageInfo<ByteDanceVideoReportDaily>> result = new Result();
 
 		 if(StringUtils.isBlank(dateDTO.getSignature())){
@@ -210,7 +210,7 @@ public class ByteDanceVideoReportDailyController {
 	 @ApiOperation(value = "头条视频按天明细", notes = "头条视频按天明细")
 	 @PostMapping(value = "/bytedanceVideoInfoListDetail")
 	 public Result<List<ByteDanceVideoReportDaily>> bytedanceVideoInfoListDetail(@RequestBody DateDTO dateDTO,
-																		   HttpServletRequest req){
+                                                                                 HttpServletRequest req){
 		 Result<List<ByteDanceVideoReportDaily>> result = new Result();
 		 List<ByteDanceVideoReportDaily> list = videoReportDailyService.videoInfoListDetail(dateDTO.getStartDate(), dateDTO.getEndDate(), dateDTO.getSignature(), dateDTO.getAccountIds());
 		 result.setResult(list);

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceAccountReportCtrl.java

@@ -114,11 +114,11 @@ public class BytedanceAccountReportCtrl {
         if(columns.isEmpty()){
             log.error("请选择需要导出的字段");
         }
-        String filed= JsonResourceUtil.joinFiled(AccountReportConstants.dicMap,columns);
+        String filed= JsonResourceUtil.joinFiled(AccountReportConstants.dicMapBy,columns);
         List<String> titles= new ArrayList<>();
         titles.add("账户Id");
         titles.add("账户名称");
-        titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.dicMap,columns));
+        titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapBy,columns));
         //此处增加两个元素是为了保证数据有序
         columns.add(0,"accountId");
         columns.add(1,"authName");

+ 0 - 8
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceInterfaceController.java

@@ -2,10 +2,7 @@ package cn.com.ctop.toutiao.modules.report.controller;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportPlayableRetry;
-import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
-import cn.com.ctop.toutiao.modules.report.service.IBytedanceAccountReportService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceInterfaceService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
 import lombok.extern.slf4j.Slf4j;
@@ -35,8 +32,6 @@ public class BytedanceInterfaceController {
     @Autowired
     private ICtopOauthTokenService tokenService;
     @Autowired
-    private IByteDanceVideoReportDailyService byteDanceVideoReportDailyService;
-    @Autowired
     private IBytedanceInterfaceService bytedanceInterfaceService;
 
 
@@ -183,7 +178,4 @@ public class BytedanceInterfaceController {
         return result;
     }
 
-
-
-
 }

+ 88 - 13
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceVideoReportCtrl.java

@@ -1,20 +1,31 @@
 package cn.com.ctop.toutiao.modules.report.controller;
 
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceVideoReportService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.AccountReportConstants;
+import org.jeecg.common.util.JsonResourceUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
- *  Created by JQ.bi on 2020.09.21
+ * Created by JQ.bi on 2020.09.21
  */
 @Slf4j
 @RestController
@@ -25,27 +36,91 @@ public class BytedanceVideoReportCtrl {
     IBytedanceVideoReportService bytedanceVideoReportService;
 
     @PostMapping("/list")
-    public Result<List<JSONObject>> getListReport(@RequestBody JSONObject requestBody) {
+    public Result<PageInfo<JSONObject>> getListReport(@RequestBody JSONObject requestBody) {
 
-        Result<List<JSONObject>> result = new Result<>();
+        Result<PageInfo<JSONObject>> result = new Result<>();
         if (requestBody.isEmpty()) {
             log.error("request body is empty");
             result.setSuccess(false);
+        } else {
+            JSONArray accountIds = requestBody.getJSONArray("accountIds");
+            String startDate = requestBody.getString("startDate");
+            String endDate = requestBody.getString("endDate");
+            String target = requestBody.getString("target");
+            String order = requestBody.getString("order");
+            int pageSize= requestBody.getInteger("pageSize");
+            int pageNo= requestBody.getInteger("pageNo");
+
+            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapByVideo);
+
+            try {
+                if(accountIds.isEmpty()){
+                    accountIds=null;
+                }
+                PageInfo<JSONObject> listData = bytedanceVideoReportService.getVideoReportBy(accountIds, startDate, endDate, filedAll, target, order,pageSize,pageNo);
+                result.setResult(listData);
+                result.setSuccess(true);
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                result.setSuccess(false);
+            }
+        }
+        return result;
+    }
+
+    @PostMapping("/report/excel")
+    public void getExcelReport(@RequestBody JSONObject requestBody,
+                               HttpServletRequest request,
+                               HttpServletResponse response) {
+        JSONArray columns=requestBody.getJSONArray("columns");
+        if(columns.isEmpty()){
+            log.error("请选择需要导出的字段");
         }
+        String filed= JsonResourceUtil.joinFiled(AccountReportConstants.dicMapByVideo,columns);
+        List<String> titles= new ArrayList<>();
+        titles.add("视频");
+        titles.add("视频名称");
+        titles.add("项目名称");
+        titles.add("上传时间");
+        titles.addAll(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapByVideo,columns));
+        //此处增加两个元素是为了保证数据顺序
+        columns.add(0,"url");
+        columns.add(1,"materialName");
+        columns.add(2,"projectName");
+        columns.add(3,"createTime");
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
+        if(accountIds.isEmpty()){
+            accountIds=null;
+        }
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
-        String target= requestBody.getString("target");
-        String order= requestBody.getString("order");
-        try {
-            List<JSONObject> listData= null;
-            result.setResult(listData);
-            result.setSuccess(true);
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-            result.setSuccess(false);
+        String target = requestBody.getString("target");
+        String order = requestBody.getString("order");
+        List<JSONObject> excelData= bytedanceVideoReportService.exportExcelReportBy(accountIds,startDate,endDate,filed,target,order);
+        if(excelData.isEmpty()){
+            return;
+        }
+        List<List<Object>> excelList= new ArrayList<>();
+        excelData.forEach(data->{
+            List<Object> temp= new ArrayList<>();
+            columns.forEach(k->{
+                temp.add(data.get(k.toString()));
+            });
+            excelList.add(temp);
+        });
+        try{
+            String[] headers = titles.toArray(new String[titles.size()]);
+            OutputStream os = response.getOutputStream();
+            ExportExcelUtils eeu = new ExportExcelUtils();
+            XSSFWorkbook workbook = new XSSFWorkbook();
+            eeu.exportExcel(workbook, 0, "头条视频报表", headers, excelList);
+            HttpUtils.setResponseHeader(response, "头条视频报表.xlsx");
+            workbook.write(os);
+            os.flush();
+            os.close();
+        }catch (IOException e){
+            log.error(e.getMessage());
         }
-        return result;
     }
 
 }

+ 13 - 15
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/ByteDanceVideoReportDailyMapper.java

@@ -17,16 +17,14 @@ import java.util.List;
  */
 public interface ByteDanceVideoReportDailyMapper extends BaseMapper<ByteDanceVideoReportDaily> {
 
-    List<ByteDanceVideoReportDaily> videoInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("accountId")Long accountId);
+    List<ByteDanceVideoReportDaily> videoInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("accountId") Long accountId);
 
-    String getCompanyIdByAccountId(@Param("accountId")Long accountId);
+    String getCompanyIdByAccountId(@Param("accountId") Long accountId);
 
-    BigDecimal getVideoReportDailyByDateAndSignature(@Param("startDate") String date, @Param("endDate") String endDate, @Param("signature") String signature, @Param("accountIds")List<Long> accountIds);
+    BigDecimal getVideoReportDailyByDateAndSignature(@Param("startDate") String date, @Param("endDate") String endDate, @Param("signature") String signature, @Param("accountIds") List<Long> accountIds);
 
     void updateHuanbiByDateAndSignature(@Param("date") Date date, @Param("signature") String signature, @Param("huanbi") BigDecimal huanbi);
 
-    List<ByteDanceVideoReportDaily> videoInfoListWeek(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("role") String role, @Param("userId") String userId, @Param("signature") String signature, @Param("companyId") String companyId, @Param("cost") BigDecimal cost);
-
     String getRoleCodeByUserId(@Param("userId") String userId);
 
     String getCompanyIdByUserId(@Param("userId") String userId);
@@ -47,36 +45,36 @@ public interface ByteDanceVideoReportDailyMapper extends BaseMapper<ByteDanceVid
 
     List<AccountVideoDTO> accountVideoMap();
 
-    void replaceIntoAccountVideoMapBatch(@Param("accountVideoDTOList")List<AccountVideoDTO> accountVideoDTOList);
+    void replaceIntoAccountVideoMapBatch(@Param("accountVideoDTOList") List<AccountVideoDTO> accountVideoDTOList);
 
     //admin角色查询视频报表
     List<ByteDanceVideoReportDaily> videoInfoListGroupAdmin(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
     //teamLeader角色查询视频报表
-    List<ByteDanceVideoReportDaily> videoInfoListGroupdesignTeamLeader(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId")String companyId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
+    List<ByteDanceVideoReportDaily> videoInfoListGroupdesignTeamLeader(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
     //平面设计角色查询视频报表
-    List<ByteDanceVideoReportDaily> videoInfoListGroupPlaneAndPlaneLeader(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId")String companyId, @Param("userId")String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
+    List<ByteDanceVideoReportDaily> videoInfoListGroupPlaneAndPlaneLeader(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("userId") String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
     //编导角色查询视频报表
-    List<ByteDanceVideoReportDaily> videoInfoListGroupPlan(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId")String companyId, @Param("userId")String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
+    List<ByteDanceVideoReportDaily> videoInfoListGroupPlan(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("userId") String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
     //剪辑角色查询视频报表
-    List<ByteDanceVideoReportDaily> videoInfoListGroupClip(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId")String companyId, @Param("userId")String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
+    List<ByteDanceVideoReportDaily> videoInfoListGroupClip(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("userId") String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
     //拍摄
-    List<ByteDanceVideoReportDaily> videoInfoListGroupShot(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId")String companyId, @Param("userId")String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
+    List<ByteDanceVideoReportDaily> videoInfoListGroupShot(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("companyId") String companyId, @Param("userId") String userId, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
     //运营
     List<ByteDanceVideoReportDaily> videoInfoListGroupOperator(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
     List<ByteDanceVideoReportDaily> videoInfoListGroupOtherRoles(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("accountIds") List<Long> accountIds, @Param("signature") String signature, @Param("cost") BigDecimal cost);
 
-    List<Long> getAccountIdByprojectIds(@Param("projectIds")List<Long> projectIds);
+    List<Long> getAccountIdByprojectIds(@Param("projectIds") List<Long> projectIds);
 
-    List<Long> getAccountIdsByOperatorIdAndMediaId(@Param("userId")String userId);
+    List<Long> getAccountIdsByOperatorIdAndMediaId(@Param("userId") String userId);
 
-    List<Long> getAccountIds(@Param("companyId")String companyId, @Param("signature")String signature);
+    List<Long> getAccountIds(@Param("companyId") String companyId, @Param("signature") String signature);
 
-    List<Long> getAccountIdsByUserIdAndMediaIds(@Param("userId")String userId, @Param("mediaIds")List<Integer> mediaIds);
+    List<Long> getAccountIdsByUserIdAndMediaIds(@Param("userId") String userId, @Param("mediaIds") List<Integer> mediaIds);
 }

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceCreativeDailyReportMapper.java

@@ -1,6 +1,6 @@
 package cn.com.ctop.toutiao.modules.report.mapper;
 
-import cn.com.ctop.toutiao.modules.report.entity.ByteDanceCleanMaterialReport;
+import cn.com.ctop.common.module.entity.ByteDanceCleanMaterialReport;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceCreativeDailyReport;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;

+ 2 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceVideoReportMapper.java

@@ -8,5 +8,6 @@ import java.util.List;
 
 public interface BytedanceVideoReportMapper {
 
-    List<JSONObject> queryVideoReportBy(@Param("accountIds") JSONArray accountIds,@Param("accountIds") String startDate,@Param("accountIds") String endDate,@Param("accountIds") String target,@Param("accountIds") String order);
+    List<JSONObject> queryVideoReportBy(@Param("accountIds") JSONArray accountIds,@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("filed") String filed,@Param("target") String target,@Param("order") String order);
+
 }

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceCreativeDailyReportMapper.xml

@@ -233,7 +233,7 @@
       WHERE signature !=''
     </select>
     <select id="calculationMaterialReport"
-            resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceCleanMaterialReport">
+            resultType="cn.com.ctop.common.module.entity.ByteDanceCleanMaterialReport">
         select
         signature id,
         sum(cost) cost,

+ 2 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceReportMaterialDailyMapper.xml

@@ -245,10 +245,9 @@
         sum(report.convert_material)                                  as 'convert',
         imageInfo.image_url                                           as 'imageUrl',
         imageInfo.signature                                           as 'signature',
-        group_concat(distinct allocation.project_name)                as 'projectName',
+        group_concat(distinct report.project_name)                as 'projectName',
         report.stat_datetime                                          as 'statDate'
-            from ctop_bytedance_report_material_daily report
-            left join ctop_user_allocation allocation on allocation.account_id = report.account_id
+            from ctop_bytedance_report_image_daily report
             left join ctop_bytedance_image_info imageInfo on imageInfo.material_id = report.material_id
         where
         1=1

+ 23 - 74
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml

@@ -1,90 +1,39 @@
 <?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.toutiao.modules.report.mapper.BytedanceAccountReportMapper">
+<mapper namespace="cn.com.ctop.toutiao.modules.report.mapper.BytedanceVideoReportMapper">
 
-    <select id="queryTodayReportByAccount" resultType="com.alibaba.fastjson.JSONObject">
+    <select id="queryVideoReportBy" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-            ROUND(sum(cost),2) cost,
-            sum(show_num) showNum,
-            sum(click) click,
-            sum(convert_num) as convertNum
-        FROM
-            ctop_bytedance_report_advertiser_daily
-        WHERE
-            stat_datetime = #{statDate} '00:00:00'
-          AND advertiser_id= #{accountId}
-    </select>
-
-    <select id="queryTodaySumByHourGroupAccount" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
-        t2.account_id as accountId,
-        t2.auth_name as authName,
-        ${filed}
-        FROM ctop_bytedance_report_advertiser_hourly t1
-        left join ctop_user_allocation t2 on t1.advertiser_id=t2.account_id
-        WHERE t1.stat_datetime = #{statDate}
-        and t1.stat_hour &lt;= #{hour}
-        AND t1.advertiser_id in
-        <foreach item="item" index="index" collection="accountIds"
-                 open="(" separator="," close=")">
-            #{item}
-        </foreach>
-        group by t1.advertiser_id
-        order by ${target} ${order}
-    </select>
-
-    <select id="queryTodaySumByHour" resultType="com.alibaba.fastjson.JSONObject">
+        t1.signature,
+        t2.url,
+        t2.cover_url as converUrl,
+        t2.material_name AS materialName,
+        (
         SELECT
-        ROUND(sum(cost),2) cost,
-        sum(show_num) showNum,
-        sum(click) click,
-        sum(convert_num) as convertNum
+        project_name
         FROM
-        ctop_bytedance_report_advertiser_hourly
+        ctop_project t4
         WHERE
-        stat_datetime = #{statDate}
-        and stat_hour &lt;= #{hour}
-        AND advertiser_id in
-        <foreach item="item" index="index" collection="accountIds"
-                 open="(" separator="," close=")">
-            #{item}
-        </foreach>
-    </select>
-
-    <select id="querySumByHour" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
+        t4.id = t3.project_id
+        ) AS projectName,
+        t2.create_time as createTime,
         ${filed}
         FROM
-        ctop_bytedance_report_advertiser_hourly t1
-        WHERE
-        t1.stat_datetime = #{statDate}
-        and t1.stat_hour &lt;= #{hour}
-        AND t1.advertiser_id in
-        <foreach item="item" index="index" collection="accountIds"
-                 open="(" separator="," close=")">
-            #{item}
-        </foreach>
-    </select>
-
-    <select id="queryTodayDetailReportBy" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
-        ROUND(sum(cost),2) cost,
-        sum(show_num) showNum,
-        sum(click) click,
-        sum(convert_num) as convertNum,
-        stat_hour as statHour
-        FROM
-        ctop_bytedance_report_advertiser_hourly
+        ctop_bytedance_video_report_daily t1
+        left join ctop_material_info t2 on t1.signature=t2.code
+        LEFT JOIN ctop_user_allocation t3 ON t3.account_id=t1.account_id
         WHERE
-        stat_datetime = #{statDate}
-        AND advertiser_id in
+        t1.stat_datetime >= #{startDate}
+        AND t1.stat_datetime &lt;= #{endDate}
+        <if test="accountIds != null">
+        AND t1.account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
-        GROUP BY
-        stat_hour
-        ORDER BY
-        stat_hour ASC
+        </if>
+        AND t2.url!=""
+        GROUP BY t1.signature
+        ORDER BY ${target} ${order}
     </select>
 </mapper>

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IByteDanceVideoReportDailyService.java

@@ -25,7 +25,7 @@ public interface IByteDanceVideoReportDailyService extends IService<ByteDanceVid
 
     List<ByteDanceVideoReportDaily> videoInfoListTotalExcel(String startDate, String endDate, String signature, BigDecimal cost, Long[] accountIds, String sort);
 
-    PageInfo<ByteDanceVideoReportDaily> videoInfoListMonth(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds,String sort);
+    PageInfo<ByteDanceVideoReportDaily> videoInfoListMonth(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort);
 
     List<ByteDanceVideoReportDaily> videoInfoListDetail(String startDate, String endDate, String signature, Long[] accountIds);
 

+ 0 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceAccountReportService.java

@@ -20,11 +20,8 @@ public interface IBytedanceAccountReportService {
 
     List<JSONObject> getExcelDataBy(String filed, String mediaId, JSONArray accounts,String startDate ,String endDate, int hour, String target, String order);
 
-    //List<ByteDanceReportAccountDailyDTO> getBytedanceSaleProjectInfo(String startDate, String endDate, List<Long> projectList);
-
     PageInfo<ByteDanceReportAccountDailyDTO> getBytedanceAccountInfoByProjectId(String startDate, String endDate, Long projectId, Integer pageNo, Integer pageSize, String sort, Integer yn);
 
     PageInfo<ByteDanceReportAccountDailyDTO> getBytedanceSaleProjectInfo(String startDate, String endDate, List<Long> projectList, Integer pageNum, Integer pageSize, String sort, Integer yn);
 
-    //List<ByteDanceReportAccountDailyDTO> getBytedanceSaleProjectInfo(String startDate, String endDate, Long projectId, int pageNum, int pageSize, String sort);
 }

+ 3 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceCreativeDailyReportService.java

@@ -18,6 +18,9 @@ public interface IBytedanceCreativeDailyReportService extends IService<Bytedance
 
     List<BytedanceCreativeDailyReport> bytedanceCreativeAccountReportList(JSONObject json);
 
+    List<String> getSignatureList();
 
     void replaceBatch(List<BytedanceCreativeDailyReport> dailyReports);
+
+    void calculationMaterialReport(String signature);
 }

+ 0 - 5
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceReportMaterialDailyService.java

@@ -2,11 +2,9 @@ package cn.com.ctop.toutiao.modules.report.service;
 
 import cn.com.ctop.toutiao.modules.material.vo.BytedanceVideoVo;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialDaily;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 import java.util.List;
-import java.util.Map;
 
 /**
  * 素材报表
@@ -15,9 +13,6 @@ import java.util.Map;
  * @version V1.0
  */
 public interface IBytedanceReportMaterialDailyService extends IService<BytedanceReportMaterialDaily> {
-
     List<BytedanceReportMaterialDaily> getListByParams(String date);
     List<BytedanceVideoVo> getVideoVoByDate(String date);
-
-    Map<String,Object> bytedanceImageCost(JSONObject data);
 }

+ 4 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceVideoReportService.java

@@ -1,12 +1,14 @@
 package cn.com.ctop.toutiao.modules.report.service;
 
 import com.alibaba.fastjson.JSONArray;
-import netscape.javascript.JSObject;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
 
 import java.util.List;
 
 public interface IBytedanceVideoReportService {
 
-    List<JSObject>  getVideoReportBy(JSONArray accountIds,String startDate,String endDate,String target,String order);
+    PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order,int pageSize,int pageNo);
 
+    List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order);
 }

+ 0 - 54
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ByteDanceCleanMaterialReportServiceImpl.java

@@ -1,54 +0,0 @@
-package cn.com.ctop.toutiao.modules.report.service.impl;
-
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.toutiao.modules.report.entity.ByteDanceCleanMaterialReport;
-import cn.com.ctop.toutiao.modules.report.mapper.ByteDanceCleanMaterialReportMapper;
-import cn.com.ctop.toutiao.modules.report.mapper.BytedanceCreativeDailyReportMapper;
-import cn.com.ctop.toutiao.modules.report.service.IByteDanceCleanMaterialReportService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Primary;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * 头条-数据清洗
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-02-25
- */
-@Service
-@Primary
-
-public class ByteDanceCleanMaterialReportServiceImpl extends ServiceImpl<ByteDanceCleanMaterialReportMapper, ByteDanceCleanMaterialReport> implements IByteDanceCleanMaterialReportService {
-    @Autowired
-    private BytedanceCreativeDailyReportMapper bytedanceCreativeDailyReportMapper;
-
-    /**
-     * 头条MD5 集合
-     *
-     * @return
-     */
-    @Override
-    public List<String> getSignature() {
-        return bytedanceCreativeDailyReportMapper.getSignatureList();
-    }
-
-    /**
-     * 头条素材报表
-     *
-     * @param signature
-     */
-    @Override
-    public void calculationMaterialReport(String signature) {
-        if (Check.isNull(signature)) {
-            return;
-        }
-        ByteDanceCleanMaterialReport calculationMaterialReport = bytedanceCreativeDailyReportMapper.calculationMaterialReport(signature);
-        if (!Check.isNull(calculationMaterialReport)) {
-            this.saveOrUpdate(calculationMaterialReport);
-        }
-    }
-}

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceAccountReportServiceImpl.java

@@ -66,7 +66,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
     @Override
     public List<JSONObject> getChartDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate) throws ParseException {
         List<JSONObject> result=new ArrayList<>();
-        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMap);
+        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapBy);
         if (startDate.equals(endDate)) {
             List<JSONObject> after = bytedanceAccountReportMapper.queryTodayDetailReportBy(filedAll, startDate, accounts);
             List<JSONObject> before = bytedanceAccountReportMapper.queryTodayDetailReportBy(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), accounts);
@@ -99,7 +99,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
     @Override
     public List<JSONObject> getListDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate, int hour, String target, String order) {
         List<JSONObject> result;
-        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMap);
+        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapBy);
         if (startDate.equals(endDate)) {
             result = bytedanceAccountReportMapper.queryTodaySumByHourGroupAccount(filedAll, startDate, hour, accounts, target, order);
             JSONObject afterSum = bytedanceAccountReportMapper.querySumByHour(filedAll, startDate, hour, accounts);

+ 20 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceCreativeDailyReportServiceImpl.java

@@ -1,6 +1,8 @@
 package cn.com.ctop.toutiao.modules.report.service.impl;
 
+import cn.com.ctop.common.module.entity.ByteDanceCleanMaterialReport;
 import cn.com.ctop.common.module.mapper.SysRoleExtMapper;
+import cn.com.ctop.common.module.service.IByteDanceCleanMaterialReportService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceCreativeDailyReport;
 import cn.com.ctop.toutiao.modules.report.mapper.BytedanceCreativeDailyReportMapper;
@@ -64,8 +66,26 @@ public class BytedanceCreativeDailyReportServiceImpl extends ServiceImpl<Bytedan
     }
 
     @Override
+    public List<String> getSignatureList() {
+        return bytedanceCreativeDailyReportMapper.getSignatureList();
+    }
+
+    @Override
     public void replaceBatch(List<BytedanceCreativeDailyReport> dailyReports) {
         bytedanceCreativeDailyReportMapper.replaceBatch(dailyReports);
     }
 
+    @Override
+    public void calculationMaterialReport(String signature) {
+        if (Check.isNull(signature)) {
+            return;
+        }
+        ByteDanceCleanMaterialReport calculationMaterialReport = bytedanceCreativeDailyReportMapper.calculationMaterialReport(signature);
+        if (!Check.isNull(calculationMaterialReport)) {
+            byteDanceCleanMaterialReportService.saveOrUpdate(calculationMaterialReport);
+        }
+    }
+    @Autowired
+    private IByteDanceCleanMaterialReportService byteDanceCleanMaterialReportService;
+
 }

+ 0 - 45
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceReportMaterialDailyServiceImpl.java

@@ -1,25 +1,16 @@
 package cn.com.ctop.toutiao.modules.report.service.impl;
 
-import cn.com.ctop.common.module.utils.ResultMapUtils;
-import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.toutiao.modules.material.vo.BytedanceVideoVo;
-import cn.com.ctop.toutiao.modules.report.DTO.ImageCostVO;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialDaily;
 import cn.com.ctop.toutiao.modules.report.mapper.BytedanceReportMaterialDailyMapper;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportMaterialDailyService;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
  * 素材报表
@@ -48,41 +39,5 @@ public class BytedanceReportMaterialDailyServiceImpl extends ServiceImpl<Bytedan
         return bytedanceReportMaterialDailyMapper.getVideoVoByDate(date);
     }
 
-    @Override
-    public Map<String,Object> bytedanceImageCost(JSONObject data) {
-        Map<String,Object>result = new HashMap<>();
-        String startDate = data.getString("startDate");
-        if(null == startDate||startDate.trim().equals("")){
-            startDate = null;
-        }
-        String endDate = data.getString("endDate");
-        if(null == endDate||endDate.trim().equals("")){
-            endDate = null;
-        }
-        JSONArray accountList = data.getJSONArray("accountList");
-        if(null==accountList||accountList.isEmpty()){
-            accountList = null;
-        }
-        String code = data.getString("code");
-        if(null == code||code.trim().equals("")){
-            code = null;
-        }
-        Integer pageSize = data.getInteger("pageSize");
-        Integer pageNumber = data.getInteger("pageNumber");
-        if(null == pageNumber||pageNumber ==0){
-            pageNumber = 1;
-        }
-        if(null == pageSize||pageSize ==0){
-            pageSize = 10;
-        }
-        PageHelper.startPage(pageNumber,pageSize);
-        List<ImageCostVO>vos = bytedanceReportMaterialDailyMapper.bytedanceImageCost(startDate,endDate,accountList,code,(pageNumber-1)*pageSize,pageSize);
-        PageInfo<ImageCostVO> pageInfo = new PageInfo<>(vos);
-        result.put("data",pageInfo);
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-
-    }
-
 
 }

+ 3 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceReportServiceImpl.java

@@ -915,7 +915,9 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
                         daily.setInAppUv(metrics.getInteger("in_app_uv"));
                         daily.setRegister(metrics.getInteger("register"));
                         daily.setConvertCost(metrics.getBigDecimal("convert_cost"));
-
+//                        if(){
+//
+//                        }
                         bytedanceReportMaterialDailyList.add(daily);
                     }
                 }

+ 12 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceVideoReportServiceImpl.java

@@ -3,7 +3,9 @@ package cn.com.ctop.toutiao.modules.report.service.impl;
 import cn.com.ctop.toutiao.modules.report.mapper.BytedanceVideoReportMapper;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceVideoReportService;
 import com.alibaba.fastjson.JSONArray;
-import netscape.javascript.JSObject;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -16,8 +18,15 @@ public class BytedanceVideoReportServiceImpl implements IBytedanceVideoReportSer
     BytedanceVideoReportMapper bytedanceVideoReportMapper;
 
     @Override
-    public List<JSObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String target, String order) {
-        return null;
+    public PageInfo<JSONObject> getVideoReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order,int pageSize,int pageNo) {
+        PageHelper.startPage(pageNo,pageSize);
+        List<JSONObject> jsonObjectList=bytedanceVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order);
+        return new PageInfo<>(jsonObjectList);
+    }
+
+    @Override
+    public List<JSONObject> exportExcelReportBy(JSONArray accountIds, String startDate, String endDate, String filed, String target, String order) {
+        return bytedanceVideoReportMapper.queryVideoReportBy(accountIds,startDate,endDate,filed,target,order);
     }
 
 }

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/tool/controller/ParseInstallPackageController.java

@@ -30,8 +30,8 @@ public class ParseInstallPackageController {
                                                           @RequestParam String appType) {
         Result<Map<String, String>> result = new Result<>();
         //在此不需要判断安装包类型拼接后缀
-        //String installPath="C:\\Users\\Arc\\Desktop\\install"+System.currentTimeMillis();
-        String installPath="/data/webpackage/install"+System.currentTimeMillis();
+        String installPath="C:\\Users\\Arc\\Desktop\\install"+System.currentTimeMillis();
+        //String installPath="/data/webpackage/install"+System.currentTimeMillis();
         byte[] bytes = restTemplate.postForObject(installUrl, null, byte[].class);
         if (null == bytes || bytes.length == 0) {
             result.error500("请输入正确的下载链接");

+ 23 - 11
module-toutiao/src/main/resources/json_template/bytedance_video_report_mapping.json

@@ -4,11 +4,11 @@
     "comment": "消耗"
   },
   "showMaterial": {
-    "filed": "sum(t1.show_num) as showMaterial ",
+    "filed": "sum(t1.show_material) as showMaterial ",
     "comment": "展示数"
   },
   "cpm": {
-    "filed": "CASE WHEN sum(t1.cost) / sum(t1.show_num) IS NULL THEN 0 ELSE ROUND((sum(t1.cost) / sum(t1.show_num)) * 1000, 2 ) END AS cpm ",
+    "filed": "CASE WHEN sum(t1.cost) / sum(t1.show_material) IS NULL THEN 0 ELSE ROUND((sum(t1.cost) / sum(t1.show_material)) * 1000, 2 ) END AS cpm ",
     "comment": "平均千次展现费用"
   },
   "clickMaterial": {
@@ -16,7 +16,7 @@
     "comment": "点击数"
   },
   "ctr": {
-    "filed": "CASE WHEN sum(t1.click) / sum(t1.show_num) IS NULL THEN 0 ELSE CONCAT( ROUND((sum(t1.click) / sum(t1.show_num)) * 100,2),'%') END AS ctr ",
+    "filed": "CASE WHEN sum(t1.click) / sum(t1.show_material) IS NULL THEN 0 ELSE CONCAT( ROUND((sum(t1.click) / sum(t1.show_material)) * 100,2),'%') END AS ctr ",
     "comment": "点击率"
   },
   "cpc": {
@@ -24,15 +24,15 @@
     "comment": "平均点击单价"
   },
   "convertMaterial": {
-    "filed": "sum(t1.convert_num) as convertMaterial ",
+    "filed": "sum(t1.convert_material) as convertMaterial ",
     "comment": "转化数"
   },
   "convertCost": {
-    "filed": "CASE WHEN sum(t1.cost) / sum(t1.convert_num) IS NULL THEN 0 ELSE ROUND((sum(t1.cost) / sum(t1.convert_num)), 2 ) END AS convertCost ",
+    "filed": "CASE WHEN sum(t1.cost) / sum(t1.convert_material) IS NULL THEN 0 ELSE ROUND((sum(t1.cost) / sum(t1.convert_material)), 2 ) END AS convertCost ",
     "comment": "转化成本"
   },
   "convertRate": {
-    "filed": "CASE WHEN sum(t1.convert_num) / sum(t1.cost) IS NULL THEN 0 ELSE concat(round(sum(t1.convert_num) / sum(t1.cost)*100,2),'%') end AS convertRate ",
+    "filed": "CASE WHEN sum(t1.convert_material) / sum(t1.cost) IS NULL THEN 0 ELSE concat(round(sum(t1.convert_material) / sum(t1.cost)*100,2),'%') end AS convertRate ",
     "comment": "转化率"
   },
   "downloadStart": {
@@ -48,7 +48,7 @@
     "comment": "安卓开始下载率"
   },
   "downloadFinish": {
-    "filed": "sum(download_finish) as downloadFinish ",
+    "filed": "sum(t1.download_finish) as downloadFinish ",
     "comment": "安卓下载完成数"
   },
   "downloadFinishCost": {
@@ -60,7 +60,7 @@
     "comment": "安卓下载完成率"
   },
   "active": {
-    "filed": "sum(active) as active ",
+    "filed": "sum(t1.active) as active ",
     "comment": "激活数"
   },
   "activeCost": {
@@ -83,6 +83,18 @@
     "filed": " CASE WHEN sum(t1.register) / sum(t1.active) IS NULL THEN 0 ELSE concat(round(sum(t1.register) / sum(t1.active)*100,2),'%') end as activeRegisterRate ",
     "comment": "注册率"
   },
+  "gameAddiction": {
+    "filed": "sum(t1.game_addiction) as gameAddiction  ",
+    "comment": "关键行为数"
+  },
+  "gameAddictionCost": {
+    "filed": "CASE WHEN sum(t1.cost) / sum(t1.game_addiction) IS NULL THEN 0 ELSE round(sum(t1.cost)/sum(t1.game_addiction),3) end as gameAddictionCost ",
+    "comment": "关键行为成本"
+  },
+  "gameAddictionRate": {
+    "filed": " CASE WHEN sum(t1.game_addiction) / sum(t1.active) IS NULL THEN 0 ELSE concat(round(sum(t1.game_addiction) / sum(t1.active)*100,2),'%') end as gameAddictionRate ",
+    "comment": "关键行为率"
+  },
   "nextDayOpen": {
     "filed": "sum(t1.next_day_open) as nextDayOpen ",
     "comment": "次留数"
@@ -131,12 +143,12 @@
     "filed": "sum(t1.follow) as follow ",
     "comment": "新增关注数"
   },
-  "likeMaterial": {
-    "filed": "sum(t1.like_num) as likeMaterial ",
+  "likeMaterial": { 
+    "filed": "sum(t1.like_material) as likeMaterial ",
     "comment": "点赞数"
   },
   "shareMaterial": {
-    "filed": "sum(t1.share) as shareMaterial ",
+    "filed": "sum(t1.share_material) as shareMaterial ",
     "comment": "分享数"
   }
 }

+ 6 - 1
pom.xml

@@ -295,7 +295,12 @@
             <version>2.9.2</version>
         </dependency>
 
-
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-devtools</artifactId>
+            <scope>runtime</scope>
+            <optional>true</optional>
+        </dependency>
         <!-- Redis -->
         <dependency>
             <groupId>org.springframework.boot</groupId>