Przeglądaj źródła

盯盘 数据清洗

yumeng 4 lat temu
rodzic
commit
d3bad25e1d
44 zmienionych plików z 1703 dodań i 398 usunięć
  1. 3 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  2. 37 70
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  3. 4 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyGroupReportLoadJob.java
  4. 2 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  5. 2 7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/TransferAccountServiceImpl.java
  6. 31 19
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  7. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/ProjectMapper.java
  8. 11 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml
  9. 4 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IProjectService.java
  10. 1 2
      module-common/src/main/java/cn/com/ctop/common/module/service/ISysUserService.java
  11. 18 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/ProjectServiceImpl.java
  12. 15 2
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysUserServiceImpl.java
  13. 5 1
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouGroupDailyReportJob.java
  14. 0 36
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java
  15. 4 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouCampaignMapper.java
  16. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouCreativeMapper.java
  17. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupMapper.java
  18. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouCampaignMapper.xml
  19. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouCreativeMapper.xml
  20. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupMapper.xml
  21. 3 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCampaignService.java
  22. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCreativeService.java
  23. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouGroupService.java
  24. 1 9
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java
  25. 6 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCampaignServiceImpl.java
  26. 12 8
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCreativeServiceImpl.java
  27. 7 11
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupServiceImpl.java
  28. 0 83
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  29. 248 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/EtlKuaiShouGroupDailyReportController.java
  30. 249 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/EtlKuaiShouNewlyController.java
  31. 173 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/EtlKuaiShouGroupDailyReport.java
  32. 108 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/EtlKuaiShouNewly.java
  33. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaiShouGroupDailyReportMapper.java
  34. 20 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaiShouNewlyMapper.java
  35. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyGroupMapper.java
  36. 54 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaiShouGroupDailyReportMapper.xml
  37. 32 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaiShouNewlyMapper.xml
  38. 254 137
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyGroupMapper.xml
  39. 18 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaiShouGroupDailyReportService.java
  40. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaiShouNewlyService.java
  41. 13 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyGroupService.java
  42. 116 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaiShouGroupDailyReportServiceImpl.java
  43. 114 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaiShouNewlyServiceImpl.java
  44. 68 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyGroupServiceImpl.java

+ 3 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -138,6 +138,9 @@ public class DateUtils extends PropertyEditorSupport {
         return format;
     }
 
+
+
+
     // 指定模式的时间格式
     private static SimpleDateFormat getSDFormat(String pattern) {
         return new SimpleDateFormat(pattern);

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

@@ -15,8 +15,10 @@ 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.service.IEtlKuaiShouNewlyService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouAudienceReportDailyService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyGroupService;
 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;
@@ -94,6 +96,9 @@ public class TestController {
     private MusicInfoService musicInfoService;
     @Autowired
     private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
+    @Autowired
+    private IKuaishouReportDailyGroupService reportDailyGroupService;
+
 
     static ExecutorService executorService = Executors.newFixedThreadPool(15);
     static ExecutorService videoService = Executors.newFixedThreadPool(5);
@@ -118,8 +123,22 @@ public class TestController {
 
     @Autowired
     private IUserAllocationService allocationService;
+    @Autowired
+    private IEtlKuaiShouNewlyService kuaiShouNewlyService;
 
 
+    @GetMapping("/cleanDate")
+    public String cleanDate(String statDate) throws ParseException {
+        //  kuaiShouNewlyService.cleanNewlyData(statDate);
+        // CtopOauthToken
+        CtopOauthToken tokenByAccountId = tokenService.getTokenByAccountId(9901975L);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date parse = simpleDateFormat.parse("2021-03-09");
+        reportDailyGroupService.getAdvertiserGroupReportDaily(tokenByAccountId, parse, parse);
+
+        return "success";
+    }
+
     @GetMapping("/getVideoByProjectId")
     public String getVideoByProjectId(Long projectId) {
         QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
@@ -419,26 +438,6 @@ public class TestController {
 
     }
 
-    @GetMapping(value = "/getGroupReport")
-    public void getGroupReport() throws ParseException {
-        List<CtopOauthToken> tokens = oauthTokenService.selectKuaiShouToken();
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date parse1 = simpleDateFormat.parse("2020-09-12");
-        Date parse2 = simpleDateFormat.parse("2020-09-17");
-        for (CtopOauthToken token : tokens) {
-
-            suzhaoService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    //1: 获取广告主信息数据
-                    kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, parse1, parse2);
-                }
-            });
-
-
-        }
-    }
-
 
     @GetMapping(value = "/syncDouyinMusicAsc")
     public String syncDouyinMusicAsc() {
@@ -690,7 +689,7 @@ public class TestController {
                             @Override
                             public void run() {
                                 //1: 获取广告主信息数据
-                                kuaishouInterfaceService.getAdvertiserReportDaily(token, start, end,"adScene");
+                                kuaishouInterfaceService.getAdvertiserReportDaily(token, start, end, "adScene");
                             }
                         });
                     });
@@ -745,7 +744,7 @@ public class TestController {
         SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
         Date date1 = sim.parse(startDate);
         Date date2 = sim.parse(endDate);
-        kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2,"adScene");
+        kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2, "adScene");
         return "Success";
     }
 
@@ -762,7 +761,7 @@ public class TestController {
             List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
             if (!Check.isNull(ctopOauthTokens)) {
                 for (CtopOauthToken token : ctopOauthTokens) {
-                    kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2,"adScene");
+                    kuaishouInterfaceService.getAdvertiserReportDaily(token, date1, date2, "adScene");
                 }
             }
         } catch (Exception e) {
@@ -909,39 +908,6 @@ public class TestController {
         return "success";
     }
 
-    @GetMapping(value = "/getGroupData")
-    public String getGroupData() {
-
-
-        Date endDate = new Date();
-        QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
-        tokenQueryWrapper.eq("media_id", 2);
-        List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
-        for (CtopOauthToken token : ctopOauthTokens) {
-
-            for (int i = 0; i < 7; i++) {
-                Date getStartDate = DateUtils.addDay(endDate, -i);
-                //3:获取广告组信息数据
-                kuaishouInterfaceService.getAdvertiserGroupReportHourly(token, getStartDate, getStartDate);
-            }
-            for (int i = 0; i < 6; i++) {
-                Date getStartDate = new Date();
-                Date getEndDate = new Date();
-                if (i == 0) {
-                    getStartDate = DateUtils.addDay(endDate, -175 + i * 30);
-                    getEndDate = DateUtils.addDay(endDate, -150 + i * 30);
-                } else {
-                    getStartDate = DateUtils.addDay(endDate, -180 + i * 30);
-                    getEndDate = DateUtils.addDay(endDate, -150 + i * 30);
-                }
-                //3:获取广告组信息数据
-                kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, getStartDate, getEndDate);
-            }
-        }
-        return "Success";
-    }
-
-
     @GetMapping(value = "/gerCreative")
     public void gerCreative() {
         QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
@@ -1086,7 +1052,7 @@ public class TestController {
                     } catch (ParseException e) {
                         e.printStackTrace();
                     }
-                    kuaishouInterfaceService.getAdvertiserReportDaily(token, startDate, endDate,"adScene");
+                    kuaishouInterfaceService.getAdvertiserReportDaily(token, startDate, endDate, "adScene");
 
                     Thread.sleep(1 * 200);
                     //  kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
@@ -1172,7 +1138,7 @@ public class TestController {
                 @Override
                 public void run() {
                     //1: 获取广告主信息数据
-                    kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate,"adScene");
+                    kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate, "adScene");
                 }
             });
         });
@@ -1375,9 +1341,10 @@ public class TestController {
     IBytedanceVideoReportService bytedanceVideoReportService;
     @Autowired
     IETLReportBytedanceVideoService etlReportBytedanceVideoService;
+
     @GetMapping("execute")
-    public Map<String,Object> execute(String date) throws Exception {
-        Map<String,Object>result = new HashMap<>();
+    public Map<String, Object> execute(String date) throws Exception {
+        Map<String, Object> result = new HashMap<>();
 //        List<CtopOauthToken> tokens = oauthTokenService.selectToutiaoToken();
 //        countDownLatch = new CountDownLatch(tokens.size());
 //        tokens.forEach(token -> executor.submit(() -> {
@@ -1394,11 +1361,11 @@ public class TestController {
 //        } catch (InterruptedException e) {
 //            e.printStackTrace();
 //        }
-        Map<String,Object> params = new HashMap<>();
-        params.put("stat_datetime",date);
+        Map<String, Object> params = new HashMap<>();
+        params.put("stat_datetime", date);
         etlReportBytedanceVideoService.removeByMap(params);
         etlReportBytedanceVideoService.cleanETL(date);
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 
@@ -1436,17 +1403,17 @@ public class TestController {
             }
             int page = 1;
             int pageSize = 2000;
-                getAudienceReportData(token, date, "ageSegment", page, pageSize);
-                getAudienceReportData(token, date, "gender", page, pageSize);
-                getAudienceReportData(token, date, "businessInterestTags", page, pageSize);
-                getAudienceReportData(token, date, "city", page, pageSize);
-                getAudienceReportData(token, date, "clientId", page, pageSize);
-                getAudienceReportData(token, date, "province", page, pageSize);
+            getAudienceReportData(token, date, "ageSegment", page, pageSize);
+            getAudienceReportData(token, date, "gender", page, pageSize);
+            getAudienceReportData(token, date, "businessInterestTags", page, pageSize);
+            getAudienceReportData(token, date, "city", page, pageSize);
+            getAudienceReportData(token, date, "clientId", page, pageSize);
+            getAudienceReportData(token, date, "province", page, pageSize);
         }));
     }
 
     private void getAudienceReportData(CtopOauthToken token, String date, String type, Integer page, Integer pageSize) {
-        System.out.println(date+"————:"+token.getAccountId());
+        System.out.println(date + "————:" + token.getAccountId());
         try {
             List<KuaiShouGroup> kuaiShouGroups = kuaiShouGroupService.queryUnitInfoByAccountId(token.getAccountId());
             for (KuaiShouGroup kuaiShouGroup : kuaiShouGroups) {

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

@@ -3,6 +3,7 @@ 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.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyGroupService;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.Job;
@@ -26,6 +27,8 @@ public class KuaishouDailyGroupReportLoadJob implements Job {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private IKuaishouReportDailyGroupService reportDailyGroupService;
     static ExecutorService executorService = null;
 
     @Override
@@ -48,7 +51,7 @@ public class KuaishouDailyGroupReportLoadJob implements Job {
                         @Override
                         public void run() {
                             //获取广告组信息数据
-                            kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, getDate, getDate);
+                            reportDailyGroupService.getAdvertiserGroupReportDaily(token, getDate, getDate);
                         }
                     });
                 });

+ 2 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java

@@ -361,14 +361,9 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
         }
         Map<String, String> userMap = new HashMap<>();
         if (!Check.isNullMap(userIdMap)) {
-            List<JSONObject> userList = userService.getUserMapByMap(userIdMap);
-            if (!Check.isNull(userList)) {
-                for (int i = 0; i < userList.size(); i++) {
-                    JSONObject userJson = userList.get(i);
-                    userMap.put(userJson.getString("id"), userJson.getString("realname"));
-                }
-            }
+            userMap = userService.getUserMapByMap(userIdMap);
         }
+
         Map<String, String> advertiserMap = new HashMap<>();
         if (!Check.isNullMap(advertiserIdMap)) {
             List<JSONObject> advertiserList = advertiserService.getAdvertiserByMap(advertiserIdMap);

+ 2 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/TransferAccountServiceImpl.java

@@ -84,14 +84,9 @@ public class TransferAccountServiceImpl extends ServiceImpl<TransferAccountMappe
         }
         Map<String, String> userMap = new HashMap<>();
         if (!Check.isNullMap(userIdMap)) {
-            List<JSONObject> userList = userService.getUserMapByMap(userIdMap);
-            if (!Check.isNull(userList)) {
-                for (int i = 0; i < userList.size(); i++) {
-                    JSONObject userJson = userList.get(i);
-                    userMap.put(userJson.getString("id"), userJson.getString("realname"));
-                }
-            }
+            userMap = userService.getUserMapByMap(userIdMap);
         }
+
         Map<String, String> advertiserMap = new HashMap<>();
         if (!Check.isNullMap(advertiserIdMap)) {
             List<JSONObject> advertiserList = advertiserService.getAdvertiserByMap(advertiserIdMap);

+ 31 - 19
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -62,14 +62,22 @@ public class SampleTest {
     private IBindAccountLoginService bindAccountLoginService;
     @Autowired
     private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
- /*   @Autowired
-    private IByteDanceAdvertiserDataService advertiserDataService;
+    /*   @Autowired
+       private IByteDanceAdvertiserDataService advertiserDataService;
 
-*/
+   */
+    @Autowired
+    private IKuaishouReportDailyGroupService reportDailyGroupService;
 
 
     @Test
     public void loadBytedanceCreativeData() throws ParseException {
+
+        CtopOauthToken tokenByAccountId = tokenService.getTokenByAccountId(9901975L);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date parse = simpleDateFormat.parse("2021-03-09");
+        reportDailyGroupService.getAdvertiserGroupReportDaily(tokenByAccountId, parse, parse);
+
         //    1662234704806924
        /* CtopOauthToken token = new CtopOauthToken();
         token.setAccountId(9549277L);
@@ -81,12 +89,12 @@ public class SampleTest {
         Date parse = simpleDateFormat.parse("2021-02-02");
         kuaishouInterfaceService.getAdvertiserReportDaily(token, parse, parse);*/
 
-        CtopOauthToken token = new CtopOauthToken();
+     /*   CtopOauthToken token = new CtopOauthToken();
         token.setAccountId(9767055L);
         token.setAccessToken("28e4e6b124e1443d6971ba4c699de6c9");
 
         kuaishouInterfaceService.getVideoList(token, null, null);
-        kuaishouInterfaceService.getVideoInfo("28e4e6b124e1443d6971ba4c699de6c9",9767055L,"5208131540349742192");
+        kuaishouInterfaceService.getVideoInfo("28e4e6b124e1443d6971ba4c699de6c9", 9767055L, "5208131540349742192");*/
 
      /*   CtopOauthToken tokenByAccountId = tokenService.getTokenByAccountId(1662234704806924L);
         advertiserDataService.getMaterialList(tokenByAccountId);*/
@@ -477,9 +485,10 @@ public class SampleTest {
     IRuleByteDanceAccountService ruleByteDanceAccountService;
     @Autowired
     IAiKuaishouNewCreateCampaign aiKuaishouNewCreateCampaign;
+
     @Test
-    public void testLoadBytedanceDataV2(){
-        String accountIds=
+    public void testLoadBytedanceDataV2() {
+        String accountIds =
                 "1675440464386062," +
                         "1688606248211533," +
                         "1669181787105294," +
@@ -532,11 +541,11 @@ public class SampleTest {
                         "1674634579279885," +
                         "1650263841162253," +
                         "1672178052130888";
-        String [] accountArray = accountIds.split(",");
-        for (int i=0;i<accountArray.length;i++){
+        String[] accountArray = accountIds.split(",");
+        for (int i = 0; i < accountArray.length; i++) {
             CtopOauthToken token = tokenService.getTokenByAccountId(Long.parseLong(accountArray[i]));
 
-            reportService.getAdvertiserReport(token, DateUtils.parseDate("2021-01-14","yyyy-MM-dd"), DateUtils.parseDate("2021-01-14","yyyy-MM-dd"),CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+            reportService.getAdvertiserReport(token, DateUtils.parseDate("2021-01-14", "yyyy-MM-dd"), DateUtils.parseDate("2021-01-14", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         }
     }
 
@@ -556,7 +565,7 @@ public class SampleTest {
         countDownLatch = new CountDownLatch(tokens.size());
         tokens.forEach(token -> executorService.submit(() -> {
             try {
-                kuaishouReportDailyImageService.getMaterialImageReport(token.getAccountId(),token.getAccessToken(), "2021-01-17", "2021-01-31", 1);
+                kuaishouReportDailyImageService.getMaterialImageReport(token.getAccountId(), token.getAccessToken(), "2021-01-17", "2021-01-31", 1);
             } catch (Exception e) {
 
             } finally {
@@ -572,21 +581,24 @@ public class SampleTest {
 
     @Autowired
     private IEtlKuaishouAccountMaterialReportDailyService dailyService;
+
     @Test
-    public void etlKuaishouInfo(){
-        Date startDate = DateUtils.parseDate("2020-05-03","yyyy-MM-dd");
-        for(int i=0;i<365;i++){
-            dailyService.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate(DateUtils.addDay(startDate,i)));
+    public void etlKuaishouInfo() {
+        Date startDate = DateUtils.parseDate("2020-05-03", "yyyy-MM-dd");
+        for (int i = 0; i < 365; i++) {
+            dailyService.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate(DateUtils.addDay(startDate, i)));
         }
     }
+
     @Autowired
     private IEtlKuaishouVideoInfoService videoEtlInfoService;
+
     @Test
-    public void etlKuaishouVideoInfo(){
-        Date startDate = DateUtils.parseDate("2020-09-11","yyyy-MM-dd");
-        for(int i=0;i<365;i++){
+    public void etlKuaishouVideoInfo() {
+        Date startDate = DateUtils.parseDate("2020-09-11", "yyyy-MM-dd");
+        for (int i = 0; i < 365; i++) {
 //            dailyService.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate(DateUtils.addDay(startDate,i)));
-            videoEtlInfoService.etlKuaishouVideoInfo(DateUtils.formatDate(DateUtils.addDay(startDate,i)));
+            videoEtlInfoService.etlKuaishouVideoInfo(DateUtils.formatDate(DateUtils.addDay(startDate, i)));
         }
     }
 

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/ProjectMapper.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 项目
@@ -24,4 +25,6 @@ public interface ProjectMapper extends BaseMapper<Project> {
     String querySupplierCodeById(@Param("projectId") Long projectId);
 
     List<JSONObject> getProjectListByIds(@Param("ids") JSONArray projectIdArray);
+
+    List<JSONObject> getListByMap(@Param("ids") Map<Long, Long> projectIdMap);
 }

+ 11 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml

@@ -43,5 +43,16 @@
 
 
     </select>
+    <select id="getListByMap" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        id as 'id',
+        project_name as 'projectName'
+        from ctop_project
+        where id in
+        <foreach collection="ids" item="ids" separator="," open="(" close=")">
+            #{ids}
+        </foreach>
+
+    </select>
 
 </mapper>

+ 4 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IProjectService.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 项目
@@ -23,4 +24,7 @@ public interface IProjectService extends IService<Project> {
     String getSupplierCodeById(Long projectId);
 
     List<JSONObject> getProjectListByIds(JSONArray projectIdArray);
+
+
+    Map<Long, String> getProjectMap(Map<Long, Long> projectIdMap);
 }

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

@@ -3,7 +3,6 @@ package cn.com.ctop.common.module.service;
 import cn.com.ctop.common.module.entity.SysUser;
 import cn.com.ctop.common.module.model.SysUserSysDepartModel;
 import cn.com.ctop.common.module.vo.SysUserVo;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -269,5 +268,5 @@ public interface ISysUserService extends IService<SysUser> {
 
     List<SysUser> queryPageList(SysUser user);
 
-    List<JSONObject> getUserMapByMap(Map<String, String> userIdMap);
+    Map<String, String> getUserMapByMap(Map<String, String> userIdMap);
 }

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

@@ -3,6 +3,7 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.mapper.ProjectMapper;
 import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -10,7 +11,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 项目
@@ -47,4 +50,19 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     public List<JSONObject> getProjectListByIds(JSONArray projectIdArray) {
         return projectMapper.getProjectListByIds(projectIdArray);
     }
+
+    @Override
+    public Map<Long, String> getProjectMap(Map<Long, Long> projectIdMap) {
+        Map<Long, String> projectMap = new HashMap<>();
+        if (!Check.isNullMap(projectIdMap)) {
+            List<JSONObject> projectList = projectMapper.getListByMap(projectIdMap);
+            if (!Check.isNull(projectList)) {
+                for (int i = 0; i < projectList.size(); i++) {
+                    JSONObject projectJson = projectList.get(i);
+                    projectMap.put(projectJson.getLong("id"), projectJson.getString("projectName"));
+                }
+            }
+        }
+        return projectMap;
+    }
 }

+ 15 - 2
module-common/src/main/java/cn/com/ctop/common/module/service/impl/SysUserServiceImpl.java

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.mapper.*;
 import cn.com.ctop.common.module.model.SysUserSysDepartModel;
 import cn.com.ctop.common.module.service.ISysBaseApi;
 import cn.com.ctop.common.module.service.ISysUserService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.vo.SysUserDepVo;
 import cn.com.ctop.common.module.vo.SysUserVo;
 import com.alibaba.fastjson.JSONObject;
@@ -289,8 +290,20 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     }
 
     @Override
-    public List<JSONObject> getUserMapByMap(Map<String, String> userIdMap) {
-        return userMapper.getUserMapByMap(userIdMap);
+    public Map<String, String> getUserMapByMap(Map<String, String> userIdMap) {
+
+        Map<String, String> userMap = new HashMap<>();
+        if (!Check.isNullMap(userIdMap)) {
+            List<JSONObject> userList = userMapper.getUserMapByMap(userIdMap);
+            if (!Check.isNull(userList)) {
+                for (int i = 0; i < userList.size(); i++) {
+                    JSONObject userJson = userList.get(i);
+                    userMap.put(userJson.getString("id"), userJson.getString("realname"));
+                }
+            }
+        }
+
+        return userMap;
     }
 
     @Override

+ 5 - 1
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouGroupDailyReportJob.java

@@ -3,6 +3,7 @@ package cn.com.ctop.job.kuaishou.handler;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyGroupService;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.jeecg.common.util.DateUtils;
@@ -22,8 +23,11 @@ public class KuaishouGroupDailyReportJob {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private IKuaishouReportDailyGroupService reportDailyGroupService;
 
     static ExecutorService executorService = Executors.newFixedThreadPool(5);
+
     @XxlJob("kuaishouGroupDailyReportJob")
     public void execute() throws ParseException {
         String date = DateUtils.getDate("yyyy-MM-dd");
@@ -34,7 +38,7 @@ public class KuaishouGroupDailyReportJob {
         Date parse2 = simpleDateFormat.parse(endDate);
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
         tokens.forEach(token -> executorService.submit(() ->
-                kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, parse, parse2))
+                reportDailyGroupService.getAdvertiserGroupReportDaily(token, parse, parse2))
         );
         XxlJobHelper.log("快手物料数据同步完成");
     }

+ 0 - 36
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java

@@ -1,6 +1,5 @@
 package cn.com.ctop.kuaishou.modules.batch.controller;
 
-import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.vo.KuaishouReportAccountDailyDTOEntity;
@@ -27,8 +26,6 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
 
 /**
  * @author yumeng
@@ -46,39 +43,6 @@ public class KuaiShouController {
     @Autowired
     private IKuaishouReportDailyAccountService accountService;
 
-    @RequestMapping("report")
-    public Map<String, Object> getReport(String accountId, String startDate, String endDate, Integer type, String temporalGranularity) {
-        Map<String, Object> result = new HashMap<>();
-        CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
-        if (null != type) {
-            if (type == 1) {
-                //广告主
-
-            } else if (type == 2) {
-                //广告组
-                if (null != temporalGranularity && "hourly".equals(temporalGranularity)) {
-                    result.put("data", kuaishouInterfaceService.getGroupHourlyReport(token.getAccessToken(), token.getAccountId(), startDate, endDate, 500, 1));
-                } else {
-                    result.put("data", kuaishouInterfaceService.getGroupDailyReport(token.getAccessToken(), token.getAccountId(), startDate, endDate, 500, 1));
-                }
-            } else if (type == 3) {
-                //广告计划
-                if (null != temporalGranularity && "hourly".equals(temporalGranularity)) {
-                    result.put("data", kuaishouInterfaceService.getCampaignHourlyReport(token.getAccessToken(), token.getAccountId(), startDate, endDate, 500, 1));
-                } else {
-                    result.put("data", kuaishouInterfaceService.getCampaignDailyReport(token.getAccessToken(), token.getAccountId(), startDate, endDate, 500, 1));
-                }
-            } else {
-                //广告创意
-                if (null != temporalGranularity && "hourly".equals(temporalGranularity)) {
-                    result.put("data", kuaishouInterfaceService.getCreativeHourlyReport(token.getAccessToken(), token.getAccountId(), startDate, endDate, 500, 1));
-                } else {
-                    result.put("data", kuaishouInterfaceService.getCreativeDailyReport(token.getAccessToken(), token.getAccountId(), startDate, endDate, 500, 1));
-                }
-            }
-        }
-        return result;
-    }
 
     @RequestMapping("/getKuaishouProjectInfo")
     public Result<PageInfo<ProjectAccountDTO>> getKuaishouProjectInfo(@RequestBody KuaishouInfoDTO dto) {

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

@@ -1,7 +1,6 @@
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
-import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -17,7 +16,9 @@ public interface KuaiShouCampaignMapper extends BaseMapper<KuaiShouCampaign> {
 
     void replaceBatch(@Param(value = "campaigns") List<KuaiShouCampaign> campaigns);
 
-    List<Long> queryIdsByPutStatus(Long accountId,String putStatus);
+    List<Long> queryIdsByPutStatus(Long accountId, String putStatus);
 
-    JSONArray queryCampaignIdByAccountId(Long accountId);
+    List<Long> queryCampaignIdByAccountId(Long accountId);
+
+    Integer getNewDataByAccountIdAndDate(@Param("accountId") Long accountId, @Param("statDate") String statDate);
 }

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

@@ -28,4 +28,6 @@ public interface KuaiShouCreativeMapper extends BaseMapper<KuaiShouCreative> {
     List<KuaiShouCreative> queryCreativeInfoByCampaignId(@Param("accountId") Long accountId, @Param("campaignId") Long campaignId);
 
     List<Long> getCreativeIds(@Param("accountId") Long accountId);
+
+    Integer getNewDataByAccountIdAndDate(Long accountId, String statDate);
 }

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

@@ -33,4 +33,6 @@ public interface KuaiShouGroupMapper extends BaseMapper<KuaiShouGroup> {
     Integer queryToDayBuiltCount(@Param("accountId") Long accountId, @Param("date") String date);
 
     void deleteByAccountId(@Param("accountId") Long accountId);
+
+    Integer getNewDataByAccountIdAndDate(Long accountId, String statDate);
 }

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

@@ -47,4 +47,11 @@
         ctop_kuaishou_campaign
         WHERE account_id = #{accountId}
     </select>
+    <select id="getNewDataByAccountIdAndDate" resultType="java.lang.Integer">
+     select
+     count(1)
+     from ctop_kuaishou_campaign
+     where account_id = #{accountId}
+     and DATE_FORMAT(put_create_time,'%Y-%m-%d') = #{statDate}
+    </select>
 </mapper>

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

@@ -147,5 +147,12 @@
      where  account_id = #{accountId}
      and  status = 42
     </select>
+    <select id="getNewDataByAccountIdAndDate" resultType="java.lang.Integer">
+     select
+     count(1)
+     from ctop_kuaishou_creative
+     where account_id = #{accountId}
+     and DATE_FORMAT(creative_create_time,'%Y-%m-%d') = #{statDate}
+    </select>
 
 </mapper>

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

@@ -137,6 +137,13 @@
           AND create_channel =1
           AND LOCATE(#{date}, group_create_time)
     </select>
+    <select id="getNewDataByAccountIdAndDate" resultType="java.lang.Integer">
+     select
+     count(1)
+     from ctop_kuaishou_group
+     where account_id = #{accountId}
+     and DATE_FORMAT(group_create_time,'%Y-%m-%d') = #{statDate}
+    </select>
     <delete id="deleteByAccountId">
         delete from ctop_kuaishou_group
         where  account_id = #{accountId}

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

@@ -18,7 +18,9 @@ public interface IKuaiShouCampaignService extends IService<KuaiShouCampaign> {
 
     List<JSONArray> getJsonArrByAccount(Long accountId, int idSize);
 
-    JSONArray queryCampaignIdByAccountId(Long accountId);
+    List<Long> queryCampaignIdByAccountId(Long accountId);
 
     KuaiShouCampaign getCampaignByAccountAndCampaign(Long accountId, Long campaignId);
+
+    Integer getNewDataByAccountIdAndDate(Long accountId, String statDate);
 }

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

@@ -64,4 +64,6 @@ public interface IKuaiShouCreativeService extends IService<KuaiShouCreative> {
     String convertMoString(String sMo);
 
     List<KuaiShouCreative> getByParams(Long accountId, String photoId, Integer putStatus);
+
+    Integer getNewDataByAccountIdAndDate(Long accountId, String statDate);
 }

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

@@ -41,4 +41,6 @@ public interface IKuaiShouGroupService extends IService<KuaiShouGroup> {
     Integer queryToDayBuiltCount(Long accountId);
 
     void deleteByAccountId(Long accountId);
+
+    Integer getNewDataByAccountIdAndDate(Long accountId, String statDate);
 }

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

@@ -60,7 +60,6 @@ public interface IKuaishouInterfaceService {
      * @param pageNum
      * @return
      */
-    KuaishouResult<KuaishouReportDailyGroup> getGroupDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum);
 
     /**
      * 组时报
@@ -284,14 +283,7 @@ public interface IKuaishouInterfaceService {
      */
     void getAdvertiserCampaignReportDaily(CtopOauthToken token, Date startDate, Date endDate);
 
-    /**
-     * 获取广告计划分天报表 暂停使用
-     *
-     * @param token
-     * @param startDate
-     * @param endDate
-     */
-    void getAdvertiserGroupReportDaily(CtopOauthToken token, Date startDate, Date endDate);
+
 
     /**
      * 获取创意分天报表 暂停使用

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

@@ -61,7 +61,7 @@ public class KuaiShouCampaignServiceImpl extends ServiceImpl<KuaiShouCampaignMap
     }
 
     @Override
-    public JSONArray queryCampaignIdByAccountId(Long accountId) {
+    public List<Long> queryCampaignIdByAccountId(Long accountId) {
         return campaignMapper.queryCampaignIdByAccountId(accountId);
     }
 
@@ -76,4 +76,9 @@ public class KuaiShouCampaignServiceImpl extends ServiceImpl<KuaiShouCampaignMap
         return campaign;
     }
 
+    @Override
+    public Integer getNewDataByAccountIdAndDate(Long accountId, String statDate) {
+        return campaignMapper.getNewDataByAccountIdAndDate(accountId, statDate);
+    }
+
 }

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

@@ -14,7 +14,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -273,18 +272,23 @@ public class KuaiShouCreativeServiceImpl extends ServiceImpl<KuaiShouCreativeMap
 
     @Override
     public List<KuaiShouCreative> getByParams(Long accountId, String photoId, Integer putStatus) {
-        QueryWrapper<KuaiShouCreative>queryWrapper =new QueryWrapper<>();
-        if(null!=accountId&&accountId!=0){
-            queryWrapper.eq("account_id",accountId);
+        QueryWrapper<KuaiShouCreative> queryWrapper = new QueryWrapper<>();
+        if (null != accountId && accountId != 0) {
+            queryWrapper.eq("account_id", accountId);
         }
-        if(null!=photoId&&!"".equals(photoId.trim())){
-            queryWrapper.eq("photo_id",photoId);
+        if (null != photoId && !"".equals(photoId.trim())) {
+            queryWrapper.eq("photo_id", photoId);
         }
-        if(null!=putStatus&&putStatus!=0){
-            queryWrapper.eq("put_status",putStatus);
+        if (null != putStatus && putStatus != 0) {
+            queryWrapper.eq("put_status", putStatus);
         }
         return this.list(queryWrapper);
     }
 
+    @Override
+    public Integer getNewDataByAccountIdAndDate(Long accountId, String statDate) {
+        return kuaiShouCreativeMapper.getNewDataByAccountIdAndDate(accountId, statDate);
+    }
+
 
 }

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

@@ -4,12 +4,7 @@ import cn.com.ctop.common.module.utils.Check;
 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.batch.entity.KuaiShouAppInfo;
-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.KuaiShouGroupTarget;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouSchedule;
+import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAppInfoMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTargetMapper;
@@ -27,11 +22,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -149,6 +140,11 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
         groupMapper.deleteByAccountId(accountId);
     }
 
+    @Override
+    public Integer getNewDataByAccountIdAndDate(Long accountId, String statDate) {
+        return groupMapper.getNewDataByAccountIdAndDate(accountId, statDate);
+    }
+
 
     @Override
     public void getGroupByUnitId(String accessToken, Long accountId, Long unitId) {

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

@@ -503,90 +503,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
 
-    @Override
-    public void getAdvertiserGroupReportDaily(CtopOauthToken token, Date startDate, Date endDate) {
-        getAdvertiserGroupReportDailyByPage(token, startDate, endDate, 1);
-    }
-
-    private void getAdvertiserGroupReportDailyByPage(CtopOauthToken token, Date startDate, Date endDate, int page) {
-        log.info("获取广告组日报,accountId:{},开始时间:{},结束时间:{}", token.getAccountId(), DateUtils.formatDate(startDate), DateUtils.formatDate(endDate));
-        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<>();
-        if (!Check.isNull(startDate)) {
-            param.put("start_date", DateUtils.formatDate(startDate));
-        }
-
-        if (!Check.isNull(endDate)) {
-            param.put("end_date", DateUtils.formatDate(endDate));
-        }
 
-        param.put("advertiser_id", token.getAccountId());
-        param.put("temporal_granularity", "DAILY");
-        param.put("page_size", 500);
-        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;
-        }
-        for (int i = 0; i < details.size(); i++) {
-            var detailJson = details.getJSONObject(i);
-
-            detailJson.put("photo_share", detailJson.getString("share"));
-            detailJson.put("photo_comment", detailJson.getString("comment"));
-            detailJson.put("photo_like", detailJson.getString("like"));
-            detailJson.put("photo_show", detailJson.getString("show"));
-
-            var dailyGroup = JSONObject.toJavaObject(detailJson, KuaishouReportDailyGroup.class);
-            dailyGroup.setAccountId(token.getAccountId());
-            dailyGroupMapper.insertSelective(dailyGroup);
-        }
-        getAdvertiserGroupReportDailyByPage(token, startDate, endDate, page + 1);
-    }
-
-    @Override
-    public KuaishouResult<KuaishouReportDailyGroup> getGroupDailyReport(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<>();
-        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", advertiserId);
-        param.put("temporal_granularity", "DAILY");
-        param.put("page_size", pageSize);
-        param.put("page", pageNum);
-        KuaishouResult<KuaishouReportDailyGroup> kuaishouResult = null;
-        try {
-            String result = HttpUtils.httpPostRequest(url, param, headers);
-            ObjectMapper mapper = new ObjectMapper();
-            mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-            kuaishouResult = mapper.readValue(result, new TypeReference<KuaishouResult<KuaishouReportDailyGroup>>() {
-            });
-            List<KuaishouReportDailyGroup> dailyGroups = kuaishouResult.getData().getDetails();
-            dailyGroups.forEach((dailyGroup) -> {
-                dailyGroup.setAccountId(advertiserId);
-                //  dailyGroup.setId("" + dailyGroup.getAccountId() + dailyGroup.getUnitId() + dailyGroup.getStatDate());
-                dailyGroupMapper.insertSelective(dailyGroup);
-            });
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return kuaishouResult;
-    }
 
     @Override
     public void getAdvertiserGroupReportHourly(CtopOauthToken token, Date startDate, Date endDate) {

+ 248 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/EtlKuaiShouGroupDailyReportController.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.EtlKuaiShouGroupDailyReport;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaiShouGroupDailyReportService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 快手组日报数据清洗
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-03-09
+ */
+@Slf4j
+@Api(tags = "快手组日报数据清洗")
+@RestController
+@RequestMapping("/group/etlKuaiShouGroupDailyReport")
+public class EtlKuaiShouGroupDailyReportController {
+    @Autowired
+    private IEtlKuaiShouGroupDailyReportService etlKuaiShouGroupDailyReportService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param etlKuaiShouGroupDailyReport
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "快手组日报数据清洗-分页列表查询")
+    @ApiOperation(value = "快手组日报数据清洗-分页列表查询", notes = "快手组日报数据清洗-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<EtlKuaiShouGroupDailyReport>> queryPageList(EtlKuaiShouGroupDailyReport etlKuaiShouGroupDailyReport,
+                                                                    @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                    HttpServletRequest req) {
+        Result<IPage<EtlKuaiShouGroupDailyReport>> result = new Result<>();
+        QueryWrapper<EtlKuaiShouGroupDailyReport> queryWrapper = QueryGenerator.initQueryWrapper(etlKuaiShouGroupDailyReport, req.getParameterMap());
+        Page<EtlKuaiShouGroupDailyReport> page = new Page<EtlKuaiShouGroupDailyReport>(pageNo, pageSize);
+        IPage<EtlKuaiShouGroupDailyReport> pageList = etlKuaiShouGroupDailyReportService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param etlKuaiShouGroupDailyReport
+     * @return
+     */
+    @AutoLog(value = "快手组日报数据清洗-添加")
+    @ApiOperation(value = "快手组日报数据清洗-添加", notes = "快手组日报数据清洗-添加")
+    @PostMapping(value = "/add")
+    public Result<EtlKuaiShouGroupDailyReport> add(@RequestBody EtlKuaiShouGroupDailyReport etlKuaiShouGroupDailyReport) {
+        Result<EtlKuaiShouGroupDailyReport> result = new Result<>();
+        try {
+            etlKuaiShouGroupDailyReportService.save(etlKuaiShouGroupDailyReport);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param etlKuaiShouGroupDailyReport
+     * @return
+     */
+    @AutoLog(value = "快手组日报数据清洗-编辑")
+    @ApiOperation(value = "快手组日报数据清洗-编辑", notes = "快手组日报数据清洗-编辑")
+    @PutMapping(value = "/edit")
+    public Result<EtlKuaiShouGroupDailyReport> edit(@RequestBody EtlKuaiShouGroupDailyReport etlKuaiShouGroupDailyReport) {
+        Result<EtlKuaiShouGroupDailyReport> result = new Result<EtlKuaiShouGroupDailyReport>();
+        EtlKuaiShouGroupDailyReport etlKuaiShouGroupDailyReportEntity = etlKuaiShouGroupDailyReportService.getById(etlKuaiShouGroupDailyReport.getId());
+        if (etlKuaiShouGroupDailyReportEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = etlKuaiShouGroupDailyReportService.updateById(etlKuaiShouGroupDailyReport);
+            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 {
+            etlKuaiShouGroupDailyReportService.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<EtlKuaiShouGroupDailyReport> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<EtlKuaiShouGroupDailyReport> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.etlKuaiShouGroupDailyReportService.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<EtlKuaiShouGroupDailyReport> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<EtlKuaiShouGroupDailyReport> result = new Result<>();
+        EtlKuaiShouGroupDailyReport etlKuaiShouGroupDailyReport = etlKuaiShouGroupDailyReportService.getById(id);
+        if (etlKuaiShouGroupDailyReport == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(etlKuaiShouGroupDailyReport);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<EtlKuaiShouGroupDailyReport> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                EtlKuaiShouGroupDailyReport etlKuaiShouGroupDailyReport = JSON.parseObject(deString, EtlKuaiShouGroupDailyReport.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(etlKuaiShouGroupDailyReport, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<EtlKuaiShouGroupDailyReport> pageList = etlKuaiShouGroupDailyReportService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "快手组日报数据清洗列表");
+        mv.addObject(NormalExcelConstants.CLASS, EtlKuaiShouGroupDailyReport.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<EtlKuaiShouGroupDailyReport> listEtlKuaiShouGroupDailyReports = ExcelImportUtil.importExcel(file.getInputStream(), EtlKuaiShouGroupDailyReport.class, params);
+                etlKuaiShouGroupDailyReportService.saveBatch(listEtlKuaiShouGroupDailyReports);
+                return Result.ok("文件导入成功!数据行数:" + listEtlKuaiShouGroupDailyReports.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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,249 @@
+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.EtlKuaiShouNewly;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaiShouNewlyService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 快手 新上计划数据汇总
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-03-08
+ */
+@Slf4j
+@Api(tags = "快手 新上计划数据汇总")
+@RestController
+@RequestMapping("/new/etlKuaiShouNewly")
+public class EtlKuaiShouNewlyController {
+    @Autowired
+    private IEtlKuaiShouNewlyService etlKuaiShouNewlyService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param etlKuaiShouNewly
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "快手 新上计划数据汇总-分页列表查询")
+    @ApiOperation(value = "快手 新上计划数据汇总-分页列表查询", notes = "快手 新上计划数据汇总-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<EtlKuaiShouNewly>> queryPageList(EtlKuaiShouNewly etlKuaiShouNewly,
+                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                         HttpServletRequest req) {
+        Result<IPage<EtlKuaiShouNewly>> result = new Result<>();
+        QueryWrapper<EtlKuaiShouNewly> queryWrapper = QueryGenerator.initQueryWrapper(etlKuaiShouNewly, req.getParameterMap());
+        Page<EtlKuaiShouNewly> page = new Page<EtlKuaiShouNewly>(pageNo, pageSize);
+        IPage<EtlKuaiShouNewly> pageList = etlKuaiShouNewlyService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param etlKuaiShouNewly
+     * @return
+     */
+    @AutoLog(value = "快手 新上计划数据汇总-添加")
+    @ApiOperation(value = "快手 新上计划数据汇总-添加", notes = "快手 新上计划数据汇总-添加")
+    @PostMapping(value = "/add")
+    public Result<EtlKuaiShouNewly> add(@RequestBody EtlKuaiShouNewly etlKuaiShouNewly) {
+        Result<EtlKuaiShouNewly> result = new Result<>();
+        try {
+            etlKuaiShouNewlyService.save(etlKuaiShouNewly);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param etlKuaiShouNewly
+     * @return
+     */
+    @AutoLog(value = "快手 新上计划数据汇总-编辑")
+    @ApiOperation(value = "快手 新上计划数据汇总-编辑", notes = "快手 新上计划数据汇总-编辑")
+    @PutMapping(value = "/edit")
+    public Result<EtlKuaiShouNewly> edit(@RequestBody EtlKuaiShouNewly etlKuaiShouNewly) {
+        Result<EtlKuaiShouNewly> result = new Result<EtlKuaiShouNewly>();
+        EtlKuaiShouNewly etlKuaiShouNewlyEntity = etlKuaiShouNewlyService.getById(etlKuaiShouNewly.getId());
+        if (etlKuaiShouNewlyEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = etlKuaiShouNewlyService.updateById(etlKuaiShouNewly);
+            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 {
+            etlKuaiShouNewlyService.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<EtlKuaiShouNewly> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<EtlKuaiShouNewly> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.etlKuaiShouNewlyService.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<EtlKuaiShouNewly> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<EtlKuaiShouNewly> result = new Result<>();
+        EtlKuaiShouNewly etlKuaiShouNewly = etlKuaiShouNewlyService.getById(id);
+        if (etlKuaiShouNewly == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(etlKuaiShouNewly);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<EtlKuaiShouNewly> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                EtlKuaiShouNewly etlKuaiShouNewly = JSON.parseObject(deString, EtlKuaiShouNewly.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(etlKuaiShouNewly, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<EtlKuaiShouNewly> pageList = etlKuaiShouNewlyService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "快手 新上计划数据汇总列表");
+        mv.addObject(NormalExcelConstants.CLASS, EtlKuaiShouNewly.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<EtlKuaiShouNewly> listEtlKuaiShouNewlys = ExcelImportUtil.importExcel(file.getInputStream(), EtlKuaiShouNewly.class, params);
+                etlKuaiShouNewlyService.saveBatch(listEtlKuaiShouNewlys);
+                return Result.ok("文件导入成功!数据行数:" + listEtlKuaiShouNewlys.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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,173 @@
+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-03-09
+ */
+@Data
+@TableName("ctop_etl_kuaishou_group_daily_report")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_etl_kuaishou_group_daily_report对象", description = "快手组日报数据清洗")
+public class EtlKuaiShouGroupDailyReport {
+
+    /**
+     * 主键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 campaignId;
+    /**
+     * 计划名称
+     */
+    @Excel(name = "计划名称", width = 15)
+    @ApiModelProperty(value = "计划名称")
+    private String campaignName;
+    /**
+     * 组id
+     */
+    @Excel(name = "组id", width = 15)
+    @ApiModelProperty(value = "组id")
+    private Long unitId;
+    /**
+     * 组名称
+     */
+    @Excel(name = "组名称", width = 15)
+    @ApiModelProperty(value = "组名称")
+    private String unitName;
+    /**
+     * 花费(元)
+     */
+    @Excel(name = "花费(元)", width = 15)
+    @ApiModelProperty(value = "花费(元)")
+    private java.math.BigDecimal charge;
+    /**
+     * 曝光数
+     */
+    @Excel(name = "曝光数", width = 15)
+    @ApiModelProperty(value = "曝光数")
+    private Long photoShow;
+    /**
+     * 素材曝光数
+     */
+    @Excel(name = "素材曝光数", width = 15)
+    @ApiModelProperty(value = "素材曝光数")
+    private Long aclick;
+    /**
+     * 行为数
+     */
+    @Excel(name = "行为数", width = 15)
+    @ApiModelProperty(value = "行为数")
+    private Long bclick;
+    /**
+     * 应用下载数据-安卓下载开始数
+     */
+    @Excel(name = "应用下载数据-安卓下载开始数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-安卓下载开始数")
+    private Long downloadStarted;
+    /**
+     * 应用下载数据-安卓下载完成数
+     */
+    @Excel(name = "应用下载数据-安卓下载完成数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-安卓下载完成数")
+    private Long downloadCompleted;
+    /**
+     * 应用下载数据-激活数
+     */
+    @Excel(name = "应用下载数据-激活数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-激活数")
+    private Long activation;
+    /**
+     * 应用下载数据-首日付费次数
+     */
+    @Excel(name = "应用下载数据-首日付费次数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-首日付费次数")
+    private Long eventPayFirstDay;
+    /**
+     * 应用下载数据-付费次数
+     */
+    @Excel(name = "应用下载数据-付费次数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付费次数")
+    private Long eventPay;
+    /**
+     * 应用下载数据-注册数
+     */
+    @Excel(name = "应用下载数据-注册数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-注册数")
+    private Long eventRegister;
+    /**
+     * 应用下载数据-完件数
+     */
+    @Excel(name = "应用下载数据-完件数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-完件数")
+    private Long eventJinJianApp;
+    /**
+     * 应用下载数据-付款成功数
+     */
+    @Excel(name = "应用下载数据-付款成功数", width = 15)
+    @ApiModelProperty(value = "应用下载数据-付款成功数")
+    private Long eventOrderPaid;
+    /**
+     * 应用下载数据-次留数(仅支持分日查询)
+     */
+    @Excel(name = "应用下载数据-次留数(仅支持分日查询)", width = 15)
+    @ApiModelProperty(value = "应用下载数据-次留数(仅支持分日查询)")
+    private Long eventNextDayStay;
+    /**
+     * 3s播放数
+     */
+    @Excel(name = "3s播放数", width = 15)
+    @ApiModelProperty(value = "3s播放数")
+    private Long play3sCount;
+    /**
+     * 时间
+     */
+    @Excel(name = "时间", width = 15)
+    @ApiModelProperty(value = "时间")
+    private String statDate;
+    /**
+     * 创建时间
+     */
+    @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;
+}

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

@@ -0,0 +1,108 @@
+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-03-08
+ */
+@Data
+@TableName("ctop_etl_kuaishou_newly")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_etl_kuaishou_newly对象", description = "快手 新上计划数据汇总")
+public class EtlKuaiShouNewly {
+
+    /**
+     * 主键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;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+    /**
+     * 账户授权名称
+     */
+    @Excel(name = "账户授权名称", width = 15)
+    @ApiModelProperty(value = "账户授权名称")
+    private String oauthName;
+    /**
+     * 绑定人id
+     */
+    @Excel(name = "绑定人id", width = 15)
+    @ApiModelProperty(value = "绑定人id")
+    private String userId;
+    /**
+     * 绑定人名称
+     */
+    @Excel(name = "绑定人名称", width = 15)
+    @ApiModelProperty(value = "绑定人名称")
+    private String userName;
+    /**
+     * 新上数量
+     */
+    @Excel(name = "新上数量", width = 15)
+    @ApiModelProperty(value = "新上数量")
+    private Integer newCount;
+    /**
+     * campaign:计划  unit:组 creative:创意
+     */
+    @Excel(name = "campaign:计划  unit:组 creative:创意", width = 15)
+    @ApiModelProperty(value = "campaign:计划  unit:组 creative:创意")
+    private String newType;
+    /**
+     * 时间
+     */
+    @Excel(name = "时间", width = 15)
+    @ApiModelProperty(value = "时间")
+    private String statDate;
+    /**
+     * 创建时间
+     */
+    @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;
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaiShouGroupDailyReport;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 快手组日报数据清洗
+ *
+ * @author: jeecg-boot
+ * @date: 2021-03-09
+ * @cersion: V1.0
+ */
+public interface EtlKuaiShouGroupDailyReportMapper extends BaseMapper<EtlKuaiShouGroupDailyReport> {
+
+    void replaceBatch(@Param("addList") List<EtlKuaiShouGroupDailyReport> addList);
+}

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

@@ -0,0 +1,20 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaiShouNewly;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+/**
+ * 快手 新上计划数据汇总
+ *
+ * @author: jeecg-boot
+ * @date: 2021-03-08
+ * @cersion: V1.0
+ */
+public interface EtlKuaiShouNewlyMapper extends BaseMapper<EtlKuaiShouNewly> {
+
+    void replaceBatch(@Param("addList") List<EtlKuaiShouNewly> addList);
+}

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

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Update;
 
+import java.util.List;
+
 public interface KuaishouReportDailyGroupMapper extends BaseMapper<KuaishouReportDailyGroup> {
     void loadGroupDailyReport(@Param("accountId") Long accountId, @Param("localPath") String localPath);
 
@@ -14,4 +16,6 @@ public interface KuaishouReportDailyGroupMapper extends BaseMapper<KuaishouRepor
     void formatChannelCode(@Param("date") String date);
 
     int insertSelective(KuaishouReportDailyGroup record);
+
+    void replaceBatch(@Param("addList") List<KuaishouReportDailyGroup> addList);
 }

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

@@ -0,0 +1,54 @@
+<?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.EtlKuaiShouGroupDailyReportMapper">
+
+    <insert id="replaceBatch">
+        replace into ctop_etl_kuaishou_group_daily_report(
+        account_id,
+        campaign_id,
+        campaign_name,
+        unit_id,
+        unit_name,
+        charge,
+        photo_show,
+        aclick,
+        bclick,
+        download_started,
+        download_completed,
+        activation,
+        event_pay_first_day,
+        event_pay,
+        event_register,
+        event_jin_jian_app,
+        event_order_paid,
+        event_next_day_stay,
+        play_3s_count,
+        stat_date
+        )
+        values
+        <foreach collection="addList" item="addList" separator=",">
+            (
+            #{addList.accountId},
+            #{addList.campaignId},
+            #{addList.campaignName},
+            #{addList.unitId},
+            #{addList.unitName},
+            #{addList.charge},
+            #{addList.photoShow},
+            #{addList.aclick},
+            #{addList.bclick},
+            #{addList.downloadStarted},
+            #{addList.downloadCompleted},
+            #{addList.activation},
+            #{addList.eventPayFirstDay},
+            #{addList.eventPay},
+            #{addList.eventRegister},
+            #{addList.eventJinJianApp},
+            #{addList.eventOrderPaid},
+            #{addList.eventNextDayStay},
+            #{addList.play3sCount},
+            #{addList.statDate}
+            )
+        </foreach>
+    </insert>
+</mapper>

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

@@ -0,0 +1,32 @@
+<?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.EtlKuaiShouNewlyMapper">
+
+    <insert id="replaceBatch">
+        replace into ctop_etl_kuaishou_newly(
+        project_id,
+        project_name,
+        account_id,
+        oauth_name,
+        user_id,
+        user_name,
+        new_count,
+        new_type,
+        stat_date
+        )
+        values
+        <foreach collection="addList" item="addList" separator=",">
+            (
+            #{addList.projectId},
+            #{addList.projectName},
+            #{addList.accountId},
+            #{addList.oauthName},
+            #{addList.userId},
+            #{addList.userName},
+            #{addList.newCount},
+            #{addList.newType},
+            #{addList.statDate}
+            )
+        </foreach>
+    </insert>
+</mapper>

+ 254 - 137
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyGroupMapper.xml

@@ -108,395 +108,512 @@
     </insert>
 
 
-
-
-
-
-
-
-
-
-
-    <insert id="insertSelective" parameterType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyGroup" >
+    <insert id="insertSelective" parameterType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyGroup">
         replace into ctop_kuaishou_report_daily_group
-        <trim prefix="(" suffix=")" suffixOverrides="," >
-            <if test="id != null" >
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">
                 id,
             </if>
-            <if test="accountId != null" >
+            <if test="accountId != null">
                 account_id,
             </if>
-            <if test="unitId != null" >
+            <if test="unitId != null">
                 unit_id,
             </if>
-            <if test="campaignId != null" >
+            <if test="campaignId != null">
                 campaign_id,
             </if>
-            <if test="status != null" >
+            <if test="status != null">
                 status,
             </if>
-            <if test="charge != null" >
+            <if test="charge != null">
                 charge,
             </if>
-            <if test="photoShow != null" >
+            <if test="photoShow != null">
                 photo_show,
             </if>
-            <if test="aclick != null" >
+            <if test="aclick != null">
                 aclick,
             </if>
-            <if test="bclick != null" >
+            <if test="bclick != null">
                 bclick,
             </if>
-            <if test="photoShare != null" >
+            <if test="photoShare != null">
                 photo_share,
             </if>
-            <if test="photoComment != null" >
+            <if test="photoComment != null">
                 photo_comment,
             </if>
-            <if test="photoLike != null" >
+            <if test="photoLike != null">
                 photo_like,
             </if>
-            <if test="follow != null" >
+            <if test="follow != null">
                 follow,
             </if>
-            <if test="cancelFollow != null" >
+            <if test="cancelFollow != null">
                 cancel_follow,
             </if>
-            <if test="report != null" >
+            <if test="report != null">
                 report,
             </if>
-            <if test="block != null" >
+            <if test="block != null">
                 block,
             </if>
-            <if test="negative != null" >
+            <if test="negative != null">
                 negative,
             </if>
-            <if test="downloadStarted != null" >
+            <if test="downloadStarted != null">
                 download_started,
             </if>
-            <if test="downloadCompleted != null" >
+            <if test="downloadCompleted != null">
                 download_completed,
             </if>
-            <if test="activation != null" >
+            <if test="activation != null">
                 activation,
             </if>
-            <if test="submit != null" >
+            <if test="submit != null">
                 submit,
             </if>
-            <if test="statDate != null" >
+            <if test="statDate != null">
                 stat_date,
             </if>
-            <if test="photoClick != null" >
+            <if test="photoClick != null">
                 photo_click,
             </if>
-            <if test="photoClickRatio != null" >
+            <if test="photoClickRatio != null">
                 photo_click_ratio,
             </if>
-            <if test="actionRatio != null" >
+            <if test="actionRatio != null">
                 action_ratio,
             </if>
-            <if test="impression1kCost != null" >
+            <if test="impression1kCost != null">
                 impression_1k_cost,
             </if>
-            <if test="photoClickCost != null" >
+            <if test="photoClickCost != null">
                 photo_click_cost,
             </if>
-            <if test="actionCost != null" >
+            <if test="actionCost != null">
                 action_cost,
             </if>
-            <if test="eventPayFirstDay != null" >
+            <if test="eventPayFirstDay != null">
                 event_pay_first_day,
             </if>
-            <if test="eventPayPurchaseAmountFirstDay != null" >
+            <if test="eventPayPurchaseAmountFirstDay != null">
                 event_pay_purchase_amount_first_day,
             </if>
-            <if test="eventPayFirstDayRoi != null" >
+            <if test="eventPayFirstDayRoi != null">
                 event_pay_first_day_roi,
             </if>
-            <if test="eventPay != null" >
+            <if test="eventPay != null">
                 event_pay,
             </if>
-            <if test="eventPayPurchaseAmount != null" >
+            <if test="eventPayPurchaseAmount != null">
                 event_pay_purchase_amount,
             </if>
-            <if test="eventPayRoi != null" >
+            <if test="eventPayRoi != null">
                 event_pay_roi,
             </if>
-            <if test="eventRegister != null" >
+            <if test="eventRegister != null">
                 event_register,
             </if>
-            <if test="eventRegisterCost != null" >
+            <if test="eventRegisterCost != null">
                 event_register_cost,
             </if>
-            <if test="eventRegisterRatio != null" >
+            <if test="eventRegisterRatio != null">
                 event_register_ratio,
             </if>
-            <if test="eventJinJianApp != null" >
+            <if test="eventJinJianApp != null">
                 event_jin_jian_app,
             </if>
-            <if test="eventJinJianAppCost != null" >
+            <if test="eventJinJianAppCost != null">
                 event_jin_jian_app_cost,
             </if>
-            <if test="eventCreditGrantApp != null" >
+            <if test="eventCreditGrantApp != null">
                 event_credit_grant_app,
             </if>
-            <if test="eventCreditGrantAppCost != null" >
+            <if test="eventCreditGrantAppCost != null">
                 event_credit_grant_app_cost,
             </if>
-            <if test="eventCreditGrantAppRatio != null" >
+            <if test="eventCreditGrantAppRatio != null">
                 event_credit_grant_app_ratio,
             </if>
-            <if test="eventOrderPaid != null" >
+            <if test="eventOrderPaid != null">
                 event_order_paid,
             </if>
-            <if test="eventOrderPaidPurchaseAmount != null" >
+            <if test="eventOrderPaidPurchaseAmount != null">
                 event_order_paid_purchase_amount,
             </if>
-            <if test="eventJinJianLandingPage != null" >
+            <if test="eventJinJianLandingPage != null">
                 event_jin_jian_landing_page,
             </if>
-            <if test="eventJinJianLandingPageCost != null" >
+            <if test="eventJinJianLandingPageCost != null">
                 event_jin_jian_landing_page_cost,
             </if>
-            <if test="eventCreditGrantLandingPage != null" >
+            <if test="eventCreditGrantLandingPage != null">
                 event_credit_grant_landing_page,
             </if>
-            <if test="eventCreditGrantLandingPageCost != null" >
+            <if test="eventCreditGrantLandingPageCost != null">
                 event_credit_grant_landing_page_cost,
             </if>
-            <if test="eventCreditGrantLandingRatio != null" >
+            <if test="eventCreditGrantLandingRatio != null">
                 event_credit_grant_landing_ratio,
             </if>
-            <if test="eventNextDayStayCost != null" >
+            <if test="eventNextDayStayCost != null">
                 event_next_day_stay_cost,
             </if>
-            <if test="eventNextDayStayRatio != null" >
+            <if test="eventNextDayStayRatio != null">
                 event_next_day_stay_ratio,
             </if>
-            <if test="formActionRatio != null" >
+            <if test="formActionRatio != null">
                 form_action_ratio,
             </if>
-            <if test="eventOrderPaidCost != null" >
+            <if test="eventOrderPaidCost != null">
                 event_order_paid_cost,
             </if>
-            <if test="eventNextDayStay != null" >
+            <if test="eventNextDayStay != null">
                 event_next_day_stay,
             </if>
-            <if test="formCost != null" >
+            <if test="formCost != null">
                 form_cost,
             </if>
-            <if test="formCount != null" >
+            <if test="formCount != null">
                 form_count,
             </if>
-            <if test="play3sRatio != null" >
+            <if test="play3sRatio != null">
                 play_3s_ratio,
             </if>
-            <if test="createTime != null" >
+            <if test="createTime != null">
                 create_time,
             </if>
-            <if test="updateTime != null" >
+            <if test="updateTime != null">
                 update_time,
             </if>
-            <if test="channelCode != null" >
+            <if test="channelCode != null">
                 channel_code,
             </if>
-            <if test="unitName != null" >
+            <if test="unitName != null">
                 unit_name,
             </if>
-            <if test="campaignName != null" >
+            <if test="campaignName != null">
                 campaign_name,
             </if>
         </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides="," >
-            <if test="id != null" >
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">
                 #{id,jdbcType=BIGINT},
             </if>
-            <if test="accountId != null" >
+            <if test="accountId != null">
                 #{accountId,jdbcType=BIGINT},
             </if>
-            <if test="unitId != null" >
+            <if test="unitId != null">
                 #{unitId,jdbcType=BIGINT},
             </if>
-            <if test="campaignId != null" >
+            <if test="campaignId != null">
                 #{campaignId,jdbcType=BIGINT},
             </if>
-            <if test="status != null" >
+            <if test="status != null">
                 #{status,jdbcType=INTEGER},
             </if>
-            <if test="charge != null" >
+            <if test="charge != null">
                 #{charge,jdbcType=DECIMAL},
             </if>
-            <if test="photoShow != null" >
+            <if test="photoShow != null">
                 #{photoShow,jdbcType=BIGINT},
             </if>
-            <if test="aclick != null" >
+            <if test="aclick != null">
                 #{aclick,jdbcType=BIGINT},
             </if>
-            <if test="bclick != null" >
+            <if test="bclick != null">
                 #{bclick,jdbcType=BIGINT},
             </if>
-            <if test="photoShare != null" >
+            <if test="photoShare != null">
                 #{photoShare,jdbcType=BIGINT},
             </if>
-            <if test="photoComment != null" >
+            <if test="photoComment != null">
                 #{photoComment,jdbcType=BIGINT},
             </if>
-            <if test="photoLike != null" >
+            <if test="photoLike != null">
                 #{photoLike,jdbcType=BIGINT},
             </if>
-            <if test="follow != null" >
+            <if test="follow != null">
                 #{follow,jdbcType=BIGINT},
             </if>
-            <if test="cancelFollow != null" >
+            <if test="cancelFollow != null">
                 #{cancelFollow,jdbcType=BIGINT},
             </if>
-            <if test="report != null" >
+            <if test="report != null">
                 #{report,jdbcType=BIGINT},
             </if>
-            <if test="block != null" >
+            <if test="block != null">
                 #{block,jdbcType=BIGINT},
             </if>
-            <if test="negative != null" >
+            <if test="negative != null">
                 #{negative,jdbcType=BIGINT},
             </if>
-            <if test="downloadStarted != null" >
+            <if test="downloadStarted != null">
                 #{downloadStarted,jdbcType=BIGINT},
             </if>
-            <if test="downloadCompleted != null" >
+            <if test="downloadCompleted != null">
                 #{downloadCompleted,jdbcType=BIGINT},
             </if>
-            <if test="activation != null" >
+            <if test="activation != null">
                 #{activation,jdbcType=BIGINT},
             </if>
-            <if test="submit != null" >
+            <if test="submit != null">
                 #{submit,jdbcType=BIGINT},
             </if>
-            <if test="statDate != null" >
+            <if test="statDate != null">
                 #{statDate,jdbcType=VARCHAR},
             </if>
-            <if test="photoClick != null" >
+            <if test="photoClick != null">
                 #{photoClick,jdbcType=BIGINT},
             </if>
-            <if test="photoClickRatio != null" >
+            <if test="photoClickRatio != null">
                 #{photoClickRatio,jdbcType=DOUBLE},
             </if>
-            <if test="actionRatio != null" >
+            <if test="actionRatio != null">
                 #{actionRatio,jdbcType=DOUBLE},
             </if>
-            <if test="impression1kCost != null" >
+            <if test="impression1kCost != null">
                 #{impression1kCost,jdbcType=DECIMAL},
             </if>
-            <if test="photoClickCost != null" >
+            <if test="photoClickCost != null">
                 #{photoClickCost,jdbcType=DECIMAL},
             </if>
-            <if test="actionCost != null" >
+            <if test="actionCost != null">
                 #{actionCost,jdbcType=DECIMAL},
             </if>
-            <if test="eventPayFirstDay != null" >
+            <if test="eventPayFirstDay != null">
                 #{eventPayFirstDay,jdbcType=BIGINT},
             </if>
-            <if test="eventPayPurchaseAmountFirstDay != null" >
+            <if test="eventPayPurchaseAmountFirstDay != null">
                 #{eventPayPurchaseAmountFirstDay,jdbcType=DECIMAL},
             </if>
-            <if test="eventPayFirstDayRoi != null" >
+            <if test="eventPayFirstDayRoi != null">
                 #{eventPayFirstDayRoi,jdbcType=DOUBLE},
             </if>
-            <if test="eventPay != null" >
+            <if test="eventPay != null">
                 #{eventPay,jdbcType=BIGINT},
             </if>
-            <if test="eventPayPurchaseAmount != null" >
+            <if test="eventPayPurchaseAmount != null">
                 #{eventPayPurchaseAmount,jdbcType=DECIMAL},
             </if>
-            <if test="eventPayRoi != null" >
+            <if test="eventPayRoi != null">
                 #{eventPayRoi,jdbcType=DOUBLE},
             </if>
-            <if test="eventRegister != null" >
+            <if test="eventRegister != null">
                 #{eventRegister,jdbcType=BIGINT},
             </if>
-            <if test="eventRegisterCost != null" >
+            <if test="eventRegisterCost != null">
                 #{eventRegisterCost,jdbcType=DECIMAL},
             </if>
-            <if test="eventRegisterRatio != null" >
+            <if test="eventRegisterRatio != null">
                 #{eventRegisterRatio,jdbcType=DOUBLE},
             </if>
-            <if test="eventJinJianApp != null" >
+            <if test="eventJinJianApp != null">
                 #{eventJinJianApp,jdbcType=BIGINT},
             </if>
-            <if test="eventJinJianAppCost != null" >
+            <if test="eventJinJianAppCost != null">
                 #{eventJinJianAppCost,jdbcType=DECIMAL},
             </if>
-            <if test="eventCreditGrantApp != null" >
+            <if test="eventCreditGrantApp != null">
                 #{eventCreditGrantApp,jdbcType=BIGINT},
             </if>
-            <if test="eventCreditGrantAppCost != null" >
+            <if test="eventCreditGrantAppCost != null">
                 #{eventCreditGrantAppCost,jdbcType=DECIMAL},
             </if>
-            <if test="eventCreditGrantAppRatio != null" >
+            <if test="eventCreditGrantAppRatio != null">
                 #{eventCreditGrantAppRatio,jdbcType=DOUBLE},
             </if>
-            <if test="eventOrderPaid != null" >
+            <if test="eventOrderPaid != null">
                 #{eventOrderPaid,jdbcType=BIGINT},
             </if>
-            <if test="eventOrderPaidPurchaseAmount != null" >
+            <if test="eventOrderPaidPurchaseAmount != null">
                 #{eventOrderPaidPurchaseAmount,jdbcType=DECIMAL},
             </if>
-            <if test="eventJinJianLandingPage != null" >
+            <if test="eventJinJianLandingPage != null">
                 #{eventJinJianLandingPage,jdbcType=BIGINT},
             </if>
-            <if test="eventJinJianLandingPageCost != null" >
+            <if test="eventJinJianLandingPageCost != null">
                 #{eventJinJianLandingPageCost,jdbcType=DECIMAL},
             </if>
-            <if test="eventCreditGrantLandingPage != null" >
+            <if test="eventCreditGrantLandingPage != null">
                 #{eventCreditGrantLandingPage,jdbcType=BIGINT},
             </if>
-            <if test="eventCreditGrantLandingPageCost != null" >
+            <if test="eventCreditGrantLandingPageCost != null">
                 #{eventCreditGrantLandingPageCost,jdbcType=DECIMAL},
             </if>
-            <if test="eventCreditGrantLandingRatio != null" >
+            <if test="eventCreditGrantLandingRatio != null">
                 #{eventCreditGrantLandingRatio,jdbcType=DOUBLE},
             </if>
-            <if test="eventNextDayStayCost != null" >
+            <if test="eventNextDayStayCost != null">
                 #{eventNextDayStayCost,jdbcType=DECIMAL},
             </if>
-            <if test="eventNextDayStayRatio != null" >
+            <if test="eventNextDayStayRatio != null">
                 #{eventNextDayStayRatio,jdbcType=BIGINT},
             </if>
-            <if test="formActionRatio != null" >
+            <if test="formActionRatio != null">
                 #{formActionRatio,jdbcType=DOUBLE},
             </if>
-            <if test="eventOrderPaidCost != null" >
+            <if test="eventOrderPaidCost != null">
                 #{eventOrderPaidCost,jdbcType=DECIMAL},
             </if>
-            <if test="eventNextDayStay != null" >
+            <if test="eventNextDayStay != null">
                 #{eventNextDayStay,jdbcType=BIGINT},
             </if>
-            <if test="formCost != null" >
+            <if test="formCost != null">
                 #{formCost,jdbcType=DECIMAL},
             </if>
-            <if test="formCount != null" >
+            <if test="formCount != null">
                 #{formCount,jdbcType=BIGINT},
             </if>
-            <if test="play3sRatio != null" >
+            <if test="play3sRatio != null">
                 #{play3sRatio,jdbcType=DOUBLE},
             </if>
-            <if test="createTime != null" >
+            <if test="createTime != null">
                 #{createTime,jdbcType=TIMESTAMP},
             </if>
-            <if test="updateTime != null" >
+            <if test="updateTime != null">
                 #{updateTime,jdbcType=TIMESTAMP},
             </if>
-            <if test="channelCode != null" >
+            <if test="channelCode != null">
                 #{channelCode,jdbcType=VARCHAR},
             </if>
-            <if test="unitName != null" >
+            <if test="unitName != null">
                 #{unitName,jdbcType=LONGVARCHAR},
             </if>
-            <if test="campaignName != null" >
+            <if test="campaignName != null">
                 #{campaignName,jdbcType=LONGVARCHAR},
             </if>
         </trim>
     </insert>
-
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_report_daily_group
+        (
+        account_id,
+        unit_id,
+        campaign_id,
+        status,
+        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,
+        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,
+        channel_code,
+        unit_name,
+        campaign_name)
+        values
+        <foreach collection="addList" item="addList" separator=",">
+            (
+            #{addList.accountId,jdbcType=BIGINT},
+            #{addList.unitId,jdbcType=BIGINT},
+            #{addList.campaignId,jdbcType=BIGINT},
+            #{addList.status,jdbcType=INTEGER},
+            #{addList.charge,jdbcType=DECIMAL},
+            #{addList.photoShow,jdbcType=BIGINT},
+            #{addList.aclick,jdbcType=BIGINT},
+            #{addList.bclick,jdbcType=BIGINT},
+            #{addList.photoShare,jdbcType=BIGINT},
+            #{addList.photoComment,jdbcType=BIGINT},
+            #{addList.photoLike,jdbcType=BIGINT},
+            #{addList.follow,jdbcType=BIGINT},
+            #{addList.cancelFollow,jdbcType=BIGINT},
+            #{addList.report,jdbcType=BIGINT},
+            #{addList.block,jdbcType=BIGINT},
+            #{addList.negative,jdbcType=BIGINT},
+            #{addList.downloadStarted,jdbcType=BIGINT},
+            #{addList.downloadCompleted,jdbcType=BIGINT},
+            #{addList.activation,jdbcType=BIGINT},
+            #{addList.submit,jdbcType=BIGINT},
+            #{addList.statDate,jdbcType=VARCHAR},
+            #{addList.photoClick,jdbcType=BIGINT},
+            #{addList.photoClickRatio,jdbcType=DOUBLE},
+            #{addList.actionRatio,jdbcType=DOUBLE},
+            #{addList.impression1kCost,jdbcType=DECIMAL},
+            #{addList.photoClickCost,jdbcType=DECIMAL},
+            #{addList.actionCost,jdbcType=DECIMAL},
+            #{addList.eventPayFirstDay,jdbcType=BIGINT},
+            #{addList.eventPayPurchaseAmountFirstDay,jdbcType=DECIMAL},
+            #{addList.eventPayFirstDayRoi,jdbcType=DOUBLE},
+            #{addList.eventPay,jdbcType=BIGINT},
+            #{addList.eventPayPurchaseAmount,jdbcType=DECIMAL},
+            #{addList.eventPayRoi,jdbcType=DOUBLE},
+            #{addList.eventRegister,jdbcType=BIGINT},
+            #{addList.eventRegisterCost,jdbcType=DECIMAL},
+            #{addList.eventRegisterRatio,jdbcType=DOUBLE},
+            #{addList.eventJinJianApp,jdbcType=BIGINT},
+            #{addList.eventJinJianAppCost,jdbcType=DECIMAL},
+            #{addList.eventCreditGrantApp,jdbcType=BIGINT},
+            #{addList.eventCreditGrantAppCost,jdbcType=DECIMAL},
+            #{addList.eventCreditGrantAppRatio,jdbcType=DOUBLE},
+            #{addList.eventOrderPaid,jdbcType=BIGINT},
+            #{addList.eventOrderPaidPurchaseAmount,jdbcType=DECIMAL},
+            #{addList.eventJinJianLandingPage,jdbcType=BIGINT},
+            #{addList.eventJinJianLandingPageCost,jdbcType=DECIMAL},
+            #{addList.eventCreditGrantLandingPage,jdbcType=BIGINT},
+            #{addList.eventCreditGrantLandingPageCost,jdbcType=DECIMAL},
+            #{addList.eventCreditGrantLandingRatio,jdbcType=DOUBLE},
+            #{addList.eventNextDayStayCost,jdbcType=DECIMAL},
+            #{addList.eventNextDayStayRatio,jdbcType=BIGINT},
+            #{addList.formActionRatio,jdbcType=DOUBLE},
+            #{addList.eventOrderPaidCost,jdbcType=DECIMAL},
+            #{addList.eventNextDayStay,jdbcType=BIGINT},
+            #{addList.formCost,jdbcType=DECIMAL},
+            #{addList.formCount,jdbcType=BIGINT},
+            #{addList.play3sRatio,jdbcType=DOUBLE},
+            #{addList.channelCode,jdbcType=VARCHAR},
+            #{addList.unitName,jdbcType=LONGVARCHAR},
+            #{addList.campaignName,jdbcType=LONGVARCHAR}
+            )
+        </foreach>
+    </insert>
 
 
 </mapper>

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

@@ -0,0 +1,18 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaiShouGroupDailyReport;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 快手组日报数据清洗
+ * @Author: jeecg-boot
+ * @Date: 2021-03-09
+ * @Version: V1.0
+ */
+public interface IEtlKuaiShouGroupDailyReportService extends IService<EtlKuaiShouGroupDailyReport> {
+
+    void cleanGroupData(Long accountId, JSONArray details);
+
+    void getGroupReport(Long accountId, String accessToken, String startDate, String endDate, Integer page);
+}

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaiShouNewly;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 快手 新上计划数据汇总
+ * @Author: jeecg-boot
+ * @Date: 2021-03-08
+ * @Version: V1.0
+ */
+public interface IEtlKuaiShouNewlyService extends IService<EtlKuaiShouNewly> {
+    void cleanNewlyData(String statDate);
+
+}

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

@@ -1,8 +1,21 @@
 package cn.com.ctop.kuaishou.modules.report.service;
 
+import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyGroup;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.Date;
+
 public interface IKuaishouReportDailyGroupService extends IService<KuaishouReportDailyGroup> {
     void formatChannelCode(String date);
+
+    /**
+     * 获取广告计划分天报表 暂停使用
+     *
+     * @param token
+     * @param startDate
+     * @param endDate
+     */
+    void getAdvertiserGroupReportDaily(CtopOauthToken token, Date startDate, Date endDate);
+
 }

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

@@ -0,0 +1,116 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+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.EtlKuaiShouGroupDailyReport;
+import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaiShouGroupDailyReportMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaiShouGroupDailyReportService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 快手组日报数据清洗
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-03-09
+ */
+@Service
+@Slf4j
+public class EtlKuaiShouGroupDailyReportServiceImpl extends ServiceImpl<EtlKuaiShouGroupDailyReportMapper, EtlKuaiShouGroupDailyReport> implements IEtlKuaiShouGroupDailyReportService {
+    @Autowired
+    private EtlKuaiShouGroupDailyReportMapper groupDailyReportMapper;
+
+
+    @Override
+    public void getGroupReport(Long accountId, String accessToken, String startDate, String endDate, Integer page) {
+        // log.info("获取广告组日报,accountId:{},开始时间:{},结束时间:{}", token.getAccountId(), DateUtils.formatDate(startDate), DateUtils.formatDate(endDate));
+        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<>();
+        if (!Check.isNull(startDate)) {
+            param.put("start_date", startDate);
+        }
+        if (!Check.isNull(endDate)) {
+            param.put("end_date", endDate);
+        }
+        param.put("advertiser_id", accountId);
+        param.put("temporal_granularity", "DAILY");
+        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;
+        }
+        cleanGroupData(accountId, details);
+        getGroupReport(accountId, accessToken, startDate, endDate, page + 1);
+    }
+
+    /**
+     * 数据清洗
+     *
+     * @param details
+     */
+    @Override
+    public void cleanGroupData(Long accountId, JSONArray details) {
+        if (Check.isNull(details)) {
+            return;
+        }
+        List<EtlKuaiShouGroupDailyReport> addList = new ArrayList<>();
+        for (int i = 0; i < details.size(); i++) {
+            JSONObject groupJson = details.getJSONObject(i);
+            EtlKuaiShouGroupDailyReport groupDailyReport = new EtlKuaiShouGroupDailyReport();
+            groupDailyReport.setAccountId(accountId);
+            groupDailyReport.setCampaignId(groupJson.getLong("campaign_id"));
+            groupDailyReport.setCampaignName(groupJson.getString("campaign_name"));
+            groupDailyReport.setUnitId(groupJson.getLong("unit_id"));
+            groupDailyReport.setUnitName(groupJson.getString("unit_name"));
+            groupDailyReport.setCharge(groupJson.getBigDecimal("charge"));
+            groupDailyReport.setPhotoShow(groupJson.getLong("show"));
+            groupDailyReport.setAclick(groupJson.getLong("aclick"));
+            groupDailyReport.setBclick(groupJson.getLong("bclick"));
+            groupDailyReport.setDownloadStarted(groupJson.getLong("download_started"));
+            groupDailyReport.setDownloadCompleted(groupJson.getLong("download_completed"));
+            groupDailyReport.setActivation(groupJson.getLong("activation"));
+            groupDailyReport.setEventPayFirstDay(groupJson.getLong("event_pay_first_day"));
+            groupDailyReport.setEventPay(groupJson.getLong("event_pay"));
+            groupDailyReport.setEventRegister(groupJson.getLong("event_register"));
+            groupDailyReport.setEventJinJianApp(groupJson.getLong("event_jin_jian_app"));
+            groupDailyReport.setEventOrderPaid(groupJson.getLong("event_order_paid"));
+            groupDailyReport.setEventNextDayStay(groupJson.getLong("event_next_day_stay"));
+            groupDailyReport.setStatDate(groupJson.getString("stat_date"));
+            Double play_3s_ratio = groupJson.getDouble("play_3s_ratio");
+            Long aclick = groupJson.getLong("aclick");
+            Double v = aclick * play_3s_ratio;
+            groupDailyReport.setPlay3sCount(v.longValue());
+            addList.add(groupDailyReport);
+        }
+        if (!Check.isNull(addList)) {
+            groupDailyReportMapper.replaceBatch(addList);
+        }
+    }
+
+
+}

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

@@ -0,0 +1,114 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.service.ISysUserService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
+import cn.com.ctop.kuaishou.modules.report.entity.EtlKuaiShouNewly;
+import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaiShouNewlyMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaiShouNewlyService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 快手 新上计划数据汇总
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-03-08
+ */
+@Service
+public class EtlKuaiShouNewlyServiceImpl extends ServiceImpl<EtlKuaiShouNewlyMapper, EtlKuaiShouNewly> implements IEtlKuaiShouNewlyService {
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @Autowired
+    private ISysUserService sysUserService;
+    @Autowired
+    private IProjectService projectService;
+    @Autowired
+    private IKuaiShouCampaignService campaignService;
+    @Autowired
+    private IKuaiShouGroupService groupService;
+    @Autowired
+    private IKuaiShouCreativeService creativeService;
+    @Autowired
+    private EtlKuaiShouNewlyMapper kuaiShouNewlyMapper;
+
+    private static List<String> typeList = new ArrayList();
+
+    /**
+     * 清洗上新数量
+     */
+    @Override
+    public void cleanNewlyData(String statDate) {
+        List<UserAllocation> userAllocations = userAllocationService.listByMediaId("2", 0);
+        if (Check.isNull(userAllocations)) {
+            return;
+        }
+        Map<Long, Long> projectIdMap = new HashMap<>();
+        Map<String, String> userIdMap = new HashMap<>();
+        for (UserAllocation allocation : userAllocations) {
+            if (!Check.isNull(allocation.getProjectId())) {
+                projectIdMap.put(allocation.getProjectId(), allocation.getProjectId());
+            }
+            if (!Check.isNull(allocation.getUserId())) {
+                userIdMap.put(allocation.getUserId(), allocation.getUserId());
+            }
+        }
+        Map<String, String> userMap = sysUserService.getUserMapByMap(userIdMap);
+        Map<Long, String> projectMap = projectService.getProjectMap(projectIdMap);
+        List<EtlKuaiShouNewly> addList = new ArrayList<>();
+        if (Check.isNull(typeList)) {
+            getTypeList();
+        }
+        for (int i = 0; i < typeList.size(); i++) {
+            String newType = typeList.get(i);
+            for (UserAllocation allocation : userAllocations) {
+                EtlKuaiShouNewly addNewly = new EtlKuaiShouNewly();
+                addNewly.setAccountId(allocation.getAccountId());
+                addNewly.setOauthName(allocation.getAuthName());
+                addNewly.setProjectId(allocation.getProjectId());
+                if (!Check.isNullMap(projectMap)) {
+                    addNewly.setProjectName(projectMap.get(allocation.getProjectId()));
+                }
+                addNewly.setUserId(allocation.getUserId());
+                if (!Check.isNullMap(userMap)) {
+                    addNewly.setUserName(userMap.get(allocation.getUserId()));
+                }
+                Integer count = 0;
+                if (newType.equals("campaign")) {
+                    count = campaignService.getNewDataByAccountIdAndDate(allocation.getAccountId(), statDate);
+                } else if (newType.equals("unit")) {
+                    count = groupService.getNewDataByAccountIdAndDate(allocation.getAccountId(), statDate);
+                } else if (newType.equals("creative")) {
+                    count = creativeService.getNewDataByAccountIdAndDate(allocation.getAccountId(), statDate);
+                }
+                addNewly.setNewCount(count);
+                addNewly.setNewType(newType);
+                addNewly.setStatDate(statDate);
+                addList.add(addNewly);
+            }
+            if (!Check.isNull(addList)) {
+                kuaiShouNewlyMapper.replaceBatch(addList);
+                addList = new ArrayList<>();
+            }
+        }
+    }
+
+    private void getTypeList() {
+        typeList.add("campaign");
+        typeList.add("unit");
+        typeList.add("creative");
+    }
+}

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

@@ -1,19 +1,87 @@
 package cn.com.ctop.kuaishou.modules.report.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;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyGroup;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyGroupMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaiShouGroupDailyReportService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyGroupService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.*;
+
 @Service
+@Slf4j
 public class KuaishouReportDailyGroupServiceImpl extends ServiceImpl<KuaishouReportDailyGroupMapper, KuaishouReportDailyGroup> implements IKuaishouReportDailyGroupService {
     @Autowired
     private KuaishouReportDailyGroupMapper groupMapper;
+    @Autowired
+    private IEtlKuaiShouGroupDailyReportService etlKuaiShouGroupDailyReportService;
 
     @Override
     public void formatChannelCode(String date) {
         groupMapper.formatChannelCode(date);
     }
+
+    @Override
+    public void getAdvertiserGroupReportDaily(CtopOauthToken token, Date startDate, Date endDate) {
+        getAdvertiserGroupReportDailyByPage(token, startDate, endDate, 1);
+    }
+
+    private void getAdvertiserGroupReportDailyByPage(CtopOauthToken token, Date startDate, Date endDate, int page) {
+        log.info("获取广告组日报,accountId:{},开始时间:{},结束时间:{}", token.getAccountId(), DateUtils.formatDate(startDate), DateUtils.formatDate(endDate));
+        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<>();
+        if (!Check.isNull(startDate)) {
+            param.put("start_date", DateUtils.formatDate(startDate));
+        }
+        if (!Check.isNull(endDate)) {
+            param.put("end_date", DateUtils.formatDate(endDate));
+        }
+        param.put("advertiser_id", token.getAccountId());
+        param.put("temporal_granularity", "DAILY");
+        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<KuaishouReportDailyGroup> addList = new ArrayList<>();
+        for (int i = 0; i < details.size(); i++) {
+            JSONObject detailJson = details.getJSONObject(i);
+            detailJson.put("photo_share", detailJson.getString("share"));
+            detailJson.put("photo_comment", detailJson.getString("comment"));
+            detailJson.put("photo_like", detailJson.getString("like"));
+            detailJson.put("photo_show", detailJson.getString("show"));
+            KuaishouReportDailyGroup dailyGroup = JSONObject.toJavaObject(detailJson, KuaishouReportDailyGroup.class);
+            dailyGroup.setAccountId(token.getAccountId());
+            addList.add(dailyGroup);
+        }
+        if (!Check.isNull(addList)) {
+            groupMapper.replaceBatch(addList);
+            etlKuaiShouGroupDailyReportService.cleanGroupData(token.getAccountId(), details);
+        }
+        getAdvertiserGroupReportDailyByPage(token, startDate, endDate, page + 1);
+    }
 }