|
@@ -78,20 +78,10 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
BytedanceMaterialRejectReasonMapper bytedanceMaterialRejectReasonMapper;
|
|
|
@Autowired
|
|
|
IAiBytedanceAutocreateLogService iBytedanceAutocreateLogService;
|
|
|
+
|
|
|
@Override
|
|
|
- public Long createCreative(AiBytedanceAdvertiserStrategy strategy, Integer createType, Long videoCnt, String openUrl) {
|
|
|
- CtopOauthToken token = tokenService.getOauthTokenByAccountId(strategy.getAccountId()+"");
|
|
|
- if (null == token) {
|
|
|
- log.info("token获取失败=>accountId:{}", strategy.getAccountId());
|
|
|
- AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
|
|
|
- strategy.getAccountId(),
|
|
|
- "获取token",
|
|
|
- 500,
|
|
|
- "token获取失败=>accountId:" + strategy.getAccountId(),
|
|
|
- "tokenService.getOauthTokenByAccountId => "+ strategy.getAccountId());
|
|
|
- iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
|
|
|
- return videoCnt;
|
|
|
- }
|
|
|
+ public Long createCreative(CtopOauthToken token, AiBytedanceAdvertiserStrategy strategy, Integer createType, Long videoCnt, String openUrl) {
|
|
|
+
|
|
|
|
|
|
UserAllocation userAllocation = userAllocationService.getByAccountId(strategy.getAccountId());
|
|
|
if(null == userAllocation||userAllocation.getAccountStatus()!=0){
|
|
@@ -246,6 +236,14 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
// 已使用dp链接 < 账户配置结束下标 || 已使用dp链接 > 结束下标
|
|
|
if( dpIndex < strategy.getDpLinkStartIndex() || dpIndex > strategy.getDpLinkEndIndex()){
|
|
|
log.info("此账户策略创建结束===已创建dp链接超过了限制===>账户id:{};策略id:{}", token.getAccountId(),strategy.getId());
|
|
|
+ AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
|
|
|
+ token.getAccountId(),
|
|
|
+ "策略创建结束",
|
|
|
+ 500,
|
|
|
+ "已创建dp链接超过了限制",
|
|
|
+ "token:"+ token.toString()+",策略id:"+strategy.getId()+
|
|
|
+ dpIndex+"<" + strategy.getDpLinkStartIndex() +"||" +dpIndex +">" + strategy.getDpLinkEndIndex());
|
|
|
+ iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
|
|
|
return 0L;
|
|
|
}
|
|
|
//组名称
|
|
@@ -308,6 +306,9 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
adDplinkInfoService.save(adDplinkInfo);
|
|
|
BytedanceAiVideoCreativeLog creativeLog = new BytedanceAiVideoCreativeLog(strategy,adId,campaignId,video);
|
|
|
videoCreativeLogService.saveOrUpdate(creativeLog);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
videoCnt --;
|
|
|
if(videoCnt<=0){
|
|
|
return 0L;
|
|
@@ -1553,9 +1554,24 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
|
|
|
@Autowired
|
|
|
private IByteDanceAdvertisePlanService planService;
|
|
|
+ @Autowired
|
|
|
+ private IByteDanceAdvertiserDataService advertiserDataService;
|
|
|
+
|
|
|
@Override
|
|
|
public void customCreativeSupplement(AiBytedanceAdvertiserStrategy strategy, Integer hour,String openUrl) {
|
|
|
try{
|
|
|
+ CtopOauthToken token = tokenService.getOauthTokenByAccountId(strategy.getAccountId()+"");
|
|
|
+ if (null == token) {
|
|
|
+ log.info("token获取失败=>accountId:{}", strategy.getAccountId());
|
|
|
+ AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
|
|
|
+ strategy.getAccountId(),
|
|
|
+ "获取token",
|
|
|
+ 500,
|
|
|
+ "token获取失败=>accountId:" + strategy.getAccountId(),
|
|
|
+ "tokenService.getOauthTokenByAccountId => "+ strategy.getAccountId());
|
|
|
+ iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
|
|
|
+ return;
|
|
|
+ }
|
|
|
Long customUnitCnt = strategy.getCampaignAdCnt()*strategy.getCampaignCnt();
|
|
|
Long unitNum = customUnitCnt * hour / 19;
|
|
|
log.info("{}当前时间内需要创建计划总数:{}", strategy.getAccountId(), unitNum);
|
|
@@ -1566,23 +1582,27 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
if (remindCnt >= 1) {
|
|
|
log.info("{}计划创建不足,剩余需要创建个数{},使用上新素材创建", strategy.getAccountId(), remindCnt);
|
|
|
//优先创建历史遗漏素材
|
|
|
- remindCnt = this.createCreative(strategy, 1, remindCnt,openUrl);
|
|
|
+ remindCnt = this.createCreative(token, strategy, 1, remindCnt,openUrl);
|
|
|
}
|
|
|
if (remindCnt >= 1) {
|
|
|
log.info("{}计划创建不足,剩余需要创建个数{},使用历史遗漏素材创建", strategy.getAccountId(), remindCnt);
|
|
|
//优先创建历史遗漏素材
|
|
|
- remindCnt = this.createCreative(strategy, 3, remindCnt,openUrl);
|
|
|
+ remindCnt = this.createCreative(token, strategy, 3, remindCnt,openUrl);
|
|
|
}
|
|
|
if (remindCnt >= 1) {
|
|
|
log.info("{}计划创建不足,剩余需要创建个数{},使用高质量素材创建", strategy.getAccountId(), remindCnt);
|
|
|
//高质量素材
|
|
|
- remindCnt = this.createCreative(strategy, 2, remindCnt,openUrl);
|
|
|
+ remindCnt = this.createCreative(token, strategy, 2, remindCnt,openUrl);
|
|
|
}
|
|
|
if (remindCnt >= 1) {
|
|
|
//历史打捞素材
|
|
|
log.info("{}计划创建不足,剩余需要创建个数{},使用历史打捞素材创建", strategy.getAccountId(), remindCnt);
|
|
|
- this.createCreative(strategy, 4, remindCnt,openUrl);
|
|
|
+ this.createCreative(token, strategy, 4, remindCnt,openUrl);
|
|
|
}
|
|
|
+ //获取最新的plan计划更新到表格
|
|
|
+ String nowDate = DateUtils.formatDate();
|
|
|
+ advertiserDataService.getAdvertiserPlan(token, "", nowDate, nowDate);
|
|
|
+
|
|
|
int newUnitCreateCnt = planService.queryToDayBuiltCount(strategy.getAccountId());
|
|
|
AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
|
|
|
strategy.getAccountId(),
|