|
@@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.jeecg.common.util.DateUtils;
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
|
+import org.jeecg.common.util.RedisUtil;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -126,8 +127,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
}
|
|
}
|
|
unitCnt++;
|
|
unitCnt++;
|
|
//开始创建组+创意
|
|
//开始创建组+创意
|
|
- String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
|
|
- String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, timestamp, unitCnt, videoItem.getPhotoName());
|
|
|
|
|
|
+ String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, videoItem.getPhotoName(), "unit", newCampaignId);
|
|
JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
|
|
JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
Integer unitCode = (Integer) unitCreateResult.get("code");
|
|
Integer unitCode = (Integer) unitCreateResult.get("code");
|
|
@@ -184,8 +184,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
unitCnt++;
|
|
unitCnt++;
|
|
- String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
|
|
- String unitName = getName(strategy.getGroupName(), strategy, createType, null, timestamp, unitCnt, videoItem.getPhotoName());
|
|
|
|
|
|
+ String unitName = getName(strategy.getGroupName(), strategy, createType, null, videoItem.getPhotoName(), "unit", newCampaignId);
|
|
|
|
|
|
Long appId = null;
|
|
Long appId = null;
|
|
if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
|
|
if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
|
|
@@ -300,8 +299,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
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++) {
|
|
//创建组
|
|
//创建组
|
|
- String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
|
|
- String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, timestamp, null, null);
|
|
|
|
|
|
+ String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, null, "unit", newCampaignId);
|
|
JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
|
|
JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
Integer unitCode = (Integer) unitCreateResult.get("code");
|
|
Integer unitCode = (Integer) unitCreateResult.get("code");
|
|
@@ -343,8 +341,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
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++) {
|
|
//创建组
|
|
//创建组
|
|
- String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
|
|
- String unitName = getName(strategy.getGroupName(), strategy, createType, null, timestamp, null, null);
|
|
|
|
|
|
+ String unitName = getName(strategy.getGroupName(), strategy, createType, null, null, "unit", newCampaignId);
|
|
String appIdString = strategy.getAppIdArray();
|
|
String appIdString = strategy.getAppIdArray();
|
|
Long appId = null;
|
|
Long appId = null;
|
|
if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
|
|
if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
|
|
@@ -402,11 +399,9 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
remindCnt = this.autoCreateCreative(strategy, 3, remindCnt);
|
|
remindCnt = this.autoCreateCreative(strategy, 3, remindCnt);
|
|
}
|
|
}
|
|
if (remindCnt >= 1) {
|
|
if (remindCnt >= 1) {
|
|
- if (strategy.getHistoryTop() == 0) {
|
|
|
|
- log.info("{}组创建不足,剩余需要创建个数{},使用高质量素材创建", strategy.getAccountId(), remindCnt);
|
|
|
|
- //高质量素材
|
|
|
|
- remindCnt = this.autoCreateCreative(strategy, 2, remindCnt);
|
|
|
|
- }
|
|
|
|
|
|
+ log.info("{}组创建不足,剩余需要创建个数{},使用高质量素材创建", strategy.getAccountId(), remindCnt);
|
|
|
|
+ //高质量素材
|
|
|
|
+ remindCnt = this.autoCreateCreative(strategy, 2, remindCnt);
|
|
}
|
|
}
|
|
if (remindCnt >= 1) {
|
|
if (remindCnt >= 1) {
|
|
//历史打捞素材
|
|
//历史打捞素材
|
|
@@ -621,23 +616,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
|
|
|
|
|
|
|
private Long getCampaignId(AiKuaishouAdvertiserStrategy strategy, CtopOauthToken token, String replaceString, String checkType, Integer createType, AiKuaiShouAppInfo appInfo, String uuid) {
|
|
private Long getCampaignId(AiKuaishouAdvertiserStrategy strategy, CtopOauthToken token, String replaceString, String checkType, Integer createType, AiKuaiShouAppInfo appInfo, String uuid) {
|
|
- // JSONArray campaignList;
|
|
|
|
- String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
|
|
- /*if ("ALL_CAMPAIGN".equals(checkType)) {
|
|
|
|
- campaignList = kuaishouInterfaceService.getCampaignList(token, null, null, 1);
|
|
|
|
- } else {
|
|
|
|
- timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
|
|
- campaignList = kuaishouInterfaceService.getCampaignList(token, new Date(), new Date(), 1);
|
|
|
|
- }*/
|
|
|
|
-
|
|
|
|
- /* if (!Check.isNull(campaignList)){
|
|
|
|
- for (int i = 0; i < campaignList.size(); i++) {
|
|
|
|
- JSONObject jsonObject = campaignList.getJSONObject(i);
|
|
|
|
- if (jsonObject.getString("campaign_name").contains(replaceString)) {
|
|
|
|
- return jsonObject.getLong("campaign_id");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }*/
|
|
|
|
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);
|
|
@@ -652,7 +630,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, appInfo, timestamp, null, null);
|
|
|
|
|
|
+ String campaignName = getName(strategy.getCampaignName(), strategy, createType, appInfo, null, "plan", null);
|
|
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) {
|
|
@@ -696,9 +674,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
unitParams.put("day_budget", 0);
|
|
unitParams.put("day_budget", 0);
|
|
}
|
|
}
|
|
//应用商店列表
|
|
//应用商店列表
|
|
-
|
|
|
|
unitParams.put("ocpx_action_type", strategy.getOcpxActionType());
|
|
unitParams.put("ocpx_action_type", strategy.getOcpxActionType());
|
|
-
|
|
|
|
//出价
|
|
//出价
|
|
if (null != strategy.getBid() && strategy.getBid() != 0) {
|
|
if (null != strategy.getBid() && strategy.getBid() != 0) {
|
|
unitParams.put("bid", strategy.getBid());
|
|
unitParams.put("bid", strategy.getBid());
|
|
@@ -726,7 +702,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
if (!Check.isNull(strategy.getDeepConversionBid())) {
|
|
if (!Check.isNull(strategy.getDeepConversionBid())) {
|
|
unitParams.put("deep_conversion_bid", strategy.getDeepConversionBid());
|
|
unitParams.put("deep_conversion_bid", strategy.getDeepConversionBid());
|
|
}
|
|
}
|
|
-
|
|
|
|
Integer sceneId = null;
|
|
Integer sceneId = null;
|
|
String scenceIdString = strategy.getSceneId();
|
|
String scenceIdString = strategy.getSceneId();
|
|
|
|
|
|
@@ -735,7 +710,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
sceneId = scenceArray.getInteger(0);
|
|
sceneId = scenceArray.getInteger(0);
|
|
unitParams.put("scene_id", scenceArray);
|
|
unitParams.put("scene_id", scenceArray);
|
|
}
|
|
}
|
|
-
|
|
|
|
Integer campaignType = strategy.getCampaignType();
|
|
Integer campaignType = strategy.getCampaignType();
|
|
if (campaignType == 2) { // 提升应用安装
|
|
if (campaignType == 2) { // 提升应用安装
|
|
//应用ID
|
|
//应用ID
|
|
@@ -758,11 +732,9 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
if (!Check.isNull(strategy.getUrlType())) {
|
|
if (!Check.isNull(strategy.getUrlType())) {
|
|
unitParams.put("url_type", strategy.getUrlType());
|
|
unitParams.put("url_type", strategy.getUrlType());
|
|
}
|
|
}
|
|
-
|
|
|
|
if (!Check.isNull(strategy.getUrl())) {
|
|
if (!Check.isNull(strategy.getUrl())) {
|
|
unitParams.put("url", strategy.getUrl());
|
|
unitParams.put("url", strategy.getUrl());
|
|
}
|
|
}
|
|
-
|
|
|
|
} else if (campaignType == 5) { //收集销售线索
|
|
} else if (campaignType == 5) { //收集销售线索
|
|
//url类型
|
|
//url类型
|
|
if (!Check.isNull(strategy.getWebUriType())) {
|
|
if (!Check.isNull(strategy.getWebUriType())) {
|
|
@@ -772,7 +744,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
if (!Check.isNull(strategy.getUrl())) {
|
|
if (!Check.isNull(strategy.getUrl())) {
|
|
unitParams.put("url", strategy.getUrl());
|
|
unitParams.put("url", strategy.getUrl());
|
|
}
|
|
}
|
|
-
|
|
|
|
} else if (campaignType == 7) { // 提高应用活跃
|
|
} else if (campaignType == 7) { // 提高应用活跃
|
|
// appId
|
|
// appId
|
|
if (!Check.isNull(appId)) {
|
|
if (!Check.isNull(appId)) {
|
|
@@ -788,7 +759,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
unitParams.put("schema_uri", strategy.getSchemaUri());
|
|
unitParams.put("schema_uri", strategy.getSchemaUri());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
//投放开始时间
|
|
//投放开始时间
|
|
if (!Check.isNull(strategy.getBeginTime())) {
|
|
if (!Check.isNull(strategy.getBeginTime())) {
|
|
unitParams.put("begin_time", strategy.getBeginTime());
|
|
unitParams.put("begin_time", strategy.getBeginTime());
|
|
@@ -807,8 +777,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
if (!Check.isNull(strategy.getConvertId())) {
|
|
if (!Check.isNull(strategy.getConvertId())) {
|
|
unitParams.put("convert_id", strategy.getConvertId());
|
|
unitParams.put("convert_id", strategy.getConvertId());
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
//创意展现方式
|
|
//创意展现方式
|
|
if (!Check.isNull(strategy.getShowMode())) {
|
|
if (!Check.isNull(strategy.getShowMode())) {
|
|
unitParams.put("show_mode", strategy.getShowMode());
|
|
unitParams.put("show_mode", strategy.getShowMode());
|
|
@@ -829,7 +797,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
if (!Check.isNull(strategy.getAutoCreatePhoto())) {
|
|
if (!Check.isNull(strategy.getAutoCreatePhoto())) {
|
|
unitParams.put("auto_create_photo", strategy.getAutoCreatePhoto());
|
|
unitParams.put("auto_create_photo", strategy.getAutoCreatePhoto());
|
|
}
|
|
}
|
|
-
|
|
|
|
if (unitType == 7) {
|
|
if (unitType == 7) {
|
|
//是否开启智能抽帧
|
|
//是否开启智能抽帧
|
|
if (!Check.isNull(strategy.getSmartCover())) {
|
|
if (!Check.isNull(strategy.getSmartCover())) {
|
|
@@ -859,8 +826,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
// 定向数据
|
|
// 定向数据
|
|
unitParams.put("target", target);
|
|
unitParams.put("target", target);
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
// 设置定向内容
|
|
// 设置定向内容
|
|
JSONObject targetJsonObject = new JSONObject();
|
|
JSONObject targetJsonObject = new JSONObject();
|
|
if (null != strategy.getRegion() && !"".equals(strategy.getRegion())) {
|
|
if (null != strategy.getRegion() && !"".equals(strategy.getRegion())) {
|
|
@@ -890,9 +855,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
if (null != strategy.getDevicePrice() && !"".equals(strategy.getDevicePrice()) && !"[]".equals(strategy.getDevicePrice())) {
|
|
if (null != strategy.getDevicePrice() && !"".equals(strategy.getDevicePrice()) && !"[]".equals(strategy.getDevicePrice())) {
|
|
targetJsonObject.put("device_price", JSON.parseArray(strategy.getDevicePrice()));
|
|
targetJsonObject.put("device_price", JSON.parseArray(strategy.getDevicePrice()));
|
|
}
|
|
}
|
|
-
|
|
|
|
- if (null != strategy.getFilterConvertedLevel() && strategy.getFilterConvertedLevel() != 0) {
|
|
|
|
- targetJsonObject.put("filter_converted_level", strategy.getFilterConvertedLevel());
|
|
|
|
|
|
+ if (sceneId != 5) {
|
|
|
|
+ if (null != strategy.getFilterConvertedLevel() && strategy.getFilterConvertedLevel() != 0) {
|
|
|
|
+ targetJsonObject.put("filter_converted_level", strategy.getFilterConvertedLevel());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
JSONArray appInterest = JSONArray.parseArray(strategy.getAppInterest());
|
|
JSONArray appInterest = JSONArray.parseArray(strategy.getAppInterest());
|
|
@@ -921,19 +887,21 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
}
|
|
}
|
|
|
|
|
|
//是否开启智能扩量
|
|
//是否开启智能扩量
|
|
- if (null != strategy.getIsOpen() && strategy.getIsOpen().equals(1)) {
|
|
|
|
- JSONObject intelliExtend = new JSONObject();
|
|
|
|
- intelliExtend.put("is_open", 1);
|
|
|
|
- if (null != strategy.getNoAgeBreak() && strategy.getNoAgeBreak().equals(1)) {
|
|
|
|
- intelliExtend.put("no_age_break", 1);
|
|
|
|
- }
|
|
|
|
- if (null != strategy.getNoGenderBreak() && strategy.getNoGenderBreak().equals(1)) {
|
|
|
|
- intelliExtend.put("no_gender_break", 1);
|
|
|
|
- }
|
|
|
|
- if (null != strategy.getNoAreaBreak() && strategy.getNoAreaBreak().equals(1)) {
|
|
|
|
- intelliExtend.put("no_area_break", 1);
|
|
|
|
|
|
+ if (sceneId != 5) {
|
|
|
|
+ if (null != strategy.getIsOpen() && strategy.getIsOpen().equals(1)) {
|
|
|
|
+ JSONObject intelliExtend = new JSONObject();
|
|
|
|
+ intelliExtend.put("is_open", 1);
|
|
|
|
+ if (null != strategy.getNoAgeBreak() && strategy.getNoAgeBreak().equals(1)) {
|
|
|
|
+ intelliExtend.put("no_age_break", 1);
|
|
|
|
+ }
|
|
|
|
+ if (null != strategy.getNoGenderBreak() && strategy.getNoGenderBreak().equals(1)) {
|
|
|
|
+ intelliExtend.put("no_gender_break", 1);
|
|
|
|
+ }
|
|
|
|
+ if (null != strategy.getNoAreaBreak() && strategy.getNoAreaBreak().equals(1)) {
|
|
|
|
+ intelliExtend.put("no_area_break", 1);
|
|
|
|
+ }
|
|
|
|
+ targetJsonObject.put("intelli_extend", intelliExtend);
|
|
}
|
|
}
|
|
- targetJsonObject.put("intelli_extend", intelliExtend);
|
|
|
|
}
|
|
}
|
|
unitParams.put("target", targetJsonObject);
|
|
unitParams.put("target", targetJsonObject);
|
|
log.info("广告组创建参数:{}", unitParams.toJSONString());
|
|
log.info("广告组创建参数:{}", unitParams.toJSONString());
|
|
@@ -1214,7 +1182,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
* @param strategy 账户id
|
|
* @param strategy 账户id
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy, Integer createType, AiKuaiShouAppInfo appInfo, String timestamp, Integer cnt, String materialName) {
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private RedisUtil redisUtil;
|
|
|
|
+
|
|
|
|
+ private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy, Integer createType, AiKuaiShouAppInfo appInfo, String materialName, String type, Long campaignId) {
|
|
if (wildcard.contains("{{应用包名}}")) {
|
|
if (wildcard.contains("{{应用包名}}")) {
|
|
String appName = "";
|
|
String appName = "";
|
|
if (null != appInfo) {
|
|
if (null != appInfo) {
|
|
@@ -1223,8 +1194,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
wildcard = wildcard.replace("{{应用包名}}", appName);
|
|
wildcard = wildcard.replace("{{应用包名}}", appName);
|
|
}
|
|
}
|
|
if (wildcard.contains("{{创意制作方式}}")) {
|
|
if (wildcard.contains("{{创意制作方式}}")) {
|
|
-// String creatype = KuaishouCreativeCreateTypeEnum.getNameByType(strategy.getOpenProgramCreate());
|
|
|
|
-// wildcard = wildcard.replace("{{创意制作方式}}",creatype);
|
|
|
|
if (strategy.getUnitType() == 4) {
|
|
if (strategy.getUnitType() == 4) {
|
|
wildcard = wildcard.replace("{{创意制作方式}}", "自定义");
|
|
wildcard = wildcard.replace("{{创意制作方式}}", "自定义");
|
|
} else if (strategy.getUnitType() == 7) {
|
|
} else if (strategy.getUnitType() == 7) {
|
|
@@ -1242,22 +1211,52 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
} else {
|
|
} else {
|
|
wildcard = wildcard.replace("{{素材名称}}", materialName);
|
|
wildcard = wildcard.replace("{{素材名称}}", materialName);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
if (!wildcard.contains("{{自定义}}")) {
|
|
if (!wildcard.contains("{{自定义}}")) {
|
|
wildcard = wildcard + "{{自定义}}";
|
|
wildcard = wildcard + "{{自定义}}";
|
|
}
|
|
}
|
|
|
|
+ Date date = new Date();
|
|
|
|
+ String nowDate = DateUtils.formatDate(date, "yy-MMdd");
|
|
|
|
+ if (type.equals("plan")) {
|
|
|
|
+ if (wildcard.contains("{{日期}}")) {
|
|
|
|
+ wildcard = wildcard.replace("{{日期}}", nowDate);
|
|
|
|
+ } else {
|
|
|
|
+ wildcard = wildcard + "-" + nowDate;
|
|
|
|
+ }
|
|
|
|
+ } else if ("unit".equals(type)) {
|
|
|
|
+ wildcard = wildcard.replace("{{日期}}", nowDate);
|
|
|
|
+ }
|
|
|
|
+
|
|
String targetName = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
|
|
String targetName = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
|
|
if (null != appInfo) {
|
|
if (null != appInfo) {
|
|
targetName = appInfo.getAppVersion() + "-" + targetName;
|
|
targetName = appInfo.getAppVersion() + "-" + targetName;
|
|
}
|
|
}
|
|
wildcard = wildcard.replace("{{自定义}}", targetName);
|
|
wildcard = wildcard.replace("{{自定义}}", targetName);
|
|
|
|
|
|
- if (null != timestamp && !"".equals(timestamp.trim())) {
|
|
|
|
- wildcard = wildcard + "-" + timestamp;
|
|
|
|
- }
|
|
|
|
- if (null != cnt) {
|
|
|
|
- wildcard = wildcard + "-" + cnt.toString();
|
|
|
|
|
|
+ if (!Check.isNull(campaignId)) {
|
|
|
|
+ Integer count = null;
|
|
|
|
+ if (null != strategy.getSingleAppid() && strategy.getSingleAppid() == 0) {
|
|
|
|
+ String redisKey = strategy.getAccountId() + "_" + campaignId;
|
|
|
|
+ Object redisValue = redisUtil.get(redisKey);
|
|
|
|
+ if (Check.isNull(redisValue)) {
|
|
|
|
+ count = 1;
|
|
|
|
+ redisUtil.set(redisKey, count);
|
|
|
|
+ } else {
|
|
|
|
+ count = (Integer) redisValue + 1;
|
|
|
|
+ redisUtil.set(redisKey, count);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ String redisKey = strategy.getAccountId() + "_" + campaignId + nowDate;
|
|
|
|
+ Object redisValue = redisUtil.get(redisKey);
|
|
|
|
+ if (Check.isNull(redisValue)) {
|
|
|
|
+ count = 1;
|
|
|
|
+ redisUtil.set(redisKey, count, 100000L);
|
|
|
|
+ } else {
|
|
|
|
+ count = (Integer) redisValue + 1;
|
|
|
|
+ redisUtil.set(redisKey, count, 100000L);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ wildcard = wildcard + "-" + count;
|
|
}
|
|
}
|
|
wildcard = wildcard.replace("--", "-");
|
|
wildcard = wildcard.replace("--", "-");
|
|
if (wildcard.startsWith("-")) {
|
|
if (wildcard.startsWith("-")) {
|
|
@@ -1283,4 +1282,14 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
}
|
|
}
|
|
return adsence.substring(0, adsence.length() - 1);
|
|
return adsence.substring(0, adsence.length() - 1);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
+ Date date = new Date();
|
|
|
|
+ String s = DateUtils.formatDate(date, "yy-MMdd");
|
|
|
|
+ String timestamp = DateUtils.formatDate(new Date(), "HHmmss");
|
|
|
|
+ System.err.println(timestamp);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|