|
@@ -62,6 +62,8 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
@Autowired
|
|
@Autowired
|
|
private IBytedanceImageInfoService bytedanceImageInfoService;
|
|
private IBytedanceImageInfoService bytedanceImageInfoService;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private IBytedanceAiVideoCreativeLogService videoCreativeLogService;
|
|
|
|
+ @Autowired
|
|
private IMaterialInfoService materialInfoService;
|
|
private IMaterialInfoService materialInfoService;
|
|
@Autowired
|
|
@Autowired
|
|
private IByteDanceCampaignService campaignService;
|
|
private IByteDanceCampaignService campaignService;
|
|
@@ -91,11 +93,17 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
Long timeStart = BytedanceCreativeMatTypeEnum.getStartTimeByType(createType.toString());
|
|
Long timeStart = BytedanceCreativeMatTypeEnum.getStartTimeByType(createType.toString());
|
|
Long timeEnd = BytedanceCreativeMatTypeEnum.getEndTimeByType(createType.toString());
|
|
Long timeEnd = BytedanceCreativeMatTypeEnum.getEndTimeByType(createType.toString());
|
|
Long now = System.currentTimeMillis();
|
|
Long now = System.currentTimeMillis();
|
|
- String startTime = DateUtils.formatDateTime(now + timeStart * 60 * 1000L);
|
|
|
|
- String endTime = DateUtils.formatDateTime(now + timeEnd * 60 * 1000L);
|
|
|
|
|
|
+ String startTime = DateUtils.formatDate()+" 00:00:00";
|
|
|
|
+ String endTime = DateUtils.formatDate()+" 23:59:59";
|
|
|
|
+ if(timeStart != 0){
|
|
|
|
+ startTime = DateUtils.formatDateTime(now + timeStart * 60 * 1000L);
|
|
|
|
+ }
|
|
|
|
+ if(timeEnd != 0){
|
|
|
|
+ endTime = DateUtils.formatDateTime(now + timeEnd * 60 * 1000L);
|
|
|
|
+ }
|
|
List<ByteDanceVideoInfo> videoInfos = getVideoInfoByCreateType(userAllocation.getProjectId(),strategy,startTime,endTime,createType,videoCnt);
|
|
List<ByteDanceVideoInfo> videoInfos = getVideoInfoByCreateType(userAllocation.getProjectId(),strategy,startTime,endTime,createType,videoCnt);
|
|
if(null == videoInfos||videoInfos.isEmpty()){
|
|
if(null == videoInfos||videoInfos.isEmpty()){
|
|
- log.info("获取视频素材为空=>accountId:{}", token.getAccountId());
|
|
|
|
|
|
+ log.info("获取{}视频素材为空=>accountId:{}",BytedanceCreativeMatTypeEnum.getNameByType(createType+""),token.getAccountId());
|
|
return videoCnt;
|
|
return videoCnt;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -217,6 +225,8 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
log.info("创意创建失败:code==>{};message==>{}",code,message);
|
|
log.info("创意创建失败:code==>{};message==>{}",code,message);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ BytedanceAiVideoCreativeLog creativeLog = new BytedanceAiVideoCreativeLog(strategy,adId,campaignId,video);
|
|
|
|
+ videoCreativeLogService.saveOrUpdate(creativeLog);
|
|
videoCnt --;
|
|
videoCnt --;
|
|
if(videoCnt<=0){
|
|
if(videoCnt<=0){
|
|
return 0L;
|
|
return 0L;
|
|
@@ -224,7 +234,6 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return videoCnt;
|
|
return videoCnt;
|
|
-
|
|
|
|
}
|
|
}
|
|
private JSONObject getCreativeParams(AiBytedanceAdvertiserStrategy strategy, Long adId,ByteDanceVideoInfo videoInfo,CtopOauthToken token) {
|
|
private JSONObject getCreativeParams(AiBytedanceAdvertiserStrategy strategy, Long adId,ByteDanceVideoInfo videoInfo,CtopOauthToken token) {
|
|
JSONObject params = new JSONObject();
|
|
JSONObject params = new JSONObject();
|
|
@@ -447,7 +456,6 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
return info.getId();
|
|
return info.getId();
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
- //图片上传头条巨量后台
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private String getSuggestImageId(CtopOauthToken token, String vid) {
|
|
private String getSuggestImageId(CtopOauthToken token, String vid) {
|
|
@@ -855,8 +863,8 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
adName = adName.replace("{{dp链接标识}}",dplinkCode);
|
|
adName = adName.replace("{{dp链接标识}}",dplinkCode);
|
|
}
|
|
}
|
|
if(adName.contains("{{出价方式}}")){
|
|
if(adName.contains("{{出价方式}}")){
|
|
- String pricing = strategy.getAdPricing().replace("PRICING_","");
|
|
|
|
- adName = adName.replace("{{出价方式}}",pricing).toLowerCase(Locale.ROOT);
|
|
|
|
|
|
+ String pricing = strategy.getAdPricing().replace("PRICING_","").toLowerCase(Locale.ROOT);
|
|
|
|
+ adName = adName.replace("{{出价方式}}",pricing);
|
|
}
|
|
}
|
|
if(adName.contains("{{素材名称}}")){
|
|
if(adName.contains("{{素材名称}}")){
|
|
MaterialInfo info = materialInfoService.getParams(videoInfo.getSignature(),null);
|
|
MaterialInfo info = materialInfoService.getParams(videoInfo.getSignature(),null);
|
|
@@ -1263,6 +1271,11 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
log.info("{}截止目前创建组总数:{}", strategy.getAccountId(), unitCreateCnt);
|
|
log.info("{}截止目前创建组总数:{}", strategy.getAccountId(), unitCreateCnt);
|
|
long remindCnt = unitNum - unitCreateCnt;
|
|
long remindCnt = unitNum - unitCreateCnt;
|
|
if (remindCnt >= 1) {
|
|
if (remindCnt >= 1) {
|
|
|
|
+ log.info("{}计划创建不足,剩余需要创建个数{},使用上新素材创建", strategy.getAccountId(), remindCnt);
|
|
|
|
+ //优先创建历史遗漏素材
|
|
|
|
+ remindCnt = this.createCreative(strategy, 1, remindCnt,openUrl);
|
|
|
|
+ }
|
|
|
|
+ if (remindCnt >= 1) {
|
|
log.info("{}计划创建不足,剩余需要创建个数{},使用历史遗漏素材创建", strategy.getAccountId(), remindCnt);
|
|
log.info("{}计划创建不足,剩余需要创建个数{},使用历史遗漏素材创建", strategy.getAccountId(), remindCnt);
|
|
//优先创建历史遗漏素材
|
|
//优先创建历史遗漏素材
|
|
remindCnt = this.createCreative(strategy, 3, remindCnt,openUrl);
|
|
remindCnt = this.createCreative(strategy, 3, remindCnt,openUrl);
|