Przeglądaj źródła

Merge branch 'test'

# Conflicts:
#	jeecg-boot-module-system/src/main/resources/application-wps.yml
#	jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
syh 4 lat temu
rodzic
commit
affb786195
58 zmienionych plików z 2063 dodań i 299 usunięć
  1. 11 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  2. 2 2
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MD5Util.java
  3. 1 1
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/PmsUtil.java
  4. 1 5
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/db/FreemarkerParseFactory.java
  5. 1 7
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/dynamic/db/FreemarkerParseFactory.java
  6. 2 2
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oConvertUtils.java
  7. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  8. 8 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cas/util/XmlUtils.java
  9. 6 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AiKuaishouAdvertiserStrategyController.java
  10. 50 35
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  11. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java
  12. 5 0
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  13. 39 17
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  14. 7 7
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/constant/MatchLogic.java
  15. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/enums/SceneIdEnum.java
  16. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialCutFrameMapper.xml
  17. 2 4
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialTagInfoServiceImpl.java
  18. 3 3
      module-common/src/main/java/cn/com/ctop/common/module/utils/ParseInstallPackageUtil.java
  19. 4 4
      module-common/src/main/java/cn/com/ctop/common/module/utils/QueryGenerator.java
  20. 0 8
      module-common/src/main/java/cn/com/ctop/common/module/utils/RestUtils.java
  21. 4 2
      module-common/src/main/java/cn/com/ctop/common/module/utils/StatusCode.java
  22. 2 0
      module-common/src/main/java/com/xxl/job/core/executor/impl/XxlJobSimpleExecutor.java
  23. 1 7
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoJhsbybtServiceImpl.java
  24. 1 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoTttmServiceImpl.java
  25. 0 25
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouAlarmRuleHourlyCheckJob.java
  26. 0 25
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouAlarmRuleMinuteCheckJob.java
  27. 12 12
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAiAdsNewMaterialCreativityJob.java
  28. 139 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAiCreativeJob.java
  29. 0 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouMaterialControer.java
  30. 8 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAdvertiserStrategy.java
  31. 56 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/enums/KuaishouCreativeAdsenceTypeEnum.java
  32. 55 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/enums/KuaishouCreativeCreateTypeEnum.java
  33. 101 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/enums/KuaishouCreativeMatTypeEnum.java
  34. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaiShouAppInfoService.java
  35. 10 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAdvertiserStrategyService.java
  36. 13 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouCreateCreativeService.java
  37. 20 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouNewCreateCampaign.java
  38. 3 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiCreativeLimitServiceImpl.java
  39. 13 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaiShouAppInfoServiceImpl.java
  40. 66 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAdvertiserStrategyServiceImpl.java
  41. 1064 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java
  42. 222 86
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouNewCreateCampaignServiceImpl.java
  43. 2 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiStrategyServiceImpl.java
  44. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaiShouVideoLastTimeServiceImpl.java
  45. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/Enums/CampaignTypeEnum.java
  46. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouBatchCampaignPreviewController.java
  47. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouVideoGetMapper.java
  48. 67 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouVideoGetMapper.xml
  49. 5 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouVideoGetService.java
  50. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupServiceImpl.java
  51. 0 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouUpdateServiceImpl.java
  52. 25 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouVideoGetServiceImpl.java
  53. 5 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCampaignPreviewServiceImpl.java
  54. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouCampaignCopyDataServiceImpl.java
  55. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouStrategyServiceImpl.java
  56. 2 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/EtlKuaishouVideoInfoServiceImpl.java
  57. 1 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/adlab/service/impl/CtopAdlabProjectDetailServiceImpl.java
  58. 6 6
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/utils/ApkUtils.java

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

@@ -115,6 +115,13 @@ public class DateUtils extends PropertyEditorSupport {
         return dsdf.format(parse);
     }
 
+    public static Integer getNowHour() throws ParseException {
+        Calendar cal = Calendar.getInstance();
+        Date date = new Date();
+        cal.setTime(date);
+        return cal.get(Calendar.HOUR_OF_DAY);
+    }
+
     public static Integer getHour(String dateStr) throws ParseException {
         DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         Calendar cal = Calendar.getInstance();
@@ -434,6 +441,10 @@ public class DateUtils extends PropertyEditorSupport {
         return datetimeFormat.get().format(getCalendar().getTime());
     }
 
+    public static String formatDateTime(Long time) {
+        return datetimeFormat.get().format(time);
+    }
+
     /**
      * 获取时间字符串
      */

+ 2 - 2
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/MD5Util.java

@@ -34,7 +34,7 @@ public class MD5Util {
 		return toHexStr(md5.digest(url.getBytes()));
 	}
 
-	public static String byteArrayToHexString(byte b[]) {
+	public static String byteArrayToHexString(byte[] b) {
 		StringBuffer resultSb = new StringBuffer();
 		for (int i = 0; i < b.length; i++){
 			resultSb.append(byteToHexString(b[i]));
@@ -80,7 +80,7 @@ public class MD5Util {
 		}
 		return resultString;
 	}
-	private static final String hexDigits[] = { "0", "1", "2", "3", "4", "5",
+	private static final String[] hexDigits = { "0", "1", "2", "3", "4", "5",
 			"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
 	private static final String[] HEX_DIGITS = {"0", "1", "2", "3", "4", "5",
 			"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };

+ 1 - 1
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/PmsUtil.java

@@ -41,7 +41,7 @@ public class PmsUtil {
             for (String s : msg) {
                 //写数据
                 if (s.indexOf("_") > 0) {
-                    String arr[] = s.split("_");
+                    String[] arr = s.split("_");
                     bw.write("第" + arr[0] + "行:" + arr[1]);
                 } else {
                     bw.write(s);

+ 1 - 5
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/db/FreemarkerParseFactory.java

@@ -100,8 +100,6 @@ public class FreemarkerParseFactory {
         } catch (Exception e) {
             log.error(e.getMessage(), e.fillInStackTrace());
             log.error("发送一次的模板key:{ " + tplName + " }");
-            //System.err.println(e.getMessage());
-            //System.err.println("模板名:{ "+ tplName +" }");
             throw new RuntimeException("解析SQL模板异常");
         }
     }
@@ -132,8 +130,6 @@ public class FreemarkerParseFactory {
         } catch (Exception e) {
             log.error(e.getMessage(), e.fillInStackTrace());
             log.error("发送一次的模板key:{ " + tplContent + " }");
-            //System.err.println(e.getMessage());
-            //System.err.println("模板内容:{ "+ tplContent +" }");
             throw new RuntimeException("解析SQL模板异常");
         }
     }
@@ -168,4 +164,4 @@ public class FreemarkerParseFactory {
         }
         return sql;
     }
-}
+}

+ 1 - 7
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/dynamic/db/FreemarkerParseFactory.java

@@ -6,8 +6,6 @@ import freemarker.template.Configuration;
 import freemarker.template.Template;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.jeecgframework.codegenerate.generate.util.SimpleFormat;
 
 import java.io.StringWriter;
@@ -102,8 +100,6 @@ public class FreemarkerParseFactory {
         } catch (Exception e) {
             log.error(e.getMessage(), e.fillInStackTrace());
             log.error("发送一次的模板key:{ " + tplName + " }");
-            //System.err.println(e.getMessage());
-            //System.err.println("模板名:{ "+ tplName +" }");
             throw new RuntimeException("解析SQL模板异常");
         }
     }
@@ -134,8 +130,6 @@ public class FreemarkerParseFactory {
         } catch (Exception e) {
             log.error(e.getMessage(), e.fillInStackTrace());
             log.error("发送一次的模板key:{ " + tplContent + " }");
-            //System.err.println(e.getMessage());
-            //System.err.println("模板内容:{ "+ tplContent +" }");
             throw new RuntimeException("解析SQL模板异常");
         }
     }
@@ -170,4 +164,4 @@ public class FreemarkerParseFactory {
         }
         return sql;
     }
-}
+}

+ 2 - 2
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oConvertUtils.java

@@ -432,7 +432,7 @@ public class oConvertUtils {
 			//update-end--Author:zhoujf  Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
 		}
 		// 用下划线将原始字符串分割
-		String camels[] = name.split("_");
+		String[] camels = name.split("_");
 		for (String camel : camels) {
 			// 跳过原始字符串中开头、结尾的下换线或双重下划线
 			if (camel.isEmpty()) {
@@ -495,7 +495,7 @@ public class oConvertUtils {
 			return name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase();
 		}
 		// 用下划线将原始字符串分割
-		String camels[] = name.split("_");
+		String[] camels = name.split("_");
 		for (String camel : camels) {
 			// 跳过原始字符串中开头、结尾的下换线或双重下划线
 			if (camel.isEmpty()) {

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

@@ -183,6 +183,9 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/ruleGroup/*", "anon");
         filterChainDefinitionMap.put("/kuaishou/material/*", "anon");
         filterChainDefinitionMap.put("/kuaishou/create/*", "anon");
+        filterChainDefinitionMap.put("/template/kuaiShouBatchCreativeTemplate/*", "anon");
+        filterChainDefinitionMap.put("/template/kuaiShouBatchGroupTemplate/*", "anon");
+        filterChainDefinitionMap.put("/template/kuaiShouBatchCampaignTemplate/*", "anon");
         filterChainDefinitionMap.put("/template/**", "anon");
         filterChainDefinitionMap.put("/batch/kuaiShouGroupTemplate/*", "anon");
         filterChainDefinitionMap.put("/kuaishouBatch/**", "anon");

+ 8 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cas/util/XmlUtils.java

@@ -88,13 +88,15 @@ public final class XmlUtils {
 
             private StringBuilder buffer = new StringBuilder();
 
+            @Override
             public void startElement(final String uri, final String localName, final String qName,
-                    final Attributes attributes) throws SAXException {
+                                     final Attributes attributes) throws SAXException {
                 if (localName.equals(element)) {
                     this.foundElement = true;
                 }
             }
 
+            @Override
             public void endElement(final String uri, final String localName, final String qName) throws SAXException {
                 if (localName.equals(element)) {
                     this.foundElement = false;
@@ -103,6 +105,7 @@ public final class XmlUtils {
                 }
             }
 
+            @Override
             public void characters(char[] ch, int start, int length) throws SAXException {
                 if (this.foundElement) {
                     this.buffer.append(ch, start, length);
@@ -139,19 +142,22 @@ public final class XmlUtils {
 
             private boolean foundElement = false;
 
+            @Override
             public void startElement(final String uri, final String localName, final String qName,
-                    final Attributes attributes) throws SAXException {
+                                     final Attributes attributes) throws SAXException {
                 if (localName.equals(element)) {
                     this.foundElement = true;
                 }
             }
 
+            @Override
             public void endElement(final String uri, final String localName, final String qName) throws SAXException {
                 if (localName.equals(element)) {
                     this.foundElement = false;
                 }
             }
 
+            @Override
             public void characters(char[] ch, int start, int length) throws SAXException {
                 if (this.foundElement) {
                     builder.append(ch, start, length);

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

@@ -106,6 +106,7 @@ public class AiKuaishouAdvertiserStrategyController {
             if(null!=allocation){
                 aiKuaishouAdvertiserStrategy.setUserId(allocation.getUserId());
             }
+            aiKuaishouAdvertiserStrategy.setDescription(aiKuaishouAdvertiserStrategy.getDescription().trim());
             Integer singleAppId = aiKuaishouAdvertiserStrategy.getSingleAppid();
             if (null != singleAppId && singleAppId == 1) {
                 Integer appId = Integer.parseInt(JSONArray.parseArray(aiKuaishouAdvertiserStrategy.getAppIdArray()).getString(0));
@@ -263,4 +264,9 @@ public class AiKuaishouAdvertiserStrategyController {
     public Map<String,Object> testCreate(Long accountId){
         return aiKuaishouAdvertiserStrategyService.testCreate(accountId);
     }
+
+    @GetMapping(value = "aiHistoricalMissingMaterial")
+    public Map<String,Object> aiHistoricalMissingMaterial(Long accountId){
+        return aiKuaishouAdvertiserStrategyService.aiHistoricalMissingMaterial(accountId);
+    }
 }

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

@@ -9,21 +9,23 @@ import cn.com.ctop.common.module.vo.ResFileDTO;
 import cn.com.ctop.crawler.modules.core.entity.CrawlerDouyinMusicTask;
 import cn.com.ctop.crawler.modules.core.service.CrawlerDouyinMusicTaskService;
 import cn.com.ctop.crawler.modules.douyin.service.DouyinMusicService;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouCreateCreativeService;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouTemplate;
 import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouAccessToken;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
-import cn.com.ctop.kuaishou.modules.report.service.*;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouDailyAgentService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouAudienceReportDailyService;
 import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.material.service.IBytedanceEffectVideoInfoService;
-import cn.com.ctop.toutiao.modules.report.mapper.BytedanceReportMaterialDailyMapper;
 import cn.com.ctop.toutiao.modules.report.service.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.xxl.job.core.context.XxlJobHelper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.annotations.Param;
@@ -31,12 +33,7 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.io.IOException;
@@ -96,43 +93,23 @@ public class TestController {
     private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
 
     static ExecutorService executorService = Executors.newFixedThreadPool(15);
-    static ExecutorService videoService = Executors.newFixedThreadPool(5);
     static ExecutorService suzhaoService = Executors.newFixedThreadPool(5);
     @Autowired
     private IKuaiShouDailyAgentService dailyAgentService;
     @Autowired
     private IKuaishouTemplateService templateService;
     @Autowired
-    private IBytedanceAccountReportTaskRecordService reportTaskRecordService;
-    @Resource
-    private BytedanceReportMaterialDailyMapper bytedanceReportMaterialDailyMapper;
-    @Autowired
     private ICtopOauthTokenService ctopOauthTokenService;
-
     @Autowired
     private IBindAccountAuthService bindAccountAuthService;
     @Resource
     private UserAllocationMapper allocationMapper;
     @Autowired
     private IBytedanceReportService bytedanceReportService;
-
     @Autowired
     private IUserAllocationService allocationService;
     @Autowired
-    private IEtlKuaiShouNewlyService kuaiShouNewlyService;
-    static ExecutorService materialExecutorService = Executors.newFixedThreadPool(8);
-
-    @Autowired
     private ICtopOauthTokenService tokenService;
-    @Autowired
-    private IEtlKuaiShouGroupDailyReportService etlKuaiShouGroupDailyReportService;
-    @Autowired
-    private IEtlKuaiShouAccountMaterialOverviewService accountMaterialOverviewService;
-
-    @Autowired
-    private IEtlKuaiShouNewlyService newlyService;
-    @Autowired
-    private IKuaishouReportDailyGroupService reportDailyGroupService;
 
 
     @GetMapping("/cleanNewlyData")
@@ -298,11 +275,6 @@ public class TestController {
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
-//        bytedanceReportMaterialDailyMapper.updateImageReportCode();
-//        bytedanceReportMaterialDailyMapper.updateImageReportProjectId();
-//        bytedanceReportMaterialDailyMapper.updateImageReportProjectName();
-//        bytedanceReportMaterialDailyMapper.updateImageReportPlaneId();
-//        bytedanceReportMaterialDailyMapper.updateImageReportPlaneName();
         Map<String, Object> result = new HashMap<>();
         ResultMapUtils.setResultMap(new HashMap<>(), StatusCode.COMMON_SUCCESS);
         return result;
@@ -546,7 +518,6 @@ public class TestController {
 
             QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
             userAllocationQueryWrapper.eq("project_id", projectId);
-            // userAllocationQueryWrapper.eq("account_status", 0);
             List<UserAllocation> list = userAllocationService.list(userAllocationQueryWrapper);
             if (!Check.isNull(list)) {
                 for (UserAllocation allocation : list) {
@@ -1277,4 +1248,48 @@ public class TestController {
         }));
         return Result.ok("success");
     }
+
+    @Autowired
+    private IAiKuaishouAdvertiserStrategyService strategyService;
+    @Autowired
+    private IAiKuaishouCreateCreativeService createCreativeService;
+
+    @GetMapping("testCreateCreative")
+    public Map<String,Object>testCreateCreative(Long accountId,Integer createType){
+        Map<String,Object>result = new HashMap<>();
+        AiKuaishouAdvertiserStrategy strategy = strategyService.getByAccountId(accountId);
+        if(strategy == null){
+            ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
+            return result;
+        }
+        createCreativeService.autoCreateCreative(strategy,createType,150L);
+        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        return result;
+    }
+
+    @GetMapping("testProgramCreative")
+    public Map<String,Object>testProgramCreative(Long accountId,Integer createType){
+        Map<String,Object>result = new HashMap<>();
+        AiKuaishouAdvertiserStrategy strategy = strategyService.getByAccountId(accountId);
+        if(strategy == null){
+            ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
+            return result;
+        }
+        createCreativeService.autoCreateProgramCreative(strategy, createType,150L);
+        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        return result;
+    }
+
+    @GetMapping("testCreateCreativeLimit")
+    public Map<String,Object>testCreateCreativeLimit(Long accountId,Integer hour) throws ParseException {
+        Map<String,Object>result = new HashMap<>();
+        AiKuaishouAdvertiserStrategy strategy = strategyService.getByAccountId(accountId);
+        if(strategy == null){
+            ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
+            return result;
+        }
+        createCreativeService.customCreativeSupplement(strategy,hour);
+        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        return result;
+    }
 }

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDepartController.java

@@ -376,7 +376,7 @@ public class SysDepartController {
         LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
         query.orderByAsc(SysDepart::getOrgCode);
         if (oConvertUtils.isNotEmpty(id)) {
-            String arr[] = id.split(",");
+            String [] arr = id.split(",");
             query.in(SysDepart::getId, arr);
         }
         List<SysDepart> ls = this.sysDepartService.list(query);

+ 5 - 0
jeecg-boot-module-system/src/main/resources/application-wps.yml

@@ -105,6 +105,11 @@ spring:
           username: hcst
           password: hcst@2020
           driver-class-name: com.mysql.jdbc.Driver
+        master:
+          url: jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
+          username: hcst
+          password: hcst@2020
+          driver-class-name: com.mysql.jdbc.Driver
 #        master:
 #          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
 #          username: data

+ 39 - 17
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -17,6 +17,7 @@ import cn.com.ctop.oa.modules.service.IWechatNoListService;
 import cn.com.ctop.oa.modules.service.IWechatUserListService;
 import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
+import cn.com.ctop.toutiao.modules.report.entity.BytedanceAccountReportTaskRecord;
 import cn.com.ctop.toutiao.modules.report.service.*;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
@@ -154,6 +155,15 @@ public class SampleTest {
         }
     }
 
+    @Test
+    public void loadKuaishouCamgaignData(){
+        Date getDate = DateUtils.parseDate("2021-03-24","yyyy-MM-dd");
+        List<UserAllocation> list = allocationService.getByParams(50L,null,0);
+        list.forEach(userAllocation -> {
+            CtopOauthToken token = tokenService.getOauthTokenByAccountId(userAllocation.getAccountId().toString());
+            kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getDate, getDate);
+        });
+    }
     static ExecutorService executorService = null;
     static CountDownLatch countDownLatch = null;
 
@@ -422,10 +432,37 @@ public class SampleTest {
     }
 
     @Autowired
+    private IBytedanceVideoEtlInfoService bytedanceVideoEtlInfoService;
+    @Autowired
+    IBytedanceVideoReportService bytedanceVideoReportService;
+    @Autowired
+    IETLReportBytedanceVideoService ietlReportBytedanceVideoService;
+    @Autowired
+    IKuaishouReportDailyImageService kuaishouReportDailyImageService;
+    @Autowired
+    IRuleByteDanceAccountService ruleByteDanceAccountService;
+    @Autowired
+    IAiKuaishouNewCreateCampaign aiKuaishouNewCreateCampaign;
+    @Autowired
+    private IKuaishouVideoEtlInfoService kuaishouVideoEtlInfoService;
+    @Autowired
     private IBytedanceAccountReportTaskRecordService reportTaskRecordService;
 
 
     @Test
+    public void execute() {
+        List<UserAllocation> allocations = allocationService.listByMediaId("3", 0);
+        for (UserAllocation allocation : allocations) {
+            BytedanceAccountReportTaskRecord reportTaskRecord1 = new BytedanceAccountReportTaskRecord(allocation.getAccountId(), "2020-10-01", "2020-10-31");
+            reportTaskRecordService.save(reportTaskRecord1);
+            BytedanceAccountReportTaskRecord reportTaskRecord2 = new BytedanceAccountReportTaskRecord(allocation.getAccountId(), "2020-11-01", "2020-11-30");
+            reportTaskRecordService.save(reportTaskRecord2);
+            BytedanceAccountReportTaskRecord reportTaskRecord3 = new BytedanceAccountReportTaskRecord(allocation.getAccountId(), "2020-12-01", "2020-12-31");
+            reportTaskRecordService.save(reportTaskRecord3);
+        }
+    }
+
+    @Test
     public void loadBDAccoutData() {
         Date startDate = DateUtils.addDay(new Date(),-2000);
         for(int i=0;i<=2000;i++){
@@ -437,8 +474,6 @@ public class SampleTest {
 
 
 
-    @Autowired
-    private IKuaishouVideoEtlInfoService kuaishouVideoEtlInfoService;
 
     @Test
     public void etlKuaishouData() {
@@ -446,6 +481,7 @@ public class SampleTest {
         Date startDate = DateUtils.parseDate(dateString, "yyyy-MM-dd");
         for (int i = 0; i <= 10; i++) {
             Date getDate = DateUtils.addDay(startDate, i);
+            kuaishouVideoEtlInfoService.etlKuaishouVideoInfo(getDate);
             bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(getDate);
         }
     }
@@ -472,10 +508,6 @@ public class SampleTest {
     }
 
 
-    @Autowired
-    IRuleByteDanceAccountService ruleByteDanceAccountService;
-    @Autowired
-    IAiKuaishouNewCreateCampaign aiKuaishouNewCreateCampaign;
 
     @Test
     public void testLoadBytedanceDataV2() {
@@ -483,20 +515,10 @@ public class SampleTest {
         String[] accountArray = accountIds.split(",");
         for (int i = 0; i < accountArray.length; i++) {
             CtopOauthToken token = tokenService.getTokenByAccountId(Long.parseLong(accountArray[i]));
-
             reportService.getAdvertiserReport(token, DateUtils.parseDate("2021-01-14", "yyyy-MM-dd"), DateUtils.parseDate("2021-01-14", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         }
     }
 
-    @Autowired
-    IBytedanceVideoReportService bytedanceVideoReportService;
-
-    @Autowired
-    IETLReportBytedanceVideoService ietlReportBytedanceVideoService;
-
-    @Autowired
-    IKuaishouReportDailyImageService kuaishouReportDailyImageService;
-
     @Test
     public void loadKuaiShouImage() {
         List<CtopOauthToken> tokens = oauthTokenService.selectKuaiShouToken();
@@ -534,7 +556,7 @@ public class SampleTest {
 
     @Test
     public void etlKuaishouVideoInfo() {
-        Date startDate = DateUtils.parseDate("2020-09-11", "yyyy-MM-dd");
+        Date startDate = DateUtils.parseDate("2021-03-01", "yyyy-MM-dd");
         for (int i = 0; i < 365; i++) {
 //            dailyService.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate(DateUtils.addDay(startDate,i)));
             videoEtlInfoService.etlKuaishouVideoInfo(DateUtils.formatDate(DateUtils.addDay(startDate, i)));

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

@@ -20,7 +20,7 @@ import java.util.List;
 @Slf4j
 public class MatchLogic {
     /**
-     * @param type      数据类型
+     * @param indicator      数据类型
      * @param condition 条件
      * @param threshold 阈值
      * @param value     比对值
@@ -261,7 +261,7 @@ public class MatchLogic {
                         Long tplanId = targetDatas.getJSONObject(k).getLong("planId");
                         for (int j = 0; j < creativeDatas.size(); j++) {
                             Long cplanId = creativeDatas.getJSONObject(j).getLong("planId");
-                            if (cplanId == tplanId && cplanId == pplanId) {
+                            if (cplanId.equals(tplanId) && cplanId.equals(pplanId)) {
                                 sendData.add(creativeDatas.getJSONObject(j));
                             }
                         }
@@ -272,7 +272,7 @@ public class MatchLogic {
                     Long pplanId = planDatas.getJSONObject(i).getLong("planId");
                     for (int k = 0; k < targetDatas.size(); k++) {
                         Long tplanId = targetDatas.getJSONObject(k).getLong("planId");
-                        if (tplanId == pplanId) {
+                        if (tplanId.equals(pplanId)) {
                             sendData.add(targetDatas.getJSONObject(k));
                         }
                     }
@@ -282,7 +282,7 @@ public class MatchLogic {
                     Long pplanId = planDatas.getJSONObject(i).getLong("planId");
                     for (int k = 0; k < creativeDatas.size(); k++) {
                         Long cplanId = creativeDatas.getJSONObject(k).getLong("planId");
-                        if (cplanId == pplanId) {
+                        if (cplanId.equals(pplanId)) {
                             sendData.add(creativeDatas.getJSONObject(k));
                         }
                     }
@@ -292,7 +292,7 @@ public class MatchLogic {
                     Long tplanId = targetDatas.getJSONObject(i).getLong("planId");
                     for (int k = 0; k < creativeDatas.size(); k++) {
                         Long cplanId = creativeDatas.getJSONObject(k).getLong("planId");
-                        if (cplanId == tplanId) {
+                        if (cplanId.equals(tplanId)) {
                             sendData.add(creativeDatas.getJSONObject(k));
                         }
                     }
@@ -332,14 +332,14 @@ public class MatchLogic {
                         if (!Check.isNull(targetDatas) && Check.isNull(groupDatas)) {
                             for (int k = 0; k < targetDatas.size(); k++) {
                                 Long tgPlanId = targetDatas.getJSONObject(k).getLong("planId");
-                                if (tgPlanId == planId) {
+                                if (tgPlanId.equals(planId)) {
                                     sendData.add(creativeDatas.getJSONObject(k));
                                 }
                             }
                         } else if (Check.isNull(targetDatas) && !Check.isNull(groupDatas)) {
                             for (int k = 0; k < groupDatas.size(); k++) {
                                 Long tgPlanId = groupDatas.getJSONObject(k).getLong("planId");
-                                if (tgPlanId == planId) {
+                                if (tgPlanId.equals(planId)) {
                                     sendData.add(creativeDatas.getJSONObject(k));
                                 }
                             }

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/enums/SceneIdEnum.java

@@ -27,7 +27,7 @@ public enum SceneIdEnum {
 
     public static SceneIdEnum getEnumById(Integer id) {
         for (SceneIdEnum em : SceneIdEnum.values()) {
-            if (em.id == id) {
+            if (em.id.equals(id)) {
                 return em;
             }
         }

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

@@ -21,7 +21,7 @@
         limit 1) as 'id'
        from (select distinct signature
       from ctop_material_cut_frame
-      where video_signature = #{videoSignature}) a;
+      where video_signature = #{videoSignature}) a
     </select>
 
 

+ 2 - 4
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialTagInfoServiceImpl.java

@@ -11,15 +11,13 @@ import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.jeecg.common.system.vo.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.Date;
+import javax.annotation.Resource;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -36,7 +34,7 @@ public class MaterialTagInfoServiceImpl extends ServiceImpl<MaterialTagInfoMappe
     private IMaterialInfoService materialInfoService;
     @Autowired
     private ITagInfoService tagInfoService;
-    @Autowired
+    @Resource
     private MaterialTagInfoMapper materialTagInfoMapper;
     @Override
     public Map<String, Object> mark(JSONObject data, LoginUser user) {

+ 3 - 3
module-common/src/main/java/cn/com/ctop/common/module/utils/ParseInstallPackageUtil.java

@@ -25,9 +25,9 @@ public class ParseInstallPackageUtil {
 
     private static final Logger log = LoggerFactory.getLogger(ParseInstallPackageUtil.class);
 
-    private static final float RADIX_MULTS[] = {0.00390625F, 3.051758E-005F, 1.192093E-007F, 4.656613E-010F};
-    private static final String DIMENSION_UNITS[] = {"px", "dip", "sp", "pt", "in", "mm", "", ""};
-    private static final String FRACTION_UNITS[] = {"%", "%p", "", "", "", "", "", ""};
+    private static final float[] RADIX_MULTS = {0.00390625F, 3.051758E-005F, 1.192093E-007F, 4.656613E-010F};
+    private static final String[] DIMENSION_UNITS = {"px", "dip", "sp", "pt", "in", "mm", "", ""};
+    private static final String[] FRACTION_UNITS = {"%", "%p", "", "", "", "", "", ""};
 
     /**
      * 解析apk文件

+ 4 - 4
module-common/src/main/java/cn/com/ctop/common/module/utils/QueryGenerator.java

@@ -115,7 +115,7 @@ public class QueryGenerator {
 		*/
 
         //区间条件组装 模糊查询 高级查询组装 简单排序 权限查询
-        PropertyDescriptor origDescriptors[] = PropertyUtils.getPropertyDescriptors(searchObj);
+        PropertyDescriptor[] origDescriptors = PropertyUtils.getPropertyDescriptors(searchObj);
         Map<String, SysPermissionDataRuleModel> ruleMap = getRuleMap();
 
         //权限规则自定义SQL表达式
@@ -691,7 +691,7 @@ public class QueryGenerator {
 
     private static String getInConditionValue(Object value, boolean isString) {
         if (isString) {
-            String temp[] = value.toString().split(",");
+            String[] temp = value.toString().split(",");
             String res = "";
             for (String string : temp) {
                 if (DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())) {
@@ -761,7 +761,7 @@ public class QueryGenerator {
         StringBuffer sb = new StringBuffer();
         //权限查询
         Map<String, SysPermissionDataRuleModel> ruleMap = getRuleMap();
-        PropertyDescriptor origDescriptors[] = PropertyUtils.getPropertyDescriptors(clazz);
+        PropertyDescriptor[] origDescriptors = PropertyUtils.getPropertyDescriptors(clazz);
         String sql_and = " and ";
         for (String c : ruleMap.keySet()) {
             if (oConvertUtils.isNotEmpty(c) && c.startsWith(SQL_RULES_COLUMN)) {
@@ -801,7 +801,7 @@ public class QueryGenerator {
     public static void installAuthMplus(QueryWrapper<?> queryWrapper, Class<?> clazz) {
         //权限查询
         Map<String, SysPermissionDataRuleModel> ruleMap = getRuleMap();
-        PropertyDescriptor origDescriptors[] = PropertyUtils.getPropertyDescriptors(clazz);
+        PropertyDescriptor[] origDescriptors = PropertyUtils.getPropertyDescriptors(clazz);
         for (String c : ruleMap.keySet()) {
             if (oConvertUtils.isNotEmpty(c) && c.startsWith(SQL_RULES_COLUMN)) {
                 queryWrapper.and(i -> i.apply(getSqlRuleValue(ruleMap.get(c).getRuleValue())));

+ 0 - 8
module-common/src/main/java/cn/com/ctop/common/module/utils/RestUtils.java

@@ -1,8 +0,0 @@
-package cn.com.ctop.common.module.utils;
-
-/**
- *  Created by JQ.bi on 2020.9.23
- */
-public class RestUtils {
-
-}

+ 4 - 2
module-common/src/main/java/cn/com/ctop/common/module/utils/StatusCode.java

@@ -58,9 +58,11 @@ public enum StatusCode {
     BYTEDACNE_API_GROUP_CREATE_ERROR("头条API创建广告组异常",-4001,false),
 
     KUAISHOU_API_ACCOUNT_SPEED_EXPLORING("此账户加速探索尚未完成",-5001,false),
+    KUAISHOU_SPEED_EXPLORE_ACTION_TYPE_NOT_CONFIG("加速探索尚不支持此类优化目标",-5002,false),
+    KUAISHOU_SPEED_EXPLORE_FAIL("加速探索失败",-5003,false),
 
-    KUAISHOU_SPEED_EXPLORE_ACTION_TYPE_NOT_CONFIG("加速探索尚不支持此类优化目标",-6001,false),
-    KUAISHOU_SPEED_EXPLORE_FAIL("加速探索失败",-6002,false),
+    KUAISHOU_AI_STRATEGY_HAS_NOT_EXIST("账户策略未配置或者已经被关闭",-6001,false),
+    KUAISHOU_AI_STRATEGY_HAS_NO_HISTORY_MATERIAL("历史素材不存在",-6002,false),
 
     KUAISHOU_CRAWLER_APP_SUCCESS("爬虫运行正常", 0, true),
     KUAISHOU_CRAWLER_APP_TASK_END("爬虫任务运行结束", 1, true),

+ 2 - 0
module-common/src/main/java/com/xxl/job/core/executor/impl/XxlJobSimpleExecutor.java

@@ -29,6 +29,7 @@ public class XxlJobSimpleExecutor extends XxlJobExecutor {
     }
 
 
+    @Override
     public void start() {
 
         // init JobHandler Repository (for method)
@@ -42,6 +43,7 @@ public class XxlJobSimpleExecutor extends XxlJobExecutor {
         }
     }
 
+    @Override
     public void destroy() {
         super.destroy();
     }

+ 1 - 7
module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoJhsbybtServiceImpl.java

@@ -1,21 +1,15 @@
 package cn.com.ctop.crawler.modules.taobao.service.impl;
 
-import cn.com.ctop.common.module.entity.BindAccountLogin;
-import cn.com.ctop.common.module.utils.ChaojiyingUtils;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.HttpUtils2;
 import cn.com.ctop.crawler.modules.taobao.service.TaobaoJhsbybtService;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.gson.Gson;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.http.cookie.Cookie;
 import org.apache.http.impl.client.BasicCookieStore;
 import org.apache.http.impl.cookie.BasicClientCookie;
 import org.openqa.selenium.By;
-import org.openqa.selenium.OutputType;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.chrome.ChromeDriver;
@@ -95,7 +89,7 @@ public class TaobaoJhsbybtServiceImpl implements TaobaoJhsbybtService {
         Map<String, Object> paramMap = new HashMap<String, Object>();
         paramMap.put("jsv", "2.5.1");
         paramMap.put("appKey", "12574478");
-        paramMap.put("t", new Date().getTime());
+        paramMap.put("t", System.currentTimeMillis());
         paramMap.put("sign", "56b679fe3a6de0cd4ffa8ccb8680ff83");
         paramMap.put("timeout", 3000);
         paramMap.put("api", "mtop.tmall.kangaroo.core.service.route.AldLampServiceFixedRes");

+ 1 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/taobao/service/impl/TaobaoTttmServiceImpl.java

@@ -20,7 +20,7 @@ public class TaobaoTttmServiceImpl implements TaobaoTttmService {
         Map<String, Object> paramMap = new HashMap<String, Object>();
         paramMap.put("jsv", "2.6.0");
         paramMap.put("appKey", "12574478");
-        paramMap.put("t", new Date().getTime());
+        paramMap.put("t", System.currentTimeMillis());
         paramMap.put("sign", "56b679fe3a6de0cd4ffa8ccb8680ff83");
         paramMap.put("timeout", 3000);
         paramMap.put("api", "mtop.panama.fiona.commonbizservice");

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

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

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

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

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

@@ -1,7 +1,7 @@
 package cn.com.ctop.job.kuaishou.handler;
 
-import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountTargetTemplate;
-import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountTargetTemplateService;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouNewCreateCampaign;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
@@ -18,31 +18,31 @@ public class KuaishouAiAdsNewMaterialCreativityJob {
 
     @Autowired
     IAiKuaishouNewCreateCampaign aiKuaishouNewCreateCampaign;
+    @Autowired
+    private IAiKuaishouAdvertiserStrategyService aiKuaishouAdvertiserStrategyService;
     static ExecutorService executorService = Executors.newFixedThreadPool(5);
     static CountDownLatch countDownLatch = null;
 
-    @Autowired
-    private IAiKuaishouAccountTargetTemplateService aiKuaishouAccountTargetTemplateService;
     @XxlJob("kuaishouAiAdsNewMaterialCreativityJob")
     public void kuaishouAiAdsNewMaterialCreativityJob() {
-        List<AiKuaishouAccountTargetTemplate> accountTargetTemplates = aiKuaishouAccountTargetTemplateService.getAllEffectTemplate();
-        if(null==accountTargetTemplates||accountTargetTemplates.isEmpty()){
+        List<AiKuaishouAdvertiserStrategy> strategies = aiKuaishouAdvertiserStrategyService.getAllEffectStrategy();
+        if(null==strategies||strategies.isEmpty()){
             return;
         }
-        accountTargetTemplates.forEach(targetTemplate -> aiKuaishouNewCreateCampaign.kuaishouAiAdsNewMaterialCreativity(targetTemplate));
+        strategies.forEach(targetTemplate -> aiKuaishouNewCreateCampaign.kuaishouAiAdsNewMaterialCreativity(targetTemplate));
     }
 
 
-    @XxlJob("kuaishouAiAddNewMaterialCreativityJob")
-    public void kuaishouAiAddNewMaterialCreativityJob() {
-        List<AiKuaishouAccountTargetTemplate> accountTargetTemplates = aiKuaishouAccountTargetTemplateService.getAllEffectTemplate();
+    @XxlJob("kuaishouAiAddZeroMaterialCreativityJob")
+    public void kuaishouAiAddZeroMaterialCreativityJob() {
+        List<AiKuaishouAdvertiserStrategy> accountTargetTemplates = aiKuaishouAdvertiserStrategyService.getAllEffectStrategy();
         if(null==accountTargetTemplates||accountTargetTemplates.isEmpty()){
             return;
         }
         countDownLatch = new CountDownLatch(accountTargetTemplates.size());
         accountTargetTemplates.forEach(targetTemplate -> executorService.submit(()->{
             try {
-                aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(targetTemplate, 10);
+                aiKuaishouNewCreateCampaign.kuaishouAiAddZeroMaterialCreativity(targetTemplate, 10);
                 XxlJobHelper.log("账户上新结束=>accountId:{}",targetTemplate.getAccountId());
             }catch (Exception e) {
                 e.printStackTrace();
@@ -60,7 +60,7 @@ public class KuaishouAiAdsNewMaterialCreativityJob {
 
     @XxlJob("kuaishouAiAdsHotMaterialCreativityJob")
     public void kuaishouAiAdsHotMaterialCreativityJob() {
-        List<AiKuaishouAccountTargetTemplate> accountTargetTemplates = aiKuaishouAccountTargetTemplateService.getAllEffectTemplate();
+        List<AiKuaishouAdvertiserStrategy> accountTargetTemplates = aiKuaishouAdvertiserStrategyService.getAllEffectStrategy();
         if(null==accountTargetTemplates||accountTargetTemplates.isEmpty()){
             return;
         }

+ 139 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAiCreativeJob.java

@@ -0,0 +1,139 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouCreateCreativeService;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.text.ParseException;
+import java.util.List;
+
+/**
+ * @author syh
+ * 自动投放定时任务
+ */
+@Component
+public class KuaishouAiCreativeJob {
+    @Autowired
+    private IAiKuaishouAdvertiserStrategyService strategyService;
+    @Autowired
+    private IAiKuaishouCreateCreativeService createCreativeService;
+    /**
+     * 自定义上新创意
+     */
+    @XxlJob("kuaishouCustomCreativeAuto")
+    public void kuaishouCustomCreativeAuto() {
+        List<AiKuaishouAdvertiserStrategy> strategies = strategyService.getAllEffectStrategy();
+        if(null==strategies||strategies.isEmpty()){
+            return;
+        }
+        strategies.forEach(strategy -> {
+            if(null!=strategy.getOpenProgramCreate()&&strategy.getOpenProgramCreate()!=1){
+                createCreativeService.autoCreateCreative(strategy,1,null);
+            }
+        });
+    }
+
+    /**
+     * 补充自定义创意
+     */
+    @XxlJob("kuaishouCustomCreativeSupplement")
+    public void kuaishouCustomCreativeSupplement() {
+        List<AiKuaishouAdvertiserStrategy> strategies = strategyService.getAllEffectStrategy();
+        if(null==strategies||strategies.isEmpty()){
+            return;
+        }
+        strategies.forEach(strategy -> {
+            if(null!=strategy.getOpenProgramCreate()&&strategy.getOpenProgramCreate()!=1){
+                try {
+                    createCreativeService.customCreativeSupplement(strategy,1);
+                } catch (ParseException e) {
+                    e.printStackTrace();
+                }
+            }
+        });
+    }
+
+
+    /**
+     * 自定义高质量创意
+     */
+    @XxlJob("kuaishouCustomCreativeTop")
+    public void kuaishouCustomCreativeTop() {
+        List<AiKuaishouAdvertiserStrategy> strategies = strategyService.getAllEffectStrategy();
+        if(null==strategies||strategies.isEmpty()){
+            return;
+        }
+        strategies.forEach(strategy -> {
+            if(null!=strategy.getOpenProgramCreate()&&strategy.getOpenProgramCreate()!=1){
+                createCreativeService.autoCreateCreative(strategy,2,20L);
+            }
+        });
+    }
+
+    /**
+     * 自定义遗漏创意
+     */
+    @XxlJob("kuaishouCustomCreativeMissing")
+    public void kuaishouCustomCreativeMissing() {
+        List<AiKuaishouAdvertiserStrategy> strategies = strategyService.getAllEffectStrategy();
+        if(null==strategies||strategies.isEmpty()){
+            return;
+        }
+        strategies.forEach(strategy -> {
+            if(null!=strategy.getOpenProgramCreate()&&strategy.getOpenProgramCreate()!=1){
+                createCreativeService.autoCreateCreative(strategy,3,null);
+            }
+        });
+    }
+
+    /**
+     * 自定义历史打捞创意
+     */
+    @XxlJob("kuaishouCustomCreativeHistory")
+    public void kuaishouCustomCreativeHistory() {
+        List<AiKuaishouAdvertiserStrategy> strategies = strategyService.getAllEffectStrategy();
+        if(null==strategies||strategies.isEmpty()){
+            return;
+        }
+        strategies.forEach(strategy -> {
+            if(null!=strategy.getOpenProgramCreate()&&strategy.getOpenProgramCreate()!=1){
+                createCreativeService.autoCreateCreative(strategy,4,null);
+            }
+        });
+    }
+
+    /**
+     * 程序化上新创意
+     */
+    @XxlJob("kuaishouProgramCreativeAuto")
+    public void kuaishouProgramCreativeAuto() {
+        List<AiKuaishouAdvertiserStrategy> strategies = strategyService.getAllEffectStrategy();
+        if(null==strategies||strategies.isEmpty()){
+            return;
+        }
+        strategies.forEach(strategy -> {
+            if(null!=strategy.getOpenProgramCreate()&&strategy.getOpenProgramCreate()!=0){
+                createCreativeService.autoCreateProgramCreative(strategy,1,150L);
+            }
+        });
+    }
+
+    /**
+     * 程序化上新创意
+     */
+    @XxlJob("kuaishouProgramCreativeTop")
+    public void kuaishouProgramCreativeTop() {
+        List<AiKuaishouAdvertiserStrategy> strategies = strategyService.getAllEffectStrategy();
+        if(null==strategies||strategies.isEmpty()){
+            return;
+        }
+        strategies.forEach(strategy -> {
+            if(null!=strategy.getOpenProgramCreate()&&strategy.getOpenProgramCreate()!=0){
+                createCreativeService.autoCreateProgramCreative(strategy,2,150L);
+            }
+        });
+    }
+}

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

@@ -215,7 +215,6 @@ public class KuaiShouMaterialControer {
      */
     @PostMapping(value = "/getHistoryTopVideoList")
     public JSONObject getHistoryTopVideoList(@RequestBody JSONObject requestJson) {
-        //   log.info("获取历史Top素材入参:{}", requestJson);
         JSONObject returnJson = new JSONObject();
         try {
             if (Check.isNull(requestJson)) {

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

@@ -201,6 +201,14 @@ public class AiKuaishouAdvertiserStrategy {
 	 */
 	private String appIdArray;
 	private Integer openProgramCreate;
+
+	private Long campaignDayBudget;
+	private String campaignDayBudgetSchedule;
+	private Long unitDayBudget;
+	private String unitDayBudgetSchedule;
+	private Long customUnitCnt;
+	private Long programUnitCnt;
+
 	@TableField(exist = false)
 	private String authName;
 }

+ 56 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/enums/KuaishouCreativeAdsenceTypeEnum.java

@@ -0,0 +1,56 @@
+package cn.com.ctop.kuaishou.modules.ai.enums;
+
+/**
+ * @author syh
+ */
+public enum KuaishouCreativeAdsenceTypeEnum {
+    /**
+     * 快手广告组投放资源位置
+     */
+    KUAISHOU_CREATIVE_ADSENCE_TYPE_ENUM_SELECT(1,"优选"),
+    KUAISHOU_CREATIVE_ADSENCE_TYPE_ENUM_STICKY(3,"便利贴"),
+    KUAISHOU_CREATIVE_ADSENCE_TYPE_ENUM_ALLIANCE(5,"联盟"),
+    KUAISHOU_CREATIVE_ADSENCE_TYPE_ENUM_SCREEN(6,"上下滑"),
+    KUAISHOU_CREATIVE_ADSENCE_TYPE_ENUM_FEEDS(7,"信息流"),
+    KUAISHOU_CREATIVE_ADSENCE_TYPE_ENUM_ALLIANCE_SCENCE(10,"联盟场景");
+
+    /**
+     * 类型
+     */
+    private Integer type;
+    /**
+     * 名称
+     */
+    private String name;
+
+    KuaishouCreativeAdsenceTypeEnum(Integer type, String name) {
+        this.type = type;
+        this.name = name;
+    }
+
+    public static String getNameByType(Integer type) {
+        for (KuaishouCreativeAdsenceTypeEnum createTypeEnum : KuaishouCreativeAdsenceTypeEnum.values()) {
+            if (createTypeEnum.getType().equals(type)) {
+                return createTypeEnum.getName();
+            }
+        }
+        return "";
+    }
+
+
+    public Integer getType() {
+        return this.type;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public void setName(String value) {
+        this.name = value;
+    }
+}

+ 55 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/enums/KuaishouCreativeCreateTypeEnum.java

@@ -0,0 +1,55 @@
+package cn.com.ctop.kuaishou.modules.ai.enums;
+
+import cn.com.ctop.kuaishou.modules.batch.Enums.CampaignTypeEnum;
+
+/**
+ * @author syh
+ */
+public enum KuaishouCreativeCreateTypeEnum {
+    /**
+     * 快手创意创建方式
+     */
+    KUAISHOU_CREATIVE_CREATETYPE_ENUM_PROGRAM(1,"程序化"),
+    KUAISHOU_CREATIVE_CREATETYPE_ENUM_UNLIMITED(2,"不限"),
+    KUAISHOU_CREATIVE_CREATETYPE_ENUM_CUSTOM(0,"自定义");
+
+    /**
+     * 类型
+     */
+    private Integer type;
+    /**
+     * 名称
+     */
+    private String value;
+
+    KuaishouCreativeCreateTypeEnum(Integer type, String value) {
+        this.type = type;
+        this.value = value;
+    }
+
+    public static String getNameByType(Integer type) {
+        for (KuaishouCreativeCreateTypeEnum createTypeEnum : KuaishouCreativeCreateTypeEnum.values()) {
+            if (createTypeEnum.getType().equals(type)) {
+                return createTypeEnum.getValue();
+            }
+        }
+        return "";
+    }
+
+
+    public Integer getType() {
+        return type;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+}

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

@@ -0,0 +1,101 @@
+package cn.com.ctop.kuaishou.modules.ai.enums;
+
+/**
+ * @author syh
+ */
+public enum KuaishouCreativeMatTypeEnum {
+    /**
+     * 13 23 分别是历史遗漏素材,归类到上新素材中
+     * type字段 第一位创意创建方式,第二位素材获取方式
+     * 快手创意素材获取类型
+     */
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_NEW("41","自定义上新",-10L,-5L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_HIGH_quality("42","自定义高质量",-14*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_MISSING("43","自定义上新",-60*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_HISTORY("44","自定义历史",-60*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_NEW("71","程序化上新",-10L,-5L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_HIGH_quality("72","程序化高质量",-14*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_MISSING("73","程序化上新",-60*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_HISTORY("74","程序化历史",-60*60*24L,-1*60*24L),;
+
+    /**
+     * 类型
+     */
+    private String type;
+    /**
+     * 名称
+     */
+    private String name;
+    /**
+     * 素材查询的时间区间
+     */
+    private Long videoGetStartTime;
+    private Long videoGetEndTime;
+
+    KuaishouCreativeMatTypeEnum(String type, String name,Long videoGetStartTime,Long videoGetEndTime) {
+        this.type = type;
+        this.name = name;
+        this.videoGetStartTime = videoGetStartTime;
+        this.videoGetEndTime = videoGetEndTime;
+    }
+
+    public static String getNameByType(String type) {
+        for (KuaishouCreativeMatTypeEnum createTypeEnum : KuaishouCreativeMatTypeEnum.values()) {
+            if (createTypeEnum.getType().equals(type)) {
+                return createTypeEnum.getName();
+            }
+        }
+        return "";
+    }
+
+    public static Long getStartTimeByType(String type) {
+        for (KuaishouCreativeMatTypeEnum createTypeEnum : KuaishouCreativeMatTypeEnum.values()) {
+            if (createTypeEnum.getType().equals(type)) {
+                return createTypeEnum.getVideoGetStartTime();
+            }
+        }
+        return -10L;
+    }
+
+    public static Long getEndTimeByType(String type) {
+        for (KuaishouCreativeMatTypeEnum createTypeEnum : KuaishouCreativeMatTypeEnum.values()) {
+            if (createTypeEnum.getType().equals(type)) {
+                return createTypeEnum.getVideoGetEndTime();
+            }
+        }
+        return -5L;
+    }
+
+
+    public String getType() {
+        return this.type;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public void setName(String value) {
+        this.name = value;
+    }
+
+    public Long getVideoGetStartTime() {
+        return videoGetStartTime;
+    }
+
+    public void setVideoGetStartTime(Long videoGetStartTime) {
+        this.videoGetStartTime = videoGetStartTime;
+    }
+
+    public Long getVideoGetEndTime() {
+        return videoGetEndTime;
+    }
+
+    public void setVideoGetEndTime(Long videoGetEndTime) {
+        this.videoGetEndTime = videoGetEndTime;
+    }
+}

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

@@ -19,4 +19,5 @@ public interface IAiKuaiShouAppInfoService extends IService<AiKuaiShouAppInfo> {
 
     void appCreative(Long accountId, String accessToken);
 
+    AiKuaiShouAppInfo getByParams(Long accountId,Long appId);
 }

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

@@ -3,6 +3,7 @@ package cn.com.ctop.kuaishou.modules.ai.service;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -16,4 +17,13 @@ public interface IAiKuaishouAdvertiserStrategyService extends IService<AiKuaisho
     AiKuaishouAdvertiserStrategy getByAccountId(Long accountId);
 
     Map<String, Object> testCreate(Long accountId);
+
+    /**
+     * 补充历史遗漏素材
+     * @param accountId
+     * @return
+     */
+    Map<String, Object> aiHistoricalMissingMaterial(Long accountId);
+
+    List<AiKuaishouAdvertiserStrategy> getAllEffectStrategy();
 }

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

@@ -0,0 +1,13 @@
+package cn.com.ctop.kuaishou.modules.ai.service;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
+
+import java.text.ParseException;
+
+public interface IAiKuaishouCreateCreativeService {
+    Long autoCreateCreative(AiKuaishouAdvertiserStrategy strategy, Integer createType, Long videoCnt);
+
+    void autoCreateProgramCreative(AiKuaishouAdvertiserStrategy strategy,Integer createType,Long videoCnt);
+
+    void customCreativeSupplement(AiKuaishouAdvertiserStrategy strategy,Integer hour) throws ParseException;
+}

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

@@ -1,11 +1,27 @@
 package cn.com.ctop.kuaishou.modules.ai.service;
 
-import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountTargetTemplate;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
 
 public interface IAiKuaishouNewCreateCampaign {
-    void kuaishouAiAdsNewMaterialCreativity(AiKuaishouAccountTargetTemplate targetTemplate);
+    void kuaishouAiAdsNewMaterialCreativityMultileAppids(AiKuaishouAdvertiserStrategy strategy);
 
-    void kuaishouAiAdsHotMaterialCreativity(AiKuaishouAccountTargetTemplate targetTemplate);
+    /**
+     * 上新
+     * @param strategy
+     */
+    void kuaishouAiAdsNewMaterialCreativity(AiKuaishouAdvertiserStrategy strategy);
+
+    /**
+     * 爆款
+     * @param strategy
+     */
+    void kuaishouAiAdsHotMaterialCreativity(AiKuaishouAdvertiserStrategy strategy);
+
+    /**
+     *
+     * @param strategy
+     * @param matNum
+     */
+    void kuaishouAiAddZeroMaterialCreativity(AiKuaishouAdvertiserStrategy strategy,Integer matNum);
 
-    void kuaishouAiAddNewMaterialCreativity(AiKuaishouAccountTargetTemplate targetTemplate,Integer matNum);
 }

+ 3 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiCreativeLimitServiceImpl.java

@@ -4,9 +4,10 @@ import cn.com.ctop.kuaishou.modules.ai.entity.AiCreativeLimit;
 import cn.com.ctop.kuaishou.modules.ai.mapper.AiCreativeLimitMapper;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiCreativeLimitService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+
 /**
  * 关联数超限
  *
@@ -16,7 +17,7 @@ import org.springframework.stereotype.Service;
  */
 @Service
 public class AiCreativeLimitServiceImpl extends ServiceImpl<AiCreativeLimitMapper, AiCreativeLimit> implements IAiCreativeLimitService {
-    @Autowired
+    @Resource
     private AiCreativeLimitMapper creativeLimitMapper;
 
     @Override

+ 13 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaiShouAppInfoServiceImpl.java

@@ -192,6 +192,19 @@ public class AiKuaiShouAppInfoServiceImpl extends ServiceImpl<AiKuaiShouAppInfoM
         }
     }
 
+    @Override
+    public AiKuaiShouAppInfo getByParams(Long accountId,Long appId) {
+        QueryWrapper<AiKuaiShouAppInfo>queryWrapper = new QueryWrapper<>();
+        if(null!=accountId&&accountId!=0){
+            queryWrapper.eq("account_id",accountId);
+        }
+        if(null!=appId&&appId!=0){
+            queryWrapper.eq("app_id",appId);
+        }
+        queryWrapper.last("limit 1");
+        return this.getOne(queryWrapper);
+    }
+
 
     private List<AiKuaiShouAppInfo> getAppListByStatus(Long accountId, Integer status) {
         QueryWrapper<AiKuaiShouAppInfo> queryWrapper = new QueryWrapper<>();

+ 66 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAdvertiserStrategyServiceImpl.java

@@ -2,12 +2,15 @@ package cn.com.ctop.kuaishou.modules.ai.service.impl;
 
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
 import cn.com.ctop.kuaishou.modules.ai.mapper.AiKuaishouAdvertiserStrategyMapper;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouVideoRelateCreativesService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -15,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -29,6 +33,11 @@ public class AiKuaishouAdvertiserStrategyServiceImpl extends ServiceImpl<AiKuais
     public static final String TEST_PROGRAM_CREATIVE_URL= "http://139.186.27.96:31012/ai_programme_new_material";
     @Autowired
     private IUserAllocationService userAllocationService;
+    @Autowired
+    private IKuaiShouVideoGetService videoGetService;
+    @Autowired
+    private IKuaishouVideoRelateCreativesService relateCreativesService;
+
     @Override
     public AiKuaishouAdvertiserStrategy getByAccountId(Long accountId) {
         QueryWrapper<AiKuaishouAdvertiserStrategy>queryWrapper =new QueryWrapper<>();
@@ -72,4 +81,61 @@ public class AiKuaishouAdvertiserStrategyServiceImpl extends ServiceImpl<AiKuais
         result.put("message",message);
         return result;
     }
+    @Override
+    public Map<String, Object> aiHistoricalMissingMaterial(Long accountId) {
+        Map<String,Object>result = new HashMap<>();
+        if(null == accountId||accountId == 0){
+            ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
+            return result;
+        }
+        AiKuaishouAdvertiserStrategy strategy = this.getByAccountId(accountId);
+        if(null == strategy||strategy.getStatus()!=1){
+            ResultMapUtils.setResultMap(result,StatusCode.KUAISHOU_AI_STRATEGY_HAS_NOT_EXIST);
+            return result;
+        }
+        this.historicalMissingMaterialCreateCreative(strategy);
+        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        return result;
+    }
+
+    @Override
+    public List<AiKuaishouAdvertiserStrategy> getAllEffectStrategy() {
+        QueryWrapper<AiKuaishouAdvertiserStrategy>queryWrapper= new QueryWrapper<>();
+        queryWrapper.eq("status",1);
+        queryWrapper.orderByDesc("id");
+        return this.list(queryWrapper);
+    }
+
+    private Map<String,Object> historicalMissingMaterialCreateCreative(AiKuaishouAdvertiserStrategy strategy) {
+        Map<String,Object>result =new HashMap<>();
+        //判定是否单一应用
+        if(strategy.getSingleAppid()==1){
+            //TODO 参数拼接
+            Map<String,Object>params =new HashMap<>();
+            //1:直接查询历史素材
+            List<JSONObject> materialList = relateCreativesService.getVideoZeroListByMap(params);
+            if (Check.isNull(materialList)) {
+                ResultMapUtils.setResultMap(result,StatusCode.KUAISHOU_AI_STRATEGY_HAS_NO_HISTORY_MATERIAL);
+                return result;
+            }
+            materialList = videoGetService.getVideoInfoAndImageList(materialList);
+            //补充遗漏素材
+            JSONObject hisMatParams = formatHisMatParams(strategy,materialList,"补充遗漏素材");
+        }else{
+            //
+
+        }
+        return result;
+    }
+
+    private JSONObject formatHisMatParams(AiKuaishouAdvertiserStrategy strategy, List<JSONObject> materialList, String fixString) {
+        JSONObject result = new JSONObject();
+        result.put("video",materialList);
+        result.put("operation_type",1);
+        result.put("account_id",strategy.getAccountId());
+        result.put("ai_strategy_remark",fixString);
+
+        return result;
+    }
+
 }

Plik diff jest za duży
+ 1064 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java


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

@@ -6,7 +6,7 @@ import cn.com.ctop.common.module.entity.MaterialImageInfo;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.service.IMaterialCutFrameService;
 import cn.com.ctop.common.module.service.IMaterialImageInfoService;
-import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountTargetTemplate;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouStrategyMapCreative;
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAccountCreativeOverrunInfo;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouNewCreateCampaign;
@@ -21,7 +21,6 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
-import org.jeecg.common.util.JsonResourceUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -57,17 +56,19 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
     @Autowired
     private IKuaishouAccountCreativeOverrunInfoService overrunInfoService;
 
+    /**
+     * 单应用上新
+     * @param strategy
+     */
     @Override
-    public void kuaishouAiAdsNewMaterialCreativity(AiKuaishouAccountTargetTemplate targetTemplate) {
-        Long accountId = targetTemplate.getAccountId();
+    public void kuaishouAiAdsNewMaterialCreativityMultileAppids(AiKuaishouAdvertiserStrategy strategy) {
+        Long accountId = strategy.getAccountId();
         CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId.toString());
         if(null == token){
             log.info("token获取失败=>accountId:{}",accountId);
             return;
         }
 
-        // 2、执行素材的同步数据服务
-        // 2.1 执行 非素造的 视频拉取服务,时间过滤支持 yyyy-MM-dd, 拉取当天凌晨到此刻的数据
         kuaishouInterfaceService.getVideoList(token, DateUtils.date2Str(),DateUtils.date2Str());
 
         // 2.2 执行 素造的 视频拉取服务,时间过滤执行 yyyy-MM-dd HH:mm:ss
@@ -77,8 +78,11 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
         Long now = System.currentTimeMillis();
         String startTime = DateUtils.formatDate(new Date(now + timeStart*60*1000),"yyyy-MM-dd HH:mm:ss");
         String endTime = DateUtils.formatDate(new Date(now + timeEnd*60*1000),"yyyy-MM-dd HH:mm:ss");
+        if(null!=strategy.getSingleAppid()&&strategy.getSingleAppid() == 1){
+            //单一应用
+        }
         // 3、获取5分钟内,ctop_kuaishou_video_get 的视频数据,记为 N,如果有数据则执行下面步骤
-        List<KuaiShouVideoGet> newVideos = videoGetService.getNewVideoBetweenTime(accountId,startTime,endTime);
+        List<KuaiShouVideoGet> newVideos = videoGetService.getNewVideoBetweenTime(accountId,startTime,endTime,strategy.getChannelType(),null,null);
         int newVideosCnt = newVideos.size();
         if (newVideosCnt == 0){
             log.info("账户:{},{} 到 {} 这段时间没有上新素材",accountId, startTime, endTime);
@@ -106,14 +110,16 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
             String timestamp = DateUtils.formatDate(campaignDate,"yyyyMMddHHmmss");
             JSONObject campaignParams = new JSONObject();
             campaignParams.put("advertiser_id",token.getAccountId());
-            String campaignName = targetTemplate.getTitlePrefix() + "素材上新"+ targetTemplate.getTitleMiddle()+ timestamp;
+            String campaignName = strategy.getCampaignName().replace("自定义","素材上新")+timestamp;
             campaignParams.put("campaign_name",campaignName);
-            campaignParams.put("type",Integer.parseInt(targetTemplate.getMarketingGoal()));
+            campaignParams.put("type",strategy.getCampaignType());
+            //TODO 目前设定为不限
             campaignParams.put("day_budget",0L);
             Map<String, Object> campaignCreateResult = kuaishouInterfaceService.campaignCreate(token.getAccessToken(), token.getAccountId(), campaignParams);
             Integer code = (Integer) campaignCreateResult.get("code");
             String message = (String) campaignCreateResult.get("message");
             if(code != 0 ){
+                //TODO 写入日志信息表
                 log.info("计划创建失败=>message:{}",message);
                 return;
             }
@@ -122,7 +128,7 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
 
         //3、在“上新”计划中新增广告组,一个素材搭配5张封面,组成一个广告组
         String timestamp = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss");
-        String unitNamePrefix = targetTemplate.getTitlePrefix() + "素材上新"+ targetTemplate.getTitleMiddle()+ timestamp;
+        String unitNamePrefix = strategy.getGroupName().replace("自定义","素材上新")+ timestamp;
         int unitCnt = 0;
         for(KuaiShouVideoGet videoItem: newVideos){
             KuaishouAccountCreativeOverrunInfo overrunInfo = overrunInfoService.getByParams(accountId,DateUtils.formatDate(new Date()));
@@ -131,7 +137,7 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
             }
             unitCnt ++;
             String unitName = unitNamePrefix + "-" + unitCnt;
-            JSONObject unitParams = createUnitParams(token, newCampaignId, targetTemplate, unitName);
+            JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName);
             Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams,1);
             Integer unitCode = (Integer) unitCreateResult.get("code");
             String unitMessage = (String) unitCreateResult.get("message");
@@ -143,19 +149,117 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
 
             // 每个组,搭配5个创意
             List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
-            List<MaterialImageInfo> orgFrameList = materialImageInfoService.getListByVideoSignature(videoItem.getSignature());
-            if ((null == cutFrameList||cutFrameList.isEmpty())&&(null == orgFrameList|| orgFrameList.isEmpty())){
+            if ((null == cutFrameList||cutFrameList.isEmpty())){
                 log.info("未获取到视频封面=>videoSignature:{}",videoItem.getSignature());
                 continue;
             }
-            JSONObject creativeParams = creativeParams(token, unitId, videoItem, targetTemplate);
-            createCreativeByImage(cutFrameList, orgFrameList,token, creativeParams, newCampaignId, unitId, videoItem,targetTemplate.getImageNumber());
+            JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy);
+            createCreativeByImage(cutFrameList,token, creativeParams, newCampaignId, unitId, videoItem,strategy.getImageCnt());
         }
     }
 
+    /**
+     * 单应用上新
+     * @param strategy
+     */
     @Override
-    public void kuaishouAiAdsHotMaterialCreativity(AiKuaishouAccountTargetTemplate targetTemplate) {
-        Long accountId = targetTemplate.getAccountId();
+    public void kuaishouAiAdsNewMaterialCreativity(AiKuaishouAdvertiserStrategy strategy) {
+        Long accountId = strategy.getAccountId();
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId.toString());
+        if(null == token){
+            log.info("token获取失败=>accountId:{}",accountId);
+            return;
+        }
+
+        kuaishouInterfaceService.getVideoList(token, DateUtils.date2Str(),DateUtils.date2Str());
+
+        // 2.2 执行 素造的 视频拉取服务,时间过滤执行 yyyy-MM-dd HH:mm:ss
+        // 时间差,单位为分钟
+        int timeStart = -10;
+        int timeEnd = -5;
+        Long now = System.currentTimeMillis();
+        String startTime = DateUtils.formatDate(new Date(now + timeStart*60*1000),"yyyy-MM-dd HH:mm:ss");
+        String endTime = DateUtils.formatDate(new Date(now + timeEnd*60*1000),"yyyy-MM-dd HH:mm:ss");
+        // 3、获取5分钟内,ctop_kuaishou_video_get 的视频数据,记为 N,如果有数据则执行下面步骤
+        List<KuaiShouVideoGet> newVideos = videoGetService.getNewVideoBetweenTime(accountId,startTime,endTime,strategy.getChannelType(),null,null);
+        int newVideosCnt = newVideos.size();
+        if (newVideosCnt == 0){
+            log.info("账户:{},{} 到 {} 这段时间没有上新素材",accountId, startTime, endTime);
+            return;
+        }
+
+        //2、判断该账户下当天有没有“上新”计划,没有则创建一个“上新”计划
+        // time_filter_type 传入 "start_date",与 "end_date" 字段,且此字段为1时,按照创建时间进行筛选
+        JSONArray campaignList = kuaishouInterfaceService.getCampaignList(token, new Date(), new Date(),1);
+        boolean isHaveNewCampaign = false;
+        Long newCampaignId = 0L;
+        if (null!=campaignList&&campaignList.size()>0){
+            for(int i = 0;i<campaignList.size();i++){
+                JSONObject jsonObject = campaignList.getJSONObject(i);
+                if (jsonObject.getString("campaign_name").contains("素材上新")){
+                    isHaveNewCampaign = true;
+                    newCampaignId = jsonObject.getLong("campaign_id");
+                    break;
+                }
+            }
+        }
+        // 不存在“上新”计划,则创建一个计划
+        if (!isHaveNewCampaign){
+            Date campaignDate = new Date();
+            String timestamp = DateUtils.formatDate(campaignDate,"yyyyMMddHHmmss");
+            JSONObject campaignParams = new JSONObject();
+            campaignParams.put("advertiser_id",token.getAccountId());
+            String campaignName = strategy.getCampaignName().replace("自定义","素材上新")+timestamp;
+            campaignParams.put("campaign_name",campaignName);
+            campaignParams.put("type",strategy.getCampaignType());
+            //TODO 目前设定为不限
+            campaignParams.put("day_budget",0L);
+            Map<String, Object> campaignCreateResult = kuaishouInterfaceService.campaignCreate(token.getAccessToken(), token.getAccountId(), campaignParams);
+            Integer code = (Integer) campaignCreateResult.get("code");
+            String message = (String) campaignCreateResult.get("message");
+            if(code != 0 ){
+                //TODO 写入日志信息表
+                log.info("计划创建失败=>message:{}",message);
+                return;
+            }
+            newCampaignId = (Long) campaignCreateResult.get("campaignId");
+        }
+
+        //3、在“上新”计划中新增广告组,一个素材搭配5张封面,组成一个广告组
+        String timestamp = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss");
+        String unitNamePrefix = strategy.getGroupName().replace("自定义","素材上新")+ timestamp;
+        int unitCnt = 0;
+        for(KuaiShouVideoGet videoItem: newVideos){
+            KuaishouAccountCreativeOverrunInfo overrunInfo = overrunInfoService.getByParams(accountId,DateUtils.formatDate(new Date()));
+            if(null!=overrunInfo){
+                return;
+            }
+            unitCnt ++;
+            String unitName = unitNamePrefix + "-" + unitCnt;
+            JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName);
+            Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams,1);
+            Integer unitCode = (Integer) unitCreateResult.get("code");
+            String unitMessage = (String) unitCreateResult.get("message");
+            if(unitCode != 0 ){
+                log.info("组创建失败=>accountId:{};message:{}",accountId,unitMessage);
+                continue;
+            }
+            Long unitId = (Long) unitCreateResult.get("unitId");
+
+            // 每个组,搭配5个创意
+            List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
+            if ((null == cutFrameList||cutFrameList.isEmpty())){
+                log.info("未获取到视频封面=>videoSignature:{}",videoItem.getSignature());
+                continue;
+            }
+            JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy);
+            createCreativeByImage(cutFrameList,token, creativeParams, newCampaignId, unitId, videoItem,strategy.getImageCnt());
+        }
+    }
+
+    @Override
+    public void kuaishouAiAdsHotMaterialCreativity(AiKuaishouAdvertiserStrategy strategy) {
+        Long accountId = strategy.getAccountId();
         CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId.toString());
         if(null == token){
             log.info("token获取失败=>accountId:{}",accountId);
@@ -189,9 +293,9 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
             String timestamp = DateUtils.formatDate(campaignDate,"yyyyMMddHHmmss");
             JSONObject campaignParams = new JSONObject();
             campaignParams.put("advertiser_id",token.getAccountId());
-            String campaignName = targetTemplate.getTitlePrefix() + "爆量素材"+ targetTemplate.getTitleMiddle() + timestamp;
+            String campaignName = strategy.getCampaignName().replace("自定义","爆量素材")+ timestamp;
             campaignParams.put("campaign_name",campaignName);
-            campaignParams.put("type",Integer.parseInt(targetTemplate.getMarketingGoal()));
+            campaignParams.put("type",strategy.getCampaignType());
             campaignParams.put("day_budget",0L);
             Map<String, Object> campaignCreateResult = kuaishouInterfaceService.campaignCreate(token.getAccessToken(), token.getAccountId(), campaignParams);
             Integer code = (Integer) campaignCreateResult.get("code");
@@ -205,7 +309,7 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
 
         //3、在“上新”计划中新增广告组,一个素材搭配5张封面,组成一个广告组
         String timestamp = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss");
-        String unitNamePrefix = targetTemplate.getTitlePrefix() + "爆量素材"+ targetTemplate.getTitleMiddle()+timestamp;
+        String unitNamePrefix = strategy.getGroupName().replace("自定义","爆量素材")+timestamp;
         int unitCnt = 0;
         for(KuaiShouVideoGet videoItem: highQualityVideos){
             KuaishouAccountCreativeOverrunInfo overrunInfo  =  overrunInfoService.getByParams(accountId,DateUtils.formatDate(new Date()));
@@ -214,7 +318,7 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
             }
             unitCnt ++;
             String unitName = unitNamePrefix + "-" + unitCnt;
-            JSONObject unitParams = createUnitParams(token, newCampaignId, targetTemplate, unitName);
+            JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName);
             Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams,1);
             Integer unitCode = (Integer) unitCreateResult.get("code");
             String unitMessage = (String) unitCreateResult.get("message");
@@ -231,14 +335,15 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
                 log.info("未获取到视频封面=>videoSignature:{}",videoItem.getSignature());
                 continue;
             }
-            JSONObject creativeParams = creativeParams(token, unitId, videoItem, targetTemplate);
-            createCreativeByImage(cutFrameList, orgFrameList,token, creativeParams, newCampaignId, unitId, videoItem,targetTemplate.getImageNumber());
+            JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy);
+            createCreativeByImage(cutFrameList,token, creativeParams, newCampaignId, unitId, videoItem,strategy.getImageCnt());
         }
 
     }
+
     @Override
-    public void kuaishouAiAddNewMaterialCreativity(AiKuaishouAccountTargetTemplate targetTemplate,Integer matNum) {
-        Long accountId = targetTemplate.getAccountId();
+    public void kuaishouAiAddZeroMaterialCreativity(AiKuaishouAdvertiserStrategy strategy,Integer matNum) {
+        Long accountId = strategy.getAccountId();
         CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId.toString());
         if(null == token){
             log.info("token获取失败=>accountId:{}",accountId);
@@ -273,9 +378,9 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
             String timestamp = DateUtils.formatDate(campaignDate,"yyyyMMddHHmmss");
             JSONObject campaignParams = new JSONObject();
             campaignParams.put("advertiser_id",token.getAccountId());
-            String campaignName = targetTemplate.getTitlePrefix() + "素材上新"+ targetTemplate.getTitleMiddle()+ timestamp;
+            String campaignName = strategy.getCampaignName().replace("自定义","素材上新")+timestamp;
             campaignParams.put("campaign_name",campaignName);
-            campaignParams.put("type",Integer.parseInt(targetTemplate.getMarketingGoal()));
+            campaignParams.put("type",strategy.getCampaignType());
             campaignParams.put("day_budget",0L);
             Map<String, Object> campaignCreateResult = kuaishouInterfaceService.campaignCreate(token.getAccessToken(), token.getAccountId(), campaignParams);
             Integer code = (Integer) campaignCreateResult.get("code");
@@ -287,9 +392,9 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
             newCampaignId = (Long) campaignCreateResult.get("campaignId");
         }
 
-        //3、在“上新”计划中新增广告组,一个素材搭配5张封面,组成一个广告组
+        //3、在“上新”计划中新增广告组,一个素材搭配n张封面,组成一个广告组
         String timestamp = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss");
-        String unitNamePrefix = targetTemplate.getTitlePrefix() + "素材上新"+ targetTemplate.getTitleMiddle()+ timestamp;
+        String unitNamePrefix = strategy.getGroupName().replace("自定义","素材上新")+timestamp;
         int unitCnt = 0;
         for(KuaishouVideoRelateCreatives videoItem: kuaishouVideoRelateCreatives){
             KuaishouAccountCreativeOverrunInfo overrunInfo  =  overrunInfoService.getByParams(accountId,DateUtils.formatDate(new Date()));
@@ -302,7 +407,7 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
                 log.info("未获取到视频信息=>photoId:{}",videoItem.getPhotoId());
                 continue;
             }
-            // 每个组,搭配5个创意
+            // 每个组,搭配n个创意
             List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoGet.getSignature());
             List<MaterialImageInfo> orgFrameList = materialImageInfoService.getListByVideoSignature(videoGet.getSignature());
             if ((null == cutFrameList||cutFrameList.isEmpty())&&(null == orgFrameList|| orgFrameList.isEmpty())){
@@ -310,7 +415,7 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
                 continue;
             }
             String unitName = unitNamePrefix + "-" + unitCnt;
-            JSONObject unitParams = createUnitParams(token, newCampaignId, targetTemplate, unitName);
+            JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName);
             Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams,1);
             Integer unitCode = (Integer) unitCreateResult.get("code");
             String unitMessage = (String) unitCreateResult.get("message");
@@ -319,39 +424,40 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
                 continue;
             }
             Long unitId = (Long) unitCreateResult.get("unitId");
-            JSONObject creativeParams = creativeParams(token, unitId, videoGet, targetTemplate);
-            createCreativeByImage(cutFrameList, orgFrameList,token, creativeParams, newCampaignId, unitId, videoGet,targetTemplate.getImageNumber());
-            videoItem.setCreativeCount(5);
+            JSONObject creativeParams = creativeParams(token, unitId, videoGet, strategy);
+            createCreativeByImage(cutFrameList,token, creativeParams, newCampaignId, unitId, videoGet,strategy.getImageCnt());
+            videoItem.setCreativeCount(videoItem.getCreativeCount()+strategy.getImageCnt());
             relateCreativesService.updateById(videoItem);
         }
     }
 
 
-    private JSONObject creativeParams(CtopOauthToken token,Long unitId,KuaiShouVideoGet videoItem,AiKuaishouAccountTargetTemplate targetTemplate){
+    private JSONObject creativeParams(CtopOauthToken token,Long unitId,KuaiShouVideoGet videoItem,AiKuaishouAdvertiserStrategy strategy){
         JSONObject creativeParams = new JSONObject();
         creativeParams.put("advertiser_id",token.getAccountId());
         creativeParams.put("unit_id",unitId);
         creativeParams.put("photo_id",videoItem.getPhotoId());
         creativeParams.put("creative_material_type",videoItem.getMaterialType());
-        creativeParams.put("action_bar_text",targetTemplate.getActionBarText());
-        creativeParams.put("description",targetTemplate.getCreativeDescription());
+        creativeParams.put("action_bar_text",strategy.getActionBarText());
+        creativeParams.put("description",strategy.getDescription());
         // 安卓下载中间页ID
-        JSONArray siteIdArray = JSONArray.parseArray(targetTemplate.getSiteId());
-        if(null == siteIdArray||!siteIdArray.isEmpty()){
-            JSONObject siteObject = siteIdArray.getJSONObject(0);
-            Long siteId = siteObject.getLong("siteId");
-            if(null!=siteId){
-                creativeParams.put("site_id",siteId);
-            }
+        if(null!=strategy.getSiteId()){
+                creativeParams.put("site_id",strategy.getSiteId());
+        }
+        if(null != strategy.getClickTrackUrl()&&!"".equals(strategy.getClickTrackUrl())){
+            creativeParams.put("click_track_url",strategy.getClickTrackUrl());
         }
-        if(null != targetTemplate.getClickTrackUrl()&&!"".equals(targetTemplate.getClickTrackUrl())){
-            creativeParams.put("click_track_url",targetTemplate.getClickTrackUrl());
+        if(null != strategy.getImpressionUrl()&&!"".equals(strategy.getImpressionUrl())){
+            creativeParams.put("impression_url",strategy.getImpressionUrl());
         }
-        if(null != targetTemplate.getImpressionUrl()&&!"".equals(targetTemplate.getImpressionUrl())){
-            creativeParams.put("impression_url",targetTemplate.getImpressionUrl());
+        if(null != strategy.getActionbarClickUrl()&&!"".equals(strategy.getActionbarClickUrl())){
+            creativeParams.put("actionbar_click_url",strategy.getActionbarClickUrl());
         }
-        if(null != targetTemplate.getActionbarClickUrl()&&!"".equals(targetTemplate.getActionbarClickUrl())){
-            creativeParams.put("actionbar_click_url",targetTemplate.getActionbarClickUrl());
+        if(null!=strategy.getCreativeCategory()){
+            creativeParams.put("creative_category",strategy.getCreativeCategory());
+        }
+        if(null!=strategy.getCreativeTag()&&!"".equals(strategy.getCreativeTag())){
+            creativeParams.put("creative_tag",JSONArray.parseArray(strategy.getCreativeTag()));
         }
         return creativeParams;
     }
@@ -379,80 +485,110 @@ public class AiKuaishouNewCreateCampaignServiceImpl implements IAiKuaishouNewCre
     }
 
 
-    private JSONObject createUnitParams(CtopOauthToken token, Long campaignId,  AiKuaishouAccountTargetTemplate targetTemplate,
+    private JSONObject createUnitParams(CtopOauthToken token, Long campaignId,  AiKuaishouAdvertiserStrategy strategy,
                                         String unitName) {
         // 拼装创建组的入参 json
         JSONObject unitParams = new JSONObject();
         unitParams.put("advertiser_id",token.getAccountId());
         unitParams.put("campaign_id",campaignId);
         unitParams.put("unit_name", unitName);
-        unitParams.put("bid_type",targetTemplate.getBidType());
-        unitParams.put("ocpx_action_type",targetTemplate.getOcpxActionType());
+        unitParams.put("bid_type",strategy.getBidType());
+        unitParams.put("ocpx_action_type",strategy.getOcpxActionType());
 
-        if(null!=targetTemplate.getUseAppMarket()&&!"".equals(targetTemplate.getUseAppMarket())){
-            unitParams.put("use_app_market",Integer.parseInt(targetTemplate.getUseAppMarket()));
+        if(null!=strategy.getUseAppMarket()){
+            unitParams.put("use_app_market",strategy.getUseAppMarket());
         }
-        if(null!=targetTemplate.getAppStore()&&!"".equals(targetTemplate.getAppStore())){
-            unitParams.put("app_store",JSONArray.parseArray(targetTemplate.getAppStore()));
+        if(null!=strategy.getAppStore()&&!"".equals(strategy.getAppStore())){
+            unitParams.put("app_store",JSONArray.parseArray(strategy.getAppStore()));
         }
 
         // 在本策略中,都是 OCPM 的出价方式
-        unitParams.put("cpa_bid",targetTemplate.getCpaBid());
-        unitParams.put("scene_id",JSONArray.parseArray(targetTemplate.getSceneId()));
+        unitParams.put("cpa_bid",strategy.getCpaBid());
+        unitParams.put("scene_id",JSONArray.parseArray(strategy.getSceneId()));
         unitParams.put("unit_type",4);
 
         // 格式为yyyy-MM-dd,需大于等于当前时间
         unitParams.put("begin_time",DateUtils.formatDate(new Date()));
 
-        JSONArray appIds = JSONArray.parseArray(targetTemplate.getAppIds());
+        JSONArray appIds = JSONArray.parseArray(strategy.getAppIds());
         if(null!=appIds&&!appIds.isEmpty()){
             unitParams.put("app_id",appIds.getLong(0));
         }
         unitParams.put("show_mode",2);
         unitParams.put("speed",1);
+        //是否开启智能抽帧
+        if(null!=strategy.getSmartCover()){
+            unitParams.put("smart_cover",strategy.getSmartCover());
+        }
+        //是否开启素材挖掘
+        if(null!=strategy.getAssetMining()){
+            unitParams.put("asset_mining",strategy.getAssetMining());
+        }
+
 
         // 设置定向内容
         JSONObject targetJsonObject = new JSONObject();
-        targetJsonObject.put("region",JSONArray.parseArray(targetTemplate.getRegion()));
-        targetJsonObject.put("ages_range",JSONArray.parseArray(targetTemplate.getAgesRange()));
-        targetJsonObject.put("gender",targetTemplate.getGender());
-        targetJsonObject.put("platform_os",targetTemplate.getPlatformOs());
-        JSONArray population = JSONArray.parseArray(targetTemplate.getPopulation());
-        if(null!=population&&!population.isEmpty()){
+        if(null!=strategy.getRegion()&&!"".equals(strategy.getRegion())){
+            targetJsonObject.put("region",JSONArray.parseArray(strategy.getRegion()));
+        }
+        if(null!=strategy.getAgesRange()&&!"".equals(strategy.getAgesRange())){
+            targetJsonObject.put("ages_range",JSONArray.parseArray(strategy.getAgesRange()));
+        }
+        if(null!=strategy.getGender()){
+            targetJsonObject.put("gender",strategy.getGender());
+        }
+        if(null!=strategy.getPlatformOs()){
+            targetJsonObject.put("platform_os",strategy.getPlatformOs());
+        }
+        if(null!=strategy.getAndroidOsv()){
+            targetJsonObject.put("android_osv",strategy.getAndroidOsv());
+        }
+        if(null!=strategy.getIosOsv()){
+            targetJsonObject.put("ios_osv",strategy.getIosOsv());
+        }
+        if(null!=strategy.getDeviceBrand()&&!"".equals(strategy.getDeviceBrand())&&!"[]".equals(strategy.getDeviceBrand())){
+            targetJsonObject.put("device_brand",JSONArray.parseArray(strategy.getDeviceBrand()));
+        }
+        if(null!=strategy.getDevicePrice()&&!"".equals(strategy.getDevicePrice())&&!"[]".equals(strategy.getDevicePrice())){
+            targetJsonObject.put("device_price",JSONArray.parseArray(strategy.getDevicePrice()));
+        }
+        if(null!=strategy.getPopulation()&&!"".equals(strategy.getPopulation())){
+            JSONArray population = JSONArray.parseArray(strategy.getPopulation());
             targetJsonObject.put("population",population);
         }
-        if(null!=targetTemplate.getFilterConvertedLevel()&&targetTemplate.getFilterConvertedLevel()!=0){
-            targetJsonObject.put("filter_converted_level",targetTemplate.getFilterConvertedLevel());
+        if(null!=strategy.getFilterConvertedLevel()&&strategy.getFilterConvertedLevel()!=0){
+            targetJsonObject.put("filter_converted_level",strategy.getFilterConvertedLevel());
         }
-        JSONArray excludePopulation = JSONArray.parseArray(targetTemplate.getExcludePopulation());
-        if(null!=excludePopulation&&!excludePopulation.isEmpty()){
+        if(null!=strategy.getExcludePopulation()&&!"".equals(strategy.getExcludePopulation())){
+            JSONArray excludePopulation = JSONArray.parseArray(strategy.getExcludePopulation());
             targetJsonObject.put("exclude_population",excludePopulation);
         }
+        //是否开启智能扩量
+        if(null!=strategy.getIsOpen()&&strategy.getIsOpen().equals(1)){
+            JSONObject intelliExtend = new JSONObject();
+            intelliExtend.put("is_open",1);
+            if(null!=strategy.getNoAgeBreak()&&strategy.getNoAgeBreak().equals(1)){
+                intelliExtend.put("no_age_break",1);
+            }
+            if(null!=strategy.getNoGenderBreak()&&strategy.getNoGenderBreak().equals(1)){
+                intelliExtend.put("no_gender_break",1);
+            }
+            if(null!=strategy.getNoAreaBreak()&&strategy.getNoAreaBreak().equals(1)){
+                intelliExtend.put("no_area_break",1);
+            }
+            targetJsonObject.put("intelli_extend",intelliExtend);
+        }
         unitParams.put("target",targetJsonObject);
         return unitParams;
     }
 
 
-    private void createCreativeByImage(List<MaterialCutFrame> cutFrameList, List<MaterialImageInfo> orgFrameList,
-                                       CtopOauthToken token, JSONObject creativeParams,
+    private void createCreativeByImage(List<MaterialCutFrame> cutFrameList, CtopOauthToken token, JSONObject creativeParams,
                                        Long campaignId, Long unitId, KuaiShouVideoGet videoItem,
                                        int imageNumber){
         int creativeCnt  = 1;
-        if (null!=orgFrameList&&!orgFrameList.isEmpty()) {
-            for (int i = 0; i < orgFrameList.size(); i++) {
-                String imageCode = orgFrameList.get(i).getCode();
-                String imageUrl = orgFrameList.get(i).getUrl();
-                String imageToken = getImageToken(imageUrl,imageCode,token.getAccountId(),token.getAccessToken());
-                creativeParams.put("image_token",imageToken);
-                createCreative(token, creativeParams, campaignId, unitId, creativeCnt,videoItem);
-                creativeCnt++;
-                if (creativeCnt > imageNumber) {
-                    break;
-                }
-            }
-        }
 
-        if ((null!=cutFrameList&&!cutFrameList.isEmpty()) && (creativeCnt<=15)){
+        if ((null!=cutFrameList&&!cutFrameList.isEmpty())){
             for (int i = 0; i < cutFrameList.size(); i++) {
                 String imageCode = cutFrameList.get(i).getSignature();
                 String imageUrl = cutFrameList.get(i).getUrl();

+ 2 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiStrategyServiceImpl.java

@@ -24,6 +24,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -56,7 +57,7 @@ public class AiStrategyServiceImpl implements IAiStrategyService {
     private IKuaiShouImageGetService imageGetService;
     @Autowired
     private IKuaiShouMaterialUploadService materialUploadService;
-    @Autowired
+    @Resource
     private KuaiShouVideoGetMapper videoGetMapper;
 
     /**

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

@@ -5,9 +5,9 @@ import cn.com.ctop.kuaishou.modules.ai.mapper.KuaiShouVideoLastTimeMapper;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaiShouVideoLastTimeService;
 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 javax.annotation.Resource;
 import java.util.List;
 
 /**
@@ -19,7 +19,7 @@ import java.util.List;
  */
 @Service
 public class KuaiShouVideoLastTimeServiceImpl extends ServiceImpl<KuaiShouVideoLastTimeMapper, KuaiShouVideoLastTime> implements IKuaiShouVideoLastTimeService {
-    @Autowired
+    @Resource
     private KuaiShouVideoLastTimeMapper videoLastTimeMapper;
 
     @Override

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/Enums/CampaignTypeEnum.java

@@ -20,7 +20,7 @@ public enum CampaignTypeEnum {
     public static String getNameByType(Integer type) {
         for (CampaignTypeEnum campaignType : CampaignTypeEnum.values()) {
 
-            if (campaignType.getType() == type) {
+            if (campaignType.getType().equals(type)) {
                 return campaignType.getValue();
             }
         }

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouBatchCampaignPreviewController.java

@@ -120,7 +120,7 @@ public class KuaishouBatchCampaignPreviewController {
     /**
      * 添加
      *
-     * @param kuaishouBatchCampaignPreview
+     * @param data
      * @return
      */
     @AutoLog(value = "添加预览数据")

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

@@ -40,4 +40,8 @@ public interface KuaiShouVideoGetMapper extends BaseMapper<KuaiShouVideoGet> {
     Integer getEffectiveCountByAccountId(Long accountId);
 
     Integer getHotMoneyCountByAccountId(Long accountId);
+
+    List<KuaiShouVideoGet> getZeroVideoByParams(@Param("accountId")Long accountId, @Param("startTime")String startTime, @Param("endTime")String endTime, @Param("videoCnt")Long videoCnt,@Param("appVersion")String appVersion,@Param("channelType")Integer channelType,@Param("relativeCnt")Integer relativeCnt);
+
+    List<KuaiShouVideoGet> getHistoryTopVideoByParams(@Param("accountId")Long accountId, @Param("startTime")String startTime, @Param("endTime")String endTime, @Param("videoCnt")Long videoCnt,@Param("appVersion")String appVersion,@Param("channelType")Integer channelType);
 }

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

@@ -202,6 +202,40 @@
         AND t2.effect_day_num &lt;= 7
 
     </select>
+    <select id="getZeroVideoByParams" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
+        select
+        video.*
+        from
+        ctop_kuaishou_video_get video left join ctop_kuaishou_video_relate_creatives creative on video.photo_id = creative.photo_id and video.account_id = creative.account_id
+        where
+              1=1
+        <if test="relativeCnt!=null">
+           and creative.creative_count &lt;= #{relativeCnt}
+        </if>
+
+        <if test="accountId!=null">
+            and video.account_id = #{accountId}
+        </if>
+        <if test="startTime!=null">
+            and video.stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime!=null">
+            and video.stat_date &lt;= #{endTime}
+        </if>
+        <if test="channelType != null and channelType != '' ">
+            and video.channel_type = #{channelType}
+        </if>
+        <if test="appVersion != null and appVersion != '' ">
+            and photo_name like concat(#{appVersion},'%')
+        </if>
+        and video.status = 0
+        group by video.signature
+        order by video.stat_date desc
+        <if test="videoCnt!=null">
+            limit #{videoCnt}
+        </if>
+    </select>
+
     <select id="getHotMoneyCountByAccountId" resultType="java.lang.Integer">
         SELECT
         count(1)
@@ -221,4 +255,37 @@
         t2.faddish_date is not null
         and faddish_day_num &lt;=14
     </select>
+    <select id="getHistoryTopVideoByParams"
+            resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
+        select
+            video.*
+        from
+            ctop_kuaishou_report_daily_material report
+        left join (select * from ctop_kuaishou_video_get
+                where
+                    status = 0
+                and signature is not null
+        <if test="accountId!=null">
+                 and account_id = #{accountId}
+        </if>
+        <if test="channelType!=null">
+            and channel_type = #{channelType}
+        </if>
+        <if test="startTime!=null">
+            and stat_date &gt;= #{startTime}
+        </if>
+        <if test="endTime!=null">
+            and stat_date &lt;= #{endTime}
+        </if>
+        group by signature) video
+                  on video.signature = report.signature
+        left join (SELECT id, photo_id from ctop_ai_creative_limit WHERE account_id = #{accountId}) t2
+            on video.photo_id = t2.photo_id
+            where video.id is not null
+            group by video.signature
+        order by sum(report.charge) desc
+        <if test="videoCnt!=null">
+            limit #{videoCnt}
+        </if>
+    </select>
 </mapper>

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

@@ -27,7 +27,7 @@ public interface IKuaiShouVideoGetService extends IService<KuaiShouVideoGet> {
 
     List<KuaiShouVideoGet> getNewVideoDescDate(Long accountId, Integer newVideoCnt);
 
-    List<KuaiShouVideoGet> getNewVideoBetweenTime(Long accountId, String startTime, String endTime);
+    List<KuaiShouVideoGet> getNewVideoBetweenTime(Long accountId, String startTime, String endTime,Integer channelType,String appVersion,Integer videoCnt);
 
     List<JSONObject> getVideoListByMap(Map<String, Object> requestMap);
 
@@ -48,4 +48,8 @@ public interface IKuaiShouVideoGetService extends IService<KuaiShouVideoGet> {
     Integer getEffectiveCountByAccountId(Long accountId);
 
     Integer getHotMoneyCountByAccountId(Long accountId);
+
+    List<KuaiShouVideoGet> getZeroVideoByParams(Long accountId, String startTime, String endTime, Long videoCnt,String appVersion,Integer channelType,Integer relativeCnt);
+
+    List<KuaiShouVideoGet> getHistoryTopVideoByParams(Long accountId, String startTime, String endTime, Long videoCnt, String appVersion, Integer channelType);
 }

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

@@ -193,6 +193,7 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
             return;
         }
         addGroupV2(accountId, details);
+        log.info("组数据入库成功=》id:{}",unitId);
     }
 
 

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

@@ -548,8 +548,6 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
             Map<String, String> headers = new HashMap<>();
             headers.put("Access-Token", accessToken);
             headers.put("Content-Type", "application/json");
-
-
             String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
             JSONObject resultJson = JSONObject.parseObject(result);
             if (!Check.isNull(resultJson)) {
@@ -579,8 +577,6 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
             returnJson.put("code", -1);
             returnJson.put("message", e.getMessage());
         }
-
-
         return returnJson;
     }
 
@@ -615,7 +611,6 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
                         } catch (InterruptedException e) {
                             e.printStackTrace();
                         }
-
                         returnJson.put("code", 0);
                     } else {
                         returnJson.put("code", -1);

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

@@ -151,8 +151,9 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
 
 
     @Override
-    public List<KuaiShouVideoGet> getNewVideoBetweenTime(Long accountId, String startTime, String endTime) {
+    public List<KuaiShouVideoGet> getNewVideoBetweenTime(Long accountId, String startTime, String endTime,Integer channelType,String appVersion,Integer videoCnt) {
         QueryWrapper<KuaiShouVideoGet> queryWrapper = new QueryWrapper<>();
+        queryWrapper.isNotNull("signature");
         if (null != accountId && accountId != 0) {
             queryWrapper.eq("account_id", accountId);
         }
@@ -160,6 +161,16 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
             queryWrapper.le("stat_date", endTime);
             queryWrapper.gt("stat_date", startTime);
         }
+        if(null!=channelType&&channelType!=2){
+            queryWrapper.eq("channel_type",channelType);
+        }
+
+        if(null!=appVersion&&!appVersion.trim().equals("")){
+            queryWrapper.likeLeft("photo_name",appVersion);
+        }
+        if(null!=videoCnt&&videoCnt!=0){
+            queryWrapper.last("limit "+videoCnt);
+        }
         return this.list(queryWrapper);
     }
 
@@ -174,12 +185,11 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
     }
 
     @Override
-    public KuaiShouVideoGet getVideoByPhotoId(Long photo_id) {
+    public KuaiShouVideoGet getVideoByPhotoId(Long photoId) {
         QueryWrapper<KuaiShouVideoGet> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("photo_id", photo_id);
+        queryWrapper.eq("photo_id", photoId);
         queryWrapper.last("limit 1");
-        KuaiShouVideoGet videoGet = videoGetMapper.selectOne(queryWrapper);
-        return videoGet;
+        return this.getOne(queryWrapper);
     }
 
     @Override
@@ -265,4 +275,14 @@ public class KuaiShouVideoGetServiceImpl extends ServiceImpl<KuaiShouVideoGetMap
     public Integer getHotMoneyCountByAccountId(Long accountId) {
         return videoGetMapper.getHotMoneyCountByAccountId(accountId);
     }
+
+    @Override
+    public List<KuaiShouVideoGet> getZeroVideoByParams(Long accountId, String startTime, String endTime, Long videoCnt,String appVersion,Integer channelType,Integer relativeCnt) {
+        return videoGetMapper.getZeroVideoByParams(accountId,startTime,endTime,videoCnt,appVersion,channelType,relativeCnt);
+    }
+
+    @Override
+    public List<KuaiShouVideoGet> getHistoryTopVideoByParams(Long accountId, String startTime, String endTime, Long videoCnt, String appVersion, Integer channelType) {
+        return videoGetMapper.getHistoryTopVideoByParams(accountId,startTime,endTime,videoCnt,appVersion,channelType);
+    }
 }

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

@@ -25,6 +25,7 @@ import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -41,19 +42,17 @@ import java.util.regex.Pattern;
  */
 @Service
 public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<KuaishouBatchCampaignPreviewMapper, KuaishouBatchCampaignPreview> implements IKuaishouBatchCampaignPreviewService {
-
-
-    @Autowired
+    @Resource
     KuaishouBatchCampaignPreviewMapper campaignPreviewMapper;
-    @Autowired
+    @Resource
     KuaishouBatchGroupPreviewMapper groupPreviewMapper;
-    @Autowired
+    @Resource
     KuaishouBatchCreativePreviewMapper creativePreviewMapper;
     @Autowired
     private IKuaishouTemplateService kuaishouTemplateService;
     @Autowired
     private IKuaiShouAppListService kuaiShouAppListService;
-    @Autowired
+    @Resource
     private KuaiShouCampaignMapper kuaiShouCampaignMapper;
 
     @Override

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

@@ -467,7 +467,7 @@ public class KuaishouCampaignCopyDataServiceImpl extends ServiceImpl<KuaishouCam
                 try {
                     log.info("开始多线程执行创建创意,accountId:{},新组:{},老组:{}", token.getAccountId(), unitId, copyUnitId);
                     kuaiShouGroupService.getCreativeByUnit(token.getAccessToken(), token.getAccountId(), copyUnitId);
-                    Thread.sleep(200l);
+                    Thread.sleep(200L);
                     batchService.copyCreative(token.getAccountId(), unitId, copyUnitId, null);
                 } catch (Exception e) {
                     e.printStackTrace();

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

@@ -122,6 +122,7 @@ public class KuaishouStrategyServiceImpl extends ServiceImpl<KuaishouStrategyMap
      * @throws
      * @author ZHAOXA
      */
+    @Override
     public Map<String, Object> createPlanLevelStrategy(CtopOauthToken oauthToken, JSONObject data) {
         JSONObject planJson = new JSONObject();
         /**计划类型

+ 2 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/EtlKuaishouVideoInfoServiceImpl.java

@@ -82,11 +82,8 @@ public class EtlKuaishouVideoInfoServiceImpl extends ServiceImpl<EtlKuaishouVide
                                 //根据id查询剪辑所属的设计负责人
                                 SysUser user = sysUserService.getById(clipId);
                                 if(null!=user){
-                                    SysUser designTeamLeader = sysUserService.getDesignerTeamLeaderBy(user.getOrgCode());
-                                    if(null!=designTeamLeader){
-                                        etlKuaishouVideoInfo.setDesignTeamLeaderId(designTeamLeader.getId());
-                                        etlKuaishouVideoInfo.setDesignTeamLeaderName(designTeamLeader.getRealname());
-                                    }
+                                    etlKuaishouVideoInfo.setDesignTeamLeaderId(user.getLeaderId());
+                                    etlKuaishouVideoInfo.setDesignTeamLeaderName(user.getLeaderName());
                                 }
                             }
                             String clipName = ascription.getString("clipName");

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

@@ -30,6 +30,7 @@ public class CtopAdlabProjectDetailServiceImpl extends ServiceImpl<CtopAdlabProj
     /**
      * 新建投放管家项目入库
      */
+    @Override
     public void putStorage(List<JSONObject> params){
         params.forEach(it->{
             JSONObject group = getProjectService.getGroup(ctopOauthTokenService.getTokenByAccountId(it.getLong("accountId")), it.getLong("accountId"), it.getLong("groupId"));

+ 6 - 6
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/utils/ApkUtils.java

@@ -128,13 +128,13 @@ public class ApkUtils {
         return (float) (complex & 0xFFFFFF00) * RADIX_MULTS[(complex >> 4) & 3];
     }
 
-    private static final float RADIX_MULTS[] =
+    private static final float[] RADIX_MULTS =
             {
                     0.00390625F, 3.051758E-005F,
                     1.192093E-007F, 4.656613E-010F
             };
-    private static final String DIMENSION_UNITS[] = { "px", "dip", "sp", "pt", "in", "mm", "", "" };
-    private static final String FRACTION_UNITS[] = { "%", "%p", "", "", "", "", "", "" };
+    private static final String[] DIMENSION_UNITS = { "px", "dip", "sp", "pt", "in", "mm", "", "" };
+    private static final String[] FRACTION_UNITS = { "%", "%p", "", "", "", "", "", "" };
 
     /**
      * 读取ipa
@@ -157,14 +157,14 @@ public class ApkUtils {
                     String name = ze.getName();
                     if (null != name &&
                             name.toLowerCase().contains(".app/info.plist")) {
-                        ByteArrayOutputStream _copy = new
+                        ByteArrayOutputStream copy = new
                                 ByteArrayOutputStream();
                         int chunk = 0;
                         byte[] data = new byte[1024];
                         while(-1!=(chunk=zipIns.read(data))){
-                            _copy.write(data, 0, chunk);
+                            copy.write(data, 0, chunk);
                         }
-                        infoIs = new ByteArrayInputStream(_copy.toByteArray());
+                        infoIs = new ByteArrayInputStream(copy.toByteArray());
                         rootDict = (NSDictionary) PropertyListParser.parse(infoIs);
 
                         //我们可以根据info.plist结构获取任意我们需要的东西