|
@@ -12,8 +12,12 @@ import cn.com.ctop.common.module.service.*;
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
|
|
import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
|
|
|
|
+import cn.com.ctop.toutiao.modules.material.entity.ByteDanceAdvertisePlan;
|
|
|
|
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertisePlanService;
|
|
import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
|
|
import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
|
|
|
|
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeService;
|
|
import cn.com.ctop.toutiao.modules.report.service.IReportService;
|
|
import cn.com.ctop.toutiao.modules.report.service.IReportService;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.jeecg.common.util.DateUtils;
|
|
import org.jeecg.common.util.DateUtils;
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
@@ -27,6 +31,7 @@ import java.io.File;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
import java.util.concurrent.CountDownLatch;
|
|
import java.util.concurrent.CountDownLatch;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.Executors;
|
|
@@ -49,6 +54,7 @@ public class SampleTest {
|
|
@Test
|
|
@Test
|
|
public void loadBytedanceCreativeData() {
|
|
public void loadBytedanceCreativeData() {
|
|
List<UserAllocation>allocations = userAllocationService.getByParams(633L,null,0);
|
|
List<UserAllocation>allocations = userAllocationService.getByParams(633L,null,0);
|
|
|
|
+
|
|
if(null!=allocations&&!allocations.isEmpty()){
|
|
if(null!=allocations&&!allocations.isEmpty()){
|
|
for (UserAllocation allocation:allocations) {
|
|
for (UserAllocation allocation:allocations) {
|
|
CtopOauthToken token = oauthTokenService.getTokenByAccountId(allocation.getAccountId());
|
|
CtopOauthToken token = oauthTokenService.getTokenByAccountId(allocation.getAccountId());
|
|
@@ -58,6 +64,93 @@ public class SampleTest {
|
|
}
|
|
}
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private IByteDanceAdvertisePlanService advertisePlanService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IByteDanceCreativeService creativeService;
|
|
|
|
+ @Test
|
|
|
|
+ public void checkBytedanceCreativeMonitorLink() {
|
|
|
|
+ UserAllocation allocation = allocationService.getByAccountId(1655865770409997L);
|
|
|
|
+// advertiserDataService.getAdvertiserPlan(token, "", null, null);
|
|
|
|
+ List<ByteDanceAdvertisePlan> plans = advertisePlanService.getAllPlans(allocation.getAccountId());
|
|
|
|
+ if(null!=plans&&!plans.isEmpty()){
|
|
|
|
+ for (ByteDanceAdvertisePlan plan:plans) {
|
|
|
|
+ Map<String, Object> creativeDetail = creativeService.getCreativeDetail(allocation.getAccountId(), plan.getId());
|
|
|
|
+ if(null!=creativeDetail.get("data")){
|
|
|
|
+ JSONObject data = (JSONObject) creativeDetail.get("data");
|
|
|
|
+ System.out.println(data.toJSONString());
|
|
|
|
+ checkMonitorLink(data,plan,allocation);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void checkMonitorLink(JSONObject data, ByteDanceAdvertisePlan plan, UserAllocation allocation) {
|
|
|
|
+ String downloadUrl = plan.getDownloadUrl();
|
|
|
|
+ boolean errorflag = false;
|
|
|
|
+ String errorMsg = "";
|
|
|
|
+ String token = plan.getName().split("-")[0];
|
|
|
|
+ String tokenInfo = "surl_token="+token;
|
|
|
|
+ String appType = plan.getAppType();
|
|
|
|
+
|
|
|
|
+ if(null!=downloadUrl){
|
|
|
|
+ if(null!=appType&&appType.equals("APP_IOS")){
|
|
|
|
+ if(!downloadUrl.equals("https://apps.apple.com/cn/app/id1468454200")){
|
|
|
|
+ errorMsg+= "应用下载链接填写异常;";
|
|
|
|
+ errorflag = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(null!=appType&&appType.equals("APP_ANDROID")){
|
|
|
|
+ if(!downloadUrl.contains(token)){
|
|
|
|
+ errorMsg+= "应用下载链接填写异常;";
|
|
|
|
+ errorflag = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //展示监测链接
|
|
|
|
+ String trackUrl = data.getString("trackUrl");
|
|
|
|
+ if(null!=trackUrl&&!trackUrl.trim().equals("")){
|
|
|
|
+ if(!trackUrl.contains(tokenInfo)){
|
|
|
|
+ errorMsg+= "展示监测链接填写异常;";
|
|
|
|
+ errorflag = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //点击监测链接
|
|
|
|
+ String actionTrackUrl = data.getString("actionTrackUrl");
|
|
|
|
+ if(null!=actionTrackUrl&&!actionTrackUrl.trim().equals("")){
|
|
|
|
+ if(null!=appType&&appType.equals("APP_IOS")){
|
|
|
|
+ if(!actionTrackUrl.contains(tokenInfo)||!actionTrackUrl.contains("app_platform=ios")){
|
|
|
|
+ errorMsg+= "点击监测链接填写异常;";
|
|
|
|
+ errorflag = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(null!=appType&&appType.equals("APP_ANDROID")){
|
|
|
|
+ if(!actionTrackUrl.contains(tokenInfo)||!actionTrackUrl.contains("tt/1967")){
|
|
|
|
+ errorMsg+= "点击监测链接填写异常;";
|
|
|
|
+ errorflag = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //视频有效播放监测链接
|
|
|
|
+ String videoPlayEffectiveTrackUrl = data.getString("videoPlayEffectiveTrackUrl");
|
|
|
|
+ if(null!=videoPlayEffectiveTrackUrl&&!videoPlayEffectiveTrackUrl.trim().equals("")){
|
|
|
|
+ if(!actionTrackUrl.contains(tokenInfo)){
|
|
|
|
+ errorMsg+= "视频有效播放监测链接填写异常;";
|
|
|
|
+ errorflag = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(errorflag){
|
|
|
|
+ sendMessage(allocation,"警告:账户:"+allocation.getAuthName()+"(id:"+allocation.getAccountId()+")下的广告计划:"+plan.getName()+"(id:"+plan.getId()+")"+"监测链接异常>>"+errorMsg);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISendMessageService sendMessageService;
|
|
|
|
+ private void sendMessage(UserAllocation allocation, String errorMsg) {
|
|
|
|
+ sendMessageService.sendMessage(allocation.getUserId(),errorMsg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
private IBindAccountLoginService bindAccountLoginService;
|
|
private IBindAccountLoginService bindAccountLoginService;
|
|
@Autowired
|
|
@Autowired
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|