|
@@ -416,59 +416,65 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
if (Check.isNull(allVideos)) {
|
|
if (Check.isNull(allVideos)) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
|
|
|
|
|
|
+ List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 1);
|
|
for (int j = 1; j < splitVideos.size() + 1; j++) {
|
|
for (int j = 1; j < splitVideos.size() + 1; j++) {
|
|
- for (int i = 0; i < appIdArray.size(); i++) {
|
|
|
|
- Object redisObj = redisUtil.get(key);
|
|
|
|
- if (!Check.isNull(redisObj)) {
|
|
|
|
- Integer value = (Integer) redisObj;
|
|
|
|
- if (value == 1) {
|
|
|
|
- log.error("程序化创意创建超限,accountId:{}", strategy.getAccountId());
|
|
|
|
- return;
|
|
|
|
|
|
+ List<KuaiShouVideoGet> kuaiShouVideoGets = splitVideos.get(j);
|
|
|
|
+ if (Check.isNull(kuaiShouVideoGets)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ for (KuaiShouVideoGet videoGet : kuaiShouVideoGets) {
|
|
|
|
+ for (int i = 0; i < appIdArray.size(); i++) {
|
|
|
|
+ Object redisObj = redisUtil.get(key);
|
|
|
|
+ if (!Check.isNull(redisObj)) {
|
|
|
|
+ Integer value = (Integer) redisObj;
|
|
|
|
+ if (value == 1) {
|
|
|
|
+ log.error("程序化创意创建超限,accountId:{}", strategy.getAccountId());
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- Long appId = appIdArray.getLong(i);
|
|
|
|
- if (Check.isNull(appId)) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- KuaiShouAppMultipleBids multipleBids = kuaiShouAppMultipleBidsService.getInfoByAccountAndAppId(accountId, appId);
|
|
|
|
- if (Check.isNull(multipleBids)) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- if (!Check.isNull(multipleBids.getTrackUrl())) {
|
|
|
|
- strategy.setClickTrackUrl(multipleBids.getTrackUrl());
|
|
|
|
- }
|
|
|
|
- Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
|
|
|
|
- //创建组
|
|
|
|
- String unitName = getName(strategy.getGroupName(), strategy, createType, null, "unit", newCampaignId, appId);
|
|
|
|
- JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
|
|
|
|
- unitParams.remove("cpa_bid");
|
|
|
|
- unitParams.put("cpa_bid", multipleBids.getCpaBid());
|
|
|
|
- if (!Check.isNull(multipleBids.getDeepConversionBid())) {
|
|
|
|
- unitParams.remove("deep_conversion_bid");
|
|
|
|
- unitParams.put("deep_conversion_bid", multipleBids.getDeepConversionBid());
|
|
|
|
- }
|
|
|
|
- Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
|
|
- Integer unitCode = (Integer) unitCreateResult.get("code");
|
|
|
|
- String unitMessage = (String) unitCreateResult.get("message");
|
|
|
|
- AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
|
|
|
|
- BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
|
|
|
|
- unitLevelOperationRecord.setGroupName(unitName);
|
|
|
|
- unitLevelOperationRecord.setCreateTime(new Date());
|
|
|
|
- unitLevelOperationRecord.setStatus(unitCode);
|
|
|
|
- unitLevelOperationRecord.setMessage(unitMessage);
|
|
|
|
- unitLevelOperationRecord.setCampaignId(newCampaignId);
|
|
|
|
- unitLevelOperationRecord.setAiStrategyUuid(strategyUuid);
|
|
|
|
- if (unitCode != 0) {
|
|
|
|
- log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
|
|
|
|
|
|
+ Long appId = appIdArray.getLong(i);
|
|
|
|
+ if (Check.isNull(appId)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ KuaiShouAppMultipleBids multipleBids = kuaiShouAppMultipleBidsService.getInfoByAccountAndAppId(accountId, appId);
|
|
|
|
+ if (Check.isNull(multipleBids)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ if (!Check.isNull(multipleBids.getTrackUrl())) {
|
|
|
|
+ strategy.setClickTrackUrl(multipleBids.getTrackUrl());
|
|
|
|
+ }
|
|
|
|
+ Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
|
|
|
|
+ //创建组
|
|
|
|
+ String unitName = getName(strategy.getGroupName(), strategy, createType, videoGet.getPhotoName(), "unit", newCampaignId, appId);
|
|
|
|
+ JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
|
|
|
|
+ unitParams.remove("cpa_bid");
|
|
|
|
+ unitParams.put("cpa_bid", multipleBids.getCpaBid());
|
|
|
|
+ if (!Check.isNull(multipleBids.getDeepConversionBid())) {
|
|
|
|
+ unitParams.remove("deep_conversion_bid");
|
|
|
|
+ unitParams.put("deep_conversion_bid", multipleBids.getDeepConversionBid());
|
|
|
|
+ }
|
|
|
|
+ Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
|
|
+ Integer unitCode = (Integer) unitCreateResult.get("code");
|
|
|
|
+ String unitMessage = (String) unitCreateResult.get("message");
|
|
|
|
+ AiKuaishouUnitLevelOperationRecord unitLevelOperationRecord = new AiKuaishouUnitLevelOperationRecord();
|
|
|
|
+ BeanUtils.copyProperties(strategy, unitLevelOperationRecord);
|
|
|
|
+ unitLevelOperationRecord.setGroupName(unitName);
|
|
|
|
+ unitLevelOperationRecord.setCreateTime(new Date());
|
|
|
|
+ unitLevelOperationRecord.setStatus(unitCode);
|
|
|
|
+ unitLevelOperationRecord.setMessage(unitMessage);
|
|
|
|
+ unitLevelOperationRecord.setCampaignId(newCampaignId);
|
|
|
|
+ unitLevelOperationRecord.setAiStrategyUuid(strategyUuid);
|
|
|
|
+ if (unitCode != 0) {
|
|
|
|
+ log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
|
|
|
|
+ unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ Long unitId = (Long) unitCreateResult.get("unitId");
|
|
|
|
+ unitLevelOperationRecord.setUnitId(unitId);
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
- continue;
|
|
|
|
|
|
+ JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, null);
|
|
|
|
+ createProgramCreative(token, creativeParams, strategy);
|
|
}
|
|
}
|
|
- Long unitId = (Long) unitCreateResult.get("unitId");
|
|
|
|
- unitLevelOperationRecord.setUnitId(unitId);
|
|
|
|
- unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
|
|
- JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, null);
|
|
|
|
- createProgramCreative(token, creativeParams, strategy);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -530,6 +536,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
createProgramCreative(token, creativeParams, strategy);
|
|
createProgramCreative(token, creativeParams, strategy);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -1402,6 +1409,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
BeanUtils.copyProperties(strategy, record);
|
|
BeanUtils.copyProperties(strategy, record);
|
|
record.setCreativeName(creativeName);
|
|
record.setCreativeName(creativeName);
|
|
record.setStatus(creativeCode);
|
|
record.setStatus(creativeCode);
|
|
|
|
+ record.setDescription(creativeParams.getString("description"));
|
|
record.setMessage(creativeMessage);
|
|
record.setMessage(creativeMessage);
|
|
record.setUnitId(unitId);
|
|
record.setUnitId(unitId);
|
|
record.setAiStrategyUuid(uuid);
|
|
record.setAiStrategyUuid(uuid);
|