فهرست منبع

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

# Conflicts:
#	module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/entity/AppiumTaskItem.java
#	module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/service/impl/AppiumTaskServiceImpl.java
xuzuoyun 5 سال پیش
والد
کامیت
3eda878f84
39فایلهای تغییر یافته به همراه2897 افزوده شده و 411 حذف شده
  1. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  2. 12 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceAdvertiserPostController.java
  3. 13 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouDailyReportLoadJob.java
  4. 11 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouHourlyReportLoadJob.java
  5. 76 132
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  6. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IFileInfoService.java
  7. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java
  8. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java
  9. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java
  10. 7 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
  11. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java
  12. 208 210
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/controller/AppiumTaskController.java
  13. 4 7
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/entity/AppiumDevice.java
  14. 5 8
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/entity/AppiumTask.java
  15. 2 6
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/entity/AppiumTaskLog.java
  16. 248 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouReportDailyCreativeStatisticController.java
  17. 248 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouReportHourlyCreativeStatisticController.java
  18. 2 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouCampaign.java
  19. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouCreative.java
  20. 2 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroup.java
  21. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouVideoGet.java
  22. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouVideoGetService.java
  23. 8 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java
  24. 221 24
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  25. 452 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyCreativeStatistic.java
  26. 459 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportHourlyCreativeStatistic.java
  27. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyCreativeStatisticMapper.java
  28. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportHourlyCreativeStatisticMapper.java
  29. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyCreativeStatisticMapper.xml
  30. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportHourlyCreativeStatisticMapper.xml
  31. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyCreativeStatisticService.java
  32. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportHourlyCreativeStatisticService.java
  33. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyCreativeStatisticServiceImpl.java
  34. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportHourlyCreativeStatisticServiceImpl.java
  35. 12 11
      module-report/src/main/java/cn/com/ctop/bytedance/controller/MaterialReportController.java
  36. 14 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/MaterialReportMapper.java
  37. 349 0
      module-report/src/main/java/cn/com/ctop/bytedance/mapper/xml/MaterialReportMapper.xml
  38. 19 0
      module-report/src/main/java/cn/com/ctop/bytedance/service/IMaterialReportService.java
  39. 408 0
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/MaterialReportServiceImpl.java

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

@@ -119,7 +119,7 @@ public class ShiroConfig {
 		filterChainDefinitionMap.put("/template/convert/list/url", "anon");
         //文件上传接口
 		filterChainDefinitionMap.put("/upload/**", "anon");
-		filterChainDefinitionMap.put("/appium/appiumTask/run", "anon");
+        filterChainDefinitionMap.put("/appium/appiumTask/run", "anon");
 
 		//爬虫接口
 		filterChainDefinitionMap.put("/graphql/video", "anon");

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

@@ -281,6 +281,18 @@ public class ByteDanceAdvertiserPostController {
         return result;
     }
 
+    @GetMapping("loadData")
+    public Map<String, Object> loadData() {
+        Map<String, Object> result = new HashMap<>();
+        try {
+            kuaishouInterfaceService.loadData();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS.getCode());
+        return result;
+    }
+
     @Autowired
     private ICtopOauthTokenService tokenService;
     @Autowired

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

@@ -23,7 +23,6 @@ public class KuaishouDailyReportLoadJob implements Job {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
-
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         Date getDate = DateUtils.addDay(new Date(), -1);
@@ -35,6 +34,19 @@ public class KuaishouDailyReportLoadJob implements Job {
         }
 
         tokens.forEach(token -> {
+            //1:获取全量广告计划数据
+            kuaishouInterfaceService.getCampaignList(token);
+            //1:获取全量广告组数据
+            kuaishouInterfaceService.getGroupList(token);
+            //1:获取全量创意数据
+            kuaishouInterfaceService.getCreativeList(token);
+            //2:获取全量视频素材数据
+            kuaishouInterfaceService.getVideoList(token);
+        });
+
+        log.info("快手物料数据同步完成");
+
+        tokens.forEach(token -> {
             //1: 获取广告主信息数据
             kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate);
             //2:获取广告计划信息数据

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

@@ -39,6 +39,17 @@ public class KuaishouHourlyReportLoadJob implements Job {
             log.info("定时获取头条数据异常:为获取到可用的token");
             return;
         }
+        tokens.forEach(token -> {
+            //1:获取全量广告计划数据
+            kuaishouInterfaceService.getCampaignList(token);
+            //1:获取全量广告组数据
+            kuaishouInterfaceService.getGroupList(token);
+            //1:获取全量创意数据
+            kuaishouInterfaceService.getCreativeList(token);
+            //2:获取全量视频素材数据
+            kuaishouInterfaceService.getVideoList(token);
+        });
+        log.info("物料数据同步完成");
 
         for (CtopOauthToken token : tokens) {
             kuaishouInterfaceService.getAdvertiserReportHourly(token, getDate, getDate);

+ 76 - 132
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -5,56 +5,34 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.IFileInfoService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.common.module.utils.OSSUtils;
-import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import cn.com.ctop.toutiao.service.IByteDanceAdvertiserDataService;
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.ctop.service.ICreateInternalService;
-import org.jeecg.modules.demo.mock.MockController;
-import org.jeecg.modules.demo.test.mapper.JeecgDemoMapper;
-import org.jeecg.modules.demo.test.service.IJeecgDemoService;
-import org.jeecg.modules.system.service.ISysDataLogService;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
-import javax.annotation.Resource;
-import java.io.File;
-import java.util.ArrayList;
+import java.io.IOException;
 import java.util.Date;
 import java.util.List;
-import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest
 @Slf4j
 public class SampleTest {
 
-    @Resource
-    private JeecgDemoMapper jeecgDemoMapper;
-    @Resource
-    private IJeecgDemoService jeecgDemoService;
-    @Resource
-    private ISysDataLogService sysDataLogService;
-    @Resource
-    private MockController mock;
-
     @Autowired
     private ICreateInternalService createInternalService;
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
 
-    @Test
-    public void testLogin() {
-        Map<String, Object> map = createInternalService.checkAccountPassword("dcd_ad@bytedance.com", "typdDCD@2018");
-    }
-
     @Autowired
     private IReportService reportService;
 
@@ -69,16 +47,6 @@ public class SampleTest {
             return;
         }
         tokens.forEach(token -> {
-            //1: 获取广告主信息数据
-//            kuaishouInterfaceService.getAdvertiserReportDaily(token,getDate);
-            //2:获取广告计划信息数据
-//            kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token,getDate);
-            //3:获取广告组信息数据
-//            kuaishouInterfaceService.getAdvertiserGroupReportDaily(token,getDate);
-            //4: 获取广告创意信息数据
-//            kuaishouInterfaceService.getAdvertiserCreativeReportDaily(token,getDate);
-//            //1: 获取广告主信息数据
-//            kuaishouInterfaceService.getAdvertiserReportHourly(token, getDate);
 //            //2:获取广告计划信息数据
             kuaishouInterfaceService.getAdvertiserCampaignReportHourly(token, getDate, getDate);
 //            //3:获取广告组信息数据
@@ -88,79 +56,14 @@ public class SampleTest {
         });
     }
 
+    @Autowired
+    IFileInfoService fileInfoService;
     @Test
-    public void testLoadDate180() {
-        Date endDate = new Date();
-        Date hourlyStartDate = DateUtils.addDay(endDate, -7);
-        Date startDate = DateUtils.addDay(endDate, -170);
-//        List<CtopOauthToken> bytedanceTokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-//        if (null != bytedanceTokens && bytedanceTokens.size() > 0) {
-//            bytedanceTokens.forEach(token -> {
-//                //1: 获取广告主信息数据
-//                reportService.getAdvertiserReport(token, startDate, endDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-//                //2:获取广告组信息数据
-//                reportService.getAdvertiserCampaignReport(token, startDate, endDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-//                //3:获取广告计划信息数据
-//                reportService.getAdvertiserPlanReport(token, startDate, endDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-//                //4: 获取广告创意信息数据
-//                reportService.getAdvertiserCreativeReport(token, startDate, endDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-//
-//                //1: 获取广告主信息数据
-//                reportService.getAdvertiserReport(token, hourlyStartDate, endDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-//                //2:获取广告组信息数据
-//                reportService.getAdvertiserCampaignReport(token, hourlyStartDate, endDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-//                //3:获取广告计划信息数据
-//                reportService.getAdvertiserPlanReport(token, hourlyStartDate, endDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-//                //4: 获取广告创意信息数据
-//                reportService.getAdvertiserCreativeReport(token, hourlyStartDate, endDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-//            });
-//        }
-        List<CtopOauthToken> kuaishouTokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
-        if (null != kuaishouTokens && kuaishouTokens.size() > 0) {
-            for (CtopOauthToken token : kuaishouTokens) {
-                for (int i = 0; i < 7; i++) {
-                    Date getStartDate = DateUtils.addDay(endDate, -i);
-                    //1: 获取广告主信息数据
-//                    kuaishouInterfaceService.getAdvertiserReportHourly(token, getStartDate, getStartDate);
-                    //2:获取广告计划信息数据
-//                    kuaishouInterfaceService.getAdvertiserCampaignReportHourly(token, getStartDate, getStartDate);
-                    //3:获取广告组信息数据
-                    kuaishouInterfaceService.getAdvertiserGroupReportHourly(token, getStartDate, getStartDate);
-                    //4: 获取广告创意信息数据
-//                    kuaishouInterfaceService.getAdvertiserCreativeReportHourly(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);
-//                    }
-//                    //1: 获取广告主信息数据
-//                    kuaishouInterfaceService.getAdvertiserReportDaily(token, getStartDate, getEndDate);
-//                    //2:获取广告计划信息数据
-//                    kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getStartDate, getEndDate);
-//                    //3:获取广告组信息数据
-//                    kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, getStartDate, getEndDate);
-//                    //4: 获取广告创意信息数据
-//                    kuaishouInterfaceService.getAdvertiserCreativeReportDaily(token, getStartDate, getEndDate);
-//                }
-            }
-        }
-    }
-
-    @Test
-    public void testFileType() {
-        File file = new File("D:\\工作文件\\360借条\\快手后台数据-户1.csv");
+    public void testVideoList() throws IOException {
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId("1232598");
+        kuaishouInterfaceService.getVideoList(token);
     }
 
-    @Test
-    public void testFileUpload() {
-        OSSUtils.uploadObject2Oss(new File("D:\\upload\\excel\\template.xlsx"));
-    }
 
     @Test
     public void testNg() {
@@ -168,36 +71,77 @@ public class SampleTest {
         createInternalService.createInternal(json);
     }
 
-
-    @Autowired
-    private ICtopOauthTokenService tokenService;
-    @Autowired
-    private IByteDanceAdvertiserDataService advertiserDataService;
-    @Autowired
-    private IFileInfoService fileInfoService;
+    static ExecutorService executorService = null;
+    static CountDownLatch countDownLatch = null; //线程计数器          如果不用执行完后统一走流程,可以不要这个
 
     @Test
-    public void setJSONFile() {
-        CtopOauthToken token = tokenService.getOauthTokenByAccountId("93289889842");
-        JSONObject wordsObject = fileInfoService.getCreativeWord(token, token.getAccountId());
-        String getTitle = "哈哈{日期}{男人女人}";
-        JSONArray ids = getCreativeWordIds(getTitle, wordsObject);
-    }
-
-    public JSONArray getCreativeWordIds(String getTitle, JSONObject wordsObject) {
-        ArrayList<String> wordsString = StringUtils.stringCutFromBrace(getTitle);
-        JSONArray creativeWords = wordsObject.getJSONArray("creative_word");
-        JSONArray ids = new JSONArray();
-        wordsString.forEach(v -> {
-            creativeWords.forEach(word -> {
-                JSONObject wordObject = (JSONObject) word;
-                String name = wordObject.getString("name");
-                Integer id = wordObject.getInteger("creative_word_id");
-                if (v.equals(name)) {
-                    ids.add(id);
+    public void loadData() throws InterruptedException {
+        Date getDate = DateUtils.addDay(new Date(), -1);
+//        Date getDate = new Date();
+        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("定时获取头条数据异常:为获取到可用的token");
+            return;
+        }
+        int times = tokens.size();
+        executorService = Executors.newFixedThreadPool(10);
+        countDownLatch = new CountDownLatch(times);
+        for (CtopOauthToken token : tokens) {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    if (token.getAccountId() == 2731757) {
+                        System.out.println("" + token.getAccountId() + "开始");
+                        kuaishouInterfaceService.getAdvertiserCreativeReportHourly(token, getDate, getDate);
+                        System.out.println("" + token.getAccountId() + "结束");
+                    }
+                    countDownLatch.countDown();
                 }
             });
+        }
+
+        countDownLatch.await();
+        System.out.println("Game Over");
+        //关掉线程池
+        executorService.shutdown();
+    }
+    @Test
+    public void loadAllMetiaralInfo() {
+        Date getDate = DateUtils.addDay(new Date(), -1);
+        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("定时获取头条数据异常:为获取到可用的token");
+            return;
+        }
+//        tokens.forEach(token -> {
+//            kuaishouInterfaceService.getCampaignList(token);
+//        });
+//        tokens.forEach(token -> {
+//                kuaishouInterfaceService.getGroupList(token);
+//        });
+        tokens.forEach(token -> {
+            kuaishouInterfaceService.getCreativeList(token);
+        });
+        tokens.forEach(token -> {
+            kuaishouInterfaceService.getVideoList(token);
+        });
+
+
+        log.info("快手物料数据同步完成");
+        tokens.forEach(token -> {
+            kuaishouInterfaceService.getAdvertiserReportDaily(token, getDate, getDate);
+        });
+        tokens.forEach(token -> {
+            kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getDate, getDate);
+        });
+        tokens.forEach(token -> {
+            kuaishouInterfaceService.getAdvertiserGroupReportDaily(token, getDate, getDate);
+        });
+        tokens.forEach(token -> {
+            kuaishouInterfaceService.getAdvertiserCreativeReportDaily(token, getDate, getDate);
         });
-        return ids;
     }
+
+    @Autowired
+    private ICtopOauthTokenService tokenService;
 }

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

@@ -33,4 +33,6 @@ public interface IFileInfoService extends IService<FileInfo> {
     JSONObject getCreativeWord(CtopOauthToken token, Long advertiserId);
 
     Map<String, Object> insertFile(String code, String url);
+
+    String downLoadByUrl(String fileUrl);
 }

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java

@@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IUserAllocationService extends IService<UserAllocation> {
 
+    UserAllocation getByAccountId(Long accountId);
 }

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java

@@ -150,7 +150,7 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
     @Override
     public List<CtopOauthToken> getTokenListByType(String platformType) {
         QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("media_id", platformType);
+        queryWrapper.eq("media_id", platformType).orderByDesc("account_id");
         return this.list(queryWrapper);
     }
 }

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java

@@ -299,6 +299,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
     }
 
 
+    @Override
     public String downLoadByUrl(String fileUrl) {
         //获取文件名,文件名实际上在URL中可以找到
         String fileName = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);

+ 7 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java

@@ -3,6 +3,7 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.IUserAllocationService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
@@ -15,4 +16,10 @@ import org.springframework.stereotype.Service;
 @Service
 public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper, UserAllocation> implements IUserAllocationService {
 
+    @Override
+    public UserAllocation getByAccountId(Long accountId) {
+        QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId + "").orderByDesc("id").last("limit 1");
+        return this.getOne(queryWrapper);
+    }
 }

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java

@@ -14,7 +14,7 @@ public class KuaishouInterfaceConstant {
     /**
      * 广告主报表数据
      */
-    public static final String VIDEO_LIST = "rest/openapi/v1/file/ad/video/list";
+    public static final String VIDEO_LIST = "/rest/openapi/v1/file/ad/video/list";
     /**
      * 广告计划报表数据
      */

+ 208 - 210
module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/controller/AppiumTaskController.java

@@ -1,39 +1,37 @@
 package cn.com.ctop.crawler.modules.appium.controller;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.jeecg.common.util.oConvertUtils;
 import cn.com.ctop.crawler.modules.appium.entity.AppiumTask;
 import cn.com.ctop.crawler.modules.appium.service.IAppiumTaskService;
-import java.util.Date;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.jeecgframework.poi.excel.entity.ImportParams;
 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
-import com.alibaba.fastjson.JSON;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 任务表
@@ -46,173 +44,173 @@ import io.swagger.annotations.ApiOperation;
 @RestController
 @RequestMapping("/appium/appiumTask")
 public class AppiumTaskController {
-	@Autowired
-	private IAppiumTaskService appiumTaskService;
+    @Autowired
+    private IAppiumTaskService appiumTaskService;
 
-	/**
-	 * 分页列表查询
-	 *
-	 * @param appiumTask
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	@AutoLog(value = "任务表-分页列表查询")
-	@ApiOperation(value = "任务表-分页列表查询", notes = "任务表-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<AppiumTask>> queryPageList(AppiumTask appiumTask,
-												   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-												   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-												   HttpServletRequest req) {
-		Result<IPage<AppiumTask>> result = new Result<IPage<AppiumTask>>();
-		QueryWrapper<AppiumTask> queryWrapper = QueryGenerator.initQueryWrapper(appiumTask, req.getParameterMap());
-		Page<AppiumTask> page = new Page<AppiumTask>(pageNo, pageSize);
-		IPage<AppiumTask> pageList = appiumTaskService.page(page, queryWrapper);
-		result.setSuccess(true);
-		result.setResult(pageList);
-		return result;
-	}
+    /**
+     * 分页列表查询
+     *
+     * @param appiumTask
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "任务表-分页列表查询")
+    @ApiOperation(value = "任务表-分页列表查询", notes = "任务表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<AppiumTask>> queryPageList(AppiumTask appiumTask,
+                                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                   HttpServletRequest req) {
+        Result<IPage<AppiumTask>> result = new Result<IPage<AppiumTask>>();
+        QueryWrapper<AppiumTask> queryWrapper = QueryGenerator.initQueryWrapper(appiumTask, req.getParameterMap());
+        Page<AppiumTask> page = new Page<AppiumTask>(pageNo, pageSize);
+        IPage<AppiumTask> pageList = appiumTaskService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
 
-	/**
-	 * 添加
-	 *
-	 * @param appiumTask
-	 * @return
-	 */
-	@AutoLog(value = "任务表-添加")
-	@ApiOperation(value = "任务表-添加", notes = "任务表-添加")
-	@PostMapping(value = "/add")
-	public Result<AppiumTask> add(@RequestBody AppiumTask appiumTask) {
-		Result<AppiumTask> result = new Result<AppiumTask>();
-		try {
-			appiumTaskService.save(appiumTask);
-			result.success("添加成功!");
-		} catch (Exception e) {
-			log.error(e.getMessage(), e);
-			result.error500("操作失败");
-		}
-		return result;
-	}
+    /**
+     * 添加
+     *
+     * @param appiumTask
+     * @return
+     */
+    @AutoLog(value = "任务表-添加")
+    @ApiOperation(value = "任务表-添加", notes = "任务表-添加")
+    @PostMapping(value = "/add")
+    public Result<AppiumTask> add(@RequestBody AppiumTask appiumTask) {
+        Result<AppiumTask> result = new Result<AppiumTask>();
+        try {
+            appiumTaskService.save(appiumTask);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
 
-	/**
-	 * 编辑
-	 *
-	 * @param appiumTask
-	 * @return
-	 */
-	@AutoLog(value = "任务表-编辑")
-	@ApiOperation(value = "任务表-编辑", notes = "任务表-编辑")
-	@PutMapping(value = "/edit")
-	public Result<AppiumTask> edit(@RequestBody AppiumTask appiumTask) {
-		Result<AppiumTask> result = new Result<AppiumTask>();
-		AppiumTask appiumTaskEntity = appiumTaskService.getById(appiumTask.getId());
-		if (appiumTaskEntity == null) {
-			result.error500("未找到对应实体");
-		} else {
-			boolean ok = appiumTaskService.updateById(appiumTask);
-			if (ok) {
-				result.success("修改成功!");
-			}
-		}
+    /**
+     * 编辑
+     *
+     * @param appiumTask
+     * @return
+     */
+    @AutoLog(value = "任务表-编辑")
+    @ApiOperation(value = "任务表-编辑", notes = "任务表-编辑")
+    @PutMapping(value = "/edit")
+    public Result<AppiumTask> edit(@RequestBody AppiumTask appiumTask) {
+        Result<AppiumTask> result = new Result<AppiumTask>();
+        AppiumTask appiumTaskEntity = appiumTaskService.getById(appiumTask.getId());
+        if (appiumTaskEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = appiumTaskService.updateById(appiumTask);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
 
-		return result;
-	}
+        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 {
-			appiumTaskService.removeById(id);
-		} catch (Exception e) {
-			log.error("删除失败", e.getMessage());
-			return Result.error("删除失败!");
-		}
-		return Result.ok("删除成功!");
-	}
+    /**
+     * 通过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 {
+            appiumTaskService.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<AppiumTask> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-		Result<AppiumTask> result = new Result<AppiumTask>();
-		if (ids == null || "".equals(ids.trim())) {
-			result.error500("参数不识别!");
-		} else {
-			this.appiumTaskService.removeByIds(Arrays.asList(ids.split(",")));
-			result.success("删除成功!");
-		}
-		return result;
-	}
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "任务表-批量删除")
+    @ApiOperation(value = "任务表-批量删除", notes = "任务表-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<AppiumTask> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<AppiumTask> result = new Result<AppiumTask>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.appiumTaskService.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<AppiumTask> queryById(@RequestParam(name = "id", required = true) String id) {
-		Result<AppiumTask> result = new Result<AppiumTask>();
-		AppiumTask appiumTask = appiumTaskService.getById(id);
-		if (appiumTask == null) {
-			result.error500("未找到对应实体");
-		} else {
-			result.setResult(appiumTask);
-			result.setSuccess(true);
-		}
-		return result;
-	}
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "任务表-通过id查询")
+    @ApiOperation(value = "任务表-通过id查询", notes = "任务表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<AppiumTask> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<AppiumTask> result = new Result<AppiumTask>();
+        AppiumTask appiumTask = appiumTaskService.getById(id);
+        if (appiumTask == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(appiumTask);
+            result.setSuccess(true);
+        }
+        return result;
+    }
 
-	/**
-	 * 导出excel
-	 *
-	 * @param request
-	 * @param response
-	 */
-	@RequestMapping(value = "/exportXls")
-	public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-		// Step.1 组装查询条件
-		QueryWrapper<AppiumTask> queryWrapper = null;
-		try {
-			String paramsStr = request.getParameter("paramsStr");
-			if (oConvertUtils.isNotEmpty(paramsStr)) {
-				String deString = URLDecoder.decode(paramsStr, "UTF-8");
-				AppiumTask appiumTask = JSON.parseObject(deString, AppiumTask.class);
-				queryWrapper = QueryGenerator.initQueryWrapper(appiumTask, request.getParameterMap());
-			}
-		} catch (UnsupportedEncodingException e) {
-			e.printStackTrace();
-		}
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<AppiumTask> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                AppiumTask appiumTask = JSON.parseObject(deString, AppiumTask.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(appiumTask, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
 
-		//Step.2 AutoPoi 导出Excel
-		ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-		List<AppiumTask> pageList = appiumTaskService.list(queryWrapper);
-		//导出文件名称
-		mv.addObject(NormalExcelConstants.FILE_NAME, "任务表列表");
-		mv.addObject(NormalExcelConstants.CLASS, AppiumTask.class);
-		mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("任务表列表数据", "导出人:Jeecg", "导出信息"));
-		mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-		return mv;
-	}
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<AppiumTask> pageList = appiumTaskService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "任务表列表");
+        mv.addObject(NormalExcelConstants.CLASS, AppiumTask.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("任务表列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
 
-	@RequestMapping(value = "/run", method = RequestMethod.POST)
-	public Result<?> run(HttpServletRequest request, HttpServletResponse response, Integer taskId, Integer deviceId) {
+    @RequestMapping(value = "/run", method = RequestMethod.POST)
+    public Result<?> run(HttpServletRequest request, HttpServletResponse response, Integer taskId, Integer deviceId) {
         Thread thread = new Thread() {
             @Override
             public void run() {
@@ -221,41 +219,41 @@ public class AppiumTaskController {
         };
         thread.start();
         return Result.ok("任务已启动");
-	}
+    }
 
-	/**
-	 * 通过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<AppiumTask> listAppiumTasks = ExcelImportUtil.importExcel(file.getInputStream(), AppiumTask.class, params);
-				appiumTaskService.saveBatch(listAppiumTasks);
-				return Result.ok("文件导入成功!数据行数:" + listAppiumTasks.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("文件导入失败!");
-	}
+    /**
+     * 通过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<AppiumTask> listAppiumTasks = ExcelImportUtil.importExcel(file.getInputStream(), AppiumTask.class, params);
+                appiumTaskService.saveBatch(listAppiumTasks);
+                return Result.ok("文件导入成功!数据行数:" + listAppiumTasks.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("文件导入失败!");
+    }
 
 }

+ 4 - 7
module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/entity/AppiumDevice.java

@@ -1,20 +1,17 @@
 package cn.com.ctop.crawler.modules.appium.entity;
 
-import java.io.Serializable;
-import java.util.Date;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import org.springframework.format.annotation.DateTimeFormat;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
+import java.util.Date;
+
 /**
  * 手机设备表
  * @author jeecg-boot
@@ -56,10 +53,10 @@ public class AppiumDevice {
      * createTime
      */
     @ApiModelProperty(value = "createTime")
-	private Date createTime;
+    private Date createTime;
     /**
      * updateTime
      */
     @ApiModelProperty(value = "updateTime")
-	private Date updateTime;
+    private Date updateTime;
 }

+ 5 - 8
module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/entity/AppiumTask.java

@@ -1,22 +1,19 @@
 package cn.com.ctop.crawler.modules.appium.entity;
 
-import java.io.Serializable;
-import java.util.Date;
-import java.util.List;
-
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import org.springframework.format.annotation.DateTimeFormat;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
+import java.util.Date;
+import java.util.List;
+
 /**
  * 任务表
  * @author jeecg-boot
@@ -58,7 +55,7 @@ public class AppiumTask {
      * createTime
      */
     @ApiModelProperty(value = "createTime")
-	private Date createTime;
+    private Date createTime;
     /**
      * updateTime
      */

+ 2 - 6
module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/entity/AppiumTaskLog.java

@@ -1,21 +1,17 @@
 package cn.com.ctop.crawler.modules.appium.entity;
 
-import java.io.Serializable;
-import java.util.Date;
-
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import org.springframework.format.annotation.DateTimeFormat;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
+import java.util.Date;
+
 /**
  * 任务日志表
  *

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

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

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

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

+ 2 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouCampaign.java

@@ -1,6 +1,5 @@
 package cn.com.ctop.kuaishou.modules.batch.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;
@@ -30,9 +29,9 @@ public class KuaiShouCampaign {
     /**
      * id
      */
-    @TableId(type = IdType.AUTO)
+    @TableId
     @ApiModelProperty(value = "id")
-    private Long id;
+    private String id;
     /**
      * 账户ID
      */

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

@@ -31,7 +31,7 @@ public class KuaiShouCreative {
      */
     @TableId
     @ApiModelProperty(value = "id")
-    private Long id;
+    private String id;
     /**
      * 账户ID
      */

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

@@ -1,6 +1,5 @@
 package cn.com.ctop.kuaishou.modules.batch.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;
@@ -30,9 +29,9 @@ public class KuaiShouGroup {
     /**
      * id
      */
-    @TableId(type = IdType.AUTO)
+    @TableId
     @ApiModelProperty(value = "id")
-    private Long id;
+    private String id;
     /**
      * 账户ID
      */

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

@@ -61,7 +61,7 @@ public class KuaiShouVideoGet {
      */
     @Excel(name = "视频预览链接", width = 15)
     @ApiModelProperty(value = "视频预览链接")
-    private Object url;
+    private String url;
     /**
      * 视频首帧图片链接
      */

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

@@ -10,5 +10,4 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @Version: V1.0
  */
 public interface IKuaiShouVideoGetService extends IService<KuaiShouVideoGet> {
-
 }

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

@@ -92,6 +92,8 @@ public interface IKuaishouInterfaceService {
     void getGroup(String accessToken, Long advertiserId, Long unitId);
 
 
+    void getCreativeList(CtopOauthToken token);
+
     void getVideoInfo(String accessToken, Long advertiserId, String photoId);
 
     /**
@@ -250,4 +252,10 @@ public interface IKuaishouInterfaceService {
     void getAdvertiserGroupReportHourly(CtopOauthToken token, Date startDate, Date endDate);
 
     void getAdvertiserCreativeReportHourly(CtopOauthToken token, Date startDate, Date endDate);
+
+    void getCampaignList(CtopOauthToken token);
+
+    void getGroupList(CtopOauthToken token);
+
+    void loadData() throws InterruptedException;
 }

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

@@ -2,16 +2,14 @@ package cn.com.ctop.kuaishou.modules.batch.service.impl;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.MaterialInfo;
+import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
-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.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.*;
 import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.mapper.*;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResult;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
 import cn.com.ctop.kuaishou.modules.report.entity.*;
@@ -51,6 +49,9 @@ import java.io.IOException;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 /**
  * @author
@@ -231,7 +232,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             log.info("快手视频列表信息为空=》accountId:{}", token.getAccountId());
             return;
         }
-
+        System.out.println(details.toJSONString());
         for (int i = 0; i < details.size(); i++) {
             var detailJson = details.getJSONObject(i);
             var kuaiShouVideoGet = JSONObject.toJavaObject(detailJson, KuaiShouVideoGet.class);
@@ -696,11 +697,41 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             var creative = JSONObject.toJavaObject(detailJson, KuaishouReportDailyCreative.class);
             creative.setAccountId(token.getAccountId());
             creative.setId("" + creative.getAccountId() + creative.getCreativeId() + creative.getStatDate());
+            KuaishouReportDailyCreativeStatistic statistic = setDailyStatistic(creative, token);
+            dailyCreativeStatisticService.saveOrUpdate(statistic);
             dailyCreativeService.saveOrUpdate(creative);
         }
         getAdvertiserCreativeReportDailyByPage(token, startDate, endDate, page + 1);
     }
 
+    private KuaishouReportDailyCreativeStatistic setDailyStatistic(KuaishouReportDailyCreative creative, CtopOauthToken token) {
+        KuaishouReportDailyCreativeStatistic statistic = new KuaishouReportDailyCreativeStatistic(creative);
+        KuaiShouCreative getCreative = kuaiShouCreativeService.getById("" + token.getAccountId() + creative.getCreativeId());
+        if (null != getCreative) {
+            statistic.setCreativeName(getCreative.getCreativeName());
+            KuaiShouCampaign getCampaign = kuaiShouCampaignService.getById("" + token.getAccountId() + getCreative.getCampaignId());
+            if (null != getCampaign) {
+                statistic.setCampaignId(getCampaign.getCampaignId());
+                statistic.setCampaignName(getCampaign.getCampaignName());
+            }
+            KuaiShouGroup getGroup = kuaiShouGroupService.getById("" + token.getAccountId() + getCreative.getUnitId());
+            if (null != getGroup) {
+                statistic.setUnitId(getGroup.getUnitId());
+                statistic.setUnitName(getGroup.getUnitName());
+            }
+            KuaiShouVideoGet getVideo = kuaiShouVideoGetService.getById("" + token.getAccountId() + getCreative.getPhotoId());
+            if (null != getVideo) {
+                statistic.setSignature(getVideo.getSignature());
+                statistic.setUrl(getVideo.getUrl());
+            }
+            UserAllocation allocation = userAllocationService.getByAccountId(token.getAccountId());
+            if (null != allocation) {
+                statistic.setAccountName(allocation.getAuthName());
+            }
+        }
+        return statistic;
+    }
+
     @Override
     public KuaishouResult<KuaishouReportDailyCreative> getCreativeDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_REPORT;
@@ -738,6 +769,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         getAdvertiserCreativeReportHourlyByPage(token, startDate, endDate, 1);
     }
 
+
     private void getAdvertiserCreativeReportHourlyByPage(CtopOauthToken token, Date startDate, Date endDate, int page) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_REPORT;
         Map<String, String> headers = new HashMap<>();
@@ -773,11 +805,54 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             var creative = JSONObject.toJavaObject(detailJson, KuaishouReportHourlyCreative.class);
             creative.setAccountId(token.getAccountId());
             creative.setId("" + creative.getAccountId() + creative.getCreativeId() + creative.getStatDate() + creative.getStatHour());
+            KuaishouReportHourlyCreativeStatistic statistic = setHourlyStatistic(creative, token);
+            hourlyCreativeStatisticService.saveOrUpdate(statistic);
             hourlyCreativeService.saveOrUpdate(creative);
         }
         getAdvertiserCreativeReportHourlyByPage(token, startDate, endDate, page + 1);
     }
 
+    @Autowired
+    private IKuaiShouCreativeService kuaiShouCreativeService;
+    @Autowired
+    private IKuaiShouCampaignService kuaiShouCampaignService;
+    @Autowired
+    private IKuaiShouGroupService kuaiShouGroupService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @Autowired
+    private IKuaishouReportHourlyCreativeStatisticService hourlyCreativeStatisticService;
+    @Autowired
+    private IKuaishouReportDailyCreativeStatisticService dailyCreativeStatisticService;
+
+    private KuaishouReportHourlyCreativeStatistic setHourlyStatistic(KuaishouReportHourlyCreative creative, CtopOauthToken token) {
+        KuaishouReportHourlyCreativeStatistic statistic = new KuaishouReportHourlyCreativeStatistic(creative);
+        KuaiShouCreative getCreative = kuaiShouCreativeService.getById("" + token.getAccountId() + creative.getCreativeId());
+        if (null != getCreative) {
+            statistic.setCreativeName(getCreative.getCreativeName());
+            KuaiShouCampaign getCampaign = kuaiShouCampaignService.getById("" + token.getAccountId() + getCreative.getCampaignId());
+            if (null != getCampaign) {
+                statistic.setCampaignId(getCampaign.getCampaignId());
+                statistic.setCampaignName(getCampaign.getCampaignName());
+            }
+            KuaiShouGroup getGroup = kuaiShouGroupService.getById("" + token.getAccountId() + getCreative.getUnitId());
+            if (null != getGroup) {
+                statistic.setUnitId(getGroup.getUnitId());
+                statistic.setUnitName(getGroup.getUnitName());
+            }
+            KuaiShouVideoGet getVideo = kuaiShouVideoGetService.getById("" + token.getAccountId() + getCreative.getPhotoId());
+            if (null != getVideo) {
+                statistic.setSignature(getVideo.getSignature());
+                statistic.setUrl(getVideo.getUrl());
+            }
+            UserAllocation allocation = userAllocationService.getByAccountId(token.getAccountId());
+            if (null != allocation) {
+                statistic.setAccountName(allocation.getAuthName());
+            }
+        }
+        return statistic;
+    }
+
     @Override
     public KuaishouResult<KuaishouReportHourlyCreative> getCreativeHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_REPORT;
@@ -859,9 +934,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     /**
      * 创建广告计划
      *
-     * @param accessToken  token信息
-     * @param advertiserId 广告主id
-     * @param requestJson  请求参数拼装
+     * @param accessToken token信息
+     * @param advertiserId  广告主id
+     * @param requestJson 请求参数拼装
      */
     @Override
     public Map<String, Object> campaignCreate(String accessToken, Long advertiserId, JSONObject requestJson) {
@@ -977,6 +1052,42 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return returnMap;
     }
 
+    @Override
+    public void getCampaignList(CtopOauthToken token) {
+        getCampaignListByPage(token.getAccessToken(), token.getAccountId(), 1);
+    }
+
+    private void getCampaignListByPage(String accessToken, Long accountId, int page) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CAMPAIGN_LIST;
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Access-Token", accessToken);
+        headers.put("Content-Type", " application/json");
+        JSONObject param = new JSONObject();
+        param.put("advertiser_id", accountId);
+        param.put("page", page);
+        param.put("page_size", 200);
+
+        String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (Check.isNull(resultJson)) {
+            log.error("获取广告计划信息返回结果异常,advertiserId:{}", accountId);
+            return;
+        }
+        Integer code = resultJson.getInteger("code");
+        if (null == code || code != 0) {
+            log.error("获取广告计划信息返回结果异常,advertiserId:{},异常信息:{}", accountId, resultJson);
+            return;
+        }
+        JSONObject dataJson = resultJson.getJSONObject("data");
+        JSONArray details = dataJson.getJSONArray("details");
+        if (Check.isNull(details)) {
+            log.info("获取广告计划信息返回结果为空,advertiserId:{}", accountId);
+            return;
+        }
+        addCampaign(accountId, details);
+        getCampaignListByPage(accessToken, accountId, page + 1);
+    }
+
     /**
      * 获取广告计划信息
      *
@@ -986,12 +1097,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
      */
     @Override
     public void getCampaignList(String accessToken, Long advertiserId, Integer page) {
-        // 第一次请求删除历史数据
-        if (page == 1) {
-            Map<String, Object> map = new HashMap<>();
-            map.put("account_id", advertiserId);
-            campaignMapper.deleteByMap(map);
-        }
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CAMPAIGN_LIST;
         Map<String, String> headers = new HashMap<>();
         headers.put("Access-Token", accessToken);
@@ -1061,22 +1166,109 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         }
     }
 
-
     private void addCampaign(Long advertiserId, JSONArray details) {
         for (int i = 0; i < details.size(); i++) {
             JSONObject detail = JSONObject.parseObject(details.get(i).toString());
             if (!Check.isNull(detail)) {
                 KuaiShouCampaign campaign = new KuaiShouCampaign();
+                campaign.setId("" + advertiserId + detail.getLong("campaign_id"));
                 campaign.setAccountId(advertiserId);
                 campaign.setCampaignId(detail.getLong("campaign_id"));
                 campaign.setCampaignName(detail.getString("campaign_name"));
                 campaign.setDayBudget(detail.getLong("day_budget"));
                 campaign.setStatus(detail.getInteger("status"));
-                campaignMapper.insert(campaign);
+                kuaiShouCampaignService.saveOrUpdate(campaign);
             }
         }
     }
 
+    @Override
+    public void getGroupList(CtopOauthToken token) {
+        getGroupListByPage(token, 1);
+    }
+
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    static ExecutorService executorService = null;
+    static CountDownLatch countDownLatch = null; //线程计数器          如果不用执行完后统一走流程,可以不要这个
+
+    @Override
+    public void loadData() throws InterruptedException {
+        Date getDate = DateUtils.addDay(new Date(), -1);
+//        Date getDate = new Date();
+        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
+        if (null == tokens || tokens.size() <= 0) {
+            log.info("定时获取头条数据异常:为获取到可用的token");
+            return;
+        }
+        int times = tokens.size();
+        executorService = Executors.newFixedThreadPool(5);
+        countDownLatch = new CountDownLatch(times);
+        for (CtopOauthToken token : tokens) {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    //1:获取全量广告计划数据
+                    getCampaignList(token);
+                    //1:获取全量广告组数据
+                    getGroupList(token);
+                    //1:获取全量创意数据
+                    getCreativeList(token);
+                    //2:获取全量视频素材数据
+                    getVideoList(token);
+                    countDownLatch.countDown();
+                }
+            });
+        }
+        countDownLatch.await();
+        //关掉线程池
+        executorService.shutdown();
+
+        executorService = Executors.newFixedThreadPool(5);
+        countDownLatch = new CountDownLatch(times);
+        for (CtopOauthToken token : tokens) {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    getAdvertiserCreativeReportHourly(token, getDate, getDate);
+                    countDownLatch.countDown();
+                }
+            });
+        }
+        countDownLatch.await();
+        //关掉线程池
+        executorService.shutdown();
+    }
+
+    private void getGroupListByPage(CtopOauthToken token, int page) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GROUP_LIST;
+        JSONObject param = new JSONObject();
+        param.put("advertiser_id", token.getAccountId());
+        param.put("page_size", 200);
+        param.put("page", page);
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Access-Token", token.getAccessToken());
+        headers.put("Content-Type", " application/json");
+
+        String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        if (Check.isNull(resultJson)) {
+            log.error("获取广告组接口异常,advertiserId:{}", token.getAccountId());
+            return;
+        }
+        Integer code = resultJson.getInteger("code");
+        if (null == code || code != 0) {
+            log.error("获取广告组返回结果异常,advertiserId:{},异常信息:{}", token.getAccountId(), resultJson);
+            return;
+        }
+        JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+        if (Check.isNull(details)) {
+            log.info("获取广告组返回结果为空,advertiserId:{}", token.getAccountId());
+            return;
+        }
+        addGroup(token.getAccountId(), details);
+        getGroupListByPage(token, page + 1);
+    }
 
     /**
      * 获取广告组信息 全量
@@ -1174,7 +1366,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     }
 
-
     private void addGroup(Long advertiserId, JSONArray details) {
         if (!Check.isNull(details)) {
             for (int i = 0; i < details.size(); i++) {
@@ -1190,6 +1381,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     group.setCampaignId(detail.getLong("campaign_id"));
                     Long unitId = detail.getLong("unit_id");
                     group.setUnitId(unitId);
+                    group.setId("" + advertiserId + unitId);
                     group.setUnitName(detail.getString("unit_name"));
                     group.setBidType(detail.getInteger("bid_type"));
                     group.setReviewDetail(detail.getString("review_detail"));
@@ -1202,7 +1394,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     group.setUrlType(detail.getInteger("url_type"));
                     group.setAppId(detail.getLong("app_id"));
                     group.setAppIconUrl(detail.getString("app_icon_url"));
-                    groupMapper.insert(group);
+                    kuaiShouGroupService.saveOrUpdate(group);
                     // 添加应用信息
                     JSONObject diverseJson = detail.getJSONObject("diverse_data");
                     if (!Check.isNull(diverseJson)) {
@@ -1235,6 +1427,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         }
     }
 
+    @Override
+    public void getCreativeList(CtopOauthToken token) {
+        getCreativeListByPage(token.getAccessToken(), token.getAccountId(), 1);
+    }
+
     public void getCreativeListByPage(String accessToken, Long advertiserId, Integer page) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_LIST;
         Map<String, String> headers = new HashMap<>();
@@ -1266,7 +1463,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             JSONObject detailJson = JSONObject.parseObject(details.get(i).toString());
             if (!Check.isNull(detailJson)) {
                 KuaiShouCreative creative = new KuaiShouCreative();
-                creative.setId(detailJson.getLong("creative_id"));
+                creative.setId("" + advertiserId + detailJson.getLong("creative_id"));
                 creative.setAccountId(advertiserId);
                 creative.setStatus(detailJson.getInteger("status"));
                 creative.setCampaignId(detailJson.getLong("campaign_id"));
@@ -1324,7 +1521,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                                 videoGet.setAccountId(advertiserId);
                                 videoGet.setWidth(detailJson.getInteger("width"));
                                 videoGet.setHeight(detailJson.getInteger("height"));
-                                videoGet.setUrl(detailJson.getLong("unit_id"));
+                                videoGet.setUrl(detailJson.getString("url"));
                                 videoGet.setCoverUrl(detailJson.getString("creative_name"));
                                 videoGet.setPhotoId(detailJson.getString("photo_id"));
                                 //videoGet.setSignature(UUID.randomUUID().toString());
@@ -1374,7 +1571,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                                 JSONObject detailJson = JSONObject.parseObject(details.get(i).toString());
                                 if (!Check.isNull(detailJson)) {
                                     KuaiShouCreative creative = new KuaiShouCreative();
-                                    creative.setId(detailJson.getLong("creative_id"));
+                                    creative.setId("" + advertiserId + detailJson.getLong("creative_id"));
                                     creative.setAccountId(advertiserId);
                                     creative.setStatus(detailJson.getInteger("status"));
                                     creative.setCampaignId(detailJson.getLong("campaign_id"));

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

@@ -0,0 +1,452 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
+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.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 时报清洗数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-01
+ */
+@Data
+@TableName("ctop_kuaishou_report_daily_creative_statistic")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_report_daily_creative_statistic对象", description = "时报清洗数据")
+public class KuaishouReportDailyCreativeStatistic {
+
+    /**
+     * id
+     */
+    @TableId
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**
+     * accountId
+     */
+    @Excel(name = "accountId", width = 15)
+    @ApiModelProperty(value = "accountId")
+    private Long accountId;
+    /**
+     * 用户名
+     */
+    @Excel(name = "用户名", width = 15)
+    @ApiModelProperty(value = "用户名")
+    private String accountName;
+    /**
+     * unitId
+     */
+    @Excel(name = "unitId", width = 15)
+    @ApiModelProperty(value = "unitId")
+    private Long unitId;
+    /**
+     * unitName
+     */
+    @Excel(name = "unitName", width = 15)
+    @ApiModelProperty(value = "unitName")
+    private String unitName;
+    /**
+     * campaignId
+     */
+    @Excel(name = "campaignId", width = 15)
+    @ApiModelProperty(value = "campaignId")
+    private Long campaignId;
+    /**
+     * campaignName
+     */
+    @Excel(name = "campaignName", width = 15)
+    @ApiModelProperty(value = "campaignName")
+    private String campaignName;
+    /**
+     * 广告创意ID
+     */
+    @Excel(name = "广告创意ID", width = 15)
+    @ApiModelProperty(value = "广告创意ID")
+    private Long creativeId;
+    /**
+     * creativeName
+     */
+    @Excel(name = "creativeName", width = 15)
+    @ApiModelProperty(value = "creativeName")
+    private String creativeName;
+    /**
+     * 日期
+     */
+    @Excel(name = "日期", width = 15, format = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @ApiModelProperty(value = "日期")
+    private String statDate;
+    /**
+     * 花费(元)
+     */
+    @Excel(name = "花费(元)", width = 15)
+    @ApiModelProperty(value = "花费(元)")
+    private BigDecimal charge;
+    /**
+     * 封面点击数
+     */
+    @Excel(name = "封面点击数", width = 15)
+    @ApiModelProperty(value = "封面点击数")
+    private Long photoClick;
+    /**
+     * 曝光数
+     */
+    @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;
+    /**
+     * photoClickRatio
+     */
+    @Excel(name = "photoClickRatio", width = 15)
+    @ApiModelProperty(value = "photoClickRatio")
+    private BigDecimal photoClickRatio;
+    /**
+     * 行为率
+     */
+    @Excel(name = "行为率", width = 15)
+    @ApiModelProperty(value = "行为率")
+    private BigDecimal actionRatio;
+    /**
+     * 平均千次曝光消耗
+     */
+    @Excel(name = "平均千次曝光消耗", width = 15)
+    @ApiModelProperty(value = "平均千次曝光消耗")
+    @JsonProperty("impression_1k_cost")
+    @TableField("impression_1k_cost")
+    private BigDecimal impression1kCost;
+    /**
+     * eventCreditGrantLandingPageCost
+     */
+    @Excel(name = "eventCreditGrantLandingPageCost", width = 15)
+    @ApiModelProperty(value = "eventCreditGrantLandingPageCost")
+    private BigDecimal eventCreditGrantLandingPageCost;
+    /**
+     * eventCreditGrantLandingPage
+     */
+    @Excel(name = "eventCreditGrantLandingPage", width = 15)
+    @ApiModelProperty(value = "eventCreditGrantLandingPage")
+    private Long eventCreditGrantLandingPage;
+    /**
+     * eventJinJianLandingPageCost
+     */
+    @Excel(name = "eventJinJianLandingPageCost", width = 15)
+    @ApiModelProperty(value = "eventJinJianLandingPageCost")
+    private BigDecimal eventJinJianLandingPageCost;
+    /**
+     * eventJinJianLandingPage
+     */
+    @Excel(name = "eventJinJianLandingPage", width = 15)
+    @ApiModelProperty(value = "eventJinJianLandingPage")
+    private Long eventJinJianLandingPage;
+    /**
+     * formActionRatio
+     */
+    @Excel(name = "formActionRatio", width = 15)
+    @ApiModelProperty(value = "formActionRatio")
+    private BigDecimal formActionRatio;
+    /**
+     * formCost
+     */
+    @Excel(name = "formCost", width = 15)
+    @ApiModelProperty(value = "formCost")
+    private BigDecimal formCost;
+    /**
+     * formCount
+     */
+    @Excel(name = "formCount", width = 15)
+    @ApiModelProperty(value = "formCount")
+    private Long formCount;
+    /**
+     * eventOrderPaidCost
+     */
+    @Excel(name = "eventOrderPaidCost", width = 15)
+    @ApiModelProperty(value = "eventOrderPaidCost")
+    private BigDecimal eventOrderPaidCost;
+    /**
+     * eventOrderPaidPurchaseAmount
+     */
+    @Excel(name = "eventOrderPaidPurchaseAmount", width = 15)
+    @ApiModelProperty(value = "eventOrderPaidPurchaseAmount")
+    private BigDecimal eventOrderPaidPurchaseAmount;
+    /**
+     * eventOrderPaid
+     */
+    @Excel(name = "eventOrderPaid", width = 15)
+    @ApiModelProperty(value = "eventOrderPaid")
+    private BigDecimal eventOrderPaid;
+    /**
+     * eventCreditGrantAppRatio
+     */
+    @Excel(name = "eventCreditGrantAppRatio", width = 15)
+    @ApiModelProperty(value = "eventCreditGrantAppRatio")
+    private BigDecimal eventCreditGrantAppRatio;
+    /**
+     * eventCreditGrantAppCost
+     */
+    @Excel(name = "eventCreditGrantAppCost", width = 15)
+    @ApiModelProperty(value = "eventCreditGrantAppCost")
+    private BigDecimal eventCreditGrantAppCost;
+    /**
+     * eventCreditGrantApp
+     */
+    @Excel(name = "eventCreditGrantApp", width = 15)
+    @ApiModelProperty(value = "eventCreditGrantApp")
+    private Long eventCreditGrantApp;
+    /**
+     * eventPayPurchaseAmountFirstDay
+     */
+    @Excel(name = "eventPayPurchaseAmountFirstDay", width = 15)
+    @ApiModelProperty(value = "eventPayPurchaseAmountFirstDay")
+    private BigDecimal eventPayPurchaseAmountFirstDay;
+    /**
+     * eventJinJianAppCost
+     */
+    @Excel(name = "eventJinJianAppCost", width = 15)
+    @ApiModelProperty(value = "eventJinJianAppCost")
+    private BigDecimal eventJinJianAppCost;
+    /**
+     * eventJinJianApp
+     */
+    @Excel(name = "eventJinJianApp", width = 15)
+    @ApiModelProperty(value = "eventJinJianApp")
+    private Long eventJinJianApp;
+    /**
+     * eventRegisterCost
+     */
+    @Excel(name = "eventRegisterCost", width = 15)
+    @ApiModelProperty(value = "eventRegisterCost")
+    private BigDecimal eventRegisterCost;
+    /**
+     * eventRegister
+     */
+    @Excel(name = "eventRegister", width = 15)
+    @ApiModelProperty(value = "eventRegister")
+    private Long eventRegister;
+    /**
+     * eventPayRoi
+     */
+    @Excel(name = "eventPayRoi", width = 15)
+    @ApiModelProperty(value = "eventPayRoi")
+    private BigDecimal eventPayRoi;
+    /**
+     * eventPayPurchaseAmount
+     */
+    @Excel(name = "eventPayPurchaseAmount", width = 15)
+    @ApiModelProperty(value = "eventPayPurchaseAmount")
+    private BigDecimal eventPayPurchaseAmount;
+    /**
+     * eventPay
+     */
+    @Excel(name = "eventPay", width = 15)
+    @ApiModelProperty(value = "eventPay")
+    private BigDecimal eventPay;
+    /**
+     * eventPayFirstDayRoi
+     */
+    @Excel(name = "eventPayFirstDayRoi", width = 15)
+    @ApiModelProperty(value = "eventPayFirstDayRoi")
+    private BigDecimal eventPayFirstDayRoi;
+    /**
+     * eventPayFirstDay
+     */
+    @Excel(name = "eventPayFirstDay", width = 15)
+    @ApiModelProperty(value = "eventPayFirstDay")
+    private Long eventPayFirstDay;
+    /**
+     * photoClickCost
+     */
+    @Excel(name = "photoClickCost", width = 15)
+    @ApiModelProperty(value = "photoClickCost")
+    private BigDecimal photoClickCost;
+    /**
+     * actionCost
+     */
+    @Excel(name = "actionCost", width = 15)
+    @ApiModelProperty(value = "actionCost")
+    private BigDecimal actionCost;
+    /**
+     * 分享数
+     */
+    @Excel(name = "分享数", width = 15)
+    @ApiModelProperty(value = "分享数")
+    private Long share;
+    /**
+     * 评论数
+     */
+    @Excel(name = "评论数", width = 15)
+    @ApiModelProperty(value = "评论数")
+    private Long comment;
+    /**
+     * 点赞数
+     */
+    @Excel(name = "点赞数", width = 15)
+    @ApiModelProperty(value = "点赞数")
+    private Long photoLike;
+    /**
+     * 新增关注数
+     */
+    @Excel(name = "新增关注数", width = 15)
+    @ApiModelProperty(value = "新增关注数")
+    private Long follow;
+    /**
+     * 举报数
+     */
+    @Excel(name = "举报数", width = 15)
+    @ApiModelProperty(value = "举报数")
+    private Long report;
+    /**
+     * 拉黑数
+     */
+    @Excel(name = "拉黑数", width = 15)
+    @ApiModelProperty(value = "拉黑数")
+    private Long block;
+    /**
+     * negative
+     */
+    @Excel(name = "negative", width = 15)
+    @ApiModelProperty(value = "negative")
+    private Long negative;
+    /**
+     * 激活数
+     */
+    @Excel(name = "激活数", width = 15)
+    @ApiModelProperty(value = "激活数")
+    private Long activation;
+    /**
+     * submit
+     */
+    @Excel(name = "submit", width = 15)
+    @ApiModelProperty(value = "submit")
+    private Long submit;
+    /**
+     * cancelFollow
+     */
+    @Excel(name = "cancelFollow", width = 15)
+    @ApiModelProperty(value = "cancelFollow")
+    private Long cancelFollow;
+    /**
+     * 安卓下载开始数
+     */
+    @Excel(name = "安卓下载开始数", width = 15)
+    @ApiModelProperty(value = "安卓下载开始数")
+    private Long downloadStarted;
+    /**
+     * 安卓下载完成数
+     */
+    @Excel(name = "安卓下载完成数", width = 15)
+    @ApiModelProperty(value = "安卓下载完成数")
+    private Long downloadCompleted;
+    /**
+     * 创建时间
+     */
+    @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;
+    /**
+     * signature
+     */
+    @Excel(name = "signature", width = 15)
+    @ApiModelProperty(value = "signature")
+    private String signature;
+    /**
+     * url
+     */
+    @Excel(name = "url", width = 15)
+    @ApiModelProperty(value = "url")
+    private String url;
+
+    public KuaishouReportDailyCreativeStatistic(KuaishouReportDailyCreative creative) {
+        this.id = creative.getId();
+        this.accountId = creative.getAccountId();
+        this.creativeId = creative.getCreativeId();
+        this.statDate = creative.getStatDate();
+        this.charge = creative.getCharge();
+        this.photoClick = creative.getPhotoClick();
+        this.photoShow = creative.getPhotoShow();
+        this.aclick = creative.getAclick();
+        this.bclick = creative.getBclick();
+        this.photoClickRatio = creative.getPhotoClickRatio();
+        this.actionRatio = creative.getActionRatio();
+        this.impression1kCost = creative.getImpression1kCost();
+        this.eventCreditGrantLandingPageCost = creative.getEventCreditGrantLandingPageCost();
+        this.eventCreditGrantLandingPage = creative.getEventCreditGrantLandingPage();
+        this.eventJinJianLandingPageCost = creative.getEventJinJianLandingPageCost();
+        this.eventJinJianLandingPage = creative.getEventJinJianLandingPage();
+        this.formActionRatio = creative.getFormActionRatio();
+        this.formCost = creative.getFormCost();
+        this.formCount = creative.getFormCount();
+        this.eventOrderPaidCost = creative.getEventOrderPaidCost();
+        this.eventOrderPaidPurchaseAmount = creative.getEventOrderPaidPurchaseAmount();
+        this.eventOrderPaid = creative.getEventOrderPaid();
+        this.eventCreditGrantAppRatio = creative.getEventCreditGrantAppRatio();
+        this.eventCreditGrantAppCost = creative.getEventCreditGrantAppCost();
+        this.eventCreditGrantApp = creative.getEventCreditGrantApp();
+        this.eventPayPurchaseAmountFirstDay = creative.getEventPayPurchaseAmountFirstDay();
+        this.eventJinJianAppCost = creative.getEventJinJianAppCost();
+        this.eventJinJianApp = creative.getEventJinJianApp();
+        this.eventRegisterCost = creative.getEventRegisterCost();
+        this.eventRegister = creative.getEventRegister();
+        this.eventPayRoi = creative.getEventPayRoi();
+        this.eventPayPurchaseAmount = creative.getEventPayPurchaseAmount();
+        this.eventPay = creative.getEventPay();
+        this.eventPayFirstDayRoi = creative.getEventPayFirstDayRoi();
+        this.eventPayFirstDay = creative.getEventPayFirstDay();
+        this.photoClickCost = creative.getPhotoClickCost();
+        this.actionCost = creative.getActionCost();
+        this.share = creative.getShare();
+        this.comment = creative.getComment();
+        this.photoLike = creative.getPhotoLike();
+        this.follow = creative.getFollow();
+        this.report = creative.getReport();
+        this.block = creative.getBlock();
+        this.negative = creative.getNegative();
+        this.activation = creative.getActivation();
+        this.submit = creative.getSubmit();
+        this.cancelFollow = creative.getCancelFollow();
+        this.downloadStarted = creative.getDownloadStarted();
+        this.downloadCompleted = creative.getDownloadCompleted();
+        this.updateTime = new Date();
+        this.createTime = new Date();
+    }
+
+    public KuaishouReportDailyCreativeStatistic() {
+    }
+}

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

@@ -0,0 +1,459 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
+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.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 时报清洗数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-01
+ */
+@Data
+@TableName("ctop_kuaishou_report_hourly_creative_statistic")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_report_hourly_creative_statistic对象", description = "时报清洗数据")
+public class KuaishouReportHourlyCreativeStatistic {
+
+    /**
+     * id
+     */
+    @TableId
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**
+     * accountId
+     */
+    @Excel(name = "accountId", width = 15)
+    @ApiModelProperty(value = "accountId")
+    private Long accountId;
+    /**
+     * 用户名
+     */
+    @Excel(name = "用户名", width = 15)
+    @ApiModelProperty(value = "用户名")
+    private String accountName;
+    /**
+     * unitId
+     */
+    @Excel(name = "unitId", width = 15)
+    @ApiModelProperty(value = "unitId")
+    private Long unitId;
+    /**
+     * unitName
+     */
+    @Excel(name = "unitName", width = 15)
+    @ApiModelProperty(value = "unitName")
+    private String unitName;
+    /**
+     * campaignId
+     */
+    @Excel(name = "campaignId", width = 15)
+    @ApiModelProperty(value = "campaignId")
+    private Long campaignId;
+    /**
+     * campaignName
+     */
+    @Excel(name = "campaignName", width = 15)
+    @ApiModelProperty(value = "campaignName")
+    private String campaignName;
+    /**
+     * 广告创意ID
+     */
+    @Excel(name = "广告创意ID", width = 15)
+    @ApiModelProperty(value = "广告创意ID")
+    private Long creativeId;
+    /**
+     * creativeName
+     */
+    @Excel(name = "creativeName", width = 15)
+    @ApiModelProperty(value = "creativeName")
+    private String creativeName;
+    /**
+     * 日期
+     */
+    @Excel(name = "日期", width = 15, format = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @ApiModelProperty(value = "日期")
+    private String statDate;
+    /**
+     * 时间
+     */
+    @Excel(name = "时间", width = 15)
+    @ApiModelProperty(value = "时间")
+    private Integer statHour;
+    /**
+     * 花费(元)
+     */
+    @Excel(name = "花费(元)", width = 15)
+    @ApiModelProperty(value = "花费(元)")
+    private java.math.BigDecimal charge;
+    /**
+     * 封面点击数
+     */
+    @Excel(name = "封面点击数", width = 15)
+    @ApiModelProperty(value = "封面点击数")
+    private Long photoClick;
+    /**
+     * 曝光数
+     */
+    @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;
+    /**
+     * photoClickRatio
+     */
+    @Excel(name = "photoClickRatio", width = 15)
+    @ApiModelProperty(value = "photoClickRatio")
+    private BigDecimal photoClickRatio;
+    /**
+     * 行为率
+     */
+    @Excel(name = "行为率", width = 15)
+    @ApiModelProperty(value = "行为率")
+    private BigDecimal actionRatio;
+    /**
+     * 平均千次曝光消耗
+     */
+    @Excel(name = "平均千次曝光消耗", width = 15)
+    @ApiModelProperty(value = "平均千次曝光消耗")
+    @JsonProperty("impression_1k_cost")
+    @TableField("impression_1k_cost")
+    private BigDecimal impression1kCost;
+    /**
+     * eventCreditGrantLandingPageCost
+     */
+    @Excel(name = "eventCreditGrantLandingPageCost", width = 15)
+    @ApiModelProperty(value = "eventCreditGrantLandingPageCost")
+    private BigDecimal eventCreditGrantLandingPageCost;
+    /**
+     * eventCreditGrantLandingPage
+     */
+    @Excel(name = "eventCreditGrantLandingPage", width = 15)
+    @ApiModelProperty(value = "eventCreditGrantLandingPage")
+    private Long eventCreditGrantLandingPage;
+    /**
+     * eventJinJianLandingPageCost
+     */
+    @Excel(name = "eventJinJianLandingPageCost", width = 15)
+    @ApiModelProperty(value = "eventJinJianLandingPageCost")
+    private BigDecimal eventJinJianLandingPageCost;
+    /**
+     * eventJinJianLandingPage
+     */
+    @Excel(name = "eventJinJianLandingPage", width = 15)
+    @ApiModelProperty(value = "eventJinJianLandingPage")
+    private Long eventJinJianLandingPage;
+    /**
+     * formActionRatio
+     */
+    @Excel(name = "formActionRatio", width = 15)
+    @ApiModelProperty(value = "formActionRatio")
+    private BigDecimal formActionRatio;
+    /**
+     * formCost
+     */
+    @Excel(name = "formCost", width = 15)
+    @ApiModelProperty(value = "formCost")
+    private BigDecimal formCost;
+    /**
+     * formCount
+     */
+    @Excel(name = "formCount", width = 15)
+    @ApiModelProperty(value = "formCount")
+    private Long formCount;
+    /**
+     * eventOrderPaidCost
+     */
+    @Excel(name = "eventOrderPaidCost", width = 15)
+    @ApiModelProperty(value = "eventOrderPaidCost")
+    private BigDecimal eventOrderPaidCost;
+    /**
+     * eventOrderPaidPurchaseAmount
+     */
+    @Excel(name = "eventOrderPaidPurchaseAmount", width = 15)
+    @ApiModelProperty(value = "eventOrderPaidPurchaseAmount")
+    private BigDecimal eventOrderPaidPurchaseAmount;
+    /**
+     * eventOrderPaid
+     */
+    @Excel(name = "eventOrderPaid", width = 15)
+    @ApiModelProperty(value = "eventOrderPaid")
+    private BigDecimal eventOrderPaid;
+    /**
+     * eventCreditGrantAppRatio
+     */
+    @Excel(name = "eventCreditGrantAppRatio", width = 15)
+    @ApiModelProperty(value = "eventCreditGrantAppRatio")
+    private BigDecimal eventCreditGrantAppRatio;
+    /**
+     * eventCreditGrantAppCost
+     */
+    @Excel(name = "eventCreditGrantAppCost", width = 15)
+    @ApiModelProperty(value = "eventCreditGrantAppCost")
+    private BigDecimal eventCreditGrantAppCost;
+    /**
+     * eventCreditGrantApp
+     */
+    @Excel(name = "eventCreditGrantApp", width = 15)
+    @ApiModelProperty(value = "eventCreditGrantApp")
+    private Long eventCreditGrantApp;
+    /**
+     * eventPayPurchaseAmountFirstDay
+     */
+    @Excel(name = "eventPayPurchaseAmountFirstDay", width = 15)
+    @ApiModelProperty(value = "eventPayPurchaseAmountFirstDay")
+    private BigDecimal eventPayPurchaseAmountFirstDay;
+    /**
+     * eventJinJianAppCost
+     */
+    @Excel(name = "eventJinJianAppCost", width = 15)
+    @ApiModelProperty(value = "eventJinJianAppCost")
+    private BigDecimal eventJinJianAppCost;
+    /**
+     * eventJinJianApp
+     */
+    @Excel(name = "eventJinJianApp", width = 15)
+    @ApiModelProperty(value = "eventJinJianApp")
+    private Long eventJinJianApp;
+    /**
+     * eventRegisterCost
+     */
+    @Excel(name = "eventRegisterCost", width = 15)
+    @ApiModelProperty(value = "eventRegisterCost")
+    private BigDecimal eventRegisterCost;
+    /**
+     * eventRegister
+     */
+    @Excel(name = "eventRegister", width = 15)
+    @ApiModelProperty(value = "eventRegister")
+    private Long eventRegister;
+    /**
+     * eventPayRoi
+     */
+    @Excel(name = "eventPayRoi", width = 15)
+    @ApiModelProperty(value = "eventPayRoi")
+    private BigDecimal eventPayRoi;
+    /**
+     * eventPayPurchaseAmount
+     */
+    @Excel(name = "eventPayPurchaseAmount", width = 15)
+    @ApiModelProperty(value = "eventPayPurchaseAmount")
+    private BigDecimal eventPayPurchaseAmount;
+    /**
+     * eventPay
+     */
+    @Excel(name = "eventPay", width = 15)
+    @ApiModelProperty(value = "eventPay")
+    private BigDecimal eventPay;
+    /**
+     * eventPayFirstDayRoi
+     */
+    @Excel(name = "eventPayFirstDayRoi", width = 15)
+    @ApiModelProperty(value = "eventPayFirstDayRoi")
+    private BigDecimal eventPayFirstDayRoi;
+    /**
+     * eventPayFirstDay
+     */
+    @Excel(name = "eventPayFirstDay", width = 15)
+    @ApiModelProperty(value = "eventPayFirstDay")
+    private Long eventPayFirstDay;
+    /**
+     * photoClickCost
+     */
+    @Excel(name = "photoClickCost", width = 15)
+    @ApiModelProperty(value = "photoClickCost")
+    private BigDecimal photoClickCost;
+    /**
+     * actionCost
+     */
+    @Excel(name = "actionCost", width = 15)
+    @ApiModelProperty(value = "actionCost")
+    private BigDecimal actionCost;
+    /**
+     * 分享数
+     */
+    @Excel(name = "分享数", width = 15)
+    @ApiModelProperty(value = "分享数")
+    private Long share;
+    /**
+     * 评论数
+     */
+    @Excel(name = "评论数", width = 15)
+    @ApiModelProperty(value = "评论数")
+    private Long comment;
+    /**
+     * 点赞数
+     */
+    @Excel(name = "点赞数", width = 15)
+    @ApiModelProperty(value = "点赞数")
+    private Long photoLike;
+    /**
+     * 新增关注数
+     */
+    @Excel(name = "新增关注数", width = 15)
+    @ApiModelProperty(value = "新增关注数")
+    private Long follow;
+    /**
+     * 举报数
+     */
+    @Excel(name = "举报数", width = 15)
+    @ApiModelProperty(value = "举报数")
+    private Long report;
+    /**
+     * 拉黑数
+     */
+    @Excel(name = "拉黑数", width = 15)
+    @ApiModelProperty(value = "拉黑数")
+    private Long block;
+    /**
+     * negative
+     */
+    @Excel(name = "negative", width = 15)
+    @ApiModelProperty(value = "negative")
+    private Long negative;
+    /**
+     * 激活数
+     */
+    @Excel(name = "激活数", width = 15)
+    @ApiModelProperty(value = "激活数")
+    private Long activation;
+    /**
+     * submit
+     */
+    @Excel(name = "submit", width = 15)
+    @ApiModelProperty(value = "submit")
+    private Long submit;
+    /**
+     * cancelFollow
+     */
+    @Excel(name = "cancelFollow", width = 15)
+    @ApiModelProperty(value = "cancelFollow")
+    private Long cancelFollow;
+    /**
+     * 安卓下载开始数
+     */
+    @Excel(name = "安卓下载开始数", width = 15)
+    @ApiModelProperty(value = "安卓下载开始数")
+    private Long downloadStarted;
+    /**
+     * 安卓下载完成数
+     */
+    @Excel(name = "安卓下载完成数", width = 15)
+    @ApiModelProperty(value = "安卓下载完成数")
+    private Long downloadCompleted;
+    /**
+     * 创建时间
+     */
+    @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;
+    /**
+     * signature
+     */
+    @Excel(name = "signature", width = 15)
+    @ApiModelProperty(value = "signature")
+    private String signature;
+    /**
+     * url
+     */
+    @Excel(name = "url", width = 15)
+    @ApiModelProperty(value = "url")
+    private String url;
+
+    public KuaishouReportHourlyCreativeStatistic(KuaishouReportHourlyCreative creative) {
+        this.id = creative.getId();
+        this.accountId = creative.getAccountId();
+        this.creativeId = creative.getCreativeId();
+        this.statDate = creative.getStatDate();
+        this.statHour = creative.getStatHour();
+        this.charge = creative.getCharge();
+        this.photoClick = creative.getPhotoClick();
+        this.photoShow = creative.getPhotoShow();
+        this.aclick = creative.getAclick();
+        this.bclick = creative.getBclick();
+        this.photoClickRatio = creative.getPhotoClickRatio();
+        this.actionRatio = creative.getActionRatio();
+        this.impression1kCost = creative.getImpression1kCost();
+        this.eventCreditGrantLandingPageCost = creative.getEventCreditGrantLandingPageCost();
+        this.eventCreditGrantLandingPage = creative.getEventCreditGrantLandingPage();
+        this.eventJinJianLandingPageCost = creative.getEventJinJianLandingPageCost();
+        this.eventJinJianLandingPage = creative.getEventJinJianLandingPage();
+        this.formActionRatio = creative.getFormActionRatio();
+        this.formCost = creative.getFormCost();
+        this.formCount = creative.getFormCount();
+        this.eventOrderPaidCost = creative.getEventOrderPaidCost();
+        this.eventOrderPaidPurchaseAmount = creative.getEventOrderPaidPurchaseAmount();
+        this.eventOrderPaid = creative.getEventOrderPaid();
+        this.eventCreditGrantAppRatio = creative.getEventCreditGrantAppRatio();
+        this.eventCreditGrantAppCost = creative.getEventCreditGrantAppCost();
+        this.eventCreditGrantApp = creative.getEventCreditGrantApp();
+        this.eventPayPurchaseAmountFirstDay = creative.getEventPayPurchaseAmountFirstDay();
+        this.eventJinJianAppCost = creative.getEventJinJianAppCost();
+        this.eventJinJianApp = creative.getEventJinJianApp();
+        this.eventRegisterCost = creative.getEventRegisterCost();
+        this.eventRegister = creative.getEventRegister();
+        this.eventPayRoi = creative.getEventPayRoi();
+        this.eventPayPurchaseAmount = creative.getEventPayPurchaseAmount();
+        this.eventPay = creative.getEventPay();
+        this.eventPayFirstDayRoi = creative.getEventPayFirstDayRoi();
+        this.eventPayFirstDay = creative.getEventPayFirstDay();
+        this.photoClickCost = creative.getPhotoClickCost();
+        this.actionCost = creative.getActionCost();
+        this.share = creative.getShare();
+        this.comment = creative.getComment();
+        this.photoLike = creative.getPhotoLike();
+        this.follow = creative.getFollow();
+        this.report = creative.getReport();
+        this.block = creative.getBlock();
+        this.negative = creative.getNegative();
+        this.activation = creative.getActivation();
+        this.submit = creative.getSubmit();
+        this.cancelFollow = creative.getCancelFollow();
+        this.downloadStarted = creative.getDownloadStarted();
+        this.downloadCompleted = creative.getDownloadCompleted();
+        this.updateTime = new Date();
+        this.createTime = new Date();
+    }
+
+    public KuaishouReportHourlyCreativeStatistic() {
+    }
+}

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreativeStatistic;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 时报清洗数据
+ *
+ * @author: jeecg-boot
+ * @date: 2019-11-01
+ * @cersion: V1.0
+ */
+public interface KuaishouReportDailyCreativeStatisticMapper extends BaseMapper<KuaishouReportDailyCreativeStatistic> {
+
+}

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCreativeStatistic;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 时报清洗数据
+ *
+ * @author: jeecg-boot
+ * @date: 2019-11-01
+ * @cersion: V1.0
+ */
+public interface KuaishouReportHourlyCreativeStatisticMapper extends BaseMapper<KuaishouReportHourlyCreativeStatistic> {
+
+}

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

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

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

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

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreativeStatistic;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 时报清洗数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-01
+ */
+public interface IKuaishouReportDailyCreativeStatisticService extends IService<KuaishouReportDailyCreativeStatistic> {
+
+}

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCreativeStatistic;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 时报清洗数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-01
+ */
+public interface IKuaishouReportHourlyCreativeStatisticService extends IService<KuaishouReportHourlyCreativeStatistic> {
+
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreativeStatistic;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeStatisticMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCreativeStatisticService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 时报清洗数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-01
+ */
+@Service
+public class KuaishouReportDailyCreativeStatisticServiceImpl extends ServiceImpl<KuaishouReportDailyCreativeStatisticMapper, KuaishouReportDailyCreativeStatistic> implements IKuaishouReportDailyCreativeStatisticService {
+
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCreativeStatistic;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportHourlyCreativeStatisticMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyCreativeStatisticService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 时报清洗数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-01
+ */
+@Service
+public class KuaishouReportHourlyCreativeStatisticServiceImpl extends ServiceImpl<KuaishouReportHourlyCreativeStatisticMapper, KuaishouReportHourlyCreativeStatistic> implements IKuaishouReportHourlyCreativeStatisticService {
+
+}

+ 12 - 11
module-report/src/main/java/cn/com/ctop/bytedance/controller/MaterialReportController.java

@@ -5,11 +5,13 @@ import cn.com.ctop.bytedance.service.IMaterialReportService;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 @Slf4j
 @RestController
 @RequestMapping("/materialReport")
@@ -18,20 +20,19 @@ public class MaterialReportController {
     private IMaterialReportService materialReportService;
 
 
-    @GetMapping(value = "/getKuaiShouMaterialReport")
-    public JSONObject getKuaiShouMaterialReport(@RequestBody String userId) {
-        String roleCode = materialReportService.getRoleCodeByUserId(userId);
-        if ("operator".equals(roleCode)) {
-            // 根据创建人查询accountId
+    @PostMapping(value = "/getKuaiShouMaterialMarket")
+    public List<JSONObject> getKuaiShouMaterialMarket(@RequestBody JSONObject json) {
+        List<JSONObject> marketJson = materialReportService.getKuaiShouMaterialMarket(json);
+        return marketJson;
 
-        } else {
-            // 查询所有
-        }
+    }
 
 
-        return null;
+    @PostMapping(value = "/getKuaiShouChainRatio")
+    public JSONObject getKuaiShouChainRatio(@RequestBody JSONObject json) {
+        JSONObject marketJson = materialReportService.getKuaiShouChainRatio(json);
+        return marketJson;
 
     }
 
-
 }

+ 14 - 0
module-report/src/main/java/cn/com/ctop/bytedance/mapper/MaterialReportMapper.java

@@ -1,7 +1,21 @@
 package cn.com.ctop.bytedance.mapper;
 
+import com.alibaba.fastjson.JSONObject;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+import java.util.Map;
+
 public interface MaterialReportMapper {
     String getRoleCodeByUserId(@Param("userId") String userId);
+
+    List<JSONObject> selectByMap(Map<String, Object> paramsMap);
+
+    Integer selectMaxHourByDate(@Param("statDate") String statDate);
+
+    JSONObject selectChainRatioByMap(Map<String, Object> paramsMap);
+
+    List<JSONObject> selectDailyByMap(Map<String, Object> paramsMap);
+
+    JSONObject selectDailyChainRatioByMap(Map<String, Object> paramsMap);
 }

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

@@ -20,4 +20,353 @@
     )
 	</select>
 
+
+    <select id="selectMaxHourByDate" resultType="java.lang.Integer">
+        select
+        max(stat_hour)
+       from
+        ctop_kuaishou_report_hourly_creative_statistic
+        where stat_date = #{statDate}
+
+      </select>
+
+
+    <select id="selectByMap" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        sum(t2.charge) cost, -- 花费
+        sum(t2.photo_show) photoShow, -- 封面曝光数
+        sum(t2.photo_click) photoClick, -- 封面点击数
+        sum(t2.aclick) aclick, -- 素材曝光数
+        sum(t2.bclick) bclick, -- 行为数
+        (case
+        when sum(photo_show) != 0
+        then (sum(t2.photo_click) / sum(photo_show))
+        else 0
+        end
+        ) photoClickRatio, -- 封面点击率
+
+        (case
+        when sum(aclick) != 0
+        then (sum(t2.bclick) / sum(aclick))
+        else 0
+        end
+        ) actionRatio, -- 行为率
+
+        (case
+        when sum(t2.photo_show) != 0
+        then ((sum(t2.charge) / sum(t2.photo_show)) * 1000)
+        else 0
+        end
+        ) impression1kCost, -- 均千次封面曝光花费
+
+        (case
+        when sum(t2.photo_click) != 0
+        then (sum(t2.charge) / sum(t2.photo_click))
+        else 0
+        end
+        ) photoClickCost, -- 平均封面点击单价
+
+        (CASE
+        WHEN sum(t2.photo_click) != 0
+        THEN (sum(t2.charge) / sum(t2.photo_click))
+        ELSE 0
+        end
+        ) actionCost, -- 平均行为单价
+
+        (case
+        WHEN sum(t2.form_count) != 0
+        THEN sum(t2.form_count)
+        WHEN sum(t2.activation) != 0
+        THEN sum(t2.activation)
+        ELSE 0
+        END
+        ) conversions, -- 转化数
+
+        (
+        CASE
+        WHEN sum(t2.form_count) != 0
+        THEN (sum(t2.charge) / sum(t2.form_count))
+        WHEN sum(t2.activation) != 0
+        THEN (sum(t2.charge) / sum(t2.activation))
+        ELSE 0
+        END
+        ) conversionPrice, -- 转化单价
+
+        t2.url url, -- 视频url
+        t2.signature signature -- 视频md5
+        from
+        ctop_user_allocation t1
+        left join
+        ctop_kuaishou_report_hourly_creative_statistic t2
+        on t1.account_id = t2.account_id
+        <where>
+            <if test="userId != null">
+                and t1.user_id = #{userId,jdbcType=VARCHAR}
+            </if>
+            and t1.media_id = '2'
+            and t1.account_id != ''
+            and t2.signature != ''
+            <if test="startDate != null">
+                and t2.stat_date = #{startDate}
+            </if>
+            <if test="statHour != null">
+                and t2.stat_hour &lt;= #{statHour}
+            </if>
+        </where>
+
+        group by t2.signature
+        order by sum(t2.charge) desc
+        limit 100
+
+
+    </select>
+
+
+    <select id="selectChainRatioByMap" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        sum(charge) cost, -- 花费
+        sum(photo_show) photoShow, -- 封面曝光数
+        sum(photo_click) photoClick, -- 封面点击数
+        sum(aclick) aclick, -- 素材曝光数
+        sum(bclick) bclick, -- 行为数
+        (case
+        when sum(photo_show) != 0
+        then (sum(photo_click) / sum(photo_show))
+        else 0
+        end
+        ) photoClickRatio, -- 封面点击率
+
+        (case
+        when sum(aclick) != 0
+        then (sum(bclick) / sum(aclick))
+        else 0
+        end
+        ) actionRatio, -- 行为率
+
+        (case
+        when sum(photo_show) != 0
+        then ((sum(charge) / sum(photo_show)) * 1000)
+        else 0
+        end
+        ) impression1kCost, -- 均千次封面曝光花费
+
+        (case
+        when sum(photo_click) != 0
+        then (sum(charge) / sum(photo_click))
+        else 0
+        end
+        ) photoClickCost, -- 平均封面点击单价
+
+        (CASE
+        WHEN sum(photo_click) != 0
+        THEN (sum(charge) / sum(photo_click))
+        ELSE 0
+        end
+        ) actionCost, -- 平均行为单价
+
+        (case
+        WHEN sum(form_count) != 0
+        THEN sum(form_count)
+        WHEN sum(activation) != 0
+        THEN sum(activation)
+        ELSE 0
+        END
+        ) conversions, -- 转化数
+
+        (
+        CASE
+        WHEN sum(form_count) != 0
+        THEN (sum(charge) / sum(form_count))
+        WHEN sum(activation) != 0
+        THEN (sum(charge) / sum(activation))
+        ELSE 0
+        END
+        ) conversionPrice -- 转化单价
+        from
+        ctop_kuaishou_report_hourly_creative_statistic
+
+        <where>
+            <if test="statDate != null">
+                and stat_date = #{statDate}
+            </if>
+            <if test="statHour != null">
+                and stat_hour &lt;= #{statHour}
+            </if>
+            <if test="signature != null">
+                and signature = #{signature}
+            </if>
+        </where>
+        group by signature
+
+    </select>
+
+
+    <select id="selectDailyByMap" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        sum(t2.charge) cost, -- 花费
+        sum(t2.photo_show) photoShow, -- 封面曝光数
+        sum(t2.photo_click) photoClick, -- 封面点击数
+        sum(t2.aclick) aclick, -- 素材曝光数
+        sum(t2.bclick) bclick, -- 行为数
+        (case
+        when sum(t2.photo_show) != 0
+        then (sum(t2.photo_click) / sum(t2.photo_show))
+        else 0
+        end
+        ) photoClickRatio, -- 封面点击率
+
+        (case
+        when sum(t2.aclick) != 0
+        then (sum(t2.bclick) / sum(t2.aclick))
+        else 0
+        end
+        ) actionRatio, -- 行为率
+
+        (case
+        when sum(t2.photo_show) != 0
+        then ((sum(t2.charge) / sum(t2.photo_show)) * 1000)
+        else 0
+        end
+        ) impression1kCost, -- 均千次封面曝光花费
+
+        (case
+        when sum(t2.photo_click) != 0
+        then (sum(t2.charge) / sum(t2.photo_click))
+        else 0
+        end
+        ) photoClickCost, -- 平均封面点击单价
+
+        (CASE
+        WHEN sum(t2.photo_click) != 0
+        THEN (sum(t2.charge) / sum(t2.photo_click))
+        ELSE 0
+        end
+        ) actionCost, -- 平均行为单价
+
+        (case
+        WHEN sum(t2.form_count) != 0
+        THEN sum(t2.form_count)
+        WHEN sum(t2.activation) != 0
+        THEN sum(t2.activation)
+        ELSE 0
+        END
+        ) conversions, -- 转化数
+
+        (
+        CASE
+        WHEN sum(t2.form_count) != 0
+        THEN (sum(t2.charge) / sum(t2.form_count))
+        WHEN sum(t2.activation) != 0
+        THEN (sum(t2.charge) / sum(t2.activation))
+        ELSE 0
+        END
+        ) conversionPrice, -- 转化单价
+
+        t2.url url, -- 视频url
+        t2.signature signature -- 视频md5
+        from
+        ctop_user_allocation t1
+        left join
+        ctop_kuaishou_report_daily_creative_statistic t2
+        on t1.account_id = t2.account_id
+        <where>
+            <if test="userId != null">
+                and t1.user_id = #{userId,jdbcType=VARCHAR}
+            </if>
+            and t1.media_id = '2'
+            and t1.account_id != ''
+            and t2.signature != ''
+            <if test="startDate != null">
+                and t2.stat_date &lt;= #{startDate}
+            </if>
+            <if test="endDate != null">
+                and stat_date &gt;= #{endDate}
+            </if>
+        </where>
+        group by t2.signature
+        order by (t2.charge) desc
+        limit 100
+    </select>
+
+
+    <select id="selectDailyChainRatioByMap" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        sum(charge) cost, -- 花费
+        sum(photo_show) photoShow, -- 封面曝光数
+        sum(photo_click) photoClick, -- 封面点击数
+        sum(aclick) aclick, -- 素材曝光数
+        sum(bclick) bclick, -- 行为数
+        (case
+        when sum(photo_show) != 0
+        then (sum(photo_click) / sum(photo_show))
+        else 0
+        end
+        ) photoClickRatio, -- 封面点击率
+
+        (case
+        when sum(aclick) != 0
+        then (sum(bclick) / sum(aclick))
+        else 0
+        end
+        ) actionRatio, -- 行为率
+
+        (case
+        when sum(photo_show) != 0
+        then ((sum(charge) / sum(photo_show)) * 1000)
+        else 0
+        end
+        ) impression1kCost, -- 均千次封面曝光花费
+
+        (case
+        when sum(photo_click) != 0
+        then (sum(charge) / sum(photo_click))
+        else 0
+        end
+        ) photoClickCost, -- 平均封面点击单价
+
+        (CASE
+        WHEN sum(photo_click) != 0
+        THEN (sum(charge) / sum(photo_click))
+        ELSE 0
+        end
+        ) actionCost, -- 平均行为单价
+
+        (case
+        WHEN sum(form_count) != 0
+        THEN sum(form_count)
+        WHEN sum(activation) != 0
+        THEN sum(activation)
+        ELSE 0
+        END
+        ) conversions, -- 转化数
+
+        (
+        CASE
+        WHEN sum(form_count) != 0
+        THEN (sum(charge) / sum(form_count))
+        WHEN sum(activation) != 0
+        THEN (sum(charge) / sum(activation))
+        ELSE 0
+        END
+        ) conversionPrice -- 转化单价
+        from
+        ctop_kuaishou_report_daily_creative_statistic
+        <where>
+            <if test="signature != null">
+                and signature = #{signature}
+            </if>
+            <if test="statDate != null">
+                and stat_date = #{statDate}
+            </if>
+            <if test="startDate != null">
+                and stat_date &gt;= #{startDate}
+            </if>
+            <if test="endDate != null">
+                and stat_date &lt;= #{endDate}
+            </if>
+        </where>
+        group by signature
+    </select>
+
+
 </mapper>

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

@@ -1,7 +1,26 @@
 package cn.com.ctop.bytedance.service;
 
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+
 public interface IMaterialReportService {
     String getRoleCodeByUserId(String userId);
 
 
+    /**
+     * 获取快手大盘素材报表
+     *
+     * @param json
+     * @return
+     */
+    List<JSONObject> getKuaiShouMaterialMarket(JSONObject json);
+
+    /**
+     * 获取 环比
+     *
+     * @param json
+     * @return
+     */
+    JSONObject getKuaiShouChainRatio(JSONObject json);
 }

+ 408 - 0
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/MaterialReportServiceImpl.java

@@ -2,9 +2,18 @@ package cn.com.ctop.bytedance.service.impl;
 
 import cn.com.ctop.bytedance.mapper.MaterialReportMapper;
 import cn.com.ctop.bytedance.service.IMaterialReportService;
+import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 @Service
 public class MaterialReportServiceImpl implements IMaterialReportService {
     @Autowired
@@ -14,4 +23,403 @@ public class MaterialReportServiceImpl implements IMaterialReportService {
     public String getRoleCodeByUserId(String userId) {
         return materialReportMapper.getRoleCodeByUserId(userId);
     }
+
+
+    /**
+     * 获取快手大盘数据报表
+     *
+     * @param json
+     * @return
+     */
+
+    @Override
+    public List<JSONObject> getKuaiShouMaterialMarket(JSONObject json) {
+
+        List<JSONObject> marketJsonList = new ArrayList<>();
+        try {
+            if (Check.isNull(json)) {
+                return null;
+            }
+
+            String userId = json.getString("userId");
+            if (Check.isNull(userId)) {
+                return null;
+            }
+            String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
+            String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+            String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+            Integer type = json.getInteger("type");
+            Map<String, Object> paramsMap = new HashMap<>();
+            if ("operator".equals(roleCode)) {
+                paramsMap.put("userId", userId);
+            }
+            if (type == 1) { // 今天分时数据
+                Integer maxHour = materialReportMapper.selectMaxHourByDate(nowDate);
+                if (Check.isNull(maxHour) || maxHour == 0) {
+                    return null;
+                }
+                Integer statHour = maxHour - 1;
+                paramsMap.put("startDate", nowDate);
+                paramsMap.put("statHour", statHour);
+                marketJsonList = materialReportMapper.selectByMap(paramsMap);
+
+            } else if (type == 2) {
+                paramsMap.put("startDate", anotherDay);
+                marketJsonList = materialReportMapper.selectByMap(paramsMap);
+
+            } else if (type == 3) {
+                String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -7);
+                paramsMap.put("startDate", anotherDay);
+                paramsMap.put("endDate", endDate);
+                marketJsonList = materialReportMapper.selectDailyByMap(paramsMap);
+
+            } else if (type == 4) {
+                String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -15);
+                paramsMap.put("startDate", anotherDay);
+                paramsMap.put("endDate", endDate);
+                marketJsonList = materialReportMapper.selectDailyByMap(paramsMap);
+
+            } else if (type == 5) {// 近一个月
+                String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -1);
+                paramsMap.put("startDate", anotherDay);
+                paramsMap.put("endDate", endDate);
+                marketJsonList = materialReportMapper.selectDailyByMap(paramsMap);
+
+            } else if (type == 6) {// 近三个月
+                String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -3);
+                paramsMap.put("startDate", anotherDay);
+                paramsMap.put("endDate", endDate);
+                marketJsonList = materialReportMapper.selectDailyByMap(paramsMap);
+
+            } else if (type == 7) {// 近六个月
+                String endDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -6);
+                paramsMap.put("startDate", anotherDay);
+                paramsMap.put("endDate", endDate);
+                marketJsonList = materialReportMapper.selectDailyByMap(paramsMap);
+
+            } else if (type == 8) {  // 所有
+                marketJsonList = materialReportMapper.selectDailyByMap(paramsMap);
+
+            } else if (type == 9) {  // 自定义查询日期
+                String startDate = json.getString("startDate");
+                String endDate = json.getString("endDate");
+                paramsMap.put("startDate", startDate);
+                paramsMap.put("endDate", endDate);
+                marketJsonList = materialReportMapper.selectDailyByMap(paramsMap);
+
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return marketJsonList;
+    }
+
+    /**
+     * 获取 环比
+     *
+     * @param json
+     * @return
+     */
+    @Override
+    public JSONObject getKuaiShouChainRatio(JSONObject json) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(json)) {
+                return null;
+            }
+
+            String signature = json.getString("signature");
+            if (Check.isNull(signature)) {
+                return null;
+            }
+            Integer type = json.getInteger("type");
+            String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+            String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+            Map<String, Object> paramsMap = new HashMap<>();
+            paramsMap.put("signature", signature);
+            String beContrastDate = "";
+            String contrastStartDate = "";
+            String beContrastStartDate = "";
+            String beContrastEndDate = "";
+            JSONObject contrastJson = new JSONObject();
+            JSONObject beContrastJson = new JSONObject();
+            if (type == 1) {
+                Integer maxHour = materialReportMapper.selectMaxHourByDate(nowDate);
+                Integer statHour = maxHour - 1;
+                paramsMap.put("statDate", nowDate);
+                paramsMap.put("statHour", statHour);
+
+                contrastJson = materialReportMapper.selectChainRatioByMap(paramsMap);
+                if (!Check.isNull(contrastJson)) {
+                    paramsMap.put("statDate", anotherDay);
+                    beContrastJson = materialReportMapper.selectChainRatioByMap(paramsMap);
+                }
+
+            } else if (type == 2) { // 昨天数据
+                paramsMap.put("statDate", anotherDay);
+                contrastJson = materialReportMapper.selectDailyChainRatioByMap(paramsMap);
+
+                if (!Check.isNull(contrastJson)) {
+                    beContrastDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -1);
+                    paramsMap.put("statDate", beContrastDate);
+                    beContrastJson = materialReportMapper.selectDailyChainRatioByMap(paramsMap);
+                }
+
+            } else if (type == 3) { // 近一周数据
+                contrastStartDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -7);
+                paramsMap.put("startDate", contrastStartDate);
+                paramsMap.put("endDate", anotherDay);
+                contrastJson = materialReportMapper.selectDailyChainRatioByMap(paramsMap);
+                if (!Check.isNull(contrastJson)) {
+                    beContrastEndDate = DateUtils.getAnotherDay("yyyy-MM-dd", contrastStartDate, -1);
+                    beContrastStartDate = DateUtils.getAnotherDay("yyyy-MM-dd", beContrastEndDate, -7);
+                    paramsMap.put("endDate", beContrastEndDate);
+                    paramsMap.put("startDate", beContrastStartDate);
+                    beContrastJson = materialReportMapper.selectDailyChainRatioByMap(paramsMap);
+                }
+
+            } else if (type == 4) { //  近15天数据
+
+                contrastStartDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -15);
+                paramsMap.put("startDate", contrastStartDate);
+                paramsMap.put("endDate", anotherDay);
+                contrastJson = materialReportMapper.selectDailyChainRatioByMap(paramsMap);
+
+                if (!Check.isNull(contrastJson)) {
+                    beContrastEndDate = DateUtils.getAnotherDay("yyyy-MM-dd", contrastStartDate, -1);
+                    beContrastStartDate = DateUtils.getAnotherDay("yyyy-MM-dd", beContrastEndDate, -15);
+                    paramsMap.put("endDate", beContrastEndDate);
+                    paramsMap.put("startDate", beContrastStartDate);
+                    beContrastJson = materialReportMapper.selectDailyChainRatioByMap(paramsMap);
+                }
+
+            } else if (type == 5) { // 近 一月数据
+                contrastStartDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -1);
+                paramsMap.put("startDate", contrastStartDate);
+                paramsMap.put("endDate", anotherDay);
+                contrastJson = materialReportMapper.selectDailyChainRatioByMap(paramsMap);
+                if (!Check.isNull(contrastJson)) {
+                    beContrastEndDate = DateUtils.getAnotherDay("yyyy-MM-dd", contrastStartDate, -1);
+                    beContrastStartDate = DateUtils.getMonthBefore("yyyy-MM-dd", beContrastEndDate, -1);
+                    paramsMap.put("endDate", beContrastEndDate);
+                    paramsMap.put("startDate", beContrastStartDate);
+                    beContrastJson = materialReportMapper.selectDailyChainRatioByMap(paramsMap);
+                }
+
+            } else if (type == 6) { // 近三月数据
+                contrastStartDate = DateUtils.getMonthBefore("yyyy-MM-dd", anotherDay, -3);
+                paramsMap.put("startDate", contrastStartDate);
+                paramsMap.put("endDate", anotherDay);
+                contrastJson = materialReportMapper.selectDailyChainRatioByMap(paramsMap);
+
+                if (!Check.isNull(contrastJson)) {
+                    beContrastEndDate = DateUtils.getAnotherDay("yyyy-MM-dd", contrastStartDate, -1);
+                    beContrastStartDate = DateUtils.getMonthBefore("yyyy-MM-dd", beContrastEndDate, -3);
+                    paramsMap.put("endDate", beContrastEndDate);
+                    paramsMap.put("startDate", beContrastStartDate);
+                    beContrastJson = materialReportMapper.selectDailyChainRatioByMap(paramsMap);
+                }
+
+            }
+
+            if (!Check.isNull(contrastJson) && !Check.isNull(beContrastJson)) {
+                if (type == 1) {
+                    contrastJson.put("statDate", nowDate);
+                    beContrastJson.put("statDate", anotherDay);
+                } else if (type == 2) {
+                    contrastJson.put("statDate", anotherDay);
+                    beContrastJson.put("statDate", beContrastDate);
+                } else {
+                    contrastJson.put("startDate", contrastStartDate);
+                    contrastJson.put("endDate", anotherDay);
+                    beContrastJson.put("startDate", beContrastStartDate);
+                    beContrastJson.put("endDate", beContrastEndDate);
+                }
+
+                returnJson.put("contrast", contrastJson);
+                returnJson.put("beContrast", beContrastJson);
+
+
+                JSONObject chainRatioJson = new JSONObject();
+                BigDecimal contrastCost = contrastJson.getBigDecimal("cost");
+                BigDecimal beContrastCost = beContrastJson.getBigDecimal("cost");
+                if (!Check.isNull(contrastCost) && !Check.isNull(beContrastCost)) {
+                    if (beContrastCost.compareTo(new BigDecimal(0)) != 0) {
+                        BigDecimal costProportion = (contrastCost.subtract(beContrastCost)).divide(beContrastCost, BigDecimal.ROUND_HALF_UP, 2);
+                        chainRatioJson.put("costProportion", costProportion);
+                    } else {
+                        chainRatioJson.put("costProportion", 0);
+                    }
+                } else {
+                    chainRatioJson.put("costProportion", 0);
+                }
+
+
+                Long contrastPhotoShow = contrastJson.getLong("photoShow");
+                Long beContrastPhotoShow = beContrastJson.getLong("photoShow");
+                if (!Check.isNull(contrastPhotoShow) && !Check.isNull(beContrastPhotoShow)) {
+                    if (beContrastPhotoShow != 0L) {
+                        double showProportion = (contrastPhotoShow.doubleValue() - beContrastPhotoShow.doubleValue()) / beContrastPhotoShow.doubleValue();
+                        chainRatioJson.put("showProportion", showProportion);
+                    } else {
+                        chainRatioJson.put("showProportion", 0);
+                    }
+                } else {
+                    chainRatioJson.put("showProportion", 0);
+                }
+
+
+                Long contrastPhotoClick = contrastJson.getLong("photoClick");
+                Long beContrastPhotoClick = beContrastJson.getLong("photoClick");
+                if (!Check.isNull(contrastPhotoClick) && !Check.isNull(beContrastPhotoClick)) {
+                    if (beContrastPhotoClick != 0L) {
+                        double photoClickProportion = (contrastPhotoClick.doubleValue() - beContrastPhotoClick.doubleValue()) / beContrastPhotoClick.doubleValue();
+                        chainRatioJson.put("photoClickProportion", photoClickProportion);
+                    } else {
+                        chainRatioJson.put("photoClickProportion", 0);
+                    }
+                } else {
+                    chainRatioJson.put("photoClickProportion", 0);
+                }
+
+                Long contrastAClick = contrastJson.getLong("aclick");
+                Long beContrastAClick = beContrastJson.getLong("aclick");
+                if (!Check.isNull(contrastAClick) && !Check.isNull(beContrastAClick)) {
+                    if (beContrastAClick != 0L) {
+                        double aClickProportion = (contrastAClick.doubleValue() - beContrastAClick.doubleValue()) / beContrastAClick.doubleValue();
+                        chainRatioJson.put("aClickProportion", aClickProportion);
+                    } else {
+                        chainRatioJson.put("aClickProportion", 0);
+                    }
+                } else {
+                    chainRatioJson.put("aClickProportion", 0);
+                }
+
+
+                Long contrastBClick = contrastJson.getLong("bclick");
+                Long beContrastBClick = beContrastJson.getLong("bclick");
+                if (!Check.isNull(contrastBClick) && !Check.isNull(beContrastBClick)) {
+                    if (beContrastBClick != 0L) {
+                        double bClickProportion = (contrastBClick.doubleValue() - beContrastBClick.doubleValue()) / beContrastBClick.doubleValue();
+                        chainRatioJson.put("bClickProportion", bClickProportion);
+                    } else {
+                        chainRatioJson.put("bClickProportion", 0);
+                    }
+                } else {
+                    chainRatioJson.put("bClickProportion", 0);
+                }
+
+
+                BigDecimal contrastPhotoClickCost = contrastJson.getBigDecimal("photoClickCost");
+                BigDecimal beContrastPhotoClickCost = beContrastJson.getBigDecimal("photoClickCost");
+                if (!Check.isNull(contrastPhotoClickCost) && !Check.isNull(beContrastPhotoClickCost)) {
+                    if (beContrastPhotoClickCost.compareTo(new BigDecimal(0)) != 0) {
+                        BigDecimal photoClickCostProportion = (contrastPhotoClickCost.subtract(beContrastPhotoClickCost)).divide(beContrastPhotoClickCost, BigDecimal.ROUND_HALF_UP, 2);
+                        chainRatioJson.put("photoClickCostProportion", photoClickCostProportion);
+                    } else {
+                        chainRatioJson.put("photoClickCostProportion", 0);
+                    }
+                } else {
+                    chainRatioJson.put("photoClickCostProportion", 0);
+                }
+
+
+                BigDecimal contrastPhotoClickRatio = contrastJson.getBigDecimal("photoClickRatio");
+                BigDecimal beContrastPhotoClickRatio = beContrastJson.getBigDecimal("photoClickRatio");
+                if (!Check.isNull(contrastPhotoClickRatio) && !Check.isNull(beContrastPhotoClickRatio)) {
+                    if (beContrastPhotoClickRatio.compareTo(new BigDecimal(0)) != 0) {
+                        BigDecimal photoClickRatioProportion = (contrastPhotoClickRatio.subtract(beContrastPhotoClickRatio)).divide(beContrastPhotoClickRatio, BigDecimal.ROUND_HALF_UP, 2);
+                        chainRatioJson.put("photoClickRatioProportion", photoClickRatioProportion);
+                    } else {
+                        chainRatioJson.put("photoClickRatioProportion", 0);
+                    }
+                } else {
+                    chainRatioJson.put("photoClickRatioProportion", 0);
+                }
+
+
+                BigDecimal contrastActionCost = contrastJson.getBigDecimal("actionCost");
+                BigDecimal beContrastActionCost = beContrastJson.getBigDecimal("actionCost");
+                if (!Check.isNull(contrastActionCost) && !Check.isNull(beContrastActionCost)) {
+                    if (beContrastActionCost.compareTo(new BigDecimal(0)) != 0) {
+                        BigDecimal actionCostProportion = (contrastActionCost.subtract(beContrastActionCost)).divide(beContrastActionCost, BigDecimal.ROUND_HALF_UP, 2);
+                        chainRatioJson.put("actionCostProportion", actionCostProportion);
+                    } else {
+                        chainRatioJson.put("actionCostProportion", 0);
+                    }
+                } else {
+                    chainRatioJson.put("actionCostProportion", 0);
+                }
+
+
+                // 封面点击率
+                BigDecimal contrastActionRatio = contrastJson.getBigDecimal("actionRatio");
+                BigDecimal beContrastActionRatio = beContrastJson.getBigDecimal("actionRatio");
+                if (!Check.isNull(contrastActionRatio) && !Check.isNull(beContrastActionRatio)) {
+                    if (beContrastActionRatio.compareTo(new BigDecimal(0)) != 0) {
+                        BigDecimal actionRatioProportion = (contrastActionRatio.subtract(beContrastActionRatio)).divide(beContrastActionRatio, BigDecimal.ROUND_HALF_UP, 2);
+                        chainRatioJson.put("actionRatioProportion", actionRatioProportion);
+                    } else {
+                        chainRatioJson.put("actionRatioProportion", 0);
+                    }
+                } else {
+                    chainRatioJson.put("actionRatioProportion", 0);
+                }
+
+                // 千次花费
+                BigDecimal contrastImpression1kCost = contrastJson.getBigDecimal("impression1kCost");
+                BigDecimal beContrastImpression1kCost = beContrastJson.getBigDecimal("impression1kCost");
+                if (!Check.isNull(contrastImpression1kCost) && !Check.isNull(beContrastImpression1kCost)) {
+                    if (beContrastImpression1kCost.compareTo(new BigDecimal(0)) != 0) {
+                        BigDecimal impression1kCostProportion = (contrastImpression1kCost.subtract(beContrastImpression1kCost)).divide(beContrastImpression1kCost, BigDecimal.ROUND_HALF_UP, 2);
+                        chainRatioJson.put("impression1kCostProportion", impression1kCostProportion);
+                    } else {
+                        chainRatioJson.put("impression1kCostProportion", 0);
+                    }
+                } else {
+                    chainRatioJson.put("impression1kCostProportion", 0);
+                }
+
+
+                Long contrastConversions = contrastJson.getLong("conversions"); // 转化书
+                Long beContrastConversions = beContrastJson.getLong("conversions");
+
+                if (!Check.isNull(contrastConversions) && !Check.isNull(beContrastConversions)) {
+                    if (beContrastConversions != 0L) {
+                        double conversionsProportion = (contrastConversions.doubleValue() - beContrastConversions.doubleValue()) / beContrastConversions.doubleValue();
+                        chainRatioJson.put("conversionsProportion", conversionsProportion);
+                    } else {
+                        chainRatioJson.put("conversionsProportion", 0);
+                    }
+                } else {
+                    chainRatioJson.put("conversionsProportion", 0);
+                }
+
+
+                BigDecimal contrastConversionPrice = contrastJson.getBigDecimal("conversionPrice"); // 转化单价
+                BigDecimal beContrastConversionPrice = beContrastJson.getBigDecimal("conversionPrice");
+                if (!Check.isNull(contrastConversionPrice) && !Check.isNull(beContrastConversionPrice)) {
+                    if (beContrastConversionPrice.compareTo(new BigDecimal(0)) != 0) {
+                        BigDecimal conversionPriceProportion = (contrastConversionPrice.subtract(beContrastConversionPrice)).divide(beContrastConversionPrice, BigDecimal.ROUND_HALF_UP, 2);
+                        chainRatioJson.put("conversionPriceProportion", conversionPriceProportion);
+                    } else {
+                        chainRatioJson.put("conversionPriceProportion", 0);
+                    }
+                } else {
+                    chainRatioJson.put("conversionPriceProportion", 0);
+                }
+                returnJson.put("chainRatio", chainRatioJson);
+            }
+
+
+            return returnJson;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return returnJson;
+    }
+
+
 }