ソースを参照

Merge branch 'master' into test

yangzian 3 年 前
コミット
30e7aa4461

+ 7 - 7
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/mapper/xml/ByteDanceVideoInfoMapper.xml

@@ -70,7 +70,7 @@
             resultType="org.jeecg.modules.bytedance.advertise.entity.ByteDanceVideoInfo">
         select distinct video.*,
         (select count(1) from ctop_bytedance_ai_video_creative_log l where l.video_code = video.signature and l.account_id = video.account_id and l.state_date = #{now}) as creativeNum,
-        (select count(1) from ctop_bytedance_creative c where c.video_id = video.vid and c.account_id = '${accountId}') as creativeCnt,
+        (select count(1) from ctop_bytedance_creative c where c.video_id = video.vid and c.account_id = #{accountId}) as creativeCnt,
         (select count(1) from ctop_bytedance_video_slogen_info s where s.video_code = video.signature) as slogens,
          'video' As materialType
         from ctop_bytedance_video_info video
@@ -94,18 +94,18 @@
         select distinct video.*,
         a.totalCost,
         (select count(1) from ctop_bytedance_ai_video_creative_log l where l.video_code = video.signature and l.account_id = video.account_id and l.state_date = #{now}) as creativeNum,
-        (select count(1) from ctop_bytedance_creative c where c.video_id = video.vid and c.account_id = '${accountId}') as creativeCnt,
+        (select count(1) from ctop_bytedance_creative c where c.video_id = video.vid and c.account_id = #{accountId}) as creativeCnt,
         (select count(1) from ctop_bytedance_video_slogen_info s where s.video_code = video.signature ) as slogens,
          'video' As materialType
         from (select report.material_id, sum(cost) as totalCost
         from ctop_bytedance_report_material_daily report
         left join ctop_user_allocation cua on report.account_id = cua.account_id
-        where cua.account_id = #{accountId}
+        where cua.account_id = '${accountId}'
         and report.stat_datetime >= #{startTime}
         and report.stat_datetime <= #{endTime}
         group by report.material_id
         order by sum(report.cost) desc ) a
-        left join (select distinct a.* from ctop_bytedance_video_info a where a.account_id = #{accountId} and a.type = #{imageMode} and a.status = 1)as video
+        left join (select distinct a.* from ctop_bytedance_video_info a where a.account_id = '${accountId}' and a.type = #{imageMode} and a.status = 1)as video
         on a.material_id = video.material_id
         left join ctop_material_info cmi on cmi.code = video.signature
         <if test="projectId !=null and projectId != ''">
@@ -126,18 +126,18 @@
         select distinct video.*,
                a.totalCost,
                (select count(1) from ctop_bytedance_ai_video_creative_log l where l.video_code = video.signature and l.account_id = video.account_id and l.state_date = #{now}) as creativeNum,
-               (select count(1) from ctop_bytedance_creative c where c.video_id = video.vid and c.account_id = '${accountId}') as creativeCnt,
+               (select count(1) from ctop_bytedance_creative c where c.video_id = video.vid and c.account_id = #{accountId}) as creativeCnt,
                (select count(1) from ctop_bytedance_video_slogen_info s where s.video_code = video.signature) as slogens,
                'video' As materialType
         from (select report.material_id, sum(cost) as totalCost
               from ctop_bytedance_report_material_daily report
                        left join ctop_user_allocation cua on report.account_id = cua.account_id
-              where cua.account_id = #{accountId}
+              where cua.account_id = '${accountId}'
                 and report.stat_datetime &gt;= #{startTime}
                 and report.stat_datetime &lt;= #{endTime}
               group by report.material_id
               order by sum(report.cost) desc ) a
-                 left join (select distinct a.* from ctop_bytedance_video_info a where a.account_id = #{accountId} and a.type = #{imageMode} and a.status = 1)as video
+                 left join (select distinct a.* from ctop_bytedance_video_info a where a.account_id = '${accountId}' and a.type = #{imageMode} and a.status = 1)as video
                            on a.material_id = video.material_id
                  left join ctop_material_info cmi on cmi.code = video.signature
         <if test="projectId !=null and projectId != ''">

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

@@ -158,9 +158,9 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
 
                 //3:创建创意
                 JSONObject creativeParams = getCreativeParams(strategy,adId,video,token);
-                log.info("账户id:{};创意创建参数:{}",strategy.getAccountId(),creativeParams);
+                log.info("账户id:{},不使用dp链接;创意创建参数:{}",strategy.getAccountId(),creativeParams);
                 JSONObject creativeObject =  marketingService.creativeCreate(token,adId,creativeParams);
-                log.info("创建创意=====》》》》》》{}",creativeObject);
+                log.info("账户id:{},不使用dp链接;创建返回数据=====》》》》》》{}",token.getAccountId(),creativeObject);
                 if(null!=creativeObject.getInteger("code")&&creativeObject.getInteger("code")!=0){
                     List<Long> adIds = new ArrayList<>();
                     adIds.add(adId);
@@ -174,7 +174,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                             "创意创建失败",
                             code,
                             message,
-                            "marketingService.creativeCreate => token:"+ token.toString()+",adIds:"+adIds.toString()+",creativeParams:"+creativeParams.toJSONString());
+                            "marketingService.creativeCreate => token:"+ token.toString()+",adIds:"+adIds.toString()+"strategy:"+strategy.getAccountId()+",creativeParams:"+creativeParams.toJSONString());
                     iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
                     continue;
                 }
@@ -238,9 +238,11 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                 }
                 //3:创建创意
                 JSONObject creativeParams = getCreativeParams(strategy,adId,video,token);
-                log.info("创意创建参数:{}",creativeParams);
+                log.info("账户id:{},使用dp链接;创意创建参数:{}",strategy.getAccountId(),creativeParams);
+
                 JSONObject creativeObject =  marketingService.creativeCreate(token,adId,creativeParams);
-                log.info("创意创建返回数据:{}",creativeObject);
+                log.info("账户id:{},不使用dp链接;创建返回数据=====》》》》》》{}",token.getAccountId(),creativeObject);
+
                 if(null!=creativeObject.getInteger("code")&&creativeObject.getInteger("code")!=0){
                     List<Long> adIds = new ArrayList<>();
                     adIds.add(adId);
@@ -254,7 +256,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                             "创意创建失败",
                             code,
                             message,
-                            "marketingService.creativeCreate => token:"+ token.toString()+",adIds:"+adIds.toString()+",creativeParams:"+creativeParams.toJSONString());
+                            "marketingService.creativeCreate => token:"+ token.toString()+",adIds:"+adIds.toString()+"strategy:"+strategy.getAccountId()+",creativeParams:"+creativeParams.toJSONString());
                     iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
                     continue;
                 }
@@ -279,7 +281,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
     // 创建创意  拼接创意参数 master
     private JSONObject getCreativeParams(AiBytedanceAdvertiserStrategy strategy, Long adId,ByteDanceVideoInfo videoInfo,CtopOauthToken token) {
         JSONObject params = new JSONObject();
-        params.put("advertiser_id", strategy.getAccountId());
+        params.put("advertiser_id", token.getAccountId());
         params.put("ad_id", adId);
 
         /*基础创意*/
@@ -552,7 +554,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
 
     private Long createAdInfo(CtopOauthToken token, AiBytedanceAdvertiserStrategy strategy, JSONObject adParams) {
         Result result = marketingService.createAdvertiserPlan(token,adParams,strategy);
-        System.out.println(result);
+        log.info("账户id{}=====创建计划{}===",token.getAccountId(),result);
         if(result.getCode()!=0){
             AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
                     strategy.getAccountId(),
@@ -1024,7 +1026,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
 
         if(adName.contains("{{素材名称}}")){
             if ("video".equals(videoInfo.getMaterialType())){
-                MaterialInfo info = materialInfoService.getParams(videoInfo.getSignature(),null,projectId);
+                MaterialInfo info = materialInfoService.getParams(videoInfo.getSignature(),null,null);
                 if(null!=info&&null!=info.getMaterialName()){
                     adName = adName.replace("{{素材名称}}","["+info.getMaterialName()+"]");
                 }
@@ -1088,7 +1090,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         campaignParam.put("campaign_type",strategy.getCampaignType());
         //创建组
         Result campaignData = marketingService.createCampaign(token, campaignParam);
-        log.info("===创建组==={}",campaignData);
+        log.info("账户id{}===创建组==={}",token.getAccountId(),campaignData);
         if(campaignData.getCode()!=0){
             AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
                     strategy.getAccountId(),