|
@@ -1,28 +1,15 @@
|
|
-/*
|
|
|
|
package cn.com.ctop.job.kuaishou.handler;
|
|
package cn.com.ctop.job.kuaishou.handler;
|
|
|
|
|
|
-import cn.com.ctop.common.module.utils.Check;
|
|
|
|
-import cn.com.ctop.common.module.utils.HttpUtils2;
|
|
|
|
-import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
|
|
|
|
|
|
+import cn.com.ctop.common.module.utils.HttpUtils;
|
|
import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
|
|
import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
-import org.jeecg.common.util.DateUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.text.ParseException;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
-import java.util.Map;
|
|
|
|
|
|
|
|
-*/
|
|
|
|
-/**
|
|
|
|
- * @author syh
|
|
|
|
- * 自动投放定时任务
|
|
|
|
- *//*
|
|
|
|
|
|
|
|
@Component
|
|
@Component
|
|
@Slf4j
|
|
@Slf4j
|
|
@@ -34,151 +21,66 @@ public class KuaishouAccountAutoCreativeJob {
|
|
@Autowired
|
|
@Autowired
|
|
private IAiKuaishouAdvertiserStrategyService strategyService;
|
|
private IAiKuaishouAdvertiserStrategyService strategyService;
|
|
|
|
|
|
- */
|
|
|
|
-/**
|
|
|
|
- * 自定义上新创意
|
|
|
|
- *//*
|
|
|
|
|
|
|
|
- @XxlJob("kuaishouCustomCreativeAuto")
|
|
|
|
- public void kuaishouCustomCreativeAuto() {
|
|
|
|
- List<AiKuaishouAdvertiserStrategy> strategies = strategyService.getAllEffectStrategy();
|
|
|
|
- if (null == strategies || strategies.isEmpty()) {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 创建自定义上新广告创意 、频率 20分钟/次
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ @XxlJob("autoCreateCustomUpNewCreative")
|
|
|
|
+ public void createCustomUpNewCreative() {
|
|
|
|
+ List<Long> ids = strategyService.getKuaishouAccountAutoStrategyIds();
|
|
|
|
+ if (null == ids || ids.isEmpty()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- String url = jobUrl + "/jeecg-boot/ai/create/customCreativeLimit";
|
|
|
|
- for (AiKuaishouAdvertiserStrategy strategy : strategies) {
|
|
|
|
- if (null != strategy.getOpenProgramCreate() && strategy.getOpenProgramCreate() != 1) {
|
|
|
|
- Map<String, Object> requestMap = new HashMap<>();
|
|
|
|
- requestMap.put("id", strategy.getId());
|
|
|
|
- String result = HttpUtils2.httpGet(url, requestMap, null);
|
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
|
- if (!Check.isNull(jsonObject)) {
|
|
|
|
- Integer code = jsonObject.getInteger("code");
|
|
|
|
- if (code == 0) {
|
|
|
|
- log.info("快手自动上新异步执行中,accountId:{}", strategy.getAccountId());
|
|
|
|
- } else {
|
|
|
|
- log.error("快手自动上新异执行失败,accountId:{}", strategy.getAccountId());
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- log.error("快手自动上新返回结果为空,accountId:{}", strategy.getAccountId());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ ids.forEach(id -> {
|
|
|
|
+ String url = jobUrl + "/jeecg-boot/auto/create/createCustomUpNewCreative?id=" + id;
|
|
|
|
+ HttpUtils.httpGet(url, null, null);
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
- */
|
|
|
|
-/**
|
|
|
|
- * 补充创意
|
|
|
|
- *//*
|
|
|
|
-
|
|
|
|
- @XxlJob("kuaishouCustomCreativeSupplement")
|
|
|
|
- public void kuaishouCustomCreativeSupplement() {
|
|
|
|
- List<AiKuaishouAdvertiserStrategy> strategies = strategyService.getAllEffectStrategy();
|
|
|
|
- if (null == strategies || strategies.isEmpty()) {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 创建自定义非上新广告创意 、频率 60分钟/次
|
|
|
|
+ */
|
|
|
|
+ @XxlJob("autoCreateCustomCreative")
|
|
|
|
+ public void createCustomCreative() {
|
|
|
|
+ List<Long> ids = strategyService.getKuaishouAccountAutoStrategyIds();
|
|
|
|
+ if (null == ids || ids.isEmpty()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- try {
|
|
|
|
- String url = jobUrl + "/jeecg-boot/ai/create/kuaishouCustomCreativeSupplement";
|
|
|
|
- int hour = DateUtils.getNowHour();
|
|
|
|
- for (AiKuaishouAdvertiserStrategy strategy : strategies) {
|
|
|
|
- if (null != strategy.getOpenProgramCreate() && strategy.getOpenProgramCreate() != 1) {
|
|
|
|
- Map<String, Object> requestMap = new HashMap<>();
|
|
|
|
- requestMap.put("id", strategy.getId());
|
|
|
|
- requestMap.put("hour", hour);
|
|
|
|
- String result = HttpUtils2.httpGet(url, requestMap, null);
|
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
|
- if (!Check.isNull(jsonObject)) {
|
|
|
|
- Integer code = jsonObject.getInteger("code");
|
|
|
|
- if (code == 0) {
|
|
|
|
- log.info("快手创意补充异步执行中,accountId:{}", strategy.getAccountId());
|
|
|
|
- } else {
|
|
|
|
- log.error("快手创意补充异步执行失败,accountId:{}", strategy.getAccountId());
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- log.error("快手创意补充返回结果为空,accountId:{}", strategy.getAccountId());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- } catch (ParseException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
|
|
+ ids.forEach(id -> {
|
|
|
|
+ String url = jobUrl + "/jeecg-boot/auto/create/createCustomCreative?id=" + id;
|
|
|
|
+ HttpUtils.httpGet(url, null, null);
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
- */
|
|
|
|
-/**
|
|
|
|
- * 程序化上新创意
|
|
|
|
- *//*
|
|
|
|
-
|
|
|
|
- @XxlJob("kuaishouProgramCreativeAuto")
|
|
|
|
- public void kuaishouProgramCreativeAuto() {
|
|
|
|
- List<AiKuaishouAdvertiserStrategy> strategies = strategyService.getAllEffectStrategy();
|
|
|
|
- if (null == strategies || strategies.isEmpty()) {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 创建程序化广告创意 频率 60分钟/次
|
|
|
|
+ */
|
|
|
|
+ @XxlJob("autoCreateProgramCreative")
|
|
|
|
+ public void createProgramCreative() {
|
|
|
|
+ List<Long> ids = strategyService.getKuaishouAccountAutoStrategyIds();
|
|
|
|
+ if (null == ids || ids.isEmpty()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- String url = jobUrl + "/jeecg-boot/ai/create/kuaishouProgramCreativeAuto";
|
|
|
|
- for (AiKuaishouAdvertiserStrategy strategy : strategies) {
|
|
|
|
- if (null != strategy.getOpenProgramCreate() && strategy.getOpenProgramCreate() != 0) {
|
|
|
|
- long videoCnt = strategy.getProgramUnitCnt() * 5 / 2;
|
|
|
|
- Map<String, Object> requestMap = new HashMap<>();
|
|
|
|
- requestMap.put("id", strategy.getId());
|
|
|
|
- requestMap.put("videoCnt", videoCnt);
|
|
|
|
- String result = HttpUtils2.httpGet(url, requestMap, null);
|
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
|
- if (!Check.isNull(jsonObject)) {
|
|
|
|
- Integer code = jsonObject.getInteger("code");
|
|
|
|
- if (code == 0) {
|
|
|
|
- log.info("快手上新程序化创意补充异步执行中,accountId:{}", strategy.getAccountId());
|
|
|
|
- } else {
|
|
|
|
- log.error("快手上新程序化异步执行失败,accountId:{}", strategy.getAccountId());
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- log.error("快手上新程序化充返回结果为空,accountId:{}", strategy.getAccountId());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ ids.forEach(id -> {
|
|
|
|
+ String url = jobUrl + "/jeecg-boot/auto/create/createProgramCreative?id=" + id;
|
|
|
|
+ HttpUtils.httpGet(url, null, null);
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
- */
|
|
|
|
-/**
|
|
|
|
- * 程序化高质量创意
|
|
|
|
- *//*
|
|
|
|
-
|
|
|
|
- @XxlJob("kuaishouProgramCreativeTop")
|
|
|
|
- public void kuaishouProgramCreativeTop() {
|
|
|
|
- List<AiKuaishouAdvertiserStrategy> strategies = strategyService.getAllEffectStrategy();
|
|
|
|
- if (null == strategies || strategies.isEmpty()) {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 每日补充创建创意 、频率 每天22点05分钟执行1次
|
|
|
|
+ */
|
|
|
|
+ @XxlJob("aotoSupplementCreatives")
|
|
|
|
+ public void aotoSupplementCreatives() {
|
|
|
|
+ List<Long> ids = strategyService.getKuaishouAccountAutoStrategyIds();
|
|
|
|
+ if (null == ids || ids.isEmpty()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- String url = jobUrl + "/jeecg-boot/ai/create/autoCreateProgramHistoryTopCreative";
|
|
|
|
- for (AiKuaishouAdvertiserStrategy strategy : strategies) {
|
|
|
|
- if (null != strategy.getOpenProgramCreate() && strategy.getOpenProgramCreate() != 0) {
|
|
|
|
- long videoCnt = strategy.getProgramUnitCnt() * 5 / 2;
|
|
|
|
- Map<String, Object> requestMap = new HashMap<>();
|
|
|
|
- requestMap.put("id", strategy.getId());
|
|
|
|
- requestMap.put("videoCnt", videoCnt);
|
|
|
|
- String result = HttpUtils2.httpGet(url, requestMap, null);
|
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
|
- if (!Check.isNull(jsonObject)) {
|
|
|
|
- Integer code = jsonObject.getInteger("code");
|
|
|
|
- if (code == 0) {
|
|
|
|
- log.info("快手历史高质量程序化创意补充异步执行中,accountId:{}", strategy.getAccountId());
|
|
|
|
- } else {
|
|
|
|
- log.error("快手历史高质量程序化异步执行失败,accountId:{}", strategy.getAccountId());
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- log.error("快手历史高质量程序化充返回结果为空,accountId:{}", strategy.getAccountId());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ ids.forEach(id -> {
|
|
|
|
+ String url = jobUrl + "/jeecg-boot/auto/create/supplementTodayCreatives?id=" + id;
|
|
|
|
+ HttpUtils.httpGet(url, null, null);
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
-*/
|
|
|