Переглянути джерело

Merge branch 'master' into test

# Conflicts:
#	jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
yumeng 4 роки тому
батько
коміт
5a79cf6a27
36 змінених файлів з 1714 додано та 155 видалено
  1. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  2. 3 3
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  3. 3 3
      jeecg-boot-module-system/src/main/resources/jeecg/jeecg_database.properties
  4. 105 67
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  5. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
  6. 25 25
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouAlarmRuleHourlyCheckJob.java
  7. 25 25
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouAlarmRuleMinuteCheckJob.java
  8. 10 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAiAdsNewMaterialCreativityJob.java
  9. 4 0
      module-job-kuaishou/src/main/resources/application-prod.yml
  10. 69 23
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouMaterialControer.java
  11. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouNewCreateCampaign.java
  12. 90 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouNewCreateCampaignServiceImpl.java
  13. 236 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouBatchCampaignTemplateController.java
  14. 248 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouBatchCreativeTemplateController.java
  15. 248 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouBatchGroupTemplateController.java
  16. 105 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouBatchCampaignTemplate.java
  17. 119 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouBatchCreativeTemplate.java
  18. 167 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouBatchGroupTemplate.java
  19. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouBatchCampaignTemplateMapper.java
  20. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouBatchCreativeTemplateMapper.java
  21. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouBatchGroupTemplateMapper.java
  22. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouVideoRelateCreativesMapper.java
  23. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouBatchCampaignTemplateMapper.xml
  24. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouBatchCreativeTemplateMapper.xml
  25. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouBatchGroupTemplateMapper.xml
  26. 3 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouStrategyMapper.xml
  27. 55 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouVideoRelateCreativesMapper.xml
  28. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouBatchCampaignTemplateService.java
  29. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouBatchCreativeTemplateService.java
  30. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouBatchGroupTemplateService.java
  31. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouVideoRelateCreativesService.java
  32. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouBatchCampaignTemplateServiceImpl.java
  33. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouBatchCreativeTemplateServiceImpl.java
  34. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouBatchGroupTemplateServiceImpl.java
  35. 26 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouVideoRelateCreativesServiceImpl.java
  36. 0 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

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

@@ -183,6 +183,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/ruleGroup/*", "anon");
         filterChainDefinitionMap.put("/kuaishou/material/*", "anon");
         filterChainDefinitionMap.put("/kuaishou/create/*", "anon");
+        filterChainDefinitionMap.put("/template/kuaiShouBatchCampaignTemplate/*", "anon");
 
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);

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

@@ -135,9 +135,9 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true
-          username: data
-          password: hcst@2021
+          url: jdbc:mysql://139.186.151.174:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true
+          username: hcst
+          password: hcst@2020
           driver-class-name: com.mysql.jdbc.Driver
           # 多数据源配置
           #multi-datasource1:

+ 3 - 3
jeecg-boot-module-system/src/main/resources/jeecg/jeecg_database.properties

@@ -1,8 +1,8 @@
 #mysql
 diver_name=com.mysql.jdbc.Driver
-url=jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-username=data
-password=hcst@2021
+url=jdbc:mysql://139.186.151.174:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+username=hcst
+password=hcst@2020
 database_name=jeecg-boot
 #oracle
 #diver_name=oracle.jdbc.driver.OracleDriver

+ 105 - 67
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -6,12 +6,13 @@ import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountTargetTemplate;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountTargetTemplateService;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouNewCreateCampaign;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCommentService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouVideoEtlInfoService;
@@ -21,7 +22,9 @@ import cn.com.ctop.oa.modules.service.IWechatNoListService;
 import cn.com.ctop.oa.modules.service.IWechatUserListService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.report.service.*;
+import com.alibaba.fastjson.JSONArray;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.catalina.User;
 import org.jeecg.common.util.DateUtils;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -35,6 +38,7 @@ import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -53,33 +57,44 @@ public class SampleTest {
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
     @Autowired
-    private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
-    @Autowired
     private ICtopOauthTokenService tokenService;
     @Autowired
-    private IKuaishouInterfaceService iKuaishouInterfaceService;
+    private IKuaiShouVideoGetService videoGetService;
+    @Autowired
+    private IKuaishouVideoRelateCreativesService kuaishouVideoRelateCreativesService;
+    @Autowired
+    private IBindAccountLoginService bindAccountLoginService;
+    @Autowired
+    private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
+
 
     @Test
     public void loadBytedanceCreativeData() throws ParseException {
 
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date parse = simpleDateFormat.parse("2020-12-11");
-        CtopOauthToken tokenByAccountId = oauthTokenService.getTokenByAccountId(5982133L);
-        iKuaishouInterfaceService.getAdvertiserGroupReportDaily(tokenByAccountId, parse, parse);
-
-      /*  QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("media_id", 2);
-        List<CtopOauthToken> list = oauthTokenService.list(queryWrapper);
-        for (CtopOauthToken token : list) {
-            kuaiShouHistoryReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-20", "2020-09-20", "daily");
-        }*/
+        List<KuaiShouVideoGet> KuaiShouVideoGets = videoGetService.selectPhotoIdsByAccountId(9743746L);
+        if (!Check.isNull(KuaiShouVideoGets)) {
+            JSONArray dateList = new JSONArray();
+            JSONArray photoIds = new JSONArray();
+            Map<String, Object> statdateMap = new HashMap<>();
+            int count = 0;
+            for (KuaiShouVideoGet video : KuaiShouVideoGets) {
+                count++;
+                if (count < 10) {
+                    photoIds.add(video.getPhotoId());
+                    statdateMap.put(video.getPhotoId(), video.getStatDate());
+                } else {
+                    photoIds.add(video.getPhotoId());
+                    statdateMap.put(video.getPhotoId(), video.getStatDate());
+                    dateList.add(photoIds);
+                    photoIds = new JSONArray();
+                    count = 0;
+                }
+            }
+            dateList.add(photoIds);
+            kuaishouVideoRelateCreativesService.videoRelateCreatives(9743746L, dateList, statdateMap);
+        }
     }
 
-    @Autowired
-    private IBindAccountLoginService bindAccountLoginService;
-    @Autowired
-    private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
-
     @Test
     public void loadKuaishouCookie() {
         List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY, 1);
@@ -245,9 +260,13 @@ public class SampleTest {
     }
 
     @Test
-    public void testData11(){
-        CtopOauthToken token =tokenService.getTokenByAccountId(1683711016125448L);
-        reportService.getAdvertiserPlanRuleData(token,new Date(),new Date(), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+    public void testData11() {
+        CtopOauthToken token = tokenService.getTokenByAccountId(9556344L);
+        int dimeDiff = 5;
+        Date now = new Date();
+        String startTime = DateUtils.formatDate("2021-01-11 18:25:00");
+        String endTime = DateUtils.formatDate(now, "2021-01-11 18:35:00");
+        kuaishouInterfaceService.getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, startTime, endTime);
     }
 
     @Test
@@ -371,46 +390,39 @@ public class SampleTest {
 
     @Test
     public void execute() {
-        String accountIds = "1675239584963662,1676540490482759,1675237415468045";
-        String[] arrays = accountIds.split(",");
-        for(int i=0;i<arrays.length;i++){
-            Long accountId = Long.parseLong(arrays[i]);
-            CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
-            load12Data(token);
+        List<UserAllocation>  allocations = allocationService.getByMediaId("3");
+        for (UserAllocation allocation:allocations) {
+            CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
+//            load12Data(token);
             load12AccountData(token);
         }
     }
 
-    @Test
-    public void loadBytedanceData(){
-        String accountIds = "1676540490482759";
-        String[] arrays = accountIds.split(",");
-        for(int i=0;i<arrays.length;i++){
-            Long accountId = Long.parseLong(arrays[i]);
-            CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
-            load12Data(token);
-        }
+    private void load12AccountData(CtopOauthToken token) {
+        reportService.getAdvertiserReport(token, DateUtils.parseDate("2020-10-01", "yyyy-MM-dd"), DateUtils.parseDate("2020-10-31", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        reportService.getAdvertiserReport(token, DateUtils.parseDate("2020-11-01", "yyyy-MM-dd"), DateUtils.parseDate("2020-11-30", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        reportService.getAdvertiserReport(token, DateUtils.parseDate("2020-12-01", "yyyy-MM-dd"), DateUtils.parseDate("2020-12-31", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
     }
 
-    private void load12AccountData(CtopOauthToken token){
-        reportService.getAdvertiserReport(token, DateUtils.parseDate("2020-12-01","yyyy-MM-dd"), DateUtils.parseDate("2020-12-11","yyyy-MM-dd"),CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-        reportService.getAdvertiserReport(token, DateUtils.parseDate("2020-12-11","yyyy-MM-dd"), DateUtils.parseDate("2020-12-21","yyyy-MM-dd"),CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-        reportService.getAdvertiserReport(token, DateUtils.parseDate("2020-12-21","yyyy-MM-dd"), DateUtils.parseDate("2020-12-31","yyyy-MM-dd"),CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+    private void load12Data(CtopOauthToken token) {
+//        bytedanceReportService.bytedanceMaterialReport(token, "2020-10-01", "2020-10-05");
+//        bytedanceReportService.bytedanceMaterialReport(token, "2020-10-06", "2020-10-10");
+//        bytedanceReportService.bytedanceMaterialReport(token, "2020-10-11", "2020-10-15");
+//        bytedanceReportService.bytedanceMaterialReport(token, "2020-10-16", "2020-10-20");
+//        bytedanceReportService.bytedanceMaterialReport(token, "2020-10-21", "2020-10-25");
+//        bytedanceReportService.bytedanceMaterialReport(token, "2020-10-26", "2020-10-31");
+        bytedanceReportService.bytedanceMaterialReport(token, "2020-10-03", "2020-10-04");
     }
 
-    private void load12Data(CtopOauthToken token){
-        bytedanceReportService.bytedanceMaterialReport(token, "2020-12-01", "2020-12-11");
-        bytedanceReportService.bytedanceMaterialReport(token, "2020-12-11", "2020-12-21");
-        bytedanceReportService.bytedanceMaterialReport(token, "2020-12-21", "2020-12-31");
-    }
     @Autowired
     private IKuaishouVideoEtlInfoService kuaishouVideoEtlInfoService;
+
     @Test
-    public void etlKuaishouData(){
-        String dateString = "2020-12-31";
-        Date startDate = DateUtils.parseDate(dateString,"yyyy-MM-dd");
-        for(int i=0;i<=10;i++){
-            Date getDate = DateUtils.addDay(startDate,i);
+    public void etlKuaishouData() {
+        String dateString = "2021-01-05";
+        Date startDate = DateUtils.parseDate(dateString, "yyyy-MM-dd");
+        for (int i = 0; i <= 10; i++) {
+            Date getDate = DateUtils.addDay(startDate, i);
             kuaishouVideoEtlInfoService.etlKuaishouVideoInfo(getDate);
             bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(getDate);
         }
@@ -420,43 +432,69 @@ public class SampleTest {
     private IBytedanceVideoEtlInfoService bytedanceVideoEtlInfoService;
 
     @Test
-    public void loadBytedanceVideo(){
+    public void loadBytedanceVideo() {
         CtopOauthToken token = tokenService.getTokenByAccountId(1673731601820686L);
-        for(int i=15;i<60;i++){
-            reportService.getAdvertiserReport(token,DateUtils.addDay(new Date(),-i),DateUtils.addDay(new Date(),-i),CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        for (int i = 15; i < 60; i++) {
+            reportService.getAdvertiserReport(token, DateUtils.addDay(new Date(), -i), DateUtils.addDay(new Date(), -i), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         }
     }
 
     @Test
-    public void loadKuaishouVideo(){
+    public void loadKuaishouVideo() {
         Date date = new Date();
         CtopOauthToken token = tokenService.getTokenByAccountId(9556344L);
 //        kuaishouInterfaceService.getAdvertiserCreativeReportDaily(token, new Date(), new Date(), null, null);
-        kuaishouInterfaceService.getVideoList(token, DateUtils.formatDate(DateUtils.addDay(date,-5)), DateUtils.formatDate(date));
+        kuaishouInterfaceService.getVideoList(token, DateUtils.formatDate(DateUtils.addDay(date, -5)), DateUtils.formatDate(date));
         // 获取图片信息数据
 //        kuaishouInterfaceService.getImageList(token, DateUtils.getNowDate("yyyy-MM-dd"));
     }
 
 
-
-
     @Autowired
     IRuleByteDanceAccountService ruleByteDanceAccountService;
 
     @Test
-    public void cleanRuleDataAccount(){
+    public void cleanRuleDataAccount() {
         List<CtopOauthToken> tokens = oauthTokenService.selectKuaiShouToken();
-        for(CtopOauthToken oauthToken:tokens){
-            ruleKuaiShouPlanService.cleanRuleDataTarget(oauthToken.getAccountId(),1);
+        for (CtopOauthToken oauthToken : tokens) {
+            ruleKuaiShouPlanService.cleanRuleDataTarget(oauthToken.getAccountId(), 1);
         }
     }
 
     @Autowired
     IAiKuaishouNewCreateCampaign aiKuaishouNewCreateCampaign;
+    @Autowired
+    private IAiKuaishouAccountTargetTemplateService aiKuaishouAccountTargetTemplateService;
+
+    @Test
+    public void createPlan() {
+        List<AiKuaishouAccountTargetTemplate> accountTargetTemplates = aiKuaishouAccountTargetTemplateService.getAllEffectTemplate();
+        if (null == accountTargetTemplates || accountTargetTemplates.isEmpty()) {
+            return;
+        }
+        accountTargetTemplates.forEach(targetTemplate -> aiKuaishouNewCreateCampaign.kuaishouAiAdsNewMaterialCreativity(targetTemplate));
+    }
 
     @Test
-    public void kuaishouAiTest(){
-        aiKuaishouNewCreateCampaign.kuaishouAiAdsNewMaterialCreativity(null);
+    public void testCreatePlan() {
+//        List<AiKuaishouAccountTargetTemplate> accountTargetTemplates = aiKuaishouAccountTargetTemplateService.getAllEffectTemplate();
+//        if (null == accountTargetTemplates || accountTargetTemplates.isEmpty()) {
+//            return;
+//        }
+        AiKuaishouAccountTargetTemplate accountTargetTemplate1 = aiKuaishouAccountTargetTemplateService.getById(30002);
+        aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate1);
+
+        AiKuaishouAccountTargetTemplate accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(30001);
+        aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2);
     }
 
+    @Test
+    public void etlKuaishouProjectData(){
+        String dateString = "2020-03-17";
+        Date startDate = DateUtils.parseDate(dateString,"yyyy-MM-dd");
+        for(int i=0;i<=365;i++){
+            Date getDate = DateUtils.addDay(startDate,i);
+            kuaishouVideoEtlInfoService.etlKuaishouVideoInfoGroupByProjectId(getDate);
+        }
+    }
 }

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

@@ -92,6 +92,7 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
         if ("".equals(mediaId)) {
             queryWrapper.eq("media_id", mediaId);
         }
+        queryWrapper.eq("account_status",0);
         queryWrapper.orderByDesc("id");
         return this.list(queryWrapper);
     }

+ 25 - 25
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouAlarmRuleHourlyCheckJob.java

@@ -1,25 +1,25 @@
-package cn.com.ctop.job.kuaishou.handler;
-
-import cn.com.ctop.alarm.modules.service.IAlarmEventSendService;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import org.quartz.JobExecutionException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class KuaiShouAlarmRuleHourlyCheckJob {
-    @Autowired
-    private IAlarmEventSendService alarmEventSendService;
-
-    /**
-     * 定时获取成本数据
-     *
-     * @throws JobExecutionException
-     */
-    @XxlJob("kuaiShouAlarmRuleHourlyCheckJob")
-    public void execute() throws Exception {
-        //检查频率 HOUR - 每小时;HALF_HOUR-每半小时
-        alarmEventSendService.matchAlarmRules("HOUR");
-    }
-}
-
+//package cn.com.ctop.job.kuaishou.handler;
+//
+//import cn.com.ctop.alarm.modules.service.IAlarmEventSendService;
+//import com.xxl.job.core.handler.annotation.XxlJob;
+//import org.quartz.JobExecutionException;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Component;
+//
+//@Component
+//public class KuaiShouAlarmRuleHourlyCheckJob {
+//    @Autowired
+//    private IAlarmEventSendService alarmEventSendService;
+//
+//    /**
+//     * 定时获取成本数据
+//     *
+//     * @throws JobExecutionException
+//     */
+//    @XxlJob("kuaiShouAlarmRuleHourlyCheckJob")
+//    public void execute() throws Exception {
+//        //检查频率 HOUR - 每小时;HALF_HOUR-每半小时
+//        alarmEventSendService.matchAlarmRules("HOUR");
+//    }
+//}
+//

+ 25 - 25
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouAlarmRuleMinuteCheckJob.java

@@ -1,25 +1,25 @@
-package cn.com.ctop.job.kuaishou.handler;
-
-import cn.com.ctop.alarm.modules.service.IAlarmEventSendService;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import org.quartz.JobExecutionException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class KuaiShouAlarmRuleMinuteCheckJob {
-    @Autowired
-    private IAlarmEventSendService alarmEventSendService;
-
-    /**
-     * 定时获取成本数据
-     *
-     * @throws JobExecutionException
-     */
-    @XxlJob("kuaiShouAlarmRuleMinuteCheckJob")
-    public void execute(String param) throws Exception {
-        //检查频率 HOUR - 每小时;HALF_HOUR-每半小时
-        alarmEventSendService.matchAlarmRules("HALF_HOUR");
-    }
-}
-
+//package cn.com.ctop.job.kuaishou.handler;
+//
+//import cn.com.ctop.alarm.modules.service.IAlarmEventSendService;
+//import com.xxl.job.core.handler.annotation.XxlJob;
+//import org.quartz.JobExecutionException;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Component;
+//
+//@Component
+//public class KuaiShouAlarmRuleMinuteCheckJob {
+//    @Autowired
+//    private IAlarmEventSendService alarmEventSendService;
+//
+//    /**
+//     * 定时获取成本数据
+//     *
+//     * @throws JobExecutionException
+//     */
+//    @XxlJob("kuaiShouAlarmRuleMinuteCheckJob")
+//    public void execute(String param) throws Exception {
+//        //检查频率 HOUR - 每小时;HALF_HOUR-每半小时
+//        alarmEventSendService.matchAlarmRules("HALF_HOUR");
+//    }
+//}
+//

+ 10 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAiAdsNewMaterialCreativityJob.java

@@ -25,6 +25,16 @@ public class KuaishouAiAdsNewMaterialCreativityJob {
         accountTargetTemplates.forEach(targetTemplate -> aiKuaishouNewCreateCampaign.kuaishouAiAdsNewMaterialCreativity(targetTemplate));
     }
 
+
+    @XxlJob("kuaishouAiAddNewMaterialCreativityJob")
+    public void kuaishouAiAddNewMaterialCreativityJob() {
+        List<AiKuaishouAccountTargetTemplate> accountTargetTemplates = aiKuaishouAccountTargetTemplateService.getAllEffectTemplate();
+        if(null==accountTargetTemplates||accountTargetTemplates.isEmpty()){
+            return;
+        }
+        accountTargetTemplates.forEach(targetTemplate -> aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(targetTemplate));
+    }
+
     @XxlJob("kuaishouAiAdsHotMaterialCreativityJob")
     public void kuaishouAiAdsHotMaterialCreativityJob() {
         List<AiKuaishouAccountTargetTemplate> accountTargetTemplates = aiKuaishouAccountTargetTemplateService.getAllEffectTemplate();

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

@@ -228,3 +228,7 @@ xxl:
       logretentiondays: 30
     admin:
       addresses: http://139.186.29.76:8090/xxl-job-admin
+ai:
+  callback:
+    callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
+    callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative

+ 69 - 23
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouMaterialControer.java

@@ -104,9 +104,14 @@ public class KuaiShouMaterialControer {
     }
 
 
+    /**
+     * 历史素材
+     *
+     * @param requestJson
+     * @return
+     */
     @PostMapping(value = "/getHistoryVideoList")
     public JSONObject getHistoryVideoList(@RequestBody JSONObject requestJson) {
-        System.err.println(requestJson);
         JSONObject returnJson = new JSONObject();
         try {
             if (Check.isNull(requestJson)) {
@@ -116,8 +121,6 @@ public class KuaiShouMaterialControer {
             if (Check.isNull(accountId)) {
                 throw new Exception("账户id不能为空");
             }
-
-
             String startDate = requestJson.getString("startDate");
             if (Check.isNull(startDate)) {
                 throw new Exception("请输入开始查询时间");
@@ -127,17 +130,14 @@ public class KuaiShouMaterialControer {
             if (Check.isNull(endDate)) {
                 throw new Exception("请输入结束查询时间");
             }
-
             Integer createCount = requestJson.getInteger("createCount");
             if (Check.isNull(createCount) || createCount == 0) {
                 throw new Exception("请输入最小关联数");
             }
-
             Integer num = requestJson.getInteger("num");
             if (Check.isNull(num) || num == 0) {
                 throw new Exception("请输入查询条数");
             }
-
             Map<String, Object> requestMap = new HashMap<>();
             requestMap.put("startTime", startDate);
             requestMap.put("endTime", endDate);
@@ -174,6 +174,12 @@ public class KuaiShouMaterialControer {
     }
 
 
+    /**
+     * 历史Top素材
+     *
+     * @param requestJson
+     * @return
+     */
     @PostMapping(value = "/getHistoryTopVideoList")
     public JSONObject getHistoryTopVideoList(@RequestBody JSONObject requestJson) {
         JSONObject returnJson = new JSONObject();
@@ -185,35 +191,75 @@ public class KuaiShouMaterialControer {
             if (Check.isNull(accountId)) {
                 throw new Exception("账户id不能为空");
             }
-
-
-            String startDate = requestJson.getString("startDate");
+            String startDate = requestJson.getString("startTime");
             if (Check.isNull(startDate)) {
                 throw new Exception("请输入开始查询时间");
             }
-
-            String endDate = requestJson.getString("endDate");
+            String endDate = requestJson.getString("endTime");
             if (Check.isNull(endDate)) {
                 throw new Exception("请输入结束查询时间");
             }
-
-            Integer createCount = requestJson.getInteger("createCount");
-            if (Check.isNull(createCount) || createCount == 0) {
-                throw new Exception("请输入最小关联数");
-            }
-
             Integer num = requestJson.getInteger("num");
             if (Check.isNull(num) || num == 0) {
                 throw new Exception("请输入查询条数");
             }
-
             Map<String, Object> requestMap = new HashMap<>();
-            requestMap.put("startTime", startDate);
-            requestMap.put("endTime", endDate);
+            requestMap.put("startDate", startDate);
+            requestMap.put("endDate", endDate);
             requestMap.put("accountId", accountId);
             requestMap.put("num", num);
-            requestMap.put("createCount", createCount);
-            List<JSONObject> materialList = relateCreativesService.getVideoListByMap(requestMap);
+            List<JSONObject> materialList = relateCreativesService.getHistoryTopVideoList(requestMap);
+            if (!Check.isNull(materialList)) {
+                for (int i = 0; i < materialList.size(); i++) {
+                    JSONObject materialJson = materialList.get(i);
+                    String signature = materialJson.getString("signature");
+                    List<String> imageList = lastTimeService.getImageListByMd5(signature);
+                    materialJson.put("imageList", imageList);
+
+                }
+                returnJson.put("code", 0);
+                returnJson.put("message", "SUCCESS");
+                returnJson.put("data", materialList);
+            } else {
+                returnJson.put("code", -1);
+                returnJson.put("message", "暂未历史爆量素材");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+    }
+
+
+    /**
+     * 关联创意数为0素材
+     *
+     * @param requestJson
+     * @return
+     */
+    @PostMapping(value = "/getCreateZeroVideoList")
+    public JSONObject getHistoryCreateVideoList(@RequestBody JSONObject requestJson) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(requestJson)) {
+                throw new Exception("入参不能为空");
+            }
+            Long accountId = requestJson.getLong("accountId");
+            if (Check.isNull(accountId)) {
+                throw new Exception("账户id不能为空");
+            }
+
+            Integer videoCnt = requestJson.getInteger("videoCnt");
+            if (Check.isNull(videoCnt)) {
+                throw new Exception("请输入查询条数");
+            }
+            Map<String, Object> requestMap = new HashMap<>();
+            requestMap.put("accountId", accountId);
+            requestMap.put("creativeCount", 0);
+            requestMap.put("videoCnt", videoCnt);
+            List<JSONObject> materialList = relateCreativesService.getVideoZeroListByMap(requestMap);
             if (!Check.isNull(materialList)) {
                 for (int i = 0; i < materialList.size(); i++) {
                     JSONObject materialJson = materialList.get(i);
@@ -232,7 +278,7 @@ public class KuaiShouMaterialControer {
                 returnJson.put("data", materialList);
             } else {
                 returnJson.put("code", -1);
-                returnJson.put("message", "暂未新上素材");
+                returnJson.put("message", "暂未关联创意数为0素材");
             }
         } catch (Exception e) {
             e.printStackTrace();

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

@@ -6,4 +6,6 @@ public interface IAiKuaishouNewCreateCampaign {
     void kuaishouAiAdsNewMaterialCreativity(AiKuaishouAccountTargetTemplate targetTemplate);
 
     void kuaishouAiAdsHotMaterialCreativity(AiKuaishouAccountTargetTemplate targetTemplate);
+
+    void kuaishouAiAddNewMaterialCreativity(AiKuaishouAccountTargetTemplate targetTemplate);
 }

+ 90 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouNewCreateCampaignServiceImpl.java

@@ -12,11 +12,9 @@ import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouNewCreateCampaign;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouStrategyMapCreativeService;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouVideoRelateCreatives;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouVideoGetMapper;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
-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 com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
@@ -225,6 +223,94 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
 
     }
 
+    @Autowired
+    private IKuaishouVideoRelateCreativesService relateCreativesService;
+    @Override
+    public void kuaishouAiAddNewMaterialCreativity(AiKuaishouAccountTargetTemplate targetTemplate) {
+        Long accountId = targetTemplate.getAccountId();
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId.toString());
+        if(null == token){
+            log.info("token获取失败=>accountId:{}",accountId);
+            return;
+        }
+        kuaishouInterfaceService.getVideoList(token, DateUtils.date2Str(),DateUtils.date2Str());
+
+        //获取创意关联数为0的素材
+        List<KuaishouVideoRelateCreatives> kuaishouVideoRelateCreatives = relateCreativesService.listByParams(accountId);
+        if(null == kuaishouVideoRelateCreatives||kuaishouVideoRelateCreatives.isEmpty()){
+            log.info("账户:{}, 不存在未创建创意素材",accountId);
+            return;
+        }
+
+        //2、判断该账户下当天有没有“上新”计划,没有则创建一个“上新”计划
+        JSONArray campaignList = kuaishouInterfaceService.getCampaignList(token, new Date(), new Date(),1);
+        boolean isHaveNewCampaign = false;
+        Long newCampaignId = 0L;
+        if (null!=campaignList&&campaignList.size()>0){
+            for(int i = 0;i<campaignList.size();i++){
+                JSONObject jsonObject = campaignList.getJSONObject(i);
+                if (jsonObject.getString("campaign_name").contains("素材上新")){
+                    isHaveNewCampaign = true;
+                    newCampaignId = jsonObject.getLong("campaign_id");
+                    break;
+                }
+            }
+        }
+        // 不存在“上新”计划,则创建一个计划
+        if (!isHaveNewCampaign){
+            Date campaignDate = new Date();
+            String timestamp = DateUtils.formatDate(campaignDate,"yyyyMMddHHmmss");
+            JSONObject campaignParams = new JSONObject();
+            campaignParams.put("advertiser_id",token.getAccountId());
+            String campaignName = targetTemplate.getTitlePrefix() + "素材上新"+ targetTemplate.getTitleMiddle()+ timestamp;
+            campaignParams.put("campaign_name",campaignName);
+            campaignParams.put("type",Integer.parseInt(targetTemplate.getMarketingGoal()));
+            campaignParams.put("day_budget",0L);
+            Map<String, Object> campaignCreateResult = kuaishouInterfaceService.campaignCreate(token.getAccessToken(), token.getAccountId(), campaignParams);
+            Integer code = (Integer) campaignCreateResult.get("code");
+            String message = (String) campaignCreateResult.get("message");
+            if(code != 0 ){
+                log.info("计划创建失败=>message:{}",message);
+                return;
+            }
+            newCampaignId = (Long) campaignCreateResult.get("campaignId");
+        }
+
+        //3、在“上新”计划中新增广告组,一个素材搭配5张封面,组成一个广告组
+        String timestamp = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss");
+        String unitNamePrefix = targetTemplate.getTitlePrefix() + "素材上新"+ targetTemplate.getTitleMiddle()+ timestamp;
+        int unitCnt = 0;
+        for(KuaishouVideoRelateCreatives videoItem: kuaishouVideoRelateCreatives){
+            unitCnt ++;
+            KuaiShouVideoGet videoGet = videoGetService.getVideoByPhotoId(videoItem.getPhotoId());
+            if(null == videoGet){
+                log.info("未获取到视频信息=>photoId:{}",videoItem.getPhotoId());
+                continue;
+            }
+            // 每个组,搭配5个创意
+            List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoGet.getSignature());
+            List<MaterialImageInfo> orgFrameList = materialImageInfoService.getListByVideoSignature(videoGet.getSignature());
+            if ((null == cutFrameList||cutFrameList.isEmpty())&&(null == orgFrameList|| orgFrameList.isEmpty())){
+                log.info("未获取到视频封面=>videoSignature:{}",videoGet.getSignature());
+                continue;
+            }
+            String unitName = unitNamePrefix + "-" + unitCnt;
+            JSONObject unitParams = createUnitParams(token, newCampaignId, targetTemplate, unitName);
+            Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams,1);
+            Integer unitCode = (Integer) unitCreateResult.get("code");
+            String unitMessage = (String) unitCreateResult.get("message");
+            if(unitCode != 0 ){
+                log.info("组创建失败=>accountId:{};message:{}",accountId,unitMessage);
+                continue;
+            }
+            Long unitId = (Long) unitCreateResult.get("unitId");
+            JSONObject creativeParams = creativeParams(token, unitId, videoGet, targetTemplate);
+            createCreativeByImage(cutFrameList, orgFrameList,token, creativeParams, newCampaignId, unitId, videoGet,targetTemplate.getImageNumber());
+            videoItem.setCreativeCount(5);
+            relateCreativesService.updateById(videoItem);
+        }
+    }
+
 
     private JSONObject creativeParams(CtopOauthToken token,Long unitId,KuaiShouVideoGet videoItem,AiKuaishouAccountTargetTemplate targetTemplate){
         JSONObject creativeParams = new JSONObject();

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

@@ -0,0 +1,236 @@
+package cn.com.ctop.kuaishou.modules.batch.controller;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchCampaignTemplate;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouBatchCampaignTemplateService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+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.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 2021-01-19
+ */
+@Slf4j
+@Api(tags = "计划模板")
+@RestController
+@RequestMapping("/template/kuaiShouBatchCampaignTemplate")
+public class KuaiShouBatchCampaignTemplateController {
+    @Autowired
+    private IKuaiShouBatchCampaignTemplateService kuaiShouBatchCampaignTemplateService;
+
+    @AutoLog(value = "计划模板-分页列表查询")
+    @ApiOperation(value = "计划模板-分页列表查询", notes = "计划模板-分页列表查询")
+    @GetMapping(value = "/getCampaignTemplate")
+    public Result<KuaiShouBatchCampaignTemplate> queryPageList(Long accountId) {
+        Result<KuaiShouBatchCampaignTemplate> result = new Result<>();
+        QueryWrapper<KuaiShouBatchCampaignTemplate> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
+        queryWrapper.orderByDesc("create_time");
+        queryWrapper.last("limit 1");
+        KuaiShouBatchCampaignTemplate one = kuaiShouBatchCampaignTemplateService.getOne(queryWrapper);
+        result.setSuccess(true);
+        result.setResult(one);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouBatchCampaignTemplate
+     * @return
+     */
+    @AutoLog(value = "计划模板-添加")
+    @ApiOperation(value = "计划模板-添加", notes = "计划模板-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouBatchCampaignTemplate> add(@RequestBody KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplate) {
+        Result<KuaiShouBatchCampaignTemplate> result = new Result<>();
+        try {
+            kuaiShouBatchCampaignTemplateService.save(kuaiShouBatchCampaignTemplate);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouBatchCampaignTemplate
+     * @return
+     */
+    @AutoLog(value = "计划模板-编辑")
+    @ApiOperation(value = "计划模板-编辑", notes = "计划模板-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouBatchCampaignTemplate> edit(@RequestBody KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplate) {
+        Result<KuaiShouBatchCampaignTemplate> result = new Result<KuaiShouBatchCampaignTemplate>();
+        KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplateEntity = kuaiShouBatchCampaignTemplateService.getById(kuaiShouBatchCampaignTemplate.getId());
+        if (kuaiShouBatchCampaignTemplateEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouBatchCampaignTemplateService.updateById(kuaiShouBatchCampaignTemplate);
+            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 {
+            kuaiShouBatchCampaignTemplateService.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<KuaiShouBatchCampaignTemplate> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaiShouBatchCampaignTemplate> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouBatchCampaignTemplateService.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<KuaiShouBatchCampaignTemplate> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouBatchCampaignTemplate> result = new Result<>();
+        KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplate = kuaiShouBatchCampaignTemplateService.getById(id);
+        if (kuaiShouBatchCampaignTemplate == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouBatchCampaignTemplate);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouBatchCampaignTemplate> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouBatchCampaignTemplate kuaiShouBatchCampaignTemplate = JSON.parseObject(deString, KuaiShouBatchCampaignTemplate.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouBatchCampaignTemplate, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouBatchCampaignTemplate> pageList = kuaiShouBatchCampaignTemplateService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "计划模板列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouBatchCampaignTemplate.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<KuaiShouBatchCampaignTemplate> listKuaiShouBatchCampaignTemplates = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouBatchCampaignTemplate.class, params);
+                kuaiShouBatchCampaignTemplateService.saveBatch(listKuaiShouBatchCampaignTemplates);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouBatchCampaignTemplates.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/KuaiShouBatchCreativeTemplateController.java

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

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

+ 105 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouBatchCampaignTemplate.java

@@ -0,0 +1,105 @@
+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 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 java.util.Date;
+
+/**
+ * 计划模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-19
+ */
+@Data
+@TableName("ctop_kuaishou_batch_campaign_template")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_batch_campaign_template对象", description = "计划模板")
+public class KuaiShouBatchCampaignTemplate {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 计划名称
+     */
+    @Excel(name = "计划名称", width = 15)
+    @ApiModelProperty(value = "计划名称")
+    private String campaignName;
+    /**
+     * 营销目标:2:提升应用安装;5:收集销售线索
+     */
+    @Excel(name = "营销目标:2:提升应用安装;5:收集销售线索", width = 15)
+    @ApiModelProperty(value = "营销目标:2:提升应用安装;5:收集销售线索")
+    private Integer campaignType;
+    /**
+     * 计划状态 0关闭,1开启
+     */
+    @Excel(name = "计划状态 0关闭,1开启", width = 15)
+    @ApiModelProperty(value = "计划状态 0关闭,1开启")
+    private Integer campaignStatus;
+    /**
+     * 组状态 1:投放中;2:暂停
+     */
+    @Excel(name = "组状态 1:投放中;2:暂停", width = 15)
+    @ApiModelProperty(value = "组状态 1:投放中;2:暂停")
+    private Integer unitStatus;
+    /**
+     * 每日预算
+     */
+    @Excel(name = "每日预算", width = 15)
+    @ApiModelProperty(value = "每日预算")
+    private Long dayBudget;
+    /**
+     * dayBudgetSchedule
+     */
+    @Excel(name = "dayBudgetSchedule", width = 15)
+    @ApiModelProperty(value = "dayBudgetSchedule")
+    private String dayBudgetSchedule;
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+    /**
+     * 推广平台 ios,android
+     */
+    @Excel(name = "推广平台 ios,android", width = 15)
+    @ApiModelProperty(value = "推广平台 ios,android")
+    private String systemType;
+    /**
+     * 是否定时启动
+     */
+    @Excel(name = "是否定时启动", width = 15)
+    @ApiModelProperty(value = "是否定时启动")
+    private String isTime;
+    /**
+     * 启动时间
+     */
+    @Excel(name = "启动时间", width = 15)
+    @ApiModelProperty(value = "启动时间")
+    private String timeStart;
+}

+ 119 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouBatchCreativeTemplate.java

@@ -0,0 +1,119 @@
+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;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 创意模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-19
+ */
+@Data
+@TableName("ctop_kuaishou_batch_creative_template")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_batch_creative_template对象", description = "创意模板")
+public class KuaiShouBatchCreativeTemplate {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 创意制作方式 4: 自定义;5:程序化创意 7:程序化创意2.0
+     */
+    @Excel(name = "创意制作方式 4: 自定义;5:程序化创意 7:程序化创意2.0", width = 15)
+    @ApiModelProperty(value = "创意制作方式 4: 自定义;5:程序化创意 7:程序化创意2.0")
+    private Integer unitType;
+    /**
+     * 行动号召按钮文案
+     */
+    @Excel(name = "行动号召按钮文案", width = 15)
+    @ApiModelProperty(value = "行动号召按钮文案")
+    private String actionBarText;
+    /**
+     * 自动发送礼包码 发送时机	android(支持的类型):如果选择「优先从系统应用商店下载」(use_app_market 为 1):2:检测到用户行为(actionBar 点击)没有选择优先应用商店下载:30: 开始下载后;31:下载完成后;32:安装完成后ios(ios支持的类型):2:检测到用户行为(actionBar 点击)
+     */
+    @Excel(name = "自动发送礼包码 发送时机	android(支持的类型):如果选择「优先从系统应用商店下载」(use_app_market 为 1):2:检测到用户行为(actionBar 点击)没有选择优先应用商店下载:30: 开始下载后;31:下载完成后;32:安装完成后ios(ios支持的类型):2:检测到用户行为(actionBar 点击)", width = 15)
+    @ApiModelProperty(value = "自动发送礼包码 发送时机	android(支持的类型):如果选择「优先从系统应用商店下载」(use_app_market 为 1):2:检测到用户行为(actionBar 点击)没有选择优先应用商店下载:30: 开始下载后;31:下载完成后;32:安装完成后ios(ios支持的类型):2:检测到用户行为(actionBar 点击)")
+    private Integer targetActionType;
+    /**
+     * 游戏礼包码
+     */
+    @Excel(name = "游戏礼包码", width = 15)
+    @ApiModelProperty(value = "游戏礼包码")
+    private String code;
+    /**
+     * 推荐理由
+     */
+    @Excel(name = "推荐理由", width = 15)
+    @ApiModelProperty(value = "推荐理由")
+    private String newExposeTag;
+    /**
+     * 应用下载详情页
+     */
+    @Excel(name = "应用下载详情页", width = 15)
+    @ApiModelProperty(value = "应用下载详情页")
+    private Long siteId;
+    /**
+     * 封面广告语标题
+     */
+    @Excel(name = "封面广告语标题", width = 15)
+    @ApiModelProperty(value = "封面广告语标题")
+    private String stickerTitle;
+    /**
+     * 贴纸样式类型
+     */
+    @Excel(name = "贴纸样式类型", width = 15)
+    @ApiModelProperty(value = "贴纸样式类型")
+    private String overlayType;
+    /**
+     * 创意分类
+     */
+    @Excel(name = "创意分类", width = 15)
+    @ApiModelProperty(value = "创意分类")
+    private Integer creativeCategory;
+    /**
+     * 创意标签
+     */
+    @Excel(name = "创意标签", width = 15)
+    @ApiModelProperty(value = "创意标签")
+    private String creativeTag;
+    /**
+     * 创建时间
+     */
+    @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;
+    /**
+     * updateTime
+     */
+    @Excel(name = "updateTime", 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 = "updateTime")
+    private Date updateTime;
+}

+ 167 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouBatchGroupTemplate.java

@@ -0,0 +1,167 @@
+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;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 创意模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-19
+ */
+@Data
+@TableName("ctop_kuaishou_batch_group_template")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_batch_group_template对象", description = "创意模板")
+public class KuaiShouBatchGroupTemplate {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 资源位置:1:优选广告位;3:视频播放页广告-便利贴广告(不支持深度转化目标的优化);5:联盟广告;6:上下滑大屏广告;7:信息流广告;;3、6、7可多选
+     */
+    @Excel(name = "资源位置:1:优选广告位;3:视频播放页广告-便利贴广告(不支持深度转化目标的优化);5:联盟广告;6:上下滑大屏广告;7:信息流广告;;3、6、7可多选", width = 15)
+    @ApiModelProperty(value = "资源位置:1:优选广告位;3:视频播放页广告-便利贴广告(不支持深度转化目标的优化);5:联盟广告;6:上下滑大屏广告;7:信息流广告;;3、6、7可多选")
+    private String sceneId;
+    /**
+     * 优先从系统应用商店下载
+     */
+    @Excel(name = "优先从系统应用商店下载", width = 15)
+    @ApiModelProperty(value = "优先从系统应用商店下载")
+    private Integer useAppMarket;
+    /**
+     * 应用列表
+     */
+    @Excel(name = "应用列表", width = 15)
+    @ApiModelProperty(value = "应用列表")
+    private String appStore;
+    /**
+     * 广告组名称
+     */
+    @Excel(name = "广告组名称", width = 15)
+    @ApiModelProperty(value = "广告组名称")
+    private String unitName;
+    /**
+     * 1 - 加速投放;2 - 平滑投放;3-优先低成本(投放时间范围只可为全天;预算不可为不限或空)
+     */
+    @Excel(name = "1 - 加速投放;2 - 平滑投放;3-优先低成本(投放时间范围只可为全天;预算不可为不限或空)", width = 15)
+    @ApiModelProperty(value = "1 - 加速投放;2 - 平滑投放;3-优先低成本(投放时间范围只可为全天;预算不可为不限或空)")
+    private Integer speed;
+    /**
+     * 单日预算
+     */
+    @Excel(name = "单日预算", width = 15)
+    @ApiModelProperty(value = "单日预算")
+    private Long dayBudget;
+    /**
+     * 投放开始时间
+     */
+    @Excel(name = "投放开始时间", width = 15)
+    @ApiModelProperty(value = "投放开始时间")
+    private String beginTime;
+    /**
+     * 投放结束时间
+     */
+    @Excel(name = "投放结束时间", width = 15)
+    @ApiModelProperty(value = "投放结束时间")
+    private String endTime;
+    /**
+     * 投放时段
+     */
+    @Excel(name = "投放时段", width = 15)
+    @ApiModelProperty(value = "投放时段")
+    private String scheduleTime;
+    /**
+     * 1 - 轮播;2 - 优选
+     */
+    @Excel(name = "1 - 轮播;2 - 优选", width = 15)
+    @ApiModelProperty(value = "1 - 轮播;2 - 优选")
+    private Integer showMode;
+    /**
+     * 出价类型
+     */
+    @Excel(name = "出价类型", width = 15)
+    @ApiModelProperty(value = "出价类型")
+    private Integer bidType;
+    /**
+     * 出价
+     */
+    @Excel(name = "出价", width = 15)
+    @ApiModelProperty(value = "出价")
+    private Integer bid;
+    /**
+     * OCPX行为类型   1: CPM, 2: CPC,
+     */
+    @Excel(name = "OCPX行为类型   1: CPM, 2: CPC,", width = 15)
+    @ApiModelProperty(value = "OCPX行为类型   1: CPM, 2: CPC,")
+    private Integer ocpxActionType;
+    /**
+     * 深度转化目标 3: 付费,7: 次日留存,10: 完件, 11: 授信 ,0:无
+     */
+    @Excel(name = "深度转化目标 3: 付费,7: 次日留存,10: 完件, 11: 授信 ,0:无", width = 15)
+    @ApiModelProperty(value = "深度转化目标 3: 付费,7: 次日留存,10: 完件, 11: 授信 ,0:无")
+    private Integer deepConversionType;
+    /**
+     * 深度转化目标出价
+     */
+    @Excel(name = "深度转化目标出价", width = 15)
+    @ApiModelProperty(value = "深度转化目标出价")
+    private Integer deepConversionBid;
+    /**
+     * 出价最小值
+     */
+    @Excel(name = "出价最小值", width = 15)
+    @ApiModelProperty(value = "出价最小值")
+    private Integer bidMin;
+    /**
+     * 出价最大值
+     */
+    @Excel(name = "出价最大值", width = 15)
+    @ApiModelProperty(value = "出价最大值")
+    private Integer bidMax;
+    /**
+     * 1:固定出价 2:随机出价 值为1时取bid或cpa_bid  2 区 bid_max  bid_min
+     */
+    @Excel(name = "1:固定出价 2:随机出价 值为1时取bid或cpa_bid  2 区 bid_max  bid_min", width = 15)
+    @ApiModelProperty(value = "1:固定出价 2:随机出价 值为1时取bid或cpa_bid  2 区 bid_max  bid_min")
+    private Integer templateBidType;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+}

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.batch.mapper;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchCampaignTemplate;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 计划模板
+ *
+ * @author: jeecg-boot
+ * @date: 2021-01-19
+ * @cersion: V1.0
+ */
+public interface KuaiShouBatchCampaignTemplateMapper extends BaseMapper<KuaiShouBatchCampaignTemplate> {
+
+}

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.batch.mapper;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchCreativeTemplate;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 创意模板
+ *
+ * @author: jeecg-boot
+ * @date: 2021-01-19
+ * @cersion: V1.0
+ */
+public interface KuaiShouBatchCreativeTemplateMapper extends BaseMapper<KuaiShouBatchCreativeTemplate> {
+
+}

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.batch.mapper;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchGroupTemplate;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 创意模板
+ *
+ * @author: jeecg-boot
+ * @date: 2021-01-19
+ * @cersion: V1.0
+ */
+public interface KuaiShouBatchGroupTemplateMapper extends BaseMapper<KuaiShouBatchGroupTemplate> {
+
+}

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

@@ -20,4 +20,8 @@ public interface KuaishouVideoRelateCreativesMapper extends BaseMapper<KuaishouV
     void insertBatch(@Param(value = "videolist") List<KuaishouVideoRelateCreatives> videolist);
 
     List<JSONObject> getVideoListByMap(Map<String, Object> requestMap);
+
+    List<JSONObject> getVideoZeroListByMap(Map<String, Object> requestMap);
+
+    List<JSONObject> getHistoryTopVideoList(Map<String, Object> requestMap);
 }

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouBatchCampaignTemplateMapper.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.batch.mapper.KuaiShouBatchCampaignTemplateMapper">
+
+</mapper>

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouBatchCreativeTemplateMapper.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.batch.mapper.KuaiShouBatchCreativeTemplateMapper">
+
+</mapper>

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouBatchGroupTemplateMapper.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.batch.mapper.KuaiShouBatchGroupTemplateMapper">
+
+</mapper>

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

@@ -12,8 +12,8 @@
     </select>
 
     <select id="queryActiveAccount" resultType="java.lang.Long">
-        SELECT account_id FROM ctop_kuaishou_strategy
-        WHERE strategy_state = 1
+        SELECT account_id FROM ctop_ai_kuaishou_auto_creative_account_info
+        WHERE status = 1
         GROUP BY account_id
     </select>
-</mapper>
+</mapper>

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

@@ -49,4 +49,59 @@
         </if>
         ORDER BY t1.id ASC LIMIT #{num}
     </select>
+
+    <select id="getVideoZeroListByMap" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        photo_id as 'photo_id',
+        stat_date as 'stat_date',
+        creative_count as 'creative_count'
+        FROM ctop_kuaishou_video_relate_creatives
+        where 1 = 1
+        <if test="accountId != null and accountId != '' ">
+            and account_id = #{accountId}
+        </if>
+        <if test="creativeCount != null and creativeCount != '' ">
+            AND creative_count = #{creativeCount}
+        </if>
+        ORDER BY stat_date ASC
+        LIMIT #{videoCnt}
+    </select>
+
+    <select id="getHistoryTopVideoList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t2.photo_id,
+        t2.signature,
+        t1.charge,
+        t2.channel_type,
+        t2.url as 'video_url'
+        FROM
+        (
+        SELECT
+        sum(charge) as 'charge',
+        signature
+        FROM
+        ctop_kuaishou_report_daily_material
+        WHERE
+        signature IN (
+        SELECT DISTINCT
+        (signature)
+        FROM
+        ctop_kuaishou_video_get
+        WHERE
+        account_id = #{accountId}
+        and stat_date &gt;= #{startDate}
+        and stat_date &lt;= #{endDate}
+        and signature is  not  null
+        )
+        GROUP BY
+        signature
+        ORDER BY
+        sum(charge) DESC
+        LIMIT #{num}
+        ) t1
+        LEFT   JOIN ctop_kuaishou_video_get t2 ON t1.signature = t2.signature
+        AND t2.account_id = #{accountId}
+        GROUP BY t2.signature
+        ORDER BY t1.charge DESC
+    </select>
 </mapper>

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

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchCampaignTemplate;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 计划模板
+ * @Author: jeecg-boot
+ * @Date: 2021-01-19
+ * @Version: V1.0
+ */
+public interface IKuaiShouBatchCampaignTemplateService extends IService<KuaiShouBatchCampaignTemplate> {
+
+}

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

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchCreativeTemplate;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 创意模板
+ * @Author: jeecg-boot
+ * @Date: 2021-01-19
+ * @Version: V1.0
+ */
+public interface IKuaiShouBatchCreativeTemplateService extends IService<KuaiShouBatchCreativeTemplate> {
+
+}

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

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchGroupTemplate;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 创意模板
+ * @Author: jeecg-boot
+ * @Date: 2021-01-19
+ * @Version: V1.0
+ */
+public interface IKuaiShouBatchGroupTemplateService extends IService<KuaiShouBatchGroupTemplate> {
+
+}

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

@@ -22,4 +22,10 @@ public interface IKuaishouVideoRelateCreativesService extends IService<KuaishouV
     void videoRelateCreatives(Long accountId, JSONArray photoIds, Map<String, Object> statdateMap);
 
     List<JSONObject> getVideoListByMap(Map<String, Object> requestMap);
+
+    List<KuaishouVideoRelateCreatives> listByParams(Long accountId);
+
+    List<JSONObject> getVideoZeroListByMap(Map<String, Object> requestMap);
+
+    List<JSONObject> getHistoryTopVideoList(Map<String, Object> requestMap);
 }

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchCampaignTemplate;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouBatchCampaignTemplateMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouBatchCampaignTemplateService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 计划模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-19
+ */
+@Service
+public class KuaiShouBatchCampaignTemplateServiceImpl extends ServiceImpl<KuaiShouBatchCampaignTemplateMapper, KuaiShouBatchCampaignTemplate> implements IKuaiShouBatchCampaignTemplateService {
+
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchCreativeTemplate;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouBatchCreativeTemplateMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouBatchCreativeTemplateService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 创意模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-19
+ */
+@Service
+public class KuaiShouBatchCreativeTemplateServiceImpl extends ServiceImpl<KuaiShouBatchCreativeTemplateMapper, KuaiShouBatchCreativeTemplate> implements IKuaiShouBatchCreativeTemplateService {
+
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouBatchGroupTemplate;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouBatchGroupTemplateMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouBatchGroupTemplateService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 创意模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-19
+ */
+@Service
+public class KuaiShouBatchGroupTemplateServiceImpl extends ServiceImpl<KuaiShouBatchGroupTemplateMapper, KuaiShouBatchGroupTemplate> implements IKuaiShouBatchGroupTemplateService {
+
+}

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

@@ -11,17 +11,20 @@ import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouVideoRelateCreativesMap
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouVideoRelateCreativesService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.*;
 
 /**
  * 频库-视频关联创意数查询
@@ -35,7 +38,7 @@ import java.util.Map;
 public class KuaishouVideoRelateCreativesServiceImpl extends ServiceImpl<KuaishouVideoRelateCreativesMapper, KuaishouVideoRelateCreatives> implements IKuaishouVideoRelateCreativesService {
     @Autowired
     private ICtopOauthTokenService tokenService;
-    @Autowired
+    @Resource
     private KuaishouVideoRelateCreativesMapper kuaishouVideoRelateCreativesMapper;
 
     /**
@@ -145,4 +148,26 @@ public class KuaishouVideoRelateCreativesServiceImpl extends ServiceImpl<Kuaisho
     public List<JSONObject> getVideoListByMap(Map<String, Object> requestMap) {
         return kuaishouVideoRelateCreativesMapper.getVideoListByMap(requestMap);
     }
+
+    @Override
+    public List<KuaishouVideoRelateCreatives> listByParams(Long accountId) {
+        QueryWrapper<KuaishouVideoRelateCreatives> queryWrapper = new QueryWrapper<>();
+        if(null!=accountId&&accountId!=0){
+            queryWrapper.eq("account_id",accountId);
+        }
+        queryWrapper.eq("creative_count",0);
+        queryWrapper.orderByDesc("stat_date");
+        queryWrapper.last("limit 10");
+        return this.list(queryWrapper);
+    }
+
+    @Override
+    public List<JSONObject> getVideoZeroListByMap(Map<String, Object> requestMap) {
+        return kuaishouVideoRelateCreativesMapper.getVideoZeroListByMap(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> getHistoryTopVideoList(Map<String, Object> requestMap) {
+        return kuaishouVideoRelateCreativesMapper.getHistoryTopVideoList(requestMap);
+    }
 }

+ 0 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

@@ -110,7 +110,6 @@ public class ReportServiceImpl implements IReportService {
                 advertiserDailyReportService.saveOrUpdate(dailyReport);
             }
         }
-        getAdvertiserReportByPage(token, conditions, page + 1);
     }
 
     @Override