Browse Source

Merge branch 'master' into jiaoyang

# Conflicts:
#	jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
yumeng 4 năm trước cách đây
mục cha
commit
8eb9b365af
45 tập tin đã thay đổi với 4186 bổ sung138 xóa
  1. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  2. 331 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialReportOverViewController.java
  3. 117 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/MaterialReportOverViewMapper.java
  4. 925 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MaterialReportOverViewMapper.xml
  5. 53 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IMaterialReportOverViewService.java
  6. 396 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/MaterialReportOverViewServiceImpl.java
  7. 32 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/controller/DesignerCommitProcessCtrl.java
  8. 9 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/entity/PlatformMaterial.java
  9. 9 3
      jeecg-boot-module-system/src/main/resources/application-test.yml
  10. 28 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ETLReportDesignJob.java
  11. 248 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiCreativeLimitController.java
  12. 65 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiCreativeLimit.java
  13. 17 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiCreativeLimitMapper.java
  14. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiCreativeLimitMapper.xml
  15. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiCreativeLimitService.java
  16. 26 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiCreativeLimitServiceImpl.java
  17. 4 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  18. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouVideoRelateCreativesMapper.xml
  19. 8 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  20. 3 22
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/SyncPullMaterialServiceImpl.java
  21. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java
  22. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyAgeMapper.java
  23. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyBusinessMapper.java
  24. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyCityMapper.java
  25. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyClientMapper.java
  26. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyGenderMapper.java
  27. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyProvinceMapper.java
  28. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouYiCheReportMapper.xml
  29. 246 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyAgeMapper.xml
  30. 246 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyBusinessMapper.xml
  31. 245 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyCityMapper.xml
  32. 246 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyClientMapper.xml
  33. 246 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyGenderMapper.xml
  34. 245 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyProvinceMapper.xml
  35. 74 59
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml
  36. 36 37
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportHourlyAccountMapper.xml
  37. 8 9
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouAudienceReportDailyServiceImpl.java
  38. 36 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/entity/EtlDesignDailyReport.java
  39. 18 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/mapper/ETLDesignDailyReportMapper.java
  40. 88 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/mapper/xml/EtlDesignDailyReportMapper.xml
  41. 13 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/service/IEtlDesignDailyReportService.java
  42. 56 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/service/impl/EtlDesignDailyReportServiceImpl.java
  43. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceNewPlanReportCtrl.java
  44. 25 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/BytedanceAdvertiserDailyReport.java
  45. 25 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/BytedanceAdvertiserHourlyReport.java

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -191,6 +191,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/explore/*", "anon");
         filterChainDefinitionMap.put("/ai/batchUpdate/*", "anon");
         filterChainDefinitionMap.put("/ctop/kuaishou/videoReport/*", "anon");
+        //filterChainDefinitionMap.put("/overView/*", "anon");
 
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);

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

@@ -0,0 +1,331 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.ctop.mapper.MaterialReportOverViewMapper;
+import org.jeecg.modules.ctop.service.IMaterialReportOverViewService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created by JQ.bi on 2021.03.02
+ */
+@Slf4j
+@RestController
+@RequestMapping("/overView")
+public class MaterialReportOverViewController {
+
+    @Autowired
+    private IMaterialReportOverViewService materialReportOverViewService;
+
+    @Autowired
+    private MaterialReportOverViewMapper materialReportOverViewMapper;
+
+    /**
+     *  根据userId递归查询下属,默认到最后一级,返回人员参与项目集合
+     */
+    @PostMapping("/getProjects")
+    public Result<Set<JSONObject>> getProjects(@RequestParam String userId, @RequestParam int mediaId) {
+        Result<Set<JSONObject>> result = new Result<>();
+        if(userId.isEmpty()){
+            result.error500("userId is empty");
+            return result;
+        }
+        //查询所有包含自己的下级
+        Set<String> subordinates= materialReportOverViewService.recursiveQuerySubordinate(userId);
+        //查询并返回所有关联的项目
+        result.setResult(materialReportOverViewService.queryProjectBy(subordinates,mediaId));
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
+     *  根据筛选条件查询总消耗、视频总数、爆款视频、有效视频
+     */
+    @PostMapping("/sumData")
+    public Result<Map<String,Object>> sumData(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String, Object> totalModule = materialReportOverViewService.getTotalModule(params.getInteger("mediaId"),
+                params.getString("startDate"),
+                params.getString("endDate"),
+                params.getJSONArray("projects"));
+        result.setResult(totalModule);
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
+     *  消耗数据趋势图
+     */
+    @PostMapping("/chartData")
+    public Result<List<JSONObject>> chartData(@RequestBody JSONObject params){
+        Result<List<JSONObject>> result =new Result<>();
+        List<JSONObject> totalChat = materialReportOverViewService.getTotalChat(params.getInteger("mediaId"),
+                params.getString("startDate"),
+                params.getString("endDate"),
+                params.getJSONArray("projects"));
+        result.setResult(totalChat);
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
+     *  Top素材排行榜
+     */
+    @PostMapping("/materialTop")
+    public Result<List<JSONObject>> materialTop(@RequestBody JSONObject params){
+        Result<List<JSONObject>> result = new Result<>();
+        List<JSONObject> topMaterialList = materialReportOverViewService.getTopMaterialList(params.getInteger("mediaId"),
+                params.getString("startDate"),
+                params.getString("endDate"),
+                params.getJSONArray("projects"));
+        result.setResult(topMaterialList);
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
+     *  Top素材排行榜查看更多
+     */
+    @PostMapping("/materialTopViewMore")
+    public Result<PageInfo<JSONObject>> materialTopViewMore(@RequestBody JSONObject params){
+        Result<PageInfo<JSONObject>> result = new Result<>();
+        PageInfo<JSONObject> pageInfo = materialReportOverViewService.getTopMaterialList(params.getInteger("mediaId"),
+                params.getString("startDate"),
+                params.getString("endDate"),
+                params.getJSONArray("projects"),
+                params.getString("channelType"),
+                params.getString("md5"),
+                params.getString("target")==null?"cost":params.getString("target"),
+                params.getString("order")==null?"desc":params.getString("order"),
+                params.getInteger("pageNo"),
+                params.getInteger("pageSize")
+                );
+        result.setResult(pageInfo);
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
+     *  Top素材排行榜查看更多导出报表
+     */
+    @PostMapping("/excel")
+    public void getExcelReport(@RequestBody JSONObject params,
+                               HttpServletRequest request,
+                               HttpServletResponse response) {
+        if (params.getInteger("mediaId") == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            materialReportOverViewService.exportBytedanceExcel(params,request,response);
+        } else if (params.getInteger("mediaId") == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            materialReportOverViewService.exportKuaishouExcel(params,request,response);
+
+        }
+    }
+
+    /**
+     *  Top设计排行榜
+     */
+    @PostMapping("/designTop")
+    public Result<PageInfo<JSONObject>> designTop(@RequestBody JSONObject params){
+        Result<PageInfo<JSONObject>> result = new Result<>();
+        PageInfo<JSONObject> topMaterialList = materialReportOverViewService.getTopDesignList(
+                params.getString("startDate"),
+                params.getString("endDate"),
+                params.getString("userId"),
+                params.getString("target"),
+                params.getString("order"),
+                params.getInteger("pageSize"),
+                params.getInteger("pageNo"));
+        result.setResult(topMaterialList);
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
+     *  标签占比饼状图
+     */
+    //TODO 需等标签库重构完
+    @PostMapping("/tagProportionAnalyse")
+    public Result<JSONObject> tagProportionAnalyse(){
+        return null;
+    }
+
+    /**
+     *  素材详情页
+     */
+    @PostMapping("/materialDetailInfo")
+    public Result<JSONObject> materialDetailInfo(@RequestBody JSONObject params){
+        Result<JSONObject> result= new Result<>();
+        result.setResult(materialReportOverViewService.getMaterialDetailInfo(params.getInteger("mediaId"),
+                params.getString("md5")));
+        result.setSuccess(true);
+        return result;
+
+    }
+
+    @PostMapping("/getProjectIdByMd5")
+    public Result<Long> getProjectIdByMd5(@RequestBody JSONObject params){
+        Result<Long> result= new Result<>();
+        if (params.getInteger("mediaId") == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            result.setResult(materialReportOverViewMapper.queryBytedanceProjectIdByMd5(params.getString("md5")));
+        } else if (params.getInteger("mediaId") == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            result.setResult(materialReportOverViewMapper.queryKuaishouProjectIdByMd5(params.getString("md5")));
+        }
+        result.setSuccess(true);
+        return result;
+    }
+
+    @PostMapping("/materialDetailCost")
+    public Result<Map<String,Object>> materialDetailCost(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("cost",materialReportOverViewMapper.queryBytedanceCostByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailClick")
+    public Result<Map<String,Object>> materialDetailClick(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("click",materialReportOverViewMapper.queryBytedanceClickByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailMaterialShow")
+    public Result<Map<String,Object>> materialDetailMaterialShow(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("materialShow",materialReportOverViewMapper.queryBytedanceMaterialShowByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailPlay100Rate")
+    public Result<Map<String,Object>> materialDetailPlay100Rate(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("play100Rate",materialReportOverViewMapper.queryBytedancePlay100RateByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailLikeMaterial")
+    public Result<Map<String,Object>> materialDetailLikeMaterial(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("likeMaterial",materialReportOverViewMapper.queryBytedanceLikeMaterialByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailCommentMaterial")
+    public Result<Map<String,Object>> materialDetailCommentMaterial(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("commentMaterial",materialReportOverViewMapper.queryBytedanceCommentMaterialByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailShareMaterial")
+    public Result<Map<String,Object>> materialDetailShareMaterial(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("shareMaterial",materialReportOverViewMapper.queryBytedanceShareMaterialByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailFollow")
+    public Result<Map<String,Object>> materialDetailFollow(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("follow",materialReportOverViewMapper.queryBytedanceFollowByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailCharge")
+    public Result<Map<String,Object>> materialDetailCharge(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("charge",materialReportOverViewMapper.queryKuaishouChargeByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailPhotoShow")
+    public Result<Map<String,Object>> materialDetailPhotoShow(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("photoShow",materialReportOverViewMapper.queryKuaishouPhotoShowByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailPhotoClick")
+    public Result<Map<String,Object>> materialDetailPhotoClick(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("photoClick",materialReportOverViewMapper.queryKuaishouPhotoClickByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailAClick")
+    public Result<Map<String,Object>> materialDetailAClick(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("aclick",materialReportOverViewMapper.queryKuaishouAClickByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailBClick")
+    public Result<Map<String,Object>> materialDetailBClick(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("bclick",materialReportOverViewMapper.queryKuaishouBClickByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailActivation")
+    public Result<Map<String,Object>> materialDetailActivation(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("activation",materialReportOverViewMapper.queryKuaishouActivationByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+    @PostMapping("/materialDetailPlay3sRate")
+    public Result<Map<String,Object>> materialDetailPlay3sRate(@RequestBody JSONObject params){
+        Result<Map<String,Object>> result= new Result<>();
+        Map<String,Object> map = new HashMap<>();
+        map.put("play3sRate",materialReportOverViewMapper.queryKuaishouPlay3sRateByMd5(params.getString("md5"),params.getLong("projectId")));
+        result.setResult(map);
+        result.setSuccess(true);
+        return result;
+    }
+
+    @PostMapping("/materialDetailChat")
+    public Result<List<JSONObject>> materialDetailChat(@RequestBody JSONObject params){
+        Result<List<JSONObject>> result= new Result<>();
+        result.setResult(materialReportOverViewService.getMaterialDetailChat(params.getInteger("mediaId"),
+                params.getString("md5")));
+        result.setSuccess(true);
+        return result;
+    }
+}

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

@@ -0,0 +1,117 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Set;
+
+public interface MaterialReportOverViewMapper {
+
+    Set<String> recursiveQuerySubordinateByLeader(@Param("leaderId") String leaderId);
+
+    Set<String> recursiveQuerySubordinateByLeaders(@Param("leaderIds") Set<String> leaderIds);
+
+    Set<String> recursiveQuerySubordinateByUserId(@Param("userId") String userId);
+
+    //查询用户参与的项目
+    Set<JSONObject> queryProjectBy(@Param("userIds") Set<String> userIds, @Param("mediaIds") JSONArray mediaIds);
+
+    JSONArray queryProjectIdBy(@Param("userIds") Set<String> userIds, @Param("mediaIds") JSONArray mediaIds);
+
+    //查询头条总消耗
+    BigDecimal queryBytedanceCost(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    //查询快手总消耗
+    BigDecimal queryKuaishouCost(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    //查询素材总数
+    Long queryMaterialCount(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    //查询今日上新素材数
+    Long queryNewMaterialCount(@Param("statDate") String statDate, @Param("projects") JSONArray projects);
+
+    //查询头条消耗数据趋势
+    List<JSONObject> queryBytedanceChat(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    List<JSONObject> queryBytedanceChatGroupMonth(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    //查询快手消耗数据趋势
+    List<JSONObject> queryKuaishouChat(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    List<JSONObject> queryKuaishouChatGroupMonth(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    //头条素材排行榜
+    List<JSONObject> queryBytedanceTopMaterial(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    //查看更多
+    List<JSONObject> queryBytedanceMaterialReport(@Param("filed") String filed, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects,
+                                                  @Param("md5") String md5, @Param("target") String target, @Param("order") String order);
+
+    Long queryBytedanceMaterialReportCount(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects,
+                                           @Param("md5") String md5);
+
+    //快手素材排行榜
+    List<JSONObject> queryKuaishouTopMaterial(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects);
+
+    //查看更多
+    List<JSONObject> queryKuaishouMaterialReport(@Param("filed") String filed, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects,
+                                                 @Param("channelType") String channelType, @Param("md5") String md5, @Param("target") String target, @Param("order") String order);
+
+    Long queryKuaishouMaterialReportCount(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projects") JSONArray projects,
+                                          @Param("channelType") String channelType, @Param("md5") String md5);
+
+    //设计排行榜
+    List<JSONObject> queryTopDesign(String startDate, String endDate, Set<String> userIds, String target, String order);
+
+    Long queryTopDesignCount(String startDate, String endDate, Set<String> userIds);
+
+    //素材详情页
+
+    JSONObject queryBytedanceVideoDetail(String md5);
+
+    JSONObject queryKuaishouVideoDetail(String md5);
+
+    //数据概览
+    Long queryBytedanceProjectIdByMd5(String md5);
+
+    Long queryKuaishouProjectIdByMd5(String md5);
+
+    List<JSONObject> queryBytedanceCostByMd5(String md5, Long project);
+
+    List<JSONObject> queryBytedanceClickByMd5(String md5, Long project);
+
+    List<JSONObject> queryBytedanceMaterialShowByMd5(String md5, Long project);
+
+    List<JSONObject> queryBytedancePlay100RateByMd5(String md5, Long project);
+
+    List<JSONObject> queryBytedanceLikeMaterialByMd5(String md5, Long project);
+
+    List<JSONObject> queryBytedanceCommentMaterialByMd5(String md5, Long project);
+
+    List<JSONObject> queryBytedanceShareMaterialByMd5(String md5, Long project);
+
+    List<JSONObject> queryBytedanceFollowByMd5(String md5, Long project);
+
+    List<JSONObject> queryKuaishouChargeByMd5(String md5, Long project);
+
+    List<JSONObject> queryKuaishouPhotoShowByMd5(String md5, Long project);
+
+    List<JSONObject> queryKuaishouPhotoClickByMd5(String md5, Long project);
+
+    List<JSONObject> queryKuaishouAClickByMd5(String md5, Long project);
+
+    List<JSONObject> queryKuaishouBClickByMd5(String md5, Long project);
+
+    List<JSONObject> queryKuaishouActivationByMd5(String md5, Long project);
+
+    List<JSONObject> queryKuaishouPlay3sRateByMd5(String md5, Long project);
+
+    //数据趋势
+    List<JSONObject> queryBytedanceVideoChat(String md5);
+
+    List<JSONObject> queryKuaishouVideoChat(String md5);
+
+}

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

@@ -0,0 +1,925 @@
+<?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.MaterialReportOverViewMapper">
+
+    <select id="recursiveQuerySubordinateByLeader" resultType="java.lang.String">
+        SELECT distinct id
+        FROM sys_user
+        WHERE leader_id = #{leaderId}
+          and status = 1
+          and del_flag = 0
+    </select>
+
+    <select id="recursiveQuerySubordinateByLeaders" resultType="java.lang.String">
+        SELECT distinct id
+        FROM sys_user
+        WHERE
+        status = 1
+        and del_flag = 0
+        and leader_id in
+        <foreach collection="leaderIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+    </select>
+
+    <select id="recursiveQuerySubordinateByUserId" resultType="java.lang.String">
+        SELECT distinct id
+        FROM sys_user
+        WHERE leader_id = (select leader_id from sys_user where id = #{userId})
+          and status = 1
+          and del_flag = 0
+
+    </select>
+
+    <select id="queryProjectBy" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT DISTINCT
+        t1.project_id as projectId,
+        t1.project_name as projectName
+        FROM
+        ctop_project_member t1
+        LEFT JOIN ctop_project t2 on t1.project_id=t2.id
+        WHERE
+        t2.media_id IN
+        <foreach collection="mediaIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        and t1.user_id IN
+        <foreach collection="userIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        and t1.project_name is not null and t1.project_name!=''
+        ORDER BY t2.create_time desc
+    </select>
+
+    <select id="queryProjectIdBy" resultType="long">
+        SELECT DISTINCT
+        t1.project_id as projectId
+        FROM
+        ctop_project_member t1
+        LEFT JOIN ctop_project t2 on t1.project_id=t2.id
+        WHERE
+        t2.media_id IN
+        <foreach collection="mediaIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        and t1.user_id IN
+        <foreach collection="userIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+
+    </select>
+
+    <select id="queryBytedanceCost" resultType="java.math.BigDecimal">
+        SELECT
+        sum(cost)
+        FROM
+        etl_report_bytedance_video
+        WHERE
+        1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_datetime >= #{startDate}
+        AND stat_datetime &lt;= #{endDate}
+    </select>
+
+    <select id="queryKuaishouCost" resultType="java.math.BigDecimal">
+        SELECT
+        sum(charge)
+        FROM
+        ctop_etl_kuaishou_account_material_report_daily
+        WHERE
+        1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+    </select>
+
+    <select id="queryMaterialCount" resultType="long">
+        SELECT
+        count(id) from ctop_material_info
+        WHERE
+        1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND DATE_FORMAT(create_time, '%Y-%m-%d')>= #{startDate}
+        AND DATE_FORMAT(create_time, '%Y-%m-%d')&lt;= #{endDate}
+    </select>
+
+    <select id="queryNewMaterialCount" resultType="long">
+        SELECT
+        count(id) from ctop_material_info
+        WHERE
+        DATE_FORMAT(create_time, '%Y-%m-%d')= #{statDate}
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="queryBytedanceChat" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        sum(cost) as cost,
+        stat_datetime as statDate
+        FROM
+        etl_report_bytedance_video
+        WHERE
+        1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_datetime >= #{startDate}
+        AND stat_datetime &lt;= #{endDate}
+        group by stat_datetime
+        order by stat_datetime
+    </select>
+
+    <select id="queryBytedanceChatGroupMonth" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        sum(cost) as cost,
+        DATE_FORMAT(stat_datetime, '%Y-%m') as statDate
+        FROM
+        etl_report_bytedance_video
+        WHERE
+        1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_datetime >= #{startDate}
+        AND stat_datetime &lt;= #{endDate}
+        group by DATE_FORMAT(stat_datetime, '%Y-%m')
+        order by stat_datetime asc
+    </select>
+
+    <select id="queryKuaishouChat" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        sum(charge) as cost,
+        stat_date as statDate
+        FROM
+        ctop_etl_kuaishou_account_material_report_daily
+        WHERE
+        1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        group by stat_date
+        order by stat_date
+    </select>
+
+    <select id="queryKuaishouChatGroupMonth" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        sum(charge) as cost,
+        DATE_FORMAT(stat_date, '%Y-%m') as statDate
+        FROM
+        ctop_etl_kuaishou_account_material_report_daily
+        WHERE
+        1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        group by DATE_FORMAT(stat_date, '%Y-%m')
+        order by stat_date
+    </select>
+
+    <select id="queryBytedanceTopMaterial" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.*,
+        IFNULL((SELECT GROUP_CONCAT(tag_name) from ctop_material_tag_info where code=signature and status=1),"塑造") as  tag
+        FROM
+        (SELECT md5 signature,
+        IFNULL(toutiao_url, '') AS url,
+        cover_url AS coverUrl,
+        material_name AS materialName,
+        sum(cost) AS cost from etl_report_bytedance_video
+        where 1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_datetime >= #{startDate}
+        AND stat_datetime &lt;= #{endDate}
+        AND md5!=''
+        GROUP BY md5
+        ORDER BY cost DESC
+        LIMIT 5) t1
+        ORDER BY cost DESC
+    </select>
+
+    <select id="queryBytedanceMaterialReport" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.md5 signature,
+        IFNULL(t1.toutiao_url, '') AS url,
+        t1.cover_url AS coverUrl,
+        t1.material_name AS materialName,
+        t1.project_name AS projectName,
+        t1.material_create_time AS createTime,
+        ${filed}
+        FROM
+        etl_report_bytedance_video t1
+        WHERE
+        1=1
+        <if test="md5 !=null and md5 != ''">
+            AND t1.md5= #{md5}
+        </if>
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_datetime >= #{startDate}
+        AND stat_datetime &lt;= #{endDate}
+        GROUP BY t1.md5
+        ORDER BY ${target} ${order}
+    </select>
+
+    <select id="queryBytedanceMaterialReportCount" resultType="java.lang.Long">
+        select count(1) from(
+        SELECT
+        count(1)
+        FROM
+        etl_report_bytedance_video t1
+        WHERE
+        1=1
+        <if test="md5 !=null and md5 != ''">
+            AND t1.md5= #{md5}
+        </if>
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND stat_datetime >= #{startDate}
+        AND stat_datetime &lt;= #{endDate}
+        GROUP BY t1.md5) t
+    </select>
+
+    <select id="queryKuaishouTopMaterial" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.*,
+        t2.video_name as materialName,
+        t2.cover_url as coverUrl,
+        t2.url as url ,
+        IFNULL((SELECT GROUP_CONCAT(tag_name) from ctop_material_tag_info where code=t1.signature and status=1),"塑造") as
+        tag
+        FROM
+        (select sum(charge) as charge,signature
+        from ctop_etl_kuaishou_account_material_report_daily t1
+        where
+        1=1
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND t1.stat_date >= #{startDate}
+        AND t1.stat_date &lt;= #{endDate}
+        GROUP BY t1.signature
+        ORDER BY charge desc
+        limit 5
+        ) t1
+        LEFT JOIN ctop_etl_kuaishou_video_info t2
+        ON t1.signature = t2.video_code
+        ORDER BY charge desc
+    </select>
+
+    <select id="queryKuaishouMaterialReport" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.*,
+        t2.video_name as materialName,
+        t2.cover_url as coverUrl,
+        t2.url as url ,
+        t2.channel_name AS channel,
+        t2.state_date as createTime
+        FROM
+        (select ${filed}
+        from ctop_etl_kuaishou_account_material_report_daily t1
+        where
+        1=1
+        <if test="md5 !=null and md5 != ''">
+            AND t1.signature= #{md5}
+        </if>
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND t1.stat_date >= #{startDate}
+        AND t1.stat_date &lt;= #{endDate}
+        GROUP BY t1.signature
+        ) t1
+        LEFT JOIN ctop_etl_kuaishou_video_info t2
+        ON t1.signature = t2.video_code
+        where 1=1
+        <if test="channelType !=null and channelType != ''">
+            AND t2.channel_type= #{channelType}
+        </if>
+        ORDER BY ${target} ${order}
+    </select>
+
+    <select id="queryKuaishouMaterialReportCount" resultType="java.lang.Long">
+        SELECT
+        count(1)
+        FROM
+        (select t1.signature
+        from ctop_etl_kuaishou_account_material_report_daily t1
+        where
+        1=1
+        <if test="md5 !=null and md5 != ''">
+            AND t1.signature= #{md5}
+        </if>
+        <if test="projects !=null">
+            AND project_id IN
+            <foreach collection="projects" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND t1.stat_date >= #{startDate}
+        AND t1.stat_date &lt;= #{endDate}
+        GROUP BY t1.signature
+        ) t1
+        LEFT JOIN ctop_etl_kuaishou_video_info t2
+        ON t1.signature = t2.video_code
+        where 1=1
+        <if test="channelType !=null and channelType != ''">
+            AND t2.channel_type= #{channelType}
+        </if>
+    </select>
+
+    <select id="queryTopDesign" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT rowNumber,
+        userName,
+        roleName,
+        cost
+        from(
+        SELECT (@i:=@i+1) AS rowNumber,
+        userName,
+        roleName,
+        cost
+        from(
+        SELECT
+        user_name AS userName,
+        role_name AS roleName,
+        sum(cost) cost
+        FROM
+        etl_design_daily_report,(SELECT @i:=0) i
+        where
+        stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        AND user_id IN
+        <foreach collection="userIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        GROUP BY
+        user_id
+        ORDER BY
+        ${target} ${order}) t) t1
+    </select>
+
+    <select id="queryTopDesignCount" resultType="java.lang.Long">
+        SELECT
+        count(1)
+        FROM
+        (
+        SELECT
+        count(1)
+        FROM
+        etl_design_daily_report
+        where
+        stat_date >= #{startDate}
+        AND stat_date &lt;= #{endDate}
+        AND user_id IN
+        <foreach collection="userIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        GROUP BY
+        user_id ) t
+    </select>
+
+    <select id="queryBytedanceVideoDetail" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t.url,
+               t.cover_url                                                                           as coverUrl,
+               t.id                                                                                  as materialId,
+               t.material_name                                                                       as materialName,
+               t2.`second`,
+               '头条'                                                                                  as madia,
+               GROUP_CONCAT((SELECT project_name from ctop_project where id = t.project_id limit 1)) as projectName,
+               t.create_time                                                                         as createTime,
+               t2.size,
+               '内部'                                                                                  as channelType,
+               t.`code`,
+               ''                                                                                  as materialType,
+               t2.height,
+               t2.width,
+               '北京汇创思拓数字科技有限公司'                                                                      as supplier,
+               IFNULL((SELECT leader_name from sys_user where id = t1.clip_id), '')                  as leaderName,
+               IFNULL(t1.clip_name, '')                                                                 clipName,
+               IFNULL(t1.shot_name, '')                                                                 shotName,
+               IFNULL(t1.plan_name, '')                                                                 planName
+        FROM ctop_material_info t
+                 LEFT JOIN ctop_material_ascription t1 on t.`code` = t1.material_id
+                 LEFT JOIN ctop_material_parameter t2 on t.`code` = t2.material_id
+        where t.code = #{md5}
+        GROUP BY t.code
+    </select>
+
+    <select id="queryKuaishouVideoDetail" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t1.url,
+               t1.cover_url                                                                           as coverUrl,
+               t.id                                                                                  as materialId,
+               t.material_name                                                                       as materialName,
+               t2.`second`,
+               '快手'                                                                                  as madia,
+               GROUP_CONCAT((SELECT project_name from ctop_project where id = t.project_id limit 1)) as projectName,
+               t.create_time                                                                         as createTime,
+               t2.size,
+               t1.channel_name                                                                       as channelType,
+               t1.`video_code` as 'code',
+               ''                                                                                    as materialType,
+               t2.height,
+               t2.width,
+               '北京汇创思拓数字科技有限公司'                                                                      as supplier,
+               IFNULL(t1.design_team_leader_name, '')                                                as leaderName,
+               IFNULL(t1.clip_name, '')                                                                 clipName,
+               IFNULL(t1.shot_name, '')                                                                 shotName,
+               IFNULL(t1.plan_name, '')                                                                 planName
+        FROM ctop_etl_kuaishou_video_info t1
+                 LEFT JOIN ctop_material_info t ON t.`code` = t1.video_code
+                 LEFT JOIN ctop_material_parameter t2 on t.`code` = t2.material_id
+        where t1.video_code = #{md5}
+        GROUP BY t1.video_code
+    </select>
+
+    <select id="queryBytedanceVideoChat" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT sum(cost)                           AS cost,
+               DATE_FORMAT(stat_datetime, '%Y-%m') AS statDate
+        FROM etl_report_bytedance_video
+        WHERE md5 = #{md5}
+        GROUP BY DATE_FORMAT(stat_datetime, '%Y-%m')
+        ORDER BY stat_datetime ASC
+    </select>
+
+    <select id="queryKuaishouVideoChat" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT sum(charge)                     AS cost,
+               DATE_FORMAT(stat_date, '%Y-%m') AS statDate
+        FROM ctop_etl_kuaishou_account_material_report_daily
+        WHERE signature = #{md5}
+        GROUP BY DATE_FORMAT(stat_date, '%Y-%m')
+        ORDER BY stat_date
+    </select>
+
+    <select id="queryBytedanceProjectIdByMd5" resultType="java.lang.Long">
+        SELECT
+            project_id
+        FROM
+            etl_report_bytedance_video
+        WHERE
+            md5 = #{md5}
+          AND project_id IS NOT NULL
+        LIMIT 1
+    </select>
+
+    <select id="queryKuaishouProjectIdByMd5" resultType="java.lang.Long">
+        SELECT
+            project_id
+        FROM
+            ctop_etl_kuaishou_account_material_report_daily
+        WHERE
+            signature = #{md5}
+          AND project_id IS NOT NULL
+        LIMIT 1
+    </select>
+
+    <select id="queryBytedanceCostByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select cost
+        from (
+                 SELECT ROUND(sum(cost), 2) cost,
+                        1 as                num
+                 FROM etl_report_bytedance_video
+                 WHERE md5 = #{md5}
+                 union all
+                 SELECT ROUND(MAX(cost), 2) top,
+                        2 as                num
+                 FROM (
+                          SELECT sum(cost) cost
+                          FROM etl_report_bytedance_video
+                          WHERE project_id = #{project}
+                          GROUP BY md5
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(cost), 2) average,
+                        3 as                num
+                 FROM etl_report_bytedance_video
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryBytedanceClickByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select click
+        from (
+                 SELECT sum(click) click,
+                        1 as       num
+                 FROM etl_report_bytedance_video
+                 WHERE md5 = #{md5}
+                 union all
+                 SELECT MAX(click) top,
+                        2 as       num
+                 FROM (
+                          SELECT sum(click) click
+                          FROM etl_report_bytedance_video
+                          WHERE project_id = #{project}
+                          GROUP BY md5
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(click), 0) average,
+                        3 as                 num
+                 FROM etl_report_bytedance_video
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryBytedanceMaterialShowByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select materialShow
+        from (
+                 SELECT sum(material_show) materialShow,
+                     1 as num
+                 FROM etl_report_bytedance_video
+                 WHERE md5 = #{md5}
+                 union all
+                 SELECT MAX(materialShow) top,
+                     2 as num
+                 FROM (
+                          SELECT sum(material_show) materialShow
+                          FROM etl_report_bytedance_video
+                          WHERE project_id = #{project}
+                          GROUP BY md5
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(material_show), 0) average,
+                     3 as num
+                 FROM etl_report_bytedance_video
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+
+    </select>
+
+    <select id="queryBytedancePlay100RateByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select play100Rate
+        from (
+        SELECT ifnull(round(sum(play100_feed_break) / sum(material_show), 2),0) play100Rate,
+            1 as num
+        FROM etl_report_bytedance_video
+        WHERE md5 = #{md5}
+        union all
+        SELECT ifnull(MAX(play100Rate),0) top,
+            2 as num
+        FROM (
+                 SELECT round(sum(play100_feed_break) / sum(material_show), 2) play100Rate
+                 FROM etl_report_bytedance_video
+                 WHERE project_id = #{project}
+                 GROUP BY md5
+             ) t
+        union all
+        SELECT ifnull(ROUND(sum(play100_feed_break) / sum(material_show), 2),0) average,
+            3 as num
+        FROM etl_report_bytedance_video
+        WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryBytedanceLikeMaterialByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select likeMaterial
+        from (
+        SELECT sum(like_material) likeMaterial,
+            1 as num
+        FROM etl_report_bytedance_video
+        WHERE md5 = #{md5}
+        union all
+        SELECT MAX(likeMaterial) top,
+            2 as num
+        FROM (
+                 SELECT sum(like_material) likeMaterial
+                 FROM etl_report_bytedance_video
+                 WHERE project_id = #{project}
+                 GROUP BY md5
+             ) t
+        union all
+        SELECT ROUND(AVG(like_material), 0) average,
+            3 as num
+        FROM etl_report_bytedance_video
+        WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryBytedanceCommentMaterialByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select commentMaterial
+        from (
+        SELECT sum(comment_material) commentMaterial,
+            1 as num
+        FROM etl_report_bytedance_video
+        WHERE md5 = #{md5}
+        union all
+        SELECT MAX(commentMaterial) top,
+            2 as num
+        FROM (
+                 SELECT sum(comment_material) commentMaterial
+                 FROM etl_report_bytedance_video
+                 WHERE project_id = #{project}
+                 GROUP BY md5
+             ) t
+        union all
+        SELECT ROUND(AVG(comment_material), 0) average,
+            3 as num
+        FROM etl_report_bytedance_video
+        WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryBytedanceShareMaterialByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select shareMaterial
+        from (
+        SELECT sum(share_material) shareMaterial,
+            1 as num
+        FROM etl_report_bytedance_video
+        WHERE md5 = #{md5}
+        union all
+        SELECT MAX(shareMaterial) top,
+            2 as num
+        FROM (
+                 SELECT sum(share_material) shareMaterial
+                 FROM etl_report_bytedance_video
+                 WHERE project_id = #{project}
+                 GROUP BY md5
+             ) t
+        union all
+        SELECT ROUND(AVG(share_material), 0) average,
+            3 as num
+        FROM etl_report_bytedance_video
+        WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryBytedanceFollowByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select follow
+        from (
+        SELECT sum(follow) follow,
+            1 as num
+        FROM etl_report_bytedance_video
+        WHERE md5 = #{md5}
+        union all
+        SELECT MAX(follow) top,
+            2 as num
+        FROM (
+                 SELECT sum(follow) follow
+                 FROM etl_report_bytedance_video
+                 WHERE project_id = #{project}
+                 GROUP BY md5
+             ) t
+        union all
+        SELECT ROUND(AVG(follow), 0) average,
+            3 as num
+        FROM etl_report_bytedance_video
+        WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryKuaishouChargeByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select charge
+        from (
+                 SELECT ROUND(sum(charge), 2) charge,
+                        1 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE signature = #{md5}
+                 union all
+                 SELECT ROUND(MAX(charge), 2) top,
+                        2 as num
+                 FROM (
+                          SELECT sum(charge) charge
+                          FROM ctop_etl_kuaishou_account_material_report_daily
+                          WHERE project_id = #{project}
+                          GROUP BY signature
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(charge), 2) average,
+                        3 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryKuaishouPhotoShowByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select photoShow
+        from (
+                 SELECT sum(photo_show) photoShow,
+                        1 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE signature = #{md5}
+                 union all
+                 SELECT MAX(photoShow) top,
+                        2 as num
+                 FROM (
+                          SELECT sum(photo_show) photoShow
+                          FROM ctop_etl_kuaishou_account_material_report_daily
+                          WHERE project_id = #{project}
+                          GROUP BY signature
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(photo_show), 0) average,
+                        3 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryKuaishouPhotoClickByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select photoClick
+        from (
+                 SELECT sum(photo_click) photoClick,
+                        1 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE signature = #{md5}
+                 union all
+                 SELECT MAX(photoClick) top,
+                        2 as num
+                 FROM (
+                          SELECT sum(photo_click) photoClick
+                          FROM ctop_etl_kuaishou_account_material_report_daily
+                          WHERE project_id = #{project}
+                          GROUP BY signature
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(photo_click), 0) average,
+                        3 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryKuaishouAClickByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select aclick
+        from (
+                 SELECT sum(aclick) aclick,
+                        1 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE signature = #{md5}
+                 union all
+                 SELECT MAX(aclick) top,
+                        2 as num
+                 FROM (
+                          SELECT sum(aclick) aclick
+                          FROM ctop_etl_kuaishou_account_material_report_daily
+                          WHERE project_id = #{project}
+                          GROUP BY signature
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(aclick), 0) average,
+                        3 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryKuaishouBClickByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select bclick
+        from (
+                 SELECT sum(bclick) bclick,
+                        1 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE signature = #{md5}
+                 union all
+                 SELECT MAX(bclick) top,
+                        2 as num
+                 FROM (
+                          SELECT sum(bclick) bclick
+                          FROM ctop_etl_kuaishou_account_material_report_daily
+                          WHERE project_id = #{project}
+                          GROUP BY signature
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(bclick), 0) average,
+                        3 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryKuaishouActivationByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select activation
+        from (
+                 SELECT sum(activation) activation,
+                        1 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE signature = #{md5}
+                 union all
+                 SELECT MAX(activation) top,
+                        2 as num
+                 FROM (
+                          SELECT sum(activation) activation
+                          FROM ctop_etl_kuaishou_account_material_report_daily
+                          WHERE project_id = #{project}
+                          GROUP BY signature
+                      ) t
+                 union all
+                 SELECT ROUND(AVG(activation), 0) average,
+                        3 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+    <select id="queryKuaishouPlay3sRateByMd5" resultType="com.alibaba.fastjson.JSONObject">
+        select play3sRate
+        from (
+                 SELECT round(sum(play_3s_count) / sum(aclick), 2) play3sRate,
+                        1 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE signature = #{md5}
+                 union all
+                 SELECT ROUND(MAX(play3sRate), 2) top,
+                        2 as num
+                 FROM (
+                          SELECT sum(play_3s_count) / sum(aclick) play3sRate
+                          FROM ctop_etl_kuaishou_account_material_report_daily
+                          WHERE project_id = #{project}
+                          GROUP BY signature
+                      ) t
+                 union all
+                 SELECT ROUND(sum(play_3s_count) / sum(aclick), 2) average,
+                        3 as num
+                 FROM ctop_etl_kuaishou_account_material_report_daily
+                 WHERE project_id = #{project}
+             ) t
+        order by num
+    </select>
+
+</mapper>

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

@@ -0,0 +1,53 @@
+package org.jeecg.modules.ctop.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageInfo;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public interface IMaterialReportOverViewService {
+
+    //递归查询下级
+    Set<String> recursiveQuerySubordinate(String userId);
+
+    //查询用户参与的项目
+    Set<JSONObject> queryProjectBy(Set<String> userIds, int mediaId);
+
+    JSONArray queryProjectIdBy(Set<String> userIds, int mediaId);
+
+    //查询总消耗、视频总数、爆款视频数、有效是视频数
+    Map<String,Object> getTotalModule(int mediaId, String startDate, String endDate, JSONArray projects);
+
+    //查询消耗趋势图
+    List<JSONObject> getTotalChat(int mediaId, String startDate, String endDate, JSONArray projects);
+
+    //查询标签占比图
+    JSONObject getTagProportion(int mediaId, String startDate, String endDate, int tagId);
+
+    //查询Top素材排行榜
+    List<JSONObject> getTopMaterialList(int mediaId, String startDate, String endDate, JSONArray projects);
+
+    //素材查看更多
+    PageInfo<JSONObject> getTopMaterialList(int mediaId, String startDate, String endDate, JSONArray projects, String channelType, String md5, String target, String order, int pageNo, int pageSize);
+
+    //导出
+    void exportBytedanceExcel(JSONObject requestBody, HttpServletRequest request, HttpServletResponse response);
+
+    void exportKuaishouExcel(JSONObject requestBody, HttpServletRequest request, HttpServletResponse response);
+
+    //查询设计人员排行榜
+    PageInfo<JSONObject> getTopDesignList(String startDate, String endDate, String userId, String target, String order, int pageSize, int pageNo);
+
+    // 视频详情页
+    JSONObject getMaterialDetailInfo(int mediaId, String md5);
+
+    Map<String,Object> materialDetailAnalyse(int mediaId, String md5);
+
+    List<JSONObject> getMaterialDetailChat(int mediaId, String md5);
+
+}

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

@@ -0,0 +1,396 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.constant.AccountReportConstants;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.JsonResourceUtil;
+import org.jeecg.modules.ctop.mapper.MaterialReportOverViewMapper;
+import org.jeecg.modules.ctop.service.IMaterialReportOverViewService;
+import org.jeecg.modules.system.service.ISysRoleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.ParseException;
+import java.util.*;
+
+@Slf4j
+@Service
+public class MaterialReportOverViewServiceImpl implements IMaterialReportOverViewService {
+
+    @Autowired
+    private MaterialReportOverViewMapper materialReportOverViewMapper;
+
+    @Autowired
+    private ISysRoleService roleService;
+
+    @Override
+    public Set<String> recursiveQuerySubordinate(String userId) {
+        Set<String> result;
+        //查询当前用户是否存在下级
+        Set<String> subordinate = materialReportOverViewMapper.recursiveQuerySubordinateByLeader(userId);
+        if (subordinate.isEmpty()) {
+            subordinate.add(userId);
+            return subordinate;
+        } else {
+            result = querySubordinate(subordinate, subordinate);
+            result.add(userId);
+        }
+        return result;
+    }
+
+    @Override
+    public Set<JSONObject> queryProjectBy(Set<String> userIds, int mediaId) {
+        JSONArray mediaIds = new JSONArray();
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            mediaIds.add(1);
+            mediaIds.add(3);
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            mediaIds.add(2);
+            mediaIds.add(4);
+        }
+        return materialReportOverViewMapper.queryProjectBy(userIds, mediaIds);
+    }
+
+    @Override
+    public JSONArray queryProjectIdBy(Set<String> userIds, int mediaId) {
+        JSONArray mediaIds = new JSONArray();
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            mediaIds.add(1);
+            mediaIds.add(3);
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            mediaIds.add(2);
+            mediaIds.add(4);
+        }
+        return materialReportOverViewMapper.queryProjectIdBy(userIds, mediaIds);
+    }
+
+    @Override
+    public Map<String, Object> getTotalModule(int mediaId, String startDate, String endDate, JSONArray projects) {
+        Map<String, Object> result = new HashMap<>();
+        if (projects.isEmpty()) {
+            projects = getProjectsByCurrentUser(mediaId);
+        }
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            BigDecimal cost = materialReportOverViewMapper.queryBytedanceCost(startDate, endDate, projects);
+            BigDecimal lastCost = materialReportOverViewMapper.queryBytedanceCost(DateUtils.addDay(startDate, -DateUtils.dateDiff(startDate, endDate)-1), DateUtils.addDay(startDate, -1), projects);
+            result.put("cost", cost);
+            result.put("costLink", countLink(cost == null ? BigDecimal.ZERO : cost, lastCost == null ? BigDecimal.ZERO : lastCost));
+            result.put("video", materialReportOverViewMapper.queryMaterialCount(startDate, endDate, projects));
+            result.put("newVideo", materialReportOverViewMapper.queryNewMaterialCount(DateUtils.date2Str(), projects));
+            result.put("hot", 0);
+            result.put("valid", 0);
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            BigDecimal cost = materialReportOverViewMapper.queryKuaishouCost(startDate, endDate, projects);
+            BigDecimal lastCost = materialReportOverViewMapper.queryKuaishouCost(DateUtils.addDay(startDate, -DateUtils.dateDiff(startDate, endDate)-1), DateUtils.addDay(startDate, -1), projects);
+            result.put("cost", cost);
+            result.put("costLink", countLink(cost == null ? BigDecimal.ZERO : cost, lastCost == null ? BigDecimal.ZERO : lastCost));
+            result.put("video", materialReportOverViewMapper.queryMaterialCount(startDate, endDate, projects));
+            result.put("newVideo", materialReportOverViewMapper.queryNewMaterialCount(DateUtils.date2Str(), projects));
+            result.put("hot", 0);
+            result.put("valid", 0);
+        }
+        return result;
+    }
+
+    @Override
+    public List<JSONObject> getTotalChat(int mediaId, String startDate, String endDate, JSONArray projects) {
+        List<JSONObject> result = new ArrayList<>();
+        if (projects.isEmpty()) {
+            projects = getProjectsByCurrentUser(mediaId);
+        }
+        try {
+            if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+                if (DateUtils.isMoreSixMonth(startDate, endDate)) {
+                    result = materialReportOverViewMapper.queryBytedanceChatGroupMonth(startDate, endDate, projects);
+                } else {
+                    result = materialReportOverViewMapper.queryBytedanceChat(startDate, endDate, projects);
+                }
+            } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+                if (DateUtils.isMoreSixMonth(startDate, endDate)) {
+                    result = materialReportOverViewMapper.queryKuaishouChatGroupMonth(startDate, endDate, projects);
+                } else {
+                    result = materialReportOverViewMapper.queryKuaishouChat(startDate, endDate, projects);
+                }
+            }
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return result;
+    }
+
+    @Override
+    public JSONObject getTagProportion(int mediaId, String startDate, String endDate, int tagId) {
+        return null;
+    }
+
+    @Override
+    public List<JSONObject> getTopMaterialList(int mediaId, String startDate, String endDate, JSONArray projects) {
+        List<JSONObject> result = new ArrayList<>();
+        if (projects.isEmpty()) {
+            projects = getProjectsByCurrentUser(mediaId);
+        }
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            result = materialReportOverViewMapper.queryBytedanceTopMaterial(startDate, endDate, projects);
+
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            result = materialReportOverViewMapper.queryKuaishouTopMaterial(startDate, endDate, projects);
+        }
+        return result;
+    }
+
+    @Override
+    public PageInfo<JSONObject> getTopMaterialList(int mediaId, String startDate, String endDate, JSONArray projects
+            , String channelType, String md5, String target, String order, int pageNo, int pageSize) {
+        PageInfo<JSONObject> result = new PageInfo<>();
+        if (projects.isEmpty()) {
+            projects = getProjectsByCurrentUser(mediaId);
+        }
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapByVideo);
+            PageHelper.startPage(pageNo, pageSize, false);
+            List<JSONObject> list = materialReportOverViewMapper.queryBytedanceMaterialReport(filedAll, startDate, endDate, projects, md5, target, order);
+            Long count = materialReportOverViewMapper.queryBytedanceMaterialReportCount(startDate, endDate, projects, md5);
+            result.setTotal(count);
+            result.setList(list);
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.kuaishouVideoReportMap);
+            PageHelper.startPage(pageNo, pageSize, false);
+            List<JSONObject> list = materialReportOverViewMapper.queryKuaishouMaterialReport(filedAll, startDate, endDate, projects, channelType, md5, target, order);
+            Long count = materialReportOverViewMapper.queryKuaishouMaterialReportCount(startDate, endDate, projects, channelType, md5);
+            result.setTotal(count);
+            result.setList(list);
+        }
+        return result;
+    }
+
+    @Override
+    public void exportBytedanceExcel(JSONObject requestBody, HttpServletRequest request, HttpServletResponse response) {
+        JSONArray projects= requestBody.getJSONArray("projects");
+        if (projects.isEmpty()) {
+            projects = getProjectsByCurrentUser(requestBody.getInteger("mediaId"));
+        }
+        JSONArray columns = requestBody.getJSONArray("columns");
+        if (columns.isEmpty()) {
+            //默认消耗必查
+            columns.add("cost");
+        }
+        String filed = JsonResourceUtil.joinFiled(AccountReportConstants.dicMapByVideo, columns);
+        List<String> titles = new ArrayList<>(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapByVideo, columns));
+
+        titles.add(0, "唯一标识");
+        titles.add(1, "视频");
+        titles.add(2, "视频名称");
+        titles.add(3, "项目名称");
+        columns.add(0, "signature");
+        columns.add(1, "url");
+        columns.add(2, "materialName");
+        columns.add(3, "projectName");
+
+        List<JSONObject> excelData = materialReportOverViewMapper.queryBytedanceMaterialReport(filed, requestBody.getString("startDate"), requestBody.getString("endDate"),
+                projects, requestBody.getString("md5"),requestBody.getString("target")==null?"cost":requestBody.getString("target")
+                , requestBody.getString("order")==null?"desc":requestBody.getString("order"));
+
+        if (null != excelData && excelData.isEmpty()) {
+            return;
+        }
+        List<List<Object>> excelList = new ArrayList<>();
+        excelData.forEach(data -> {
+            List<Object> temp = new ArrayList<>();
+            columns.forEach(k -> {
+                temp.add(data.get(k.toString()));
+            });
+            excelList.add(temp);
+        });
+        try {
+            String[] headers = titles.toArray(new String[titles.size()]);
+            OutputStream os = response.getOutputStream();
+            ExportExcelUtils eeu = new ExportExcelUtils();
+            XSSFWorkbook workbook = new XSSFWorkbook();
+            eeu.exportExcel(workbook, 0, "头条视频报表", headers, excelList);
+            HttpUtils.setResponseHeader(response, "头条视频报表.xlsx");
+            workbook.write(os);
+            os.flush();
+            os.close();
+        } catch (IOException e) {
+            log.error(e.getMessage());
+        }
+    }
+
+    @Override
+    public void exportKuaishouExcel(JSONObject requestBody, HttpServletRequest request, HttpServletResponse response) {
+        JSONArray projects= requestBody.getJSONArray("projects");
+        if (projects.isEmpty()) {
+            projects = getProjectsByCurrentUser(requestBody.getInteger("mediaId"));
+        }
+        JSONArray columns2 = new JSONArray();
+        columns2.add(0, "signature");
+        columns2.add(1, "url");
+        columns2.add(2, "projectName");
+        columns2.add(3, "materialName");
+        JSONArray columns = requestBody.getJSONArray("columns");
+        for (int i = 0; i < columns.size(); i++) {
+            columns2.add(columns2.size(), columns.getString(i));
+        }
+        List<String> titles = getfileIds(AccountReportConstants.kuaishouVideoReportDict, columns2);
+        String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.kuaishouVideoReportMap);
+        List<JSONObject> excelData = materialReportOverViewMapper.queryKuaishouMaterialReport(filedAll, requestBody.getString("startDate"), requestBody.getString("endDate"),
+                projects, requestBody.getString("channelType"),requestBody.getString("md5"), requestBody.getString("target")==null?"cost":requestBody.getString("target")
+                , requestBody.getString("order")==null?"desc":requestBody.getString("order"));
+        if (null != excelData && excelData.isEmpty()) {
+            return;
+        }
+        List<List<Object>> excelList = new ArrayList<>();
+        for (int i = 0; i < excelData.size(); i++) {
+            List<Object> temp = new ArrayList<>();
+            JSONObject jsonObject = excelData.get(i);
+            for (int j = 0; j < columns2.size(); j++) {
+                String key = columns2.getString(j);
+                String value = jsonObject.getString(key);
+                temp.add(value);
+            }
+            excelList.add(temp);
+        }
+
+        try {
+            String[] strings = titles.toArray(new String[]{});
+            OutputStream os = response.getOutputStream();
+            ExportExcelUtils eeu = new ExportExcelUtils();
+            XSSFWorkbook workbook = new XSSFWorkbook();
+            eeu.exportExcel(workbook, 0, "快手素材报表", strings, excelList);
+            HttpUtils.setResponseHeader(response, "快手素材.xlsx");
+            workbook.write(os);
+            os.flush();
+            os.close();
+        } catch (IOException e) {
+            log.error(e.getMessage());
+        }
+    }
+
+    @Override
+    public PageInfo<JSONObject> getTopDesignList(String startDate, String endDate, String userId, String target, String order, int pageSize, int pageNo) {
+        PageInfo<JSONObject> result = new PageInfo<>();
+        Set<String> subordinate = this.recursiveQuerySubordinate(userId);
+        if (subordinate.size()==1) {
+            subordinate = materialReportOverViewMapper.recursiveQuerySubordinateByUserId(userId);
+        }
+        PageHelper.startPage(pageNo, pageSize, false);
+        List<JSONObject> topDesign = materialReportOverViewMapper.queryTopDesign(startDate, endDate, subordinate, target, order);
+        Long count = materialReportOverViewMapper.queryTopDesignCount(startDate, endDate, subordinate);
+        result.setList(topDesign);
+        result.setTotal(count);
+        return result;
+    }
+
+    @Override
+    public JSONObject getMaterialDetailInfo(int mediaId, String md5) {
+        JSONObject result = new JSONObject();
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            result = materialReportOverViewMapper.queryBytedanceVideoDetail(md5);
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            result = materialReportOverViewMapper.queryKuaishouVideoDetail(md5);
+
+        }
+        return result;
+    }
+
+    @Override
+    public Map<String, Object> materialDetailAnalyse(int mediaId, String md5) {
+        Map<String, Object> result = new HashMap<>();
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            Long projectId = materialReportOverViewMapper.queryBytedanceProjectIdByMd5(md5);
+            result.put("cost", materialReportOverViewMapper.queryBytedanceCostByMd5(md5, projectId));
+            result.put("click", materialReportOverViewMapper.queryBytedanceClickByMd5(md5, projectId));
+            result.put("materialShow", materialReportOverViewMapper.queryBytedanceMaterialShowByMd5(md5, projectId));
+            result.put("play100Rate", materialReportOverViewMapper.queryBytedancePlay100RateByMd5(md5, projectId));
+            result.put("likeMaterial", materialReportOverViewMapper.queryBytedanceLikeMaterialByMd5(md5, projectId));
+            result.put("commentMaterial", materialReportOverViewMapper.queryBytedanceCommentMaterialByMd5(md5, projectId));
+            result.put("shareMaterial", materialReportOverViewMapper.queryBytedanceShareMaterialByMd5(md5, projectId));
+            result.put("follow", materialReportOverViewMapper.queryBytedanceFollowByMd5(md5, projectId));
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            Long projectId = materialReportOverViewMapper.queryKuaishouProjectIdByMd5(md5);
+            result.put("charge", materialReportOverViewMapper.queryKuaishouChargeByMd5(md5, projectId));
+            result.put("photoShow", materialReportOverViewMapper.queryKuaishouPhotoShowByMd5(md5, projectId));
+            result.put("photoClick", materialReportOverViewMapper.queryKuaishouPhotoClickByMd5(md5, projectId));
+            result.put("aclick", materialReportOverViewMapper.queryKuaishouAClickByMd5(md5, projectId));
+            result.put("bclick", materialReportOverViewMapper.queryKuaishouBClickByMd5(md5, projectId));
+            result.put("activation", materialReportOverViewMapper.queryKuaishouActivationByMd5(md5, projectId));
+            result.put("play3sRate", materialReportOverViewMapper.queryKuaishouPlay3sRateByMd5(md5, projectId));
+        }
+        return result;
+    }
+
+    @Override
+    public List<JSONObject> getMaterialDetailChat(int mediaId, String md5) {
+        List<JSONObject> result = new ArrayList<>();
+        if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
+            result = materialReportOverViewMapper.queryBytedanceVideoChat(md5);
+        } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
+            result = materialReportOverViewMapper.queryKuaishouVideoChat(md5);
+        }
+        return result;
+    }
+
+    //递归查询
+    private Set<String> querySubordinate(Set<String> leaderIds, Set<String> result) {
+        if (leaderIds.isEmpty()) {
+            return result;
+        }
+        Set<String> temp = materialReportOverViewMapper.recursiveQuerySubordinateByLeaders(leaderIds);
+        result.addAll(temp);
+        querySubordinate(temp, result);
+        return result;
+    }
+
+    //当项目为空的时候,根据当前登录人查询可查看的所有项目集合
+    private JSONArray getProjectsByCurrentUser(int mediaId) {
+        String currentUser = ((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId();
+        //TODO 为了解决管理员等角色初始化查全部项目查询效率慢的问题判断角色,待优化
+        String roleCode = roleService.getRoleCodeByUserId(currentUser);
+        if (roleCode.equals("admin")) {
+            return null;
+        }
+        return queryProjectIdBy(recursiveQuerySubordinate(currentUser), mediaId);
+    }
+    private List<String> getfileIds(Map<String, Map<String, Object>> kuaishouVideoReportMap, JSONArray columns) {
+        List<String> titles = new ArrayList<>();
+        for (int i = 0; i < columns.size(); i++) {
+            String string = columns.getString(i);
+            Map<String, Object> stringObjectMap = kuaishouVideoReportMap.get(string);
+            if (Check.isNull(stringObjectMap)) {
+                titles.add("-");
+                continue;
+            }
+            Object comment = stringObjectMap.get("comment");
+            titles.add(String.valueOf(comment));
+
+        }
+        return titles;
+    }
+
+    //环比计算
+    private  BigDecimal countLink(BigDecimal numA, BigDecimal numB) {
+        BigDecimal link = new BigDecimal(0);
+        if (numB.compareTo(BigDecimal.ZERO)!=0) {
+            link = (numA.subtract(numB)).divide(numB, 4, RoundingMode.HALF_UP);
+        }
+        return link;
+    }
+
+}

+ 32 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/controller/DesignerCommitProcessCtrl.java

@@ -1,5 +1,7 @@
 package org.jeecg.modules.orderplatform.controller;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.orderplatform.entity.PlatformMaterial;
@@ -14,6 +16,10 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 @Slf4j
 @RestController
 @RequestMapping("/platform/designer")
@@ -92,6 +98,32 @@ DesignerCommitProcessCtrl {
     }
 
     /**
+     *   设计组长批量派单
+     */
+    @PostMapping("/batchAssign")
+    public Result<Map<String,Object>> batchAssign(@RequestBody JSONObject params) {
+        Result<Map<String,Object>> result = new Result<>();
+        Map<String,Object> assignResult= new HashMap<>();
+        JSONArray ids=params.getJSONArray("id");
+        PlatformMaterial platformMaterial= new PlatformMaterial(params.getString("plan"),params.getString("shot"),params.getString("clip"));
+        ids.forEach(id->{
+            //物料状态->脚本待上传
+            platformMaterial.setId(Long.valueOf(id.toString()));
+            platformMaterial.setMaterialStatus(1);
+            platformMaterial.setScriptStatus(0);
+            boolean ok = platformMaterialService.updateById(platformMaterial);
+            if (ok) {
+                assignResult.put(platformMaterial.getId().toString(),"物料派单成功");
+            }else {
+                assignResult.put(platformMaterial.getId().toString(),"物料派单失败");
+            }
+        });
+        result.setResult(assignResult);
+        result.setSuccess(true);
+        return result;
+    }
+
+    /**
      *  设计组长修改指派人
      */
     @PostMapping("/assignAgain")

+ 9 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/entity/PlatformMaterial.java

@@ -92,4 +92,13 @@ public class PlatformMaterial {
 
 	@TableField(exist = false)
 	private String clipName;
+
+	public PlatformMaterial() {
+	}
+
+	public PlatformMaterial(String plan, String shot, String clip) {
+		this.plan = plan;
+		this.shot = shot;
+		this.clip = clip;
+	}
 }

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

@@ -101,6 +101,12 @@ spring:
           username: hcst
           password: hcst@2020
           driver-class-name: com.mysql.jdbc.Driver
+#      datasource:
+#        master:
+#          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
+#          username: data
+#          password: hcst@2021
+#          driver-class-name: com.mysql.jdbc.Driver
   #redis 配置
   redis:
     database: 0
@@ -125,9 +131,9 @@ mybatis-plus:
       id-type: 4
       # 默认数据库表下划线命名
       table-underline: true
-  #  configuration:
-  #    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
-  #  map-underscore-to-camel-case: false
+    configuration:
+      log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    map-underscore-to-camel-case: false
   #分页pageHelper
 pagehelper:
   helper-dialect: mysql

+ 28 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/ETLReportDesignJob.java

@@ -0,0 +1,28 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import cn.com.ctop.toutiao.modules.link.service.IEtlDesignDailyReportService;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+
+public class ETLReportDesignJob {
+
+    @Autowired
+    IEtlDesignDailyReportService etlDesignDailyReportService;
+
+    @XxlJob("ETLReportDesignJob")
+    public void execute() throws Exception {
+        String statDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -1));
+        try {
+            etlDesignDailyReportService.cleanEtl(statDate);
+        } catch (Exception e) {
+            XxlJobHelper.log("头条视频报表基础数据拉取异常:{}", e.getMessage());
+        } finally {
+            XxlJobHelper.log("ETLReportVideoCleanJob is finish");
+        }
+    }
+
+}

+ 248 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiCreativeLimitController.java

@@ -0,0 +1,248 @@
+package cn.com.ctop.kuaishou.modules.ai.controller;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiCreativeLimit;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiCreativeLimitService;
+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.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 2021-03-24
+ */
+@Slf4j
+@Api(tags = "关联数超限")
+@RestController
+@RequestMapping("/limit/aiCreativeLimit")
+public class AiCreativeLimitController {
+    @Autowired
+    private IAiCreativeLimitService aiCreativeLimitService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param aiCreativeLimit
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "关联数超限-分页列表查询")
+    @ApiOperation(value = "关联数超限-分页列表查询", notes = "关联数超限-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<AiCreativeLimit>> queryPageList(AiCreativeLimit aiCreativeLimit,
+                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                        HttpServletRequest req) {
+        Result<IPage<AiCreativeLimit>> result = new Result<>();
+        QueryWrapper<AiCreativeLimit> queryWrapper = QueryGenerator.initQueryWrapper(aiCreativeLimit, req.getParameterMap());
+        Page<AiCreativeLimit> page = new Page<AiCreativeLimit>(pageNo, pageSize);
+        IPage<AiCreativeLimit> pageList = aiCreativeLimitService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param aiCreativeLimit
+     * @return
+     */
+    @AutoLog(value = "关联数超限-添加")
+    @ApiOperation(value = "关联数超限-添加", notes = "关联数超限-添加")
+    @PostMapping(value = "/add")
+    public Result<AiCreativeLimit> add(@RequestBody AiCreativeLimit aiCreativeLimit) {
+        Result<AiCreativeLimit> result = new Result<>();
+        try {
+            aiCreativeLimitService.save(aiCreativeLimit);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param aiCreativeLimit
+     * @return
+     */
+    @AutoLog(value = "关联数超限-编辑")
+    @ApiOperation(value = "关联数超限-编辑", notes = "关联数超限-编辑")
+    @PutMapping(value = "/edit")
+    public Result<AiCreativeLimit> edit(@RequestBody AiCreativeLimit aiCreativeLimit) {
+        Result<AiCreativeLimit> result = new Result<AiCreativeLimit>();
+        AiCreativeLimit aiCreativeLimitEntity = aiCreativeLimitService.getById(aiCreativeLimit.getId());
+        if (aiCreativeLimitEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = aiCreativeLimitService.updateById(aiCreativeLimit);
+            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 {
+            aiCreativeLimitService.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<AiCreativeLimit> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<AiCreativeLimit> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.aiCreativeLimitService.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<AiCreativeLimit> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<AiCreativeLimit> result = new Result<>();
+        AiCreativeLimit aiCreativeLimit = aiCreativeLimitService.getById(id);
+        if (aiCreativeLimit == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(aiCreativeLimit);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<AiCreativeLimit> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                AiCreativeLimit aiCreativeLimit = JSON.parseObject(deString, AiCreativeLimit.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(aiCreativeLimit, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<AiCreativeLimit> pageList = aiCreativeLimitService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "关联数超限列表");
+        mv.addObject(NormalExcelConstants.CLASS, AiCreativeLimit.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<AiCreativeLimit> listAiCreativeLimits = ExcelImportUtil.importExcel(file.getInputStream(), AiCreativeLimit.class, params);
+                aiCreativeLimitService.saveBatch(listAiCreativeLimits);
+                return Result.ok("文件导入成功!数据行数:" + listAiCreativeLimits.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("文件导入失败!");
+    }
+
+}

+ 65 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiCreativeLimit.java

@@ -0,0 +1,65 @@
+package cn.com.ctop.kuaishou.modules.ai.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 2021-03-24
+ */
+@Data
+@TableName("ctop_ai_creative_limit")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_ai_creative_limit对象", description = "关联数超限")
+public class AiCreativeLimit {
+
+    /**
+     * 主键ID
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键ID")
+    private Long id;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long photoId;
+    /**
+     * 创建时间
+     */
+    @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;
+}

+ 17 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiCreativeLimitMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.kuaishou.modules.ai.mapper;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiCreativeLimit;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 关联数超限
+ *
+ * @author: jeecg-boot
+ * @date: 2021-03-24
+ * @cersion: V1.0
+ */
+public interface AiCreativeLimitMapper extends BaseMapper<AiCreativeLimit> {
+
+    void replaceSava(@Param("accountId") Long advertiserId, @Param("photoId") Long photo_id);
+}

+ 15 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiCreativeLimitMapper.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.ai.mapper.AiCreativeLimitMapper">
+
+    <insert id="replaceSava">
+        replace into ctop_ai_creative_limit
+        (account_id,
+        photo_id)
+        values (
+        #{accountId},
+        #{photoId}
+        )
+
+    </insert>
+</mapper>

+ 15 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiCreativeLimitService.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.ai.service;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiCreativeLimit;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 关联数超限
+ * @Author: jeecg-boot
+ * @Date: 2021-03-24
+ * @Version: V1.0
+ */
+public interface IAiCreativeLimitService extends IService<AiCreativeLimit> {
+
+    void replaceSava(Long advertiserId, Long photo_id);
+}

+ 26 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiCreativeLimitServiceImpl.java

@@ -0,0 +1,26 @@
+package cn.com.ctop.kuaishou.modules.ai.service.impl;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiCreativeLimit;
+import cn.com.ctop.kuaishou.modules.ai.mapper.AiCreativeLimitMapper;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiCreativeLimitService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 关联数超限
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-03-24
+ */
+@Service
+public class AiCreativeLimitServiceImpl extends ServiceImpl<AiCreativeLimitMapper, AiCreativeLimit> implements IAiCreativeLimitService {
+    @Autowired
+    private AiCreativeLimitMapper creativeLimitMapper;
+
+    @Override
+    public void replaceSava(Long advertiserId, Long photo_id) {
+        creativeLimitMapper.replaceSava(advertiserId,photo_id);
+    }
+}

+ 4 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -918,7 +918,7 @@ public class BatchController {
                                 failArr.add(failJson);
                             } else {
                                 //更新数据状态
-                                shouGroupDailyReportService.updateStatus(accountId,unitId,putStatus);
+                                shouGroupDailyReportService.updateStatus(accountId, unitId, putStatus);
                             }
                         }
                     }
@@ -2266,12 +2266,12 @@ public class BatchController {
         Result<Boolean> result = new Result<>();
         try {
             String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-            String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -30);
+            String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -7);
             syncPullMaterialService.getSyncVideoList(accountId, startDate, nowDate);
-            Thread.sleep(5 * 1000L);
             result.setSuccess(true);
             result.setResult(true);
-        } catch (InterruptedException e) {
+        } catch (Exception e) {
+            result.setSuccess(false);
             e.printStackTrace();
         }
 

+ 4 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouVideoRelateCreativesMapper.xml

@@ -89,6 +89,7 @@
     </select>
 
     <select id="getHistoryTopVideoList" resultType="com.alibaba.fastjson.JSONObject">
+        select t3.* from (
         select
         t2.photo_id,
         t1.charge
@@ -134,5 +135,8 @@
         account_id = #{accountId}
         ) t2 ON t1.signature = t2.signature
         ORDER BY t1.charge DESC
+        ) t3 left join
+        ( SELECT id,photo_id from ctop_ai_creative_limit WHERE account_id = #{accountId} ) t4 on t3.photo_id = t4.photo_id
+        where t4.id is null
     </select>
 </mapper>

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

@@ -8,6 +8,7 @@ import cn.com.ctop.common.module.service.IMaterialCutFrameService;
 import cn.com.ctop.common.module.service.IOauthConfigService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiCreativeLimitService;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAccountCreativeOverrunInfoService;
 import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.ConvertVo;
@@ -1947,6 +1948,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     @Autowired
     private IKuaiShouOverRunSendMessageService overRunSendMessageService;
+    @Autowired
+    private IAiCreativeLimitService creativeLimitService;
 
     @Override
     public Map<String, Object> creativeCreate(String accessToken, Long advertiserId, JSONObject requestJson, Integer count) {
@@ -1995,6 +1998,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                         creativeOverrunInfoService.updateOverrunInfo(advertiserId);
                         overRunSendMessageService.creativeOverRunSendMessage(advertiserId, null);
                     }
+
+                    if (code == 401000 && resultJson.getString("message").contains("超过可关联的有效创意的上限")) {
+                        creativeLimitService.replaceSava(advertiserId, requestJson.getLong("photo_id"));
+                    }
+
                     log.error("创建广告创意失败,advertiser_id:{},返回信息:{},入参:{}", advertiserId, resultJson, requestJson, count + 1);
                     returnMap.put("code", -1);
                     returnMap.put("message", resultJson.getString("message"));

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

@@ -2,15 +2,12 @@ package cn.com.ctop.kuaishou.modules.batch.service.impl;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAdvertiserBaseInfo;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAdvertiserBaseInfoService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.batch.service.ISyncPullMaterialService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -26,8 +23,7 @@ public class SyncPullMaterialServiceImpl implements ISyncPullMaterialService {
     private ICtopOauthTokenService oauthTokenService;
     @Autowired
     private IKuaishouInterfaceService iKuaishouInterfaceService;
-    static ExecutorService videoExecutorService = Executors.newFixedThreadPool(10);
-    static ExecutorService suZhaoExecutorService = Executors.newFixedThreadPool(10);
+
 
 
     /**
@@ -39,23 +35,8 @@ public class SyncPullMaterialServiceImpl implements ISyncPullMaterialService {
      */
     @Override
     public void getSyncVideoList(Long accountId, String startDate, String endDate) {
-        KuaiShouAdvertiserBaseInfo baseInfo = KuaiShouAdvertiserBaseInfoService.getBaseInfo(accountId);
-        if (!Check.isNull(baseInfo)) {
-            List<KuaiShouAdvertiserBaseInfo> baseInfoList = KuaiShouAdvertiserBaseInfoService.getAccountIdList(baseInfo.getUserId());
-            if (!Check.isNull(baseInfoList)) {
-                for (KuaiShouAdvertiserBaseInfo advertiserBaseInfo : baseInfoList) {
-                    CtopOauthToken token = oauthTokenService.getTokenByAccountId(advertiserBaseInfo.getAccountId());
-                    if (!Check.isNull(token)) {
-                        videoExecutorService.submit(new Runnable() {
-                            @Override
-                            public void run() {
-                                iKuaishouInterfaceService.getVideoList(token, startDate, endDate);
-                            }
-                        });
-                    }
-                }
-            }
-        }
+        CtopOauthToken token = oauthTokenService.getTokenByAccountId(accountId);
+        iKuaishouInterfaceService.getVideoList(token, startDate, endDate);
     }
 
 

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

@@ -241,7 +241,7 @@ public class KsVideoReportCtrl {
                         HttpServletRequest request,
                         HttpServletResponse response) {
         Result<PageInfo<JSONObject>> result = new Result<>();
-        try {
+    try {
 
 
             if (Check.isNull(requestBody)) {

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

@@ -2,6 +2,9 @@ package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyAge;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 人群分析报表
@@ -12,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface KuaishouAudienceReportDailyAgeMapper extends BaseMapper<KuaishouAudienceReportDailyAge> {
 
+    void replaceBatch(@Param(value = "data") List<KuaishouAudienceReportDailyAge> data);
 }

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

@@ -2,6 +2,9 @@ package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyBusiness;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 人群分析报表
@@ -12,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface KuaishouAudienceReportDailyBusinessMapper extends BaseMapper<KuaishouAudienceReportDailyBusiness> {
 
+    void replaceBatch(@Param(value = "data") List<KuaishouAudienceReportDailyBusiness> data);
 }

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

@@ -2,6 +2,9 @@ package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyCity;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 人群分析报表
@@ -12,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface KuaishouAudienceReportDailyCityMapper extends BaseMapper<KuaishouAudienceReportDailyCity> {
 
+    void replaceBatch(@Param(value = "data") List<KuaishouAudienceReportDailyCity> data);
 }

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

@@ -2,6 +2,9 @@ package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyClient;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 人群分析报表
@@ -12,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface KuaishouAudienceReportDailyClientMapper extends BaseMapper<KuaishouAudienceReportDailyClient> {
 
+    void replaceBatch(@Param(value = "data") List<KuaishouAudienceReportDailyClient> data);
 }

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

@@ -2,6 +2,9 @@ package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyGender;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 人群分析报表
@@ -11,4 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @cersion: V1.0
  */
 public interface KuaishouAudienceReportDailyGenderMapper extends BaseMapper<KuaishouAudienceReportDailyGender> {
+    void replaceBatch(@Param(value = "data") List<KuaishouAudienceReportDailyGender> data);
 }

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

@@ -2,6 +2,9 @@ package cn.com.ctop.kuaishou.modules.report.mapper;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyProvince;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 人群分析报表
@@ -12,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface KuaishouAudienceReportDailyProvinceMapper extends BaseMapper<KuaishouAudienceReportDailyProvince> {
 
+    void replaceBatch(@Param(value = "data") List<KuaishouAudienceReportDailyProvince> data);
 }

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

@@ -492,7 +492,7 @@
         '%'
         )
         ELSE
-        0
+        '0%'
         END
         ) clickRate,
         (

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

@@ -2,4 +2,250 @@
 <!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.KuaishouAudienceReportDailyAgeMapper">
 
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_audience_report_daily_age (
+        account_id,
+        plan_id ,
+        unit_id ,
+        placement_type,
+        stat_date ,
+        aclick ,
+        bclick ,
+        photo_click_cost,
+        follow ,
+        cancel_follow ,
+        report ,
+        block ,
+        negative ,
+        download_started ,
+        download_completed ,
+        activation ,
+        submit ,
+        photo_click ,
+        photo_click_ratio,
+        charge ,
+        action_ratio ,
+        impression_1k_cost,
+        action_cost ,
+        event_pay_first_day ,
+        event_pay_purchase_amount_first_day,
+        event_pay_first_day_roi,
+        event_pay ,
+        event_pay_purchase_amount ,
+        event_pay_roi ,
+        event_register ,
+        event_register_cost ,
+        event_register_ratio ,
+        event_jin_jian_app ,
+        event_jin_jian_app_cost ,
+        event_credit_grant_app ,
+        event_credit_grant_app_cost,
+        event_order_paid ,
+        event_order_paid_purchase_amount,
+        event_jin_jian_landing_page ,
+        event_jin_jian_landing_page_cost ,
+        event_credit_grant_landing_page ,
+        event_credit_grant_landing_page_cost,
+        event_credit_grant_landing_ratio ,
+        event_next_day_stay_cost ,
+        event_next_day_stay_ratio ,
+        form_action_ratio ,
+        event_order_paid_cost ,
+        event_next_day_stay ,
+        form_cost ,
+        form_count ,
+        play_3s_ratio ,
+        stat_hour ,
+        click_1k_cost ,
+        event_valid_clues ,
+        event_valid_clues_cost,
+        ad_product_cnt ,
+        event_goods_view ,
+        merchant_reco_fans ,
+        event_order_amount_roi ,
+        event_new_user_pay ,
+        event_new_user_pay_cost ,
+        event_new_user_pay_ratio ,
+        event_button_click ,
+        event_button_click_cost ,
+        event_button_click_ratio ,
+        play_5s_ratio ,
+        play_end_ratio ,
+        event_order_paid_roi,
+        event_new_user_jinjian_app ,
+        event_new_user_jinjian_app_cost,
+        event_new_user_jinjian_app_roi ,
+        event_new_user_credit_grant_app ,
+        event_new_user_credit_grant_app_cost,
+        event_new_user_credit_grant_app_roi ,
+        event_new_user_jinjian_page ,
+        event_new_user_jinjian_page_cost ,
+        event_new_user_jinjian_page_roi ,
+        event_new_user_credit_grant_page ,
+        event_new_user_credit_grant_page_cost ,
+        event_new_user_credit_grant_page_roi ,
+        event_appoint_form ,
+        event_appoint_form_cost,
+        event_appoint_form_ratio,
+        event_appoint_jump_click ,
+        event_appoint_jump_click_cost,
+        event_appoint_jump_click_ratio,
+        union_event_pay_purchase_amount_7d ,
+        province ,
+        event_app_invoked ,
+        union_event_pay_purchase_amount_7d_roi,
+        event_add_shopping_cart_cost ,
+        gender ,
+        city ,
+        event_ad_watch_times_ratio ,
+        shares ,
+        business_interest_tags ,
+        event_watch_app_ad ,
+        event_multi_conversion_cost,
+        merchant_reco_fans_cost ,
+        ad_scene ,
+        event_ad_watch_times_cost ,
+        event_add_shopping_cart ,
+        age_segment ,
+        photo_like ,
+        event_add_wechat ,
+        event_add_wechat_cost,
+        event_add_wechat_ratio,
+        event_app_invoked_cost ,
+        event_multi_conversion ,
+        event_dsp_gift_form ,
+        event_app_invoked_ratio ,
+        photo_show ,
+        event_multi_conversion_ratio,
+        client ,
+        event_goods_view_cost ,
+        event_credit_grant_app_ratio,
+        event_ad_watch_times ,
+        comments
+        )
+        values
+        <foreach collection="data" item="da" separator=",">
+            (
+            #{da.accountId},
+            #{da.planId},
+            #{da.unitId},
+            #{da.placementType},
+            #{da.statDate},
+            #{da.aclick},
+            #{da.bclick},
+            #{da.photoClickCost},
+            #{da.follow},
+            #{da.cancelFollow},
+            #{da.report},
+            #{da.block},
+            #{da.negative},
+            #{da.downloadStarted},
+            #{da.downloadCompleted},
+            #{da.activation},
+            #{da.submit},
+            #{da.photoClick},
+            #{da.photoClickRatio},
+            #{da.charge},
+            #{da.actionRatio},
+            #{da.impression_1kCost},
+            #{da.actionCost},
+            #{da.eventPayFirstDay},
+            #{da.eventPayPurchaseAmountFirstDay},
+            #{da.eventPayFirstDayRoi},
+            #{da.eventPay},
+            #{da.eventPayPurchaseAmount},
+            #{da.eventPayRoi},
+            #{da.eventRegister},
+            #{da.eventRegisterCost},
+            #{da.eventRegisterRatio},
+            #{da.eventJinJianApp},
+            #{da.eventJinJianAppCost},
+            #{da.eventCreditGrantApp},
+            #{da.eventCreditGrantAppCost},
+            #{da.eventOrderPaid},
+            #{da.eventOrderPaidPurchaseAmount},
+            #{da.eventJinJianLandingPage},
+            #{da.eventJinJianLandingPageCost},
+            #{da.eventCreditGrantLandingPage},
+            #{da.eventCreditGrantLandingPageCost},
+            #{da.eventCreditGrantLandingRatio},
+            #{da.eventNextDayStayCost},
+            #{da.eventNextDayStayRatio},
+            #{da.formActionRatio},
+            #{da.eventOrderPaidCost},
+            #{da.eventNextDayStay},
+            #{da.formCost},
+            #{da.formCount},
+            #{da.play_3sRatio},
+            #{da.statHour},
+            #{da.click_1kCost},
+            #{da.eventValidClues},
+            #{da.eventValidCluesCost},
+            #{da.adProductCnt},
+            #{da.eventGoodsView},
+            #{da.merchantRecoFans},
+            #{da.eventOrderAmountRoi},
+            #{da.eventNewUserPay},
+            #{da.eventNewUserPayCost},
+            #{da.eventNewUserPayRatio},
+            #{da.eventButtonClick},
+            #{da.eventButtonClickCost},
+            #{da.eventButtonClickRatio},
+            #{da.play_5sRatio},
+            #{da.playEndRatio},
+            #{da.eventOrderPaidRoi},
+            #{da.eventNewUserJinjianApp},
+            #{da.eventNewUserJinjianAppCost},
+            #{da.eventNewUserJinjianAppRoi},
+            #{da.eventNewUserCreditGrantApp},
+            #{da.eventNewUserCreditGrantAppCost},
+            #{da.eventNewUserCreditGrantAppRoi},
+            #{da.eventNewUserJinjianPage},
+            #{da.eventNewUserJinjianPageCost},
+            #{da.eventNewUserJinjianPageRoi},
+            #{da.eventNewUserCreditGrantPage},
+            #{da.eventNewUserCreditGrantPageCost},
+            #{da.eventNewUserCreditGrantPageRoi},
+            #{da.eventAppointForm},
+            #{da.eventAppointFormCost},
+            #{da.eventAppointFormRatio},
+            #{da.eventAppointJumpClick},
+            #{da.eventAppointJumpClickCost},
+            #{da.eventAppointJumpClickRatio},
+            #{da.unionEventPayPurchaseAmount_7d},
+            #{da.province},
+            #{da.eventAppInvoked},
+            #{da.unionEventPayPurchaseAmount_7dRoi},
+            #{da.eventAddShoppingCartCost},
+            #{da.gender},
+            #{da.city},
+            #{da.eventAdWatchTimesRatio},
+            #{da.shares},
+            #{da.businessInterestTags},
+            #{da.eventWatchAppAd},
+            #{da.eventMultiConversionCost},
+            #{da.merchantRecoFansCost},
+            #{da.adScene},
+            #{da.eventAdWatchTimesCost},
+            #{da.eventAddShoppingCart},
+            #{da.ageSegment},
+            #{da.photoLike},
+            #{da.eventAddWechat},
+            #{da.eventAddWechatCost},
+            #{da.eventAddWechatRatio},
+            #{da.eventAppInvokedCost},
+            #{da.eventMultiConversion},
+            #{da.eventDspGiftForm},
+            #{da.eventAppInvokedRatio},
+            #{da.photoShow},
+            #{da.eventMultiConversionRatio},
+            #{da.client},
+            #{da.eventGoodsViewCost},
+            #{da.eventCreditGrantAppRatio},
+            #{da.eventAdWatchTimes},
+            #{da.comments}
+            )
+        </foreach>
+    </insert>
+
 </mapper>

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

@@ -2,4 +2,250 @@
 <!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.KuaishouAudienceReportDailyBusinessMapper">
 
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_audience_report_daily_business (
+        account_id,
+        plan_id ,
+        unit_id ,
+        placement_type,
+        stat_date ,
+        aclick ,
+        bclick ,
+        photo_click_cost,
+        follow ,
+        cancel_follow ,
+        report ,
+        block ,
+        negative ,
+        download_started ,
+        download_completed ,
+        activation ,
+        submit ,
+        photo_click ,
+        photo_click_ratio,
+        charge ,
+        action_ratio ,
+        impression_1k_cost,
+        action_cost ,
+        event_pay_first_day ,
+        event_pay_purchase_amount_first_day,
+        event_pay_first_day_roi,
+        event_pay ,
+        event_pay_purchase_amount ,
+        event_pay_roi ,
+        event_register ,
+        event_register_cost ,
+        event_register_ratio ,
+        event_jin_jian_app ,
+        event_jin_jian_app_cost ,
+        event_credit_grant_app ,
+        event_credit_grant_app_cost,
+        event_order_paid ,
+        event_order_paid_purchase_amount,
+        event_jin_jian_landing_page ,
+        event_jin_jian_landing_page_cost ,
+        event_credit_grant_landing_page ,
+        event_credit_grant_landing_page_cost,
+        event_credit_grant_landing_ratio ,
+        event_next_day_stay_cost ,
+        event_next_day_stay_ratio ,
+        form_action_ratio ,
+        event_order_paid_cost ,
+        event_next_day_stay ,
+        form_cost ,
+        form_count ,
+        play_3s_ratio ,
+        stat_hour ,
+        click_1k_cost ,
+        event_valid_clues ,
+        event_valid_clues_cost,
+        ad_product_cnt ,
+        event_goods_view ,
+        merchant_reco_fans ,
+        event_order_amount_roi ,
+        event_new_user_pay ,
+        event_new_user_pay_cost ,
+        event_new_user_pay_ratio ,
+        event_button_click ,
+        event_button_click_cost ,
+        event_button_click_ratio ,
+        play_5s_ratio ,
+        play_end_ratio ,
+        event_order_paid_roi,
+        event_new_user_jinjian_app ,
+        event_new_user_jinjian_app_cost,
+        event_new_user_jinjian_app_roi ,
+        event_new_user_credit_grant_app ,
+        event_new_user_credit_grant_app_cost,
+        event_new_user_credit_grant_app_roi ,
+        event_new_user_jinjian_page ,
+        event_new_user_jinjian_page_cost ,
+        event_new_user_jinjian_page_roi ,
+        event_new_user_credit_grant_page ,
+        event_new_user_credit_grant_page_cost ,
+        event_new_user_credit_grant_page_roi ,
+        event_appoint_form ,
+        event_appoint_form_cost,
+        event_appoint_form_ratio,
+        event_appoint_jump_click ,
+        event_appoint_jump_click_cost,
+        event_appoint_jump_click_ratio,
+        union_event_pay_purchase_amount_7d ,
+        province ,
+        event_app_invoked ,
+        union_event_pay_purchase_amount_7d_roi,
+        event_add_shopping_cart_cost ,
+        gender ,
+        city ,
+        event_ad_watch_times_ratio ,
+        shares ,
+        business_interest_tags ,
+        event_watch_app_ad ,
+        event_multi_conversion_cost,
+        merchant_reco_fans_cost ,
+        ad_scene ,
+        event_ad_watch_times_cost ,
+        event_add_shopping_cart ,
+        age_segment ,
+        photo_like ,
+        event_add_wechat ,
+        event_add_wechat_cost,
+        event_add_wechat_ratio,
+        event_app_invoked_cost ,
+        event_multi_conversion ,
+        event_dsp_gift_form ,
+        event_app_invoked_ratio ,
+        photo_show ,
+        event_multi_conversion_ratio,
+        client ,
+        event_goods_view_cost ,
+        event_credit_grant_app_ratio,
+        event_ad_watch_times ,
+        comments
+        )
+        values
+        <foreach collection="data" item="da" separator=",">
+            (
+            #{da.accountId},
+            #{da.planId},
+            #{da.unitId},
+            #{da.placementType},
+            #{da.statDate},
+            #{da.aclick},
+            #{da.bclick},
+            #{da.photoClickCost},
+            #{da.follow},
+            #{da.cancelFollow},
+            #{da.report},
+            #{da.block},
+            #{da.negative},
+            #{da.downloadStarted},
+            #{da.downloadCompleted},
+            #{da.activation},
+            #{da.submit},
+            #{da.photoClick},
+            #{da.photoClickRatio},
+            #{da.charge},
+            #{da.actionRatio},
+            #{da.impression_1kCost},
+            #{da.actionCost},
+            #{da.eventPayFirstDay},
+            #{da.eventPayPurchaseAmountFirstDay},
+            #{da.eventPayFirstDayRoi},
+            #{da.eventPay},
+            #{da.eventPayPurchaseAmount},
+            #{da.eventPayRoi},
+            #{da.eventRegister},
+            #{da.eventRegisterCost},
+            #{da.eventRegisterRatio},
+            #{da.eventJinJianApp},
+            #{da.eventJinJianAppCost},
+            #{da.eventCreditGrantApp},
+            #{da.eventCreditGrantAppCost},
+            #{da.eventOrderPaid},
+            #{da.eventOrderPaidPurchaseAmount},
+            #{da.eventJinJianLandingPage},
+            #{da.eventJinJianLandingPageCost},
+            #{da.eventCreditGrantLandingPage},
+            #{da.eventCreditGrantLandingPageCost},
+            #{da.eventCreditGrantLandingRatio},
+            #{da.eventNextDayStayCost},
+            #{da.eventNextDayStayRatio},
+            #{da.formActionRatio},
+            #{da.eventOrderPaidCost},
+            #{da.eventNextDayStay},
+            #{da.formCost},
+            #{da.formCount},
+            #{da.play_3sRatio},
+            #{da.statHour},
+            #{da.click_1kCost},
+            #{da.eventValidClues},
+            #{da.eventValidCluesCost},
+            #{da.adProductCnt},
+            #{da.eventGoodsView},
+            #{da.merchantRecoFans},
+            #{da.eventOrderAmountRoi},
+            #{da.eventNewUserPay},
+            #{da.eventNewUserPayCost},
+            #{da.eventNewUserPayRatio},
+            #{da.eventButtonClick},
+            #{da.eventButtonClickCost},
+            #{da.eventButtonClickRatio},
+            #{da.play_5sRatio},
+            #{da.playEndRatio},
+            #{da.eventOrderPaidRoi},
+            #{da.eventNewUserJinjianApp},
+            #{da.eventNewUserJinjianAppCost},
+            #{da.eventNewUserJinjianAppRoi},
+            #{da.eventNewUserCreditGrantApp},
+            #{da.eventNewUserCreditGrantAppCost},
+            #{da.eventNewUserCreditGrantAppRoi},
+            #{da.eventNewUserJinjianPage},
+            #{da.eventNewUserJinjianPageCost},
+            #{da.eventNewUserJinjianPageRoi},
+            #{da.eventNewUserCreditGrantPage},
+            #{da.eventNewUserCreditGrantPageCost},
+            #{da.eventNewUserCreditGrantPageRoi},
+            #{da.eventAppointForm},
+            #{da.eventAppointFormCost},
+            #{da.eventAppointFormRatio},
+            #{da.eventAppointJumpClick},
+            #{da.eventAppointJumpClickCost},
+            #{da.eventAppointJumpClickRatio},
+            #{da.unionEventPayPurchaseAmount_7d},
+            #{da.province},
+            #{da.eventAppInvoked},
+            #{da.unionEventPayPurchaseAmount_7dRoi},
+            #{da.eventAddShoppingCartCost},
+            #{da.gender},
+            #{da.city},
+            #{da.eventAdWatchTimesRatio},
+            #{da.shares},
+            #{da.businessInterestTags},
+            #{da.eventWatchAppAd},
+            #{da.eventMultiConversionCost},
+            #{da.merchantRecoFansCost},
+            #{da.adScene},
+            #{da.eventAdWatchTimesCost},
+            #{da.eventAddShoppingCart},
+            #{da.ageSegment},
+            #{da.photoLike},
+            #{da.eventAddWechat},
+            #{da.eventAddWechatCost},
+            #{da.eventAddWechatRatio},
+            #{da.eventAppInvokedCost},
+            #{da.eventMultiConversion},
+            #{da.eventDspGiftForm},
+            #{da.eventAppInvokedRatio},
+            #{da.photoShow},
+            #{da.eventMultiConversionRatio},
+            #{da.client},
+            #{da.eventGoodsViewCost},
+            #{da.eventCreditGrantAppRatio},
+            #{da.eventAdWatchTimes},
+            #{da.comments}
+            )
+        </foreach>
+    </insert>
+
 </mapper>

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

@@ -2,6 +2,250 @@
 <!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.KuaishouAudienceReportDailyCityMapper">
 
-
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_audience_report_daily_city (
+        account_id,
+        plan_id ,
+        unit_id ,
+        placement_type,
+        stat_date ,
+        aclick ,
+        bclick ,
+        photo_click_cost,
+        follow ,
+        cancel_follow ,
+        report ,
+        block ,
+        negative ,
+        download_started ,
+        download_completed ,
+        activation ,
+        submit ,
+        photo_click ,
+        photo_click_ratio,
+        charge ,
+        action_ratio ,
+        impression_1k_cost,
+        action_cost ,
+        event_pay_first_day ,
+        event_pay_purchase_amount_first_day,
+        event_pay_first_day_roi,
+        event_pay ,
+        event_pay_purchase_amount ,
+        event_pay_roi ,
+        event_register ,
+        event_register_cost ,
+        event_register_ratio ,
+        event_jin_jian_app ,
+        event_jin_jian_app_cost ,
+        event_credit_grant_app ,
+        event_credit_grant_app_cost,
+        event_order_paid ,
+        event_order_paid_purchase_amount,
+        event_jin_jian_landing_page ,
+        event_jin_jian_landing_page_cost ,
+        event_credit_grant_landing_page ,
+        event_credit_grant_landing_page_cost,
+        event_credit_grant_landing_ratio ,
+        event_next_day_stay_cost ,
+        event_next_day_stay_ratio ,
+        form_action_ratio ,
+        event_order_paid_cost ,
+        event_next_day_stay ,
+        form_cost ,
+        form_count ,
+        play_3s_ratio ,
+        stat_hour ,
+        click_1k_cost ,
+        event_valid_clues ,
+        event_valid_clues_cost,
+        ad_product_cnt ,
+        event_goods_view ,
+        merchant_reco_fans ,
+        event_order_amount_roi ,
+        event_new_user_pay ,
+        event_new_user_pay_cost ,
+        event_new_user_pay_ratio ,
+        event_button_click ,
+        event_button_click_cost ,
+        event_button_click_ratio ,
+        play_5s_ratio ,
+        play_end_ratio ,
+        event_order_paid_roi,
+        event_new_user_jinjian_app ,
+        event_new_user_jinjian_app_cost,
+        event_new_user_jinjian_app_roi ,
+        event_new_user_credit_grant_app ,
+        event_new_user_credit_grant_app_cost,
+        event_new_user_credit_grant_app_roi ,
+        event_new_user_jinjian_page ,
+        event_new_user_jinjian_page_cost ,
+        event_new_user_jinjian_page_roi ,
+        event_new_user_credit_grant_page ,
+        event_new_user_credit_grant_page_cost ,
+        event_new_user_credit_grant_page_roi ,
+        event_appoint_form ,
+        event_appoint_form_cost,
+        event_appoint_form_ratio,
+        event_appoint_jump_click ,
+        event_appoint_jump_click_cost,
+        event_appoint_jump_click_ratio,
+        union_event_pay_purchase_amount_7d ,
+        province ,
+        event_app_invoked ,
+        union_event_pay_purchase_amount_7d_roi,
+        event_add_shopping_cart_cost ,
+        gender ,
+        city ,
+        event_ad_watch_times_ratio ,
+        shares ,
+        business_interest_tags ,
+        event_watch_app_ad ,
+        event_multi_conversion_cost,
+        merchant_reco_fans_cost ,
+        ad_scene ,
+        event_ad_watch_times_cost ,
+        event_add_shopping_cart ,
+        age_segment ,
+        photo_like ,
+        event_add_wechat ,
+        event_add_wechat_cost,
+        event_add_wechat_ratio,
+        event_app_invoked_cost ,
+        event_multi_conversion ,
+        event_dsp_gift_form ,
+        event_app_invoked_ratio ,
+        photo_show ,
+        event_multi_conversion_ratio,
+        client ,
+        event_goods_view_cost ,
+        event_credit_grant_app_ratio,
+        event_ad_watch_times ,
+        comments
+        )
+        values
+        <foreach collection="data" item="da" separator=",">
+            (
+            #{da.accountId},
+            #{da.planId},
+            #{da.unitId},
+            #{da.placementType},
+            #{da.statDate},
+            #{da.aclick},
+            #{da.bclick},
+            #{da.photoClickCost},
+            #{da.follow},
+            #{da.cancelFollow},
+            #{da.report},
+            #{da.block},
+            #{da.negative},
+            #{da.downloadStarted},
+            #{da.downloadCompleted},
+            #{da.activation},
+            #{da.submit},
+            #{da.photoClick},
+            #{da.photoClickRatio},
+            #{da.charge},
+            #{da.actionRatio},
+            #{da.impression_1kCost},
+            #{da.actionCost},
+            #{da.eventPayFirstDay},
+            #{da.eventPayPurchaseAmountFirstDay},
+            #{da.eventPayFirstDayRoi},
+            #{da.eventPay},
+            #{da.eventPayPurchaseAmount},
+            #{da.eventPayRoi},
+            #{da.eventRegister},
+            #{da.eventRegisterCost},
+            #{da.eventRegisterRatio},
+            #{da.eventJinJianApp},
+            #{da.eventJinJianAppCost},
+            #{da.eventCreditGrantApp},
+            #{da.eventCreditGrantAppCost},
+            #{da.eventOrderPaid},
+            #{da.eventOrderPaidPurchaseAmount},
+            #{da.eventJinJianLandingPage},
+            #{da.eventJinJianLandingPageCost},
+            #{da.eventCreditGrantLandingPage},
+            #{da.eventCreditGrantLandingPageCost},
+            #{da.eventCreditGrantLandingRatio},
+            #{da.eventNextDayStayCost},
+            #{da.eventNextDayStayRatio},
+            #{da.formActionRatio},
+            #{da.eventOrderPaidCost},
+            #{da.eventNextDayStay},
+            #{da.formCost},
+            #{da.formCount},
+            #{da.play_3sRatio},
+            #{da.statHour},
+            #{da.click_1kCost},
+            #{da.eventValidClues},
+            #{da.eventValidCluesCost},
+            #{da.adProductCnt},
+            #{da.eventGoodsView},
+            #{da.merchantRecoFans},
+            #{da.eventOrderAmountRoi},
+            #{da.eventNewUserPay},
+            #{da.eventNewUserPayCost},
+            #{da.eventNewUserPayRatio},
+            #{da.eventButtonClick},
+            #{da.eventButtonClickCost},
+            #{da.eventButtonClickRatio},
+            #{da.play_5sRatio},
+            #{da.playEndRatio},
+            #{da.eventOrderPaidRoi},
+            #{da.eventNewUserJinjianApp},
+            #{da.eventNewUserJinjianAppCost},
+            #{da.eventNewUserJinjianAppRoi},
+            #{da.eventNewUserCreditGrantApp},
+            #{da.eventNewUserCreditGrantAppCost},
+            #{da.eventNewUserCreditGrantAppRoi},
+            #{da.eventNewUserJinjianPage},
+            #{da.eventNewUserJinjianPageCost},
+            #{da.eventNewUserJinjianPageRoi},
+            #{da.eventNewUserCreditGrantPage},
+            #{da.eventNewUserCreditGrantPageCost},
+            #{da.eventNewUserCreditGrantPageRoi},
+            #{da.eventAppointForm},
+            #{da.eventAppointFormCost},
+            #{da.eventAppointFormRatio},
+            #{da.eventAppointJumpClick},
+            #{da.eventAppointJumpClickCost},
+            #{da.eventAppointJumpClickRatio},
+            #{da.unionEventPayPurchaseAmount_7d},
+            #{da.province},
+            #{da.eventAppInvoked},
+            #{da.unionEventPayPurchaseAmount_7dRoi},
+            #{da.eventAddShoppingCartCost},
+            #{da.gender},
+            #{da.city},
+            #{da.eventAdWatchTimesRatio},
+            #{da.shares},
+            #{da.businessInterestTags},
+            #{da.eventWatchAppAd},
+            #{da.eventMultiConversionCost},
+            #{da.merchantRecoFansCost},
+            #{da.adScene},
+            #{da.eventAdWatchTimesCost},
+            #{da.eventAddShoppingCart},
+            #{da.ageSegment},
+            #{da.photoLike},
+            #{da.eventAddWechat},
+            #{da.eventAddWechatCost},
+            #{da.eventAddWechatRatio},
+            #{da.eventAppInvokedCost},
+            #{da.eventMultiConversion},
+            #{da.eventDspGiftForm},
+            #{da.eventAppInvokedRatio},
+            #{da.photoShow},
+            #{da.eventMultiConversionRatio},
+            #{da.client},
+            #{da.eventGoodsViewCost},
+            #{da.eventCreditGrantAppRatio},
+            #{da.eventAdWatchTimes},
+            #{da.comments}
+            )
+        </foreach>
+    </insert>
 
 </mapper>

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

@@ -2,4 +2,250 @@
 <!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.KuaishouAudienceReportDailyClientMapper">
 
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_audience_report_daily_client (
+        account_id,
+        plan_id ,
+        unit_id ,
+        placement_type,
+        stat_date ,
+        aclick ,
+        bclick ,
+        photo_click_cost,
+        follow ,
+        cancel_follow ,
+        report ,
+        block ,
+        negative ,
+        download_started ,
+        download_completed ,
+        activation ,
+        submit ,
+        photo_click ,
+        photo_click_ratio,
+        charge ,
+        action_ratio ,
+        impression_1k_cost,
+        action_cost ,
+        event_pay_first_day ,
+        event_pay_purchase_amount_first_day,
+        event_pay_first_day_roi,
+        event_pay ,
+        event_pay_purchase_amount ,
+        event_pay_roi ,
+        event_register ,
+        event_register_cost ,
+        event_register_ratio ,
+        event_jin_jian_app ,
+        event_jin_jian_app_cost ,
+        event_credit_grant_app ,
+        event_credit_grant_app_cost,
+        event_order_paid ,
+        event_order_paid_purchase_amount,
+        event_jin_jian_landing_page ,
+        event_jin_jian_landing_page_cost ,
+        event_credit_grant_landing_page ,
+        event_credit_grant_landing_page_cost,
+        event_credit_grant_landing_ratio ,
+        event_next_day_stay_cost ,
+        event_next_day_stay_ratio ,
+        form_action_ratio ,
+        event_order_paid_cost ,
+        event_next_day_stay ,
+        form_cost ,
+        form_count ,
+        play_3s_ratio ,
+        stat_hour ,
+        click_1k_cost ,
+        event_valid_clues ,
+        event_valid_clues_cost,
+        ad_product_cnt ,
+        event_goods_view ,
+        merchant_reco_fans ,
+        event_order_amount_roi ,
+        event_new_user_pay ,
+        event_new_user_pay_cost ,
+        event_new_user_pay_ratio ,
+        event_button_click ,
+        event_button_click_cost ,
+        event_button_click_ratio ,
+        play_5s_ratio ,
+        play_end_ratio ,
+        event_order_paid_roi,
+        event_new_user_jinjian_app ,
+        event_new_user_jinjian_app_cost,
+        event_new_user_jinjian_app_roi ,
+        event_new_user_credit_grant_app ,
+        event_new_user_credit_grant_app_cost,
+        event_new_user_credit_grant_app_roi ,
+        event_new_user_jinjian_page ,
+        event_new_user_jinjian_page_cost ,
+        event_new_user_jinjian_page_roi ,
+        event_new_user_credit_grant_page ,
+        event_new_user_credit_grant_page_cost ,
+        event_new_user_credit_grant_page_roi ,
+        event_appoint_form ,
+        event_appoint_form_cost,
+        event_appoint_form_ratio,
+        event_appoint_jump_click ,
+        event_appoint_jump_click_cost,
+        event_appoint_jump_click_ratio,
+        union_event_pay_purchase_amount_7d ,
+        province ,
+        event_app_invoked ,
+        union_event_pay_purchase_amount_7d_roi,
+        event_add_shopping_cart_cost ,
+        gender ,
+        city ,
+        event_ad_watch_times_ratio ,
+        shares ,
+        business_interest_tags ,
+        event_watch_app_ad ,
+        event_multi_conversion_cost,
+        merchant_reco_fans_cost ,
+        ad_scene ,
+        event_ad_watch_times_cost ,
+        event_add_shopping_cart ,
+        age_segment ,
+        photo_like ,
+        event_add_wechat ,
+        event_add_wechat_cost,
+        event_add_wechat_ratio,
+        event_app_invoked_cost ,
+        event_multi_conversion ,
+        event_dsp_gift_form ,
+        event_app_invoked_ratio ,
+        photo_show ,
+        event_multi_conversion_ratio,
+        client ,
+        event_goods_view_cost ,
+        event_credit_grant_app_ratio,
+        event_ad_watch_times ,
+        comments
+        )
+        values
+        <foreach collection="data" item="da" separator=",">
+            (
+            #{da.accountId},
+            #{da.planId},
+            #{da.unitId},
+            #{da.placementType},
+            #{da.statDate},
+            #{da.aclick},
+            #{da.bclick},
+            #{da.photoClickCost},
+            #{da.follow},
+            #{da.cancelFollow},
+            #{da.report},
+            #{da.block},
+            #{da.negative},
+            #{da.downloadStarted},
+            #{da.downloadCompleted},
+            #{da.activation},
+            #{da.submit},
+            #{da.photoClick},
+            #{da.photoClickRatio},
+            #{da.charge},
+            #{da.actionRatio},
+            #{da.impression_1kCost},
+            #{da.actionCost},
+            #{da.eventPayFirstDay},
+            #{da.eventPayPurchaseAmountFirstDay},
+            #{da.eventPayFirstDayRoi},
+            #{da.eventPay},
+            #{da.eventPayPurchaseAmount},
+            #{da.eventPayRoi},
+            #{da.eventRegister},
+            #{da.eventRegisterCost},
+            #{da.eventRegisterRatio},
+            #{da.eventJinJianApp},
+            #{da.eventJinJianAppCost},
+            #{da.eventCreditGrantApp},
+            #{da.eventCreditGrantAppCost},
+            #{da.eventOrderPaid},
+            #{da.eventOrderPaidPurchaseAmount},
+            #{da.eventJinJianLandingPage},
+            #{da.eventJinJianLandingPageCost},
+            #{da.eventCreditGrantLandingPage},
+            #{da.eventCreditGrantLandingPageCost},
+            #{da.eventCreditGrantLandingRatio},
+            #{da.eventNextDayStayCost},
+            #{da.eventNextDayStayRatio},
+            #{da.formActionRatio},
+            #{da.eventOrderPaidCost},
+            #{da.eventNextDayStay},
+            #{da.formCost},
+            #{da.formCount},
+            #{da.play_3sRatio},
+            #{da.statHour},
+            #{da.click_1kCost},
+            #{da.eventValidClues},
+            #{da.eventValidCluesCost},
+            #{da.adProductCnt},
+            #{da.eventGoodsView},
+            #{da.merchantRecoFans},
+            #{da.eventOrderAmountRoi},
+            #{da.eventNewUserPay},
+            #{da.eventNewUserPayCost},
+            #{da.eventNewUserPayRatio},
+            #{da.eventButtonClick},
+            #{da.eventButtonClickCost},
+            #{da.eventButtonClickRatio},
+            #{da.play_5sRatio},
+            #{da.playEndRatio},
+            #{da.eventOrderPaidRoi},
+            #{da.eventNewUserJinjianApp},
+            #{da.eventNewUserJinjianAppCost},
+            #{da.eventNewUserJinjianAppRoi},
+            #{da.eventNewUserCreditGrantApp},
+            #{da.eventNewUserCreditGrantAppCost},
+            #{da.eventNewUserCreditGrantAppRoi},
+            #{da.eventNewUserJinjianPage},
+            #{da.eventNewUserJinjianPageCost},
+            #{da.eventNewUserJinjianPageRoi},
+            #{da.eventNewUserCreditGrantPage},
+            #{da.eventNewUserCreditGrantPageCost},
+            #{da.eventNewUserCreditGrantPageRoi},
+            #{da.eventAppointForm},
+            #{da.eventAppointFormCost},
+            #{da.eventAppointFormRatio},
+            #{da.eventAppointJumpClick},
+            #{da.eventAppointJumpClickCost},
+            #{da.eventAppointJumpClickRatio},
+            #{da.unionEventPayPurchaseAmount_7d},
+            #{da.province},
+            #{da.eventAppInvoked},
+            #{da.unionEventPayPurchaseAmount_7dRoi},
+            #{da.eventAddShoppingCartCost},
+            #{da.gender},
+            #{da.city},
+            #{da.eventAdWatchTimesRatio},
+            #{da.shares},
+            #{da.businessInterestTags},
+            #{da.eventWatchAppAd},
+            #{da.eventMultiConversionCost},
+            #{da.merchantRecoFansCost},
+            #{da.adScene},
+            #{da.eventAdWatchTimesCost},
+            #{da.eventAddShoppingCart},
+            #{da.ageSegment},
+            #{da.photoLike},
+            #{da.eventAddWechat},
+            #{da.eventAddWechatCost},
+            #{da.eventAddWechatRatio},
+            #{da.eventAppInvokedCost},
+            #{da.eventMultiConversion},
+            #{da.eventDspGiftForm},
+            #{da.eventAppInvokedRatio},
+            #{da.photoShow},
+            #{da.eventMultiConversionRatio},
+            #{da.client},
+            #{da.eventGoodsViewCost},
+            #{da.eventCreditGrantAppRatio},
+            #{da.eventAdWatchTimes},
+            #{da.comments}
+            )
+        </foreach>
+    </insert>
+
 </mapper>

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

@@ -2,4 +2,250 @@
 <!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.KuaishouAudienceReportDailyGenderMapper">
 
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_audience_report_daily_gender (
+        account_id,
+        plan_id ,
+        unit_id ,
+        placement_type,
+        stat_date ,
+        aclick ,
+        bclick ,
+        photo_click_cost,
+        follow ,
+        cancel_follow ,
+        report ,
+        block ,
+        negative ,
+        download_started ,
+        download_completed ,
+        activation ,
+        submit ,
+        photo_click ,
+        photo_click_ratio,
+        charge ,
+        action_ratio ,
+        impression_1k_cost,
+        action_cost ,
+        event_pay_first_day ,
+        event_pay_purchase_amount_first_day,
+        event_pay_first_day_roi,
+        event_pay ,
+        event_pay_purchase_amount ,
+        event_pay_roi ,
+        event_register ,
+        event_register_cost ,
+        event_register_ratio ,
+        event_jin_jian_app ,
+        event_jin_jian_app_cost ,
+        event_credit_grant_app ,
+        event_credit_grant_app_cost,
+        event_order_paid ,
+        event_order_paid_purchase_amount,
+        event_jin_jian_landing_page ,
+        event_jin_jian_landing_page_cost ,
+        event_credit_grant_landing_page ,
+        event_credit_grant_landing_page_cost,
+        event_credit_grant_landing_ratio ,
+        event_next_day_stay_cost ,
+        event_next_day_stay_ratio ,
+        form_action_ratio ,
+        event_order_paid_cost ,
+        event_next_day_stay ,
+        form_cost ,
+        form_count ,
+        play_3s_ratio ,
+        stat_hour ,
+        click_1k_cost ,
+        event_valid_clues ,
+        event_valid_clues_cost,
+        ad_product_cnt ,
+        event_goods_view ,
+        merchant_reco_fans ,
+        event_order_amount_roi ,
+        event_new_user_pay ,
+        event_new_user_pay_cost ,
+        event_new_user_pay_ratio ,
+        event_button_click ,
+        event_button_click_cost ,
+        event_button_click_ratio ,
+        play_5s_ratio ,
+        play_end_ratio ,
+        event_order_paid_roi,
+        event_new_user_jinjian_app ,
+        event_new_user_jinjian_app_cost,
+        event_new_user_jinjian_app_roi ,
+        event_new_user_credit_grant_app ,
+        event_new_user_credit_grant_app_cost,
+        event_new_user_credit_grant_app_roi ,
+        event_new_user_jinjian_page ,
+        event_new_user_jinjian_page_cost ,
+        event_new_user_jinjian_page_roi ,
+        event_new_user_credit_grant_page ,
+        event_new_user_credit_grant_page_cost ,
+        event_new_user_credit_grant_page_roi ,
+        event_appoint_form ,
+        event_appoint_form_cost,
+        event_appoint_form_ratio,
+        event_appoint_jump_click ,
+        event_appoint_jump_click_cost,
+        event_appoint_jump_click_ratio,
+        union_event_pay_purchase_amount_7d ,
+        province ,
+        event_app_invoked ,
+        union_event_pay_purchase_amount_7d_roi,
+        event_add_shopping_cart_cost ,
+        gender ,
+        city ,
+        event_ad_watch_times_ratio ,
+        shares ,
+        business_interest_tags ,
+        event_watch_app_ad ,
+        event_multi_conversion_cost,
+        merchant_reco_fans_cost ,
+        ad_scene ,
+        event_ad_watch_times_cost ,
+        event_add_shopping_cart ,
+        age_segment ,
+        photo_like ,
+        event_add_wechat ,
+        event_add_wechat_cost,
+        event_add_wechat_ratio,
+        event_app_invoked_cost ,
+        event_multi_conversion ,
+        event_dsp_gift_form ,
+        event_app_invoked_ratio ,
+        photo_show ,
+        event_multi_conversion_ratio,
+        client ,
+        event_goods_view_cost ,
+        event_credit_grant_app_ratio,
+        event_ad_watch_times ,
+        comments
+        )
+        values
+        <foreach collection="data" item="da" separator=",">
+            (
+            #{da.accountId},
+            #{da.planId},
+            #{da.unitId},
+            #{da.placementType},
+            #{da.statDate},
+            #{da.aclick},
+            #{da.bclick},
+            #{da.photoClickCost},
+            #{da.follow},
+            #{da.cancelFollow},
+            #{da.report},
+            #{da.block},
+            #{da.negative},
+            #{da.downloadStarted},
+            #{da.downloadCompleted},
+            #{da.activation},
+            #{da.submit},
+            #{da.photoClick},
+            #{da.photoClickRatio},
+            #{da.charge},
+            #{da.actionRatio},
+            #{da.impression_1kCost},
+            #{da.actionCost},
+            #{da.eventPayFirstDay},
+            #{da.eventPayPurchaseAmountFirstDay},
+            #{da.eventPayFirstDayRoi},
+            #{da.eventPay},
+            #{da.eventPayPurchaseAmount},
+            #{da.eventPayRoi},
+            #{da.eventRegister},
+            #{da.eventRegisterCost},
+            #{da.eventRegisterRatio},
+            #{da.eventJinJianApp},
+            #{da.eventJinJianAppCost},
+            #{da.eventCreditGrantApp},
+            #{da.eventCreditGrantAppCost},
+            #{da.eventOrderPaid},
+            #{da.eventOrderPaidPurchaseAmount},
+            #{da.eventJinJianLandingPage},
+            #{da.eventJinJianLandingPageCost},
+            #{da.eventCreditGrantLandingPage},
+            #{da.eventCreditGrantLandingPageCost},
+            #{da.eventCreditGrantLandingRatio},
+            #{da.eventNextDayStayCost},
+            #{da.eventNextDayStayRatio},
+            #{da.formActionRatio},
+            #{da.eventOrderPaidCost},
+            #{da.eventNextDayStay},
+            #{da.formCost},
+            #{da.formCount},
+            #{da.play_3sRatio},
+            #{da.statHour},
+            #{da.click_1kCost},
+            #{da.eventValidClues},
+            #{da.eventValidCluesCost},
+            #{da.adProductCnt},
+            #{da.eventGoodsView},
+            #{da.merchantRecoFans},
+            #{da.eventOrderAmountRoi},
+            #{da.eventNewUserPay},
+            #{da.eventNewUserPayCost},
+            #{da.eventNewUserPayRatio},
+            #{da.eventButtonClick},
+            #{da.eventButtonClickCost},
+            #{da.eventButtonClickRatio},
+            #{da.play_5sRatio},
+            #{da.playEndRatio},
+            #{da.eventOrderPaidRoi},
+            #{da.eventNewUserJinjianApp},
+            #{da.eventNewUserJinjianAppCost},
+            #{da.eventNewUserJinjianAppRoi},
+            #{da.eventNewUserCreditGrantApp},
+            #{da.eventNewUserCreditGrantAppCost},
+            #{da.eventNewUserCreditGrantAppRoi},
+            #{da.eventNewUserJinjianPage},
+            #{da.eventNewUserJinjianPageCost},
+            #{da.eventNewUserJinjianPageRoi},
+            #{da.eventNewUserCreditGrantPage},
+            #{da.eventNewUserCreditGrantPageCost},
+            #{da.eventNewUserCreditGrantPageRoi},
+            #{da.eventAppointForm},
+            #{da.eventAppointFormCost},
+            #{da.eventAppointFormRatio},
+            #{da.eventAppointJumpClick},
+            #{da.eventAppointJumpClickCost},
+            #{da.eventAppointJumpClickRatio},
+            #{da.unionEventPayPurchaseAmount_7d},
+            #{da.province},
+            #{da.eventAppInvoked},
+            #{da.unionEventPayPurchaseAmount_7dRoi},
+            #{da.eventAddShoppingCartCost},
+            #{da.gender},
+            #{da.city},
+            #{da.eventAdWatchTimesRatio},
+            #{da.shares},
+            #{da.businessInterestTags},
+            #{da.eventWatchAppAd},
+            #{da.eventMultiConversionCost},
+            #{da.merchantRecoFansCost},
+            #{da.adScene},
+            #{da.eventAdWatchTimesCost},
+            #{da.eventAddShoppingCart},
+            #{da.ageSegment},
+            #{da.photoLike},
+            #{da.eventAddWechat},
+            #{da.eventAddWechatCost},
+            #{da.eventAddWechatRatio},
+            #{da.eventAppInvokedCost},
+            #{da.eventMultiConversion},
+            #{da.eventDspGiftForm},
+            #{da.eventAppInvokedRatio},
+            #{da.photoShow},
+            #{da.eventMultiConversionRatio},
+            #{da.client},
+            #{da.eventGoodsViewCost},
+            #{da.eventCreditGrantAppRatio},
+            #{da.eventAdWatchTimes},
+            #{da.comments}
+            )
+        </foreach>
+    </insert>
+
 </mapper>

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

@@ -2,5 +2,250 @@
 <!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.KuaishouAudienceReportDailyProvinceMapper">
 
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_audience_report_daily_province (
+        account_id,
+        plan_id ,
+        unit_id ,
+        placement_type,
+        stat_date ,
+        aclick ,
+        bclick ,
+        photo_click_cost,
+        follow ,
+        cancel_follow ,
+        report ,
+        block ,
+        negative ,
+        download_started ,
+        download_completed ,
+        activation ,
+        submit ,
+        photo_click ,
+        photo_click_ratio,
+        charge ,
+        action_ratio ,
+        impression_1k_cost,
+        action_cost ,
+        event_pay_first_day ,
+        event_pay_purchase_amount_first_day,
+        event_pay_first_day_roi,
+        event_pay ,
+        event_pay_purchase_amount ,
+        event_pay_roi ,
+        event_register ,
+        event_register_cost ,
+        event_register_ratio ,
+        event_jin_jian_app ,
+        event_jin_jian_app_cost ,
+        event_credit_grant_app ,
+        event_credit_grant_app_cost,
+        event_order_paid ,
+        event_order_paid_purchase_amount,
+        event_jin_jian_landing_page ,
+        event_jin_jian_landing_page_cost ,
+        event_credit_grant_landing_page ,
+        event_credit_grant_landing_page_cost,
+        event_credit_grant_landing_ratio ,
+        event_next_day_stay_cost ,
+        event_next_day_stay_ratio ,
+        form_action_ratio ,
+        event_order_paid_cost ,
+        event_next_day_stay ,
+        form_cost ,
+        form_count ,
+        play_3s_ratio ,
+        stat_hour ,
+        click_1k_cost ,
+        event_valid_clues ,
+        event_valid_clues_cost,
+        ad_product_cnt ,
+        event_goods_view ,
+        merchant_reco_fans ,
+        event_order_amount_roi ,
+        event_new_user_pay ,
+        event_new_user_pay_cost ,
+        event_new_user_pay_ratio ,
+        event_button_click ,
+        event_button_click_cost ,
+        event_button_click_ratio ,
+        play_5s_ratio ,
+        play_end_ratio ,
+        event_order_paid_roi,
+        event_new_user_jinjian_app ,
+        event_new_user_jinjian_app_cost,
+        event_new_user_jinjian_app_roi ,
+        event_new_user_credit_grant_app ,
+        event_new_user_credit_grant_app_cost,
+        event_new_user_credit_grant_app_roi ,
+        event_new_user_jinjian_page ,
+        event_new_user_jinjian_page_cost ,
+        event_new_user_jinjian_page_roi ,
+        event_new_user_credit_grant_page ,
+        event_new_user_credit_grant_page_cost ,
+        event_new_user_credit_grant_page_roi ,
+        event_appoint_form ,
+        event_appoint_form_cost,
+        event_appoint_form_ratio,
+        event_appoint_jump_click ,
+        event_appoint_jump_click_cost,
+        event_appoint_jump_click_ratio,
+        union_event_pay_purchase_amount_7d ,
+        province ,
+        event_app_invoked ,
+        union_event_pay_purchase_amount_7d_roi,
+        event_add_shopping_cart_cost ,
+        gender ,
+        city ,
+        event_ad_watch_times_ratio ,
+        shares ,
+        business_interest_tags ,
+        event_watch_app_ad ,
+        event_multi_conversion_cost,
+        merchant_reco_fans_cost ,
+        ad_scene ,
+        event_ad_watch_times_cost ,
+        event_add_shopping_cart ,
+        age_segment ,
+        photo_like ,
+        event_add_wechat ,
+        event_add_wechat_cost,
+        event_add_wechat_ratio,
+        event_app_invoked_cost ,
+        event_multi_conversion ,
+        event_dsp_gift_form ,
+        event_app_invoked_ratio ,
+        photo_show ,
+        event_multi_conversion_ratio,
+        client ,
+        event_goods_view_cost ,
+        event_credit_grant_app_ratio,
+        event_ad_watch_times ,
+        comments
+        )
+        values
+        <foreach collection="data" item="da" separator=",">
+            (
+            #{da.accountId},
+            #{da.planId},
+            #{da.unitId},
+            #{da.placementType},
+            #{da.statDate},
+            #{da.aclick},
+            #{da.bclick},
+            #{da.photoClickCost},
+            #{da.follow},
+            #{da.cancelFollow},
+            #{da.report},
+            #{da.block},
+            #{da.negative},
+            #{da.downloadStarted},
+            #{da.downloadCompleted},
+            #{da.activation},
+            #{da.submit},
+            #{da.photoClick},
+            #{da.photoClickRatio},
+            #{da.charge},
+            #{da.actionRatio},
+            #{da.impression_1kCost},
+            #{da.actionCost},
+            #{da.eventPayFirstDay},
+            #{da.eventPayPurchaseAmountFirstDay},
+            #{da.eventPayFirstDayRoi},
+            #{da.eventPay},
+            #{da.eventPayPurchaseAmount},
+            #{da.eventPayRoi},
+            #{da.eventRegister},
+            #{da.eventRegisterCost},
+            #{da.eventRegisterRatio},
+            #{da.eventJinJianApp},
+            #{da.eventJinJianAppCost},
+            #{da.eventCreditGrantApp},
+            #{da.eventCreditGrantAppCost},
+            #{da.eventOrderPaid},
+            #{da.eventOrderPaidPurchaseAmount},
+            #{da.eventJinJianLandingPage},
+            #{da.eventJinJianLandingPageCost},
+            #{da.eventCreditGrantLandingPage},
+            #{da.eventCreditGrantLandingPageCost},
+            #{da.eventCreditGrantLandingRatio},
+            #{da.eventNextDayStayCost},
+            #{da.eventNextDayStayRatio},
+            #{da.formActionRatio},
+            #{da.eventOrderPaidCost},
+            #{da.eventNextDayStay},
+            #{da.formCost},
+            #{da.formCount},
+            #{da.play_3sRatio},
+            #{da.statHour},
+            #{da.click_1kCost},
+            #{da.eventValidClues},
+            #{da.eventValidCluesCost},
+            #{da.adProductCnt},
+            #{da.eventGoodsView},
+            #{da.merchantRecoFans},
+            #{da.eventOrderAmountRoi},
+            #{da.eventNewUserPay},
+            #{da.eventNewUserPayCost},
+            #{da.eventNewUserPayRatio},
+            #{da.eventButtonClick},
+            #{da.eventButtonClickCost},
+            #{da.eventButtonClickRatio},
+            #{da.play_5sRatio},
+            #{da.playEndRatio},
+            #{da.eventOrderPaidRoi},
+            #{da.eventNewUserJinjianApp},
+            #{da.eventNewUserJinjianAppCost},
+            #{da.eventNewUserJinjianAppRoi},
+            #{da.eventNewUserCreditGrantApp},
+            #{da.eventNewUserCreditGrantAppCost},
+            #{da.eventNewUserCreditGrantAppRoi},
+            #{da.eventNewUserJinjianPage},
+            #{da.eventNewUserJinjianPageCost},
+            #{da.eventNewUserJinjianPageRoi},
+            #{da.eventNewUserCreditGrantPage},
+            #{da.eventNewUserCreditGrantPageCost},
+            #{da.eventNewUserCreditGrantPageRoi},
+            #{da.eventAppointForm},
+            #{da.eventAppointFormCost},
+            #{da.eventAppointFormRatio},
+            #{da.eventAppointJumpClick},
+            #{da.eventAppointJumpClickCost},
+            #{da.eventAppointJumpClickRatio},
+            #{da.unionEventPayPurchaseAmount_7d},
+            #{da.province},
+            #{da.eventAppInvoked},
+            #{da.unionEventPayPurchaseAmount_7dRoi},
+            #{da.eventAddShoppingCartCost},
+            #{da.gender},
+            #{da.city},
+            #{da.eventAdWatchTimesRatio},
+            #{da.shares},
+            #{da.businessInterestTags},
+            #{da.eventWatchAppAd},
+            #{da.eventMultiConversionCost},
+            #{da.merchantRecoFansCost},
+            #{da.adScene},
+            #{da.eventAdWatchTimesCost},
+            #{da.eventAddShoppingCart},
+            #{da.ageSegment},
+            #{da.photoLike},
+            #{da.eventAddWechat},
+            #{da.eventAddWechatCost},
+            #{da.eventAddWechatRatio},
+            #{da.eventAppInvokedCost},
+            #{da.eventMultiConversion},
+            #{da.eventDspGiftForm},
+            #{da.eventAppInvokedRatio},
+            #{da.photoShow},
+            #{da.eventMultiConversionRatio},
+            #{da.client},
+            #{da.eventGoodsViewCost},
+            #{da.eventCreditGrantAppRatio},
+            #{da.eventAdWatchTimes},
+            #{da.comments}
+            )
+        </foreach>
+    </insert>
 
 </mapper>

+ 74 - 59
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml

@@ -673,11 +673,28 @@
 
 
     <insert id="loadAccountDailyReport">
-		LOAD DATA local INFILE  #{localPath}
-		INTO TABLE ctop_kuaishou_report_daily_account
-		FIELDS TERMINATED BY ',' enclosed by '"' LINES TERMINATED BY '\n'
-		IGNORE 1 LINES
-		(ad_scene,
+        LOAD
+        DATA local INFILE
+        #{localPath}
+        INTO
+        TABLE
+        ctop_kuaishou_report_daily_account
+        FIELDS
+        TERMINATED
+        BY
+        ','
+        enclosed
+        by
+        '"'
+        LINES
+        TERMINATED
+        BY
+        '\n'
+        IGNORE
+        1
+        LINES
+        (
+        ad_scene,
         charge,
         photo_show,
         aclick,
@@ -768,14 +785,16 @@
         event_appoint_jump_click_cost,
         event_appoint_jump_click_ratio
         )
-          set account_id = #{accountId}
+        set
+        account_id
+        =
+        #{accountId}
     </insert>
 
 
     <select id="selectCost" resultType="com.alibaba.fastjson.JSONObject">
-        select
-            sum(charge) cost,
-            stat_date statDate
+        select sum(charge) cost,
+               stat_date   statDate
         from ctop_kuaishou_report_daily_account
         where account_id = #{accountId}
           and stat_date &gt;= #{startDate}
@@ -1189,11 +1208,9 @@
     </select>
 
     <select id="getRoleCodeByUserId" resultType="string">
-        select
-        role_code
-        from
-        sys_user_role a
-        left join sys_role b on a.role_id = b.id
+        select role_code
+        from sys_user_role a
+                 left join sys_role b on a.role_id = b.id
         where a.user_id = #{userId}
     </select>
 
@@ -1311,13 +1328,10 @@
 
 
     <select id="getVideoUrl" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouVideoInfoDTO">
-        select
-        url as url,
-        cover_url as coverUrl
-        from
-        ctop_kuaishou_video_get
-        where photo_id = #{photoId}
-        limit 1
+        select url       as url,
+               cover_url as coverUrl
+        from ctop_kuaishou_video_get
+        where photo_id = #{photoId} limit 1
     </select>
 
     <select id="getUserProjectAccountIds" resultType="long">
@@ -1453,47 +1467,48 @@
 
     <select id="queryEveryDayDataForAccount"
             resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly">
-    SELECT stat_date,
-           account_id,
-           SUM(charge) as 'charge',
-           SUM(photo_show) as 'photoShow',
-           SUM(photo_click) as 'photoClick',
-           SUM(aclick) as 'aclick',
-           SUM(bclick) as 'bclick',
-           SUM(photo_share) as 'photoShare',
-           SUM(photo_comment) as 'photoComment',
-           SUM(photo_like) as 'photoLike',
-           SUM(follow) as 'follow',
-           SUM(cancel_follow) as 'cancelFollow',
-           SUM(report) as 'report',
-           SUM(block) as 'block',
-           SUM(negative) as 'negative',
-           SUM(download_started) as 'downloadStarted',
-           SUM(download_completed) as 'downloadCompleted',
-           SUM(activation) as 'activation',
-           SUM(submit) as 'submit',
-           SUM(event_pay_first_day) as 'eventPayFirstDay',
-           SUM(event_pay_purchase_amount_first_day) as 'eventPayPurchaseAmountFirstDay',
-           SUM(event_pay) as 'eventPay',
-           SUM(event_pay_purchase_amount) as 'eventPayPurchaseAmount',
-           SUM(event_register) as 'eventRegister',
-           SUM(event_jin_jian_app) as 'eventJinJianApp',
-           SUM(event_credit_grant_app) as 'eventCreditGrantApp',
-           SUM(event_order_paid) as 'eventOrderPaid',
-           SUM(event_order_paid_purchase_amount) as 'eventOrderPaidPurchaseAmount',
-           SUM(event_jin_jian_landing_page) as 'eventJinJianLandingPage',
-           SUM(event_credit_grant_landing_page) as 'eventCreditGrantLandingPage',
-           SUM(event_next_day_stay) as 'eventNextDayStay',
-           SUM(form_count) as 'formCount',
-           ROUND(SUM(play_3s_ratio * photo_show)) as 'play3sCount'
-    FROM ctop_kuaishou_report_daily_account
-    WHERE stat_date = DATE_FORMAT(date_sub(now(), interval 1 day), '%Y-%m-%d')
-    GROUP BY account_id
+        SELECT stat_date,
+               account_id,
+               SUM(charge) as 'charge',
+               SUM(photo_show) as 'photoShow',
+               SUM(photo_click) as 'photoClick',
+               SUM(aclick) as 'aclick',
+               SUM(bclick) as 'bclick',
+               SUM(photo_share) as 'photoShare',
+               SUM(photo_comment) as 'photoComment',
+               SUM(photo_like) as 'photoLike',
+               SUM(follow) as 'follow',
+               SUM(cancel_follow) as 'cancelFollow',
+               SUM(report) as 'report',
+               SUM(block) as 'block',
+               SUM(negative) as 'negative',
+               SUM(download_started) as 'downloadStarted',
+               SUM(download_completed) as 'downloadCompleted',
+               SUM(activation) as 'activation',
+               SUM(submit) as 'submit',
+               SUM(event_pay_first_day) as 'eventPayFirstDay',
+               SUM(event_pay_purchase_amount_first_day) as 'eventPayPurchaseAmountFirstDay',
+               SUM(event_pay) as 'eventPay',
+               SUM(event_pay_purchase_amount) as 'eventPayPurchaseAmount',
+               SUM(event_register) as 'eventRegister',
+               SUM(event_jin_jian_app) as 'eventJinJianApp',
+               SUM(event_credit_grant_app) as 'eventCreditGrantApp',
+               SUM(event_order_paid) as 'eventOrderPaid',
+               SUM(event_order_paid_purchase_amount) as 'eventOrderPaidPurchaseAmount',
+               SUM(event_jin_jian_landing_page) as 'eventJinJianLandingPage',
+               SUM(event_credit_grant_landing_page) as 'eventCreditGrantLandingPage',
+               SUM(event_next_day_stay) as 'eventNextDayStay',
+               SUM(form_count) as 'formCount',
+               SUM(play_3s_ratio * aclick) as 'play3sCount'
+        FROM ctop_kuaishou_report_daily_account
+        WHERE stat_date = DATE_FORMAT(date_sub(now(), interval 1 day), '%Y-%m-%d')
+        GROUP BY account_id
     </select>
     <select id="getSumChargeByAccountIdAndStatDate" resultType="java.math.BigDecimal">
-        select  sum(charge)  from  ctop_kuaishou_report_daily_account
+        select sum(charge)
+        from ctop_kuaishou_report_daily_account
         where account_id = #{accountId}
-        and stat_date = #{statDate}
+          and stat_date = #{statDate}
     </select>
 
 </mapper>

+ 36 - 37
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportHourlyAccountMapper.xml

@@ -116,10 +116,9 @@
 
     <select id="selectMaxHour" resultType="java.lang.Integer">
         select max(stat_hour)
-        from
-        ctop_kuaishou_report_hourly_account
+        from ctop_kuaishou_report_hourly_account
         where account_id = #{accountId}
-        and stat_date = #{statDate}
+          and stat_date = #{statDate}
 
     </select>
 
@@ -135,42 +134,42 @@
     <select id="queryEveryhourlyDataForAccount"
             resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly">
         SELECT stat_date,
-        account_id,
-        DATE_FORMAT(now(), '%H') as 'statHour',
-        SUM(charge) as 'charge',
-        SUM(photo_show) as 'photoShow',
-        SUM(photo_click) as 'photoClick',
-        SUM(aclick) as 'aclick',
-        SUM(bclick) as 'bclick',
-        SUM(share) as 'photoShare',
-        SUM(comment) as 'photoComment',
-        SUM(photo_like) as 'photoLike',
-        SUM(follow) as 'follow',
-        SUM(cancel_follow) as 'cancelFollow',
-        SUM(report) as 'report',
-        SUM(block) as 'block',
-        SUM(negative) as 'negative',
-        SUM(download_started) as 'downloadStarted',
-        SUM(download_completed) as 'downloadCompleted',
-        SUM(activation) as 'activation',
-        SUM(submit) as 'submit',
-        SUM(event_pay_first_day) as 'eventPayFirstDay',
-        SUM(event_pay_purchase_amount_first_day) as 'eventPayPurchaseAmountFirstDay',
-        SUM(event_pay) as 'eventPay',
-        SUM(event_pay_purchase_amount) as 'eventPayPurchaseAmount',
-        SUM(event_register) as 'eventRegister',
-        SUM(event_jin_jian_app) as 'eventJinJianApp',
-        SUM(event_credit_grant_app) as 'eventCreditGrantApp',
-        SUM(event_order_paid) as 'eventOrderPaid',
-        SUM(event_order_paid_purchase_amount) as 'eventOrderPaidPurchaseAmount',
-        SUM(event_jin_jian_landing_page) as 'eventJinJianLandingPage',
-        SUM(event_credit_grant_landing_page) as 'eventCreditGrantLandingPage',
-        SUM(event_next_day_stay) as 'eventNextDayStay',
-        SUM(form_count) as 'formCount',
-        ROUND(SUM(play_3s_ratio * photo_show)) as 'play3sCount'
+               account_id,
+               DATE_FORMAT(now(), '%H') as 'statHour',
+               SUM(charge) as 'charge',
+               SUM(photo_show) as 'photoShow',
+               SUM(photo_click) as 'photoClick',
+               SUM(aclick) as 'aclick',
+               SUM(bclick) as 'bclick',
+               SUM(share) as 'photoShare',
+               SUM(comment) as 'photoComment',
+               SUM(photo_like) as 'photoLike',
+               SUM(follow) as 'follow',
+               SUM(cancel_follow) as 'cancelFollow',
+               SUM(report) as 'report',
+               SUM(block) as 'block',
+               SUM(negative) as 'negative',
+               SUM(download_started) as 'downloadStarted',
+               SUM(download_completed) as 'downloadCompleted',
+               SUM(activation) as 'activation',
+               SUM(submit) as 'submit',
+               SUM(event_pay_first_day) as 'eventPayFirstDay',
+               SUM(event_pay_purchase_amount_first_day) as 'eventPayPurchaseAmountFirstDay',
+               SUM(event_pay) as 'eventPay',
+               SUM(event_pay_purchase_amount) as 'eventPayPurchaseAmount',
+               SUM(event_register) as 'eventRegister',
+               SUM(event_jin_jian_app) as 'eventJinJianApp',
+               SUM(event_credit_grant_app) as 'eventCreditGrantApp',
+               SUM(event_order_paid) as 'eventOrderPaid',
+               SUM(event_order_paid_purchase_amount) as 'eventOrderPaidPurchaseAmount',
+               SUM(event_jin_jian_landing_page) as 'eventJinJianLandingPage',
+               SUM(event_credit_grant_landing_page) as 'eventCreditGrantLandingPage',
+               SUM(event_next_day_stay) as 'eventNextDayStay',
+               SUM(form_count) as 'formCount',
+               SUM(play_3s_ratio * aclick) as 'play3sCount'
         FROM ctop_kuaishou_report_hourly_account
         WHERE stat_date = DATE_FORMAT(now(), '%Y-%m-%d')
-        AND stat_hour  &lt;= DATE_FORMAT(now(), '%H')
+          AND stat_hour &lt;= DATE_FORMAT(now(), '%H')
         GROUP BY account_id
     </select>
 

+ 8 - 9
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouAudienceReportDailyServiceImpl.java

@@ -32,10 +32,7 @@ import cn.com.ctop.kuaishou.modules.report.service.IKuaishouAudienceReportDailyS
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.api.vo.Result;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -190,19 +187,21 @@ public class KuaishouAudienceReportDailyServiceImpl extends ServiceImpl<Kuaishou
                                 }
                             }
                             if ("province".equals(type)) {
-                                dailyProvinceService.saveBatch(provinceList);
+                                provinceMapper.replaceBatch(provinceList);
                             } else if ("city".equals(type)) {
-                                dailyCityService.saveBatch(cityList);
+                                cityMapper.replaceBatch(cityList);
                             } else if ("gender".equals(type)) {
-                                dailyGenderService.saveBatch(genderList);
+                                genderMapper.replaceBatch(genderList);
                             } else if ("ageSegment".equals(type)) {
-                                dailyAgeService.saveBatch(ageList);
+                                ageMapper.replaceBatch(ageList);
                             } else if ("clientId".equals(type)) {
-                                dailyClientService.saveBatch(clientList);
+                                clientMapper.replaceBatch(clientList);
                             } else if ("businessInterestTags".equals(type)) {
-                                dailyBusinessService.saveBatch(businessList);
+                                bussinessMapper.replaceBatch(businessList);
                             }
                         }
+                    } else {
+                        log.error("-----------未查询到人群分析报表数据:unitId:{},日期:{}", unit, date);
                     }
                 } else {
                     log.error("查询人群分析报表数据返回信息错误:accountId:{},返回信息:{}", token.getAccountId(), resultJson);

+ 36 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/entity/EtlDesignDailyReport.java

@@ -0,0 +1,36 @@
+package cn.com.ctop.toutiao.modules.link.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * 设计人员日报
+ */
+@Data
+@TableName("etl_design_daily_report")
+public class EtlDesignDailyReport {
+    
+	/**id*/
+	@TableId(type = IdType.AUTO)
+	private Integer id;
+	/**userId*/
+	private String userId;
+	/**userName*/
+	private String userName;
+	/**cost*/
+	private java.math.BigDecimal cost;
+	/**statDate*/
+	private String statDate;
+	/**roleName*/
+	private String roleName;
+	/**leaderId*/
+	private String leaderId;
+	/**leaderName*/
+	private String leaderName;
+	/**depId*/
+	private String depId;
+	/**depName*/
+	private String depName;
+}

+ 18 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/mapper/ETLDesignDailyReportMapper.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.toutiao.modules.link.mapper;
+
+import cn.com.ctop.toutiao.modules.link.entity.EtlDesignDailyReport;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface ETLDesignDailyReportMapper extends BaseMapper<EtlDesignDailyReport> {
+
+    List<JSONObject> queryMaterialCostGroupMd5ByStatDate(@Param("statDate") String statDate);
+
+    List<EtlDesignDailyReport> queryAllDesign(@Param("statDate") String statDate);
+
+    void insertBatch(@Param("records") List<EtlDesignDailyReport> records);
+
+}

+ 88 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/mapper/xml/EtlDesignDailyReportMapper.xml

@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.toutiao.modules.link.mapper.ETLDesignDailyReportMapper">
+
+    <select id="queryMaterialCostGroupMd5ByStatDate" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            sum(cost) cost,
+            clip_id clipId,
+            plan_id planId,
+            shot_id shotId
+        FROM
+            etl_report_bytedance_video
+        WHERE
+            stat_datetime = #{statDate}
+          AND cover_url!=''
+        GROUP BY md5 HAVING sum(cost)>0
+        union all
+        SELECT
+            t1.cost,
+            t2.clip_id clipId,
+            t2.plan_id planId,
+            t2.shot_id shotId
+        FROM
+            (select sum(charge) cost,
+                    t1.signature
+             from ctop_etl_kuaishou_account_material_report_daily t1
+             where
+                 t1.stat_date = #{statDate}
+             GROUP BY t1.signature HAVING  sum(charge)>0
+            ) t1
+                LEFT JOIN ctop_etl_kuaishou_video_info t2
+                          ON t1.signature = t2.video_code
+        where t2.clip_id  is not null
+    </select>
+
+    <select id="queryAllDesign" resultType="cn.com.ctop.toutiao.modules.link.entity.EtlDesignDailyReport">
+        SELECT
+            t1.id as userId,
+            t1.realname as userName,
+            t5.role_name as roleName,
+            t1.leader_id,
+            t1.leader_name,
+            t3.id as depId,
+            t3.depart_name as depName,
+            #{statDate} as statDate
+        FROM
+            sys_user t1
+                LEFT JOIN sys_user_depart t2 on t1.id=t2.user_id
+                LEFT JOIN sys_depart t3 on t2.dep_id=t3.id
+                LEFT JOIN sys_user_role t4 on t1.id=t4.user_id
+                LEFT JOIN sys_role t5 on t4.role_id=t5.id
+-- where t5.role_name in ('设计组长','剪辑','策划')
+        where t3.depart_name like '快手设计%'
+           or t3.depart_name like '设计-%'
+           or t3.depart_name like '头条设计%'
+            and t1.leader_id is not null
+            and t1.`status`=1
+            and t1.del_flag=0
+    </select>
+
+    <insert id="insertBatch">
+        insert into etl_design_daily_report(
+        user_id,
+        user_name,
+        cost,
+        stat_date,
+        role_name,
+        leader_id,
+        leader_name,
+        dep_id,
+        dep_name
+        )
+        values
+        <foreach collection="records" item="record" separator=",">
+            (#{record.userId},
+            #{record.userName},
+            #{record.cost},
+            #{record.statDate},
+            #{record.roleName},
+            #{record.leaderId},
+            #{record.leaderName},
+            #{record.depId},
+            #{record.depName}
+            )
+        </foreach>
+    </insert>
+
+</mapper>

+ 13 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/service/IEtlDesignDailyReportService.java

@@ -0,0 +1,13 @@
+package cn.com.ctop.toutiao.modules.link.service;
+
+import cn.com.ctop.toutiao.modules.link.entity.EtlDesignDailyReport;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *  设计人员日报
+ */
+public interface IEtlDesignDailyReportService extends IService<EtlDesignDailyReport> {
+
+    void cleanEtl(String statDate);
+
+}

+ 56 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/service/impl/EtlDesignDailyReportServiceImpl.java

@@ -0,0 +1,56 @@
+package cn.com.ctop.toutiao.modules.link.service.impl;
+
+import cn.com.ctop.toutiao.modules.link.entity.EtlDesignDailyReport;
+import cn.com.ctop.toutiao.modules.link.mapper.ETLDesignDailyReportMapper;
+import cn.com.ctop.toutiao.modules.link.service.IEtlDesignDailyReportService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 设计人员日报
+ */
+@Service
+public class EtlDesignDailyReportServiceImpl extends ServiceImpl<ETLDesignDailyReportMapper, EtlDesignDailyReport> implements IEtlDesignDailyReportService {
+
+    @Autowired
+    ETLDesignDailyReportMapper etlDesignDailyReportMapper;
+
+    @Override
+    public void cleanEtl(String statDate) {
+        //查询t-1所有头条、快手素材产生的报表数据
+        List<JSONObject> materialReport=etlDesignDailyReportMapper.queryMaterialCostGroupMd5ByStatDate(statDate);
+        Map<String, BigDecimal> userMapCost= new HashMap<>();
+        materialReport.forEach(m -> {
+            if (userMapCost.get(m.getString("clipId")) == null) {
+                userMapCost.put(m.getString("clipId"), userMapCost.get(m.getString("clipId"))==null?BigDecimal.ZERO:userMapCost.get(m.getString("clipId")));
+            } else {
+                userMapCost.put(m.getString("clipId"), userMapCost.get(m.getString("clipId"))==null?BigDecimal.ZERO:userMapCost.get(m.getString("clipId")).add(m.getBigDecimal("cost")));
+            }
+            if (userMapCost.get(m.getString("planId")) == null) {
+                userMapCost.put(m.getString("planId"), userMapCost.get(m.getString("planId"))==null?BigDecimal.ZERO:userMapCost.get(m.getString("planId")));
+            } else {
+                userMapCost.put(m.getString("planId"), userMapCost.get(m.getString("planId"))==null?BigDecimal.ZERO:userMapCost.get(m.getString("planId")).add(m.getBigDecimal("cost")));
+            }
+            if (m.getString("shotId") != null) {
+                if (userMapCost.get(m.getString("shotId")) == null) {
+                    userMapCost.put(m.getString("shotId"), userMapCost.get(m.getString("shotId"))==null?BigDecimal.ZERO:userMapCost.get(m.getString("shotId")));
+                } else {
+                    userMapCost.put(m.getString("shotId"), userMapCost.get(m.getString("shotId"))==null?BigDecimal.ZERO:userMapCost.get(m.getString("shotId")).add(m.getBigDecimal("cost")));
+                }
+            }
+        });
+        //查询所有需要清洗数据的设计人员
+        List<EtlDesignDailyReport> allDesign = etlDesignDailyReportMapper.queryAllDesign(statDate);
+        allDesign.forEach(it->{
+            it.setCost(userMapCost.get(it.getUserId())==null?BigDecimal.ZERO:userMapCost.get(it.getUserId()));
+        });
+        etlDesignDailyReportMapper.insertBatch(allDesign);
+    }
+}

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceNewPlanReportCtrl.java

@@ -93,7 +93,7 @@ public class BytedanceNewPlanReportCtrl {
     }
 
     /**
-     * 查询所有的快手运营
+     * 查询所有的头条运营
      */
     @PostMapping("/report/AllOperator")
     public Result<List<JSONObject>> getAllOperator() {

+ 25 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/BytedanceAdvertiserDailyReport.java

@@ -363,6 +363,19 @@ public class BytedanceAdvertiserDailyReport {
     @Excel(name = "次留成本", width = 15)
     @ApiModelProperty(value = "次留成本")
     private BigDecimal nextDayOpenCost;
+    /**
+     * 应用下载广告数据-次留数
+     */
+    private Long attributionNextDayOpenCnt;
+    /**
+     * 应用下载广告数据-次留成本
+     */
+    private BigDecimal attributionNextDayOpenCost;
+    /**
+     * 应用下载广告数据-次留率
+     */
+    private BigDecimal attributionNextDayOpenRate;
+
     @Excel(name = "创建时间")
     @ApiModelProperty(value = "创建时间")
     private Date createTime;
@@ -479,6 +492,18 @@ public class BytedanceAdvertiserDailyReport {
         if (null != nextDayOpenRate) {
             this.nextDayOpenRate = nextDayOpenRate;
         }
+        Long attributionNextDayOpenCnt = data.getLong("attribution_next_day_open_cnt");
+        if (null != attributionNextDayOpenCnt) {
+            this.attributionNextDayOpenCnt = attributionNextDayOpenCnt;
+        }
+        BigDecimal attributionNextDayOpenCost = data.getBigDecimal("attribution_next_day_open_cost");
+        if (null != attributionNextDayOpenCost) {
+            this.attributionNextDayOpenCost = attributionNextDayOpenCost;
+        }
+        BigDecimal attributionNextDayOpenRate = data.getBigDecimal("attribution_next_day_open_rate");
+        if (null != attributionNextDayOpenRate) {
+            this.attributionNextDayOpenRate = attributionNextDayOpenRate;
+        }
         Long mapSearch = data.getLong("map_search");
         if (null != mapSearch) {
             this.mapSearch = mapSearch;

+ 25 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/BytedanceAdvertiserHourlyReport.java

@@ -356,6 +356,7 @@ public class BytedanceAdvertiserHourlyReport {
     @Excel(name = "次留数", width = 15)
     @ApiModelProperty(value = "次留数")
     private Long nextDayOpen;
+
     /**
      * 次留率
      */
@@ -369,6 +370,18 @@ public class BytedanceAdvertiserHourlyReport {
     @ApiModelProperty(value = "次留成本")
     private BigDecimal nextDayOpenCost;
     /**
+     * 应用下载广告数据-次留数
+     */
+    private Long attributionNextDayOpenCnt;
+    /**
+     * 应用下载广告数据-次留成本
+     */
+    private BigDecimal attributionNextDayOpenCost;
+    /**
+     * 应用下载广告数据-次留率
+     */
+    private BigDecimal attributionNextDayOpenRate;
+    /**
      * createTime
      */
     @ApiModelProperty(value = "createTime")
@@ -493,6 +506,18 @@ public class BytedanceAdvertiserHourlyReport {
         if (null != getNextDayOpenRate) {
             this.nextDayOpenRate = getNextDayOpenRate;
         }
+        Long attributionNextDayOpenCnt = data.getLong("attribution_next_day_open_cnt");
+        if (null != attributionNextDayOpenCnt) {
+            this.attributionNextDayOpenCnt = attributionNextDayOpenCnt;
+        }
+        BigDecimal attributionNextDayOpenCost = data.getBigDecimal("attribution_next_day_open_cost");
+        if (null != attributionNextDayOpenCost) {
+            this.attributionNextDayOpenCost = attributionNextDayOpenCost;
+        }
+        BigDecimal attributionNextDayOpenRate = data.getBigDecimal("attribution_next_day_open_rate");
+        if (null != attributionNextDayOpenRate) {
+            this.attributionNextDayOpenRate = attributionNextDayOpenRate;
+        }
         Long getMapSearch = data.getLong("map_search");
         if (null != getMapSearch) {
             this.mapSearch = getMapSearch;