|
@@ -78,6 +78,13 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
@Autowired
|
|
|
IAiBytedanceAutocreateLogService iBytedanceAutocreateLogService;
|
|
|
|
|
|
+ private synchronized AiBytedanceAdDplinkInfo getlatestDpLinkInfo(AiBytedanceAdvertiserStrategy strategy,int status){
|
|
|
+ return adDplinkInfoService.getlatestDpLinkInfo(strategy.getId(),strategy.getAccountId(),strategy.getCreativeImageMode(),status);
|
|
|
+ }
|
|
|
+
|
|
|
+ private synchronized void saveDpLink(AiBytedanceAdDplinkInfo dplinkInfo){
|
|
|
+ adDplinkInfoService.save(dplinkInfo);
|
|
|
+ }
|
|
|
@Override
|
|
|
public Long createCreative(CtopOauthToken token, AiBytedanceAdvertiserStrategy strategy, Integer createType, Long videoCnt, String openUrl) {
|
|
|
UserAllocation userAllocation = userAllocationService.getByAccountId(strategy.getAccountId());
|
|
@@ -133,7 +140,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
Integer useDplinkIndex = strategy.getDpLinkIndexUsed();
|
|
|
if(null==useDplinkIndex||useDplinkIndex.equals(0)){
|
|
|
//查看已使用的dp链接
|
|
|
- AiBytedanceAdDplinkInfo adDplinkInfo = adDplinkInfoService.getlatestDpLinkInfo(strategy.getId(),strategy.getAccountId(),strategy.getCreativeImageMode(),1);
|
|
|
+ AiBytedanceAdDplinkInfo adDplinkInfo = getlatestDpLinkInfo(strategy,1);
|
|
|
if(null == adDplinkInfo){
|
|
|
adDplinkInfo = new AiBytedanceAdDplinkInfo();
|
|
|
if("FIX".equalsIgnoreCase(strategy.getAdBidCreateType())){
|
|
@@ -206,7 +213,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
adDplinkInfo.setStatus(1);
|
|
|
adDplinkInfo.setStrategyId(strategy.getId());
|
|
|
adDplinkInfo.setImageMode(strategy.getCreativeImageMode());
|
|
|
- adDplinkInfoService.save(adDplinkInfo);
|
|
|
+ saveDpLink(adDplinkInfo);
|
|
|
|
|
|
BytedanceAiVideoCreativeLog creativeLog = new BytedanceAiVideoCreativeLog(strategy,adId,campaignId,video);
|
|
|
videoCreativeLogService.saveOrUpdate(creativeLog);
|
|
@@ -216,7 +223,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
}
|
|
|
}else{
|
|
|
Long dpIndex ;
|
|
|
- AiBytedanceAdDplinkInfo adDplinkInfo = adDplinkInfoService.getlatestDpLinkInfo(strategy.getId(),strategy.getAccountId(),strategy.getCreativeImageMode(),1);
|
|
|
+ AiBytedanceAdDplinkInfo adDplinkInfo = getlatestDpLinkInfo(strategy,1);
|
|
|
if(null == adDplinkInfo){
|
|
|
adDplinkInfo = new AiBytedanceAdDplinkInfo();
|
|
|
if("FIX".equalsIgnoreCase(strategy.getAdBidCreateType())){
|
|
@@ -255,10 +262,8 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
String dplinkCode = StringUtils.getParamFromUrl(strategy.getAdOpenUrl(),"bc_fl_src");
|
|
|
//计划名称
|
|
|
String adName = getAdName(strategy,dplinkCode,video,userAllocation.getProjectId());
|
|
|
- log.info("计划原名称=============>>>>>>>>>>{};长度为{}",adName,StringUtils.length(adName));
|
|
|
//截取 计划名称
|
|
|
adName = StringUtils.adNameSubMaterial(adName);
|
|
|
- log.info("计划截取后名称===========>>>>>>>>>>{};长度为{}",adName,StringUtils.length(adName));
|
|
|
//计算本次出价
|
|
|
BigDecimal currentCpaBid = StringUtils.getRandomAdCpaBid(strategy.getAdBidCreateType(),strategy.getAdMaxBid(),strategy.getAdMinBid(),strategy.getAdStepBid(),adDplinkInfo.getAdBid(),strategy.getAdCpaBid());
|
|
|
adDplinkInfo.setAdBid(currentCpaBid);
|
|
@@ -305,7 +310,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
adDplinkInfo.setStatus(1);
|
|
|
adDplinkInfo.setStrategyId(strategy.getId());
|
|
|
adDplinkInfo.setImageMode(strategy.getCreativeImageMode());
|
|
|
- adDplinkInfoService.save(adDplinkInfo);
|
|
|
+ saveDpLink(adDplinkInfo);
|
|
|
BytedanceAiVideoCreativeLog creativeLog = new BytedanceAiVideoCreativeLog(strategy,adId,campaignId,video);
|
|
|
videoCreativeLogService.saveOrUpdate(creativeLog);
|
|
|
videoCnt --;
|