|
@@ -13,6 +13,7 @@ import org.jeecg.modules.bytedance.advertise.dockapi.MarketingService;
|
|
|
import org.jeecg.modules.bytedance.advertise.entity.*;
|
|
|
import org.jeecg.modules.bytedance.advertise.enums.BytedanceCreativeMatTypeEnum;
|
|
|
import org.jeecg.modules.bytedance.advertise.mapper.AiBytedanceAdvertiserStrategyMapper;
|
|
|
+import org.jeecg.modules.bytedance.advertise.mapper.ByteDanceGeneralCopywriterMapper;
|
|
|
import org.jeecg.modules.bytedance.advertise.mapper.BytedanceAreaInfoMapper;
|
|
|
import org.jeecg.modules.bytedance.advertise.mapper.RuleDataAccountMapper;
|
|
|
import org.jeecg.modules.bytedance.advertise.service.*;
|
|
@@ -73,7 +74,8 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
private IByteDanceVideoInfoService videoInfoService;
|
|
|
@Autowired
|
|
|
private MarketingService marketingService;
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ ByteDanceGeneralCopywriterMapper byteDanceGeneralCopywriterMapper;
|
|
|
@Override
|
|
|
public Long createCreative(AiBytedanceAdvertiserStrategy strategy, Integer createType, Long videoCnt, String openUrl) {
|
|
|
CtopOauthToken token = tokenService.getOauthTokenByAccountId(strategy.getAccountId()+"");
|
|
@@ -283,9 +285,25 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
imageArray.add(imageObject);
|
|
|
params.put("image_list",imageArray);
|
|
|
JSONArray titleArray = new JSONArray();
|
|
|
- List<BytedanceVideoSlogenInfo>slogenInfos = slogenInfoService.listByParams(videoInfo.getSignature(),1);
|
|
|
+ List<BytedanceVideoSlogenInfo> slogenInfos = slogenInfoService.listByParams(videoInfo.getSignature(),1);
|
|
|
if(!Check.isNull(slogenInfos)){
|
|
|
- slogenInfos.forEach(slogenInfo->{
|
|
|
+// slogenInfos.forEach(slogenInfo->{
|
|
|
+//// JSONObject titleObject = new JSONObject();
|
|
|
+//// titleObject.put("title",slogenInfo.getSlogan());
|
|
|
+//// String creativeWordsIds = slogenInfo.getCreativeWordIds();
|
|
|
+//// if(null!=creativeWordsIds&&!creativeWordsIds.trim().equals("")){
|
|
|
+//// JSONArray creativeWordsArray = JSON.parseArray(creativeWordsIds);
|
|
|
+//// if(null!=creativeWordsArray&&!creativeWordsArray.isEmpty()){
|
|
|
+//// titleObject.put("creative_word_ids",creativeWordsArray);
|
|
|
+//// }
|
|
|
+//// }
|
|
|
+//// titleArray.add(titleObject);
|
|
|
+//// });
|
|
|
+
|
|
|
+ for (BytedanceVideoSlogenInfo slogenInfo:slogenInfos) {
|
|
|
+ if(titleArray.size() >= 10){ //接口中是要求一个视频最多10个标题
|
|
|
+ break;
|
|
|
+ }
|
|
|
JSONObject titleObject = new JSONObject();
|
|
|
titleObject.put("title",slogenInfo.getSlogan());
|
|
|
String creativeWordsIds = slogenInfo.getCreativeWordIds();
|
|
@@ -296,7 +314,29 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
}
|
|
|
}
|
|
|
titleArray.add(titleObject);
|
|
|
- });
|
|
|
+ }
|
|
|
+ for(int i = 0; i < 3; i++){
|
|
|
+ if(titleArray.size() >= 10){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ QueryWrapper<ByteDanceGeneralCopywriter> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("account_id",strategy.getAccountId());
|
|
|
+ ByteDanceGeneralCopywriter byteDanceGeneralCopywriter = byteDanceGeneralCopywriterMapper.selectOne(queryWrapper);
|
|
|
+ if(!Check.isNull(byteDanceGeneralCopywriter)){
|
|
|
+ JSONObject titleObject = new JSONObject();
|
|
|
+ titleObject.put("title",byteDanceGeneralCopywriter.getTextCopywriter());
|
|
|
+ String creativeWordsIds = byteDanceGeneralCopywriter.getCreativeWordIds();
|
|
|
+ if(null!=creativeWordsIds&&!creativeWordsIds.trim().equals("")){
|
|
|
+ JSONArray creativeWordsArray = JSON.parseArray(creativeWordsIds);
|
|
|
+ if(null!=creativeWordsArray&&!creativeWordsArray.isEmpty()){
|
|
|
+ titleObject.put("creative_word_ids",creativeWordsArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ titleArray.add(titleObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
if(!Check.isNull(titleArray)){
|
|
|
params.put("title_list",titleArray);
|