Kaynağa Gözat

添加自动创建定时任务

songyh 4 yıl önce
ebeveyn
işleme
7a3994fea9

+ 0 - 1
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/dockapi/MarketingServiceImpl.java

@@ -277,7 +277,6 @@ public class MarketingServiceImpl implements MarketingService{
             return Result.error(message);
         }
         //广告组id
-        //TODO 广告组数据同步入库
         JSONArray ids = new JSONArray();
         ids.add(data.getJSONObject("data").getLong("campaign_id"));
         this.getCampaignGroupList(token,token.getAccountId().toString(),ids,1,10);

+ 3 - 4
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/IAiBytedanceAdvertiserStrategyService.java

@@ -17,9 +17,6 @@ import java.util.List;
  * @version V1.0
  */
 public interface IAiBytedanceAdvertiserStrategyService extends IService<AiBytedanceAdvertiserStrategy> {
-    //创建创意创建
-    Long createCreative(AiBytedanceAdvertiserStrategy strategy,Integer createType, Long videoCnt);
-
     /**
      * 修改 广告 组-计划-创意
      * @param strategy
@@ -30,6 +27,8 @@ public interface IAiBytedanceAdvertiserStrategyService extends IService<AiByteda
     Result updateADCreative(AiBytedanceAdvertiserStrategy strategy,String groupModifyTime,String planModifyTime);
 
 
+    Long createCreative(AiBytedanceAdvertiserStrategy strategy, Integer createType, Long videoCnt, String openUrl);
+
     /**
      * 头条 - 配置信息 修改 状态
      * @param
@@ -96,5 +95,5 @@ public interface IAiBytedanceAdvertiserStrategyService extends IService<AiByteda
 
     List<AiBytedanceAdvertiserStrategy> getByAccountId(Long accountId,Integer status);
 
-    void customCreativeSupplement(AiBytedanceAdvertiserStrategy strategy, Integer hour);
+    void customCreativeSupplement(AiBytedanceAdvertiserStrategy strategy, Integer hour,String openUrl);
 }

+ 7 - 6
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/AiBytedanceAdvertiserStrategyServiceImpl.java

@@ -67,7 +67,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
     private MarketingService marketingService;
 
     @Override
-    public Long createCreative(AiBytedanceAdvertiserStrategy strategy,Integer createType, Long videoCnt) {
+    public Long createCreative(AiBytedanceAdvertiserStrategy strategy,Integer createType, Long videoCnt,String openUrl) {
         CtopOauthToken token = tokenService.getOauthTokenByAccountId(strategy.getAccountId()+"");
         if (null == token) {
             log.info("token获取失败=>accountId:{}", token.getAccountId());
@@ -118,9 +118,10 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                 log.info("此账户策略创建结束=>账户id:{};策略id:{}", token.getAccountId(),strategy.getId());
                 return 0L;
             }
-            strategy.setAdOpenUrl(strategy.getAdOpenUrl().replace("{{dp链接下标}}",dpIndex.toString()));
+            strategy.setAdOpenUrl(openUrl.replace("{{dp链接下标}}",dpIndex.toString()));
             String dplinkCode = StringUtils.getParamFromUrl(strategy.getAdOpenUrl(),"bc_fl_src");
             String adName = getAdName(strategy,dplinkCode,video);
+            System.out.println(adName);
             JSONObject adParams = getAdParams(strategy,adName,campaignId);
             Long adId = createAdInfo(token,strategy,adParams);
             if(null == adId){
@@ -1170,7 +1171,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
     @Autowired
     private IByteDanceAdvertisePlanService planService;
     @Override
-    public void customCreativeSupplement(AiBytedanceAdvertiserStrategy strategy, Integer hour) {
+    public void customCreativeSupplement(AiBytedanceAdvertiserStrategy strategy, Integer hour,String openUrl) {
         Long customUnitCnt = strategy.getCampaignAdCnt()*strategy.getCampaignCnt();
         Long unitNum = customUnitCnt * hour / 15;
         log.info("{}当前时间内需要创建计划总数:{}", strategy.getAccountId(), unitNum);
@@ -1181,17 +1182,17 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         if (remindCnt >= 1) {
             log.info("{}计划创建不足,剩余需要创建个数{},使用历史遗漏素材创建", strategy.getAccountId(), remindCnt);
             //优先创建历史遗漏素材
-            remindCnt = this.createCreative(strategy, 3, remindCnt);
+            remindCnt = this.createCreative(strategy, 3, remindCnt,openUrl);
         }
         if (remindCnt >= 1) {
             log.info("{}计划创建不足,剩余需要创建个数{},使用高质量素材创建", strategy.getAccountId(), remindCnt);
             //高质量素材
-            remindCnt = this.createCreative(strategy, 2, remindCnt);
+            remindCnt = this.createCreative(strategy, 2, remindCnt,openUrl);
         }
         if (remindCnt >= 1) {
             //历史打捞素材
             log.info("{}计划创建不足,剩余需要创建个数{},使用历史打捞素材创建", strategy.getAccountId(), remindCnt);
-            this.createCreative(strategy, 4, remindCnt);
+            this.createCreative(strategy, 4, remindCnt,openUrl);
         }
     }
 }

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/bytedance/advertise/controller/AiBytedanceAdvertiserStrategyController.java

@@ -330,7 +330,7 @@ public class AiBytedanceAdvertiserStrategyController {
 			return result;
 		}
 		strategys.forEach(strategy -> {
-			aiBytedanceAdvertiserStrategyService.customCreativeSupplement(strategy, hour);
+			aiBytedanceAdvertiserStrategyService.customCreativeSupplement(strategy, hour,strategy.getAdOpenUrl());
 		});
 		ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
 		return result;

+ 3 - 3
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -131,9 +131,9 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://172.30.0.4:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
-          username: hcst
-          password: hcst@2020
+          url: jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+          username: data
+          password: hcst@2021
           driver-class-name: com.mysql.cj.jdbc.Driver
           # 多数据源配置
           #multi-datasource1: