Browse Source

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

# Conflicts:
#	module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAgentServiceImpl.java
yumeng 5 years ago
parent
commit
f21ace0865
100 changed files with 4326 additions and 559 deletions
  1. 2 2
      jeecg-boot-module-system/pom.xml
  2. 248 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceCleanMaterialReportController.java
  3. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CrawlerController.java
  4. 248 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaiShouCleanMaterialReportController.java
  5. 248 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouEffectAdInfoController.java
  6. 172 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouHotPhotoInfoController.java
  7. 248 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouInspiredAdController.java
  8. 35 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  9. 248 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ScriptTagInfoController.java
  10. 179 144
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  11. 8 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UReportFileBindUserController.java
  12. 8 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UReportFileController.java
  13. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  14. 29 31
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/VideoWatermarkTaskController.java
  15. 107 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceCleanMaterialReport.java
  16. 93 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/KuaiShouCleanMaterialReport.java
  17. 63 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ScriptTagInfo.java
  18. 50 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/ByteDanceCleanMaterialJob.java
  19. 1 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceAdvertiserDailyReportLoadJob.java
  20. 1 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceAdvertiserHourlyReportLoadJob.java
  21. 55 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceCreativeDailyReportLoadJob.java
  22. 62 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceCreativeHourlyReportLoadJob.java
  23. 10 31
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanDailyReportLoadJob.java
  24. 0 35
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanHourlyReportLoadJob.java
  25. 57 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanLoadJob.java
  26. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanRealTimeLoadJob.java
  27. 58 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceSameDayCreativeLoadJob.java
  28. 50 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaiShouCleanMaterialJob.java
  29. 17 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCceDataJob.java
  30. 23 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouNowDateGroupJob.java
  31. 1 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/WatermarkVideoJob.java
  32. 15 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/ByteDanceCleanMaterialReportMapper.java
  33. 17 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/CleanMaterialMapper.java
  34. 15 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/KuaiShouCleanMaterialReportMapper.java
  35. 15 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/ScriptTagInfoMapper.java
  36. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ByteDanceCleanMaterialReportMapper.xml
  37. 51 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/CleanMaterialMapper.xml
  38. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/KuaiShouCleanMaterialReportMapper.xml
  39. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ScriptTagInfoMapper.xml
  40. 15 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IByteDanceCleanMaterialReportService.java
  41. 31 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICleanMaterialService.java
  42. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICrawlerService.java
  43. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IKuaiShouCleanMaterialReportService.java
  44. 15 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IScriptTagInfoService.java
  45. 19 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceCleanMaterialReportServiceImpl.java
  46. 79 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CleanMaterialServiceImpl.java
  47. 134 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CrawlerServiceImpl.java
  48. 20 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/KuaiShouCleanMaterialReportServiceImpl.java
  49. 19 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ScriptTagInfoServiceImpl.java
  50. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/mq/Receiver.java
  51. 20 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/PerformanceController2.java
  52. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IPerformanceService2.java
  53. 35 19
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java
  54. 0 228
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  55. 7 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  56. 5 2
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java
  57. 29 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  58. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  59. 11 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  60. 4 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java
  61. 2 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/service/IAppiumJobService.java
  62. 48 3
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/service/impl/AppiumJobServiceImpl.java
  63. 161 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/entity/KuaishouEffectAdInfo.java
  64. 140 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/entity/KuaishouHotPhotoInfo.java
  65. 120 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/entity/KuaishouInspiredAd.java
  66. 19 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/mapper/KuaishouEffectAdInfoMapper.java
  67. 19 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/mapper/KuaishouHotPhotoInfoMapper.java
  68. 19 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/mapper/KuaishouInspiredAdMapper.java
  69. 52 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/mapper/xml/KuaishouEffectAdInfoMapper.xml
  70. 42 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/mapper/xml/KuaishouHotPhotoInfoMapper.xml
  71. 38 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/mapper/xml/KuaishouInspiredAdMapper.xml
  72. 18 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/service/IKuaishouEffectAdInfoService.java
  73. 18 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/service/IKuaishouHotPhotoInfoService.java
  74. 18 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/service/IKuaishouInspiredAdService.java
  75. 28 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/service/impl/KuaishouEffectAdInfoServiceImpl.java
  76. 28 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/service/impl/KuaishouHotPhotoInfoServiceImpl.java
  77. 28 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/service/impl/KuaishouInspiredAdServiceImpl.java
  78. 17 4
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java
  79. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupMapper.xml
  80. 9 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  81. 81 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouReportDailyAgentSumController.java
  82. 6 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAgentSum.java
  83. 13 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/ParamsDTO.java
  84. 3 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/job/KuaishouReportAgentJob.java
  85. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyAgentSumMapper.java
  86. 77 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAgentSumMapper.xml
  87. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportHourlyCreativeStatisticMapper.xml
  88. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyAgentSumService.java
  89. 23 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAgentSumServiceImpl.java
  90. 37 6
      module-report/src/main/java/cn/com/ctop/bytedance/controller/BytedancePlanDailyReportController.java
  91. 1 0
      module-report/src/main/java/cn/com/ctop/bytedance/entity/BytedanceCreativeDailyReport.java
  92. 10 1
      module-report/src/main/java/cn/com/ctop/bytedance/entity/BytedanceCreativeHourlyReport.java
  93. 2 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedanceCreativeDailyReportMapper.java
  94. 8 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedanceCreativeHourlyReportMapper.java
  95. 17 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedancePlanDailyReportMapper.java
  96. 135 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/BytedanceCreativeDailyReportMapper.xml
  97. 150 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/BytedanceCreativeHourlyReportMapper.xml
  98. 4 2
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/BytedancePlanHourlyReportMapper.xml
  99. 1 1
      module-report/src/main/java/cn/com/ctop/bytedance/service/IBytedanceCreativeDailyReportService.java
  100. 0 0
      module-report/src/main/java/cn/com/ctop/bytedance/service/IBytedanceCreativeHourlyReportService.java

+ 2 - 2
jeecg-boot-module-system/pom.xml

@@ -146,11 +146,11 @@
             <version>3.17</version>
         </dependency>
         <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
-        <dependency>
+       <!-- <dependency>
             <groupId>org.apache.poi</groupId>
             <artifactId>poi-ooxml</artifactId>
             <version>3.17</version>
-        </dependency>
+        </dependency>-->
     </dependencies>
 
     <dependencyManagement>

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

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

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

@@ -17,4 +17,9 @@ public class CrawlerController {
     public Map<String, Object> runTask(@RequestBody KuaishouAppiumJobVO jobVO) {
         return crawlerService.startJob(jobVO);
     }
+
+    @GetMapping("loadInspiration")
+    public Map<String, Object> loadInspiration() {
+        return crawlerService.loadInspiration();
+    }
 }

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

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

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

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

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

@@ -0,0 +1,172 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.crawler.modules.kuaishoucce.entity.KuaishouHotPhotoInfo;
+import cn.com.ctop.crawler.modules.kuaishoucce.service.IKuaishouHotPhotoInfoService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+
+/**
+ * 快手热门作品信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-03
+ */
+@Slf4j
+@Api(tags = "快手热门作品信息")
+@RestController
+@RequestMapping("/ctop/kuaishouHotPhotoInfo")
+public class KuaishouHotPhotoInfoController {
+    @Autowired
+    private IKuaishouHotPhotoInfoService kuaishouHotPhotoInfoService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaishouHotPhotoInfo
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "快手热门作品信息-分页列表查询")
+    @ApiOperation(value = "快手热门作品信息-分页列表查询", notes = "快手热门作品信息-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaishouHotPhotoInfo>> queryPageList(KuaishouHotPhotoInfo kuaishouHotPhotoInfo,
+                                                             @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                             @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                             @RequestParam(name = "sortType", defaultValue = "1") Integer sortType,
+                                                             HttpServletRequest req) {
+        Result<IPage<KuaishouHotPhotoInfo>> result = new Result<IPage<KuaishouHotPhotoInfo>>();
+        QueryWrapper<KuaishouHotPhotoInfo> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouHotPhotoInfo, req.getParameterMap());
+        if (sortType == 1) {
+            queryWrapper.orderByDesc("playing_time");
+        } else if (sortType == 2) {
+            queryWrapper.orderByDesc("like_time");
+        } else {
+            queryWrapper.orderByDesc("comment_time");
+        }
+        Page<KuaishouHotPhotoInfo> page = new Page<KuaishouHotPhotoInfo>(pageNo, pageSize);
+        IPage<KuaishouHotPhotoInfo> pageList = kuaishouHotPhotoInfoService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaishouHotPhotoInfo
+     * @return
+     */
+    @AutoLog(value = "快手热门作品信息-添加")
+    @ApiOperation(value = "快手热门作品信息-添加", notes = "快手热门作品信息-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaishouHotPhotoInfo> add(@RequestBody KuaishouHotPhotoInfo kuaishouHotPhotoInfo) {
+        Result<KuaishouHotPhotoInfo> result = new Result<KuaishouHotPhotoInfo>();
+        try {
+            kuaishouHotPhotoInfoService.save(kuaishouHotPhotoInfo);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaishouHotPhotoInfo
+     * @return
+     */
+    @AutoLog(value = "快手热门作品信息-编辑")
+    @ApiOperation(value = "快手热门作品信息-编辑", notes = "快手热门作品信息-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaishouHotPhotoInfo> edit(@RequestBody KuaishouHotPhotoInfo kuaishouHotPhotoInfo) {
+        Result<KuaishouHotPhotoInfo> result = new Result<KuaishouHotPhotoInfo>();
+        KuaishouHotPhotoInfo kuaishouHotPhotoInfoEntity = kuaishouHotPhotoInfoService.getById(kuaishouHotPhotoInfo.getId());
+        if (kuaishouHotPhotoInfoEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaishouHotPhotoInfoService.updateById(kuaishouHotPhotoInfo);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "快手热门作品信息-通过id删除")
+    @ApiOperation(value = "快手热门作品信息-通过id删除", notes = "快手热门作品信息-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            kuaishouHotPhotoInfoService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "快手热门作品信息-批量删除")
+    @ApiOperation(value = "快手热门作品信息-批量删除", notes = "快手热门作品信息-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<KuaishouHotPhotoInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaishouHotPhotoInfo> result = new Result<KuaishouHotPhotoInfo>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaishouHotPhotoInfoService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "快手热门作品信息-通过id查询")
+    @ApiOperation(value = "快手热门作品信息-通过id查询", notes = "快手热门作品信息-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaishouHotPhotoInfo> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaishouHotPhotoInfo> result = new Result<KuaishouHotPhotoInfo>();
+        KuaishouHotPhotoInfo kuaishouHotPhotoInfo = kuaishouHotPhotoInfoService.getById(id);
+        if (kuaishouHotPhotoInfo == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaishouHotPhotoInfo);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+}

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

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

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

@@ -7,6 +7,7 @@ import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.common.module.service.IMaterialParameterService;
 import cn.com.ctop.common.module.service.IMaterialTagService;
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.JsonUtil;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -24,6 +25,10 @@ import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.ctop.entity.ByteDanceCleanMaterialReport;
+import org.jeecg.modules.ctop.entity.KuaiShouCleanMaterialReport;
+import org.jeecg.modules.ctop.service.IByteDanceCleanMaterialReportService;
+import org.jeecg.modules.ctop.service.IKuaiShouCleanMaterialReportService;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
@@ -67,6 +72,10 @@ public class MaterialInfoController {
     private IMaterialParameterService materialParameterService;
     @Autowired
     private IMaterialTagService materialTagService;
+    @Autowired
+    private IByteDanceCleanMaterialReportService byteDanceCleanMaterialReportService;
+    @Autowired
+    private IKuaiShouCleanMaterialReportService kuaiShouCleanMaterialReportService;
 
     @GetMapping(value = "/report")
     public JSONObject report(String userId) {
@@ -193,22 +202,41 @@ public class MaterialInfoController {
 
         List<MaterialInfo> materialInfoList = pageList.getRecords();
 
-        if (materialInfoList.size() != 0){
-            for (MaterialInfo material:materialInfoList){
+        if (materialInfoList.size() != 0) {
+            for (MaterialInfo material : materialInfoList) {
                 //判断是否已经同步到快手平台
                 Integer kuaishouMaterialUpCount = materialInfoService.getKuaishouUpVideoCount(material.getCode());
-                if (kuaishouMaterialUpCount>0){
+                if (kuaishouMaterialUpCount > 0) {
                     material.setKuaishouVideoIsUp(1);
-                }else{
+                } else {
                     material.setKuaishouVideoIsUp(0);
                 }
                 //判断是否已经同步到抖音平台
                 Integer toutiaoMaterialUpCount = materialInfoService.getToutiaoUpVideoCount(material.getCode());
-                if(toutiaoMaterialUpCount >0){
+                if (toutiaoMaterialUpCount > 0) {
                     material.setToutiaoVideoIsUp(1);
-                }else{
+                } else {
                     material.setToutiaoVideoIsUp(0);
                 }
+
+
+                ByteDanceCleanMaterialReport byteDance = byteDanceCleanMaterialReportService.getById(material.getCode());
+                if (!Check.isNull(byteDance)) {
+                    String byteDanceString = JsonUtil.objectToJson(byteDance);
+                    material.setByteDance(JSONObject.parseObject(byteDanceString));
+                }
+
+                KuaiShouCleanMaterialReport kuaiShou = kuaiShouCleanMaterialReportService.getById(material.getCode());
+                if (!Check.isNull(kuaiShou)) {
+                    String kuaiShouString = JsonUtil.objectToJson(kuaiShou);
+                    material.setKuaiShou(JSONObject.parseObject(kuaiShouString));
+                }
+
+                /*JSONObject generalizationJson = materialInfoService.getGeneralizationInfo(material.getCode());
+                if (!Check.isNull(generalizationJson)) {
+                    material.setGeneralization(generalizationJson);
+                }*/
+
             }
         }
 
@@ -217,6 +245,7 @@ public class MaterialInfoController {
         return result;
     }
 
+
     /**
      * 添加
      *

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

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

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

@@ -1,7 +1,6 @@
 package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.bytedance.entity.BytedancePlanDailyReport;
-import cn.com.ctop.bytedance.entity.BytedancePlanHourlyReport;
 import cn.com.ctop.bytedance.service.IBytedancePlanDailyReportService;
 import cn.com.ctop.bytedance.service.IBytedancePlanHourlyReportService;
 import cn.com.ctop.bytedance.service.IReportService;
@@ -10,6 +9,7 @@ import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
@@ -22,6 +22,7 @@ import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.ctop.service.ICleanMaterialService;
 import org.jeecg.modules.ctop.service.ICreateInternalService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -91,10 +92,8 @@ public class TestController {
 
             for (int i = 0; i < 7; i++) {
                 Date getStartDate = DateUtils.addDay(endDate, -i);
-
                 //3:获取广告组信息数据
                 kuaishouInterfaceService.getAdvertiserGroupReportHourly(token, getStartDate, getStartDate);
-
             }
             for (int i = 0; i < 6; i++) {
                 Date getStartDate = new Date();
@@ -106,13 +105,9 @@ public class TestController {
                     getStartDate = DateUtils.addDay(endDate, -180 + i * 30);
                     getEndDate = DateUtils.addDay(endDate, -150 + i * 30);
                 }
-
                 //3:获取广告组信息数据
                 kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, getStartDate, getEndDate);
-
             }
-
-
         }
         return "Success";
     }
@@ -139,8 +134,6 @@ public class TestController {
     }
 
 
-
-
     @GetMapping(value = "/gerCreative")
     public void gerCreative() {
         QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
@@ -205,28 +198,27 @@ public class TestController {
         oauthTokenQueryWrapper.eq("account_id", accountId);
         oauthTokenQueryWrapper.last("limit 1");
         CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        System.err.println("获取创意,accountId:" + token.getAccountId());
-                        kuaishouInterfaceService.getCreativeList(token, null, null);
-                        //  kuaishouInterfaceService.getVideoList2(token, null, null,1);
-                        //3: 获取图片信息数据
-                        // kuaishouInterfaceService.getImageList2(token, null, null,1);
-                        Thread.sleep(1 * 200);
-                        //  kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
+        executorService.submit(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    System.err.println("获取创意,accountId:" + token.getAccountId());
+                    kuaishouInterfaceService.getCreativeList(token, null, null);
+                    //  kuaishouInterfaceService.getVideoList2(token, null, null,1);
+                    //3: 获取图片信息数据
+                    // kuaishouInterfaceService.getImageList2(token, null, null,1);
+                    Thread.sleep(1 * 200);
+                    //  kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
+                } catch (Exception e) {
+                    e.printStackTrace();
                 }
-            });
+            }
+        });
 
 
     }
 
 
-
     @GetMapping(value = "/gerCreativeReportByAccount")
     public void gerCreativeReportByAccount(Long accountId, String startDateStr, String endDateStr, QueryWrapper<CtopOauthToken> account_id) {
         Thread thread = new Thread() {
@@ -261,7 +253,7 @@ public class TestController {
 
     @GetMapping("loadBytedanceData")
     public Map<String, Object> formatZybData(String date) {
-        Map<String,Object>result = new HashMap<>();
+        Map<String, Object> result = new HashMap<>();
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
         Date getDate = null;
         try {
@@ -283,20 +275,20 @@ public class TestController {
         //清洗关于作业帮数据
         //1:查询作业帮相关的用户数据
         QueryWrapper<UserAllocation> wrapper = new QueryWrapper<>();
-        wrapper.eq("project_id",215);
+        wrapper.eq("project_id", 215);
         List<UserAllocation> allocations = userAllocationService.list(wrapper);
-        if(null!=allocations&&allocations.size()>0){
-            allocations.forEach(allocation->{
+        if (null != allocations && allocations.size() > 0) {
+            allocations.forEach(allocation -> {
                 //根据accountId和时间,查询相关的日报表信息
                 QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
                 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                String dateString = dateFormat.format(finalGetDate)+" 00:00:00";
-                queryWrapper.eq("advertiser_id",allocation.getAccountId())
-                        .eq("stat_datetime",dateString)
+                String dateString = dateFormat.format(finalGetDate) + " 00:00:00";
+                queryWrapper.eq("advertiser_id", allocation.getAccountId())
+                        .eq("stat_datetime", dateString)
                 ;
-                List<BytedancePlanDailyReport>bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
-                if(null!=bytedancePlanDailyReports&&bytedancePlanDailyReports.size()>0){
-                    bytedancePlanDailyReports.forEach(report->{
+                List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
+                if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
+                    bytedancePlanDailyReports.forEach(report -> {
                         String adName = report.getAdName();
                         String[] tags = adName.split("-");
                         report.setAdsense(tags[1]);
@@ -317,7 +309,7 @@ public class TestController {
                             report.setMaterialType("剧情");
                         } else if (materialName.contains("口播")) {
                             report.setMaterialType("口播");
-                        }else{
+                        } else {
                             report.setMaterialType("其他");
                         }
                         planDailyReportService.updateById(report);
@@ -325,15 +317,16 @@ public class TestController {
                 }
             });
         }
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
+
     @GetMapping("getBytedanceData")
     public Map<String, Object> getBytedanceData() {
-        Map<String,Object>result = new HashMap<>();
+        Map<String, Object> result = new HashMap<>();
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
         if (null == tokens || tokens.size() <= 0) {
@@ -343,7 +336,7 @@ public class TestController {
             //3:获取广告计划信息数据
             advertiserDataService.getMaterialList(token);
         });
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 
@@ -403,7 +396,7 @@ public class TestController {
     private IReportService reportService;
 
     @GetMapping("bytedanceHourReport")
-    public Map<String, Object> testReport() {
+    public Map<String, Object> bytedanceHourReport() {
         Map<String, Object> result = new HashMap<>();
         log.info("头条时报数据获取开始");
         Date getDate = new Date();
@@ -435,84 +428,6 @@ public class TestController {
         return result;
     }
 
-    @GetMapping("formatYddData")
-    public Map<String, Object> formatYddData() throws Exception {
-        Map<String, Object> result = new HashMap<>();
-        //清洗关于缘多多数据
-        //1:查询缘多多相关的用户数据
-        QueryWrapper<UserAllocation> yddWrapper = new QueryWrapper<>();
-        yddWrapper.eq("project_id", 113);
-        List<UserAllocation> yddallocations = userAllocationService.list(yddWrapper);
-        if (null != yddallocations && yddallocations.size() > 0) {
-            yddallocations.forEach(allocation -> {
-                //根据accountId和时间,查询相关的日报表信息
-                QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
-                queryWrapper.eq("advertiser_id", allocation.getAccountId())
-                //.eq("stat_datetime",dateString)
-                ;
-                List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
-                if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
-                    bytedancePlanDailyReports.forEach(report -> {
-                        String adName = report.getAdName();
-                        String[] tags = adName.split("-");
-                        report.setChannelCode(tags[0]);
-                        planDailyReportService.updateById(report);
-                    });
-                }
-            });
-        }
-
-        //清洗关于缘多多数据
-        //1:查询缘多多相关的用户数据
-        QueryWrapper<UserAllocation> dsjyWrapper = new QueryWrapper<>();
-        yddWrapper.eq("project_id", 112);
-        List<UserAllocation> dsjyAllocations = userAllocationService.list(dsjyWrapper);
-        if (null != dsjyAllocations && dsjyAllocations.size() > 0) {
-            dsjyAllocations.forEach(allocation -> {
-                //根据accountId和时间,查询相关的日报表信息
-                QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
-                queryWrapper.eq("advertiser_id", allocation.getAccountId())
-                //.eq("stat_datetime",dateString)
-                ;
-                List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
-                if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
-                    bytedancePlanDailyReports.forEach(report -> {
-                        String adName = report.getAdName();
-                        String[] tags = adName.split("-");
-                        report.setChannelCode(tags[0]);
-                        planDailyReportService.updateById(report);
-                    });
-                }
-            });
-        }
-
-        //清洗关于缘多多数据
-        //1:查询缘多多相关的用户数据
-        QueryWrapper<UserAllocation> fjyhWrapper = new QueryWrapper<>();
-        yddWrapper.eq("project_id", 222);
-        List<UserAllocation> fjyhAllocations = userAllocationService.list(fjyhWrapper);
-        if (null != fjyhAllocations && fjyhAllocations.size() > 0) {
-            fjyhAllocations.forEach(allocation -> {
-                //根据accountId和时间,查询相关的日报表信息
-                QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
-                queryWrapper.eq("advertiser_id", allocation.getAccountId())
-                //.eq("stat_datetime",dateString)
-                ;
-                List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
-                if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
-                    bytedancePlanDailyReports.forEach(report -> {
-                        String adName = report.getAdName();
-                        String[] tags = adName.split("-");
-                        report.setChannelCode(tags[0]);
-                        planDailyReportService.updateById(report);
-                    });
-                }
-            });
-        }
-        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
-        return result;
-    }
-
     //线程计数器
     static CountDownLatch countDownLatch = null;
 
@@ -551,45 +466,105 @@ public class TestController {
             e.printStackTrace();
         }
         //清洗关于缘多多数据
-        formatData(113, finalGetDate);
+        planDailyReportService.cleanYddData(113, finalGetDate);
         //清洗关于交友数据
-        formatData(112, finalGetDate);
+        planDailyReportService.cleanYddData(112, finalGetDate);
         //清洗关于附近约会数据
-        formatData(222, finalGetDate);
+        planDailyReportService.cleanYddData(222, finalGetDate);
         log.info("头条计划时报数据获取完成");
         Map<String, Object> result = new HashMap<>();
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 
-    private void formatData(Integer projectId, Date finalGetDate) {
-        QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("project_id", projectId);
-        List<UserAllocation> fjyhAllocations = userAllocationService.list(queryWrapper);
-        if (null != fjyhAllocations && fjyhAllocations.size() > 0) {
-            fjyhAllocations.forEach(allocation -> {
-                //根据accountId和时间,查询相关的时报报表信息
-                QueryWrapper<BytedancePlanHourlyReport> accountWrapper = new QueryWrapper<>();
-                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                String dateString = dateFormat.format(finalGetDate);
-                accountWrapper.eq("advertiser_id", allocation.getAccountId())
-                        .eq("stat_datetime", dateString)
-                ;
-                List<BytedancePlanHourlyReport> bytedancePlanHourlyReports = planHourlyReportService.list(accountWrapper);
-                if (null != bytedancePlanHourlyReports && bytedancePlanHourlyReports.size() > 0) {
-                    bytedancePlanHourlyReports.forEach(report -> {
-                        String adName = report.getAdName();
-                        String[] tags = adName.split("-");
-                        report.setChannelCode(tags[0]);
-                        planHourlyReportService.updateById(report);
-                    });
+    @GetMapping("formatYzData")
+    public Map<String, Object> formatYzData() {
+        Map<String, Object> result = new HashMap<>();
+        planDailyReportService.cleanYzData(151);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        return result;
+    }
+
+    @Autowired
+    private IBytedancePlanHourlyReportService planHourlyReportService;
+
+    @GetMapping("loadCreativeData")
+    public Map<String, Object> loadCreaticeData() {
+        Map<String, Object> result = new HashMap<>();
+        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
+        log.info("头条创意素材数据开始获取");
+        //查询当日数据
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("定时获取头条数据异常:wei获取到可用的token");
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_SERVER_ERROR);
+            return result;
+        }
+        executorService = Executors.newFixedThreadPool(20);
+        countDownLatch = new CountDownLatch(tokens.size());
+        tokens.forEach(token -> {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    // 获取广告创意信息数据
+                    try {
+                        advertiserDataService.getAdvertiserCreative(token, null);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    } finally {
+                        countDownLatch.countDown();
+                    }
                 }
             });
+        });
+        try {
+            countDownLatch.await();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
         }
+        log.info("头条创意素材数据获取完成");
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        return result;
     }
 
-    @Autowired
-    private IBytedancePlanHourlyReportService planHourlyReportService;
+    @GetMapping("loadCreaticeReportData")
+    public Map<String, Object> loadCreaticeReportData() {
+        Map<String, Object> result = new HashMap<>();
+        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
+        for (int i = 51; i < 180; i++) {
+            Date getDate = DateUtils.addDay(new Date(), -i);
+            log.info(DateUtils.formatDate(getDate) + "头条创意日报数据开始获取");
+            //查询当日数据
+            if (null == tokens || tokens.size() <= 0) {
+                log.info("定时获取头条数据异常:为获取到可用的token");
+                continue;
+            }
+            executorService = Executors.newFixedThreadPool(10);
+            countDownLatch = new CountDownLatch(tokens.size());
+            tokens.forEach(token -> {
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        //获取广告创意日报信息数据
+                        try {
+                            reportService.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        } finally {
+                            countDownLatch.countDown();
+                        }
+                    }
+                });
+            });
+            try {
+                countDownLatch.await();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            log.info(DateUtils.formatDate(getDate) + "头条创意日报数据获取完成");
+        }
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        return result;
+    }
 
     @GetMapping("loadVideoData")
     public Map<String, Object> loadVideoData() {
@@ -623,4 +598,64 @@ public class TestController {
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
+
+
+    @Autowired
+    private ICleanMaterialService cleanMaterialService;
+
+    @GetMapping("testReport")
+    public void testReport() {
+        List<String> signatureList = cleanMaterialService.getSignature();
+        if (Check.isNull(signatureList)) {
+            log.error("素材数据获取为空");
+            return;
+        }
+        executorService = Executors.newFixedThreadPool(5);
+        for (int i = 0; i < signatureList.size(); i++) {
+            String signature = signatureList.get(i);
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    System.err.println(signature);
+                    cleanMaterialService.calculationReport(signature);
+                }
+            });
+        }
+
+
+    }
+
+    @GetMapping(value = "/AccountReportByAccount")
+    public void AccountReportByAccount(Long accountId, String startDateStr, String endDateStr) {
+        QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
+        oauthTokenQueryWrapper.eq("media_id", 2);
+        oauthTokenQueryWrapper.eq("account_id", accountId);
+        oauthTokenQueryWrapper.last("limit 1");
+        CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
+        executorService.submit(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+                    Date startDate = null;
+                    Date endDate = null;
+                    try {
+                        startDate = simpleDateFormat.parse(startDateStr);
+                        endDate = simpleDateFormat.parse(endDateStr);
+                    } catch (ParseException e) {
+                        e.printStackTrace();
+                    }
+                    System.err.println("获取广告主报表,accountId:" + token.getAccountId());
+                    kuaishouInterfaceService.getAdvertiserReportDaily(token, startDate, endDate);
+
+                    Thread.sleep(1 * 200);
+                    //  kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        });
+
+
+    }
 }

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

@@ -73,7 +73,15 @@ public class UReportFileBindUserController {
         Result<IPage<UReportFileBindUser>> result = new Result<>();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         uReportFileBindUser.setUserId(user.getId());
+        String fileName = null;
+        if (null != uReportFileBindUser.getFileName() && !uReportFileBindUser.getFileName().trim().equals("")) {
+            fileName = uReportFileBindUser.getFileName();
+            uReportFileBindUser.setFileName(null);
+        }
         QueryWrapper<UReportFileBindUser> queryWrapper = QueryGenerator.initQueryWrapper(uReportFileBindUser, req.getParameterMap());
+        if (null != fileName) {
+            queryWrapper.like("file_name", fileName);
+        }
         Page<UReportFileBindUser> page = new Page<>(pageNo, pageSize);
         IPage<UReportFileBindUser> pageList = uReportFileBindUserService.page(page, queryWrapper);
         result.setSuccess(true);

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

@@ -66,7 +66,15 @@ public class UReportFileController {
                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                     HttpServletRequest req) {
         Result<IPage<UReportFile>> result = new Result<IPage<UReportFile>>();
+        String name = null;
+        if (null != uReportFile.getName() && !uReportFile.getName().trim().equals("")) {
+            name = uReportFile.getName();
+            uReportFile.setName(null);
+        }
         QueryWrapper<UReportFile> queryWrapper = QueryGenerator.initQueryWrapper(uReportFile, req.getParameterMap());
+        if (null != name) {
+            queryWrapper.like("name", name);
+        }
         Page<UReportFile> page = new Page<UReportFile>(pageNo, pageSize);
         IPage<UReportFile> pageList = uReportFileService.page(page, queryWrapper);
         result.setSuccess(true);

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

@@ -169,7 +169,8 @@ public class UserAllocationController {
             }
 
             String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
-            if (!"admin".equals(roleCode) && !"kuaishouOperationManager".equals(roleCode)) {
+            if (!"admin".equals(roleCode) && !"kuaishouOperationManager".equals(roleCode)
+                    && !"kuaishouOperationManager".equals(roleCode) && !"designTeamLeader".equals(roleCode)) {
                 queryWrapper.eq("user_id", userId);
             }
             queryWrapper.orderByDesc("create_time");

+ 29 - 31
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/VideoWatermarkTaskController.java

@@ -1,39 +1,37 @@
 package org.jeecg.modules.ctop.controller;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.jeecg.common.util.oConvertUtils;
 import cn.com.ctop.common.module.entity.VideoWatermarkTask;
 import cn.com.ctop.common.module.service.IVideoWatermarkTaskService;
-import java.util.Date;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.jeecgframework.poi.excel.entity.ImportParams;
 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
-import com.alibaba.fastjson.JSON;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
 
  /**
  * 水印任务表
@@ -48,7 +46,7 @@ import io.swagger.annotations.ApiOperation;
 public class VideoWatermarkTaskController {
 	@Autowired
 	private IVideoWatermarkTaskService videoWatermarkTaskService;
-	
+
 	/**
 	  * 分页列表查询
 	 * @param videoWatermarkTask
@@ -71,8 +69,8 @@ public class VideoWatermarkTaskController {
 		result.setSuccess(true);
 		result.setResult(pageList);
 		return result;
-	}
-	
+    }
+
 	/**
 	  *   添加
 	 * @param videoWatermarkTask
@@ -92,8 +90,8 @@ public class VideoWatermarkTaskController {
 		}
 		return result;
 	}
-	
-	/**
+
+     /**
 	  *  编辑
 	 * @param videoWatermarkTask
 	 * @return
@@ -112,11 +110,11 @@ public class VideoWatermarkTaskController {
 				result.success("修改成功!");
 			}
 		}
-		
-		return result;
+
+        return result;
 	}
-	
-	/**
+
+     /**
 	  *   通过id删除
 	 * @param id
 	 * @return
@@ -133,8 +131,8 @@ public class VideoWatermarkTaskController {
 		}
 		return Result.ok("删除成功!");
 	}
-	
-	/**
+
+     /**
 	  *  批量删除
 	 * @param ids
 	 * @return
@@ -152,8 +150,8 @@ public class VideoWatermarkTaskController {
 		}
 		return result;
 	}
-	
-	/**
+
+     /**
 	  * 通过id查询
 	 * @param id
 	 * @return

+ 107 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceCleanMaterialReport.java

@@ -0,0 +1,107 @@
+package org.jeecg.modules.ctop.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
+ * @version V1.0
+ * @date 2020-02-25
+ */
+@Data
+@TableName("ctop_bytedance_clean_material_report")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_bytedance_clean_material_report对象", description = "头条-数据清洗")
+public class ByteDanceCleanMaterialReport {
+
+    /**
+     * md5 为id
+     */
+    @TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "md5 为id")
+    private String id;
+    /**
+     * 花费(元)
+     */
+    @Excel(name = "花费(元)", width = 15)
+    @ApiModelProperty(value = "花费(元)")
+    private java.math.BigDecimal cost;
+    /**
+     * 展示量
+     */
+    @Excel(name = "展示量", width = 15)
+    @ApiModelProperty(value = "展示量")
+    private Integer showNum;
+    /**
+     * 点击量
+     */
+    @Excel(name = "点击量", width = 15)
+    @ApiModelProperty(value = "点击量")
+    private Integer click;
+    /**
+     * 转化量
+     */
+    @Excel(name = "转化量", width = 15)
+    @ApiModelProperty(value = "转化量")
+    private Integer convertNum;
+    /**
+     * 激活
+     */
+    @Excel(name = "激活", width = 15)
+    @ApiModelProperty(value = "激活")
+    private Integer active;
+    /**
+     * 下载-注册
+     */
+    @Excel(name = "下载-注册", width = 15)
+    @ApiModelProperty(value = "下载-注册")
+    private Integer register;
+    /**
+     * 表单提交
+     */
+    @Excel(name = "表单提交", width = 15)
+    @ApiModelProperty(value = "表单提交")
+    private Integer form;
+    /**
+     * 视频-总播放
+     */
+    @Excel(name = "视频-总播放", width = 15)
+    @ApiModelProperty(value = "视频-总播放")
+    private Integer totalPlay;
+    /**
+     * 视频-有效播放
+     */
+    @Excel(name = "视频-有效播放", width = 15)
+    @ApiModelProperty(value = "视频-有效播放")
+    private Integer validPlay;
+    /**
+     * 创建时间
+     */
+    @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;
+}

+ 93 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/KuaiShouCleanMaterialReport.java

@@ -0,0 +1,93 @@
+package org.jeecg.modules.ctop.entity;
+
+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
+ * @version V1.0
+ * @date 2020-02-24
+ */
+@Data
+@TableName("ctop_kuaishou_clean_material_report")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_clean_material_report对象", description = "快手素材清洗数据")
+public class KuaiShouCleanMaterialReport {
+
+    /**
+     * signature
+     */
+    @Excel(name = "id", width = 15)
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**
+     * 花费(元)
+     */
+    @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 photoClick;
+    /**
+     * 点击数
+     */
+    @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 activation;
+    /**
+     * 表单提交数
+     */
+    @Excel(name = "表单提交数", width = 15)
+    @ApiModelProperty(value = "表单提交数")
+    private Integer formCount;
+    /**
+     * 创建时间
+     */
+    @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;
+}

+ 63 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ScriptTagInfo.java

@@ -0,0 +1,63 @@
+package org.jeecg.modules.ctop.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 脚本库标签信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-02-27
+ */
+@Data
+@TableName("ctop_script_tag_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_script_tag_info对象", description = "脚本库标签信息")
+public class ScriptTagInfo {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+    private Integer id;
+    /**
+     * 标签名称
+     */
+    @Excel(name = "标签名称", width = 15)
+    @ApiModelProperty(value = "标签名称")
+    private String name;
+    /**
+     * 父id
+     */
+    @Excel(name = "父id", width = 15)
+    @ApiModelProperty(value = "父id")
+    private Integer parentId;
+    /**
+     * enabled
+     */
+    @Excel(name = "enabled", width = 15)
+    @ApiModelProperty(value = "enabled")
+    private Integer enabled;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

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

@@ -0,0 +1,50 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.utils.Check;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.ctop.service.ICleanMaterialService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 清洗素材报表
+ */
+@Slf4j
+public class ByteDanceCleanMaterialJob implements Job {
+    @Autowired
+    private ICleanMaterialService cleanMaterialService;
+    static ExecutorService executorService = null;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) {
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                List<String> signatureList = cleanMaterialService.getByteDanceSignature();
+                if (Check.isNull(signatureList)) {
+                    log.error("头条素材数据获取为空");
+                    return;
+                }
+                executorService = Executors.newFixedThreadPool(3);
+                for (int i = 0; i < signatureList.size(); i++) {
+                    String signature = signatureList.get(i);
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            cleanMaterialService.calculationByteDanceReport(signature);
+                        }
+                    });
+                }
+
+
+            }
+        };
+        thread.start();
+
+    }
+}

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

@@ -44,15 +44,8 @@ public class BytedanceAdvertiserDailyReportLoadJob implements Job {
             executorService.submit(new Runnable() {
                 @Override
                 public void run() {
-                    //1: 获取广告主信息数据
+                    //获取广告主信息数据
                     reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-//            2:获取广告组信息数据
-//            reportService.getAdvertiserCampaignReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-                    //3:获取广告计划信息数据
-//            reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-                    //4: 获取广告创意信息数据
-//            reportService.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-
                 }
             });
         });

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

@@ -50,14 +50,8 @@ public class BytedanceAdvertiserHourlyReportLoadJob implements Job {
             executorService.submit(new Runnable() {
                 @Override
                 public void run() {
-                    //1: 获取广告主信息数据
+                    //获取广告主信息数据
                     reportService.getAdvertiserReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-                    //2:获取广告组信息数据
-                    //reportService.getAdvertiserCampaignReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-                    //3:获取广告计划信息数据
-                    //reportService.getAdvertiserPlanReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-                    //4: 获取广告创意信息数据
-                    //reportService.getAdvertiserCreativeReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
                 }
 
             });

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

@@ -0,0 +1,55 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.bytedance.service.IReportService;
+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 lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * @author syh
+ * 头条创意日报数据获取任务
+ * 第二天凌晨跑前一天的数据
+ */
+@Slf4j
+public class BytedanceCreativeDailyReportLoadJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IReportService reportService;
+    static ExecutorService executorService = null;
+
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        //1:查询当日数据
+        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("定时获取头条数据异常:为获取到可用的token");
+            return;
+        }
+        executorService = Executors.newFixedThreadPool(5);
+        tokens.forEach(token -> {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    //4: 获取广告创意信息数据
+                    reportService.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+                }
+            });
+        });
+    }
+
+
+}

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

@@ -0,0 +1,62 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.bytedance.service.IReportService;
+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 lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * @author syh
+ * 头条创意时报获取任务
+ */
+@Slf4j
+public class BytedanceCreativeHourlyReportLoadJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IReportService reportService;
+    static ExecutorService executorService = null;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        log.info("头条时报数据获取开始");
+        Date getDate = new Date();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
+        String hour = simpleDateFormat.format(getDate);
+        if (null != hour && "00".equals(hour)) {
+            getDate = DateUtils.addDay(getDate, -1);
+        }
+        //1:查询当日数据
+        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("定时获取头条小时数据异常:未获取到可用的token");
+            return;
+        }
+        executorService = Executors.newFixedThreadPool(4);
+        Date finalGetDate = getDate;
+        tokens.forEach(token -> {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    //获取广告创意信息数据
+                    reportService.getAdvertiserCreativeReport(token, finalGetDate, finalGetDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+                }
+
+            });
+
+        });
+        log.info("头条时报数据获取结束");
+    }
+}

+ 10 - 31
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedancePlanDailyReportLoadJob.java

@@ -42,13 +42,21 @@ public class BytedancePlanDailyReportLoadJob implements Job {
             return;
         }
         tokens.forEach(token -> {
-            //3:获取广告计划信息数据
+            //获取广告计划信息数据
             reportService.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         });
+        formatZybData(215, getDate);
+        planDailyReportService.cleanYddData(112, getDate);
+        planDailyReportService.cleanYddData(113, getDate);
+        planDailyReportService.cleanYddData(222, getDate);
+        planDailyReportService.cleanYzData(151);
+    }
+
+    private void formatZybData(Integer projectId, Date getDate) {
         //清洗关于作业帮数据
         //1:查询作业帮相关的用户数据
         QueryWrapper<UserAllocation> wrapper = new QueryWrapper<>();
-        wrapper.eq("project_id",215);
+        wrapper.eq("project_id", projectId);
         List<UserAllocation> allocations = userAllocationService.list(wrapper);
         if(null!=allocations&&allocations.size()>0){
             allocations.forEach(allocation->{
@@ -90,35 +98,6 @@ public class BytedancePlanDailyReportLoadJob implements Job {
                 }
             });
         }
-        formatData(113,getDate);
-        formatData(112,getDate);
-        formatData(222,getDate);
-    }
-
-    private void formatData(Integer projectId,Date getDate){
-        //清洗关于缘多多数据
-        QueryWrapper<UserAllocation> dsjyWrapper = new QueryWrapper<>();
-        dsjyWrapper.eq("project_id", projectId);
-        List<UserAllocation> dsjyAllocations = userAllocationService.list(dsjyWrapper);
-        if (null != dsjyAllocations && dsjyAllocations.size() > 0) {
-            dsjyAllocations.forEach(allocation -> {
-                //根据accountId和时间,查询相关的日报表信息
-                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                String dateString = dateFormat.format(getDate)+" 00:00:00";
-                QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
-                queryWrapper.eq("advertiser_id", allocation.getAccountId())
-                        .eq("stat_datetime",dateString);
-                List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
-                if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
-                    bytedancePlanDailyReports.forEach(report -> {
-                        String adName = report.getAdName();
-                        String[] tags = adName.split("-");
-                        report.setChannelCode(tags[0]);
-                        planDailyReportService.updateById(report);
-                    });
-                }
-            });
-        }
     }
 
     @Autowired

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

@@ -1,14 +1,11 @@
 package org.jeecg.modules.ctop.job;
 
-import cn.com.ctop.bytedance.entity.BytedancePlanHourlyReport;
 import cn.com.ctop.bytedance.service.IBytedancePlanHourlyReportService;
 import cn.com.ctop.bytedance.service.IReportService;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.Job;
@@ -73,39 +70,7 @@ public class BytedancePlanHourlyReportLoadJob implements Job {
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
-        //清洗关于缘多多数据
-        formatData(113,finalGetDate);
-        //清洗关于交友数据
-        formatData(112,finalGetDate);
-        //清洗关于附近约会数据
-        formatData(222,finalGetDate);
         log.info("头条计划时报数据获取完成");
         executorService.shutdown();
     }
-
-    private void formatData(Integer projectId, Date finalGetDate){
-        QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("project_id", projectId);
-        List<UserAllocation> fjyhAllocations = userAllocationService.list(queryWrapper);
-        if (null != fjyhAllocations && fjyhAllocations.size() > 0) {
-            fjyhAllocations.forEach(allocation -> {
-                //根据accountId和时间,查询相关的时报报表信息
-                QueryWrapper<BytedancePlanHourlyReport> accountWrapper = new QueryWrapper<>();
-                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                String dateString = dateFormat.format(finalGetDate);
-                accountWrapper.eq("advertiser_id", allocation.getAccountId())
-                        .eq("stat_datetime",dateString)
-                ;
-                List<BytedancePlanHourlyReport> bytedancePlanHourlyReports = planHourlyReportService.list(accountWrapper);
-                if (null != bytedancePlanHourlyReports && bytedancePlanHourlyReports.size() > 0) {
-                    bytedancePlanHourlyReports.forEach(report -> {
-                        String adName = report.getAdName();
-                        String[] tags = adName.split("-");
-                        report.setChannelCode(tags[0]);
-                        planHourlyReportService.updateById(report);
-                    });
-                }
-            });
-        }
-    }
 }

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

@@ -0,0 +1,57 @@
+package org.jeecg.modules.ctop.job;
+
+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.service.IByteDanceAdvertiserDataService;
+import cn.com.ctop.toutiao.service.IByteDanceCreativeService;
+import lombok.extern.slf4j.Slf4j;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Slf4j
+public class BytedancePlanLoadJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    static ExecutorService executorService = null;
+    @Autowired
+    private IByteDanceAdvertiserDataService advertiserDataService;
+    @Autowired
+    private IByteDanceCreativeService creativeService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                //1:查询当日数据
+                List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
+                executorService = Executors.newFixedThreadPool(4);
+                tokens.forEach(token -> {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+                                //1:获取当日广告计划数据
+                                advertiserDataService.getAdvertiserPlan(token, "", null, null);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            } finally {
+                            }
+                        }
+                    });
+                });
+                log.info("头条全量计划数据获取完成");
+            }
+
+        };
+        thread.start();
+    }
+}

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

@@ -35,7 +35,7 @@ public class BytedancePlanRealTimeLoadJob implements Job {
             public void run() {
                 //1:查询当日数据
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-                executorService = Executors.newFixedThreadPool(8);
+                executorService = Executors.newFixedThreadPool(4);
                 String nowDate = DateUtils.date2Str();
                 tokens.forEach(token -> {
                     executorService.submit(new Runnable() {

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

@@ -0,0 +1,58 @@
+package org.jeecg.modules.ctop.job;
+
+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.service.IByteDanceAdvertiserDataService;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Slf4j
+public class BytedanceSameDayCreativeLoadJob implements Job {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    static ExecutorService executorService = null;
+    //线程计数器
+    static CountDownLatch countDownLatch = null;
+    @Autowired
+    private IByteDanceAdvertiserDataService advertiserDataService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
+        executorService = Executors.newFixedThreadPool(6);
+        countDownLatch = new CountDownLatch(tokens.size());
+        tokens.forEach(token -> {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        String getDateString = DateUtils.formatDate(new Date());
+                        advertiserDataService.getAdvertiserCreative(token, getDateString);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    } finally {
+                        countDownLatch.countDown();
+                    }
+                }
+            });
+        });
+        try {
+            countDownLatch.await();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        log.info("创意物料数据同步完成");
+    }
+}

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

@@ -0,0 +1,50 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.utils.Check;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.ctop.service.ICleanMaterialService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 清洗素材报表
+ */
+@Slf4j
+public class KuaiShouCleanMaterialJob implements Job {
+    @Autowired
+    private ICleanMaterialService cleanMaterialService;
+    static ExecutorService executorService = null;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) {
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                List<String> signatureList = cleanMaterialService.getSignature();
+                if (Check.isNull(signatureList)) {
+                    log.error("素材数据获取为空");
+                    return;
+                }
+                executorService = Executors.newFixedThreadPool(5);
+                for (int i = 0; i < signatureList.size(); i++) {
+                    String signature = signatureList.get(i);
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            cleanMaterialService.calculationReport(signature);
+                        }
+                    });
+                }
+
+
+            }
+        };
+        thread.start();
+
+    }
+}

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

@@ -0,0 +1,17 @@
+package org.jeecg.modules.ctop.job;
+
+import org.jeecg.modules.ctop.service.ICrawlerService;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class KuaishouCceDataJob implements Job {
+    @Autowired
+    private ICrawlerService crawlerService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        crawlerService.loadInspiration();
+    }
+}

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

@@ -4,6 +4,7 @@ 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.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.Job;
@@ -11,6 +12,8 @@ import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
@@ -30,19 +33,22 @@ public class KuaishouNowDateGroupJob implements Job {
 
 
         Thread thread = new Thread() {
+            @SneakyThrows
             @Override
             public void run() {
                 //1:查询当日数据
-                Date nowDate  = DateUtils.getDate();
+                Date endDate  = DateUtils.getDate();
+                String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
+                SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
+                Date startDate = sim.parse(anotherDay);
                 List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
-                executorService = Executors.newFixedThreadPool(8);
+                executorService = Executors.newFixedThreadPool(5);
                 tokens.forEach(token -> {
                     executorService.submit(new Runnable() {
                         @Override
                         public void run() {
                             try {
-                                //1:获取全量广告组数据
-                                kuaishouInterfaceService.getGroupList(token, nowDate, nowDate);
+                                kuaishouInterfaceService.getGroupList(token, startDate, endDate);
                             } catch (Exception e) {
                                 e.printStackTrace();
                             } finally {
@@ -58,4 +64,17 @@ public class KuaishouNowDateGroupJob implements Job {
 
 
     }
+
+   /* public static void main(String[] args) throws ParseException {
+        Date nowDate  = DateUtils.getDate();
+        String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(nowDate), -1);
+
+
+
+        SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
+        Date endDate = sim.parse(anotherDay);
+        String s = DateUtils.formatDate(endDate);
+        System.err.println(s);
+
+    }*/
 }

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

@@ -34,8 +34,7 @@ public class WatermarkVideoJob implements Job {
                 List<VideoWatermarkTask> list = videoWaterMarkService.list(queryWrapper);
                 if (list != null && list.size() > 0) {
                     for (VideoWatermarkTask videoWatermarkTask : list) {
-                        MpsUtils mpsUtils = new MpsUtils();
-                        QueryJobListResponse.Job job = mpsUtils.getJobStatus(videoWatermarkTask.getJobId());
+                        QueryJobListResponse.Job job = MpsUtils.getJobStatus(videoWatermarkTask.getJobId());
                         if (job.getState().equals("TranscodeSuccess")) {
                             String url = "https://ctop-media.oss-cn-beijing.aliyuncs.com/" + job.getOutput().getOutputFile().getObject();
 

+ 15 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/ByteDanceCleanMaterialReportMapper.java

@@ -0,0 +1,15 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.ctop.entity.ByteDanceCleanMaterialReport;
+
+/**
+ * 头条-数据清洗
+ *
+ * @author: jeecg-boot
+ * @date: 2020-02-25
+ * @cersion: V1.0
+ */
+public interface ByteDanceCleanMaterialReportMapper extends BaseMapper<ByteDanceCleanMaterialReport> {
+
+}

+ 17 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/CleanMaterialMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.ctop.mapper;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.ctop.entity.ByteDanceCleanMaterialReport;
+import org.jeecg.modules.ctop.entity.KuaiShouCleanMaterialReport;
+
+import java.util.List;
+
+public interface CleanMaterialMapper {
+    List<String> getSignatureList();
+
+    KuaiShouCleanMaterialReport calculationMaterialReport(@Param("signature") String signature);
+
+    List<String> getByteDanceSignatureList();
+
+    ByteDanceCleanMaterialReport calculationByteDanceMaterialReport(String signature);
+}

+ 15 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/KuaiShouCleanMaterialReportMapper.java

@@ -0,0 +1,15 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.ctop.entity.KuaiShouCleanMaterialReport;
+
+/**
+ * 快手素材清洗数据
+ *
+ * @author: jeecg-boot
+ * @date: 2020-02-24
+ * @cersion: V1.0
+ */
+public interface KuaiShouCleanMaterialReportMapper extends BaseMapper<KuaiShouCleanMaterialReport> {
+
+}

+ 15 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/ScriptTagInfoMapper.java

@@ -0,0 +1,15 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.ctop.entity.ScriptTagInfo;
+
+/**
+ * 脚本库标签信息
+ *
+ * @author: jeecg-boot
+ * @date: 2020-02-27
+ * @cersion: V1.0
+ */
+public interface ScriptTagInfoMapper extends BaseMapper<ScriptTagInfo> {
+
+}

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ByteDanceCleanMaterialReportMapper.xml

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

+ 51 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/CleanMaterialMapper.xml

@@ -0,0 +1,51 @@
+<?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="org.jeecg.modules.ctop.mapper.CleanMaterialMapper">
+    <select id="getSignatureList" resultType="java.lang.String">
+    SELECT
+      DISTINCT(signature)
+      from ctop_kuaishou_report_daily_creative
+      WHERE signature !=''
+    </select>
+
+    <select id="calculationMaterialReport" resultType="org.jeecg.modules.ctop.entity.KuaiShouCleanMaterialReport">
+        select
+        signature id,
+        sum(charge) charge,
+        sum(photo_show) photoShow,
+        sum(photo_click) photoClick,
+        sum(aclick) aclick,
+        sum(bclick) bclick,
+        sum(activation) activation,
+        sum(form_count) formCount
+        from ctop_kuaishou_report_daily_creative
+        where
+        signature = #{signature}
+    </select>
+
+
+    <select id="getByteDanceSignatureList" resultType="java.lang.String">
+    SELECT
+      DISTINCT(signature)
+      from ctop_bytedance_report_creative_daily
+      WHERE signature !=''
+    </select>
+
+    <select id="calculationByteDanceMaterialReport" resultType="org.jeecg.modules.ctop.entity.ByteDanceCleanMaterialReport">
+        select
+        signature id,
+        sum(cost) cost,
+        sum(show_num) showNum,
+        sum(click) click,
+        sum(convert_num) convertNum,
+        sum(active) active,
+        sum(register) register,
+        sum(form) form,
+        sum(total_play) totalPlay,
+        sum(valid_play) validPlay
+        from ctop_bytedance_report_creative_daily
+        where
+        signature = #{signature}
+    </select>
+
+</mapper>

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/KuaiShouCleanMaterialReportMapper.xml

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

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ScriptTagInfoMapper.xml

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

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

@@ -0,0 +1,15 @@
+package org.jeecg.modules.ctop.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.ctop.entity.ByteDanceCleanMaterialReport;
+
+/**
+ * 头条-数据清洗
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-02-25
+ */
+public interface IByteDanceCleanMaterialReportService extends IService<ByteDanceCleanMaterialReport> {
+
+}

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

@@ -0,0 +1,31 @@
+package org.jeecg.modules.ctop.service;
+
+import java.util.List;
+
+public interface ICleanMaterialService {
+    /**
+     * 快手 唯一素材MD5标识
+     * @return
+     */
+    List<String> getSignature();
+
+    /**
+     * 计算快手素材报表
+     *
+     * @param signature
+     */
+    void calculationReport(String signature);
+
+    /**
+     * 头条 唯一素材MD5标识
+     * @return
+     */
+    List<String> getByteDanceSignature();
+
+    /**
+     * 计算头条素材报表
+     *
+     * @param signature
+     */
+    void calculationByteDanceReport(String signature);
+}

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

@@ -6,4 +6,6 @@ import java.util.Map;
 
 public interface ICrawlerService {
     Map<String, Object> startJob(KuaishouAppiumJobVO jobVO);
+
+    Map<String, Object> loadInspiration();
 }

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

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

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

@@ -0,0 +1,15 @@
+package org.jeecg.modules.ctop.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.ctop.entity.ScriptTagInfo;
+
+/**
+ * 脚本库标签信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-02-27
+ */
+public interface IScriptTagInfoService extends IService<ScriptTagInfo> {
+
+}

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

@@ -0,0 +1,19 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.ctop.entity.ByteDanceCleanMaterialReport;
+import org.jeecg.modules.ctop.mapper.ByteDanceCleanMaterialReportMapper;
+import org.jeecg.modules.ctop.service.IByteDanceCleanMaterialReportService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 头条-数据清洗
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-02-25
+ */
+@Service
+public class ByteDanceCleanMaterialReportServiceImpl extends ServiceImpl<ByteDanceCleanMaterialReportMapper, ByteDanceCleanMaterialReport> implements IByteDanceCleanMaterialReportService {
+
+}

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

@@ -0,0 +1,79 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCreativeService;
+import org.jeecg.modules.ctop.entity.ByteDanceCleanMaterialReport;
+import org.jeecg.modules.ctop.entity.KuaiShouCleanMaterialReport;
+import org.jeecg.modules.ctop.mapper.CleanMaterialMapper;
+import org.jeecg.modules.ctop.service.IByteDanceCleanMaterialReportService;
+import org.jeecg.modules.ctop.service.ICleanMaterialService;
+import org.jeecg.modules.ctop.service.IKuaiShouCleanMaterialReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class CleanMaterialServiceImpl implements ICleanMaterialService {
+    @Autowired
+    private CleanMaterialMapper cleanMaterialMapper;
+    @Autowired
+    IKuaishouReportDailyCreativeService kuaishouReportDailyCreativeService;
+    @Autowired
+    private IKuaiShouCleanMaterialReportService cleanMaterialReportService;
+    @Autowired
+    private IByteDanceCleanMaterialReportService byteDanceCleanMaterialReportService;
+
+
+    /**
+     * 快手 MD5集合
+     *
+     * @return
+     */
+    @Override
+    public List<String> getSignature() {
+        return cleanMaterialMapper.getSignatureList();
+    }
+
+    /**
+     * 计算素材报表
+     *
+     * @param signature
+     */
+    @Override
+    public void calculationReport(String signature) {
+        if (Check.isNull(signature)) {
+            return;
+        }
+        KuaiShouCleanMaterialReport calculationMaterialReport = cleanMaterialMapper.calculationMaterialReport(signature);
+        if (!Check.isNull(calculationMaterialReport)) {
+            cleanMaterialReportService.saveOrUpdate(calculationMaterialReport);
+        }
+    }
+
+    /**
+     * 头条MD5 集合
+     *
+     * @return
+     */
+    @Override
+    public List<String> getByteDanceSignature() {
+        return cleanMaterialMapper.getByteDanceSignatureList();
+    }
+
+    /**
+     * 头条素材报表
+     *
+     * @param signature
+     */
+    @Override
+    public void calculationByteDanceReport(String signature) {
+        if (Check.isNull(signature)) {
+            return;
+        }
+        ByteDanceCleanMaterialReport calculationMaterialReport = cleanMaterialMapper.calculationByteDanceMaterialReport(signature);
+        if (!Check.isNull(calculationMaterialReport)) {
+            byteDanceCleanMaterialReportService.saveOrUpdate(calculationMaterialReport);
+        }
+    }
+}

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

@@ -2,6 +2,7 @@ package org.jeecg.modules.ctop.service.impl;
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.crawler.modules.appium.entity.AppiumDevice;
@@ -10,17 +11,29 @@ import cn.com.ctop.crawler.modules.appium.mapper.AppiumTaskLogMapper;
 import cn.com.ctop.crawler.modules.appium.service.IAppiumDeviceService;
 import cn.com.ctop.crawler.modules.appium.service.IAppiumJobService;
 import cn.com.ctop.crawler.modules.appium.service.IAppiumTaskService;
+import cn.com.ctop.crawler.modules.kuaishoucce.entity.KuaishouEffectAdInfo;
+import cn.com.ctop.crawler.modules.kuaishoucce.entity.KuaishouHotPhotoInfo;
+import cn.com.ctop.crawler.modules.kuaishoucce.entity.KuaishouInspiredAd;
+import cn.com.ctop.crawler.modules.kuaishoucce.service.IKuaishouEffectAdInfoService;
+import cn.com.ctop.crawler.modules.kuaishoucce.service.IKuaishouHotPhotoInfoService;
+import cn.com.ctop.crawler.modules.kuaishoucce.service.IKuaishouInspiredAdService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
 import org.jeecg.modules.ctop.service.ICrawlerService;
 import org.jeecg.modules.ctop.vo.KuaishouAppiumJobVO;
 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;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
 @Service
+@Slf4j
 public class CrawlerServiceImpl implements ICrawlerService {
     static ExecutorService executorService = null;
     @Autowired
@@ -37,7 +50,6 @@ public class CrawlerServiceImpl implements ICrawlerService {
     @Override
     public Map<String, Object> startJob(KuaishouAppiumJobVO jobVO) {
         Map<String, Object> result = new HashMap<>();
-        //TODO 需要考虑多个任务并行的问题
         //1:根据id查询快手账号信息
         BindAccountLogin accountLogin = bindAccountLoginService.getById(jobVO.getAccountId());
         if (null == accountLogin) {
@@ -108,4 +120,125 @@ public class CrawlerServiceImpl implements ICrawlerService {
         ResultMapUtils.setResultMap(result, StatusCode.KUAISHOU_CRAWLER_APP_JOB_StART.getCode());
         return result;
     }
+
+    @Override
+    public Map<String, Object> loadInspiration() {
+        //(1):效果广告解析
+        loadeffectAdByPage(100, 1);
+
+        //(2):广告创意视频
+        loadInspiredAdByPage(100, 1);
+
+        //(3):快手热门作品
+        loadHotPhotoByPage(100, 1);
+
+        return null;
+    }
+
+    private void loadHotPhotoByPage(int pageSize, int pageNum) {
+        String url = "https://cc.e.kuaishou.com/rest/creativeCentor/hotPhoto/list";
+        JSONObject param = new JSONObject();
+        param.put("pageNum", pageNum);
+        param.put("pageSize", pageSize);
+        param.put("sortType", 1);
+        String result = HttpUtils.httpPostRequest(url, param, new HashMap<>());
+        JSONObject resultObject = JSONObject.parseObject(result);
+        if (null == resultObject.getLong("result") || resultObject.getLong("result") != 1) {
+            log.info("热门作品数据获取失败");
+            return;
+        }
+        JSONArray hotPhotoInfos = resultObject.getJSONObject("data").getJSONArray("hotPhotoInfos");
+        if (null == hotPhotoInfos || hotPhotoInfos.size() <= 0) {
+            log.info("热门作品数据获取完成");
+            return;
+        }
+        List<KuaishouHotPhotoInfo> photoInfos = new ArrayList<>();
+        for (int i = 0; i < hotPhotoInfos.size(); i++) {
+            JSONObject photoInfoJSONObject = hotPhotoInfos.getJSONObject(i);
+            KuaishouHotPhotoInfo hotPhotoInfo = new KuaishouHotPhotoInfo(photoInfoJSONObject);
+            photoInfos.add(hotPhotoInfo);
+        }
+        hotPhotoInfoService.replaceBatch(photoInfos);
+        loadHotPhotoByPage(pageSize, pageNum + 1);
+    }
+
+    private void loadInspiredAdByPage(int pageSize, int pageNumber) {
+        String url = "https://cc.e.kuaishou.com/rest/creativeCentor/inspired/list";
+        JSONObject param = new JSONObject();
+        param.put("pageNum", pageNumber);
+        param.put("pageSize", pageSize);
+        param.put("firstIndustryId", 0);
+        param.put("formatId", 0);
+        param.put("inspiredSortTypeId", 0);
+        param.put("platformSourceId", 0);
+        param.put("queryCond", "");
+        String result = HttpUtils.httpPostRequest(url, param, new HashMap<>());
+        JSONObject resultObject = JSONObject.parseObject(result);
+        if (null == resultObject.getLong("result") || resultObject.getLong("result") != 1) {
+            log.info("广告创意数据获取失败");
+            return;
+        }
+        JSONArray inspiredAds = resultObject.getJSONObject("data").getJSONArray("inspiredAds");
+        if (null == inspiredAds || inspiredAds.size() <= 0) {
+            log.info("广告创意数据获取完成");
+            return;
+        }
+        List<KuaishouInspiredAd> ads = new ArrayList<>();
+        for (int i = 0; i < inspiredAds.size(); i++) {
+            JSONObject ad = inspiredAds.getJSONObject(i);
+            KuaishouInspiredAd inspiredAd = new KuaishouInspiredAd(ad);
+            ads.add(inspiredAd);
+        }
+        inspiredAdService.replaceBatch(ads);
+        loadInspiredAdByPage(pageSize, pageNumber + 1);
+    }
+
+    @Autowired
+    private IKuaishouInspiredAdService inspiredAdService;
+    @Autowired
+    private IKuaishouHotPhotoInfoService hotPhotoInfoService;
+    @Autowired
+    private IKuaishouEffectAdInfoService effectAdInfoService;
+
+    private void loadeffectAdByPage(int pageSize, int pageNum) {
+        String url = "https://cc.e.kuaishou.com/rest/creativeCentor/adCase/effectAd/list";
+        JSONObject param = new JSONObject();
+        param.put("caseType", 1);
+        param.put("pageNum", pageNum);
+        param.put("pageSize", pageSize);
+        String result = HttpUtils.httpPostRequest(url, param, new HashMap<>());
+        JSONObject resultObject = JSONObject.parseObject(result);
+        if (null == resultObject.getLong("result") || resultObject.getLong("result") != 1) {
+            log.info("效果广告数据获取失败");
+            return;
+        }
+        JSONArray effectAds = resultObject.getJSONObject("data").getJSONArray("effectAds");
+        if (null == effectAds || effectAds.size() <= 0) {
+            log.info("效果广告数据获取完成");
+            return;
+        }
+        List<KuaishouEffectAdInfo> adInfos = new ArrayList<>();
+        for (int i = 0; i < effectAds.size(); i++) {
+            JSONObject ad = effectAds.getJSONObject(i);
+            Long contentId = ad.getLong("contentId");
+            if (null != contentId) {
+                JSONObject content = getEffectAdDetail(contentId).getJSONObject("data").getJSONObject("effectAdDetail");
+                KuaishouEffectAdInfo adInfo = new KuaishouEffectAdInfo(content);
+                adInfos.add(adInfo);
+            }
+        }
+        if (adInfos.size() > 0) {
+            effectAdInfoService.replaceBatch(adInfos);
+        }
+        loadeffectAdByPage(pageSize, pageNum + 1);
+    }
+
+    private JSONObject getEffectAdDetail(Long contentId) {
+        String url = "https://cc.e.kuaishou.com/rest/creativeCentor/adCase/effectAd/detail";
+        JSONObject param = new JSONObject();
+        param.put("caseType", 1);
+        param.put("contentId", contentId);
+        String result = HttpUtils.httpPostRequest(url, param, new HashMap<>());
+        return JSONObject.parseObject(result);
+    }
 }

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

@@ -0,0 +1,20 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.ctop.entity.KuaiShouCleanMaterialReport;
+import org.jeecg.modules.ctop.mapper.KuaiShouCleanMaterialReportMapper;
+import org.jeecg.modules.ctop.service.IKuaiShouCleanMaterialReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+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 {
+
+}

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

@@ -0,0 +1,19 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.ctop.entity.ScriptTagInfo;
+import org.jeecg.modules.ctop.mapper.ScriptTagInfoMapper;
+import org.jeecg.modules.ctop.service.IScriptTagInfoService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 脚本库标签信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-02-27
+ */
+@Service
+public class ScriptTagInfoServiceImpl extends ServiceImpl<ScriptTagInfoMapper, ScriptTagInfo> implements IScriptTagInfoService {
+
+}

+ 2 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/mq/Receiver.java

@@ -1,13 +1,14 @@
 package org.jeecg.modules.mq;
 
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.rabbit.annotation.Queue;
 import org.springframework.amqp.rabbit.annotation.RabbitHandler;
 import org.springframework.amqp.rabbit.annotation.RabbitListener;
 import org.springframework.stereotype.Component;
 
 @Slf4j
 @Component
-@RabbitListener(queues = "hello")
+@RabbitListener(queuesToDeclare = @Queue("hello"))
 public class Receiver {
     /**
      * 通过@RabbitHandler声明的方法,对hello队列中的消息进行处理

+ 20 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/PerformanceController2.java

@@ -535,6 +535,26 @@ public class PerformanceController2 {
         return result;
     }
 
+    @AutoLog(value = "获取本周相关有效视频列表")
+    @ApiOperation(value = "获取本周相关有效视频列表", notes = "获取本周相关有效视频列表")
+    @PostMapping(value = "/getWeekEffiVideoList")
+    public Result<List<MaterialInfo>> getWeekEffiVideoList(@RequestBody PerformanceTimeDTO dto,
+                                                       HttpServletRequest req) {
+        Result<List<MaterialInfo>> result = new Result<>();
+        String userId = dto.getUserId();
+        String startDate = dto.getStartDate();
+        String endDate = dto.getEndDate();
+        Integer appType = dto.getAppType();
+        if(userId==null || appType == null){
+            result.setSuccess(false);
+            result.setMessage("userId和appType不能为空");
+        }
+        List<MaterialInfo> materialInfoList = performanceService.getEffiWeekVideoList(appType, startDate, endDate, userId);
+        result.setSuccess(true);
+        result.setResult(materialInfoList);
+        return result;
+    }
+
     //快手优化季度绩效报表
     //List<UserDto2> kuaishouYouhuaQuarterReport(Integer year, Integer quarter);
     @AutoLog(value = "快手优化季度绩效报表")

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

@@ -90,6 +90,8 @@ public interface IPerformanceService2 extends IService<Performance> {
     //获取有效视频列表
     List<MaterialInfo> effiVideoList(Integer appType, Integer year, Integer quarter, String userId);
 
+    List<MaterialInfo> getEffiWeekVideoList(Integer appType, String startDate, String endDate, String userId);
+
     //获取快手优化师绩效实时数据
     List<UserDto2> kuaishouYouhuaPerformanceInfoNow();
 

+ 35 - 19
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java

@@ -1628,10 +1628,10 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
     public List<UserDto2> kuaishouPerformanceInfoNow() {
         //0 获取当前季度的时间
         Map<String, Integer> dateMap = DateUtils.getYearQuarter(new Date());
-        //Integer year = dateMap.get("year");
-        //Integer quarter = dateMap.get("quarter");
-        int year = 2019;
-        int quarter = 4;
+        Integer year = dateMap.get("year");
+        Integer quarter = dateMap.get("quarter");
+        //int year = 2019;
+        //int quarter = 4;
         Map<String, String> timeMap = DateUtils.quarterStartEndDate(year, quarter);
         String startTime = timeMap.get("startDate");
         String endTime = timeMap.get("endDate");
@@ -1670,10 +1670,10 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
     public List<UserDto2> kuaishouYouhuaPerformanceInfoNow() {
         //0 获取当前季度的时间
         Map<String, Integer> dateMap = DateUtils.getYearQuarter(new Date());
-        //Integer year = dateMap.get("year");
-        //Integer quarter = dateMap.get("quarter");
-        int year = 2019;
-        int quarter = 4;
+        Integer year = dateMap.get("year");
+        Integer quarter = dateMap.get("quarter");
+        //int year = 2019;
+        //int quarter = 4;
         Map<String, String> timeMap = DateUtils.quarterStartEndDate(year, quarter);
         String startTime = timeMap.get("startDate");
         String endTime = timeMap.get("endDate");
@@ -1698,16 +1698,16 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
     public List<UserDto2> toutiaoYouhuaPerformanceInfoNow() {
         //0 获取当前季度的时间
         Map<String, Integer> dateMap = DateUtils.getYearQuarter(new Date());
-        //Integer year = dateMap.get("year");
-        //Integer quarter = dateMap.get("quarter");
-        int year = 2019;
-        int quarter = 4;
+        Integer year = dateMap.get("year");
+        Integer quarter = dateMap.get("quarter");
+        //int year = 2019;
+        //int quarter = 4;
         Map<String, String> timeMap = DateUtils.quarterStartEndDate(year, quarter);
         String startTime = timeMap.get("startDate");
         String endTime = timeMap.get("endDate");
 
-        //1 获取快手下所有人
-        List<UserDto2> userDto2List = userEfficientVideoMapMapper.getKuaishouYunyingDepartUserInfo();
+        //1 获取头条下所有优化师
+        List<UserDto2> userDto2List = userEfficientVideoMapMapper.getToutiaoYunyingDepartUserInfo();
         //2 循环所有人,并查询出每个人的有效视频数、总视频数、总消耗
         for (UserDto2 userDto : userDto2List) {
             BigDecimal cost = null;
@@ -1895,7 +1895,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         String endTime = timeMap.get("endDate");
 
         //1 获取快手下所有人
-        List<UserDto2> userDto2List = userEfficientVideoMapMapper.getKuaishouDepartUserInfo();
+        List<UserDto2> userDto2List = userEfficientVideoMapMapper.getKuaishouDepartAllUserInfo();
         //2 循环所有人,并查询出每个人的有效视频数、总视频数、总消耗
         for (UserDto2 userDto : userDto2List) {
             //String roleCode = userDto.getRoleCode();
@@ -1910,7 +1910,9 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             }
             //2.4 当季度绩效
             BigDecimal performance = userEfficientVideoMapMapper.getQuarterPerformance(userDto.getUserId(), year, quarter, 2);
-
+            if(performance==null){
+                performance=BigDecimal.ZERO;
+            }
             userDto.setEffiRate(performance);
             userDto.setCost(cost);
             userDto.setVideoCount(videoCount);
@@ -1928,7 +1930,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         String endTime = timeMap.get("endDate");
 
         //1 获取头条下所有人
-        List<UserDto2> userDto2List = userEfficientVideoMapMapper.getToutiaoDepartUserInfo();
+        List<UserDto2> userDto2List = userEfficientVideoMapMapper.getToutiaoDepartAllUserInfo();
         //2 循环所有人,并查询出每个人的有效视频数、总视频数、总消耗
         for (UserDto2 userDto : userDto2List) {
             //String roleCode = userDto.getRoleCode();
@@ -1943,7 +1945,9 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             }
             //2.4 当季度绩效
             BigDecimal performance = userEfficientVideoMapMapper.getQuarterPerformance(userDto.getUserId(), year, quarter, 1);
-
+            if(performance==null){
+                performance=BigDecimal.ZERO;
+            }
             userDto.setEffiRate(performance);
             userDto.setCost(cost);
             userDto.setVideoCount(videoCount);
@@ -1963,8 +1967,14 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         return materialInfoList;
     }
 
+    //根据userid,appType,年度,季度查询有效视频列表
+    public List<MaterialInfo> getEffiWeekVideoList(Integer appType, String startDate, String endDate, String userId){
+        List<MaterialInfo> materialInfoList = userEfficientVideoMapMapper.getEffiWeekVideoList(appType, startDate, endDate, userId);
+        return materialInfoList;
+    }
+
     //快手优化季度绩效报表
-    //@Override
+    @Override
     public List<UserDto2> kuaishouYouhuaQuarterReport(Integer year, Integer quarter) {
         //1 获取快手下所有人
         List<UserDto2> userDto2List = userEfficientVideoMapMapper.getKuaishouYunyingDepartUserInfo();
@@ -1977,6 +1987,9 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             }
             //当季度绩效
             BigDecimal performance = userEfficientVideoMapMapper.getQuarterPerformance(userDto.getUserId(), year, quarter, 2);
+            if(performance==null){
+                performance=BigDecimal.ZERO;
+            }
             userDto.setEffiRate(performance);
             userDto.setCost(cost);
             userDto.setYear(year);
@@ -2000,6 +2013,9 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             }
             //当季度绩效
             BigDecimal performance = userEfficientVideoMapMapper.getQuarterPerformance(userDto.getUserId(), year, quarter, 1);
+            if(performance==null){
+                performance=BigDecimal.ZERO;
+            }
             userDto.setEffiRate(performance);
             userDto.setCost(cost);
             userDto.setYear(year);

+ 0 - 228
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -1,245 +1,17 @@
 package org.jeecg;
 
-import cn.com.ctop.bytedance.entity.BytedancePlanDailyReport;
-import cn.com.ctop.bytedance.service.IBytedancePlanDailyReportService;
-import cn.com.ctop.bytedance.service.IReportService;
-import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.entity.UserAllocation;
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.service.IUserAllocationService;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.crawler.modules.appium.service.IAppiumJobService;
-import cn.com.ctop.toutiao.service.IByteDanceAdvertiserDataService;
-import cn.com.ctop.toutiao.service.IByteDanceCreativeService;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.util.DateUtils;
-import org.jeecg.modules.mq.Sender;
-import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-
 @RunWith(SpringRunner.class)
 @SpringBootTest
 @Slf4j
 public class SampleTest {
     @Value("${jeecg.path.chrome-driver}")
     private String chromeDriver;
-    @Autowired
-    private IAppiumJobService jobService;
-
-    @Test
-    public void testMq() {
-        Sender sender = new Sender();
-        sender.send();
-    }
-    @Autowired
-    private ICtopOauthTokenService tokenService;
-    @Autowired
-    private IReportService reportService;
-
-    @Test
-    public void getYddData()throws Exception{
-        String dateString = "2020-01-06";
-        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date getDate = dateFormat.parse(dateString);
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
-            log.info("定时获取头条数据异常:为获取到可用的token");
-            return;
-        }
-//        tokens.forEach(token -> {
-//            reportService.getAdvertiserPlanReport(token,getDate,getDate,CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-//        });
-
-        //清洗关于缘多多数据
-        //1:查询缘多多相关的用户数据
-        QueryWrapper<UserAllocation> yddWrapper = new QueryWrapper<>();
-        yddWrapper.eq("project_id",113);
-        List<UserAllocation> yddallocations = userAllocationService.list(yddWrapper);
-        if(null!=yddallocations&&yddallocations.size()>0){
-            yddallocations.forEach(allocation->{
-                //根据accountId和时间,查询相关的日报表信息
-                QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
-                queryWrapper.eq("advertiser_id",allocation.getAccountId())
-                        //.eq("stat_datetime",dateString)
-                ;
-                List<BytedancePlanDailyReport>bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
-                if(null!=bytedancePlanDailyReports&&bytedancePlanDailyReports.size()>0){
-                    bytedancePlanDailyReports.forEach(report->{
-                        String adName = report.getAdName();
-                        String[] tags = adName.split("-");
-                        report.setChannelCode(tags[0]);
-                        planDailyReportService.updateById(report);
-                    });
-                }
-            });
-        }
-
-        //清洗关于缘多多数据
-        //1:查询缘多多相关的用户数据
-        QueryWrapper<UserAllocation> dsjyWrapper = new QueryWrapper<>();
-        yddWrapper.eq("project_id",112);
-        List<UserAllocation> dsjyAllocations = userAllocationService.list(dsjyWrapper);
-        if(null!=dsjyAllocations&&dsjyAllocations.size()>0){
-            dsjyAllocations.forEach(allocation->{
-                //根据accountId和时间,查询相关的日报表信息
-                QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
-                queryWrapper.eq("advertiser_id",allocation.getAccountId())
-                //.eq("stat_datetime",dateString)
-                ;
-                List<BytedancePlanDailyReport>bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
-                if(null!=bytedancePlanDailyReports&&bytedancePlanDailyReports.size()>0){
-                    bytedancePlanDailyReports.forEach(report->{
-                        String adName = report.getAdName();
-                        String[] tags = adName.split("-");
-                        report.setChannelCode(tags[0]);
-                        planDailyReportService.updateById(report);
-                    });
-                }
-            });
-        }
-
-        //清洗关于缘多多数据
-        //1:查询缘多多相关的用户数据
-        QueryWrapper<UserAllocation> fjyhWrapper = new QueryWrapper<>();
-        yddWrapper.eq("project_id",222);
-        List<UserAllocation> fjyhAllocations = userAllocationService.list(fjyhWrapper);
-        if(null!=fjyhAllocations&&fjyhAllocations.size()>0){
-            fjyhAllocations.forEach(allocation->{
-                //根据accountId和时间,查询相关的日报表信息
-                QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
-                queryWrapper.eq("advertiser_id",allocation.getAccountId())
-                //.eq("stat_datetime",dateString)
-                ;
-                List<BytedancePlanDailyReport>bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
-                if(null!=bytedancePlanDailyReports&&bytedancePlanDailyReports.size()>0){
-                    bytedancePlanDailyReports.forEach(report->{
-                        String adName = report.getAdName();
-                        String[] tags = adName.split("-");
-                        report.setChannelCode(tags[0]);
-                        planDailyReportService.updateById(report);
-                    });
-                }
-            });
-        }
-    }
-    @Test
-    public void getZybBytedancePlanReport(){
-
-//        Date getDate = DateUtils.addDay(new Date(), -1);
-        Date getDate = new Date();
-        //1:查询作业帮相关的用户数据
-        QueryWrapper<UserAllocation> wrapper = new QueryWrapper<>();
-        wrapper.eq("project_id",215);
-        List<UserAllocation> allocations = userAllocationService.list(wrapper);
-        if(null!=allocations){
-            allocations.forEach(allocation->{
-                CtopOauthToken token = tokenService.getOauthTokenByAccountId(allocation.getAccountId()+"");
-                //3:获取广告计划信息数据
-                reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-            });
-        }
-
-        //清洗关于作业帮数据
-        if(null!=allocations&&allocations.size()>0){
-            allocations.forEach(allocation->{
-                //根据accountId和时间,查询相关的日报表信息
-                QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
-                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-                String dateString = dateFormat.format(getDate)+" 00:00:00";
-                queryWrapper.eq("advertiser_id",allocation.getAccountId())
-//                        .eq("stat_datetime",dateString)
-                ;
-                List<BytedancePlanDailyReport>bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
-                if(null!=bytedancePlanDailyReports&&bytedancePlanDailyReports.size()>0){
-                    bytedancePlanDailyReports.forEach(report->{
-                        String adName = report.getAdName();
-                        String[] tags = adName.split("-");
-                        report.setAdsense(tags[1]);
-                        report.setPlanCode(tags[2]);
-                        String tag = tags[3];
-                        if(tag.contains("其他")){
-                            report.setMaterialType("其他");
-                        }else if (tag.contains("图片轮播")){
-                            report.setMaterialType("图片轮播");
-                        }else if(tag.contains("大字报")){
-                            report.setMaterialType("大字报");
-                        }else if(tag.contains("文字动画")){
-                            report.setMaterialType("文字动画");
-                        }else if(tag.contains("采访形式")){
-                            report.setMaterialType("采访形式");
-                        }else if(tag.contains("剧情")){
-                            report.setMaterialType("剧情");
-                        }else if(tag.contains("口播")){
-                            report.setMaterialType("口播");
-                        }else{
-                            report.setMaterialType("其他");
-                        }
-                        planDailyReportService.updateById(report);
-                    });
-                }
-            });
-        }
-    }
-
-    @Test
-    public void getByteDanceCreativeDate()throws Exception{
-        String dateString = "2020-01-06";
-        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date getDate = dateFormat.parse(dateString);
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
-            log.info("定时获取头条数据异常:为获取到可用的token");
-            return;
-        }
-        tokens.forEach(token -> {
-            //3:获取广告计划信息数据
-//            creativeService.getAdvertiserCreative(token.getAccountId() + "", "", null);
-            //2:获取全量素材数据
-//            advertiserDataService.getMaterialList(token);
-            reportService.getAdvertiserPlanReport(token,getDate,getDate,CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-        });
-    }
-
-    @Autowired
-    private IByteDanceAdvertiserDataService advertiserDataService;
-    @Autowired
-    private IByteDanceCreativeService creativeService;
-
-    @Test
-    public void getBytedancePlanHourReport(){
-        Date getDate = DateUtils.addDay(new Date(), -1);
-        //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
-            log.info("定时获取头条数据异常:为获取到可用的token");
-            return;
-        }
-        tokens.forEach(token -> {
-            //3:获取广告计划信息数据
-            advertiserDataService.getAdvertiserPlan(token, "", null, null);
-        });
-    }
-
-    @Test
-    public void loadRegistOrderData(){
-
-    }
-
-    @Autowired
-    private IUserAllocationService userAllocationService;
-
-    @Autowired
-    private IBytedancePlanDailyReportService planDailyReportService;
-
 }
 
 

+ 7 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.common.module.entity;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -129,4 +130,10 @@ public class MaterialInfo {
     @TableField(exist = false)
     private Integer toutiaoVideoIsUp;  //判断是否已经同步到头条平台0否_1是
 
+    @TableField(exist = false)
+    private JSONObject byteDance;
+
+    @TableField(exist = false)
+    private JSONObject kuaiShou;
+
 }

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

@@ -1,6 +1,7 @@
 package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.MaterialInfo;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -21,7 +22,9 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
 
     String getRoleCodeByUserId(@Param("userId") String userId);
 
-    Integer getKuaishouUpVideoCount(@Param("code")String code);
+    Integer getKuaishouUpVideoCount(@Param("code") String code);
 
-    Integer getToutiaoUpVideoCount(@Param("code")String code);
+    Integer getToutiaoUpVideoCount(@Param("code") String code);
+
+    JSONObject getGeneralizationInfo(@Param("code") String code);
 }

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

@@ -58,4 +58,33 @@
         v.signature = #{code}
     </select>
 
+
+    <select id="getGeneralizationInfo" resultType="com.alibaba.fastjson.JSONObject">
+     SELECT
+	 SUM(t.cost) cost,
+	 SUM(t.photoShow) photoShow,
+	 SUM(t.photoClick) photoClick
+      FROM
+	 (
+		SELECT
+		cost cost,
+        show_num photoShow,
+        click photoClick
+		FROM
+		ctop_bytedance_clean_material_report
+		WHERE
+		id = #{code}
+		UNION ALL
+		SELECT
+		charge cost,
+        photo_show photoShow,
+        photo_click photoClick
+		FROM
+		ctop_kuaishou_clean_material_report
+		WHERE
+		id = #{code}
+	  )t
+    </select>
+
+
 </mapper>

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

@@ -38,4 +38,6 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
     Integer getKuaishouUpVideoCount(@Param("code")String code);
 
     Integer getToutiaoUpVideoCount(@Param("code")String code);
+
+    JSONObject getGeneralizationInfo(String code);
 }

+ 11 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -422,4 +422,15 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     public Integer getToutiaoUpVideoCount(String code) {
         return materialInfoMapper.getToutiaoUpVideoCount(code);
     }
+
+
+    /**
+     * 获取素材概括信息
+     * @param code
+     * @return
+     */
+    @Override
+    public JSONObject getGeneralizationInfo(String code) {
+        return materialInfoMapper.getGeneralizationInfo(code);
+    }
 }

+ 4 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java

@@ -68,6 +68,8 @@ public class HttpUtils {
             client = HttpClientBuilder.create().build();
             httpEntity.setURI(URI.create(url));
             httpEntity.setEntity(new StringEntity(params.toJSONString(), ContentType.APPLICATION_JSON));
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(12000).setConnectTimeout(12000).build();
+            httpEntity.setConfig(requestConfig);
             response = client.execute(httpEntity);
             if (response != null && response.getStatusLine().getStatusCode() == 200) {
                 BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
@@ -105,6 +107,8 @@ public class HttpUtils {
         try {
             client = HttpClientBuilder.create().build();
             httpEntity.setEntity(new StringEntity(params.toJSONString(), ContentType.APPLICATION_JSON));
+            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(12000).setConnectTimeout(12000).build();
+            httpEntity.setConfig(requestConfig);
             response = client.execute(httpEntity);
             if (response != null && response.getStatusLine().getStatusCode() == 200) {
                 BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));

+ 2 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/service/IAppiumJobService.java

@@ -18,6 +18,8 @@ public interface IAppiumJobService extends IService<AppiumJob> {
 
     boolean bindCreative(String account, String password, String creativeName, String ksId);
 
+    void loadTantanData();
+
     boolean refreshWebPhone();
 
     void updateStatus(AppiumDevice appiumDevice, AppiumTaskLog log, Integer logStatus, Integer deviceStatus);

+ 48 - 3
module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/service/impl/AppiumJobServiceImpl.java

@@ -10,12 +10,12 @@ import cn.com.ctop.crawler.modules.appium.mapper.AppiumTaskLogMapper;
 import cn.com.ctop.crawler.modules.appium.mapper.AppiumTaskMapper;
 import cn.com.ctop.crawler.modules.appium.service.IAppiumDeviceService;
 import cn.com.ctop.crawler.modules.appium.service.IAppiumJobService;
-import cn.com.ctop.crawler.modules.appium.service.IAppiumTaskService;
 import cn.com.ctop.crawler.modules.core.util.AppiumUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import io.appium.java_client.android.AndroidDriver;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.impl.client.BasicCookieStore;
+import org.jeecg.common.util.DateUtils;
 import org.openqa.selenium.By;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -152,8 +153,52 @@ public class AppiumJobServiceImpl extends ServiceImpl<AppiumJobMapper, AppiumJob
         return isBind;
     }
 
-    @Autowired
-    private IAppiumTaskService appiumTaskService;
+    public static final String GET_AGENT_DATA_URL = "https://marketing.tantanapp.com/platform/ad_statistic/channel_report/table?level=agent&interval=hour&";
+
+    @Override
+    public void loadTantanData() {
+        String url = "https://marketing.tantanapp.com/login";
+        System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
+        ChromeOptions chromeOptions = new ChromeOptions();
+//        chromeOptions.addArguments("--headless");
+        chromeOptions.addArguments("--incognito");
+        chromeOptions.addArguments("--disable-gpu");
+        chromeOptions.addArguments("--no-sandbox");
+        chromeOptions.addArguments("--window-size=1920,1080");
+        chromeOptions.addArguments("--user-agent=" + HttpUtils2.USER_AGENT);
+        chromeOptions.setAcceptInsecureCerts(true);
+        WebDriver webDriver = new ChromeDriver(chromeOptions);
+        try {
+            HttpUtils2.cookieStore = new BasicCookieStore();
+            webDriver.manage().deleteAllCookies();
+            //获取登录页面
+            webDriver.get(url);
+            Thread.sleep(1000L);
+            WebElement accountElement = webDriver.findElement(By.xpath("//input[@class='form-control user_name']"));
+            accountElement.sendKeys("huichuang");
+            Thread.sleep(1000L);
+            WebElement passwordElement = webDriver.findElement(By.xpath("//input[@class='form-control user_password']"));
+            passwordElement.sendKeys("2PitTUSFG7AgBWVfbnIC");
+            WebElement loginElement = webDriver.findElement(By.xpath("//button[@class='btn btn-primary block full-width m-b user_button']"));
+            Thread.sleep(2000L);
+            //点击登录
+            loginElement.click();
+            Thread.sleep(2000L);
+            String nowDate = DateUtils.formatDate(new Date());
+            String stDate = nowDate + " 00:00:00";
+            String etDate = nowDate + " 23:59:59";
+            webDriver.get(GET_AGENT_DATA_URL + "st=" + stDate + "&et=" + etDate);
+            Thread.sleep(1000L);
+            String getData = webDriver.findElement(By.xpath("//pre[@style='word-wrap: break-word; white-space: pre-wrap;']")).getText();
+            System.out.println(getData);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("爬取代理商数据异常");
+        } finally {
+            webDriver.manage().deleteAllCookies();
+            webDriver.close();
+        }
+    }
 
     @Override
     public boolean refreshWebPhone() {

+ 161 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/entity/KuaishouEffectAdInfo.java

@@ -0,0 +1,161 @@
+package cn.com.ctop.crawler.modules.kuaishoucce.entity;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 快手效果广告信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-02
+ */
+@Data
+@TableName("kuaishou_effect_ad_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "kuaishou_effect_ad_info对象", description = "快手效果广告信息")
+public class KuaishouEffectAdInfo {
+    @TableId()
+    private Long id;
+    /**
+     * mainMvUrl
+     */
+    @Excel(name = "mainMvUrl", width = 15)
+    @ApiModelProperty(value = "mainMvUrl")
+    private String mainMvUrl;
+    /**
+     * coverThumbnailUrl
+     */
+    @Excel(name = "coverThumbnailUrl", width = 15)
+    @ApiModelProperty(value = "coverThumbnailUrl")
+    private String coverThumbnailUrl;
+    /**
+     * photoId
+     */
+    @Excel(name = "photoId", width = 15)
+    @ApiModelProperty(value = "photoId")
+    private Long photoId;
+    /**
+     * width
+     */
+    @Excel(name = "width", width = 15)
+    @ApiModelProperty(value = "width")
+    private Integer width;
+    /**
+     * height
+     */
+    @Excel(name = "height", width = 15)
+    @ApiModelProperty(value = "height")
+    private Integer height;
+    /**
+     * videoDuration
+     */
+    @Excel(name = "videoDuration", width = 15)
+    @ApiModelProperty(value = "videoDuration")
+    private Integer videoDuration;
+    /**
+     * adminTime
+     */
+    @Excel(name = "adminTime", width = 15)
+    @ApiModelProperty(value = "adminTime")
+    private Long adminTime;
+    /**
+     * likeRatio
+     */
+    @Excel(name = "likeRatio", width = 15)
+    @ApiModelProperty(value = "likeRatio")
+    private java.math.BigDecimal likeRatio;
+    /**
+     * likeCount
+     */
+    @Excel(name = "likeCount", width = 15)
+    @ApiModelProperty(value = "likeCount")
+    private Long likeCount;
+    /**
+     * timeGrowthRatio
+     */
+    @Excel(name = "timeGrowthRatio", width = 15)
+    @ApiModelProperty(value = "timeGrowthRatio")
+    private java.math.BigDecimal timeGrowthRatio;
+    /**
+     * theme
+     */
+    @Excel(name = "theme", width = 15)
+    @ApiModelProperty(value = "theme")
+    private String theme;
+    /**
+     * text
+     */
+    @Excel(name = "text", width = 15)
+    @ApiModelProperty(value = "text")
+    private String text;
+    /**
+     * caption
+     */
+    @Excel(name = "caption", width = 15)
+    @ApiModelProperty(value = "caption")
+    private String caption;
+    /**
+     * source
+     */
+    @Excel(name = "source", width = 15)
+    @ApiModelProperty(value = "source")
+    private String source;
+    /**
+     * bannerUrl
+     */
+    @Excel(name = "bannerUrl", width = 15)
+    @ApiModelProperty(value = "bannerUrl")
+    private String bannerUrl;
+    /**
+     * majorIndustryName
+     */
+    @Excel(name = "majorIndustryName", width = 15)
+    @ApiModelProperty(value = "majorIndustryName")
+    private String majorIndustryName;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+
+    public KuaishouEffectAdInfo() {
+    }
+
+    public KuaishouEffectAdInfo(JSONObject data) {
+        this.id = data.getLong("contentId");
+        this.mainMvUrl = data.getJSONArray("mainMvUrls").getJSONObject(0).getString("url");
+        this.coverThumbnailUrl = data.getJSONArray("coverThumbnailUrls").getJSONObject(0).getString("url");
+        this.photoId = data.getLong("photoId");
+        this.width = data.getInteger("width");
+        this.height = data.getInteger("height");
+        this.videoDuration = data.getInteger("videoDuration");
+        this.adminTime = data.getLong("adminTime");
+        this.likeRatio = data.getBigDecimal("likeRatio");
+        this.likeCount = data.getLong("likeCount");
+        this.timeGrowthRatio = data.getBigDecimal("timeGrowthRatio");
+        this.theme = data.getString("theme");
+        this.text = data.getString("text");
+        this.caption = data.getString("caption");
+        this.source = data.getString("source");
+        this.bannerUrl = data.getString("bannerUrl");
+        this.majorIndustryName = data.getString("majorIndustryName");
+        this.createTime = new Date();
+        this.updateTime = new Date();
+    }
+}

+ 140 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/entity/KuaishouHotPhotoInfo.java

@@ -0,0 +1,140 @@
+package cn.com.ctop.crawler.modules.kuaishoucce.entity;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 快手热门作品信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-03
+ */
+@Data
+@TableName("kuaishou_hot_photo_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "kuaishou_hot_photo_info对象", description = "快手热门作品信息")
+public class KuaishouHotPhotoInfo {
+
+    /**
+     * photoId
+     */
+    @Excel(name = "photoId", width = 15)
+    @ApiModelProperty(value = "photoId")
+    @TableId
+    private Long id;
+    /**
+     * mainMvUrl
+     */
+    @Excel(name = "mainMvUrl", width = 15)
+    @ApiModelProperty(value = "mainMvUrl")
+    private String mainMvUrl;
+    /**
+     * coverThumbnailUrl
+     */
+    @Excel(name = "coverThumbnailUrl", width = 15)
+    @ApiModelProperty(value = "coverThumbnailUrl")
+    private String coverThumbnailUrl;
+    /**
+     * width
+     */
+    @Excel(name = "width", width = 15)
+    @ApiModelProperty(value = "width")
+    private Integer width;
+    /**
+     * height
+     */
+    @Excel(name = "height", width = 15)
+    @ApiModelProperty(value = "height")
+    private Integer height;
+    /**
+     * videoDuration
+     */
+    @Excel(name = "videoDuration", width = 15)
+    @ApiModelProperty(value = "videoDuration")
+    private Integer videoDuration;
+    /**
+     * playingTime
+     */
+    @Excel(name = "playingTime", width = 15)
+    @ApiModelProperty(value = "playingTime")
+    private Integer playingTime;
+    /**
+     * likeTime
+     */
+    @Excel(name = "likeTime", width = 15)
+    @ApiModelProperty(value = "likeTime")
+    private Integer likeTime;
+    /**
+     * commentTime
+     */
+    @Excel(name = "commentTime", width = 15)
+    @ApiModelProperty(value = "commentTime")
+    private Integer commentTime;
+    /**
+     * headUrl
+     */
+    @Excel(name = "headUrl", width = 15)
+    @ApiModelProperty(value = "headUrl")
+    private String headUrl;
+    /**
+     * nickName
+     */
+    @Excel(name = "nickName", width = 15)
+    @ApiModelProperty(value = "nickName")
+    private String nickName;
+    /**
+     * caption
+     */
+    @Excel(name = "caption", width = 15)
+    @ApiModelProperty(value = "caption")
+    private String caption;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+
+    public KuaishouHotPhotoInfo() {
+    }
+
+    public KuaishouHotPhotoInfo(JSONObject data) {
+        this.id = data.getLong("photoId");
+        this.mainMvUrl = data.getJSONArray("mainMvUrls").getJSONObject(0).getString("url");
+        this.coverThumbnailUrl = data.getJSONArray("coverThumbnailUrls").getJSONObject(0).getString("url");
+        this.width = data.getInteger("width");
+        this.height = data.getInteger("height");
+        ;
+        this.videoDuration = data.getInteger("videoDuration");
+        ;
+        this.playingTime = data.getInteger("playingTimes");
+        ;
+        this.likeTime = data.getInteger("likeTimes");
+        ;
+        this.commentTime = data.getInteger("commentTimes");
+        ;
+        this.headUrl = data.getJSONArray("headUrls").getJSONObject(0).getString("url");
+        ;
+        this.nickName = data.getString("nickName");
+        ;
+        this.caption = data.getString("caption");
+        ;
+        this.createTime = new Date();
+        this.updateTime = new Date();
+    }
+}

+ 120 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/entity/KuaishouInspiredAd.java

@@ -0,0 +1,120 @@
+package cn.com.ctop.crawler.modules.kuaishoucce.entity;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 快手创意视频
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-03
+ */
+@Data
+@TableName("kuaishou_inspired_ad")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "kuaishou_inspired_ad对象", description = "快手创意视频")
+public class KuaishouInspiredAd {
+
+    /**
+     * id
+     */
+    @TableId
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * mainMvUrl
+     */
+    @Excel(name = "mainMvUrl", width = 15)
+    @ApiModelProperty(value = "mainMvUrl")
+    private String mainMvUrl;
+    /**
+     * coverThumbnailUrl
+     */
+    @Excel(name = "coverThumbnailUrl", width = 15)
+    @ApiModelProperty(value = "coverThumbnailUrl")
+    private String coverThumbnailUrl;
+    /**
+     * width
+     */
+    @Excel(name = "width", width = 15)
+    @ApiModelProperty(value = "width")
+    private Integer width;
+    /**
+     * height
+     */
+    @Excel(name = "height", width = 15)
+    @ApiModelProperty(value = "height")
+    private Integer height;
+    /**
+     * videoDuration
+     */
+    @Excel(name = "videoDuration", width = 15)
+    @ApiModelProperty(value = "videoDuration")
+    private Long videoDuration;
+    /**
+     * headUrl
+     */
+    @Excel(name = "headUrl", width = 15)
+    @ApiModelProperty(value = "headUrl")
+    private String headUrl;
+    /**
+     * firstIndustryName
+     */
+    @Excel(name = "firstIndustryName", width = 15)
+    @ApiModelProperty(value = "firstIndustryName")
+    private String firstIndustryName;
+    /**
+     * nickName
+     */
+    @Excel(name = "nickName", width = 15)
+    @ApiModelProperty(value = "nickName")
+    private String nickName;
+    /**
+     * caption
+     */
+    @Excel(name = "caption", width = 15)
+    @ApiModelProperty(value = "caption")
+    private String caption;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+
+    public KuaishouInspiredAd() {
+    }
+
+    public KuaishouInspiredAd(JSONObject data) {
+        this.id = data.getLong("photoId");
+        this.mainMvUrl = data.getJSONArray("mainMvUrls").getJSONObject(0).getString("url");
+        this.coverThumbnailUrl = data.getJSONArray("coverThumbnailUrls").getJSONObject(0).getString("url");
+        ;
+        this.width = data.getInteger("width");
+        this.height = data.getInteger("height");
+        this.videoDuration = data.getLong("videoDuration");
+        this.headUrl = data.getJSONArray("headUrls").getJSONObject(0).getString("url");
+        ;
+        ;
+        this.firstIndustryName = data.getString("firstIndustryName");
+        this.nickName = data.getString("nickName");
+        this.caption = data.getString("caption");
+        this.createTime = new Date();
+        this.updateTime = new Date();
+    }
+}

+ 19 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/mapper/KuaishouEffectAdInfoMapper.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.crawler.modules.kuaishoucce.mapper;
+
+import cn.com.ctop.crawler.modules.kuaishoucce.entity.KuaishouEffectAdInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 快手效果广告信息
+ *
+ * @author: jeecg-boot
+ * @date: 2020-03-02
+ * @cersion: V1.0
+ */
+public interface KuaishouEffectAdInfoMapper extends BaseMapper<KuaishouEffectAdInfo> {
+
+    void replaceBatch(@Param(value = "adInfos") List<KuaishouEffectAdInfo> adInfos);
+}

+ 19 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/mapper/KuaishouHotPhotoInfoMapper.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.crawler.modules.kuaishoucce.mapper;
+
+import cn.com.ctop.crawler.modules.kuaishoucce.entity.KuaishouHotPhotoInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 快手热门作品信息
+ *
+ * @author: jeecg-boot
+ * @date: 2020-03-03
+ * @cersion: V1.0
+ */
+public interface KuaishouHotPhotoInfoMapper extends BaseMapper<KuaishouHotPhotoInfo> {
+
+    void replaceBatch(@Param(value = "photoInfos") List<KuaishouHotPhotoInfo> photoInfos);
+}

+ 19 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/mapper/KuaishouInspiredAdMapper.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.crawler.modules.kuaishoucce.mapper;
+
+import cn.com.ctop.crawler.modules.kuaishoucce.entity.KuaishouInspiredAd;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 快手创意视频
+ *
+ * @author: jeecg-boot
+ * @date: 2020-03-03
+ * @cersion: V1.0
+ */
+public interface KuaishouInspiredAdMapper extends BaseMapper<KuaishouInspiredAd> {
+
+    void replaceBatch(@Param(value = "ads") List<KuaishouInspiredAd> ads);
+}

+ 52 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/mapper/xml/KuaishouEffectAdInfoMapper.xml

@@ -0,0 +1,52 @@
+<?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.crawler.modules.kuaishoucce.mapper.KuaishouEffectAdInfoMapper">
+
+    <insert id="replaceBatch">
+        replace into kuaishou_effect_ad_info(
+        id,
+        main_mv_url,
+        cover_thumbnail_url,
+        photo_id,
+        width,
+        height,
+        video_duration,
+        admin_time,
+        like_ratio,
+        like_count,
+        time_growth_ratio,
+        theme,
+        text,
+        caption,
+        source,
+        banner_url,
+        major_industry_name,
+        create_time,
+        update_time
+        )
+        values
+        <foreach collection="adInfos" item="ad" separator=",">
+            (
+            #{ad.id},
+            #{ad.mainMvUrl},
+            #{ad.coverThumbnailUrl},
+            #{ad.photoId},
+            #{ad.width},
+            #{ad.height},
+            #{ad.videoDuration},
+            #{ad.adminTime},
+            #{ad.likeRatio},
+            #{ad.likeCount},
+            #{ad.timeGrowthRatio},
+            #{ad.theme},
+            #{ad.text},
+            #{ad.caption},
+            #{ad.source},
+            #{ad.bannerUrl},
+            #{ad.majorIndustryName},
+            #{ad.createTime},
+            #{ad.updateTime}
+            )
+        </foreach>
+    </insert>
+</mapper>

+ 42 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/mapper/xml/KuaishouHotPhotoInfoMapper.xml

@@ -0,0 +1,42 @@
+<?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.crawler.modules.kuaishoucce.mapper.KuaishouHotPhotoInfoMapper">
+
+    <insert id="replaceBatch">
+        replace into kuaishou_hot_photo_info(
+        id ,
+        main_mv_url ,
+        cover_thumbnail_url ,
+        width ,
+        height ,
+        video_duration ,
+        playing_time ,
+        like_time ,
+        comment_time ,
+        head_url ,
+        nick_name ,
+        caption ,
+        create_time ,
+        update_time
+        )
+        values
+        <foreach collection="photoInfos" item="photoInfo" separator=",">
+            (
+            #{photoInfo.id},
+            #{photoInfo.mainMvUrl},
+            #{photoInfo.coverThumbnailUrl},
+            #{photoInfo.width},
+            #{photoInfo.height},
+            #{photoInfo.videoDuration},
+            #{photoInfo.playingTime},
+            #{photoInfo.likeTime},
+            #{photoInfo.commentTime},
+            #{photoInfo.headUrl},
+            #{photoInfo.nickName},
+            #{photoInfo.caption},
+            #{photoInfo.createTime},
+            #{photoInfo.updateTime}
+            )
+        </foreach>
+    </insert>
+</mapper>

+ 38 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/mapper/xml/KuaishouInspiredAdMapper.xml

@@ -0,0 +1,38 @@
+<?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.crawler.modules.kuaishoucce.mapper.KuaishouInspiredAdMapper">
+
+    <insert id="replaceBatch">
+        replace into kuaishou_inspired_ad(
+        id,
+        main_mv_url,
+        cover_thumbnail_url,
+        width,
+        height,
+        video_duration,
+        head_url,
+        first_industry_name,
+        nick_name,
+        caption,
+        create_time,
+        update_time
+        )
+        values
+        <foreach collection="ads" item="ad" separator=",">
+            (
+            #{ad.id},
+            #{ad.mainMvUrl},
+            #{ad.coverThumbnailUrl},
+            #{ad.width},
+            #{ad.height},
+            #{ad.videoDuration},
+            #{ad.headUrl},
+            #{ad.firstIndustryName},
+            #{ad.nickName},
+            #{ad.caption},
+            #{ad.createTime},
+            #{ad.updateTime}
+            )
+        </foreach>
+    </insert>
+</mapper>

+ 18 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/service/IKuaishouEffectAdInfoService.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.crawler.modules.kuaishoucce.service;
+
+import cn.com.ctop.crawler.modules.kuaishoucce.entity.KuaishouEffectAdInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 快手效果广告信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-02
+ */
+public interface IKuaishouEffectAdInfoService extends IService<KuaishouEffectAdInfo> {
+
+    void replaceBatch(List<KuaishouEffectAdInfo> adInfos);
+}

+ 18 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/service/IKuaishouHotPhotoInfoService.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.crawler.modules.kuaishoucce.service;
+
+import cn.com.ctop.crawler.modules.kuaishoucce.entity.KuaishouHotPhotoInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 快手热门作品信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-03
+ */
+public interface IKuaishouHotPhotoInfoService extends IService<KuaishouHotPhotoInfo> {
+
+    void replaceBatch(List<KuaishouHotPhotoInfo> photoInfos);
+}

+ 18 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/service/IKuaishouInspiredAdService.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.crawler.modules.kuaishoucce.service;
+
+import cn.com.ctop.crawler.modules.kuaishoucce.entity.KuaishouInspiredAd;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 快手创意视频
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-03-03
+ */
+public interface IKuaishouInspiredAdService extends IService<KuaishouInspiredAd> {
+
+    void replaceBatch(List<KuaishouInspiredAd> ads);
+}

+ 28 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/service/impl/KuaishouEffectAdInfoServiceImpl.java

@@ -0,0 +1,28 @@
+package cn.com.ctop.crawler.modules.kuaishoucce.service.impl;
+
+import cn.com.ctop.crawler.modules.kuaishoucce.entity.KuaishouEffectAdInfo;
+import cn.com.ctop.crawler.modules.kuaishoucce.mapper.KuaishouEffectAdInfoMapper;
+import cn.com.ctop.crawler.modules.kuaishoucce.service.IKuaishouEffectAdInfoService;
+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-03-02
+ */
+@Service
+public class KuaishouEffectAdInfoServiceImpl extends ServiceImpl<KuaishouEffectAdInfoMapper, KuaishouEffectAdInfo> implements IKuaishouEffectAdInfoService {
+    @Autowired
+    private KuaishouEffectAdInfoMapper adInfoMapper;
+
+    @Override
+    public void replaceBatch(List<KuaishouEffectAdInfo> adInfos) {
+        adInfoMapper.replaceBatch(adInfos);
+    }
+}

+ 28 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/service/impl/KuaishouHotPhotoInfoServiceImpl.java

@@ -0,0 +1,28 @@
+package cn.com.ctop.crawler.modules.kuaishoucce.service.impl;
+
+import cn.com.ctop.crawler.modules.kuaishoucce.entity.KuaishouHotPhotoInfo;
+import cn.com.ctop.crawler.modules.kuaishoucce.mapper.KuaishouHotPhotoInfoMapper;
+import cn.com.ctop.crawler.modules.kuaishoucce.service.IKuaishouHotPhotoInfoService;
+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-03-03
+ */
+@Service
+public class KuaishouHotPhotoInfoServiceImpl extends ServiceImpl<KuaishouHotPhotoInfoMapper, KuaishouHotPhotoInfo> implements IKuaishouHotPhotoInfoService {
+    @Autowired
+    private KuaishouHotPhotoInfoMapper photoInfoMapper;
+
+    @Override
+    public void replaceBatch(List<KuaishouHotPhotoInfo> photoInfos) {
+        photoInfoMapper.replaceBatch(photoInfos);
+    }
+}

+ 28 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/kuaishoucce/service/impl/KuaishouInspiredAdServiceImpl.java

@@ -0,0 +1,28 @@
+package cn.com.ctop.crawler.modules.kuaishoucce.service.impl;
+
+import cn.com.ctop.crawler.modules.kuaishoucce.entity.KuaishouInspiredAd;
+import cn.com.ctop.crawler.modules.kuaishoucce.mapper.KuaishouInspiredAdMapper;
+import cn.com.ctop.crawler.modules.kuaishoucce.service.IKuaishouInspiredAdService;
+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-03-03
+ */
+@Service
+public class KuaishouInspiredAdServiceImpl extends ServiceImpl<KuaishouInspiredAdMapper, KuaishouInspiredAd> implements IKuaishouInspiredAdService {
+    @Autowired
+    private KuaishouInspiredAdMapper inspiredAdMapper;
+
+    @Override
+    public void replaceBatch(List<KuaishouInspiredAd> ads) {
+        inspiredAdMapper.replaceBatch(ads);
+    }
+}

+ 17 - 4
module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java

@@ -8,6 +8,7 @@ import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
 import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
 import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
 import cn.com.ctop.common.module.service.IFileInfoService;
+import cn.com.ctop.common.module.service.IMaterialParameterService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.LoadFileUtil;
@@ -64,6 +65,12 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
     private IFileInfoService fileInfoService;
     @Autowired
     private IKuaiShouImageGetService iKuaiShouImageGetService;
+    @Autowired
+    private IMaterialParameterService materialParameterService;
+    @Autowired
+    private MaterialParameterMapper parameterMapper;
+    @Autowired
+    private IKuaiShouVideoGetService kuaiShouVideoGetService;
 
 
     /**
@@ -139,10 +146,6 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
 
     }
 
-    @Autowired
-    private MaterialParameterMapper parameterMapper;
-    @Autowired
-    private IKuaiShouVideoGetService kuaiShouVideoGetService;
 
     private void kuaiShouUpload(String mediaId, JSONArray materialArray, JSONArray accountArray) {
         for (int j = 0; j < materialArray.size(); j++) {
@@ -164,6 +167,16 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                 JSONObject requestJson = new JSONObject();
                 requestJson.put("file", resource);
                 requestJson.put("signature", materialInfo.getCode());
+                QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
+                parameterQueryWrapper.eq("material_id", materialInfo.getId());
+                parameterQueryWrapper.orderByDesc("create_time").last("limit 1");
+                MaterialParameter materialParameter = materialParameterService.getOne(parameterQueryWrapper);
+                if (!Check.isNull(materialParameter)) {
+                    Integer type = MaterialEnum.getTypeBySize(Integer.valueOf(materialParameter.getWidth()), Integer.valueOf(materialParameter.getHeight()));
+                    if (!Check.isNull(type) && type != 0) {
+                        requestJson.put("type", type);
+                    }
+                }
                 for (int i = 0; i < accountArray.size(); i++) {
                     Long accountId = accountArray.getLong(i);
                     QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();

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

@@ -84,7 +84,7 @@
    unit_name
    FROM ctop_kuaishou_group
    WHERE account_id = #{accountId}
-   and deep_conversion_bid &gt; #{maxDeepCpaBid}
+   and deep_conversion_bid &gt; #{maxBid}
    group by unit_id
     </select>
 

+ 9 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -390,8 +390,14 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         headers.put("Content-Type", "application/json");
         headers.put("Access-Token", accessToken);
         Map<String, Object> param = new HashMap<String, Object>();
-        param.put("start_date", startDate);
-        param.put("end_date", endDate);
+        if (!Check.isNull(startDate)) {
+            param.put("start_date", startDate);
+        }
+
+        if (!Check.isNull(endDate)) {
+            param.put("end_date", endDate);
+        }
+
         param.put("advertiser_id", advertiserId);
         param.put("temporal_granularity", "DAILY");
         param.put("page_size", pageSize);
@@ -1435,7 +1441,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         }
         Map<String, String> headers = new HashMap<>();
         headers.put("Access-Token", token.getAccessToken());
-        headers.put("Content-Type", " application/json");
+        headers.put("Content-Type", "application/json");
 
         String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
         JSONObject resultJson = JSONObject.parseObject(result);

+ 81 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouReportDailyAgentSumController.java

@@ -8,6 +8,10 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
+import cn.com.ctop.kuaishou.modules.report.entity.ParamsDTO;
+import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.aspect.annotation.AutoLog;
@@ -48,7 +52,7 @@ import io.swagger.annotations.ApiOperation;
 public class KuaishouReportDailyAgentSumController {
 	@Autowired
 	private IKuaishouReportDailyAgentSumService kuaishouReportDailyAgentSumService;
-	
+
 	/**
 	  * 分页列表查询
 	 * @param kuaishouReportDailyAgentSum
@@ -72,7 +76,7 @@ public class KuaishouReportDailyAgentSumController {
 		result.setResult(pageList);
 		return result;
 	}
-	
+
 	/**
 	  *   添加
 	 * @param kuaishouReportDailyAgentSum
@@ -92,7 +96,7 @@ public class KuaishouReportDailyAgentSumController {
 		}
 		return result;
 	}
-	
+
 	/**
 	  *  批量删除
 	 * @param ids
@@ -111,7 +115,7 @@ public class KuaishouReportDailyAgentSumController {
 		}
 		return result;
 	}
-	
+
 	/**
 	  * 通过id查询
 	 * @param id
@@ -199,4 +203,77 @@ public class KuaishouReportDailyAgentSumController {
       return Result.ok("文件导入失败!");
   }
 
+	 /**
+	  * @param dto
+	  * @return Result<List<KuaishouReportDailyAgentSum>>
+	  */
+	 @AutoLog(value = "公司报表")
+	 @ApiOperation(value="公司报表", notes="公司报表")
+	 @PostMapping(value = "/companyReport")
+	 public Result<List<KuaishouReportDailyAgentSum>> companyReport(@RequestBody ParamsDTO dto) {
+		Result<List<KuaishouReportDailyAgentSum>> result = new Result<>();
+	 	String startDate = dto.getStartDate();
+	 	String endDate = dto.getEndDate();
+	 	if(StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
+			result.setSuccess(false);
+			result.setMessage("时间不能为空");
+	 	}
+
+		List<KuaishouReportDailyAgentSum> kuaishouReportDailyAgentSumList = kuaishouReportDailyAgentSumService.companyReport(startDate,endDate);
+	 	result.setResult(kuaishouReportDailyAgentSumList);
+	 	result.setSuccess(true);
+	 	result.setMessage("success");
+
+	 	return result;
+	 }
+
+	 /**
+	  * @param dto
+	  * @return Result<KuaishouReportDailyAgentSum>
+	  */
+	 @AutoLog(value = "公司报表按时间汇总")
+	 @ApiOperation(value="公司报表按时间汇总", notes="公司报表按时间汇总")
+	 @PostMapping(value = "/companyReportSum")
+	 public Result<KuaishouReportDailyAgentSum> companyReportSum(@RequestBody ParamsDTO dto) {
+		 Result<KuaishouReportDailyAgentSum> result = new Result<>();
+		 String startDate = dto.getStartDate();
+		 String endDate = dto.getEndDate();
+		 if(StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
+			 result.setSuccess(false);
+			 result.setMessage("时间不能为空");
+			 return result;
+		 }
+
+		 KuaishouReportDailyAgentSum kuaishouReportDailyAgentSum = kuaishouReportDailyAgentSumService.companyReportSum(startDate,endDate);
+		 result.setResult(kuaishouReportDailyAgentSum);
+		 result.setSuccess(true);
+		 result.setMessage("success");
+
+		 return result;
+	 }
+
+	 /**
+	  * @param dto
+	  * @return Result<KuaishouReportDailyAgentSum>
+	  */
+	 @AutoLog(value = "公司报表按时间汇总")
+	 @ApiOperation(value="公司报表按时间汇总", notes="公司报表按时间汇总")
+	 @PostMapping(value = "/companyReportAccountDetailList")
+	 public Result<List<KuaishouReportDailyAgent>> companyReportAccountDetailList(@RequestBody ParamsDTO dto) {
+		 Result<List<KuaishouReportDailyAgent>> result = new Result<>();
+		 String date = dto.getDate();
+		 if(StringUtils.isBlank(date)){
+			 result.setSuccess(false);
+			 result.setMessage("时间不能为空");
+			 return result;
+		 }
+
+		 List<KuaishouReportDailyAgent> kuaishouReportDailyAgentList = kuaishouReportDailyAgentSumService.companyReportAccountDetailList(date);
+		 result.setResult(kuaishouReportDailyAgentList);
+		 result.setSuccess(true);
+		 result.setMessage("success");
+
+		 return result;
+	 }
+
 }

+ 6 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAgentSum.java

@@ -27,7 +27,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
 @Accessors(chain = true)
 @ApiModel(value="ctop_kuaishou_report_daily_agent对象", description="代理商日汇总表")
 public class KuaishouReportDailyAgentSum {
-    
+
 	/**日期*/
 	@Excel(name = "日期", width = 15, format = "yyyy-MM-dd")
 	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@@ -38,7 +38,7 @@ public class KuaishouReportDailyAgentSum {
 	/**有消费计划数*/
 	@Excel(name = "有消费计划数", width = 15)
     @ApiModelProperty(value = "有消费计划数")
-	private Integer costCampaignCount;
+	private Long costCampaignCount;
 	/**总余额*/
 	@Excel(name = "总余额", width = 15)
     @ApiModelProperty(value = "总余额")
@@ -70,19 +70,19 @@ public class KuaishouReportDailyAgentSum {
 	/**封面曝光数*/
 	@Excel(name = "封面曝光数", width = 15)
     @ApiModelProperty(value = "封面曝光数")
-	private Integer fengmianShowCount;
+	private Long fengmianShowCount;
 	/**封面点击数*/
 	@Excel(name = "封面点击数", width = 15)
     @ApiModelProperty(value = "封面点击数")
-	private Integer fengmianClickCount;
+	private Long fengmianClickCount;
 	/**素材曝光数*/
 	@Excel(name = "素材曝光数", width = 15)
     @ApiModelProperty(value = "素材曝光数")
-	private Integer sucaiShowCount;
+	private Long sucaiShowCount;
 	/**行为数*/
 	@Excel(name = "行为数", width = 15)
     @ApiModelProperty(value = "行为数")
-	private Integer convertCount;
+	private Long convertCount;
 	/**封面点击率*/
 	@Excel(name = "封面点击率", width = 15)
     @ApiModelProperty(value = "封面点击率")

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

@@ -0,0 +1,13 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+@Data
+public class ParamsDTO implements Serializable {
+    private String startDate;
+    private String endDate;
+    private String date;
+}

+ 3 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/job/KuaishouReportAgentJob.java

@@ -30,10 +30,10 @@ public class KuaishouReportAgentJob implements Job {
     private IKuaishouReportDailyAgentService kuaishouReportDailyAgentService;
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-//        String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(),-1));
-//        kuaishouReportDailyAgentService.getReport(currentDate,currentDate);
+        String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(),-1));
+        kuaishouReportDailyAgentService.getReport(currentDate,currentDate);
 
-        kuaishouReportDailyAgentService.getReport("2019-01-01","2019-12-12");
+        //kuaishouReportDailyAgentService.getReport("2019-01-01","2019-12-12");
 
     }
 }

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

@@ -2,6 +2,7 @@ package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import java.util.List;
 
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum;
 import org.apache.ibatis.annotations.Param;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -13,5 +14,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @cersion: V1.0
  */
 public interface KuaishouReportDailyAgentSumMapper extends BaseMapper<KuaishouReportDailyAgentSum> {
+    List<KuaishouReportDailyAgentSum> companyReport(@Param("startDate")String startDate, @Param("endDate")String endDate);
 
+    KuaishouReportDailyAgentSum companyReportSum(@Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    List<KuaishouReportDailyAgent> companyReporAccountDetailList(@Param("date")String date);
 }

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

@@ -2,4 +2,80 @@
 <!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.KuaishouReportDailyAgentSumMapper">
 
-</mapper>
+    <!-- 公司报表sql -->
+    <select id="companyReport" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum">
+            select
+            date as date,  <!-- 日期 -->
+            cost_campaign_count as costCampaignCount,  <!-- 有消费计划数 -->
+            balance as balance,  <!-- 总余额 -->
+            cost as cost,  <!-- 总消耗 -->
+            xianjin_cost as xianjinCost,  <!-- 现金消耗 -->
+            fandian_cost as fandianCost,  <!-- 后返消耗 -->
+            kuangfan_cost as kuangfanCost,  <!-- 框返消耗 -->
+            jili_cost as jiliCost,  <!-- 激励账户消耗 -->
+            xinyong_cost as xinyongCost,  <!-- 信用账户消耗 -->
+            fengmian_show_count as fengmianShowCount,  <!-- 封面曝光数 -->
+            fengmian_click_count as fengmianClickCount,  <!-- 封面点击数 -->
+            sucai_show_count as sucaiShowCount,  <!-- 素材曝光数 -->
+            convert_count as convertCount,  <!-- 行为数 -->
+            fengmian_click_rate as fengmianClickRate,  <!-- 封面点击率 -->
+            convert_click_rate as convertClickRate  <!-- 转化点击率 -->
+        from
+        ctop_kuaishou_report_daily_agent_sum
+        where
+        date &lt;= #{endDate} and
+        date &gt;= #{startDate}
+    </select>
+
+    <select id="companyReportSum" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum">
+        select
+        sum(cost_campaign_count) as costCampaignCount,  <!-- 有消费计划数 -->
+        sum(balance) as balance,  <!-- 总余额 -->
+        sum(cost) as cost,  <!-- 总消耗 -->
+        sum(xianjin_cost) as xianjinCost,  <!-- 现金消耗 -->
+        sum(fandian_cost) as fandianCost,  <!-- 后返消耗 -->
+        sum(kuangfan_cost) as kuangfanCost,  <!-- 框返消耗 -->
+        sum(jili_cost) as jiliCost,  <!-- 激励账户消耗 -->
+        sum(xinyong_cost) as xinyongCost,  <!-- 信用账户消耗 -->
+        sum(fengmian_show_count) as fengmianShowCount,  <!-- 封面曝光数 -->
+        sum(fengmian_click_count) as fengmianClickCount,  <!-- 封面点击数 -->
+        sum(sucai_show_count) as sucaiShowCount,  <!-- 素材曝光数 -->
+        sum(convert_count) as convertCount,  <!-- 行为数 -->
+        sum(fengmian_click_rate) as fengmianClickRate,  <!-- 封面点击率 -->
+        sum(convert_click_rate) as convertClickRate  <!-- 转化点击率 -->
+        from
+        ctop_kuaishou_report_daily_agent_sum
+        where
+        date &lt;= #{endDate} and
+        date &gt;= #{startDate}
+    </select>
+
+    <!-- 根据传入时间获取公司报表账户的列表 -->
+    <select id="companyReporAccountDetailList" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent">
+            select
+            date as date,  <!-- 日期 -->
+            account_id as accountId,  <!-- 账户id -->
+            kid as kid, <!-- 快手id -->
+            advertiser_name as advertiserName, <!-- 广告主名称 -->
+            advertiser_create_time as advertiserCreateTime, <!-- 广告主创建时间 -->
+            cost_campaign_count as costCampaignCount, <!-- 有消费计划数 -->
+            balance as balance, <!-- 总余额 -->
+            cost as cost, <!-- 总消耗 -->
+            xianjin_cost as xianjinCost, <!-- 现金消耗 -->
+            fandian_cost as fandianCost, <!-- 后返消耗 -->
+            kuangfan_cost as kuangfanCost, <!-- 框返消耗 -->
+            jili_cost as jiliCost, <!-- 激励账户消耗 -->
+            xinyong_cost as xinyongCost, <!-- 信用账户消耗 -->
+            fengmian_show_count as fengmianShowCount, <!-- 封面曝光数 -->
+            fengmian_click_count as fengmianClickCount, <!-- 封面点击数 -->
+            sucai_show_count as sucaiShowCount, <!-- 素材曝光数 -->
+            convert_count as convertCount, <!-- 行为数 -->
+            fengmian_click_rate as fengmianClickRate, <!-- 封面点击率 -->
+            convert_click_rate as convertClickRate <!-- 转化点击率 -->
+        from
+        ctop_kuaishou_report_daily_agent
+        where
+        date_format(date, '%Y-%m-%d') = #{date}
+    </select>
+
+</mapper>

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

@@ -13,7 +13,6 @@
 	`creative_id`,
 	`creative_name`,
 	`stat_date`,
-	`stat_date`,
 	`stat_hour`,
 	`charge`,
 	`photo_click`,

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

@@ -1,8 +1,11 @@
 package cn.com.ctop.kuaishou.modules.report.service;
 
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * 代理商日汇总表
  * @author jeecg-boot
@@ -10,5 +13,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @version V1.0
  */
 public interface IKuaishouReportDailyAgentSumService extends IService<KuaishouReportDailyAgentSum> {
+    List<KuaishouReportDailyAgentSum> companyReport(String startDate, String endDate);
+    KuaishouReportDailyAgentSum companyReportSum(String startDate, String endDate);
 
+    List<KuaishouReportDailyAgent> companyReportAccountDetailList(String date);
 }

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

@@ -1,12 +1,16 @@
 package cn.com.ctop.kuaishou.modules.report.service.impl;
 
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAgentSumMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentSumService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import java.util.List;
+
 /**
  * 代理商日汇总表
  * @author jeecg-boot
@@ -16,4 +20,23 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 @Service
 public class KuaishouReportDailyAgentSumServiceImpl extends ServiceImpl<KuaishouReportDailyAgentSumMapper, KuaishouReportDailyAgentSum> implements IKuaishouReportDailyAgentSumService {
 
+    @Autowired
+    private KuaishouReportDailyAgentSumMapper kuaishouReportDailyAgentSumMapper;
+
+    //公司报表
+    public List<KuaishouReportDailyAgentSum> companyReport(String startDate, String endDate){
+        return kuaishouReportDailyAgentSumMapper.companyReport(startDate,endDate);
+    }
+
+    //公司报表汇总
+    public KuaishouReportDailyAgentSum companyReportSum(String startDate, String endDate){
+        return kuaishouReportDailyAgentSumMapper.companyReportSum(startDate, endDate);
+    }
+
+    //公司报表详情
+    @Override
+    public List<KuaishouReportDailyAgent> companyReportAccountDetailList(String date){
+        return kuaishouReportDailyAgentSumMapper.companyReporAccountDetailList(date);
+    }
+
 }

+ 37 - 6
module-report/src/main/java/cn/com/ctop/bytedance/controller/BytedancePlanDailyReportController.java

@@ -53,7 +53,6 @@ public class BytedancePlanDailyReportController {
      * @param bytedancePlanDailyReport
      * @param pageNo
      * @param pageSize
-     * @param req
      * @return
      */
     @AutoLog(value = "广告计划日报表信息-分页列表查询")
@@ -61,11 +60,17 @@ public class BytedancePlanDailyReportController {
     @GetMapping(value = "/list")
     public Result<IPage<BytedancePlanDailyReport>> queryPageList(BytedancePlanDailyReport bytedancePlanDailyReport,
                                                                  @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                                 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                                 HttpServletRequest req) {
-        Result<IPage<BytedancePlanDailyReport>> result = new Result<IPage<BytedancePlanDailyReport>>();
-        QueryWrapper<BytedancePlanDailyReport> queryWrapper = QueryGenerator.initQueryWrapper(bytedancePlanDailyReport, req.getParameterMap());
-        Page<BytedancePlanDailyReport> page = new Page<BytedancePlanDailyReport>(pageNo, pageSize);
+                                                                 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        Result<IPage<BytedancePlanDailyReport>> result = new Result<>();
+        QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
+        if (null != bytedancePlanDailyReport.getStatDatetime() && !"".equals(bytedancePlanDailyReport.getStatDatetime())) {
+            queryWrapper.eq("stat_datetime", bytedancePlanDailyReport.getStatDatetime().substring(1, 11) + " 00:00:00");
+        }
+        if (null != bytedancePlanDailyReport.getPlanCode() && !"".equals(bytedancePlanDailyReport.getPlanCode())) {
+            queryWrapper.eq("plan_code", bytedancePlanDailyReport.getPlanCode().replace("yk_xxl_jrtt_", ""));
+        }
+        queryWrapper.orderByDesc("stat_datetime", "order_num");
+        Page<BytedancePlanDailyReport> page = new Page<>(pageNo, pageSize);
         IPage<BytedancePlanDailyReport> pageList = bytedancePlanDailyReportService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -119,6 +124,32 @@ public class BytedancePlanDailyReportController {
     }
 
     /**
+     * 编辑
+     *
+     * @param bytedancePlanDailyReport
+     * @return
+     */
+    @AutoLog(value = "广告计划日报表信息-编辑")
+    @ApiOperation(value = "广告计划日报表信息-编辑", notes = "广告计划日报表信息-编辑")
+    @PutMapping(value = "/synZybData")
+    public Result<BytedancePlanDailyReport> synZybData(@RequestBody BytedancePlanDailyReport bytedancePlanDailyReport) {
+        Result<BytedancePlanDailyReport> result = new Result<BytedancePlanDailyReport>();
+        BytedancePlanDailyReport bytedancePlanDailyReportEntity = bytedancePlanDailyReportService.getById(bytedancePlanDailyReport.getId());
+        if (bytedancePlanDailyReportEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            bytedancePlanDailyReportEntity.setRegistNum(bytedancePlanDailyReport.getRegistNum());
+            bytedancePlanDailyReportEntity.setOrderNum(bytedancePlanDailyReport.getOrderNum());
+            boolean ok = bytedancePlanDailyReportService.updateById(bytedancePlanDailyReportEntity);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
      * 通过id删除
      *
      * @param id

+ 1 - 0
module-report/src/main/java/cn/com/ctop/bytedance/entity/BytedanceCreativeDailyReport.java

@@ -401,6 +401,7 @@ public class BytedanceCreativeDailyReport {
     private Date updateTime;
 
     private String videoUrl;
+    private String signature;
 
     public String getVideoUrl() {
         return videoUrl;

+ 10 - 1
module-report/src/main/java/cn/com/ctop/bytedance/entity/BytedanceCreativeHourlyReport.java

@@ -8,9 +8,11 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.jeecg.common.util.DateUtils;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
 import java.math.BigDecimal;
+import java.text.ParseException;
 import java.util.Date;
 
 /**
@@ -44,6 +46,8 @@ public class BytedanceCreativeHourlyReport {
     @Excel(name = "数据起始时间", width = 15)
     @ApiModelProperty(value = "数据起始时间")
     private String statDatetime;
+
+    private Integer statHour;
     /**
      * 展示量
      */
@@ -437,7 +441,12 @@ public class BytedanceCreativeHourlyReport {
         }
         String statDatetime = data.getString("stat_datetime");
         if (null != statDatetime && !"".equals(statDatetime.trim())) {
-            this.statDatetime = statDatetime;
+            try {
+                this.statDatetime = DateUtils.getDateByDateStr(statDatetime);
+                this.statHour = DateUtils.getHour(statDatetime);
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
         }
         Long shopping = data.getLong("shopping");
         if (null != shopping) {

+ 2 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedanceCreativeDailyReportMapper.java

@@ -2,6 +2,7 @@ package cn.com.ctop.bytedance.mapper;
 
 import cn.com.ctop.bytedance.entity.BytedanceCreativeDailyReport;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
@@ -18,4 +19,5 @@ public interface BytedanceCreativeDailyReportMapper extends BaseMapper<Bytedance
     List<BytedanceCreativeDailyReport> bytedanceCreativeAccountReport(Map<String, Object> paramsMap);
 
 
+    void replaceBatch(@Param(value = "reports") List<BytedanceCreativeDailyReport> reports);
 }

+ 8 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedanceCreativeHourlyReportMapper.java

@@ -2,6 +2,9 @@ package cn.com.ctop.bytedance.mapper;
 
 import cn.com.ctop.bytedance.entity.BytedanceCreativeHourlyReport;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * @Description: 广告创意日报表信息
@@ -11,4 +14,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface BytedanceCreativeHourlyReportMapper extends BaseMapper<BytedanceCreativeHourlyReport> {
 
+    void replaceBatch(@Param(value = "reports") List<BytedanceCreativeHourlyReport> reports);
+
+    String getVideoIdByCreativeId(@Param("creativeId") Long creativeId);
+
+    String selectSignatureByVideoId(@Param("videoId") String videoId);
 }

+ 17 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/BytedancePlanDailyReportMapper.java

@@ -3,6 +3,7 @@ package cn.com.ctop.bytedance.mapper;
 import cn.com.ctop.bytedance.entity.BytedancePlanDailyReport;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Update;
 
 import java.util.List;
 
@@ -15,4 +16,20 @@ import java.util.List;
 public interface BytedancePlanDailyReportMapper extends BaseMapper<BytedancePlanDailyReport> {
 
     void replaceBatch(@Param(value = "reports") List<BytedancePlanDailyReport> dailyReports);
+
+    @Update("update ctop_bytedance_report_plan_daily " +
+            "set channel_code = replace(substring_index(ad_name, '-', 1), '.apk', '') " +
+            "where advertiser_id in (select account_id from ctop_user_allocation where project_id = #{projectId})")
+    void cleanYzData(@Param(value = "projectId") Integer projectId);
+
+    @Update("update ctop_bytedance_report_plan_daily " +
+            "set channel_code = replace(replace(replace(substring_index(ad_name, '-', 2), '衍生计划-', ''), '.apk',''),'-','') " +
+            "where advertiser_id in (select account_id from ctop_user_allocation where project_id = #{projectId}) " +
+            "  and channel_code = '衍生计划' ")
+    void cleanYzDataFuck(@Param(value = "projectId") Integer projectId);
+
+    @Update("update ctop_bytedance_report_plan_daily " +
+            "set channel_code = substring_index(ad_name, '-', 1) " +
+            "where advertiser_id in (select account_id from ctop_user_allocation where project_id = #{projectId}) and stat_datetime =#{date}")
+    void cleanYddData(@Param(value = "projectId") Integer projectId, @Param(value = "date") String date);
 }

+ 135 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/BytedanceCreativeDailyReportMapper.xml

@@ -93,5 +93,140 @@
         limit 100
     </select>
 
+    <insert id="replaceBatch">
+        replace into ctop_bytedance_report_creative_daily(
+        id,
+        advertiser_id ,
+        stat_datetime,
+        show_num,
+        click,
+        convert_num,
+        cost,
+        active,
+        download_finish,
+        download_start,
+        click_install,
+        install_finish,
+        register,
+        pay_count,
+        in_app_uv,
+        in_app_detail_uv,
+        in_app_cart,
+        in_app_order,
+        in_app_pay,
+        phone,
+        form,
+        map_search,
+        button,
+        view,
+        qq,
+        lottery,
+        vote,
+        redirect,
+        shopping,
+        consult,
+        wechat,
+        phone_confirm,
+        phone_connect,
+        consult_effective,
+        total_play,
+        valid_play,
+        wifi_play,
+        play_duration_sum,
+        play25_feed_break,
+        play50_feed_break,
+        play75_feed_break,
+        play100_feed_break,
+        advanced_creative_phone_click,
+        advanced_creative_counsel_click,
+        advanced_creative_form_click,
+        share,
+        comment,
+        like_num,
+        follow,
+        home_visited,
+        ies_challenge_click,
+        ies_music_click,
+        interact_per_cost,
+        next_day_open,
+        next_day_open_rate,
+        next_day_open_cost,
+        ad_id,
+        ad_name,
+        campaign_id,
+        create_time,
+        update_time,
+        creative_id,
+        signature)
+        values
+        <foreach collection="reports" item="report" separator=",">
+            (
+            #{report.id},
+            #{report.advertiserId},
+            #{report.statDatetime},
+            #{report.showNum},
+            #{report.click},
+            #{report.convertNum},
+            #{report.cost},
+            #{report.active},
+            #{report.downloadFinish},
+            #{report.downloadStart},
+            #{report.clickInstall},
+            #{report.installFinish},
+            #{report.register},
+            #{report.payCount},
+            #{report.inAppUv},
+            #{report.inAppDetailUv},
+            #{report.inAppCart},
+            #{report.inAppOrder},
+            #{report.inAppPay},
+            #{report.phone},
+            #{report.form},
+            #{report.mapSearch},
+            #{report.button},
+            #{report.view},
+            #{report.qq},
+            #{report.lottery},
+            #{report.vote},
+            #{report.redirect},
+            #{report.shopping},
+            #{report.consult},
+            #{report.wechat},
+            #{report.phoneConfirm},
+            #{report.phoneConnect},
+            #{report.consultEffective},
+            #{report.totalPlay},
+            #{report.validPlay},
+            #{report.wifiPlay},
+            #{report.playDurationSum},
+            #{report.play25FeedBreak},
+            #{report.play50FeedBreak},
+            #{report.play75FeedBreak},
+            #{report.play100FeedBreak},
+            #{report.advancedCreativePhoneClick},
+            #{report.advancedCreativeCounselClick},
+            #{report.advancedCreativeFormClick},
+            #{report.share},
+            #{report.comment},
+            #{report.likeNum},
+            #{report.follow},
+            #{report.homeVisited},
+            #{report.iesChallengeClick},
+            #{report.iesMusicClick},
+            #{report.interactPerCost},
+            #{report.nextDayOpen},
+            #{report.nextDayOpenRate},
+            #{report.nextDayOpenCost},
+            #{report.adId},
+            #{report.adName},
+            #{report.campaignId},
+            #{report.createTime},
+            #{report.updateTime},
+            #{report.creativeId},
+            #{report.signature}
+            )
+        </foreach>
+    </insert>
+
 
 </mapper>

+ 150 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/BytedanceCreativeHourlyReportMapper.xml

@@ -1,5 +1,155 @@
 <?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.bytedance.mapper.BytedanceCreativeHourlyReportMapper">
+    <insert id="replaceBatch">
+        replace into ctop_bytedance_report_creative_hourly(
+        id,
+        advertiser_id ,
+        stat_datetime,
+        stat_hour,
+        show_num,
+        click,
+        convert_num,
+        cost,
+        active,
+        download_finish,
+        download_start,
+        click_install,
+        install_finish,
+        register,
+        pay_count,
+        in_app_uv,
+        in_app_detail_uv,
+        in_app_cart,
+        in_app_order,
+        in_app_pay,
+        phone,
+        form,
+        map_search,
+        button,
+        view,
+        qq,
+        lottery,
+        vote,
+        redirect,
+        shopping,
+        consult,
+        wechat,
+        phone_confirm,
+        phone_connect,
+        consult_effective,
+        total_play,
+        valid_play,
+        wifi_play,
+        play_duration_sum,
+        play25_feed_break,
+        play50_feed_break,
+        play75_feed_break,
+        play100_feed_break,
+        advanced_creative_phone_click,
+        advanced_creative_counsel_click,
+        advanced_creative_form_click,
+        share,
+        comment,
+        like_num,
+        follow,
+        home_visited,
+        ies_challenge_click,
+        ies_music_click,
+        interact_per_cost,
+        next_day_open,
+        next_day_open_rate,
+        next_day_open_cost,
+        ad_id,
+        ad_name,
+        campaign_id,
+        create_time,
+        update_time,
+        creative_id,
+        stat_datahour)
+        values
+        <foreach collection="reports" item="report" separator=",">
+            (
+            #{report.id},
+            #{report.advertiserId},
+            #{report.statDatetime},
+            #{report.statHour},
+            #{report.showNum},
+            #{report.click},
+            #{report.convertNum},
+            #{report.cost},
+            #{report.active},
+            #{report.downloadFinish},
+            #{report.downloadStart},
+            #{report.clickInstall},
+            #{report.installFinish},
+            #{report.register},
+            #{report.payCount},
+            #{report.inAppUv},
+            #{report.inAppDetailUv},
+            #{report.inAppCart},
+            #{report.inAppOrder},
+            #{report.inAppPay},
+            #{report.phone},
+            #{report.form},
+            #{report.mapSearch},
+            #{report.button},
+            #{report.view},
+            #{report.qq},
+            #{report.lottery},
+            #{report.vote},
+            #{report.redirect},
+            #{report.shopping},
+            #{report.consult},
+            #{report.wechat},
+            #{report.phoneConfirm},
+            #{report.phoneConnect},
+            #{report.consultEffective},
+            #{report.totalPlay},
+            #{report.validPlay},
+            #{report.wifiPlay},
+            #{report.playDurationSum},
+            #{report.play25FeedBreak},
+            #{report.play50FeedBreak},
+            #{report.play75FeedBreak},
+            #{report.play100FeedBreak},
+            #{report.advancedCreativePhoneClick},
+            #{report.advancedCreativeCounselClick},
+            #{report.advancedCreativeFormClick},
+            #{report.share},
+            #{report.comment},
+            #{report.likeNum},
+            #{report.follow},
+            #{report.homeVisited},
+            #{report.iesChallengeClick},
+            #{report.iesMusicClick},
+            #{report.interactPerCost},
+            #{report.nextDayOpen},
+            #{report.nextDayOpenRate},
+            #{report.nextDayOpenCost},
+            #{report.adId},
+            #{report.adName},
+            #{report.campaignId},
+            #{report.createTime},
+            #{report.updateTime},
+            #{report.creativeId}
+            )
+        </foreach>
+    </insert>
+    <select id="getVideoIdByCreativeId" resultType="java.lang.String">
+        select
+        video_id
+        from
+        ctop_bytedance_creative
+        where
+        id = #{creativeId}
+    </select>
 
+    <select id="selectSignatureByVideoId" resultType="java.lang.String">
+      select
+      signature
+       from ctop_bytedance_video_info
+       where
+       id = #{videoId}
+    </select>
 </mapper>

+ 4 - 2
module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/BytedancePlanHourlyReportMapper.xml

@@ -64,7 +64,8 @@
         ad_name ,
         campaign_id,
         create_time,
-        update_time)
+        update_time,
+        channel_code)
         values
         <foreach collection="reports" item="report" separator=",">
             (
@@ -129,7 +130,8 @@
             #{report.adName},
             #{report.campaignId},
             #{report.createTime},
-            #{report.updateTime}
+            #{report.updateTime},
+            #{report.channelCode}
             )
         </foreach>
     </insert>

+ 1 - 1
module-report/src/main/java/cn/com/ctop/bytedance/service/IBytedanceCreativeDailyReportService.java

@@ -19,5 +19,5 @@ public interface IBytedanceCreativeDailyReportService extends IService<Bytedance
     List<BytedanceCreativeDailyReport> bytedanceCreativeAccountReportList(JSONObject json);
 
 
-
+    void replaceBatch(List<BytedanceCreativeDailyReport> dailyReports);
 }

+ 0 - 0
module-report/src/main/java/cn/com/ctop/bytedance/service/IBytedanceCreativeHourlyReportService.java


Some files were not shown because too many files changed in this diff