|
@@ -13,10 +13,12 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.moka.gdtauto.common.AutoPlanRule;
|
|
import com.moka.gdtauto.common.AutoPlanRule;
|
|
|
|
|
+import com.moka.gdtauto.entity.AccountGroup;
|
|
|
import com.moka.gdtauto.entity.AdAutoConf;
|
|
import com.moka.gdtauto.entity.AdAutoConf;
|
|
|
import com.moka.gdtauto.entity.AdAutoExecuteLog;
|
|
import com.moka.gdtauto.entity.AdAutoExecuteLog;
|
|
|
import com.moka.gdtauto.entity.AdPlanConf;
|
|
import com.moka.gdtauto.entity.AdPlanConf;
|
|
|
import com.moka.gdtauto.entity.AdPlanCreative;
|
|
import com.moka.gdtauto.entity.AdPlanCreative;
|
|
|
|
|
+import com.moka.gdtauto.util.RobotUtil;
|
|
|
import com.tencent.ads.model.v3.ConfiguredStatus;
|
|
import com.tencent.ads.model.v3.ConfiguredStatus;
|
|
|
|
|
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
@@ -38,6 +40,8 @@ public class AdPlanCreativeAutoExecutor {
|
|
|
private final AdPlanConfService adPlanConfService;
|
|
private final AdPlanConfService adPlanConfService;
|
|
|
private final AdPlanCreativeDailyReportService adPlanCreativeDailyReportService;
|
|
private final AdPlanCreativeDailyReportService adPlanCreativeDailyReportService;
|
|
|
private final AdPlanCreativeService adPlanCreativeService;
|
|
private final AdPlanCreativeService adPlanCreativeService;
|
|
|
|
|
+ private final AccountGroupService accountGroupService;
|
|
|
|
|
+ private final RobotUtil robotUtil;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 执行广告创意巡检
|
|
* 执行广告创意巡检
|
|
@@ -153,7 +157,7 @@ public class AdPlanCreativeAutoExecutor {
|
|
|
long adCount = 0;
|
|
long adCount = 0;
|
|
|
List<AdPlanCreative> creativesToSuspend = new ArrayList<>();
|
|
List<AdPlanCreative> creativesToSuspend = new ArrayList<>();
|
|
|
int pageNum = 1;
|
|
int pageNum = 1;
|
|
|
- int pageSize = 100;
|
|
|
|
|
|
|
+ int pageSize = 1000;
|
|
|
while (true) {
|
|
while (true) {
|
|
|
LambdaQueryWrapper<AdPlanCreative> queryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<AdPlanCreative> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(AdPlanCreative::getAdPlanConfId, confId)
|
|
queryWrapper.eq(AdPlanCreative::getAdPlanConfId, confId)
|
|
@@ -189,6 +193,18 @@ public class AdPlanCreativeAutoExecutor {
|
|
|
|
|
|
|
|
if (!creativesToSuspend.isEmpty()) {
|
|
if (!creativesToSuspend.isEmpty()) {
|
|
|
adPlanConfService.gdtSuspendByCreatives(adPlanConf, creativesToSuspend);
|
|
adPlanConfService.gdtSuspendByCreatives(adPlanConf, creativesToSuspend);
|
|
|
|
|
+ AccountGroup accountGroup = accountGroupService.getById(adPlanConf.getAccountGroupId());
|
|
|
|
|
+ // 发送webhook
|
|
|
|
|
+ String accountGroupName = accountGroup.getGroupName();
|
|
|
|
|
+ List<String> msgs = new ArrayList<>(creativesToSuspend.size());
|
|
|
|
|
+ String msgFormat = accountGroupName + "账户组下%d账户的%d创意 %s 已经被自动暂停链接如下: %s";
|
|
|
|
|
+ String urlFormat = "https://ad.qq.com/atlas/%d/admanage/index?tab=dynamic_creative&query={%%22operation_status%%22:[],%%22created_time%%22:%%22-89%%22,%%22fuzzy_name%%22:%%22%d%%22}";
|
|
|
|
|
+ for (AdPlanCreative creative : creativesToSuspend) {
|
|
|
|
|
+ String targetUrl = String.format(urlFormat, creative.getAccountId(), creative.getCreativeId());
|
|
|
|
|
+ String msg = String.format(msgFormat, creative.getAccountId(), creative.getCreativeId(), creative.getFailReason(), targetUrl);
|
|
|
|
|
+ msgs.add(msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ robotUtil.pushMsg(msgs);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
log.info("[AdPlanCreativeAutoExecutor] confId={} 巡检:广告数={}, 需暂停数={}", confId, adCount, creativesToSuspend.size());
|
|
log.info("[AdPlanCreativeAutoExecutor] confId={} 巡检:广告数={}, 需暂停数={}", confId, adCount, creativesToSuspend.size());
|