|
@@ -4,11 +4,15 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
|
import cn.com.ctop.common.module.entity.MaterialCutFrame;
|
|
|
import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
|
import cn.com.ctop.common.module.service.IMaterialCutFrameService;
|
|
|
-import cn.com.ctop.common.module.utils.*;
|
|
|
+import cn.com.ctop.common.module.utils.Check;
|
|
|
+import cn.com.ctop.common.module.utils.HttpUtils;
|
|
|
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
|
|
|
+import cn.com.ctop.common.module.utils.PropertiesUtils;
|
|
|
import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaiShouAppInfo;
|
|
|
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.enums.KuaishouCreativeCreateTypeEnum;
|
|
|
import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaiShouAppInfoService;
|
|
|
import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouCreateCreativeService;
|
|
|
import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouStrategyMapCreativeService;
|
|
@@ -85,7 +89,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
*
|
|
|
* @param strategy 账户配置信息
|
|
|
* @param createType 创意创建类型 1:素材上新 2:历史高质量 3:历史遗漏素材 4:历史打捞
|
|
|
- * @param videoCnt
|
|
|
+ * @param videoCnt 视频数量
|
|
|
*/
|
|
|
@Override
|
|
|
public Long autoCreateCreative(AiKuaishouAdvertiserStrategy strategy, Integer createType, Long videoCnt) {
|
|
@@ -373,19 +377,28 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void customCreativeSupplement(AiKuaishouAdvertiserStrategy strategy) throws ParseException {
|
|
|
- //获取当前小时数 ,计算截止当前应当创建的组数量
|
|
|
- Integer hour = DateUtils.getNowHour();
|
|
|
+ public void customCreativeSupplement(AiKuaishouAdvertiserStrategy strategy,Integer hour) throws ParseException {
|
|
|
Long unitNum = strategy.getCustomUnitCnt()/20*hour;
|
|
|
+ log.info("当前时间内需要创建组总数:{}",unitNum);
|
|
|
//查询当前账户创建自定义类型组数量
|
|
|
int unitCreateCnt = groupService.queryToDayBuiltCount(strategy.getAccountId());
|
|
|
+ log.info("截止目前创建组总数:{}",unitCreateCnt);
|
|
|
long remindCnt = unitNum-unitCreateCnt;
|
|
|
if(remindCnt>=1){
|
|
|
+ log.info("组创建不足,剩余需要创建个数{},使用历史遗漏素材创建",remindCnt);
|
|
|
//优先创建历史遗漏素材
|
|
|
remindCnt = this.autoCreateCreative(strategy,3,remindCnt);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ if(remindCnt>=1){
|
|
|
+ log.info("组创建不足,剩余需要创建个数{},使用高质量素材创建",remindCnt);
|
|
|
+ //高质量素材
|
|
|
+ remindCnt = this.autoCreateCreative(strategy,2,remindCnt);
|
|
|
+ }
|
|
|
+ if(remindCnt>=1){
|
|
|
+ //历史打捞素材
|
|
|
+ log.info("组创建不足,剩余需要创建个数{},使用历史打捞素材创建",remindCnt);
|
|
|
+ remindCnt = this.autoCreateCreative(strategy,4,remindCnt);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void createProgramCreative(CtopOauthToken token, JSONObject creativeParams) {
|
|
@@ -1040,4 +1053,42 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
mapCreative.setCreativeId(creativeId);
|
|
|
mapCreativeService.save(mapCreative);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param wildcard 计划名称
|
|
|
+ * @param strategy 账户id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy,Integer num) {
|
|
|
+ if(wildcard.contains("{{定向包}}")){
|
|
|
+ String targetName = "";
|
|
|
+ }
|
|
|
+ if(wildcard.contains("{{日期}}")){
|
|
|
+ String date = DateUtils.getNowDate("yyyyMMddHHmmss");
|
|
|
+ wildcard.replace("{{日期}}","-"+date+"-");
|
|
|
+ }
|
|
|
+ if(wildcard.contains("{{下标号}}")){
|
|
|
+ String numString = num.toString();
|
|
|
+ wildcard.replace("{{下标号}}","-"+numString+"-");
|
|
|
+ }
|
|
|
+ if(wildcard.contains("{{应用包名}}")){
|
|
|
+ String targetName = "";
|
|
|
+ }
|
|
|
+ if(wildcard.contains("{{创意制作方式}}")){
|
|
|
+ String creatype = KuaishouCreativeCreateTypeEnum.getNameByType(strategy.getOpenProgramCreate());
|
|
|
+ wildcard.replace("{{创意制作方式}}","-"+creatype+"-");
|
|
|
+ }
|
|
|
+ if(wildcard.contains("{{广告位置}}")){
|
|
|
+ String adsence = getAdSenceByParams(strategy.getSceneId());
|
|
|
+ }
|
|
|
+ if(wildcard.contains("{{自定义}}")){
|
|
|
+ String targetName = "";
|
|
|
+ }
|
|
|
+ return wildcard;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getAdSenceByParams(String sceneId) {
|
|
|
+ String adsence = "";
|
|
|
+ return adsence;
|
|
|
+ }
|
|
|
}
|