瀏覽代碼

修改广告计划创意成功的表中的日志,以及完善打印的内容

huangxuechao 4 年之前
父節點
當前提交
c5d5d828bb

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

@@ -328,13 +328,6 @@ public class MarketingServiceImpl implements MarketingService{
         Integer code = jsonObject.getInteger("code");
         if (null ==  code || !code.equals(0)) {
             log.error("广告计划创建失败==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
-            AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
-                    token.getAccountId(),
-                    "广告计划创建",
-                    code,
-                    "广告计划创建失败 => message:" + jsonObject.getString("message"),
-                    urlPath + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_create")+" => params:"+ params.toJSONString());
-            iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
             return Result.error(jsonObject.getString("message"));
         }
         //strategy.setId(jsonObject.getJSONObject("data").getLong("ad_id"));

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

@@ -126,7 +126,13 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
             return videoCnt;
         }
         log.info("获取{}素材个数:{}=>accountId:{}",BytedanceCreativeMatTypeEnum.getNameByType(createType+""),videoInfos.size(),token.getAccountId());
-
+        AiBytedanceAutocreateLog iBytedanceAutocreateLogofVideoInfo = new AiBytedanceAutocreateLog(
+                token.getAccountId(),
+                "获取素材",
+                200,
+                "获取"+BytedanceCreativeMatTypeEnum.getNameByType(createType+"")+"素材个数"+videoInfos.size(),
+                "");
+        iBytedanceAutocreateLogService.save(iBytedanceAutocreateLogofVideoInfo);
 
         for (ByteDanceVideoInfo video:videoInfos) {
             //判断此素材为视频
@@ -186,10 +192,10 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                         log.info("广告计划删除失败:message==>{}",resultDeletePlan.getMessage());
                         AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
                                 token.getAccountId(),
-                                "删除广告计划",
+                                "广告计划删除失败",
                                 resultDeletePlan.getCode(),
-                                "广告计划删除失败 => message:" + resultDeletePlan.getMessage(),
-                                "marketingService.updPlanStatus => token:"+ token.toString()+",adIds:"+adIds+",optstatus:delete");
+                                resultDeletePlan.getMessage(),
+                                "marketingService.updPlanStatus => token:"+ token.toString()+",adIds:"+adIds.toString()+",optstatus:delete");
                         iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
                     }
 
@@ -199,10 +205,10 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                     log.info("账户id:{};创意创建失败:code==>{};message==>{}",strategy.getAccountId(),code,message);
                     AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
                             strategy.getAccountId(),
-                            "创建创意",
+                            "创意创建失败",
                             code,
-                            "创意创建失败 => message:" + message,
-                            "marketingService.creativeCreate => token:"+ token.toString()+",adIds:"+adIds+",creativeParams:"+creativeParams.toJSONString());
+                            message,
+                            "marketingService.creativeCreate => token:"+ token.toString()+",adIds:"+adIds.toString()+",creativeParams:"+creativeParams.toJSONString());
                     iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
                     continue;
                 }
@@ -273,10 +279,10 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                         log.info("广告计划删除失败:message==>{}",resultDeletePlan.getMessage());
                         AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
                                 token.getAccountId(),
-                                "删除广告计划",
+                                "广告计划删除失败",
                                 resultDeletePlan.getCode(),
-                                "广告计划删除失败 => message:" + resultDeletePlan.getMessage(),
-                                "marketingService.updPlanStatus => token:"+ token.toString()+",adIds:"+adIds+",optstatus:delete");
+                                resultDeletePlan.getMessage(),
+                                "marketingService.updPlanStatus => token:"+ token.toString()+",adIds:"+adIds.toString()+",optstatus:delete");
                         iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
                     }
                     String message = creativeObject.getString("message");
@@ -285,10 +291,10 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                     log.info("账户id:{};创意创建失败:code==>{};message==>{}",strategy.getAccountId(),code,message);
                     AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
                             strategy.getAccountId(),
-                            "创建创意",
+                            "创意创建失败",
                             code,
-                            "创意创建失败 => message:" + message,
-                            "marketingService.creativeCreate => token:"+ token.toString()+",adIds:"+adIds+",creativeParams:"+creativeParams.toJSONString());
+                            message,
+                            "marketingService.creativeCreate => token:"+ token.toString()+",adIds:"+adIds.toString()+",creativeParams:"+creativeParams.toJSONString());
                     iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
                     continue;
                 }
@@ -588,7 +594,13 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         Result result = marketingService.createAdvertiserPlan(token,adParams,strategy);
         System.out.println(result);
         if(result.getCode()!=0){
-            //TODO 计划创建异常 后续需要加日志
+            AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
+                    strategy.getAccountId(),
+                    "计划创建异常",
+                    result.getCode(),
+                    result.getMessage(),
+                    adParams.toJSONString());
+            iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
             return null;
         }
         return (Long)result.getResult();
@@ -1066,7 +1078,13 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         //创建组
         Result campaignData = marketingService.createCampaign(token, campaignParam);
         if(campaignData.getCode()!=0){
-            //TODO 组创建异常 后续需要加日志
+            AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
+                    strategy.getAccountId(),
+                    "组创建异常",
+                    campaignData.getCode(),
+                    campaignData.getMessage(),
+                    campaignParam.toJSONString());
+            iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
             return null;
         }
         return (Long)campaignData.getResult();
@@ -1577,6 +1595,14 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                 log.info("{}计划创建不足,剩余需要创建个数{},使用历史打捞素材创建", strategy.getAccountId(), remindCnt);
                 this.createCreative(strategy, 4, remindCnt,openUrl);
             }
+            int newUnitCreateCnt = planService.queryToDayBuiltCount(strategy.getAccountId());
+            AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
+                    strategy.getAccountId(),
+                    "创建广告计划",
+                    200,
+                    "当前账户需要创建计划总数为"+unitNum+"个,截止目前有"+unitCreateCnt+"个,此次创建成功"+(newUnitCreateCnt - unitCreateCnt)+"个。",
+                    "aiBytedanceAdvertiserStrategyService.customCreativeSupplement => strategy:"+ strategy.toString()+",hour:"+hour);
+            iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
         }catch (Exception e){
             log.info(e.getMessage());
         }

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

@@ -66,8 +66,7 @@ public class AiBytedanceAdvertiserStrategyController {
 	private MarketingService marketingService;
 	@Autowired
 	private ICtopOauthTokenService tokenService;
-	@Autowired
-	IAiBytedanceAutocreateLogService iBytedanceAutocreateLogService;
+
 
 	/**
 	  * 分页列表查询
@@ -375,13 +374,6 @@ public class AiBytedanceAdvertiserStrategyController {
 		List<AiBytedanceAdvertiserStrategy> strategys = aiBytedanceAdvertiserStrategyService.getByAccountId(accountId,0);
 		strategys.forEach(strategy->{
 			aiBytedanceAdvertiserStrategyService.customCreativeSupplement(strategy, hour,strategy.getAdOpenUrl());
-			AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
-					strategy.getAccountId(),
-					"创意创建",
-					200,
-					"成功",
-					"aiBytedanceAdvertiserStrategyService.customCreativeSupplement => strategy:"+ strategy.toString()+",hour:"+hour);
-			iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
 		});
 		ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
 		return result;
@@ -399,13 +391,6 @@ public class AiBytedanceAdvertiserStrategyController {
 		}
 		strategys.forEach(strategy -> executorService.submit(()->{
 			aiBytedanceAdvertiserStrategyService.customCreativeSupplement(strategy, hour,strategy.getAdOpenUrl());
-			AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
-					strategy.getAccountId(),
-					"创意创建",
-					200,
-					"成功",
-					"aiBytedanceAdvertiserStrategyService.customCreativeSupplement => strategy:"+ strategy.toString()+",hour:"+hour);
-			iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
 		}));
 		ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
 		return result;