瀏覽代碼

Merge branch 'master' into V1.1.7

yumeng 4 年之前
父節點
當前提交
d5fd378f55
共有 43 個文件被更改,包括 2006 次插入309 次删除
  1. 277 30
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  2. 0 84
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHourlyGroupReportLoadJob.java
  3. 22 14
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  4. 1 2
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysUserMapper.xml
  5. 3 0
      module-job-bytedance/src/main/resources/application-dev.yml
  6. 3 0
      module-job-bytedance/src/main/resources/application-jiaoyang.yml
  7. 3 0
      module-job-bytedance/src/main/resources/application-prod.yml
  8. 3 0
      module-job-bytedance/src/main/resources/application-test.yml
  9. 2 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/CrowdListQueryJob.java
  10. 2 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAccountReportLoadEtlJob.java
  11. 48 19
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyGroupReportLoadJob.java
  12. 66 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouMatDailyReportJob.java
  13. 3 0
      module-job-kuaishou/src/main/resources/application-prod.yml
  14. 3 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/enums/KuaishouCreativeMatTypeEnum.java
  15. 127 56
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java
  16. 2 20
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  17. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouCampaignMapper.java
  18. 16 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouCampaignMapper.xml
  19. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCampaignService.java
  20. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCreativeService.java
  21. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouReportDailyMaterialService.java
  22. 1 13
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java
  23. 5 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouActionBarTextServiceImpl.java
  24. 10 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCampaignServiceImpl.java
  25. 76 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreativeServiceImpl.java
  26. 12 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouReportDailyMaterialServiceImpl.java
  27. 5 53
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  28. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouPopulationServiceImpl.java
  29. 248 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouProjectDataController.java
  30. 248 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaiShouReportHourlyMaterialController.java
  31. 71 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaiShouProjectData.java
  32. 2 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaiShouReportDailyMaterial.java
  33. 425 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaiShouReportHourlyMaterial.java
  34. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaiShouProjectDataMapper.java
  35. 20 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaiShouReportHourlyMaterialMapper.java
  36. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouProjectDataMapper.xml
  37. 139 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouReportHourlyMaterialMapper.xml
  38. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaiShouProjectDataService.java
  39. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaiShouReportHourlyMaterialService.java
  40. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportHourlyGroupService.java
  41. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaiShouProjectDataServiceImpl.java
  42. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaiShouReportHourlyMaterialServiceImpl.java
  43. 61 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportHourlyGroupServiceImpl.java

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

@@ -12,13 +12,19 @@ import cn.com.ctop.crawler.modules.douyin.service.DouyinMusicService;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouCreateCreativeService;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouTemplate;
 import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouAccessToken;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouProjectData;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouProjectDataService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouAudienceReportDailyService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyGroupService;
 import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.material.service.IBytedanceEffectVideoInfoService;
@@ -92,7 +98,7 @@ public class TestController {
     @Autowired
     private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
 
-    static ExecutorService executorService = Executors.newFixedThreadPool(15);
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
     static ExecutorService suzhaoService = Executors.newFixedThreadPool(5);
     @Autowired
     private IKuaiShouDailyAgentService dailyAgentService;
@@ -111,23 +117,264 @@ public class TestController {
     @Autowired
     private ICtopOauthTokenService tokenService;
 
+    @Autowired
+    private IKuaiShouProjectDataService kuaiShouProjectDataService;
+    @Autowired
+    private IKuaishouReportHourlyGroupService hourlyGroupService;
+    @Autowired
+    private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
+
+    @Autowired
+    private IKuaiShouCreativeService creativeService;
+    @Autowired
+    private IKuaiShouGroupService groupService;
+
+    @Autowired
+    private IBatchService batchService;
+    static ExecutorService videoService = Executors.newFixedThreadPool(3);
+
+
+    @GetMapping(value = "/getProgramCreative")
+    public void getProgramCreative() {
+        List<Long> list = new ArrayList();
+        list.add(10045052L);
+        list.add(10045823L);
+        list.add(10045830L);
+        list.add(10045831L);
+
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            creativeService.getProgramCreative(oauthToken, 1);
+        }
+
+
+    }
+
+
+    @GetMapping(value = "/campaignList")
+    public void campaignList() {
+        List<Long> list = new ArrayList();
+        list.add(10045052L);
+        list.add(10045823L);
+        list.add(10045830L);
+        list.add(10045831L);
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            // kuaishouInterfaceService.getCampaignList(oauthToken, null, null);
+            videoService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        kuaishouInterfaceService.getCampaignList(oauthToken, null, null);
+                        //   kuaishouInterfaceService.getGroupList(oauthToken, null, null);
+                        //     kuaishouInterfaceService.getCreativeList(oauthToken, null, null);
+                        Thread.sleep(1500);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            });
+
+        }
+
+    }
+
+
+    @GetMapping(value = "/creativeList")
+    public void creativeList() {
+        List<Long> list = new ArrayList();
+        list.add(10045052L);
+        list.add(10045823L);
+        list.add(10045830L);
+        list.add(10045831L);
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            QueryWrapper<KuaiShouCampaign> campaignQueryWrapper = new QueryWrapper<>();
+            campaignQueryWrapper.eq("account_id", accountId);
+
+            List<KuaiShouCampaign> list1 = campaignService.list(campaignQueryWrapper);
+            for (KuaiShouCampaign campaign : list1) {
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        kuaishouInterfaceService.getCreativeList(oauthToken, null, null);
+                    }
+                });
+                try {
+                    Thread.sleep(400L);
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+
+
+        }
+
+    }
+
+
+    @GetMapping(value = "/updateUnit")
+    public void updateUnit() throws Exception {
+        List<Long> list = new ArrayList();
+        list.add(9556344L);
+        list.add(9743738L);
+        list.add(9743727L);
+        list.add(9812671L);
+        list.add(9838554L);
+        list.add(9743746L);
+        list.add(9767055L);
+        list.add(9556274L);
+        list.add(9767096L);
+        list.add(9792538L);
+        list.add(9766952L);
+        list.add(9677440L);
+        list.add(9677334L);
+        list.add(9556465L);
+        list.add(9677236L);
+        list.add(9556227L);
+        list.add(9556188L);
+        list.add(9556431L);
+        list.add(9677408L);
+        list.add(9677284L);
+
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            QueryWrapper<KuaiShouGroup> groupQueryWrapper = new QueryWrapper<>();
+            groupQueryWrapper.eq("account_id", accountId);
+            //      groupQueryWrapper.ne("schedule_time","000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111000000111111111111111111");
+            //     groupQueryWrapper.eq("use_app_market", 1);
+            //    groupQueryWrapper.gt("cpa_bid", 19000);
+
+
+            List<KuaiShouGroup> list1 = groupService.list(groupQueryWrapper);
+          /*  for (KuaiShouGroup group : list1) {
+
+                JSONObject json = new JSONObject();
+                json.put("unitId", group.getUnitId());
+                json.put("useAppMarket", 0);
+                json.put("appStore", new JSONArray());
+                batchService.updateUnit(json, oauthToken);
+            }*/
+
+            for (KuaiShouGroup group : list1) {
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        try {
+                            JSONObject json = new JSONObject();
+                            json.put("unitId", group.getUnitId());
+                            json.put("cpaBid", 18 * 1000);
+                            //     json.put("gender", "2");
+                            batchService.updateUnit(json, oauthToken);
+                            Thread.sleep(1500);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                });
+
+
+            }
+
+
+        }
+
+
+    }
+
+
+    @GetMapping(value = "/updateCreative")
+    public void updateCreative() {
+        List<Long> list = new ArrayList();
+        list.add(10045052L);
+        list.add(10045823L);
+        list.add(10045830L);
+        list.add(10045831L);
+
+        for (int i = 0; i < list.size(); i++) {
+            Long accountId = list.get(i);
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+
+
+            QueryWrapper<KuaiShouCreative> creativeQueryWrapper = new QueryWrapper<>();
+            creativeQueryWrapper.eq("account_id", accountId);
+
+
+            List<KuaiShouCreative> creativeList = creativeService.list(creativeQueryWrapper);
+            for (KuaiShouCreative creative : creativeList) {
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        try {
+                            JSONObject json = new JSONObject();
+                            json.put("creativeId", creative.getCreativeId());
+                            String url = "https://click-wailaxin.1sapp.com/vendor/feedback/reportClick?platform=kuaishou&feedback_type=android&account_id=19&plan_id=__DID__&adgroup_id=__AID__&creative_id=__CID__&imei=__IMEI2__&mac=__MAC__&androidid=__ANDROIDID2__&ts=__TS__&ip=__IP__&ua=__UA__&callback=__CALLBACK__&oaid=__OAID__&app=dxqlb";
+
+                            if (creative.getCreativeMaterialType() == 1) {
+                                json.put("clickTrackUrl", url);
+                            } else if (creative.getCreativeMaterialType() == 4) {
+                                json.put("impressionUrl", url);
+                                json.put("clickTrackUrl", url);
+
+                            }
+                            JSONObject jsonObject = batchService.updateCreative(json, oauthToken);
+                            log.info("修改创意返回信息:creative:{},结果:{}", creative.getCreativeId(), jsonObject);
+                            Thread.sleep(1000L);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                });
+            }
+        }
+    }
+
 
     @GetMapping("/cleanNewlyData")
     public void cleanNewlyData(String startDate, String endDate) throws ParseException {
 
 
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date parse1 = simpleDateFormat.parse(startDate);
-        Date parse2 = simpleDateFormat.parse(endDate);
-     /*   CtopOauthToken token = new CtopOauthToken();
-        token.setAccountId(9791267L);
-        token.setAccessToken("b8ab3b361cd30339ef7e18dcc1305123");*/
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String yesterday = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        //1:查询当日数据
+        QueryWrapper<KuaiShouProjectData> queryWrapper = new QueryWrapper();
+        queryWrapper.eq("project_status", 0);
+        List<KuaiShouProjectData> list = kuaiShouProjectDataService.list(queryWrapper);
+        if (Check.isNull(list)) {
+            return;
+        }
+        for (KuaiShouProjectData projectData : list) {
+            Long projectId = projectData.getProjectId();
+            if (Check.isNull(projectId)) {
+                continue;
+            }
+            QueryWrapper<UserAllocation> allocationQueryWrapper = new QueryWrapper<>();
+            allocationQueryWrapper.eq("project_id", projectId);
+            allocationQueryWrapper.eq("account_status", 0);
+            List<UserAllocation> accountIds = allocationService.list(allocationQueryWrapper);
+            if (Check.isNull(accountIds)) {
+                continue;
+            }
+            for (UserAllocation allocation : accountIds) {
+                CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
+                if (Check.isNull(token)) {
+                    continue;
+                }
 
-        List<CtopOauthToken> ctopOauthTokens = tokenService.selectKuaiShouToken();
-        // kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate, "adScene");
-        ctopOauthTokens.forEach(token -> executorService.submit(() -> {
-            kuaishouInterfaceService.getAdvertiserReportDaily(token, parse1, parse2, "adScene");
-        }));
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), yesterday, yesterday, "HOURLY", 1);
+
+                        //  hourlyGroupService.getAdvertiserGroupReportHourly(token.getAccountId(), token.getAccessToken(), yesterday, yesterday);
+                    }
+                });
+            }
+        }
 
 
     }
@@ -1255,41 +1502,41 @@ public class TestController {
     private IAiKuaishouCreateCreativeService createCreativeService;
 
     @GetMapping("testCreateCreative")
-    public Map<String,Object>testCreateCreative(Long accountId,Integer createType){
-        Map<String,Object>result = new HashMap<>();
+    public Map<String, Object> testCreateCreative(Long accountId, Integer createType) {
+        Map<String, Object> result = new HashMap<>();
         AiKuaishouAdvertiserStrategy strategy = strategyService.getByAccountId(accountId);
-        if(strategy == null){
-            ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
+        if (strategy == null) {
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             return result;
         }
-        createCreativeService.autoCreateCreative(strategy,createType,150L);
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        createCreativeService.autoCreateCreative(strategy, createType, 150L);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 
     @GetMapping("testProgramCreative")
-    public Map<String,Object>testProgramCreative(Long accountId,Integer createType){
-        Map<String,Object>result = new HashMap<>();
+    public Map<String, Object> testProgramCreative(Long accountId, Integer createType) {
+        Map<String, Object> result = new HashMap<>();
         AiKuaishouAdvertiserStrategy strategy = strategyService.getByAccountId(accountId);
-        if(strategy == null){
-            ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
+        if (strategy == null) {
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             return result;
         }
-        createCreativeService.autoCreateProgramCreative(strategy, createType,150L);
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        createCreativeService.autoCreateProgramCreative(strategy, createType, 150L);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 
     @GetMapping("testCreateCreativeLimit")
-    public Map<String,Object>testCreateCreativeLimit(Long accountId,Integer hour) throws ParseException {
-        Map<String,Object>result = new HashMap<>();
+    public Map<String, Object> testCreateCreativeLimit(Long accountId, Integer hour) throws ParseException {
+        Map<String, Object> result = new HashMap<>();
         AiKuaishouAdvertiserStrategy strategy = strategyService.getByAccountId(accountId);
-        if(strategy == null){
-            ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
+        if (strategy == null) {
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             return result;
         }
-        createCreativeService.customCreativeSupplement(strategy,hour);
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        createCreativeService.customCreativeSupplement(strategy, hour);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 }

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

@@ -1,84 +0,0 @@
-package org.jeecg.modules.ctop.job;
-
-import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.util.DateUtils;
-import org.quartz.Job;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * 获取 广告组分时数据
- *
- * @author syh
- */
-@Slf4j
-public class KuaishouHourlyGroupReportLoadJob implements Job {
-    @Autowired
-    private ICtopOauthTokenService tokenService;
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
-
-    static ExecutorService executorService = null;
-    //线程计数器
-    static CountDownLatch countDownLatch = null;
-
-    @Override
-    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        Thread thread = new Thread() {
-            @Override
-            public void run() {
-                Date getDate = new Date();
-                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
-                String hour = simpleDateFormat.format(getDate);
-                if (null != hour && "00".equals(hour)) {
-                    getDate = DateUtils.addDay(getDate, -1);
-                }
-                //1:查询当日数据
-                List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-                if (null == tokens || tokens.size() <= 0) {
-                    log.info("定时获取快手数据异常:未获取到可用的token");
-                    return;
-                }
-                executorService = Executors.newFixedThreadPool(5);
-                countDownLatch = new CountDownLatch(tokens.size());
-                Date finalGetDate = getDate;
-                tokens.forEach(token -> {
-                    executorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            try {
-                                //3:获取广告组信息数据
-                                kuaishouInterfaceService.getAdvertiserGroupReportHourly(token, finalGetDate, finalGetDate);
-                            } catch (Exception e) {
-                                e.printStackTrace();
-                            } finally {
-                                countDownLatch.countDown();
-                            }
-                        }
-                    });
-                });
-                try {
-                    countDownLatch.await();
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                }
-
-                executorService.shutdown();
-            }
-        };
-        thread.start();
-
-    }
-}

+ 22 - 14
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -71,18 +71,29 @@ public class SampleTest {
     private IEtlKuaiShouAccountMaterialOverviewService kuaiShouAccountMaterialOverviewService;
     @Autowired
     private IKuaiShouGroupService kuaiShouGroupService;
-
+    @Autowired
+    private IKuaishouReportHourlyGroupService groupService;
+    @Autowired
+    private IKuaiShouReportDailyMaterialService reportDailyMaterialService;
+    @Autowired
+    private IKuaiShouActionBarTextService actionBarTextService;
 
     @Test
     public void loadBytedanceCreativeData() throws ParseException {
-        Date getDate = DateUtils.addDay(new Date(), -1);
+
+        actionBarTextService.getActionBarText();
+
+        // groupService.getAdvertiserGroupReportHourly(9677284L, "b88c5f0d80c518fc80174a4dabbcd180", "2021-04-19", "2021-04-19");
+    //    reportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(9677284L, "b88c5f0d80c518fc80174a4dabbcd180", "2021-04-19", "2021-04-19", "DAILY", 1);
+
+     /*   Date getDate = DateUtils.addDay(new Date(), -1);
         Date getDate2 = DateUtils.addDay(new Date(), -2);
 
         CtopOauthToken token = new CtopOauthToken();
         token.setAccountId(9901975L);
         token.setAccessToken("1c7cebebc3174c39fe941d136df65b1d");
 
-        kuaiShouGroupService.getGroupListByPage("90f31a01c2137aa11c8686e86064b630",9845316L,null,1);
+        kuaiShouGroupService.getGroupListByPage("90f31a01c2137aa11c8686e86064b630",9845316L,null,1);*/
 
 //        kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate2, getDate, "adScene");
 
@@ -157,14 +168,15 @@ public class SampleTest {
     }
 
     @Test
-    public void loadKuaishouCamgaignData(){
-        Date getDate = DateUtils.parseDate("2021-03-24","yyyy-MM-dd");
-        List<UserAllocation> list = allocationService.getByParams(50L,null,0);
+    public void loadKuaishouCamgaignData() {
+        Date getDate = DateUtils.parseDate("2021-03-24", "yyyy-MM-dd");
+        List<UserAllocation> list = allocationService.getByParams(50L, null, 0);
         list.forEach(userAllocation -> {
             CtopOauthToken token = tokenService.getOauthTokenByAccountId(userAllocation.getAccountId().toString());
             kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getDate, getDate);
         });
     }
+
     static ExecutorService executorService = null;
     static CountDownLatch countDownLatch = null;
 
@@ -463,17 +475,14 @@ public class SampleTest {
 
     @Test
     public void loadBDAccoutData() {
-        Date startDate = DateUtils.addDay(new Date(),-2000);
-        for(int i=0;i<=2000;i++){
-            Date getDate = DateUtils.addDay(startDate,i);
+        Date startDate = DateUtils.addDay(new Date(), -2000);
+        for (int i = 0; i <= 2000; i++) {
+            Date getDate = DateUtils.addDay(startDate, i);
             bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(getDate);
         }
     }
 
 
-
-
-
     @Test
     public void etlKuaishouData() {
         String dateString = "2021-01-05";
@@ -504,7 +513,6 @@ public class SampleTest {
     }
 
 
-
     @Test
     public void testLoadBytedanceDataV2() {
         String accountIds = "1675440464386062";
@@ -551,11 +559,11 @@ public class SampleTest {
     private IEtlKuaishouVideoInfoService videoEtlInfoService;
     @Resource
     private EtlKuaishouAccountMaterialReportDailyMapper etlKuaishouAccountMaterialReportDailyMapper;
+
     @Test
     public void etlKuaishouVideoInfo() {
         etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate());
     }
 
 
-
 }

+ 1 - 2
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/SysUserMapper.xml

@@ -313,8 +313,7 @@ SELECT
         <if test="sex != null and sex != ''">
             AND t1.sex =#{sex}
         </if>
-        ORDER BY updTime DESC
-        limit 99999
+
         ) t4
         GROUP BY t4.id
     </select>

+ 3 - 0
module-job-bytedance/src/main/resources/application-dev.yml

@@ -212,3 +212,6 @@ xxl:
       logretentiondays: 30
     admin:
       addresses: http://127.0.0.1:8090/xxl-job-admin
+zip:
+  local:
+    download-path: /data/unzip/

+ 3 - 0
module-job-bytedance/src/main/resources/application-jiaoyang.yml

@@ -227,3 +227,6 @@ xxl:
       logretentiondays: 30
     admin:
       addresses: http://129.28.150.229:8090/xxl-job-admin
+zip:
+  local:
+    download-path: /data/unzip/

+ 3 - 0
module-job-bytedance/src/main/resources/application-prod.yml

@@ -231,3 +231,6 @@ ai:
   callback:
     callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
+zip:
+  local:
+    download-path: /data/unzip/

+ 3 - 0
module-job-bytedance/src/main/resources/application-test.yml

@@ -236,3 +236,6 @@ xxl:
       logretentiondays: 30
     admin:
       addresses: http://127.0.0.1:8090/xxl-job-admin
+zip:
+  local:
+    download-path: /data/unzip/

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

@@ -59,9 +59,9 @@ public class CrowdListQueryJob {
                                         crowdPackEntity.setStatDate(oldPack.getStatDate());
                                         crowdPackEntity.setUrl(oldPack.getUrl());
                                         crowdPackEntity.setSignature(oldPack.getSignature());
-                                        crowdPackEntity.setMessage("PUSH OK");
-                                        crowdPackEntity.setDataStatus(1);
                                     }
+                                    crowdPackEntity.setMessage("PUSH OK");
+                                    crowdPackEntity.setDataStatus(1);
                                     crowdPackService.save(crowdPackEntity);
                                 } else {
                                     crowdPackMapper.update(obj);

+ 2 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAccountReportLoadEtlJob.java

@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
+import java.util.Date;
 
 /**
  * 账户维度-盯盘每日数据
@@ -44,6 +45,7 @@ public class KuaishouDailyAccountReportLoadEtlJob {
     public void etlKuaishouAccountMaterialReportDailyData() throws Exception {
         try {
             etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate());
+            etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate(DateUtils.addDay(new Date(),-1)));
             XxlJobHelper.log("queryEveryDayDataForAccount success");
         } catch (Exception e) {
             XxlJobHelper.log(e.getMessage());

+ 48 - 19
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouHourlyGroupReportLoadJob.java

@@ -1,16 +1,19 @@
 package cn.com.ctop.job.kuaishou.handler;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import com.xxl.job.core.context.XxlJobHelper;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouProjectData;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouProjectDataService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyGroupService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -24,26 +27,52 @@ import java.util.concurrent.Executors;
 public class KuaishouHourlyGroupReportLoadJob {
     @Autowired
     private ICtopOauthTokenService tokenService;
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
     static ExecutorService executorService = Executors.newFixedThreadPool(5);
+    @Autowired
+    private IKuaiShouProjectDataService kuaiShouProjectDataService;
+    @Autowired
+    private IUserAllocationService allocationService;
+    @Autowired
+    private IKuaishouReportHourlyGroupService hourlyGroupService;
+
 
     @XxlJob("kuaishouHourlyGroupReport")
     public void execute() throws Exception {
-        Date getDate = new Date();
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
-        String hour = simpleDateFormat.format(getDate);
-        if (null != hour && "00".equals(hour)) {
-            getDate = DateUtils.addDay(getDate, -1);
-        }
+        //增加接口的开始和结束日期
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String yesterday = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
         //1:查询当日数据
-        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        if (null == tokens || tokens.isEmpty()) {
-            XxlJobHelper.log("定时获取快手数据异常:未获取到可用的token");
-            XxlJobHelper.handleFail();
-            return ;
+        QueryWrapper<KuaiShouProjectData> queryWrapper = new QueryWrapper();
+        queryWrapper.eq("project_status", 0);
+        List<KuaiShouProjectData> list = kuaiShouProjectDataService.list(queryWrapper);
+        if (Check.isNull(list)) {
+            return;
+        }
+        for (KuaiShouProjectData projectData : list) {
+            Long projectId = projectData.getProjectId();
+            if (Check.isNull(projectId)) {
+                continue;
+            }
+            QueryWrapper<UserAllocation> allocationQueryWrapper = new QueryWrapper<>();
+            allocationQueryWrapper.eq("project_id", projectId);
+            allocationQueryWrapper.eq("account_status", 0);
+            List<UserAllocation> accountIds = allocationService.list(allocationQueryWrapper);
+            if (Check.isNull(accountIds)) {
+                continue;
+            }
+            for (UserAllocation allocation : accountIds) {
+                CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
+                if (Check.isNull(token)) {
+                    continue;
+                }
+
+                executorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        hourlyGroupService.getAdvertiserGroupReportHourly(token.getAccountId(), token.getAccessToken(), yesterday, yesterday);
+                    }
+                });
+            }
         }
-        Date finalGetDate = getDate;
-        tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getAdvertiserGroupReportHourly(token, finalGetDate, finalGetDate)));
     }
 }

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

@@ -1,8 +1,14 @@
 package cn.com.ctop.job.kuaishou.handler;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouProjectData;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouProjectDataService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.jeecg.common.util.DateUtils;
@@ -19,20 +25,78 @@ public class KuaishouMatDailyReportJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
+    @Autowired
+    private IKuaiShouProjectDataService kuaiShouProjectDataService;
+    @Autowired
+    private IUserAllocationService allocationService;
+
     static ExecutorService executorService = Executors.newFixedThreadPool(10);
+    static ExecutorService hourExecutorService = Executors.newFixedThreadPool(5);
 
+    /**
+     * 素材日报
+     *
+     * @throws Exception
+     */
     @XxlJob("kuaishouMaterialReportByStateDate")
     public void execute() throws Exception {
         //增加接口的开始和结束日期
         String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-        String endDate =DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        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(() -> {
-            kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(),token.getAccessToken(),startDate,endDate,1);
+            kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), startDate, endDate, "DAILY", 1);
         }));
         XxlJobHelper.log("快手物料数据同步完成");
     }
 
+
+    /**
+     * 素材时报
+     *
+     * @throws Exception
+     */
+    @XxlJob("kuaishouMaterialHourReportByStateDate")
+    public void kuaishouMaterialHourReportByStateDate() throws Exception {
+        //增加接口的开始和结束日期
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String yesterday = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        //1:查询当日数据
+        QueryWrapper<KuaiShouProjectData> queryWrapper = new QueryWrapper();
+        queryWrapper.eq("project_status", 0);
+        List<KuaiShouProjectData> list = kuaiShouProjectDataService.list(queryWrapper);
+        if (Check.isNull(list)) {
+            return;
+        }
+
+        for (KuaiShouProjectData projectData : list) {
+            Long projectId = projectData.getProjectId();
+            if (Check.isNull(projectId)) {
+                continue;
+            }
+            QueryWrapper<UserAllocation> allocationQueryWrapper = new QueryWrapper<>();
+            allocationQueryWrapper.eq("project_id", projectId);
+            allocationQueryWrapper.eq("account_status", 0);
+            List<UserAllocation> accountIds = allocationService.list(allocationQueryWrapper);
+            if (Check.isNull(accountIds)) {
+                continue;
+            }
+            for (UserAllocation allocation : accountIds) {
+                CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
+                if (Check.isNull(token)) {
+                    continue;
+                }
+
+                hourExecutorService.submit(new Runnable() {
+                    @Override
+                    public void run() {
+                        kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), yesterday, yesterday, "HOURLY", 1);
+                    }
+                });
+            }
+        }
+    }
+
 }

+ 3 - 0
module-job-kuaishou/src/main/resources/application-prod.yml

@@ -232,3 +232,6 @@ ai:
   callback:
     callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
+zip:
+  local:
+    download-path: /data/unzip/

+ 3 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/enums/KuaishouCreativeMatTypeEnum.java

@@ -10,11 +10,11 @@ public enum KuaishouCreativeMatTypeEnum {
      * 快手创意素材获取类型
      */
     KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_NEW("41","自定义上新",-10L,-5L),
-    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_HIGH_quality("42","自定义高质量",-14*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_HIGH_quality("42","自定义高质量",-28*60*24L,-1*60*24L),
     KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_MISSING("43","自定义上新",-60*60*24L,-1*60*24L),
     KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_HISTORY("44","自定义历史",-60*60*24L,-1*60*24L),
-    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_NEW("71","程序化上新",-1*60*24L,-5L),
-    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_HIGH_quality("72","程序化高质量",-14*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_NEW("71","程序化上新",-3*60*24L,-5L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_HIGH_quality("72","程序化高质量",-28*60*24L,-1*60*24L),
     KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_MISSING("73","程序化上新",-60*60*24L,-1*60*24L),
     KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_HISTORY("74","程序化历史",-60*60*24L,-1*60*24L),;
 

+ 127 - 56
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java

@@ -98,6 +98,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         log.info("账户:{},appid({}) 数据不存在", accountId, appIdArray.getLong(i));
                         continue;
                     }
+
                     if (null != strategy.getGeneralTrack() && strategy.getGeneralTrack() == 0) {
                         strategy.setClickTrackUrl(appInfo.getTrackUrl());
                         strategy.setImpressionUrl(appInfo.getTrackUrl());
@@ -149,7 +150,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
                         videoCnt--;
                         JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy);
-                        createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid);
+                        createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, appInfo.getAppVersion());
                         if (videoCnt <= 0) {
                             return videoCnt;
                         }
@@ -185,7 +186,12 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 unitCnt++;
                 String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
                 String unitName = getName(strategy.getGroupName(), strategy, createType, null, timestamp, unitCnt);
-                Long appId = JSONArray.parseArray(strategy.getAppIdArray()).getLong(0);
+
+                Long appId = null;
+                if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
+                    appId = JSONArray.parseArray(strategy.getAppIdArray()).getLong(0);
+                }
+
                 JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
                 Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                 Integer unitCode = (Integer) unitCreateResult.get("code");
@@ -208,7 +214,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
                 videoCnt--;
                 JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy);
-                createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid);
+                createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, null);
                 if (videoCnt <= 0) {
                     return 0L;
                 }
@@ -235,14 +241,24 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         }
         //1:获取视频信息
         kuaishouInterfaceService.getVideoList(token, DateUtils.date2Str(), DateUtils.date2Str());
-        Long timeStart = KuaishouCreativeMatTypeEnum.getStartTimeByType(strategy.getUnitType().toString() + createType.toString());
-        Long timeEnd = KuaishouCreativeMatTypeEnum.getEndTimeByType(strategy.getUnitType().toString() + createType.toString());
+        //2:判定账户是否单一应用
+        Long timeStart = null;
+        Long timeEnd = null;
+
+        Integer singleAppid = strategy.getSingleAppid();
+        if (null != singleAppid && singleAppid == 0) {
+            timeStart = -7 * 60 * 24L;
+            timeEnd = -5L;
+        } else {
+            timeStart = KuaishouCreativeMatTypeEnum.getStartTimeByType(strategy.getUnitType().toString() + createType.toString());
+            timeEnd = KuaishouCreativeMatTypeEnum.getEndTimeByType(strategy.getUnitType().toString() + createType.toString());
+        }
+
         Long now = System.currentTimeMillis();
         String startTime = DateUtils.formatDateTime(now + timeStart * 60 * 1000L);
         String endTime = DateUtils.formatDateTime(now + timeEnd * 60 * 1000L);
 
-        //2:判定账户是否单一应用
-        Integer singleAppid = strategy.getSingleAppid();
+
         if (null != singleAppid && singleAppid == 0) {
             //多应用
             String appidString = strategy.getAppIdArray();
@@ -300,7 +316,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         Long unitId = (Long) unitCreateResult.get("unitId");
                         unitLevelOperationRecord.setUnitId(unitId);
                         unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
-                        JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j);
+                        JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, appInfo.getAppVersion());
                         createProgramCreative(token, creativeParams, strategy);
                     }
                 }
@@ -317,7 +333,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             if (null == newCampaignId) {
                 return;
             }
-
             //创意
             List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
             for (int j = 1; j < splitVideos.size() + 1; j++) {
@@ -326,8 +341,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 String unitName = getName(strategy.getGroupName(), strategy, createType, null, timestamp, null);
                 String appIdString = strategy.getAppIdArray();
                 Long appId = null;
-                if (!Check.isNull(appIdString) && !Check.isNull(JSON.parseArray(appIdString))) {
-                    appId = JSON.parseArray(appIdString).getLong(0);
+                if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
+                    if (!Check.isNull(appIdString) && !Check.isNull(JSON.parseArray(appIdString))) {
+                        appId = JSON.parseArray(appIdString).getLong(0);
+                    }
                 }
                 JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
                 Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
@@ -349,7 +366,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 Long unitId = (Long) unitCreateResult.get("unitId");
                 unitLevelOperationRecord.setUnitId(unitId);
                 unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
-                JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j);
+                JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, null);
                 createProgramCreative(token, creativeParams, strategy);
             }
         }
@@ -436,11 +453,21 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         log.info("创建程序化创意成功");
     }
 
-    private JSONObject programCreativeParams(CtopOauthToken token, Long unitId, List<KuaiShouVideoGet> list, AiKuaishouAdvertiserStrategy strategy, Integer creativeCnt) {
+    private JSONObject programCreativeParams(CtopOauthToken token, Long unitId, List<KuaiShouVideoGet> list, AiKuaishouAdvertiserStrategy strategy, Integer creativeCnt, String appVersion) {
         JSONObject programJson = new JSONObject();
         programJson.put("advertiser_id", token.getAccountId());
         programJson.put("unit_id", unitId);
-        programJson.put("package_name", "程序化创意" + creativeCnt);
+        if (strategy.getSingleAppid() != null && strategy.getSingleAppid() == 0) {  // 多应用情况下 创意名称已app-versionMI命名
+            if (!Check.isNull(appVersion)) {
+                programJson.put("package_name", appVersion);
+            } else {
+                programJson.put("package_name", "程序化创意" + creativeCnt);
+            }
+
+        } else {
+            programJson.put("package_name", "程序化创意" + creativeCnt);
+        }
+
         JSONArray horizontalPhotoIds = new JSONArray();
         JSONArray verticalPhotoIds = new JSONArray();
         JSONArray coverImageTokens = new JSONArray();
@@ -571,6 +598,9 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
      * @param startTime  开始时间
      * @param endTime    结束时间
      */
+    @Autowired
+    private IKuaiShouCampaignService campaignService;
+
     private List<KuaiShouVideoGet> getVideosByParams(AiKuaishouAdvertiserStrategy strategy, String startTime, String endTime, AiKuaiShouAppInfo appInfo, Integer createType, Long videoCnt) {
         if (createType == 1) {
             return getNewVideoListByParams(strategy, startTime, endTime, appInfo);
@@ -584,23 +614,34 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     }
 
     private Long getCampaignId(AiKuaishouAdvertiserStrategy strategy, CtopOauthToken token, String replaceString, String checkType, Integer createType, AiKuaiShouAppInfo appInfo, String uuid) {
-        JSONArray campaignList;
-        String timestamp = null;
-        if ("ALL_CAMPAIGN".equals(checkType)) {
+        //  JSONArray campaignList;
+        String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
+        /*if ("ALL_CAMPAIGN".equals(checkType)) {
             campaignList = kuaishouInterfaceService.getCampaignList(token, null, null, 1);
         } else {
             timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
             campaignList = kuaishouInterfaceService.getCampaignList(token, new Date(), new Date(), 1);
-        }
+        }*/
 
-        if (null != campaignList && !campaignList.isEmpty()) {
+       /* if (!Check.isNull(campaignList)){
             for (int i = 0; i < campaignList.size(); i++) {
                 JSONObject jsonObject = campaignList.getJSONObject(i);
                 if (jsonObject.getString("campaign_name").contains(replaceString)) {
                     return jsonObject.getLong("campaign_id");
                 }
             }
+        }*/
+        Long campaignId = null;
+        if ("ALL_CAMPAIGN".equals(checkType)) {
+            campaignId = campaignService.getCampaignIdByAccountAndName(strategy.getAccountId(), replaceString);
+        } else if ("TODAY".equals(checkType)) {
+            String nowDate = DateUtils.getNowDate("yyyy-MM-dd") + " 00:00:01";
+            campaignId = campaignService.getCampaignIdByAccountAndNameAndDate(strategy.getAccountId(), replaceString, nowDate);
+        }
+        if (!Check.isNull(campaignId)) {
+            return campaignId;
         }
+
         // 不存在“上新”计划,则创建一个计划
         JSONObject campaignParams = new JSONObject();
         campaignParams.put("advertiser_id", token.getAccountId());
@@ -622,7 +663,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             aiKuaishouCampaignLevelOperationRecordService.saveOrUpdate(record);
             return null;
         }
-        Long campaignId = (Long) campaignCreateResult.get("campaignId");
+        campaignId = (Long) campaignCreateResult.get("campaignId");
         record.setCampaignId(campaignId);
         aiKuaishouCampaignLevelOperationRecordService.saveOrUpdate(record);
         return campaignId;
@@ -633,6 +674,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         // 拼装创建组的入参 json
         JSONObject unitParams = new JSONObject();
         Integer unitType = strategy.getUnitType();
+
+
         //创意制作方式
         unitParams.put("unit_type", unitType);
         unitParams.put("advertiser_id", token.getAccountId());
@@ -640,10 +683,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         unitParams.put("unit_name", unitName);
         //出价类型
         unitParams.put("bid_type", strategy.getBidType());
-        // 优先从系统应用商店下载
-        if (null != strategy.getUseAppMarket()) {
-            unitParams.put("use_app_market", strategy.getUseAppMarket());
-        }
+
         //组单日预算
         if (null != strategy.getUnitDayBudget() && strategy.getUnitDayBudget() != 0) {
             unitParams.put("day_budget", strategy.getUnitDayBudget());
@@ -651,9 +691,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             unitParams.put("day_budget", 0);
         }
         //应用商店列表
-        if (null != strategy.getAppStore() && !"".equals(strategy.getAppStore())) {
-            unitParams.put("app_store", JSON.parseArray(strategy.getAppStore()));
-        }
+
         unitParams.put("ocpx_action_type", strategy.getOcpxActionType());
 
         //出价
@@ -686,17 +724,63 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
 
         Integer sceneId = null;
         String scenceIdString = strategy.getSceneId();
+
         if (!Check.isNull(scenceIdString) && !Check.isNull(JSON.parseArray(scenceIdString))) {
             JSONArray scenceArray = JSON.parseArray(scenceIdString);
             sceneId = scenceArray.getInteger(0);
-            //资源位置
-            if (unitType == 7) {
-                //程序化
-                scenceArray = cleanPramgramErrorScence(scenceArray);
-            }
             unitParams.put("scene_id", scenceArray);
         }
 
+        Integer campaignType = strategy.getCampaignType();
+        if (campaignType == 2) { // 提升应用安装
+            //应用ID
+            if (!Check.isNull(appId)) {
+                unitParams.put("app_id", appId);
+            }
+            // 优先从系统应用商店下载
+            if (null != strategy.getUseAppMarket()) {
+                unitParams.put("use_app_market", strategy.getUseAppMarket());
+            }
+            if (null != strategy.getAppStore() && !"".equals(strategy.getAppStore())) {
+                unitParams.put("app_store", JSON.parseArray(strategy.getAppStore()));
+            }
+        } else if (campaignType == 3) { //  获取电商下单
+
+            //url类型
+            if (!Check.isNull(strategy.getUrlType())) {
+                unitParams.put("url_type", strategy.getUrlType());
+            }
+
+            if (!Check.isNull(strategy.getUrl())) {
+                unitParams.put("url", strategy.getUrl());
+            }
+
+        } else if (campaignType == 5) { //收集销售线索
+            //url类型
+            if (!Check.isNull(strategy.getWebUriType())) {
+                unitParams.put("web_uri_type", strategy.getWebUriType());
+            }
+            //url
+            if (!Check.isNull(strategy.getUrl())) {
+                unitParams.put("url", strategy.getUrl());
+            }
+
+        } else if (campaignType == 7) { //  提高应用活跃
+            //  appId
+            if (!Check.isNull(appId)) {
+                unitParams.put("app_id", appId);
+            }
+
+            //  url
+            if (!Check.isNull(strategy.getUrl())) {
+                unitParams.put("url", strategy.getUrl());
+            }
+            //调起链接
+            if (!Check.isNull(strategy.getSchemaUri())) {
+                unitParams.put("schema_uri", strategy.getSchemaUri());
+            }
+        }
+
         //投放开始时间
         if (!Check.isNull(strategy.getBeginTime())) {
             unitParams.put("begin_time", strategy.getBeginTime());
@@ -715,26 +799,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (!Check.isNull(strategy.getConvertId())) {
             unitParams.put("convert_id", strategy.getConvertId());
         }
-        //url类型
-        if (!Check.isNull(strategy.getUrlType())) {
-            unitParams.put("url_type", strategy.getUrlType());
-        }
-        //url类型
-        if (!Check.isNull(strategy.getWebUriType())) {
-            unitParams.put("web_uri_type", strategy.getWebUriType());
-        }
-        //url
-        if (!Check.isNull(strategy.getUrl())) {
-            unitParams.put("url", strategy.getUrl());
-        }
-        //调起链接
-        if (!Check.isNull(strategy.getSchemaUri())) {
-            unitParams.put("schema_uri", strategy.getSchemaUri());
-        }
-        //应用ID
-        if (!Check.isNull(appId)) {
-            unitParams.put("app_id", appId);
-        }
+
+
         //创意展现方式
         if (!Check.isNull(strategy.getShowMode())) {
             unitParams.put("show_mode", strategy.getShowMode());
@@ -1007,14 +1073,14 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
 
     private void createCreativeByImage(List<MaterialCutFrame> cutFrameList, CtopOauthToken token, JSONObject creativeParams,
                                        Long campaignId, Long unitId, KuaiShouVideoGet videoItem,
-                                       int imageNumber, AiKuaishouAdvertiserStrategy strategy, String uuid) {
+                                       int imageNumber, AiKuaishouAdvertiserStrategy strategy, String uuid, String appVersion) {
         if ((null != cutFrameList && !cutFrameList.isEmpty())) {
             for (int i = 0; i < cutFrameList.size(); i++) {
                 String imageCode = cutFrameList.get(i).getSignature();
                 String imageUrl = cutFrameList.get(i).getUrl();
                 String imageToken = getImageToken(imageUrl, imageCode, token.getAccountId(), token.getAccessToken());
                 creativeParams.put("image_token", imageToken);
-                createCreative(token, creativeParams, campaignId, unitId, i + 1, videoItem, strategy, uuid);
+                createCreative(token, creativeParams, campaignId, unitId, i + 1, videoItem, strategy, uuid, appVersion);
                 imageNumber--;
                 if (imageNumber <= 0) {
                     break;
@@ -1088,8 +1154,13 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
 
 
     private void createCreative(CtopOauthToken token, JSONObject creativeParams, Long campaignId, Long unitId,
-                                int creativeCnt, KuaiShouVideoGet videoGet, AiKuaishouAdvertiserStrategy strategy, String uuid) {
-        String creativeName = "自定义创意_" + creativeCnt;
+                                int creativeCnt, KuaiShouVideoGet videoGet, AiKuaishouAdvertiserStrategy strategy, String uuid, String appVersion) {
+        String creativeName = null;
+        if (!Check.isNull(appVersion)) {
+            creativeName = appVersion + "_" + creativeCnt;
+        } else {
+            creativeName = "自定义创意_" + creativeCnt;
+        }
         creativeParams.put("creative_name", creativeName);
         Map<String, Object> creativeCreateResult = kuaishouInterfaceService.creativeCreate(token.getAccessToken(), token.getAccountId(), creativeParams, 1);
         Integer creativeCode = (Integer) creativeCreateResult.get("code");

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

@@ -109,7 +109,6 @@ public class BatchController {
             SpendVo spendVo = new SpendVo();
             JSONObject fundJson = iKuaishouInterfaceService.fundGet(oauthToken);
 
-
             if (!Check.isNull(fundJson)) {
                 spendVo.setBalance(fundJson.getBigDecimal("balance")); // 余额
             }
@@ -120,15 +119,7 @@ public class BatchController {
             spendVo.setBudget(budget);
             result.setSuccess(true);
             result.setResult(spendVo);
-
             String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
-            String startDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
-            String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, 1);
-
-
-            iKuaishouInterfaceService.getCampaignList(oauthToken, new java.util.Date(), new java.util.Date());
-
-
             Thread thread = new Thread() {
                 @Override
                 public void run() {
@@ -149,21 +140,12 @@ public class BatchController {
             Thread thread2 = new Thread() {
                 @Override
                 public void run() {
-                    // syncPullMaterialService.getSyncVideoList(accountId, nowDate, nowDate);
                     iKuaishouInterfaceService.getVideoList(oauthToken, nowDate, nowDate);
 
                 }
             };
             thread2.start();
 
-          /*  Thread thread3 = new Thread() {
-                @Override
-                public void run() {
-                    iKuaishouInterfaceService.getSuZaoList(oauthToken.getAccessToken(), accountId, 1, nowDate, endDate);
-                }
-            };
-            thread3.start();*/
-
             Thread thread4 = new Thread() {
                 @Override
                 public void run() {
@@ -172,7 +154,6 @@ public class BatchController {
                 }
             };
             thread4.start();
-
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);
@@ -198,10 +179,11 @@ public class BatchController {
                                                            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                            HttpServletRequest req) {
         Result<IPage<KuaiShouCampaign>> result = new Result<>();
+        CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(kuaiShouCampaign.getAccountId());
+        iKuaishouInterfaceService.getCampaignList(oauthToken, new java.util.Date(), new java.util.Date());
         String campaignName = kuaiShouCampaign.getCampaignName();
         kuaiShouCampaign.setCampaignName(null);
         if (!Check.isNull(kuaiShouCampaign.getCampaignId())) {
-            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(kuaiShouCampaign.getAccountId());
             iKuaishouInterfaceService.getCampaign(oauthToken.getAccessToken(), kuaiShouCampaign.getAccountId(), kuaiShouCampaign.getCampaignId());
         }
         QueryWrapper<KuaiShouCampaign> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouCampaign, req.getParameterMap());

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

@@ -21,4 +21,8 @@ public interface KuaiShouCampaignMapper extends BaseMapper<KuaiShouCampaign> {
     List<Long> queryCampaignIdByAccountId(Long accountId);
 
     Integer getNewDataByAccountIdAndDate(@Param("accountId") Long accountId, @Param("statDate") String statDate);
+
+    Long getCampaignIdByAccountAndName(@Param("accountId") Long accountId, @Param("name") String replaceString);
+
+    Long getCampaignIdByAccountAndNameAndDate(@Param("accountId") Long accountId, @Param("name") String replaceString, @Param("nowDate") String nowDate);
 }

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

@@ -54,4 +54,20 @@
      where account_id = #{accountId}
      and DATE_FORMAT(put_create_time,'%Y-%m-%d') = #{statDate}
     </select>
+    <select id="getCampaignIdByAccountAndName" resultType="java.lang.Long">
+        select campaign_id  from  ctop_kuaishou_campaign where  account_id = #{accountId}
+        and campaign_name like CONCAT('%',CONCAT(#{name},'%'))
+        order by put_create_time DESC
+        limit 1
+
+
+    </select>
+    <select id="getCampaignIdByAccountAndNameAndDate" resultType="java.lang.Long">
+          select campaign_id  from  ctop_kuaishou_campaign where  account_id = #{accountId}
+        and campaign_name like CONCAT('%',CONCAT(#{name},'%'))
+        and put_create_time &gt;= #{nowDate}
+        order by put_create_time DESC
+        limit 1
+
+    </select>
 </mapper>

+ 4 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCampaignService.java

@@ -23,4 +23,8 @@ public interface IKuaiShouCampaignService extends IService<KuaiShouCampaign> {
     KuaiShouCampaign getCampaignByAccountAndCampaign(Long accountId, Long campaignId);
 
     Integer getNewDataByAccountIdAndDate(Long accountId, String statDate);
+
+    Long getCampaignIdByAccountAndName(Long accountId, String replaceString);
+
+    Long getCampaignIdByAccountAndNameAndDate(Long accountId, String replaceString, String nowDate);
 }

+ 4 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCreativeService.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 
+import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -70,4 +71,7 @@ public interface IKuaiShouCreativeService extends IService<KuaiShouCreative> {
     String getClickTrackUrl(Long accountId, Long unitId);
 
     List<KuaiShouCreative> getCreativeListByAccountIdAndUnitId(Long accountId, Long unitId);
+
+
+    void getProgramCreative(CtopOauthToken oauthToken, int page);
 }

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

@@ -17,7 +17,7 @@ public interface IKuaiShouReportDailyMaterialService extends IService<KuaiShouRe
 
     List<KuaiShouVideoGetVo> getVideoList(Map<String, Object> requestMap);
 
-    void getMaterialReportByAccountIdAndStatDate(Long accountId, String token, String startDate, String endDate, Integer page);
+    void getMaterialReportByAccountIdAndStatDate(Long accountId, String token, String startDate, String endDate,String temporalGranularity, Integer page);
 
     List<KuaiShouReportDailyMaterial> getSignatureByDate(String date);
 

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

@@ -5,11 +5,7 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.ConvertVo;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResult;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCampaign;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCampaign;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCreative;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyGroup;
+import cn.com.ctop.kuaishou.modules.report.entity.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 
@@ -316,14 +312,6 @@ public interface IKuaishouInterfaceService {
      */
     void getAdvertiserCampaignReportHourly(CtopOauthToken token, Date startDate, Date endDate);
 
-    /**
-     * 获取组时报
-     *
-     * @param token
-     * @param startDate
-     * @param endDate
-     */
-    void getAdvertiserGroupReportHourly(CtopOauthToken token, Date startDate, Date endDate);
 
     /**
      * 获取创意时报 暂停使用

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

@@ -45,10 +45,11 @@ public class KuaiShouActionBarTextServiceImpl extends ServiceImpl<KuaiShouAction
         queryWrapper.last("limit 1");
         CtopOauthToken token = tokenService.getOne(queryWrapper);
         List list = new ArrayList();
-        list.add(2);
+     /*   list.add(2);
         list.add(3);
         list.add(4);
-        list.add(5);
+        list.add(5);*/
+        list.add(7);
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.ACTION_BAR_TEXT_LIST;
         Map<String, String> headers = new HashMap<>();
         headers.put("Access-Token", token.getAccessToken());
@@ -60,6 +61,7 @@ public class KuaiShouActionBarTextServiceImpl extends ServiceImpl<KuaiShouAction
             requestJson.put("campaign_type", list.get(i));
             String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
             JSONObject resultJson = JSONObject.parseObject(result);
+            System.err.println(resultJson);
             Integer code = resultJson.getInteger("code");
             if (code == 0) {
                 JSONObject data = resultJson.getJSONObject("data");
@@ -69,7 +71,7 @@ public class KuaiShouActionBarTextServiceImpl extends ServiceImpl<KuaiShouAction
                     if (!Check.isNull(action_bar_text)) {
                         Map<String, Object> deleteMap = new HashMap<>();
                         deleteMap.put("type", campaign_type);
-                        actionBarTextMapper.deleteByMap(deleteMap);
+                   //     actionBarTextMapper.deleteByMap(deleteMap);
                         for (int j = 0; j < action_bar_text.size(); j++) {
                             String actionBarText = action_bar_text.getString(j);
                             KuaiShouActionBarText kuaiShouActionBarText = new KuaiShouActionBarText();

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

@@ -81,4 +81,14 @@ public class KuaiShouCampaignServiceImpl extends ServiceImpl<KuaiShouCampaignMap
         return campaignMapper.getNewDataByAccountIdAndDate(accountId, statDate);
     }
 
+    @Override
+    public Long getCampaignIdByAccountAndName(Long accountId, String replaceString) {
+        return campaignMapper.getCampaignIdByAccountAndName(accountId, replaceString);
+    }
+
+    @Override
+    public Long getCampaignIdByAccountAndNameAndDate(Long accountId, String replaceString, String nowDate) {
+        return campaignMapper.getCampaignIdByAccountAndNameAndDate(accountId, replaceString, nowDate);
+    }
+
 }

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.batch.service.impl;
 
+import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
@@ -304,4 +305,79 @@ public class KuaiShouCreativeServiceImpl extends ServiceImpl<KuaiShouCreativeMap
     }
 
 
+    @Override
+    public void getProgramCreative(CtopOauthToken token, int page) {
+
+        log.info("获取视频数据,accountId:{}", token.getAccountId());
+        String url1 = "https://ad.e.kuaishou.com/rest/openapi/v2/creative/advanced/program/list";
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", token.getAccessToken());
+        Map<String, Object> param = new HashMap<>();
+        param.put("advertiser_id", token.getAccountId());
+        param.put("page_size", 500);
+        param.put("page", page);
+
+        String result = HttpUtils.httpPostRequest(url1, param, headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        Integer code = resultJson.getInteger("code");
+        String message = resultJson.getString("message");
+        if (null == code || code != 0) {
+            log.error("获取快手视频列表数据异常:{},accountId:{}", message, token.getAccountId());
+            return;
+        }
+        JSONObject dataJson = resultJson.getJSONObject("data");
+        if (Check.isNull(dataJson)) {
+            return;
+        }
+        JSONArray details = dataJson.getJSONArray("details");
+        if (Check.isNull(details)) {
+            return;
+        }
+
+        for (int i = 0; i < details.size(); i++) {
+            JSONObject jsonObject = details.getJSONObject(i);
+            if (Check.isNull(jsonObject)) {
+                continue;
+            }
+
+            String updateUrl = "https://ad.e.kuaishou.com/rest/openapi/v2/creative/advanced/program/update";
+
+            Map<String, String> headers1 = new HashMap<>();
+            headers1.put("Content-Type", "application/json");
+            headers1.put("Access-Token", token.getAccessToken());
+            Map<String, Object> param1 = new HashMap<>();
+            param1.put("advertiser_id", token.getAccountId());
+            param1.put("unit_id", jsonObject.getLong("unit_id"));
+
+          /*  String clickTrackUrl = jsonObject.getString("click_url").replace("&idfa_md5=__IDFA__", "").replace("&idfa_md5=__IDFA2__", "");
+            if (Check.isNull(clickTrackUrl)) {
+                continue;
+            }
+
+            if (clickTrackUrl.contains("&ad_name=__DNAME__")) {
+                continue;
+            }*/
+
+            String replaceUrll = "https://click-wailaxin.1sapp.com/vendor/feedback/reportClick?platform=kuaishou&feedback_type=android&account_id=19&plan_id=__DID__&adgroup_id=__AID__&creative_id=__CID__&imei=__IMEI2__&mac=__MAC__&androidid=__ANDROIDID2__&ts=__TS__&ip=__IP__&ua=__UA__&callback=__CALLBACK__&oaid=__OAID__&app=dxqlb";
+
+            param1.put("click_url", replaceUrll);
+            String result1 = HttpUtils.httpPostRequest(updateUrl, param1, headers1);
+            JSONObject resultJson1 = JSONObject.parseObject(result1);
+            Integer code1 = resultJson1.getInteger("code");
+            if (code1 == 0) {
+                log.info("修改成功,accountId:{},unitId:{}", token.getAccountId(), jsonObject.getLong("unit_id"));
+
+            } else {
+                log.info("修改失败,accountId:{},unitId:{},原因:{}", token.getAccountId(), jsonObject.getLong("unit_id"), resultJson1.getString("message"));
+            }
+
+
+        }
+
+        getProgramCreative(token, page + 1);
+
+    }
+
+
 }

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

@@ -6,6 +6,7 @@ import cn.com.ctop.kuaishou.modules.batch.entity.vo.KuaiShouVideoGetVo;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouReportDailyMaterialMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouReportHourlyMaterialMapper;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -30,6 +31,8 @@ import java.util.Map;
 public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShouReportDailyMaterialMapper, KuaiShouReportDailyMaterial> implements IKuaiShouReportDailyMaterialService {
     @Autowired
     private KuaiShouReportDailyMaterialMapper dailyMaterialMapper;
+    @Autowired
+    private KuaiShouReportHourlyMaterialMapper hourlyMaterialMapper;
 
     @Override
     public List<KuaiShouVideoGetVo> getVideoList(Map<String, Object> requestMap) {
@@ -44,7 +47,7 @@ public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShou
      * @param endDate
      */
     @Override
-    public void getMaterialReportByAccountIdAndStatDate(Long accountId, String token, String startDate, String endDate, Integer page) {
+    public void getMaterialReportByAccountIdAndStatDate(Long accountId, String token, String startDate, String endDate, String temporalGranularity, Integer page) {
         String url = "https://ad.e.kuaishou.com/rest/openapi/v1/report/material_report";
         Map<String, String> headers = new HashMap<>();
         headers.put("Content-Type", "application/json");
@@ -53,7 +56,7 @@ public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShou
         param.put("start_date", startDate);
         param.put("end_date", endDate);
         param.put("advertiser_id", accountId);
-        param.put("temporal_granularity", "DAILY");
+        param.put("temporal_granularity", temporalGranularity);
         param.put("view_type", 5);
         param.put("page_size", 2000);
         param.put("page", page);
@@ -89,8 +92,13 @@ public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShou
             addList.add(material);
         }
         addList = this.getVideoInfoByList(addList, photoIdList);
-        dailyMaterialMapper.batchReplace(addList);
-        getMaterialReportByAccountIdAndStatDate(accountId, token, startDate, endDate, page + 1);
+        if ("DAILY".equals(temporalGranularity)) {
+            dailyMaterialMapper.batchReplace(addList);
+        } else if ("HOURLY".equals(temporalGranularity)) {
+            hourlyMaterialMapper.batchReplace(addList);
+        }
+
+        getMaterialReportByAccountIdAndStatDate(accountId, token, startDate, endDate, temporalGranularity, page + 1);
     }
 
     private List<KuaiShouReportDailyMaterial> getVideoInfoByList(List<KuaiShouReportDailyMaterial> addList, List<Long> photoIdList) {

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

@@ -504,57 +504,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
 
     @Override
-    public void getAdvertiserGroupReportHourly(CtopOauthToken token, Date startDate, Date endDate) {
-        getGroupHourlyReportByPage(token, startDate, endDate, 1);
-    }
-
-    private void getGroupHourlyReportByPage(CtopOauthToken token, Date startDate, Date endDate, int page) {
-        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GTOUP_REPORT;
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Content-Type", "application/json");
-        headers.put("Access-Token", token.getAccessToken());
-        Map<String, Object> param = new HashMap<>();
-        param.put("start_date", DateUtils.formatDate(startDate));
-        param.put("end_date", DateUtils.formatDate(endDate));
-        param.put("advertiser_id", token.getAccountId());
-        param.put("temporal_granularity", "HOURLY");
-        param.put("page_size", 2000);
-        param.put("page", page);
-
-        String result = HttpUtils.httpPostRequest(url, param, headers);
-        JSONObject resultJson = JSONObject.parseObject(result);
-        Integer code = resultJson.getInteger("code");
-        String message = resultJson.getString("message");
-        if (null == code || code != 0) {
-            log.error("获取快手广告组时报表异常:{},accountId:{}", message, token.getAccountId());
-            return;
-        }
-        JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
-        if (null == details || details.size() <= 0) {
-            log.info("快手广告组时报表信息为空=》accountId:{}", token.getAccountId());
-            return;
-        }
-        List<KuaishouReportHourlyGroup> groups = new ArrayList<>();
-        for (int i = 0; i < details.size(); i++) {
-            JSONObject detailJson = details.getJSONObject(i);
-            var show = detailJson.getLong("show");
-            detailJson.put("photo_show", show);
-            var like = detailJson.getLong("like");
-            detailJson.put("photo_like", like);
-            var hourlyGroup = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyGroup.class);
-            hourlyGroup.setAccountId(token.getAccountId());
-            hourlyGroup.setId("" + hourlyGroup.getAccountId() + hourlyGroup.getUnitId() + hourlyGroup.getStatDate() + hourlyGroup.getStatHour());
-            hourlyGroup.setCreateTime(new Date());
-            hourlyGroup.setUpdateTime(new Date());
-            groups.add(hourlyGroup);
-        }
-        hourlyGroupService.replaceBatch(groups);
-
-
-        getGroupHourlyReportByPage(token, startDate, endDate, page + 1);
-    }
-
-    @Override
     public KuaishouResult<KuaishouReportHourlyGroup> getGroupHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GTOUP_REPORT;
         Map<String, String> headers = new HashMap<>();
@@ -1023,7 +972,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             param.put("end_date", DateUtils.formatDate(endDate));
         }
         param.put("page", page);
-        param.put("page_size", 200);
+        param.put("page_size", 500);
 
         String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
         JSONObject resultJson = JSONObject.parseObject(result);
@@ -1905,7 +1854,10 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                         returnJson.put("isAppInvoked", dataJson.getInteger("is_app_invoked"));
                         returnJson.put("isMultiConversion", dataJson.getInteger("is_multi_conversion"));
                         returnJson.put("isAdWatchTimes", dataJson.getInteger("is_ad_watch_times"));
-
+                        returnJson.put("isAppInvoked", dataJson.getInteger("is_app_invoked"));
+                        returnJson.put("isMultiConversion", dataJson.getInteger("is_multi_conversion"));
+                        returnJson.put("isAdWatchTimes", dataJson.getInteger("is_ad_watch_times"));
+                        returnJson.put("isOrderPaied", dataJson.getInteger("is_order_paied"));
 
                         JSONArray deep_conversion_types = dataJson.getJSONArray("deep_conversion_types");
                         JSONArray deepConversionTypes = new JSONArray();

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

@@ -42,7 +42,6 @@ public class KuaishouPopulationServiceImpl extends ServiceImpl<KuaishouPopulatio
 
     @Override
     public JSONObject getPopulationList(Long accountId, String accessToken, Integer status) {
-        log.info("获取人群包列表,accountId:{}", accountId);
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.POPULATION_LIST;
         Map<String, String> headers = new HashMap<>();
         headers.put("Access-Token", accessToken);

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

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

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

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

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

@@ -0,0 +1,71 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 快手-配置项目拉取时报数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-04-20
+ */
+@Data
+@TableName("ctop_kuaishou_project_data")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_project_data对象", description = "快手-配置项目拉取时报数据")
+public class KuaiShouProjectData {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long projectId;
+    /**
+     * 项目名称
+     */
+    @Excel(name = "项目名称", width = 15)
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
+    /**
+     * 0:拉取 1:暂停
+     */
+    @Excel(name = "0:拉取 1:暂停", width = 15)
+    @ApiModelProperty(value = "0:拉取 1:暂停")
+    private Integer projectStatus;
+    /**
+     * 创建时间
+     */
+    @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;
+}

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

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.report.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -11,7 +12,6 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
-import com.baomidou.mybatisplus.annotation.TableField;
 
 import java.util.Date;
 
@@ -191,6 +191,7 @@ public class KuaiShouReportDailyMaterial {
     @Excel(name = "日期", width = 15)
     @ApiModelProperty(value = "日期")
     private String statDate;
+    private Integer statHour;
     /**
      * 封面点击数
      */

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

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

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouProjectData;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 快手-配置项目拉取时报数据
+ *
+ * @author: jeecg-boot
+ * @date: 2021-04-20
+ * @cersion: V1.0
+ */
+public interface KuaiShouProjectDataMapper extends BaseMapper<KuaiShouProjectData> {
+
+}

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

@@ -0,0 +1,20 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportHourlyMaterial;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 素材时报
+ *
+ * @author: jeecg-boot
+ * @date: 2021-04-20
+ * @cersion: V1.0
+ */
+public interface KuaiShouReportHourlyMaterialMapper extends BaseMapper<KuaiShouReportHourlyMaterial> {
+
+    void batchReplace(@Param("addList") List<KuaiShouReportDailyMaterial> addList);
+}

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

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

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

@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouReportHourlyMaterialMapper">
+
+    <insert id="batchReplace">
+        replace into `ctop_kuaishou_report_hourly_material` (
+        account_id,
+        photo_id,
+        channel_type,
+        signature,
+        image_token,
+        cover_url,
+        photo_url,
+        creative_material_type_string,
+        ad_scene,
+        charge,
+        photo_show,
+        aclick,
+        bclick,
+        photo_share,
+        photo_comment,
+        photo_like,
+        follow,
+        cancel_follow,
+        report,
+        block,
+        negative,
+        download_started,
+        download_completed,
+        activation,
+        submit,
+        stat_date,
+        stat_hour,
+        photo_click,
+        photo_click_ratio,
+        action_ratio,
+        impression_1k_cost,
+        photo_click_cost,
+        action_cost,
+        event_pay_first_day,
+        event_pay_purchase_amount_first_day,
+        event_pay_first_day_roi,
+        event_pay,
+        event_pay_purchase_amount,
+        event_pay_roi,
+        event_register,
+        event_register_cost,
+        event_register_ratio,
+        event_jin_jian_app,
+        event_jin_jian_app_cost,
+        event_credit_grant_app,
+        event_credit_grant_app_cost,
+        event_credit_grant_app_ratio,
+        event_order_paid,
+        event_order_paid_purchase_amount,
+        event_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
+        )
+        values
+        <foreach collection="addList" item="material" separator=",">
+            (
+            #{material.accountId},
+            #{material.photoId},
+            #{material.channelType},
+            #{material.signature},
+            #{material.imageToken},
+            #{material.coverUrl},
+            #{material.photoUrl},
+            #{material.creativeMaterialTypeString},
+            #{material.adScene},
+            #{material.charge},
+            #{material.photoShow},
+            #{material.aclick},
+            #{material.bclick},
+            #{material.photoShare},
+            #{material.photoComment},
+            #{material.photoLike},
+            #{material.follow},
+            #{material.cancelFollow},
+            #{material.report},
+            #{material.block},
+            #{material.negative},
+            #{material.downloadStarted},
+            #{material.downloadCompleted},
+            #{material.activation},
+            #{material.submit},
+            #{material.statDate},
+            #{material.statHour},
+            #{material.photoClick},
+            #{material.photoClickRatio},
+            #{material.actionRatio},
+            #{material.impression1kCost},
+            #{material.photoClickCost},
+            #{material.actionCost},
+            #{material.eventPayFirstDay},
+            #{material.eventPayPurchaseAmountFirstDay},
+            #{material.eventPayFirstDayRoi},
+            #{material.eventPay},
+            #{material.eventPayPurchaseAmount},
+            #{material.eventPayRoi},
+            #{material.eventRegister},
+            #{material.eventRegisterCost},
+            #{material.eventRegisterRatio},
+            #{material.eventJinJianApp},
+            #{material.eventJinJianAppCost},
+            #{material.eventCreditGrantApp},
+            #{material.eventCreditGrantAppCost},
+            #{material.eventCreditGrantAppRatio},
+            #{material.eventOrderPaid},
+            #{material.eventOrderPaidPurchaseAmount},
+            #{material.eventJinJianLandingPage},
+            #{material.eventJinJianLandingPageCost},
+            #{material.eventCreditGrantLandingPage},
+            #{material.eventCreditGrantLandingPageCost},
+            #{material.eventCreditGrantLandingRatio},
+            #{material.eventNextDayStayCost},
+            #{material.eventNextDayStayRatio},
+            #{material.formActionRatio},
+            #{material.eventOrderPaidCost},
+            #{material.eventNextDayStay},
+            #{material.formCost},
+            #{material.formCount},
+            #{material.play3sRatio}
+            )
+        </foreach>
+
+    </insert>
+</mapper>

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

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouProjectData;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 快手-配置项目拉取时报数据
+ * @Author: jeecg-boot
+ * @Date: 2021-04-20
+ * @Version: V1.0
+ */
+public interface IKuaiShouProjectDataService extends IService<KuaiShouProjectData> {
+
+}

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

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportHourlyMaterial;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 素材时报
+ * @Author: jeecg-boot
+ * @Date: 2021-04-20
+ * @Version: V1.0
+ */
+public interface IKuaiShouReportHourlyMaterialService extends IService<KuaiShouReportHourlyMaterial> {
+
+}

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

@@ -6,5 +6,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import java.util.List;
 
 public interface IKuaishouReportHourlyGroupService extends IService<KuaishouReportHourlyGroup> {
+
+    void getAdvertiserGroupReportHourly(Long accountId, String accessToken, String startDate, String endDate);
+
     void replaceBatch(List<KuaishouReportHourlyGroup> groups);
 }

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouProjectData;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouProjectDataMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouProjectDataService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 快手-配置项目拉取时报数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-04-20
+ */
+@Service
+public class KuaiShouProjectDataServiceImpl extends ServiceImpl<KuaiShouProjectDataMapper, KuaiShouProjectData> implements IKuaiShouProjectDataService {
+
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportHourlyMaterial;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouReportHourlyMaterialMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouReportHourlyMaterialService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 素材时报
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-04-20
+ */
+@Service
+public class KuaiShouReportHourlyMaterialServiceImpl extends ServiceImpl<KuaiShouReportHourlyMaterialMapper, KuaiShouReportHourlyMaterial> implements IKuaiShouReportHourlyMaterialService {
+
+}

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

@@ -1,19 +1,79 @@
 package cn.com.ctop.kuaishou.modules.report.service.impl;
 
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyGroup;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportHourlyGroupMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyGroupService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import lombok.var;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
+import java.util.*;
 
 @Service
+@Slf4j
 public class KuaishouReportHourlyGroupServiceImpl extends ServiceImpl<KuaishouReportHourlyGroupMapper, KuaishouReportHourlyGroup> implements IKuaishouReportHourlyGroupService {
     @Autowired
     private KuaishouReportHourlyGroupMapper groupMapper;
 
+
+    @Override
+    public void getAdvertiserGroupReportHourly(Long accountId, String accessToken, String startDate, String endDate) {
+        getGroupHourlyReportByPage(accountId, accessToken, startDate, endDate, 1);
+    }
+
+    private void getGroupHourlyReportByPage(Long accountId, String accessToken, String startDate, String endDate, int page) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GTOUP_REPORT;
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", accessToken);
+        Map<String, Object> param = new HashMap<>();
+        param.put("start_date", startDate);
+        param.put("end_date", endDate);
+        param.put("advertiser_id", accountId);
+        param.put("temporal_granularity", "HOURLY");
+        param.put("page_size", 2000);
+        param.put("page", page);
+
+        String result = HttpUtils.httpPostRequest(url, param, headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        Integer code = resultJson.getInteger("code");
+        String message = resultJson.getString("message");
+        if (null == code || code != 0) {
+            log.error("获取快手广告组时报表异常:{},accountId:{}", message, accountId);
+            return;
+        }
+        JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+        if (null == details || details.size() <= 0) {
+            log.info("快手广告组时报表信息为空=》accountId:{}", accountId);
+            return;
+        }
+        List<KuaishouReportHourlyGroup> groups = new ArrayList<>();
+        for (int i = 0; i < details.size(); i++) {
+            JSONObject detailJson = details.getJSONObject(i);
+            var show = detailJson.getLong("show");
+            detailJson.put("photo_show", show);
+            var like = detailJson.getLong("like");
+            detailJson.put("photo_like", like);
+            var hourlyGroup = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyGroup.class);
+            hourlyGroup.setAccountId(accountId);
+            hourlyGroup.setId("" + hourlyGroup.getAccountId() + hourlyGroup.getUnitId() + hourlyGroup.getStatDate() + hourlyGroup.getStatHour());
+            hourlyGroup.setCreateTime(new Date());
+            hourlyGroup.setUpdateTime(new Date());
+            groups.add(hourlyGroup);
+        }
+        groupMapper.replaceBatch(groups);
+
+        getGroupHourlyReportByPage(accountId, accessToken, startDate, endDate, page + 1);
+    }
+
+
     @Override
     public void replaceBatch(List<KuaishouReportHourlyGroup> groups) {
         groupMapper.replaceBatch(groups);