Forráskód Böngészése

Merge branch 'master' into kuaishou-ai-advertising

# Conflicts:
#	module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouReportDailyMaterialMapper.java
#	module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml
syh 4 éve
szülő
commit
61479347e9
57 módosított fájl, 2303 hozzáadás és 69 törlés
  1. 7 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  2. 27 6
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  3. 1 3
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/constant/MatchLogic.java
  4. 166 0
      module-common/src/main/java/cn/com/ctop/common/module/enums/BytedanceConvertType.java
  5. 43 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateCreativeJob.java
  6. 19 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateUnitJob.java
  7. 0 2
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAudienceReportJob.java
  8. 13 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  9. 5 13
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/CollectionSlogansController.java
  10. 342 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouGroupTemplateController.java
  11. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouStrategyController.java
  12. 235 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroupTemplate.java
  13. 8 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouStrategy.java
  14. 57 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/kuaishoustrategycampaignRel.java
  15. 26 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupTemplateMapper.java
  16. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouReportDailyMaterialMapper.java
  17. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/kuaishoustrategycampaignRelMapper.java
  18. 41 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupTemplateMapper.xml
  19. 35 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml
  20. 12 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/kuaishoustrategycampaignRelMapper.xml
  21. 36 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouGroupTemplateService.java
  22. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouOverRunSendMessageService.java
  23. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouReportDailyMaterialService.java
  24. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java
  25. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouStrategyService.java
  26. 18 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IkuaishoustrategycampaignRelService.java
  27. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java
  28. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/CrossAccountBatchServiceImpl.java
  29. 595 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupTemplateServiceImpl.java
  30. 12 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouOverRunSendMessageServiceImpl.java
  31. 11 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouReportDailyMaterialServiceImpl.java
  32. 6 7
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  33. 29 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouStrategyServiceImpl.java
  34. 30 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/kuaishoustrategycampaignRelServiceImpl.java
  35. 23 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouAudienceReportDailyController.java
  36. 4 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaiShouReportDailyMaterial.java
  37. 88 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouVideoEtlInfo.java
  38. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyAgeMapper.java
  39. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyBusinessMapper.java
  40. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyCityMapper.java
  41. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyClientMapper.java
  42. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyGenderMapper.java
  43. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouAudienceReportDailyProvinceMapper.java
  44. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouVideoEtlInfoMapper.java
  45. 11 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyAgeMapper.xml
  46. 11 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyBusinessMapper.xml
  47. 11 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyCityMapper.xml
  48. 11 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyClientMapper.xml
  49. 11 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyGenderMapper.xml
  50. 12 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyProvinceMapper.xml
  51. 8 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouVideoEtlInfoMapper.xml
  52. 11 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouAudienceReportDailyService.java
  53. 18 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouVideoEtlInfoService.java
  54. 44 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouAudienceReportDailyServiceImpl.java
  55. 186 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouVideoEtlInfoServiceImpl.java
  56. 2 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IReportService.java
  57. 8 9
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

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

@@ -839,6 +839,13 @@ public class DateUtils extends PropertyEditorSupport {
         System.err.println(s1);
     }
 
+    public static int getdaysOfTwoDate(String minDate, String date) {
+        Date bigDate = parseDate(date,"yyyy-MM-dd");
+        Date smallDate = parseDate(minDate,"yyyy-MM-dd");
+        int days = (int) ((bigDate.getTime() - smallDate.getTime()) / (1000*3600*24));
+        return days+1;
+    }
+
     /**
      * String类型 转换为Date, 如果参数长度为10 转换格式”yyyy-MM-dd“ 如果参数长度为19 转换格式”yyyy-MM-dd
      * HH:mm:ss“ * @param text String类型的时间值

+ 27 - 6
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -15,15 +15,18 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouCostGroupService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouVideoEtlInfoService;
 import cn.com.ctop.kuaishou.modules.report.service.IRuleKuaiShouPlanService;
 import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
 import cn.com.ctop.oa.modules.service.IWechatNoListService;
 import cn.com.ctop.oa.modules.service.IWechatUserListService;
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceAdvertisePlan;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceFundDailyService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
 import cn.com.ctop.toutiao.modules.report.service.IReportService;
+import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.junit.Test;
@@ -248,6 +251,12 @@ public class SampleTest {
     }
 
     @Test
+    public void testData11(){
+        CtopOauthToken token =tokenService.getTokenByAccountId(1683711016125448L);
+        reportService.getAdvertiserPlanRuleData(token,new Date(),new Date(), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+    }
+
+    @Test
     public void loadKuaishouAgentData() {
         kuaishouReportDailyAgentService.loginAgent();
         try {
@@ -322,11 +331,6 @@ public class SampleTest {
 //        }
     }
 
-
-    @Autowired
-    private IKuaishouCostGroupService kuaishouCostGroupService;
-    @Autowired
-    private IAlarmEventSendService alarmEventSendService;
     @Autowired
     private IWechatCheckinDataService wechatCheckinDataService;
     @Autowired
@@ -391,6 +395,23 @@ public class SampleTest {
         CtopOauthToken token = tokenService.getTokenByAccountId(9589905L);
         ruleKuaiShouPlanService.cleanRuleDataTarget(token.getAccountId(), 1);
     }
+    @Autowired
+    private IKuaishouVideoEtlInfoService etlInfoService;
+    @Test
+    public void etlKuaishouData(){
+        String dateString = "2020-05-25";
+        Date startDate = DateUtils.parseDate(dateString,"yyyy-MM-dd");
+        for(int i=0;i<=277;i++){
+            Date getDate = DateUtils.addDay(startDate,i);
+            etlInfoService.etlKuaishouVideoInfo(getDate);
+        }
+    }
 
-
+    @Test
+    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);
+        }
+    }
 }

+ 1 - 3
module-alarm/src/main/java/cn/com/ctop/alarm/modules/constant/MatchLogic.java

@@ -12,8 +12,6 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * TODO
- *
  * @ClassName MatchLogic
  * @Author ZHAOXA
  * @date 2020-11-17 10:54
@@ -185,7 +183,7 @@ public class MatchLogic {
             buf.append("预警计划:").append(codes).append("<br/>");
         } else if ("unit".equals(type)) {
             buf.append("预警组:").append(codes).append("<br/>");
-        }else if ("creative".equals(type)) {
+        } else if ("creative".equals(type)) {
             buf.append("预警创意:").append(codes).append("<br/>");
         }
         if (isNull) {

+ 166 - 0
module-common/src/main/java/cn/com/ctop/common/module/enums/BytedanceConvertType.java

@@ -0,0 +1,166 @@
+package cn.com.ctop.common.module.enums;
+
+public enum BytedanceConvertType {
+    AD_CONVERT_TYPE_PHONE("AD_CONVERT_TYPE_PHONE", 1L, "电话拨打"),
+    AD_CONVERT_TYPE_FORM("AD_CONVERT_TYPE_FORM", 2L, "表单提交"),
+    AD_CONVERT_TYPE_MAP_SEARCH("AD_CONVERT_TYPE_MAP_SEARCH", 3L, "地图搜索"),
+    AD_CONVERT_TYPE_DOWNLOAD_FINISH("AD_CONVERT_TYPE_DOWNLOAD_FINISH", 4L, "下载完成"),
+    AD_CONVERT_TYPE_BUTTON("AD_CONVERT_TYPE_BUTTON", 5L, "按钮跳转"),
+    AD_CONVERT_TYPE_XPATH("AD_CONVERT_TYPE_XPATH", 6L, "xpath类型转换"),
+    AD_CONVERT_TYPE_VIEW("AD_CONVERT_TYPE_VIEW", 7L, "关键页面浏览"),
+    AD_CONVERT_TYPE_ACTIVE("AD_CONVERT_TYPE_ACTIVE", 8L, "激活"),
+    AD_CONVERT_TYPE_DOWNLOAD_START("AD_CONVERT_TYPE_DOWNLOAD_START", 9L, "下载按钮download_start"),
+    AD_CONVERT_TYPE_QQ("AD_CONVERT_TYPE_QQ", 10L, "qq咨询"),
+    AD_CONVERT_TYPE_LOTTERY("AD_CONVERT_TYPE_LOTTERY", 11L, "抽奖"),
+    AD_CONVERT_TYPE_VOTE("AD_CONVERT_TYPE_VOTE", 12L, "投票"),
+    AD_CONVERT_TYPE_ACTIVE_REGISTER("AD_CONVERT_TYPE_ACTIVE_REGISTER", 13L, "激活且注册"),
+    AD_CONVERT_TYPE_PAY("AD_CONVERT_TYPE_PAY", 14L, "激活且付费"),
+    AD_CONVERT_TYPE_INSTALL_FINISH("AD_CONVERT_TYPE_INSTALL_FINISH", 15L, "安装完成"),
+    AD_CONVERT_TYPE_PHONE_CONFIRM("AD_CONVERT_TYPE_PHONE_CONFIRM", 16L, "智能电话-确认拨打"),
+    AD_CONVERT_TYPE_PHONE_CONNECT("AD_CONVERT_TYPE_PHONE_CONNECT", 17L, "智能电话-确认接通"),
+    AD_CONVERT_TYPE_PHONE_EFFECTIVE("AD_CONVERT_TYPE_PHONE_EFFECTIVE", 18L, "智能电话-有效接通"),
+    AD_CONVERT_TYPE_CONSULT_EFFECTIVE("AD_CONVERT_TYPE_CONSULT_EFFECTIVE", 19L, "有效咨询"),
+    AD_CONVERT_TYPE_APP_ORDER("AD_CONVERT_TYPE_APP_ORDER", 20L, "app内下单(电商)"),
+    AD_CONVERT_TYPE_APP_UV("AD_CONVERT_TYPE_APP_UV", 21L, "app内访问"),
+    AD_CONVERT_TYPE_APP_CART("AD_CONVERT_TYPE_APP_CART", 22L, "app内添加购物车(电商)"),
+    AD_CONVERT_TYPE_APP_PAY("AD_CONVERT_TYPE_APP_PAY", 23L, "app内付费"),
+    AD_CONVERT_TYPE_SALES_LEAD("AD_CONVERT_TYPE_SALES_LEAD", 24L, "销售线索"),
+    AD_CONVERT_TYPE_GAME_ADDICTION("AD_CONVERT_TYPE_GAME_ADDICTION", 25L, "关键行为(原深度转化)"),
+    AD_CONVERT_TYPE_CUSTOMER_EFFECTIVE("AD_CONVERT_TYPE_CUSTOMER_EFFECTIVE", 26L, "有效获客"),
+    AD_CONVERT_TYPE_EFFECTIVE_COPY("AD_CONVERT_TYPE_EFFECTIVE_COPY", 27L, "关键页面到达&有效内容复制"),
+    AD_CONVERT_TYPE_COUPON("AD_CONVERT_TYPE_COUPON", 28L, "卡券领取"),
+    AD_CONVERT_TYPE_APP_DETAIL_UV("AD_CONVERT_TYPE_APP_DETAIL_UV", 29L, "app内详情页到站uv"),
+    AD_CONVERT_TYPE_RSS("AD_CONVERT_TYPE_RSS", 30L, "账号关注"),
+    AD_CONVERT_TYPE_FORM_CONNECT("AD_CONVERT_TYPE_FORM_CONNECT", 31L, "表单提交-已接通"),
+    AD_CONVERT_TYPE_FORM_ANSWER("AD_CONVERT_TYPE_FORM_ANSWER", 32L, "有效沟通"),
+    AD_CONVERT_TYPE_DIALBACK("AD_CONVERT_TYPE_DIALBACK", 33L, "提交回呼电话"),
+    AD_CONVERT_TYPE_DIALBACK_CONFIRM("AD_CONVERT_TYPE_DIALBACK_CONFIRM", 34L, "回呼电话-确认拨打"),
+    AD_CONVERT_TYPE_DIALBACK_CONNECT("AD_CONVERT_TYPE_DIALBACK_CONNECT", 35L, "回呼电话-确认接通"),
+    AD_CONVERT_TYPE_FORM_DEEP("AD_CONVERT_TYPE_FORM_DEEP", 36L, "分层表单"),
+    AD_CONVERT_TYPE_UPDATE_LEVEL("AD_CONVERT_TYPE_UPDATE_LEVEL", 37L, "激活且升级"),
+    AD_CONVERT_TYPE_CREATE_GAMEROLE("AD_CONVERT_TYPE_CREATE_GAMEROLE", 38L, "激活且创建角色"),
+    AD_CONVERT_TYPE_NEXT_DAY_OPEN("AD_CONVERT_TYPE_NEXT_DAY_OPEN", 39L, "激活且次留"),
+    AD_CONVERT_TYPE_INVALID_CLUE("AD_CONVERT_TYPE_INVALID_CLUE", 40L, "无效线索"),
+    AD_CONVERT_TYPE_INTENTION_CLUE("AD_CONVERT_TYPE_INTENTION_CLUE", 41L, "有意向客户"),
+    AD_CONVERT_TYPE_HIGH_VALUE_CLUE("AD_CONVERT_TYPE_HIGH_VALUE_CLUE", 42L, "高价值客户"),
+    AD_CONVERT_TYPE_PAID_CLUE("AD_CONVERT_TYPE_PAID_CLUE", 43L, "已成单"),
+    AD_CONVERT_TYPE_NATIVE_ACTION("AD_CONVERT_TYPE_NATIVE_ACTION", 44L, "原生互动"),
+    AD_CONVERT_TYPE_LIKE_ACTION("AD_CONVERT_TYPE_LIKE_ACTION", 45L, "视频点赞"),
+    AD_CONVERT_TYPE_FOLLOW_ACTION("AD_CONVERT_TYPE_FOLLOW_ACTION", 46L, "账户关注"),
+    AD_CONVERT_TYPE_COMMENT_ACTION("AD_CONVERT_TYPE_COMMENT_ACTION", 47L, "视频评论"),
+    AD_CONVERT_TYPE_LOCATION_ACTION("AD_CONVERT_TYPE_LOCATION_ACTION", 48L, "POI点击"),
+    AD_CONVERT_TYPE_SHOPPING_ACTION("AD_CONVERT_TYPE_SHOPPING_ACTION", 49L, "购物车点击"),
+    AD_CONVERT_TYPE_REDIRECT_TO_SHOP("AD_CONVERT_TYPE_REDIRECT_TO_SHOP", 50L, "调起店铺"),
+    AD_CONVERT_TYPE_LINK_ACTION("AD_CONVERT_TYPE_LINK_ACTION", 51L, "link点击"),
+    AD_CONVERT_TYPE_DEEP_PURCHASE("AD_CONVERT_TYPE_DEEP_PURCHASE", 52L, "多次付费"),
+    AD_CONVERT_TYPE_SUCCESSORDER_ACTION("AD_CONVERT_TYPE_SUCCESSORDER_ACTION", 53L, "小店转化"),
+    AD_CONVERT_TYPE_POI_COLLECT("AD_CONVERT_TYPE_POI_COLLECT", 60L, "poi地址点击"),
+    AD_CONVERT_TYPE_POI_ADDRESS_CLICK("AD_CONVERT_TYPE_POI_ADDRESS_CLICK", 61L, "poi收藏"),
+    AD_CONVERT_TYPE_RESERVATION("AD_CONVERT_TYPE_RESERVATION", 62L, "poi预定"),
+    AD_CONVERT_TYPE_MESSAGE_ACTION("AD_CONVERT_TYPE_MESSAGE_ACTION", 63L, "私信消息"),
+    AD_CONVERT_TYPE_SHARE_ACTION("AD_CONVERT_TYPE_SHARE_ACTION", 65L, "分享"),
+    AD_CONVERT_TYPE_CLICK_LANDING_PAGE("AD_CONVERT_TYPE_CLICK_LANDING_PAGE", 66L, "访问推广详情页"),
+    AD_CONVERT_TYPE_CLICK_SHOPWINDOW("AD_CONVERT_TYPE_CLICK_SHOPWINDOW", 67L, "访问主页商品橱窗"),
+    AD_CONVERT_TYPE_CLICK_DOWNLOAD("AD_CONVERT_TYPE_CLICK_DOWNLOAD", 68L, "访问主页下载应用"),
+    AD_CONVERT_TYPE_CLICK_CALL_DY("AD_CONVERT_TYPE_CLICK_CALL_DY", 69L, "点击主页内电话拨打"),
+    AD_CONVERT_TYPE_CLICK_WEBSITE("AD_CONVERT_TYPE_CLICK_WEBSITE", 70L, "访问主页官网"),
+    AD_CONVERT_PAGE_VIEW("AD_CONVERT_PAGE_VIEW", 93L, "访问目标页面"),
+    AD_CONVERT_TYPE_MESSAGE("AD_CONVERT_TYPE_MESSAGE", 94L, "短信"),
+    AD_CONVERT_TYPE_REDIRECT("AD_CONVERT_TYPE_REDIRECT", 95L, "页面跳转"),
+    AD_CONVERT_TYPE_SHOPPING("AD_CONVERT_TYPE_SHOPPING", 96L, "商品购买"),
+    AD_CONVERT_TYPE_CONSULT("AD_CONVERT_TYPE_CONSULT", 97L, "在线咨询"),
+    AD_CONVERT_TYPE_WECHAT("AD_CONVERT_TYPE_WECHAT", 98L, "微信"),
+    AD_CONVERT_TYPE_OTHER("AD_CONVERT_TYPE_OTHER", 99L, "其他"),
+    AD_CONVERT_TYPE_MULTIPLE("AD_CONVERT_TYPE_MULTIPLE", 100L, "多转化事件"),
+    AD_CONVERT_TYPE_POI_MULTIPLE("AD_CONVERT_TYPE_POI_MULTIPLE", 101L, "POI门店多转化目标"),
+    AD_CONVERT_TYPE_MULTI_NATIVE_ACTION("AD_CONVERT_TYPE_MULTI_NATIVE_ACTION", 102L, "互动"),
+    AD_CONVERT_TYPE_LOAN_COMPLETION("AD_CONVERT_TYPE_LOAN_COMPLETION", 103L, "互联网金融-完件"),
+    AD_CONVERT_TYPE_PRE_LOAN_CREDIT("AD_CONVERT_TYPE_PRE_LOAN_CREDIT", 104L, "互联网金融-预授信"),
+    AD_CONVERT_TYPE_LOAN_CREDIT("AD_CONVERT_TYPE_LOAN_CREDIT", 105L, "互联网金融-授信"),
+    AD_CONVERT_TYPE_IDCARD_INFORMATION("AD_CONVERT_TYPE_IDCARD_INFORMATION", 106L, "身份证信息填写完成"),
+    AD_CONVERT_TYPE_BANKCARD_INFORMATION("AD_CONVERT_TYPE_BANKCARD_INFORMATION", 107L, "银行卡信息填写完成"),
+    AD_CONVERT_TYPE_PERSONAL_INFORMATION("AD_CONVERT_TYPE_PERSONAL_INFORMATION", 108L, "补充个人信息填写完成"),
+    AD_CONVERT_TYPE_CERTIFICATION_INFORMATION("AD_CONVERT_TYPE_CERTIFICATION_INFORMATION", 109L, "用户活体认证信息上传完成"),
+    AD_CONVERT_TYPE_LT_ROI("AD_CONVERT_TYPE_LT_ROI", 110L, "广告变现ROI"),
+    AD_CONVERT_TYPE_LIVE_HOMEPAGE("AD_CONVERT_TYPE_LIVE_HOMEPAGE", 111L, "直播导流"),
+    AD_CONVERT_TYPE_REDIRECT_TO_STORE("AD_CONVERT_TYPE_REDIRECT_TO_STORE", 113L, "店铺导流"),
+    AD_CONVERT_TYPE_FEED_LIVE_HOMEPAGE("AD_CONVERT_TYPE_FEED_LIVE_HOMEPAGE", 120L, "火山feed进入直播页"),
+    AD_CONVERT_TYPE_AUTHORIZATION("AD_CONVERT_TYPE_AUTHORIZATION", 121L, "授权(电商)"),
+    AD_CONVERT_TYPE_COMMODITY_CLICK("AD_CONVERT_TYPE_COMMODITY_CLICK", 122L, "快上电商推广目的"),
+    AD_CONVERT_TYPE_CONSULT_CLUE("AD_CONVERT_TYPE_CONSULT_CLUE", 123L, "留咨咨询"),
+    AD_CONVERT_TYPE_BOOST("AD_CONVERT_TYPE_BOOST", 124L, "自然助推"),
+    AD_CONVERT_TYPE_STAY_TIME("AD_CONVERT_TYPE_STAY_TIME", 125L, "店铺停留"),
+    AD_CONVERT_TYPE_PURCHASE_OF_GOODS("AD_CONVERT_TYPE_PURCHASE_OF_GOODS", 156L, "商品签收"),
+    AD_CONVERT_TYPE_PURCHASE_ROI("AD_CONVERT_TYPE_PURCHASE_ROI", 160L, "付费ROI"),
+    AD_CONVERT_TYPE_LIVE_NATIVE_ACITON("AD_CONVERT_TYPE_LIVE_NATIVE_ACITON", 162L, "直播间原生互动"),
+    AD_CONVERT_TYPE_LIVE_FOLLOW_ACITON("AD_CONVERT_TYPE_LIVE_FOLLOW_ACITON", 163L, "直播间关注"),
+    AD_CONVERT_TYPE_LIVE_COMMENT_ACTION("AD_CONVERT_TYPE_LIVE_COMMENT_ACTION", 164L, "直播间评论"),
+    AD_CONVERT_TYPE_LIVE_GIFT_ACTION("AD_CONVERT_TYPE_LIVE_GIFT_ACTION", 165L, "直播间内打赏"),
+    AD_CONVERT_TYPE_LIVE_SLIDECART_CLICK_ACTION("AD_CONVERT_TYPE_LIVE_SLIDECART_CLICK_ACTION", 166L, "直播间查看购物车"),
+    AD_CONVERT_TYPE_LIVE_CLICK_PRODUCT_ACTION("AD_CONVERT_TYPE_LIVE_CLICK_PRODUCT_ACTION", 167L, "直播间查看商品"),
+    AD_CONVERT_TYPE_LIVE_ENTER_ACTION("AD_CONVERT_TYPE_LIVE_ENTER_ACTION", 171L, "直播间观看"),
+    AD_CONVERT_TYPE_LIVE_SUCCESSORDER_ACTION("AD_CONVERT_TYPE_LIVE_SUCCESSORDER_ACTION", 172L, "直播间成单"),
+    AD_CONVERT_TYPE_NOTIFY_DOWNLOAD("AD_CONVERT_TYPE_NOTIFY_DOWNLOAD", 173L, "预约下载"),
+    AD_CONVERT_TYPE_PREMIUM_PAYMENT("AD_CONVERT_TYPE_PREMIUM_PAYMENT", 174L, "保险支付"),
+    AD_CONVERT_TYPE_MESSAGE_CLICK("AD_CONVERT_TYPE_MESSAGE_CLICK", 177L, "私信点击"),
+    AD_CONVERT_TYPE_UG_ROI("AD_CONVERT_TYPE_UG_ROI", 178L, "内广roi"),
+    AD_CONVERT_TYPE_ENTER_HOMEPAGE("AD_CONVERT_TYPE_ENTER_HOMEPAGE", 181L, "进入个人主页"),
+    AD_CONVERT_TYPE_SHOPPING_CART("AD_CONVERT_TYPE_SHOPPING_CART", 182L, "商品购物车点击"),
+    AD_CONVERT_TYPE_WECHAT_REGISTER("AD_CONVERT_TYPE_WECHAT_REGISTER", 183L, "微信内注册"),
+    AD_CONVERT_TYPE_WECHAT_PAY("AD_CONVERT_TYPE_WECHAT_PAY", 184L, "微信内付费"),
+    AD_CONVERT_TYPE_MESSAGE_INTERACTION("AD_CONVERT_TYPE_MESSAGE_INTERACTION", 185L, "沟通互动"),
+    AD_CONVERT_TYPE_LIVE_STAY_TIME("AD_CONVERT_TYPE_LIVE_STAY_TIME", 186L, "直播间停留"),
+    AD_CONVERT_TYPE_NEW_FOLLOW_ACTION("AD_CONVERT_TYPE_NEW_FOLLOW_ACTION", 187L, "粉丝增长"),
+    AD_CONVERT_TYPE_APPLET_CLICK("AD_CONVERT_TYPE_APPLET_CLICK", 189L, "小程序互动"),
+    AD_CONVERT_TYPE_MESSAGE_SERVICE("AD_CONVERT_TYPE_MESSAGE_SERVICE", 190L, "私信服务"),
+    AD_CONVERT_TYPE_MESSAGE_CLUE("AD_CONVERT_TYPE_MESSAGE_CLUE", 192L, "私信留资"),
+    AD_CONVERT_TYPE_LIVE_FANS_ACTION("AD_CONVERT_TYPE_LIVE_FANS_ACTION", 193L, "直播间加入粉丝团"),
+    AD_CONVERT_TYPE_CLUE_CONFIRM("AD_CONVERT_TYPE_CLUE_CONFIRM", 194L, "回访_信息确认"),
+    AD_CONVERT_TYPE_CLUE_INTERFLOW("AD_CONVERT_TYPE_CLUE_INTERFLOW", 195L, "回访_加为好友"),
+    AD_CONVERT_TYPE_CLUE_HIGH_INTENTION("AD_CONVERT_TYPE_CLUE_HIGH_INTENTION", 196L, "回访_高潜成交"),
+    AD_CONVERT_TYPE_LIVE_COMPONENT_CLICK("AD_CONVERT_TYPE_LIVE_COMPONENT_CLICK", 215L, "组件点击");
+
+
+    private String code;
+    private Long num;
+    private String desc;
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public Long getNum() {
+        return num;
+    }
+
+    public void setNum(Long num) {
+        this.num = num;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public void setDesc(String desc) {
+        this.desc = desc;
+    }
+
+    BytedanceConvertType(String code, Long num, String desc) {
+        this.code = code;
+        this.num = num;
+        this.desc = desc;
+    }
+
+    public static Long getNum(String code) {
+        for (BytedanceConvertType convertType : BytedanceConvertType.values()) {
+            if (convertType.getCode().equals(code.trim())) {
+                return convertType.getNum();
+            }
+        }
+        return null;
+    }
+}

+ 43 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateCreativeJob.java

@@ -0,0 +1,43 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTemplate;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+public class KuaishouCreateCreativeJob {
+
+
+    @Autowired
+    private IKuaiShouGroupTemplateService groupTemplateService;
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+
+    @XxlJob("kuaihouCreateCreative")
+    public void execute() {
+        QueryWrapper<KuaiShouGroupTemplate> templateQueryWrapper = new QueryWrapper<>();
+        templateQueryWrapper.eq("task_status", 2);
+        templateQueryWrapper.eq("creative_status", 0);
+        templateQueryWrapper.orderByAsc("create_time");
+        templateQueryWrapper.last("limit 20");
+        List<KuaiShouGroupTemplate> list = groupTemplateService.list(templateQueryWrapper);
+        if (Check.isNull(list)) {
+            return;
+        }
+        for (KuaiShouGroupTemplate template : list) {
+            CtopOauthToken token = tokenService.getTokenByAccountId(template.getAccountId());
+            if (Check.isNull(token)) {
+                continue;
+            }
+            groupTemplateService.createCreative(token.getAccessToken(), template.getUnitId(), template);
+        }
+    }
+}

+ 19 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouCreateUnitJob.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class KuaishouCreateUnitJob {
+
+
+    @Autowired
+    private IKuaiShouGroupTemplateService groupTemplateService;
+
+    @XxlJob("kuaihouCreateUnit")
+    public void execute() {
+        groupTemplateService.createUnit();
+    }
+}

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

@@ -28,8 +28,6 @@ public class KuaishouDailyAudienceReportJob {
     @Autowired
     private IKuaishouAudienceReportDailyService kuaishouAudienceReportDailyService;
     @Autowired
-    private IKuaiShouCampaignService kuaiShouCampaignService;
-    @Autowired
     private IKuaiShouGroupService kuaiShouGroupService;
 
     static ExecutorService executorService = Executors.newFixedThreadPool(6);

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

@@ -1201,6 +1201,19 @@ public class BatchController {
         return result;
     }
 
+
+    @GetMapping(value = "/getActionBarTextByType")
+    public Result<List<KuaiShouActionBarText>> getActionBarTextByType(Integer type) {
+        Result<List<KuaiShouActionBarText>> result = new Result<>();
+        QueryWrapper<KuaiShouActionBarText> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("type", type);
+        List<KuaiShouActionBarText> list = actionBarTextService.list(queryWrapper);
+        result.setSuccess(true);
+        result.setResult(list);
+        return result;
+    }
+
+
     /**
      * 创建创意
      *

+ 5 - 13
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/CollectionSlogansController.java

@@ -21,15 +21,7 @@ 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.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
@@ -86,7 +78,7 @@ public class CollectionSlogansController {
     /**
      * 添加
      *
-     * @param CollectionSlogans
+     * @param
      * @return
      */
     @AutoLog(value = "收藏的广告语-添加")
@@ -95,7 +87,7 @@ public class CollectionSlogansController {
     public Result<JSONObject> add(@RequestBody JSONObject requestJson) {
         Result<JSONObject> result = new Result<>();
         try {
-            if(Check.isNull(requestJson.getJSONArray("coverSlogansList"))&&Check.isNull(requestJson.getJSONArray("captionsList"))&&Check.isNull(requestJson.getJSONArray("creativeTag"))){
+            if (Check.isNull(requestJson.getJSONArray("coverSlogansList")) && Check.isNull(requestJson.getJSONArray("captionsList")) && Check.isNull(requestJson.getJSONArray("creativeTag"))) {
                 result.setMessage("请输入广告语");
                 result.setSuccess(false);
                 return result;
@@ -181,9 +173,9 @@ public class CollectionSlogansController {
     @AutoLog(value = "收藏的广告语-通过userId查询")
     @ApiOperation(value = "收藏的广告语-通过id查询", notes = "收藏的广告语-通过id查询")
     @GetMapping(value = "/getByUserId")
-    public Result<JSONObject> queryById(String userId,String accountId,String type) {
+    public Result<JSONObject> queryById(String userId, String accountId, String type) {
         Result<JSONObject> result = new Result<>();
-        JSONObject CollectionSlogans = CollectionSlogansService.getByUserId(userId,accountId,type);
+        JSONObject CollectionSlogans = CollectionSlogansService.getByUserId(userId, accountId, type);
         if (CollectionSlogans == null) {
             result.error500("未找到对应实体");
         } else {

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

@@ -0,0 +1,342 @@
+package cn.com.ctop.kuaishou.modules.batch.controller;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTemplate;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+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.DateUtils;
+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 2020-12-15
+ */
+@Slf4j
+@Api(tags = "创建组模板")
+@RestController
+@RequestMapping("/batch/kuaiShouGroupTemplate")
+public class KuaiShouGroupTemplateController {
+    @Autowired
+    private IKuaiShouGroupTemplateService kuaiShouGroupTemplateService;
+
+
+    /**
+     * 批量创建广告组
+     *
+     * @param requestJson
+     * @return
+     */
+    @PostMapping(value = "/submitUnitTask")
+    public Result<JSONObject> submitUnitTask(@RequestBody JSONObject requestJson) {
+        System.err.println(requestJson);
+        Result<JSONObject> result = new Result<>();
+        try {
+            if (Check.isNull(requestJson)) {
+                throw new Exception("参数不能为空");
+            }
+            JSONObject returnJson = kuaiShouGroupTemplateService.submitUnitTask(requestJson);
+            result.setSuccess(true);
+            result.setResult(returnJson);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+
+    }
+
+    @GetMapping(value = "/createUnit")
+    public Result<JSONObject> createUnit() {
+        Result<JSONObject> result = new Result<>();
+        try {
+            kuaiShouGroupTemplateService.createUnit();
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+
+    }
+
+
+    /**
+     * 获取api今日创建创意数
+     *
+     * @param accountId
+     * @return
+     */
+    @GetMapping(value = "/getApiCreateCount")
+    public Result<Integer> getApiCreateCount(Long accountId) {
+        Result<Integer> result = new Result<>();
+        try {
+            if (Check.isNull(accountId)) {
+                throw new Exception("accountId参数不能为空");
+            }
+            String date = DateUtils.getNowDate("yyyy-MM-dd");
+            Integer count = kuaiShouGroupTemplateService.getApiCreateCount(accountId, date);
+            result.setSuccess(true);
+            result.setResult(count);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+
+    }
+
+
+    @GetMapping(value = "/getUrlByPhotoId")
+    public Result<JSONObject> getUrlByPhotoId(Long photoId) {
+        Result<JSONObject> result = new Result<>();
+        try {
+            if (Check.isNull(photoId)) {
+                throw new Exception("photoId参数不能为空");
+            }
+            JSONObject urlJson = kuaiShouGroupTemplateService.getUrlByPhotoId(photoId);
+            result.setSuccess(true);
+            result.setResult(urlJson);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaiShouGroupTemplate
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "创建组模板-分页列表查询")
+    @ApiOperation(value = "创建组模板-分页列表查询", notes = "创建组模板-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaiShouGroupTemplate>> queryPageList(KuaiShouGroupTemplate kuaiShouGroupTemplate,
+                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                              HttpServletRequest req) {
+        Result<IPage<KuaiShouGroupTemplate>> result = new Result<>();
+        QueryWrapper<KuaiShouGroupTemplate> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouGroupTemplate, req.getParameterMap());
+        queryWrapper.orderByDesc("create_time");
+        Page<KuaiShouGroupTemplate> page = new Page<KuaiShouGroupTemplate>(pageNo, pageSize);
+        IPage<KuaiShouGroupTemplate> pageList = kuaiShouGroupTemplateService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouGroupTemplate
+     * @return
+     */
+    @AutoLog(value = "创建组模板-添加")
+    @ApiOperation(value = "创建组模板-添加", notes = "创建组模板-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouGroupTemplate> add(@RequestBody KuaiShouGroupTemplate kuaiShouGroupTemplate) {
+        Result<KuaiShouGroupTemplate> result = new Result<>();
+        try {
+            kuaiShouGroupTemplateService.save(kuaiShouGroupTemplate);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouGroupTemplate
+     * @return
+     */
+    @AutoLog(value = "创建组模板-编辑")
+    @ApiOperation(value = "创建组模板-编辑", notes = "创建组模板-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouGroupTemplate> edit(@RequestBody KuaiShouGroupTemplate kuaiShouGroupTemplate) {
+        Result<KuaiShouGroupTemplate> result = new Result<KuaiShouGroupTemplate>();
+        KuaiShouGroupTemplate kuaiShouGroupTemplateEntity = kuaiShouGroupTemplateService.getById(kuaiShouGroupTemplate.getId());
+        if (kuaiShouGroupTemplateEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouGroupTemplateService.updateById(kuaiShouGroupTemplate);
+            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 {
+            kuaiShouGroupTemplateService.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<KuaiShouGroupTemplate> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaiShouGroupTemplate> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouGroupTemplateService.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<KuaiShouGroupTemplate> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouGroupTemplate> result = new Result<>();
+        KuaiShouGroupTemplate kuaiShouGroupTemplate = kuaiShouGroupTemplateService.getById(id);
+        if (kuaiShouGroupTemplate == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouGroupTemplate);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouGroupTemplate> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouGroupTemplate kuaiShouGroupTemplate = JSON.parseObject(deString, KuaiShouGroupTemplate.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouGroupTemplate, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouGroupTemplate> pageList = kuaiShouGroupTemplateService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "创建组模板列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouGroupTemplate.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<KuaiShouGroupTemplate> listKuaiShouGroupTemplates = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouGroupTemplate.class, params);
+                kuaiShouGroupTemplateService.saveBatch(listKuaiShouGroupTemplates);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouGroupTemplates.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

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

@@ -117,9 +117,9 @@ public class KuaishouStrategyController {
     @AutoLog(value = "kuaishou.modules.batch-优化评估策略表-编辑")
     @ApiOperation(value = "kuaishou.modules.batch-优化评估策略表-编辑", notes = "kuaishou.modules.batch-优化评估策略表-编辑")
     @PostMapping(value = "/edit")
-    public Result<?> edit(@RequestBody JSONArray ids) {
+    public Result<?> edit(@RequestBody JSONObject data) {
         try {
-            return kuaishouStrategyService.shutDownPlan(ids);
+            return kuaishouStrategyService.shutDownPlan(data);
         } catch (Exception e) {
             log.error("关停策略下的计划异常", e);
         }

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

@@ -0,0 +1,235 @@
+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 2020-12-15
+ */
+@Data
+@TableName("ctop_kuaishou_group_template")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_group_template对象", description = "创建组模板")
+public class KuaiShouGroupTemplate {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+
+    private String userId;
+
+    /**
+     * 计划ID
+     */
+    @Excel(name = "计划ID", width = 15)
+    @ApiModelProperty(value = "计划ID")
+    private Long campaignId;
+    /**
+     * 广告组ID
+     */
+    @Excel(name = "广告组ID", width = 15)
+    @ApiModelProperty(value = "广告组ID")
+    private Long unitId;
+    /**
+     * 广告组名称
+     */
+    @Excel(name = "广告组名称", width = 15)
+    @ApiModelProperty(value = "广告组名称")
+    private String unitName;
+    /**
+     * 定向模板id
+     */
+    @Excel(name = "定向模板id", width = 15)
+    @ApiModelProperty(value = "定向模板id")
+    private Long templateId;
+    /**
+     * 优化目标出价类型 1: CPM 2: CPC 10:OCPM
+     */
+    @Excel(name = "优化目标出价类型 1: CPM 2: CPC 10:OCPM", width = 15)
+    @ApiModelProperty(value = "优化目标出价类型 1: CPM 2: CPC 10:OCPM")
+    private Integer bidType;
+    /**
+     * 优先从系统应用商店下载
+     */
+    @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 Long bid;
+    /**
+     * OCPC出价
+     */
+    @Excel(name = "OCPC出价", width = 15)
+    @ApiModelProperty(value = "OCPC出价")
+    private Long cpaBid;
+    /**
+     * 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 Long deepConversionBid;
+    /**
+     * 广告位 1:优选广告位;
+     */
+    @Excel(name = "广告位 1:优选广告位;", width = 15)
+    @ApiModelProperty(value = "广告位 1:优选广告位;")
+    private String sceneId;
+    /**
+     * 创意制作方式 4: 自定义
+     */
+    @Excel(name = "创意制作方式 4: 自定义", width = 15)
+    @ApiModelProperty(value = "创意制作方式 4: 自定义")
+    private Integer unitType;
+    /**
+     * 投放开始时间
+     */
+    @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;
+    /**
+     * 单日预算
+     */
+    @Excel(name = "单日预算", width = 15)
+    @ApiModelProperty(value = "单日预算")
+    private Long dayBudget;
+    /**
+     * 转化目标
+     */
+    @Excel(name = "转化目标", width = 15)
+    @ApiModelProperty(value = "转化目标")
+    private Long convertId;
+    /**
+     * 当计划类型为3时(获取电商下单)时有返回。
+     */
+    @Excel(name = "当计划类型为3时(获取电商下单)时有返回。", width = 15)
+    @ApiModelProperty(value = "当计划类型为3时(获取电商下单)时有返回。")
+    private Integer urlType;
+    /**
+     * 投放链接
+     */
+    @Excel(name = "投放链接", width = 15)
+    @ApiModelProperty(value = "投放链接")
+    private String url;
+    /**
+     * APP ID
+     */
+    @Excel(name = "APP ID", width = 15)
+    @ApiModelProperty(value = "APP ID")
+    private Long appId;
+    /**
+     * 创意展现方式  0:未知, 1:轮播,
+     */
+    @Excel(name = "创意展现方式  0:未知, 1:轮播,", width = 15)
+    @ApiModelProperty(value = "创意展现方式  0:未知, 1:轮播,")
+    private Integer showMode;
+    /**
+     * 投放方式  0:未知, 1:正常投
+     */
+    @Excel(name = "投放方式  0:未知, 1:正常投", width = 15)
+    @ApiModelProperty(value = "投放方式  0:未知, 1:正常投")
+    private Integer speed;
+
+    private Long photoId;
+    /**
+     * 0:未提交 1:创建成功 2:创建失败
+     */
+    @Excel(name = "0:未提交 1:创建成功 2:创建失败", width = 15)
+    @ApiModelProperty(value = "0:未提交 1:创建成功 2:创建失败")
+    private Integer taskStatus;
+    /**
+     * 失败原因
+     */
+    @Excel(name = "失败原因", width = 15)
+    @ApiModelProperty(value = "失败原因")
+    private String reviewDetail;
+
+
+    private String clickTrackUrl;
+    private String actionbarClickUrl;
+    private Integer creativeCategory;
+    private String creativeTag;
+    private String creativeName;
+    private String actionBarText;
+    private String description;
+    private Long siteId;
+    private Integer createCreativeCount;
+    private Integer creativeStatus;
+    private String creativeReviewDetail;
+
+
+    /**
+     * 创建时间
+     */
+    @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;
+}

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

@@ -207,6 +207,14 @@ public class KuaishouStrategy {
      */
     private String urlType;
     /**
+     * 是否优先从应用商店下载  true false
+     */
+    private String useAppMarket;
+    /**
+     * 请勾选投放应用已上架的应用商店
+     */
+    private String appStore;
+    /**
      * 第三方点击检测链接
      */
     private String clickTrackUrl;

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

@@ -0,0 +1,57 @@
+package cn.com.ctop.kuaishou.modules.batch.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 快手-策略和计划启动/关停关系表
+ * @author jeecg-boot
+ * @date   2020-12-18
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_kuaishou_strategy_campaign_rel")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_kuaishou_strategy_campaign_rel对象", description="快手-策略和计划启动/关停关系表")
+public class kuaishoustrategycampaignRel {
+    
+	/**策略ID*/
+	@TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "策略ID")
+	private Long id;
+	/**策略id*/
+	@Excel(name = "策略id", width = 15)
+    @ApiModelProperty(value = "策略id")
+	private Long strategyId;
+	/**账户ID*/
+	@Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+	private Long accountId;
+	/**策略状态 0 关停,1激活*/
+	@Excel(name = "策略状态 0 关停,1激活", width = 15)
+    @ApiModelProperty(value = "策略状态 0 关停,1激活")
+	private String strategyState;
+	/**计划id*/
+	@Excel(name = "计划id", width = 15)
+    @ApiModelProperty(value = "计划id")
+	private Long campaignId;
+	/**创建时间*/
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**updateTime*/
+    @ApiModelProperty(value = "updateTime")
+	private Date updateTime;
+}

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

@@ -0,0 +1,26 @@
+package cn.com.ctop.kuaishou.modules.batch.mapper;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTemplate;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 创建组模板
+ *
+ * @author: jeecg-boot
+ * @date: 2020-12-15
+ * @cersion: V1.0
+ */
+public interface KuaiShouGroupTemplateMapper extends BaseMapper<KuaiShouGroupTemplate> {
+
+    JSONObject getMd5ByPhotoId(@Param("photoId") Long photoId);
+
+    List<JSONObject> getImageListByMd5(@Param("md5") String md5);
+
+    Integer getApiCreateCount(@Param("accountId") Long accountId, @Param("date") String date);
+
+    JSONObject getUrlByPhotoId(@Param("photoId") Long photoId);
+}

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

@@ -30,6 +30,10 @@ public interface KuaiShouReportDailyMaterialMapper extends BaseMapper<KuaiShouRe
 
     void batchReplace(@Param("addList") List<KuaiShouReportDailyMaterial> addList);
 
+    KuaiShouReportDailyMaterial getEtlDataByParams(@Param("signature")String signature,@Param("date") String date);
+
+    List<KuaiShouReportDailyMaterial> getSignatureByDate(@Param("date")String date);
+
 
     List<KuaiShouReportDailyMaterial> getHighQualityMaterialId(@Param(value = "accountId") Long accountId,
                                                                @Param(value = "days") Integer days,

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.batch.mapper;
+
+import java.util.List;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.kuaishoustrategycampaignRel;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 快手-策略和计划启动/关停关系表
+ * @author: jeecg-boot
+ * @date:   2020-12-18
+ * @cersion: V1.0
+ */
+public interface kuaishoustrategycampaignRelMapper extends BaseMapper<kuaishoustrategycampaignRel> {
+
+    List<JSONObject> queryPlanIdsByStrategyId(Object id);
+}

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

@@ -0,0 +1,41 @@
+<?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.KuaiShouGroupTemplateMapper">
+
+    <select id="getMd5ByPhotoId" resultType="com.alibaba.fastjson.JSONObject">
+    select
+    signature  as 'md5',
+    material_type as 'materialType'
+    from ctop_kuaishou_video_get
+    where  photo_id = #{photoId}
+    and signature is not null
+    limit 1
+    </select>
+
+    <select id="getImageListByMd5" resultType="com.alibaba.fastjson.JSONObject">
+      select
+      signature as 'md5',
+      url as 'url'
+      from ctop_material_cut_frame
+      where video_signature = #{md5}
+      limit 6
+    </select>
+    <select id="getApiCreateCount" resultType="java.lang.Integer">
+    select count(1)
+    from
+    ctop_kuaishou_creative
+    where  account_id = #{accountId}
+    and DATE_FORMAT(creative_create_time,'%Y-%m-%d') = #{date}
+    </select>
+
+    <select id="getUrlByPhotoId" resultType="com.alibaba.fastjson.JSONObject">
+     select
+     cover_url as 'coverUrl',
+     url as 'url'
+     from
+     ctop_kuaishou_video_get
+     where  photo_id = #{photoId}
+     limit 1
+    </select>
+
+</mapper>

+ 35 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml

@@ -316,6 +316,39 @@
         ORDER BY
         sum(t1.charge) DESC
     </select>
+    <select id="getEtlDataByParams"
+            resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial">
+        select
+            channel_type,
+            signature,
+            cover_url,
+            photo_url,
+            min(stat_date)as 'stat_date',
+            sum(charge)as 'charge',
+            sum(photo_click)as 'photo_click',
+            sum(photo_show)as 'photo_show',
+            sum(aclick)as 'aclick',
+            sum(bclick)as 'bclick'
+        from ctop_kuaishou_report_daily_material
+        where
+            signature = #{signature}
+        and
+            stat_date&lt;=#{date}
+        group by signature
+    </select>
+    <select id="getSignatureByDate"
+            resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial">
+        select
+            distinct signature
+        from
+        ctop_kuaishou_report_daily_material
+        where
+            signature is not null
+        and
+            signature != ''
+        and
+            stat_date = #{date}
+    </select>
 
 
 
@@ -344,4 +377,5 @@
     </select>
 
 
-</mapper>
+</mapper>
+

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

@@ -0,0 +1,12 @@
+<?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.kuaishoustrategycampaignRelMapper">
+    <select id="queryPlanIdsByStrategyId" parameterType="java.util.Map" resultType="com.alibaba.fastjson.JSONObject">
+         select
+          id,
+          account_id as accountId,
+          campaign_id as campaignId
+          from ctop_kuaishou_strategy_campaign_rel
+         where strategy_id = #{id}
+    </select>
+</mapper>

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

@@ -0,0 +1,36 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTemplate;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 创建组模板
+ * @Author: jeecg-boot
+ * @Date: 2020-12-15
+ * @Version: V1.0
+ */
+public interface IKuaiShouGroupTemplateService extends IService<KuaiShouGroupTemplate> {
+
+    JSONObject submitUnitTask(JSONObject requestJson) throws Exception;
+
+    void createUnit();
+
+    /**
+     * 获取api创建数
+     *
+     * @param accountId
+     * @return
+     */
+    Integer getApiCreateCount(Long accountId, String date);
+
+    /**
+     * 通过photoId 获取 url
+     *
+     * @param photoId
+     * @return
+     */
+    JSONObject getUrlByPhotoId(Long photoId);
+
+    void createCreative(String accessToken, Long unitId, KuaiShouGroupTemplate template);
+}

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

@@ -1,7 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 
 public interface IKuaiShouOverRunSendMessageService {
-    void creativeOverRunSendMessage(Long accountId);
+    void creativeOverRunSendMessage(Long accountId, String userId);
 
 
 }

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

@@ -20,4 +20,7 @@ public interface IKuaiShouReportDailyMaterialService extends IService<KuaiShouRe
 
     void getMaterialReportByAccountIdAndStatDate(Long accountId, String token, String startDate, String endDate, Integer page);
 
+    List<KuaiShouReportDailyMaterial> getSignatureByDate(String date);
+
+    KuaiShouReportDailyMaterial getEtlDataByParams(String signature, String date);
 }

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

@@ -459,7 +459,7 @@ public interface IKuaishouInterfaceService {
     JSONArray getPageList(Long accountId, String token, Long appId, String viewComp);
 
 
-    Map<String, Object> batchCreativeCreate(String accessToken, Long advertiserId, JSONObject requestJson, Integer count);
+    Map<String, Object> batchCreativeCreate(String accessToken, Long advertiserId, JSONObject requestJson, Integer count, String userId);
 
     void getCreativeByCreativeIds(String accessToken, Long advertiserId, JSONArray creativeIds);
 

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

@@ -24,7 +24,7 @@ public interface IKuaishouStrategyService extends IService<KuaishouStrategy> {
      * @throws
      * @author ZHAOXA
      */
-    Result<?> shutDownPlan(JSONArray ids);
+    Result<?> shutDownPlan(JSONObject data);
 
     /**
      * 创建快手广告计划

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

@@ -0,0 +1,18 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.kuaishoustrategycampaignRel;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * @Description: 快手-策略和计划启动/关停关系表
+ * @Author: jeecg-boot
+ * @Date: 2020-12-18
+ * @Version: V1.0
+ */
+public interface IkuaishoustrategycampaignRelService extends IService<kuaishoustrategycampaignRel> {
+
+    List<JSONObject>  queryPlanIdsByStrategyId(Long id);
+}

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

@@ -1520,7 +1520,7 @@ public class BatchServiceImpl implements IBatchService {
                                 creative.put("image_token", imageToken);
                                 creativeJson.put("click_track_url", click_track_url);
                             }
-                            if(!Check.isNull(actionbar_click_url)){
+                            if (!Check.isNull(actionbar_click_url)) {
                                 creativeJson.put("actionbar_click_url", actionbar_click_url);
                             }
 
@@ -1535,7 +1535,7 @@ public class BatchServiceImpl implements IBatchService {
             creativeJson.put("creatives", creatives);
         }
 
-        Map<String, Object> returnUnitMap = kuaishouInterfaceService.batchCreativeCreate(oauthToken.getAccessToken(), accountId, creativeJson, 1);
+        Map<String, Object> returnUnitMap = kuaishouInterfaceService.batchCreativeCreate(oauthToken.getAccessToken(), accountId, creativeJson, 1, null);
         return returnUnitMap;
     }
 

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

@@ -550,7 +550,7 @@ public class CrossAccountBatchServiceImpl implements ICrossAccountBatchService {
                         aCreativeCreate(requestJson, count + 1);
                     }
                     if (code == 400001 && "/rest/openapi/v2/creative/create调用已超日限,次日可恢复调用".equals(resultJson.getString("message"))) {
-                        overRunSendMessageService.creativeOverRunSendMessage(advertiserId);
+                        overRunSendMessageService.creativeOverRunSendMessage(advertiserId, null);
                     }
                     log.error("创建广告创意失败,advertiser_id:{},返回信息:{},入参:{}", advertiserId, resultJson, requestJson, count + 1);
                     retuenJson.put("code", -1);

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

@@ -0,0 +1,595 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTemplate;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouTemplateTarget;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTemplateMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
+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.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 创建组模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-12-15
+ */
+@Service
+@Slf4j
+public class KuaiShouGroupTemplateServiceImpl extends ServiceImpl<KuaiShouGroupTemplateMapper, KuaiShouGroupTemplate> implements IKuaiShouGroupTemplateService {
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    @Autowired
+    private IKuaishouInterfaceService iKuaishouInterfaceService;
+    @Autowired
+    private KuaiShouGroupTemplateMapper groupTemplateMapper;
+    @Autowired
+    private IKuaiShouImageGetService imageGetService;
+    @Autowired
+    private IKuaiShouMaterialUploadService uploadService;
+    @Autowired
+    private IKuaishouTemplateTargetService templateTargetService;
+
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+
+    /**
+     * 提交创建任务
+     *
+     * @param requestJson
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public JSONObject submitUnitTask(JSONObject requestJson) throws Exception {
+        Long accountId = requestJson.getLong("accountId");
+        if (Check.isNull(accountId)) {
+            throw new Exception("accountId不能为空");
+        }
+        Long campaignId = requestJson.getLong("campaignId");
+        if (Check.isNull(campaignId)) {
+            throw new Exception("campaignId不能为空");
+        }
+        Integer createCount = requestJson.getInteger("createCount");
+        if (Check.isNull(createCount)) {
+            throw new Exception("创建数不能为空不能为空");
+        }
+        JSONArray photoArr = requestJson.getJSONArray("photoArr");
+        if (Check.isNull(photoArr)) {
+            throw new Exception("请选择需要创建的视频");
+        }
+        if (createCount != photoArr.size()) {
+            throw new Exception("视频数量必须和创建数量保持一致");
+        }
+        JSONObject returnJson = new JSONObject();
+
+        String userId = requestJson.getString("userId");
+        String unitName = requestJson.getString("unitName");
+        Long template_id = requestJson.getLong("templateId");
+        Integer bid_type = requestJson.getInteger("bidType");
+        Integer use_app_market = requestJson.getInteger("useAppMarket");
+        JSONArray app_store = requestJson.getJSONArray("appStore");
+        Long bid = requestJson.getLong("bid");
+        Long cpa_bid = requestJson.getLong("cpaBid");
+        Integer ocpx_action_type = requestJson.getInteger("ocpxActionType");
+        Integer deep_conversion_type = requestJson.getInteger("deepConversionType");
+        Long deep_conversion_bid = requestJson.getLong("deepConversionBid");
+        JSONArray scene_id = requestJson.getJSONArray("sceneId");
+        Integer unit_type = requestJson.getInteger("unitType");
+        String begin_time = requestJson.getString("beginTime");
+        String end_time = requestJson.getString("endTime");
+        String schedule_time = requestJson.getString("scheduleTime");
+        Long day_budget = requestJson.getLong("dayBudget");
+        Long convert_id = requestJson.getLong("convertId");
+        Integer url_type = requestJson.getInteger("urlType");
+        String url = requestJson.getString("url");
+        Long app_id = requestJson.getLong("appId");
+        Integer show_mode = requestJson.getInteger("showMode");
+        Integer speed = requestJson.getInteger("speed");
+        String click_track_url = requestJson.getString("clickTrackUrl");
+        String actionbar_click_url = requestJson.getString("actionbarClickUrl");
+        Integer creative_category = requestJson.getInteger("creativeCategory");
+        JSONArray creative_tag = requestJson.getJSONArray("creativeTag");
+        String creative_name = requestJson.getString("creativeName");
+        String action_bar_text = requestJson.getString("actionBarText");
+        String description = requestJson.getString("description");
+        Long site_id = requestJson.getLong("siteId");
+
+        List<KuaiShouGroupTemplate> templates = new ArrayList<>();
+        for (int i = 0; i < createCount; i++) {
+            Long photoId = photoArr.getLong(i);
+            String name = unitName + "_" + i;
+            KuaiShouGroupTemplate template = new KuaiShouGroupTemplate();
+            template.setAccountId(accountId);
+            template.setUserId(userId);
+            template.setCampaignId(campaignId);
+            template.setUnitName(name);
+            template.setPhotoId(photoId);
+            if (!Check.isNull(template_id)) {
+                template.setTemplateId(template_id);
+            }
+            if (!Check.isNull(bid_type)) {
+                template.setBidType(bid_type);
+            }
+            if (!Check.isNull(use_app_market)) {
+                template.setUseAppMarket(use_app_market);
+            }
+            if (!Check.isNull(app_store)) {
+                template.setAppStore(app_store.toJSONString());
+            }
+            if (!Check.isNull(bid)) {
+                template.setBid(bid);
+            }
+            if (!Check.isNull(cpa_bid)) {
+                template.setCpaBid(cpa_bid);
+            }
+            if (!Check.isNull(ocpx_action_type)) {
+                template.setOcpxActionType(ocpx_action_type);
+            }
+            if (!Check.isNull(deep_conversion_type)) {
+                template.setDeepConversionType(deep_conversion_type);
+            }
+            if (!Check.isNull(deep_conversion_bid)) {
+                template.setDeepConversionBid(deep_conversion_bid);
+            }
+            if (!Check.isNull(scene_id)) {
+                template.setSceneId(scene_id.toJSONString());
+            }
+            if (!Check.isNull(unit_type)) {
+                template.setUnitType(unit_type);
+            }
+            if (!Check.isNull(begin_time)) {
+                template.setBeginTime(begin_time);
+            }
+            if (!Check.isNull(end_time)) {
+                template.setEndTime(end_time);
+            }
+            if (!Check.isNull(schedule_time)) {
+                template.setScheduleTime(schedule_time);
+            }
+            if (!Check.isNull(day_budget)) {
+                template.setDayBudget(day_budget);
+            }
+            if (!Check.isNull(convert_id)) {
+                template.setConvertId(convert_id);
+            }
+            if (!Check.isNull(url_type)) {
+                template.setUrlType(url_type);
+            }
+            if (!Check.isNull(url)) {
+                template.setUrl(url);
+            }
+            if (!Check.isNull(app_id)) {
+                template.setAppId(app_id);
+            }
+            if (!Check.isNull(show_mode)) {
+                template.setShowMode(show_mode);
+            }
+            if (!Check.isNull(speed)) {
+                template.setSpeed(speed);
+            }
+            if (!Check.isNull(click_track_url)) {
+                template.setClickTrackUrl(click_track_url);
+            }
+            if (!Check.isNull(actionbar_click_url)) {
+                template.setActionbarClickUrl(actionbar_click_url);
+            }
+            if (!Check.isNull(creative_category)) {
+                template.setCreativeCategory(creative_category);
+            }
+            if (!Check.isNull(creative_tag)) {
+                template.setCreativeTag(creative_tag.toJSONString());
+            }
+            if (!Check.isNull(creative_name)) {
+                template.setCreativeName(creative_name);
+            }
+            if (!Check.isNull(action_bar_text)) {
+                template.setActionBarText(action_bar_text);
+            }
+            if (!Check.isNull(description)) {
+                template.setDescription(description);
+            }
+            if (!Check.isNull(description)) {
+                template.setDescription(description);
+            }
+            if (!Check.isNull(site_id)) {
+                template.setSiteId(site_id);
+            }
+            template.setTaskStatus(0);
+            template.setCreativeReviewDetail("创意待创建");
+            template.setCreativeStatus(0);
+            templates.add(template);
+        }
+        boolean b = this.saveBatch(templates);
+        if (b) {
+            returnJson.put("code", 0);
+            returnJson.put("size", templates.size());
+        } else {
+            returnJson.put("code", -1);
+            returnJson.put("message", "提交任务失败");
+        }
+
+        return returnJson;
+    }
+
+
+    /**
+     * 创建组
+     */
+    @Override
+    public void createUnit() {
+        QueryWrapper<KuaiShouGroupTemplate> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("task_status", 0);
+        queryWrapper.orderByAsc("create_time");
+        queryWrapper.last("limit 30");
+        List<KuaiShouGroupTemplate> list = this.list(queryWrapper);
+        if (Check.isNull(list)) {
+            log.error("暂未未创建的组");
+            return;
+        }
+        for (KuaiShouGroupTemplate template : list) {
+            executorService.submit(new Runnable() {
+                @Override
+                public void run() {
+                    Long accountId = template.getAccountId();
+                    CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+                    if (Check.isNull(token)) {
+                        return;
+                    }
+                    KuaiShouGroupTemplate updateTemplate = new KuaiShouGroupTemplate();
+                    updateTemplate.setId(template.getId());
+                    updateTemplate.setTaskStatus(1);
+                    updateById(updateTemplate);   // 修改状态为创建中
+                    JSONObject createUnitJson = new JSONObject();
+
+                    JSONArray sceneIdArr = JSONArray.parseArray(template.getSceneId());
+                    if (Check.isNull(sceneIdArr)) {
+                        updateTemplate.setTaskStatus(3);
+                        updateTemplate.setReviewDetail("scene_id不能为空");
+                        updateTemplate.setCreativeStatus(3);
+                        updateTemplate.setCreativeReviewDetail("组创建失败");
+                        updateById(updateTemplate);
+                        return;
+                    }
+                    createUnitJson.put("scene_id", sceneIdArr); //资源位置
+                    Integer sceneId = (Integer) sceneIdArr.get(0);
+                    if (sceneId != 5) {
+                        if (!Check.isNull(template.getTemplateId())) {
+                            createUnitJson.put("template_id", template.getTemplateId());
+                        }
+                    } else {
+                        if (!Check.isNull(template.getTemplateId())) {
+                            JSONObject unionJson = getUnionJson(template.getTemplateId());
+                            if (unionJson.getInteger("code") != 0) {
+                                updateTemplate.setTaskStatus(3);
+                                updateTemplate.setReviewDetail(unionJson.getString("message"));
+                                updateTemplate.setCreativeStatus(3);
+                                updateTemplate.setCreativeReviewDetail("组创建失败");
+                                updateById(updateTemplate);
+                                return;
+                            } else {
+                                createUnitJson.put("target", unionJson.getJSONObject("target"));
+                            }
+                        }
+                    }
+                    createUnitJson.put("campaign_id", template.getCampaignId());
+                    createUnitJson.put("unit_name", template.getUnitName());
+                    if (!Check.isNull(template.getBidType())) {
+                        createUnitJson.put("bid_type", template.getBidType()); // 优化目标类型
+                    }
+                    if (!Check.isNull(template.getUseAppMarket())) {
+                        createUnitJson.put("use_app_market", template.getUseAppMarket()); //优先从系统应用商店下载
+                    }
+                    if (!Check.isNull(template.getAppStore())) {
+                        createUnitJson.put("app_store", JSONArray.parseArray(template.getAppStore())); //应用商店列表
+                    }
+                    if (!Check.isNull(template.getBid())) {
+                        createUnitJson.put("bid", template.getBid()); //出价
+                    }
+                    if (!Check.isNull(template.getCpaBid())) {
+                        createUnitJson.put("cpa_bid", template.getCpaBid()); //出价
+                    }
+                    if (!Check.isNull(template.getOcpxActionType())) {
+                        createUnitJson.put("ocpx_action_type", template.getOcpxActionType()); //优化目标
+                    }
+                    if (!Check.isNull(template.getDeepConversionType())) {
+                        createUnitJson.put("deep_conversion_type", template.getDeepConversionType()); //深度转化目标
+                    }
+                    if (!Check.isNull(template.getDeepConversionBid())) {
+                        createUnitJson.put("deep_conversion_bid", template.getDeepConversionBid()); //深度转化目标出价
+                    }
+                    if (!Check.isNull(template.getUnitType())) {
+                        createUnitJson.put("unit_type", template.getUnitType()); //创意制作方式
+                    }
+                    if (!Check.isNull(template.getBeginTime())) {
+                        createUnitJson.put("begin_time", template.getBeginTime()); //投放开始时间
+                    }
+                    if (!Check.isNull(template.getEndTime())) {
+                        createUnitJson.put("end_time", template.getEndTime()); //投放结束时间
+                    }
+                    if (!Check.isNull(template.getScheduleTime())) {
+                        createUnitJson.put("schedule_time", template.getScheduleTime()); //投放时间段
+                    }
+                    if (!Check.isNull(template.getDayBudget())) {
+                        createUnitJson.put("day_budget", template.getDayBudget()); //单日预算金额
+                    }
+                    if (!Check.isNull(template.getConvertId())) {
+                        createUnitJson.put("convert_id", template.getConvertId()); //转化目标ID
+                    }
+                    if (!Check.isNull(template.getUrlType())) {
+                        createUnitJson.put("url_type", template.getUrlType()); //url类型
+                    }
+                    if (!Check.isNull(template.getUrl())) {
+                        createUnitJson.put("url", template.getUrl()); // 投放链接
+                    }
+                    if (!Check.isNull(template.getAppId())) {
+                        createUnitJson.put("app_id", template.getAppId()); // 应用ID
+                    }
+                    if (!Check.isNull(template.getShowMode())) {
+                        createUnitJson.put("show_mode", template.getShowMode()); // 创意展现方式
+                    }
+                    if (!Check.isNull(template.getSpeed())) {
+                        createUnitJson.put("speed", template.getSpeed()); // 投放方式
+                    }
+                    Map<String, Object> groupMap = iKuaishouInterfaceService.adUnitCreate(token.getAccessToken(), accountId, createUnitJson, 1);
+                    updateTemplate = new KuaiShouGroupTemplate();
+                    updateTemplate.setId(template.getId());
+                    Integer code = (Integer) groupMap.get("code");
+                    if (code == 0) {
+                        updateTemplate.setTaskStatus(2);
+                        Long unit = (Long) groupMap.get("unitId");
+                        updateTemplate.setUnitId((unit));
+                        Thread thread = new Thread() {
+                            @Override
+                            public void run() {
+                                createCreative(token.getAccessToken(), unit, template);
+                            }
+                        };
+                        thread.start();
+                    } else {
+                        updateTemplate.setTaskStatus(3);
+                        updateTemplate.setReviewDetail((String) groupMap.get("message"));
+                        updateTemplate.setCreativeStatus(3);
+                        updateTemplate.setCreativeReviewDetail("组创建失败");
+                    }
+                    updateById(updateTemplate);
+                    try {
+                        Thread.sleep(2 * 1000);
+                    } catch (InterruptedException e) {
+                        e.printStackTrace();
+                    }
+                }
+            });
+        }
+
+    }
+
+
+    /**
+     * 根据模板id 获取联盟定向
+     *
+     * @return
+     */
+    private JSONObject getUnionJson(Long templateId) {
+        JSONObject returnJson = new JSONObject();
+        QueryWrapper<KuaishouTemplateTarget> targetQueryWrapper = new QueryWrapper<>();
+        targetQueryWrapper.eq("template_id", templateId);
+        targetQueryWrapper.last("limit 1");
+        KuaishouTemplateTarget templateTarget = templateTargetService.getOne(targetQueryWrapper);
+        if (Check.isNull(templateTarget)) {
+            returnJson.put("code", -1);
+            returnJson.put("message", "根据模板id未获取到模板详情");
+            return returnJson;
+        }
+        JSONObject target = new JSONObject();
+        if (!Check.isNull(templateTarget.getRegion())) {
+            target.put("region", JSONArray.parseArray(templateTarget.getRegion()));
+        }
+
+        if (!Check.isNull(templateTarget.getMax()) && !Check.isNull(templateTarget.getMin())) {
+            JSONObject ageJson = new JSONObject();
+            if (!Check.isNull(templateTarget.getMax())) {
+                ageJson.put("max", templateTarget.getMax());
+            }
+            if (!Check.isNull(templateTarget.getMin())) {
+                ageJson.put("min", templateTarget.getMin());
+            }
+            target.put("age", ageJson);
+        }
+        if (!Check.isNull(templateTarget.getAgesRange())) {
+            target.put("ages_range", JSONArray.parseArray(templateTarget.getAgesRange()));
+        }
+
+        if (!Check.isNull(templateTarget.getGender())) {
+            target.put("gender", templateTarget.getGender());
+        }
+
+        if (!Check.isNull(templateTarget.getPlatformOs())) {
+            target.put("platform_os", templateTarget.getPlatformOs());
+        }
+
+        if (!Check.isNull(templateTarget.getAndroidOsv())) {
+            target.put("android_osv", templateTarget.getAndroidOsv());
+        }
+
+        if (!Check.isNull(templateTarget.getIosOsv())) {
+            target.put("ios_osv", templateTarget.getIosOsv());
+        }
+
+        if (!Check.isNull(templateTarget.getNetwork())) {
+            target.put("network", templateTarget.getNetwork());
+        }
+
+        if (!Check.isNull(templateTarget.getDeviceBrand())) {
+            target.put("device_brand", JSONArray.parseArray(templateTarget.getDeviceBrand()));
+        }
+
+        if (!Check.isNull(templateTarget.getDevicePrice())) {
+            target.put("device_price", JSONArray.parseArray(templateTarget.getDevicePrice()));
+        }
+
+        if (!Check.isNull(templateTarget.getAppInterest())) {
+            target.put("app_interest", JSONArray.parseArray(templateTarget.getAppInterest()));
+        }
+
+        if (!Check.isNull(templateTarget.getAppIds())) {
+            target.put("app_ids", JSONArray.parseArray(templateTarget.getAppIds()));
+        }
+
+        if (!Check.isNull(templateTarget.getPopulation())) {
+            target.put("population", JSONArray.parseArray(templateTarget.getPopulation()));
+        }
+
+        if (!Check.isNull(templateTarget.getExcludePopulation())) {
+            target.put("exclude_population", JSONArray.parseArray(templateTarget.getExcludePopulation()));
+        }
+
+        if (!Check.isNull(templateTarget.getPaidAudience())) {
+            target.put("paid_audience", JSONArray.parseArray(templateTarget.getPaidAudience()));
+        }
+        returnJson.put("target", target);
+        returnJson.put("code", 0);
+        return returnJson;
+    }
+
+    /**
+     * 获取当天api创建创意数
+     *
+     * @param accountId
+     * @param date
+     * @return
+     */
+    @Override
+    public Integer getApiCreateCount(Long accountId, String date) {
+        return groupTemplateMapper.getApiCreateCount(accountId, date);
+    }
+
+    /**
+     * 根据photoId 获取视频、封面链接
+     *
+     * @param photoId
+     * @return
+     */
+    @Override
+    public JSONObject getUrlByPhotoId(Long photoId) {
+        return groupTemplateMapper.getUrlByPhotoId(photoId);
+    }
+
+
+    /**
+     * 创建创意
+     *
+     * @param accessToken
+     * @param unitId
+     * @param template
+     */
+    @Override
+    public void createCreative(String accessToken, Long unitId, KuaiShouGroupTemplate template) {
+        KuaiShouGroupTemplate updateTemplate = new KuaiShouGroupTemplate();
+        updateTemplate.setId(template.getId());
+        updateTemplate.setCreativeStatus(1);
+        updateTemplate.setCreativeReviewDetail("创意创建中");
+        this.updateById(updateTemplate);
+        Long photoId = template.getPhotoId();
+        JSONObject md5Json = groupTemplateMapper.getMd5ByPhotoId(photoId);
+        if (Check.isNull(md5Json)) {
+            log.error("未获取到素材详细信息,accountId:{},unitId:{}", template.getAccountId(), unitId);
+            updateTemplate.setCreativeStatus(3);
+            updateTemplate.setCreativeReviewDetail("未获取到素材信息");
+            this.updateById(updateTemplate);
+            return;
+        }
+        String md5 = md5Json.getString("md5");
+        List<JSONObject> imageList = groupTemplateMapper.getImageListByMd5(md5);
+        JSONObject createJson = new JSONObject();
+        createJson.put("unit_id", unitId);
+        if (!Check.isNull(template.getClickTrackUrl())) {
+            createJson.put("click_track_url", template.getClickTrackUrl());
+        }
+        if (!Check.isNull(template.getActionbarClickUrl())) {
+            createJson.put("actionbar_click_url", template.getActionbarClickUrl());
+        }
+        if (!Check.isNull(template.getCreativeCategory())) {
+            createJson.put("creative_category", template.getCreativeCategory());
+        }
+        if (!Check.isNull(template.getCreativeTag())) {
+            createJson.put("creative_tag", JSONArray.parseArray(template.getCreativeTag()));
+        }
+        Integer materialType = md5Json.getInteger("materialType");
+        JSONArray creatives = new JSONArray();
+        if (Check.isNull(imageList)) {
+            JSONObject json = new JSONObject();
+            json.put("creative_name", template.getCreativeName());
+            json.put("photo_id", template.getPhotoId());
+            json.put("creative_material_type", materialType);
+            json.put("action_bar_text", template.getActionBarText());
+            json.put("description", template.getDescription());
+            if (Check.isNull(template.getSiteId())) {
+                json.put("site_id", template.getSiteId());
+            }
+            creatives.add(json);
+        } else {
+            for (int i = 0; i < imageList.size(); i++) {
+                JSONObject imageJson = imageList.get(i);
+                if (Check.isNull(imageJson)) {
+                    continue;
+                }
+                JSONObject json = new JSONObject();
+                String signature = imageJson.getString("md5");
+                String imageToken = null;
+                if (!Check.isNull(signature)) {
+                    QueryWrapper<KuaiShouImageGet> queryWrapper = new QueryWrapper<>();
+                    queryWrapper.eq("account_id", template.getAccountId());
+                    queryWrapper.eq("signature", signature);
+                    queryWrapper.last("limit 1");
+                    KuaiShouImageGet imageGet = imageGetService.getOne(queryWrapper);
+                    if (!Check.isNull(imageGet)) {
+                        imageToken = imageGet.getImageToken();
+                    } else {
+                        String url = imageJson.getString("url");
+                        imageToken = uploadService.kuauiShouImageUpload(url, signature, template.getAccountId(), accessToken);
+                    }
+                }
+                if (Check.isNull(imageToken)) {
+                    continue;
+                }
+                json.put("image_token", imageToken);
+                json.put("creative_name", template.getCreativeName() + "_" + i);
+                json.put("photo_id", template.getPhotoId());
+                json.put("creative_material_type", materialType);
+                json.put("action_bar_text", template.getActionBarText());
+                json.put("description", template.getDescription());
+                if (Check.isNull(template.getSiteId())) {
+                    json.put("site_id", template.getSiteId());
+                }
+                creatives.add(json);
+            }
+        }
+        createJson.put("creatives", creatives);
+        Map<String, Object> creativeMap = iKuaishouInterfaceService.batchCreativeCreate(accessToken, template.getAccountId(), createJson, 1, template.getUserId());
+        Integer code = (Integer) creativeMap.get("code");
+        if (code == 0) {
+            updateTemplate.setCreativeStatus(2);
+            updateTemplate.setCreativeReviewDetail("创意创建成功");
+            updateTemplate.setCreateCreativeCount((Integer) creativeMap.get("count"));
+        } else {
+            updateTemplate.setCreativeStatus(3);
+            updateTemplate.setCreativeReviewDetail((String) creativeMap.get("message"));
+        }
+        this.updateById(updateTemplate);
+    }
+}

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

@@ -40,7 +40,7 @@ public class KuaiShouOverRunSendMessageServiceImpl extends ServiceImpl<KuaishouO
 
 
     @Override
-    public void creativeOverRunSendMessage(Long accountId) {
+    public void creativeOverRunSendMessage(Long accountId, String userId) {
 
         try {
             String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
@@ -61,12 +61,18 @@ public class KuaiShouOverRunSendMessageServiceImpl extends ServiceImpl<KuaishouO
 
             UserAllocation userAllocation = userAllocationService.getByAccountId(accountId);
             if (!Check.isNull(userAllocation)) {
-                String message = messageTemplate.getCreativeOverRunMessage(accountId, creativeCount, userAllocation.getAuthName());
-                LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-                if (Check.isNull(sysUser)) {
-                    return;
+                String sendUserId;
+                if (!Check.isNull(userId)) {
+                    sendUserId = userId;
+                } else {
+                    LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+                    if (Check.isNull(sysUser)) {
+                        return;
+                    }
+                    sendUserId = sysUser.getId();
                 }
-                sendMessageService.sendMessage(sysUser.getId(), message);
+                String message = messageTemplate.getCreativeOverRunMessage(accountId, creativeCount, userAllocation.getAuthName());
+                sendMessageService.sendMessage(sendUserId, message);
                 KuaishouOverRunLog addOverRunLog = new KuaishouOverRunLog();
                 addOverRunLog.setAccountId(accountId);
                 addOverRunLog.setMailType(1);

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

@@ -9,6 +9,7 @@ import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import cn.com.ctop.kuaishou.modules.report.entity.VideoGetvo;
 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.springframework.beans.factory.annotation.Autowired;
@@ -93,4 +94,14 @@ public class KuaiShouReportDailyMaterialServiceImpl extends ServiceImpl<KuaiShou
         dailyMaterialMapper.batchReplace(addList);
         getMaterialReportByAccountIdAndStatDate(accountId, token, startDate, endDate, page + 1);
     }
+
+    @Override
+    public List<KuaiShouReportDailyMaterial> getSignatureByDate(String date) {
+        return dailyMaterialMapper.getSignatureByDate(date);
+    }
+
+    @Override
+    public KuaiShouReportDailyMaterial getEtlDataByParams(String signature, String date) {
+        return dailyMaterialMapper.getEtlDataByParams(signature,date);
+    }
 }

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

@@ -1091,8 +1091,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
                         };
                         thread.start();
-
-
                         returnMap.put("code", 0);
                         returnMap.put("message", "success");
                         returnMap.put("unitId", unitId);
@@ -2046,7 +2044,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     }
 
                     if (code == 400001 && "/rest/openapi/v2/creative/create调用已超日限,次日可恢复调用".equals(resultJson.getString("message"))) {
-                        overRunSendMessageService.creativeOverRunSendMessage(advertiserId);
+                        overRunSendMessageService.creativeOverRunSendMessage(advertiserId, null);
                     }
                     log.error("创建广告创意失败,advertiser_id:{},返回信息:{},入参:{}", advertiserId, resultJson, requestJson, count + 1);
                     returnMap.put("code", -1);
@@ -2079,7 +2077,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
 
     @Override
-    public Map<String, Object> batchCreativeCreate(String accessToken, Long advertiserId, JSONObject requestJson, Integer count) {
+    public Map<String, Object> batchCreativeCreate(String accessToken, Long advertiserId, JSONObject requestJson, Integer count, String userId) {
         Map<String, Object> returnMap = new HashMap<>();
         try {
             String url = "https://ad.e.kuaishou.com/rest/openapi/v2/creative/batch/update";
@@ -2117,14 +2115,15 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                         returnMap.put("code", 0);
                         returnMap.put("message", "success");
                         returnMap.put("success", true);
+                        returnMap.put("count", add_creative_ids.size());
                     }
                 } else {
                     if (code == 500000 && count <= 4) {
                         creativeCreate(accessToken, advertiserId, requestJson, count + 1);
                     }
 
-                    if (code == 400001 && "/rest/openapi/v2/creative/create调用已超日限,次日可恢复调用".equals(resultJson.getString("message"))) {
-                        overRunSendMessageService.creativeOverRunSendMessage(advertiserId);
+                    if (code == 400001 && "/rest/openapi/v2/creative/batch/update调用已超日限,次日可恢复调用".equals(resultJson.getString("message"))) {
+                        overRunSendMessageService.creativeOverRunSendMessage(advertiserId, userId);
                     }
                     log.error("创建广告创意失败,advertiser_id:{},返回信息:{},入参:{}", advertiserId, resultJson, requestJson, count + 1);
                     returnMap.put("code", -1);
@@ -2134,7 +2133,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                 }
             } else {
                 if (count <= 4) {
-                    batchCreativeCreate(accessToken, advertiserId, requestJson, count + 1);
+                    batchCreativeCreate(accessToken, advertiserId, requestJson, count + 1, userId);
                 }
 
                 log.error("快手创建广告创意返回内容为空,advertiser_id:{},入参:{}", advertiserId, requestJson);

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

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouStrategy;
+import cn.com.ctop.kuaishou.modules.batch.entity.kuaishoustrategycampaignRel;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouStrategyMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
@@ -49,28 +50,43 @@ public class KuaishouStrategyServiceImpl extends ServiceImpl<KuaishouStrategyMap
     @Autowired
     private IKuaiShouUpdateService kuaiShouUpdateService;
     @Autowired
+    private kuaishoustrategycampaignRelServiceImpl kuaishoustrategycampaignRelService;
+    @Autowired
     private ICtopOauthTokenService tokenService;
 
-    //TODO
     @Override
-    public Result<?> shutDownPlan(JSONArray ids) {
+    public Result<?> shutDownPlan(JSONObject data) {
+        JSONArray ids = data.getJSONArray("ids");
+        Integer state = data.getInteger("state");
         JSONObject obj = new JSONObject();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = null;
         if (!Check.isNull(sysUser)) {
             userId = sysUser.getId();
         }
-        userId = "test";
         for (Object id : ids) {
             boolean flag = true;
-            List<JSONObject> list = kuaishouStrategyMapper.queryPlanIdsByStrategyId(Long.valueOf(id.toString()));
+            List<JSONObject> list = null;
+            //开启
+            if (state == 1) {
+                list = kuaishoustrategycampaignRelService.queryPlanIdsByStrategyId(Long.valueOf(id.toString()));
+            } else {
+                list = kuaishouStrategyMapper.queryPlanIdsByStrategyId(Long.valueOf(id.toString()));
+            }
             CtopOauthToken token = tokenService.getTokenByAccountId(list.get(0).getLong("accountId"));
+            kuaishoustrategycampaignRel rel = new kuaishoustrategycampaignRel();
+            rel.setAccountId(token.getAccountId());
+            rel.setStrategyId(Long.valueOf(id.toString()));
+            rel.setStrategyState(state.toString());
             for (JSONObject object : list) {
+                rel.setId(object.getLong("id"));
+                rel.setCampaignId(object.getLong("campaignId"));
                 if (flag) {
-                    flag = EditAdvertisingPlanStatus(token.getAccessToken(), token.getAccountId(), object.getLong("campaignId"), NoEn.NO2.valueInt(), userId, NoEn.NO1.valueInt());
+                    flag = EditAdvertisingPlanStatus(token.getAccessToken(), token.getAccountId(), object.getLong("campaignId"), state, userId, NoEn.NO1.valueInt());
                 } else {
-                    EditAdvertisingPlanStatus(token.getAccessToken(), token.getAccountId(), object.getLong("campaignId"), NoEn.NO2.valueInt(), userId, NoEn.NO1.valueInt());
+                    EditAdvertisingPlanStatus(token.getAccessToken(), token.getAccountId(), object.getLong("campaignId"), state, userId, NoEn.NO1.valueInt());
                 }
+                kuaishoustrategycampaignRelService.saveOrUpdate(rel);
             }
             if (flag) {
                 obj.put(id.toString(), true);
@@ -81,6 +97,12 @@ public class KuaishouStrategyServiceImpl extends ServiceImpl<KuaishouStrategyMap
         return Result.ok(obj);
     }
 
+    /**
+     * @param
+     * @return boolean
+     * @throws
+     * @author ZHAOXA
+     */
     private boolean EditAdvertisingPlanStatus(String token, Long accountId, Long campaignId, Integer state, String userId, int count) {
         Map<String, Object> map = kuaiShouUpdateService.updateCampaignStatus(token, accountId, campaignId, state, userId);
         boolean success = (boolean) map.get("success");
@@ -435,6 +457,7 @@ public class KuaishouStrategyServiceImpl extends ServiceImpl<KuaishouStrategyMap
         return kuaishouInterfaceService.adUnitCreate(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitJson, 1);
     }
 
+
     /**
      * 根据策略创建创意
      *

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

@@ -0,0 +1,30 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.kuaishoustrategycampaignRel;
+import cn.com.ctop.kuaishou.modules.batch.mapper.kuaishoustrategycampaignRelMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IkuaishoustrategycampaignRelService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 快手-策略和计划启动/关停关系表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-12-18
+ */
+@Service
+public class kuaishoustrategycampaignRelServiceImpl extends ServiceImpl<kuaishoustrategycampaignRelMapper, kuaishoustrategycampaignRel> implements IkuaishoustrategycampaignRelService {
+
+    @Autowired
+    private kuaishoustrategycampaignRelMapper relMapper;
+
+    @Override
+    public List<JSONObject> queryPlanIdsByStrategyId(Long id) {
+        return relMapper.queryPlanIdsByStrategyId(id);
+    }
+}

+ 23 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouAudienceReportDailyController.java

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.annotation.AutoLog;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouAudienceReportDailyService;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -51,7 +52,7 @@ import java.util.Map;
 @Slf4j
 @Api(tags = "人群分析报表")
 @RestController
-@RequestMapping("/modules.batch/kuaishouAudienceReportDaily")
+@RequestMapping("/audienceReport")
 public class KuaishouAudienceReportDailyController {
     @Autowired
     private IKuaishouAudienceReportDailyService kuaishouAudienceReportDailyService;
@@ -82,6 +83,27 @@ public class KuaishouAudienceReportDailyController {
     }
 
     /**
+     * 分页列表查询
+     *
+     * @param kuaishouAudienceReportDaily
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "人群分析报表-分页列表查询")
+    @ApiOperation(value = "人群分析报表-分页列表查询", notes = "人群分析报表-分页列表查询")
+    @GetMapping(value = "/queryPageList")
+    public Result<Object> queryPageLists(KuaishouAudienceReportDaily audienceReport, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, String type) {
+        try {
+            return kuaishouAudienceReportDailyService.queryPageLists(audienceReport, pageNo, pageSize, type);
+        } catch (Exception e) {
+            log.error("人群分析报表-分页列表查询异常", e);
+        }
+        return Result.error("查询人群分析报表失败");
+    }
+
+    /**
      * 添加
      *
      * @param kuaishouAudienceReportDaily

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

@@ -99,19 +99,19 @@ public class KuaiShouReportDailyMaterial {
      */
     @Excel(name = "曝光数", width = 15)
     @ApiModelProperty(value = "曝光数")
-    private Integer photoShow;
+    private Long photoShow;
     /**
      * 素材曝光数
      */
     @Excel(name = "素材曝光数", width = 15)
     @ApiModelProperty(value = "素材曝光数")
-    private Integer aclick;
+    private Long aclick;
     /**
      * 行为数
      */
     @Excel(name = "行为数", width = 15)
     @ApiModelProperty(value = "行为数")
-    private Integer bclick;
+    private Long bclick;
     /**
      * 分享数
      */
@@ -195,7 +195,7 @@ public class KuaiShouReportDailyMaterial {
      */
     @Excel(name = "封面点击数", width = 15)
     @ApiModelProperty(value = "封面点击数")
-    private Integer photoClick;
+    private Long photoClick;
     /**
      * 封面点击率
      */

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

@@ -0,0 +1,88 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 快手视频信息清洗表(有效,爆款)
+ * @author jeecg-boot
+ * @date   2020-12-17
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_kuaishou_video_etl_info")
+public class KuaishouVideoEtlInfo {
+
+	@TableId(type = IdType.AUTO)
+	private Long id;
+	/**视频唯一标识*/
+	private String videoCode;
+	/**初次产生消耗时间*/
+	private String stateDate;
+	/**url*/
+	private String url;
+	/**coverUrl*/
+	private String coverUrl;
+	/**渠道类型*/
+	private String channelType;
+	/**companyName*/
+	private String companyName;
+	/**planId*/
+	private String planId;
+	/**planName*/
+	private String planName;
+	/**clipId*/
+	private String clipId;
+	/**clipName*/
+	private String clipName;
+	/**shotId*/
+	private String shotId;
+	/**shotName*/
+	private String shotName;
+	/**singleWeekCost*/
+	private BigDecimal singleWeekCost;
+	/**twoWeekCost*/
+	private BigDecimal twoWeekCost;
+	/**fourWeekCost*/
+	private BigDecimal fourWeekCost;
+	/**总消耗*/
+	private BigDecimal totalCost;
+	/**photoShow*/
+	private Long photoShow;
+	/**photoClick*/
+	private Long photoClick;
+	/**aclick*/
+	private Long aclick;
+	/**bclick*/
+	private Long bclick;
+	private String effectDate;
+	private String faddishDate;
+	private Integer effectDayNum;
+	private Integer faddishDayNum;
+	/**createTime*/
+	private Date createTime;
+	/**updateTime*/
+	private Date updateTime;
+
+	public KuaishouVideoEtlInfo() {
+	}
+
+	public KuaishouVideoEtlInfo(KuaiShouReportDailyMaterial nowData) {
+		this.url = nowData.getPhotoUrl();
+		this.videoCode  = nowData.getSignature();
+		this.stateDate = nowData.getStatDate();
+		this.channelType = nowData.getChannelType()+"";
+		this.coverUrl = nowData.getCoverUrl();
+		this.totalCost = nowData.getCharge();
+		this.photoClick = nowData.getPhotoClick();
+		this.photoShow =  nowData.getPhotoShow();
+		this.aclick = nowData.getAclick();
+		this.bclick = nowData.getBclick();
+
+	}
+}

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

@@ -1,8 +1,11 @@
 package cn.com.ctop.kuaishou.modules.report.mapper;
 
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyAge;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+
 /**
  * 人群分析报表
  *
@@ -12,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface KuaishouAudienceReportDailyAgeMapper extends BaseMapper<KuaishouAudienceReportDailyAge> {
 
+    List<KuaishouAudienceReportDaily> queryPageLists(KuaishouAudienceReportDaily audienceReport);
 }

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

@@ -4,6 +4,8 @@ import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyBussiness;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+
 /**
  * 人群分析报表
  *
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface KuaishouAudienceReportDailyBusinessMapper extends BaseMapper<KuaishouAudienceReportDailyBussiness> {
 
+    List<KuaishouAudienceReportDaily> queryPageLists(KuaishouAudienceReportDaily audienceReport);
 }

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

@@ -4,6 +4,8 @@ import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyCity;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+
 /**
  * 人群分析报表
  *
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface KuaishouAudienceReportDailyCityMapper extends BaseMapper<KuaishouAudienceReportDailyCity> {
 
+    List<KuaishouAudienceReportDaily> queryPageLists(KuaishouAudienceReportDaily audienceReport);
 }

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

@@ -4,6 +4,8 @@ import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyClient;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+
 /**
  * 人群分析报表
  *
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface KuaishouAudienceReportDailyClientMapper extends BaseMapper<KuaishouAudienceReportDailyClient> {
 
+    List<KuaishouAudienceReportDaily> queryPageLists(KuaishouAudienceReportDaily audienceReport);
 }

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

@@ -4,6 +4,8 @@ import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyGender;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+
 /**
  * 人群分析报表
  *
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface KuaishouAudienceReportDailyGenderMapper extends BaseMapper<KuaishouAudienceReportDailyGender> {
 
+    List<KuaishouAudienceReportDaily> queryPageLists(KuaishouAudienceReportDaily audienceReport);
 }

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

@@ -1,8 +1,12 @@
 package cn.com.ctop.kuaishou.modules.report.mapper;
 
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDailyProvince;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+
 /**
  * 人群分析报表
  *
@@ -12,4 +16,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface KuaishouAudienceReportDailyProvinceMapper extends BaseMapper<KuaishouAudienceReportDailyProvince> {
 
+    List<KuaishouAudienceReportDaily> queryPageLists(KuaishouAudienceReportDaily audienceReport);
 }

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouVideoEtlInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 快手视频信息清洗表(有效,爆款)
+ * @author: jeecg-boot
+ * @date:   2020-12-17
+ * @cersion: V1.0
+ */
+public interface KuaishouVideoEtlInfoMapper extends BaseMapper<KuaishouVideoEtlInfo> {
+
+    String getCompanyNameByUserId(String planId);
+}

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

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouAudienceReportDailyAgeMapper">
+    <select id="queryPageLists" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily">
+        select
+        *
+       from
+        ctop_kuaishou_audience_report_daily_province
+        where account_id = #{accountId}
+      </select>
+</mapper>

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

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouAudienceReportDailyBusinessMapper">
+    <select id="queryPageLists" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily">
+        select
+        *
+       from
+        ctop_kuaishou_audience_report_daily_province
+        where account_id = #{accountId}
+      </select>
+</mapper>

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

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouAudienceReportDailyCityMapper">
+    <select id="queryPageLists" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily">
+        select
+        *
+       from
+        ctop_kuaishou_audience_report_daily_province
+        where account_id = #{accountId}
+      </select>
+</mapper>

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

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouAudienceReportDailyClientMapper">
+    <select id="queryPageLists" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily">
+        select
+        *
+       from
+        ctop_kuaishou_audience_report_daily_province
+        where account_id = #{accountId}
+      </select>
+</mapper>

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

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouAudienceReportDailyGenderMapper">
+    <select id="queryPageLists" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily">
+        select
+        *
+       from
+        ctop_kuaishou_audience_report_daily_province
+        where account_id = #{accountId}
+      </select>
+</mapper>

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

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouAudienceReportDailyProvinceMapper">
+
+    <select id="queryPageLists" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily">
+        select
+        *
+       from
+        ctop_kuaishou_audience_report_daily_province
+        where account_id = #{accountId}
+      </select>
+</mapper>

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

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouVideoEtlInfoMapper">
+
+    <select id="getCompanyNameByUserId" resultType="java.lang.String">
+        select company_name from user_company where user_id = #{planId} limit 1
+    </select>
+</mapper>

+ 11 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouAudienceReportDailyService.java

@@ -2,8 +2,9 @@ package cn.com.ctop.kuaishou.modules.report.service;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouAudienceReportDaily;
-import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
 
 /**
  * @Description: 人群分析报表
@@ -22,4 +23,13 @@ public interface IKuaishouAudienceReportDailyService extends IService<KuaishouAu
      */
     void crowdAnalysisReport(CtopOauthToken token, String date, String type, Long plan, Long unit, Integer page, Integer pageSize);
 
+    /**
+     * 人群分析报表
+     *
+     * @param
+     * @return java.lang.Long
+     * @throws
+     * @author ZHAOXA
+     */
+    Result<Object> queryPageLists(KuaishouAudienceReportDaily audienceReport, Integer pageNo, Integer pageSize, String type);
 }

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

@@ -0,0 +1,18 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouVideoEtlInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.Date;
+
+/**
+ * @Description: 快手视频信息清洗表(有效,爆款)
+ * @Author: jeecg-boot
+ * @Date:   2020-12-17
+ * @Version: V1.0
+ */
+public interface IKuaishouVideoEtlInfoService extends IService<KuaishouVideoEtlInfo> {
+    void etlKuaishouVideoInfo(Date date);
+
+    KuaishouVideoEtlInfo getBySignature(String signature);
+}

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

@@ -24,11 +24,15 @@ import cn.com.ctop.kuaishou.modules.report.service.IKuaishouAudienceReportDailyS
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -43,6 +47,8 @@ import java.util.Map;
 public class KuaishouAudienceReportDailyServiceImpl extends ServiceImpl<KuaishouAudienceReportDailyMapper, KuaishouAudienceReportDaily> implements IKuaishouAudienceReportDailyService {
 
     @Autowired
+    private KuaishouAudienceReportDailyMapper kuaishouAudienceReportDailyMapper;
+    @Autowired
     private KuaishouAudienceReportDailyProvinceMapper provinceMapper;
     @Autowired
     private KuaishouAudienceReportDailyAgeMapper ageMapper;
@@ -59,11 +65,47 @@ public class KuaishouAudienceReportDailyServiceImpl extends ServiceImpl<Kuaishou
     private String urlPath = PropertiesUtils.getConfig("kuaishou_api_url");
 
     /**
-     * 人群分析报表
+     * 报表分页查询
+     *
+     * @param type province: 省级地域分布, city: 地级地域分布,gender: 性别分布,ageSegment: 年龄分布clientId: 系统分布 businessInterestTags: 商业兴趣分布
+     * @return org.jeecg.common.api.vo.Result<java.lang.Object>
+     * @throws
+     * @author ZHAOXA
+     */
+    @Override
+    public Result<Object> queryPageLists(KuaishouAudienceReportDaily audienceReport, Integer pageNo, Integer pageSize, String type) {
+        if (null == pageNo || pageNo == 0) {
+            pageNo = 1;
+        }
+        if (null == pageSize || pageSize == 0) {
+            pageSize = 10;
+        }
+        List<KuaishouAudienceReportDaily> list = null;
+        PageHelper.startPage(pageNo, pageSize);
+        if ("province".equals(type)) {
+            list = provinceMapper.queryPageLists(audienceReport);
+        } else if ("city".equals(type)) {
+            list = cityMapper.queryPageLists(audienceReport);
+        } else if ("gender".equals(type)) {
+            list = genderMapper.queryPageLists(audienceReport);
+        } else if ("ageSegment".equals(type)) {
+            list = ageMapper.queryPageLists(audienceReport);
+        } else if ("client".equals(type)) {
+            list = clientMapper.queryPageLists(audienceReport);
+        } else if ("businessInterestTags".equals(type)) {
+            list = bussinessMapper.queryPageLists(audienceReport);
+        } else {
+            return Result.error("请选择人群报表类型");
+        }
+        PageInfo<KuaishouAudienceReportDaily> pageInfo = new PageInfo<>(list);
+        return Result.ok(pageInfo);
+    }
+
+    /**
+     * 人群分析报表入库
      *
      * @param type      province: 省级地域分布, city: 地级地域分布,gender: 性别分布,ageSegment: 年龄分布clientId: 系统分布 businessInterestTags: 商业兴趣分布
      * @param accountId 广告主ID
-     * @param file      请求的文件,最大支持500MB
      * @return
      */
     @Override

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

@@ -0,0 +1,186 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.common.module.entity.MaterialAscription;
+import cn.com.ctop.common.module.entity.MaterialInfo;
+import cn.com.ctop.common.module.service.IMaterialAscriptionService;
+import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouVideoEtlInfo;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouVideoEtlInfoMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouVideoEtlInfoService;
+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.util.DateUtils;
+import org.opencv.core.Mat;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.logging.Logger;
+
+/**
+ * 快手视频信息清洗表(有效,爆款)
+ * @author jeecg-boot
+ * @date   2020-12-17
+ * @version V1.0
+ */
+@Slf4j
+@Service
+public class KuaishouVideoEtlInfoServiceImpl extends ServiceImpl<KuaishouVideoEtlInfoMapper, KuaishouVideoEtlInfo> implements IKuaishouVideoEtlInfoService {
+    @Autowired
+    private KuaishouVideoEtlInfoMapper kuaishouVideoEtlInfoMapper;
+    @Autowired
+    private IKuaiShouReportDailyMaterialService dailyMaterialService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(50);
+    @Override
+    public void etlKuaishouVideoInfo(Date getDate) {
+        String date = DateUtils.formatDate(getDate);
+        //1:查询单当日视频信息
+        List<KuaiShouReportDailyMaterial> materials = dailyMaterialService.getSignatureByDate(date);
+        if(null!=materials&&!materials.isEmpty()){
+            CountDownLatch countDownLatch= new CountDownLatch(materials.size());
+            materials.forEach(material->{
+                executorService.submit(()->{
+                    try {
+                        if(null == material.getSignature()||material.getSignature().trim().equals("")){
+                            return;
+                        }
+
+                        String signature = material.getSignature();
+                        KuaishouVideoEtlInfo etlInfo = this.getBySignature(signature);
+                        KuaiShouReportDailyMaterial nowData = dailyMaterialService.getEtlDataByParams(signature,date);
+                        String minDate = nowData.getStatDate();
+                        Integer days = DateUtils.getdaysOfTwoDate(minDate,date);
+                        if(null == etlInfo){
+                            //第一次查询的数据
+                            etlInfo = new KuaishouVideoEtlInfo(nowData);
+                            BigDecimal totalCost = etlInfo.getTotalCost();
+                            JSONObject ascription =  materialAscriptionService.getDetailByCode(signature);
+                            String planId = null;
+                            if(null!=ascription){
+                                planId = ascription.getString("planId");
+                                if(null!=planId&&!planId.trim().equals("")){
+                                    etlInfo.setPlanId(planId);
+                                }
+                                String planName =  ascription.getString("planName");
+                                if(null!=planName&&!planName.trim().equals("")){
+                                    etlInfo.setPlanName(planName);
+                                }
+                                String clipId = ascription.getString("clipId");
+                                if(null!=clipId&&!clipId.trim().equals("")){
+                                    etlInfo.setClipId(clipId);
+                                }
+                                String clipName = ascription.getString("clipName");
+                                if(null!=clipName&&!clipName.trim().equals("")){
+                                    etlInfo.setClipName(clipName);
+                                }
+                                String shotId = ascription.getString("shotId");
+                                if(null!=shotId&&!shotId.trim().equals("")){
+                                    etlInfo.setShotId(shotId);
+                                }
+                                String shotName = ascription.getString("shotName");
+                                if(null!=shotName&&!shotName.trim().equals("")){
+                                    etlInfo.setShotName(shotName);
+                                }
+                            }
+                            if(null!=planId){
+                                String companyName = kuaishouVideoEtlInfoMapper.getCompanyNameByUserId(planId);
+                                if (null!=companyName&&!companyName.trim().equals("")){
+                                    etlInfo.setCompanyName(companyName);
+                                }
+                            }
+                            //计算投放总天数
+                            if(days == 7){
+                                etlInfo.setSingleWeekCost(nowData.getCharge());
+                            }
+                            if(days == 14){
+                                etlInfo.setTwoWeekCost(nowData.getCharge());
+                            }
+                            if(days == 28){
+                                etlInfo.setFourWeekCost(nowData.getCharge());
+                            }
+                            //计算是否有效,爆款
+                            if(totalCost.compareTo(new BigDecimal("5000"))>0){
+                                //此刻成为有效
+                                etlInfo.setEffectDate(date);
+                                etlInfo.setEffectDayNum(days);
+                            }
+                            if(totalCost.compareTo(new BigDecimal("100000"))>0){
+                                //此刻成为爆款
+                                etlInfo.setEffectDate(date);
+                                etlInfo.setEffectDayNum(days);
+                            }
+                            etlInfo.setCreateTime(new Date());
+                            etlInfo.setUpdateTime(new Date());
+                            this.save(etlInfo);
+                        }else{
+                            BigDecimal totalCost = etlInfo.getTotalCost();
+                            //只需要更新汇总数据
+                            etlInfo.setTotalCost(nowData.getCharge());
+                            etlInfo.setAclick(nowData.getAclick());
+                            etlInfo.setBclick(nowData.getBclick());
+                            etlInfo.setPhotoClick(nowData.getPhotoClick());
+                            etlInfo.setPhotoShow(nowData.getPhotoShow());
+                            etlInfo.setUpdateTime(new Date());
+                            //计算投放总天数
+                            if(days == 7){
+                                etlInfo.setSingleWeekCost(nowData.getCharge());
+                            }
+                            if(days == 14){
+                                etlInfo.setTwoWeekCost(nowData.getCharge());
+                            }
+                            if(days == 28){
+                                etlInfo.setFourWeekCost(nowData.getCharge());
+                            }
+                            if(null == etlInfo.getEffectDayNum()){
+                                if(totalCost.compareTo(new BigDecimal("5000"))>0){
+                                    //此刻成为有效
+                                    etlInfo.setEffectDate(date);
+                                    etlInfo.setEffectDayNum(days);
+                                }
+                            }
+                            if(null == etlInfo.getFaddishDayNum()){
+                                if(totalCost.compareTo(new BigDecimal("100000"))>0){
+                                    //此刻成为爆款
+                                    etlInfo.setEffectDate(date);
+                                    etlInfo.setEffectDayNum(days);
+                                }
+                            }
+                            this.updateById(etlInfo);
+                        }
+                    }catch (Exception e){
+
+                    }finally {
+                        countDownLatch.countDown();
+                    }
+                });
+            });
+
+            try {
+                countDownLatch.await();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            log.info("{}数据获取完成",date);
+        }
+    }
+
+    @Autowired
+    private IMaterialAscriptionService materialAscriptionService;
+    @Autowired
+    private IMaterialInfoService materialInfoService;
+    @Override
+    public KuaishouVideoEtlInfo getBySignature(String signature) {
+        QueryWrapper<KuaishouVideoEtlInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("video_code",signature).last("limit 1");
+        return this.getOne(queryWrapper);
+    }
+}

+ 2 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IReportService.java

@@ -18,6 +18,8 @@ public interface IReportService {
 
     void getAdvertiserPlanRuleData(CtopOauthToken token, Date startDate, Date endDate, String bytedanceReportTypePl);
 
+    JSONObject readAdConvert(CtopOauthToken token, Long convertId);
+
     void getAdvertiserCreativeReport(CtopOauthToken token, Date startDate, Date endDate, String bytedanceReportTypePL);
 
     void getMaterialReportByPage(CtopOauthToken token, String startDate, String endDate, Integer pageNum);

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

@@ -1,6 +1,7 @@
 package cn.com.ctop.toutiao.modules.report.service.impl;
 
 import cn.com.ctop.common.module.entity.*;
+import cn.com.ctop.common.module.enums.BytedanceConvertType;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
@@ -208,9 +209,10 @@ public class ReportServiceImpl implements IReportService {
                 Long convertId = plan.getConvertId();
                 if(null!=convertId&&convertId!=0){
                     ruleDataPlan.setConvertId(plan.getConvertId());
-                    String deepConvertTarget = readAdConvert(token,plan.getConvertId());
-                    if(null!=deepConvertTarget){
-                        ruleDataPlan.setDeepConvertTarget(deepConvertTarget);
+                    JSONObject convertTargetObject = readAdConvert(token,plan.getConvertId());
+                    if(null != convertTargetObject){
+                        ruleDataPlan.setConvertId(BytedanceConvertType.getNum(convertTargetObject.getString("convert_type")));
+                        ruleDataPlan.setDeepConvertTarget(convertTargetObject.getString("deep_external_action"));
                     }
                 }
                 RuleDataTarget target = new RuleDataTarget();
@@ -295,8 +297,8 @@ public class ReportServiceImpl implements IReportService {
         }
     }
 
-
-    public String readAdConvert(CtopOauthToken token,Long convertId) {
+    @Override
+    public JSONObject readAdConvert(CtopOauthToken token, Long convertId) {
         String url = "https://ad.oceanengine.com/open_api/2/tools/ad_convert/read/";
         JSONObject params = new JSONObject();
         params.put("advertiser_id", token.getAccountId());
@@ -308,10 +310,7 @@ public class ReportServiceImpl implements IReportService {
             log.error("获取转化数据异常=》account:{};convertId:{};message:{}", token.getAccountId(), convertId,message);
             return  null;
         }
-        if(null!=result.getJSONObject("data")&&null!=result.getJSONObject("data").getString("deep_external_action")&&!"".equals(result.getJSONObject("data").getString("deep_external_action"))){
-            return result.getJSONObject("data").getString("deep_external_action");
-        }
-        return null;
+        return result.getJSONObject("data");
     }