|
@@ -123,35 +123,83 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
|
private IKuaiShouGroupService groupService;
|
|
|
static ExecutorService executorService = Executors.newFixedThreadPool(2);
|
|
|
|
|
|
+ /**
|
|
|
+ * 检查匹配
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void projectAutomaticCreates(KuaishouProjectStrategy strategy, Integer operationType) {
|
|
|
+ try {
|
|
|
+ Integer customUnitCnt = strategy.getCustomUnitCnt();
|
|
|
+ if (Check.isNull(customUnitCnt)) {
|
|
|
+ Integer imageCnt = strategy.getImageCnt();
|
|
|
+ if (imageCnt <= 5) {
|
|
|
+ customUnitCnt = 600;
|
|
|
+ } else {
|
|
|
+ customUnitCnt = 2000 / imageCnt;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //程序化组数 最大60
|
|
|
+ Integer programUnitCnt = strategy.getProgramUnitCnt();
|
|
|
+ if (Check.isNull(programUnitCnt)) {
|
|
|
+ Integer imageCnt = strategy.getImageCnt();
|
|
|
+ if (imageCnt <= 5) {
|
|
|
+ programUnitCnt = 60;
|
|
|
+ } else {
|
|
|
+ programUnitCnt = 300 / imageCnt;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //素材来源 1-上新素材,2-高质量素材,3-遗漏素材,4-历史打捞
|
|
|
+ List<Integer> sourceMaterial = JSONObject.parseObject(strategy.getSourceMaterial(), List.class);
|
|
|
+ //创意制作方式,0-不限,4-自定义,7-程序化创意
|
|
|
+ for (Integer createType : sourceMaterial) {
|
|
|
+ if (strategy.getUnitType() == 4) {
|
|
|
+ this.autoCreateCreative(strategy, createType, customUnitCnt, 1);
|
|
|
+ } else if (strategy.getUnitType() == 7) {
|
|
|
+ this.autoCreateProgramCreative(strategy, createType, programUnitCnt, 1);
|
|
|
+ } else {
|
|
|
+ this.autoCreateCreative(strategy, createType, customUnitCnt, 1);
|
|
|
+ this.autoCreateProgramCreative(strategy, createType, programUnitCnt, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("项目自动化创建异常", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 自定义补充
|
|
|
+ */
|
|
|
@Override
|
|
|
public void customCreativeSupplement(KuaishouProjectStrategy strategy, Integer hour) throws ParseException {
|
|
|
Integer customUnitCnt = strategy.getCustomUnitCnt();
|
|
|
if (Check.isNull(customUnitCnt)) {
|
|
|
Integer imageCnt = strategy.getImageCnt();
|
|
|
- if (imageCnt <= 1) {
|
|
|
+ if (imageCnt <= 5) {
|
|
|
customUnitCnt = 600;
|
|
|
} else {
|
|
|
customUnitCnt = 2000 / imageCnt;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
int unitNum = customUnitCnt * hour / 20;
|
|
|
log.info("{}当前时间内需要创建组总数:{}", strategy.getAccountId(), unitNum);
|
|
|
//查询当前账户创建自定义类型组数量
|
|
|
int unitCreateCnt = groupService.queryToDayBuiltCount(strategy.getAccountId());
|
|
|
log.info("{}截止目前创建组总数:{}", strategy.getAccountId(), unitCreateCnt);
|
|
|
int remindCnt = unitNum - unitCreateCnt;
|
|
|
- if (remindCnt >= 1) {
|
|
|
+ int concat = strategy.getSourceMaterial().contains("3") ? 3 : 0;
|
|
|
+ if (concat != 0 && remindCnt >= 1) {
|
|
|
log.info("{}组创建不足,剩余需要创建个数{},使用历史遗漏素材创建", strategy.getAccountId(), remindCnt);
|
|
|
//优先创建历史遗漏素材
|
|
|
remindCnt = this.autoCreateCreative(strategy, 3, remindCnt, 2);
|
|
|
}
|
|
|
- if (remindCnt >= 1) {
|
|
|
+ concat = strategy.getSourceMaterial().contains("2") ? 2 : 0;
|
|
|
+ if (concat != 0 && remindCnt >= 1) {
|
|
|
log.info("{}组创建不足,剩余需要创建个数{},使用高质量素材创建", strategy.getAccountId(), remindCnt);
|
|
|
//高质量素材
|
|
|
remindCnt = this.autoCreateCreative(strategy, 2, remindCnt, 2);
|
|
|
}
|
|
|
- if (remindCnt >= 1) {
|
|
|
+ concat = strategy.getSourceMaterial().contains("4") ? 4 : 0;
|
|
|
+ if (concat != 0 && remindCnt >= 1) {
|
|
|
//历史打捞素材
|
|
|
log.info("{}组创建不足,剩余需要创建个数{},使用历史打捞素材创建", strategy.getAccountId(), remindCnt);
|
|
|
this.autoCreateCreative(strategy, 4, remindCnt, 2);
|
|
@@ -159,51 +207,56 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 项目自动创建
|
|
|
- *
|
|
|
- * @return void
|
|
|
+ * 自定义上新
|
|
|
*/
|
|
|
@Override
|
|
|
- public void projectAutomaticCreates(KuaishouProjectStrategy strategy, Integer operationType) {
|
|
|
+ public void projectAutomaticCreates(KuaishouProjectStrategy strategy) {
|
|
|
try {
|
|
|
- //自定义组数,最多540
|
|
|
Integer customUnitCnt = strategy.getCustomUnitCnt();
|
|
|
if (Check.isNull(customUnitCnt)) {
|
|
|
Integer imageCnt = strategy.getImageCnt();
|
|
|
- if (imageCnt <= 1) {
|
|
|
+ if (imageCnt <= 5) {
|
|
|
customUnitCnt = 600;
|
|
|
} else {
|
|
|
customUnitCnt = 2000 / imageCnt;
|
|
|
}
|
|
|
}
|
|
|
- //程序化组数 最大60
|
|
|
- Integer programUnitCnt = strategy.getProgramUnitCnt();
|
|
|
+ log.info("{}可创建组总数:{}", strategy.getAccountId(), customUnitCnt);
|
|
|
+ //查询当前账户创建自定义类型组数量
|
|
|
+ int unitCreateCnt = groupService.queryToDayBuiltCount(strategy.getAccountId());
|
|
|
+ log.info("{}截止目前创建组总数:{}", strategy.getAccountId(), unitCreateCnt);
|
|
|
+ int remindCnt = customUnitCnt - unitCreateCnt;
|
|
|
+ if (remindCnt >= 1) {
|
|
|
+ this.autoCreateCreative(strategy, 1, remindCnt, 2);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("项目自动创建自定义上新异常", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 程序化上新
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void projectProgramAutomaticCreates(KuaishouProjectStrategy strategy,Integer type) {
|
|
|
+ try {
|
|
|
+ Integer programUnitCnt = strategy.getCustomUnitCnt();
|
|
|
if (Check.isNull(programUnitCnt)) {
|
|
|
Integer imageCnt = strategy.getImageCnt();
|
|
|
- if (imageCnt <= 1) {
|
|
|
+ if (imageCnt <= 5) {
|
|
|
programUnitCnt = 60;
|
|
|
} else {
|
|
|
programUnitCnt = 300 / imageCnt;
|
|
|
}
|
|
|
}
|
|
|
- //素材来源 1-上新素材,2-高质量素材,3-遗漏素材,4-历史打捞
|
|
|
- List<Integer> sourceMaterial = JSONObject.parseObject(strategy.getSourceMaterial(), List.class);
|
|
|
- //创意制作方式,0-不限,4-自定义,7-程序化创意
|
|
|
- for (Integer createType : sourceMaterial) {
|
|
|
- if (strategy.getUnitType() == 4) {
|
|
|
- this.autoCreateCreative(strategy, createType, customUnitCnt, operationType);
|
|
|
- } else if (strategy.getUnitType() == 7) {
|
|
|
- this.autoCreateProgramCreative(strategy, createType, programUnitCnt, operationType);
|
|
|
- } else {
|
|
|
- this.autoCreateCreative(strategy, createType, customUnitCnt, operationType);
|
|
|
- this.autoCreateProgramCreative(strategy, createType, programUnitCnt, operationType);
|
|
|
- }
|
|
|
- }
|
|
|
+ log.info("{}可创建组总数:{}", strategy.getAccountId(), programUnitCnt);
|
|
|
+ this.autoCreateCreative(strategy, type, programUnitCnt, 2);
|
|
|
} catch (Exception e) {
|
|
|
- log.error("项目自动化创建异常", e);
|
|
|
+ log.error("项目自动创建自定义上新异常", e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 创建自定义创意
|
|
|
*
|
|
@@ -1462,6 +1515,7 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 记录账户维度操作数据
|
|
|
*
|