|
@@ -38,6 +38,7 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
|
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
|
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
|
import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel;
|
|
|
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelItems;
|
|
|
import cn.com.ctop.kuaishou.modules.channel.service.IKuaishouChannelService;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -289,11 +290,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
} else {
|
|
|
//单一应用
|
|
|
String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
|
|
|
- List<KuaiShouVideoGet> newVideos = getVideosByParams(strategy, startTime, endTime, null, createType, videoCnt);
|
|
|
- if (null == newVideos || newVideos.isEmpty()) {
|
|
|
- log.info("账户:{},{} 到 {} 未获取到相应素材({})", accountId, startTime, endTime, replaceString);
|
|
|
- return videoCnt;
|
|
|
- }
|
|
|
Long appId = null;
|
|
|
String appName = null;
|
|
|
if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
|
|
@@ -312,7 +308,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
KuaishouChannel channel = null;
|
|
|
if (!Check.isNull(useChannel) && useChannel == 1 && ("account".equals(level) || "plan".equals(level))) {
|
|
|
try {
|
|
|
- Result<Object> result = channelService.queryChannel(accountId, level, appName);
|
|
|
+ Result<Object> result = channelService.queryChannel(accountId, level, appName, null);
|
|
|
Integer code = result.getCode();
|
|
|
if (code == 200) {
|
|
|
channel = (KuaishouChannel) result.getResult();
|
|
@@ -334,6 +330,19 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
if (null == newCampaignId) {
|
|
|
return videoCnt;
|
|
|
}
|
|
|
+ channel = channelService.queryUsedChannel(accountId, newCampaignId, level);
|
|
|
+ if (Check.isNull(channel)) {
|
|
|
+ return videoCnt;
|
|
|
+ }
|
|
|
+ List<KuaishouChannelItems> items = channel.getItems();
|
|
|
+ if (!Check.isNull(items) && !items.isEmpty()) {
|
|
|
+ strategy.setMaterialKeyword(items.get(0).getKeyword());
|
|
|
+ }
|
|
|
+ List<KuaiShouVideoGet> newVideos = getVideosByParams(strategy, startTime, endTime, null, createType, videoCnt);
|
|
|
+ if (null == newVideos || newVideos.isEmpty()) {
|
|
|
+ log.info("账户:{},{} 到 {} 未获取到相应素材({})", accountId, startTime, endTime, replaceString);
|
|
|
+ return videoCnt;
|
|
|
+ }
|
|
|
//3、在“上新”计划中新增广告组,一个素材搭配n张封面,组成一个广告组
|
|
|
for (KuaiShouVideoGet videoItem : newVideos) {
|
|
|
Boolean unitOverrun = getUnitOverrun(accountId);
|
|
@@ -355,7 +364,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
//获取组级渠道号
|
|
|
if (!Check.isNull(useChannel) && useChannel == 1 && "group".equals(level)) {
|
|
|
try {
|
|
|
- Result<Object> result = channelService.queryChannel(accountId, level, appName);
|
|
|
+ Result<Object> result = channelService.queryChannel(accountId, level, appName, videoItem.getPhotoName());
|
|
|
Integer code = result.getCode();
|
|
|
if (code == 200) {
|
|
|
channel = (KuaishouChannel) result.getResult();
|
|
@@ -395,7 +404,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
|
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
|
if (!Check.isNull(channel)) {
|
|
|
- channelService.callBackUpdateChannelRel(level, channel.getChannelCode(), accountId, newCampaignId, null,0);
|
|
|
+ channelService.callBackUpdateChannelRel(level, channel.getChannelCode(), accountId, newCampaignId, null, 0);
|
|
|
}
|
|
|
continue;
|
|
|
}
|
|
@@ -404,7 +413,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
|
videoCnt--;
|
|
|
if (!Check.isNull(channel)) {
|
|
|
- channelService.callBackUpdateChannelRel(level, channel.getChannelCode(), accountId, newCampaignId, unitId,1);
|
|
|
+ channelService.callBackUpdateChannelRel(level, channel.getChannelCode(), accountId, newCampaignId, unitId, 1);
|
|
|
}
|
|
|
JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy, channel);//TODO 添加素材
|
|
|
createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, null);
|
|
@@ -624,10 +633,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
} else {
|
|
|
String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
|
|
|
//单一应用
|
|
|
- List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, null, createType, videoCnt);
|
|
|
- if (null == allVideos) {
|
|
|
- return;
|
|
|
- }
|
|
|
Long appId = null;
|
|
|
String appName = null;
|
|
|
String appIdString = strategy.getAppIdArray();
|
|
@@ -649,7 +654,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
KuaishouChannel channel = null;
|
|
|
if (!Check.isNull(useChannel) && useChannel == 1 && ("account".equals(level) || "plan".equals(level))) {
|
|
|
try {
|
|
|
- Result<Object> result = channelService.queryChannel(accountId, level, appName);
|
|
|
+ Result<Object> result = channelService.queryChannel(accountId, level, appName, null);
|
|
|
Integer code = result.getCode();
|
|
|
if (code == 200) {
|
|
|
channel = (KuaishouChannel) result.getResult();
|
|
@@ -671,6 +676,18 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
if (null == newCampaignId) {
|
|
|
return;
|
|
|
}
|
|
|
+ channel = channelService.queryUsedChannel(accountId, newCampaignId, level);
|
|
|
+ if (Check.isNull(channel)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<KuaishouChannelItems> items = channel.getItems();
|
|
|
+ if (!Check.isNull(items) && !items.isEmpty()) {
|
|
|
+ strategy.setMaterialKeyword(items.get(0).getKeyword());
|
|
|
+ }
|
|
|
+ List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, null, createType, videoCnt);
|
|
|
+ if (null == allVideos) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
//创意
|
|
|
List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
|
|
|
for (int j = 1; j < splitVideos.size() + 1; j++) {
|
|
@@ -691,7 +708,11 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
//获取组级渠道号
|
|
|
if (!Check.isNull(useChannel) && useChannel == 1 && "group".equals(level)) {
|
|
|
try {
|
|
|
- Result<Object> result = channelService.queryChannel(accountId, level, appName);
|
|
|
+ KuaiShouVideoGet videoGet = splitVideos.get(1).get(0);
|
|
|
+ if (Check.isNull(videoGet)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Result<Object> result = channelService.queryChannel(accountId, level, appName, videoGet.getPhotoName());
|
|
|
Integer code = result.getCode();
|
|
|
if (code == 200) {
|
|
|
channel = (KuaishouChannel) result.getResult();
|
|
@@ -733,7 +754,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
|
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
|
if (!Check.isNull(channel)) {
|
|
|
- channelService.callBackUpdateChannelRel(level, channel.getChannelCode(), accountId, newCampaignId, null,0);
|
|
|
+ channelService.callBackUpdateChannelRel(level, channel.getChannelCode(), accountId, newCampaignId, null, 0);
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -741,7 +762,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
unitLevelOperationRecord.setUnitId(unitId);
|
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
|
if (!Check.isNull(channel)) {
|
|
|
- channelService.callBackUpdateChannelRel(level, channel.getChannelCode(), accountId, newCampaignId, unitId,1);
|
|
|
+ channelService.callBackUpdateChannelRel(level, channel.getChannelCode(), accountId, newCampaignId, unitId, 1);
|
|
|
}
|
|
|
JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, null, channel);
|
|
|
createProgramCreative(token, creativeParams, strategy);
|