|
@@ -10,6 +10,8 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
+import java.util.concurrent.Executors;
|
|
|
|
|
|
/**
|
|
|
* @author syh
|
|
@@ -21,6 +23,11 @@ public class KuaishouAiCreativeJob {
|
|
|
private IAiKuaishouAdvertiserStrategyService strategyService;
|
|
|
@Autowired
|
|
|
private IAiKuaishouCreateCreativeService createCreativeService;
|
|
|
+
|
|
|
+ static ExecutorService customCreativeAutoExecutorService = Executors.newFixedThreadPool(5);
|
|
|
+ static ExecutorService customCreativeSupplementExecutorService = Executors.newFixedThreadPool(5);
|
|
|
+ static ExecutorService programCreativeAutoExecutorService = Executors.newFixedThreadPool(5);
|
|
|
+ static ExecutorService programCreativeTopExecutorService = Executors.newFixedThreadPool(5);
|
|
|
/**
|
|
|
* 自定义上新创意
|
|
|
*/
|
|
@@ -30,11 +37,11 @@ public class KuaishouAiCreativeJob {
|
|
|
if(null==strategies||strategies.isEmpty()){
|
|
|
return;
|
|
|
}
|
|
|
- strategies.forEach(strategy -> {
|
|
|
+ strategies.forEach(strategy -> customCreativeAutoExecutorService.submit(()->{
|
|
|
if(null!=strategy.getOpenProgramCreate()&&strategy.getOpenProgramCreate()!=1){
|
|
|
createCreativeService.customCreativeLimit(strategy);
|
|
|
}
|
|
|
- });
|
|
|
+ }));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -48,7 +55,7 @@ public class KuaishouAiCreativeJob {
|
|
|
}
|
|
|
try {
|
|
|
int hour = DateUtils.getNowHour();
|
|
|
- strategies.forEach(strategy -> {
|
|
|
+ strategies.forEach(strategy -> customCreativeSupplementExecutorService.submit(()->{
|
|
|
if(null!=strategy.getOpenProgramCreate()&&strategy.getOpenProgramCreate()!=1){
|
|
|
try {
|
|
|
createCreativeService.customCreativeSupplement(strategy,hour);
|
|
@@ -56,11 +63,10 @@ public class KuaishouAiCreativeJob {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ }));
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -72,12 +78,12 @@ public class KuaishouAiCreativeJob {
|
|
|
if(null==strategies||strategies.isEmpty()){
|
|
|
return;
|
|
|
}
|
|
|
- strategies.forEach(strategy -> {
|
|
|
+ strategies.forEach(strategy -> programCreativeAutoExecutorService.submit(()->{
|
|
|
if(null!=strategy.getOpenProgramCreate()&&strategy.getOpenProgramCreate()!=0){
|
|
|
long videoCnt = strategy.getProgramUnitCnt()*5/2;
|
|
|
createCreativeService.autoCreateProgramCreative(strategy,1,videoCnt);
|
|
|
}
|
|
|
- });
|
|
|
+ }));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -89,11 +95,11 @@ public class KuaishouAiCreativeJob {
|
|
|
if(null==strategies||strategies.isEmpty()){
|
|
|
return;
|
|
|
}
|
|
|
- strategies.forEach(strategy -> {
|
|
|
+ strategies.forEach(strategy -> programCreativeTopExecutorService.submit(()->{
|
|
|
if(null!=strategy.getOpenProgramCreate()&&strategy.getOpenProgramCreate()!=0){
|
|
|
long videoCnt = strategy.getProgramUnitCnt()*5/2;
|
|
|
createCreativeService.autoCreateProgramCreative(strategy,2,videoCnt);
|
|
|
}
|
|
|
- });
|
|
|
+ }));
|
|
|
}
|
|
|
}
|