|
@@ -150,7 +150,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
log.info("账户:{},{} 到 {} 未获取到相应素材({})", accountId, startTime, endTime, replaceString);
|
|
log.info("账户:{},{} 到 {} 未获取到相应素材({})", accountId, startTime, endTime, replaceString);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN", createType, appInfo.getAppId(), strategyUuid);
|
|
|
|
|
|
+ Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN", createType, appInfo.getAppId(), strategyUuid, null);
|
|
for (KuaiShouVideoGet videoItem : allVideos) {
|
|
for (KuaiShouVideoGet videoItem : allVideos) {
|
|
Boolean unitOverrun = getUnitOverrun(accountId);
|
|
Boolean unitOverrun = getUnitOverrun(accountId);
|
|
if (unitOverrun) {
|
|
if (unitOverrun) {
|
|
@@ -242,7 +242,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
log.info("该账户创意创建已超限=>accountId:{}", accountId);
|
|
log.info("该账户创意创建已超限=>accountId:{}", accountId);
|
|
return 0L;
|
|
return 0L;
|
|
}
|
|
}
|
|
- Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
|
|
|
|
|
|
+ Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid, null);
|
|
//开始创建组+创意
|
|
//开始创建组+创意
|
|
String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appId, null);
|
|
String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appId, null);
|
|
JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId, null);
|
|
JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId, null);
|
|
@@ -302,7 +302,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
return videoCnt;
|
|
return videoCnt;
|
|
}
|
|
}
|
|
KuaiShouAppList appInfo = appListService.getAppInfo(accountId, appId);
|
|
KuaiShouAppList appInfo = appListService.getAppInfo(accountId, appId);
|
|
- if(!Check.isNull(appInfo)){
|
|
|
|
|
|
+ if (!Check.isNull(appInfo)) {
|
|
appName = appInfo.getAppName();
|
|
appName = appInfo.getAppName();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -312,7 +312,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
KuaishouChannel channel = null;
|
|
KuaishouChannel channel = null;
|
|
if (!Check.isNull(useChannel) && useChannel == 1 && ("account".equals(level) || "plan".equals(level))) {
|
|
if (!Check.isNull(useChannel) && useChannel == 1 && ("account".equals(level) || "plan".equals(level))) {
|
|
try {
|
|
try {
|
|
- Result<Object> result = channelService.queryChannel(accountId, level,appName);
|
|
|
|
|
|
+ Result<Object> result = channelService.queryChannel(accountId, level, appName);
|
|
Integer code = result.getCode();
|
|
Integer code = result.getCode();
|
|
if (code == 200) {
|
|
if (code == 200) {
|
|
channel = (KuaishouChannel) result.getResult();
|
|
channel = (KuaishouChannel) result.getResult();
|
|
@@ -329,7 +329,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
|
|
|
|
|
|
+ Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid, channel);
|
|
if (null == newCampaignId) {
|
|
if (null == newCampaignId) {
|
|
return videoCnt;
|
|
return videoCnt;
|
|
}
|
|
}
|
|
@@ -355,7 +355,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
//获取组级渠道号
|
|
//获取组级渠道号
|
|
if (!Check.isNull(useChannel) && useChannel == 1 && "group".equals(level)) {
|
|
if (!Check.isNull(useChannel) && useChannel == 1 && "group".equals(level)) {
|
|
try {
|
|
try {
|
|
- Result<Object> result = channelService.queryChannel(accountId, level,appName);
|
|
|
|
|
|
+ Result<Object> result = channelService.queryChannel(accountId, level, appName);
|
|
Integer code = result.getCode();
|
|
Integer code = result.getCode();
|
|
if (code == 200) {
|
|
if (code == 200) {
|
|
channel = (KuaishouChannel) result.getResult();
|
|
channel = (KuaishouChannel) result.getResult();
|
|
@@ -490,7 +490,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
log.info("该账户创意创建已超限=>accountId:{}", accountId);
|
|
log.info("该账户创意创建已超限=>accountId:{}", accountId);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN", createType, appInfo.getAppId(), strategyUuid);
|
|
|
|
|
|
+ Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN", createType, appInfo.getAppId(), strategyUuid, null);
|
|
//创建组+创意
|
|
//创建组+创意
|
|
List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
|
|
List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
|
|
for (int j = 1; j < splitVideos.size() + 1; j++) {
|
|
for (int j = 1; j < splitVideos.size() + 1; j++) {
|
|
@@ -573,7 +573,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
if (!Check.isNull(multipleBids.getTrackUrl())) {
|
|
if (!Check.isNull(multipleBids.getTrackUrl())) {
|
|
strategy.setClickTrackUrl(multipleBids.getTrackUrl());
|
|
strategy.setClickTrackUrl(multipleBids.getTrackUrl());
|
|
}
|
|
}
|
|
- Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
|
|
|
|
|
|
+ Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid, null);
|
|
//创建组
|
|
//创建组
|
|
String unitName = getName(strategy.getGroupName(), strategy, createType, videoGet.getPhotoName(), "unit", newCampaignId, appId, null);
|
|
String unitName = getName(strategy.getGroupName(), strategy, createType, videoGet.getPhotoName(), "unit", newCampaignId, appId, null);
|
|
JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId, null);
|
|
JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId, null);
|
|
@@ -632,22 +632,18 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
KuaiShouAppList appInfo = appListService.getAppInfo(accountId, appId);
|
|
KuaiShouAppList appInfo = appListService.getAppInfo(accountId, appId);
|
|
- if(!Check.isNull(appInfo)){
|
|
|
|
|
|
+ if (!Check.isNull(appInfo)) {
|
|
appName = appInfo.getAppName();
|
|
appName = appInfo.getAppName();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
|
|
|
|
- if (null == newCampaignId) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
//渠道号应用层级,account-账户,plan-计划,group-组
|
|
//渠道号应用层级,account-账户,plan-计划,group-组
|
|
String level = strategy.getUsageLevel();
|
|
String level = strategy.getUsageLevel();
|
|
Integer useChannel = strategy.getUseChannel();//0不使用,1使用
|
|
Integer useChannel = strategy.getUseChannel();//0不使用,1使用
|
|
KuaishouChannel channel = null;
|
|
KuaishouChannel channel = null;
|
|
if (!Check.isNull(useChannel) && useChannel == 1 && ("account".equals(level) || "plan".equals(level))) {
|
|
if (!Check.isNull(useChannel) && useChannel == 1 && ("account".equals(level) || "plan".equals(level))) {
|
|
try {
|
|
try {
|
|
- Result<Object> result = channelService.queryChannel(accountId, level,appName);
|
|
|
|
|
|
+ Result<Object> result = channelService.queryChannel(accountId, level, appName);
|
|
Integer code = result.getCode();
|
|
Integer code = result.getCode();
|
|
if (code == 200) {
|
|
if (code == 200) {
|
|
channel = (KuaishouChannel) result.getResult();
|
|
channel = (KuaishouChannel) result.getResult();
|
|
@@ -664,7 +660,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid, channel);
|
|
|
|
+ if (null == newCampaignId) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
//创意
|
|
//创意
|
|
List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
|
|
List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
|
|
for (int j = 1; j < splitVideos.size() + 1; j++) {
|
|
for (int j = 1; j < splitVideos.size() + 1; j++) {
|
|
@@ -685,7 +684,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
//获取组级渠道号
|
|
//获取组级渠道号
|
|
if (!Check.isNull(useChannel) && useChannel == 1 && "group".equals(level)) {
|
|
if (!Check.isNull(useChannel) && useChannel == 1 && "group".equals(level)) {
|
|
try {
|
|
try {
|
|
- Result<Object> result = channelService.queryChannel(accountId, level,appName);
|
|
|
|
|
|
+ Result<Object> result = channelService.queryChannel(accountId, level, appName);
|
|
Integer code = result.getCode();
|
|
Integer code = result.getCode();
|
|
if (code == 200) {
|
|
if (code == 200) {
|
|
channel = (KuaishouChannel) result.getResult();
|
|
channel = (KuaishouChannel) result.getResult();
|
|
@@ -1045,7 +1044,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- private Long getCampaignId(AiKuaishouAdvertiserStrategy strategy, CtopOauthToken token, String replaceString, String checkType, Integer createType, Long appId, String uuid) {
|
|
|
|
|
|
+ private Long getCampaignId(AiKuaishouAdvertiserStrategy strategy, CtopOauthToken token, String replaceString, String checkType, Integer createType, Long appId, String uuid, KuaishouChannel channel) {
|
|
Long campaignId = null;
|
|
Long campaignId = null;
|
|
if ("ALL_CAMPAIGN".equals(checkType)) {
|
|
if ("ALL_CAMPAIGN".equals(checkType)) {
|
|
campaignId = campaignService.getCampaignIdByAccountAndName(strategy.getAccountId(), replaceString);
|
|
campaignId = campaignService.getCampaignIdByAccountAndName(strategy.getAccountId(), replaceString);
|
|
@@ -1060,7 +1059,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
// 不存在“上新”计划,则创建一个计划
|
|
// 不存在“上新”计划,则创建一个计划
|
|
JSONObject campaignParams = new JSONObject();
|
|
JSONObject campaignParams = new JSONObject();
|
|
campaignParams.put("advertiser_id", token.getAccountId());
|
|
campaignParams.put("advertiser_id", token.getAccountId());
|
|
- String campaignName = getName(strategy.getCampaignName(), strategy, createType, null, "plan", null, appId, null);
|
|
|
|
|
|
+ String campaignName = getName(strategy.getCampaignName(), strategy, createType, null, "plan", null, appId, channel);
|
|
campaignParams.put("campaign_name", campaignName);
|
|
campaignParams.put("campaign_name", campaignName);
|
|
campaignParams.put("type", strategy.getCampaignType());
|
|
campaignParams.put("type", strategy.getCampaignType());
|
|
if (null != strategy.getCampaignDayBudget() && strategy.getCampaignDayBudget() != 0) {
|
|
if (null != strategy.getCampaignDayBudget() && strategy.getCampaignDayBudget() != 0) {
|