Sfoglia il codice sorgente

Merge branch 'master' into master_ai

syh 4 anni fa
parent
commit
a93b20557b
50 ha cambiato i file con 3977 aggiunte e 147 eliminazioni
  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. 50 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  4. 117 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/MaterialReportOverViewMapper.java
  5. 925 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MaterialReportOverViewMapper.xml
  6. 53 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IMaterialReportOverViewService.java
  7. 396 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/MaterialReportOverViewServiceImpl.java
  8. 32 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/controller/DesignerCommitProcessCtrl.java
  9. 9 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/entity/PlatformMaterial.java
  10. 9 3
      jeecg-boot-module-system/src/main/resources/application-test.yml
  11. 10 5
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  12. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml
  13. 3 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouMatDailyReportJob.java
  14. 248 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiCreativeLimitController.java
  15. 65 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiCreativeLimit.java
  16. 17 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiCreativeLimitMapper.java
  17. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiCreativeLimitMapper.xml
  18. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiCreativeLimitService.java
  19. 26 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiCreativeLimitServiceImpl.java
  20. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroup.java
  21. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupMapper.xml
  22. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouVideoRelateCreativesMapper.xml
  23. 4 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupServiceImpl.java
  24. 10 12
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  25. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java
  26. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouReportAccountDailyMapper.java
  27. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyAgeMapper.java
  28. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyBusinessMapper.java
  29. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyCityMapper.java
  30. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyClientMapper.java
  31. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyGenderMapper.java
  32. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyProvinceMapper.java
  33. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyAccountMapper.java
  34. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouReportAccountDailyMapper.xml
  35. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouReportAccountHourlyMapper.xml
  36. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouYiCheReportMapper.xml
  37. 246 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyAgeMapper.xml
  38. 246 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyBusinessMapper.xml
  39. 245 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyCityMapper.xml
  40. 246 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyClientMapper.xml
  41. 246 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyGenderMapper.xml
  42. 245 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyProvinceMapper.xml
  43. 75 60
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml
  44. 36 37
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportHourlyAccountMapper.xml
  45. 2 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouReportAccountDailyServiceImpl.java
  46. 3 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouReportAccountHourlyServiceImpl.java
  47. 8 9
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouAudienceReportDailyServiceImpl.java
  48. 1 1
      module-kuaishou/src/main/resources/json_template/kuaishou_filed_mapping.json
  49. 1 1
      module-kuaishou/src/main/resources/json_template/kuaishou_video_report_filed_mapping.json
  50. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceNewPlanReportCtrl.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;
+    }
+}

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

@@ -23,6 +23,7 @@ import cn.com.ctop.toutiao.modules.report.service.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.xxl.job.core.context.XxlJobHelper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
@@ -31,6 +32,8 @@ import org.jeecg.common.util.DateUtils;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
@@ -150,8 +153,7 @@ public class TestController {
         }));
 
 
-
-        }
+    }
 
     @GetMapping("/getVideoByProjectId")
     public String getVideoByProjectId(Long projectId) {
@@ -1229,4 +1231,50 @@ public class TestController {
     IETLReportBytedanceVideoService etlReportBytedanceVideoService;
 
 
+    @Autowired
+    private IKuaishouAudienceReportDailyService kuaishouAudienceReportDailyService;
+    @Autowired
+    private IKuaiShouGroupService kuaiShouGroupService;
+    @Autowired
+    private IKuaishouStrategyService kuaishouStrategyService;
+
+    /**
+     * 勿动勿删,煜一人群报表数据拉取接口。
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    @PostMapping(value = "/getAudienceData")
+    public Result getAudienceData(@RequestBody JSONObject request) throws Exception {
+        Long accountId = request.getLong("accountId");
+        Long planId = request.getLong("planId");
+        Long unitId = request.getLong("unitId");
+        String type = request.getString("type");
+        String startTime = request.getString("startTime");
+        String endTime = request.getString("endTime");
+        if (Check.isNull(accountId) || Check.isNull(planId) || Check.isNull(unitId) || Check.isNull(type) || Check.isNull(endTime) || Check.isNull(startTime)) {
+            return Result.error("缺少参数");
+        }
+        CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+        List<String> dayList = new ArrayList<>();
+        if (startTime.equals(endTime)) {
+            dayList.add(startTime);
+        } else {
+            dayList = DateUtils.getDays(startTime, endTime);
+        }
+        ExecutorService executorServic1e = Executors.newFixedThreadPool(8);
+        int page = 1;
+        int pageSize = 2000;
+        dayList.forEach(date -> executorServic1e.submit(() -> {
+            try {
+                kuaishouAudienceReportDailyService.crowdAnalysisReport(token, date, type, planId, unitId, page, pageSize);
+                Thread.sleep(500);
+            } catch (InterruptedException e) {
+                log.error("获取人群消息异常", e);
+            }
+        }));
+        return Result.ok("success");
+    }
 }

+ 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

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

@@ -70,6 +70,8 @@ public class SampleTest {
     private IKuaishouReportDailyGroupService reportDailyGroupService;
     @Autowired
     private IEtlKuaiShouAccountMaterialOverviewService kuaiShouAccountMaterialOverviewService;
+    @Autowired
+    private IKuaiShouGroupService kuaiShouGroupService;
 
 
     @Test
@@ -80,7 +82,10 @@ public class SampleTest {
         CtopOauthToken token = new CtopOauthToken();
         token.setAccountId(9901975L);
         token.setAccessToken("1c7cebebc3174c39fe941d136df65b1d");
-        kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate2, getDate,"adScene");
+
+        kuaiShouGroupService.getGroupListByPage("90f31a01c2137aa11c8686e86064b630",9845316L,null,1);
+
+//        kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate2, getDate, "adScene");
 
      /*   JSONObject materialOverview = kuaiShouAccountMaterialOverviewService.getMaterialOverview(5473041L, "2021-03-09");
         System.err.println(materialOverview);*/
@@ -618,11 +623,11 @@ public class SampleTest {
     private IEtlKuaishouVideoInfoService videoEtlInfoService;
 
     @Test
-    public void etlKuaishouVideoInfo(){
-        Date startDate = DateUtils.parseDate("2020-09-11","yyyy-MM-dd");
-        for(int i=0;i<365;i++){
+    public void etlKuaishouVideoInfo() {
+        Date startDate = DateUtils.parseDate("2020-09-11", "yyyy-MM-dd");
+        for (int i = 0; i < 365; i++) {
 //            dailyService.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate(DateUtils.addDay(startDate,i)));
-            videoEtlInfoService.etlKuaishouVideoInfo(DateUtils.formatDate(DateUtils.addDay(startDate,i)));
+            videoEtlInfoService.etlKuaishouVideoInfo(DateUtils.formatDate(DateUtils.addDay(startDate, i)));
         }
     }
 

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml

@@ -66,6 +66,7 @@
     ctop_user_allocation  t2
     ON t1.account_id = t2.account_id
     WHERE t2.project_id = #{projectId}
+    AND t2.account_status = 0
     GROUP BY t1.user_id;
     </select>
 

+ 3 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouMatDailyReportJob.java

@@ -24,8 +24,9 @@ public class KuaishouMatDailyReportJob {
     @XxlJob("kuaishouMaterialReportByStateDate")
     public void execute() throws Exception {
         //增加接口的开始和结束日期
-        String endDate = DateUtils.getNowDate("yyyy-MM-dd");
-        String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", endDate, -1);
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String endDate =DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -2);
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         tokens.forEach(token -> executorService.submit(() -> {

+ 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);
+    }
+}

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroup.java

@@ -110,6 +110,7 @@ public class KuaiShouGroup {
      * 落地页链接
      */
     private Object url;
+    private String schemaUri;
     /**
      * APP ID
      */
@@ -120,7 +121,6 @@ public class KuaiShouGroup {
     private String appIconUrl;
 
 
-
     // 转化目标
     private Long convertId;
     // 转化目标

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

@@ -28,6 +28,7 @@
         unit_type,
         url_type,
         url,
+        schema_uri,
         app_id,
         app_icon_url,
         convert_id,
@@ -66,6 +67,7 @@
             #{getGroup.unitType},
             #{getGroup.urlType},
             #{getGroup.url},
+            #{getGroup.schemaUri},
             #{getGroup.appId},
             #{getGroup.appIconUrl},
             #{getGroup.convertId},

+ 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>

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

@@ -86,7 +86,9 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GROUP_LIST;
         JSONObject param = new JSONObject();
         param.put("advertiser_id", accountId);
-        param.put("campaign_id", campaignId);
+        if(!Check.isNull(campaignId)){
+            param.put("campaign_id", campaignId);
+        }
         param.put("page_size", 500);
         param.put("page", page);
 
@@ -424,6 +426,7 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
                     group.setUnitType(detail.getInteger("unit_type"));
                     group.setUrlType(detail.getInteger("url_type"));
                     group.setUrl(detail.getString("url"));
+                    group.setSchemaUri(detail.getString("schema_uri"));
                     group.setAppId(detail.getLong("app_id"));
                     group.setAppIconUrl(detail.getString("app_icon_url"));
                     group.setGroupCreateTime(detail.getString("create_time"));

+ 10 - 12
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;
@@ -18,7 +19,6 @@ import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
 import cn.com.ctop.kuaishou.modules.report.entity.*;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCampaignMapper;
-import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyGroupMapper;
 import cn.com.ctop.kuaishou.modules.report.service.*;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -71,10 +71,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     @Autowired
     private IKuaiShouCreativeService creativeService;
     @Autowired
-    private KuaiShouConversionInfosMapper conversionInfosMapper;
-    @Autowired
-    private KuaiShouConversionTypesMapper conversionTypesMapper;
-    @Autowired
     private KuaiShouRegionListChildrenMapper regionListChildrenMapper;
     @Autowired
     private KuaiShouRegionListParentMapper regionListParentMapper;
@@ -95,8 +91,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     @Autowired
     private IKuaishouReportDailyCampaignService dailyCampaignService;
     @Autowired
-    private KuaishouReportDailyGroupMapper dailyGroupMapper;
-    @Autowired
     private IKuaishouReportHourlyGroupService hourlyGroupService;
     @Autowired
     private IKuaishouReportDailyCreativeService dailyCreativeService;
@@ -113,8 +107,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     @Autowired
     private IUserAllocationService userAllocationService;
     @Autowired
-    private IKuaishouReportDailyCreativeStatisticService dailyCreativeStatisticService;
-    @Autowired
     private IKuaiShouHistoryReportTaskService historyReportTaskService;
     @Autowired
     private IKuaiShouImageGetService kuaiShouImageGetService;
@@ -125,8 +117,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     @Autowired
     private IKuaiShouGroupService getKuaiShouGroupService;
     @Autowired
-    private IKuaiShouAdvertiserBaseInfoService KuaiShouAdvertiserBaseInfoService;
-    @Autowired
     private IWarningOperationService warningOperationService;
 
 
@@ -838,7 +828,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             Date getStartDate = DateUtils.addDay(endDate, -i);
             //1: 获取广告主信息数据
             getAdvertiserReportHourly(token, getStartDate, getStartDate);
-            getAdvertiserReportDaily(token, getStartDate, getStartDate, "adScene");
+            getAdvertiserReportDaily(token, getStartDate, getStartDate, null);
             //2:获取广告计划信息数据
             // getAdvertiserCampaignReportHourly(token, getStartDate, getStartDate);
             //3:获取广告组信息数据
@@ -1328,6 +1318,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     group.setUnitType(detail.getInteger("unit_type"));
                     group.setUrlType(detail.getInteger("url_type"));
                     group.setUrl(detail.getString("url"));
+                    group.setSchemaUri(detail.getString("schema_uri"));
                     group.setAppId(detail.getLong("app_id"));
                     group.setAppIconUrl(detail.getString("app_icon_url"));
                     group.setGroupCreateTime(detail.getString("create_time"));
@@ -1957,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) {
@@ -2005,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"));

+ 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)) {

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

@@ -17,7 +17,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface EtlKuaishouReportAccountDailyMapper extends BaseMapper<EtlKuaishouReportAccountDaily> {
 
-    void replaceBatch(@Param("list") List<EtlKuaishouReportAccountDaily> list);
+    void replaceBatch(@Param("list") List<EtlKuaishouReportAccountHourly> list);
 
     EtlKuaishouReportAccountHourly getOnedayAggregatebyDaily(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("accountId") Long accountId);
 

+ 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/KuaishouReportDailyAccountMapper.java

@@ -51,7 +51,7 @@ public interface KuaishouReportDailyAccountMapper extends BaseMapper<KuaishouRep
 
     void replaceBatchAdScene(@Param("addList") List<KuaishouReportDailyAccount> addList);
 
-    List<EtlKuaishouReportAccountDaily> queryEveryDayDataForAccount();
+    List<EtlKuaishouReportAccountHourly> queryEveryDayDataForAccount();
 
     BigDecimal getSumChargeByAccountIdAndStatDate(@Param("accountId") Long accountId, @Param("statDate") String statDate);
 }

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

@@ -144,7 +144,7 @@
                       0) as 'eventCreditGrantAppRatio',
                IFNULL(ROUND(SUM(form_count) / SUM(bclick) * 100, 2), 0) as 'formActionRatio',
                IFNULL(ROUND(SUM(submit) / SUM(bclick) * 100, 2), 0) as 'submitRatio',
-               IFNULL(ROUND(SUM(play_3s_count) / SUM(photo_show) * 100, 2), 0) as 'play3sRatio'
+               IFNULL(ROUND(SUM(play_3s_count) / SUM(aclick) * 100, 2), 0) as 'play3sRatio'
         FROM ctop_etl_kuaishou_report_account_daily
         WHERE account_id = #{accountId}
           AND stat_date &gt;= #{startTime}
@@ -171,7 +171,7 @@
                 IFNULL(ROUND(SUM(charge) / SUM(bclick), 2), 0) as 'value',
             </if>
             <if test="value == 'play3sRatio'">
-                IFNULL(ROUND(SUM(play_3s_count) / SUM(photo_show) * 100, 2), 0) as 'value',
+                IFNULL(ROUND(SUM(play_3s_count) / SUM(aclick) * 100, 2), 0) as 'value',
             </if>
             <if test="value == 'downloadStartedCost'">
                 IFNULL(ROUND(SUM(charge) / SUM(download_started), 2), 0) as 'value',

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

@@ -87,7 +87,7 @@
                IFNULL(ROUND(charge / aclick * 1000, 2), 0) as 'impression1kCost',
                IFNULL(ROUND(charge / photo_click, 2), 0) as 'photoClickCost',
                IFNULL(ROUND(charge / bclick, 2), 0) as 'actionCost',
-               IFNULL(ROUND(play_3s_count / photo_show * 100, 2), 0) as 'play3sRatio',
+               IFNULL(ROUND(play_3s_count / aclick * 100, 2), 0) as 'play3sRatio',
                IFNULL(ROUND(charge / download_started, 2), 0) as 'downloadStartedCost',
                IFNULL(ROUND(charge / download_completed, 2), 0) as 'downloadCompletedCost',
                IFNULL(ROUND(charge / form_count, 2), 0) as 'formCost',
@@ -137,7 +137,7 @@
                 IFNULL(ROUND(charge / bclick, 2), 0) as 'value',
             </if>
             <if test="value == 'play3sCount'">
-                IFNULL(ROUND(play_3s_ratio * photo_show, 2), 0) as 'value',
+                IFNULL(ROUND(play_3s_ratio * aclick, 2), 0) as 'value',
             </if>
             <if test="value == 'downloadStartedCost'">
                 IFNULL(ROUND(charge / download_started, 2), 0) as 'value',

+ 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>

+ 75 - 60
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">
@@ -1452,48 +1466,49 @@
     </select>
 
     <select id="queryEveryDayDataForAccount"
-            resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountDaily">
-    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
+            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',
+               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>
 

+ 2 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouReportAccountDailyServiceImpl.java

@@ -2,6 +2,7 @@ package cn.com.ctop.kuaishou.modules.report.service.impl;
 
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountDaily;
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly;
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouReportAccountDailyMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouReportAccountDailyService;
@@ -29,7 +30,7 @@ public class EtlKuaishouReportAccountDailyServiceImpl extends ServiceImpl<EtlKua
 
     @Override
     public void queryEveryDayDataForAccount() {
-        List<EtlKuaishouReportAccountDaily> list = dailyAccountMapper.queryEveryDayDataForAccount();
+        List<EtlKuaishouReportAccountHourly> list = dailyAccountMapper.queryEveryDayDataForAccount();
         if (!Check.isNull(list)) {
             etlDailyAccountMapper.replaceBatch(list);
         }

+ 3 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouReportAccountHourlyServiceImpl.java

@@ -64,6 +64,7 @@ public class EtlKuaishouReportAccountHourlyServiceImpl extends ServiceImpl<EtlKu
         if (!Check.isNull(list)) {
             etlHourlyAccountMapper.replaceBatch(list);
         }
+        etlDailyAccountMapper.replaceBatch(list);
     }
 
     @Override
@@ -128,8 +129,8 @@ public class EtlKuaishouReportAccountHourlyServiceImpl extends ServiceImpl<EtlKu
             if ("photo_comment".equals(value)) {
                 value = "comment";
             }
-            if("play_3s_count".equals(value)){
-                value =  value = request.getString("value");
+            if ("play_3s_count".equals(value)) {
+                value = value = request.getString("value");
                 type = "more";
             }
             todayList = etlHourlyAccountMapper.getOnedayEtlReportList(startTime, accountId, value, type);

+ 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);

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

@@ -192,7 +192,7 @@
     "comment": "按钮点击率"
   },
   "play3sRate": {
-    "filed": "CASE WHEN sum(CEIL(t1.play_3s_ratio * t1.photo_show)) / sum(t1.photo_show) IS NULL THEN 0 ELSE round(sum(CEIL(t1.play_3s_ratio * t1.photo_show)) / sum(t1.photo_show)*100,2)end as play3sRate ",
+    "filed": "CASE WHEN sum(CEIL(t1.play_3s_ratio * t1.aclick)) / sum(t1.aclick) IS NULL THEN 0 ELSE round(sum(CEIL(t1.play_3s_ratio * t1.aclick)) / sum(t1.aclick)*100,2)end as play3sRate ",
     "comment": "3s播放率"
   },
   "activeRate": {

+ 1 - 1
module-kuaishou/src/main/resources/json_template/kuaishou_video_report_filed_mapping.json

@@ -208,7 +208,7 @@
     "comment": "3s播放数"
   },
   "play3sRate": {
-    "filed": "CASE WHEN sum(photo_show) != 0 THEN CONCAT(CAST(ROUND( sum(t1.play_3s_count) / sum(t1.photo_show),2 )  * 100 AS CHAR),'%') ELSE '-' END AS play3sRate",
+    "filed": "CASE WHEN sum(aclick) != 0 THEN CONCAT(CAST(ROUND( sum(t1.play_3s_count) / sum(t1.aclick),2 )  * 100 AS CHAR),'%') ELSE '-' END AS play3sRate",
     "comment": "3s播放率"
   }
 }

+ 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() {