|
@@ -5,15 +5,20 @@ import cn.com.ctop.check.entity.CtopCheckTaskList;
|
|
import cn.com.ctop.check.service.ICtopCheckTaskListService;
|
|
import cn.com.ctop.check.service.ICtopCheckTaskListService;
|
|
import cn.com.ctop.common.module.entity.BindAccountLogin;
|
|
import cn.com.ctop.common.module.entity.BindAccountLogin;
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
-import cn.com.ctop.common.module.entity.UReportSubscriber;
|
|
|
|
import cn.com.ctop.common.module.entity.UserAllocation;
|
|
import cn.com.ctop.common.module.entity.UserAllocation;
|
|
import cn.com.ctop.common.module.message.handle.impl.EmailSendMsgHandle;
|
|
import cn.com.ctop.common.module.message.handle.impl.EmailSendMsgHandle;
|
|
import cn.com.ctop.common.module.service.*;
|
|
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.crawler.modules.core.service.IKuaishouCrawlerService;
|
|
|
|
+import cn.com.ctop.crawler.modules.music.service.IMusicKuaishouTypeService;
|
|
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;
|
|
@@ -23,10 +28,10 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|
import org.springframework.test.context.ActiveProfiles;
|
|
import org.springframework.test.context.ActiveProfiles;
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
-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;
|
|
@@ -56,11 +61,93 @@ public class SampleTest {
|
|
// advertiserDataService.getAdvertiserPlan(token, "", null, null);
|
|
// advertiserDataService.getAdvertiserPlan(token, "", null, null);
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
- CtopOauthToken token = oauthTokenService.getTokenByAccountId(1667284088260616L);
|
|
|
|
- advertiserDataService.getAdvertiserPlan(token, "", null, null);
|
|
|
|
|
|
+ UserAllocation allocation = userAllocationService.getByAccountId(1648083559613447L);
|
|
|
|
+ CtopOauthToken token = oauthTokenService.getTokenByAccountId(1648083559613447L);
|
|
|
|
+// advertiserDataService.getAdvertiserPlan(token, "", null, null);
|
|
|
|
+ List<ByteDanceAdvertisePlan> plans = advertisePlanService.getAllPlans(token.getAccountId(),DateUtils.formatDate(new Date()));
|
|
|
|
+ if(null!=plans&&!plans.isEmpty()){
|
|
|
|
+ for (ByteDanceAdvertisePlan plan:plans) {
|
|
|
|
+ Map<String, Object> creativeDetail = creativeService.getCreativeDetail(token.getAccountId(), plan.getId());
|
|
|
|
+ if(null!=creativeDetail.get("data")){
|
|
|
|
+ JSONObject data = (JSONObject) creativeDetail.get("data");
|
|
|
|
+ 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(!videoPlayEffectiveTrackUrl.contains(tokenInfo)){
|
|
|
|
+ errorMsg+= "视频有效播放监测链接填写异常;";
|
|
|
|
+ errorflag = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(errorflag){
|
|
|
|
+ sendMessage(allocation,"警告:账户:"+allocation.getAuthName()+"(id:"+allocation.getAccountId()+")下的广告计划:"+plan.getName()+"(id:"+plan.getId()+")"+"监测链接异常>>"+errorMsg);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ private void sendMessage(UserAllocation allocation, String errorMsg) {
|
|
|
|
+ sendMessageService.sendMessage(allocation.getUserId(),errorMsg);
|
|
}
|
|
}
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private IUserAllocationService allocationService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IByteDanceAdvertisePlanService advertisePlanService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IByteDanceCreativeService creativeService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISendMessageService sendMessageService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
private IBindAccountLoginService bindAccountLoginService;
|
|
private IBindAccountLoginService bindAccountLoginService;
|
|
@Autowired
|
|
@Autowired
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
@@ -112,9 +199,6 @@ public class SampleTest {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private IUserAllocationService allocationService;
|
|
|
|
-
|
|
|
|
@Test
|
|
@Test
|
|
public void testLoadBytedanceData() {
|
|
public void testLoadBytedanceData() {
|
|
List<UserAllocation> allocations = allocationService.getByParams(435L, null, 0);
|
|
List<UserAllocation> allocations = allocationService.getByParams(435L, null, 0);
|
|
@@ -172,28 +256,25 @@ public class SampleTest {
|
|
@Autowired
|
|
@Autowired
|
|
IUReportService uReportService;
|
|
IUReportService uReportService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IKuaishouCrawlerService crawlerService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IMusicKuaishouTypeService musicKuaishouTypeService;
|
|
@Test
|
|
@Test
|
|
- public void sendUReport() {
|
|
|
|
- uReportService.uReportList().forEach(uReport -> {
|
|
|
|
- List<UReportSubscriber> uReportSubscriber = uReportService.getUReportSubscriberByFileId(uReport.getString("id"));
|
|
|
|
- if (!uReportSubscriber.isEmpty()) {
|
|
|
|
- String title = uReport.getString("name").replace(".ureport.xml", "");
|
|
|
|
- String content = "您订阅的日报在附件中请注意查收》》》";
|
|
|
|
- //下载文件到本地
|
|
|
|
- uReportExportService.exportExcel(uReport.getString("name"));
|
|
|
|
- uReportSubscriber.forEach(sender -> {
|
|
|
|
- emailSendMsgHandle.SendAttachment("bijiequan@c-top.com.cn", title, content,
|
|
|
|
- new File(System.getProperty("user.dir") + File.separator + "uReport" + File.separator + uReport.getString("name").replace("ureport.xml", "") + "xlsx"));
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- //发完全部订阅,删除文件
|
|
|
|
- File file = new File(System.getProperty("user.dir") + File.separator + "uReport");
|
|
|
|
- File[] files = file.listFiles();
|
|
|
|
- if (files != null && files.length > 0) {
|
|
|
|
- for (File f : files) {
|
|
|
|
- f.delete();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ public void loadKuaishouMusicInfo(){
|
|
|
|
+// String musicTypeString = crawlerService.getMusicTypeList("");
|
|
|
|
+// String llsid = JSONObject.parseObject(musicTypeString).getString("llsid");
|
|
|
|
+// System.out.println(llsid);
|
|
|
|
+// JSONArray channels = JSONObject.parseObject(musicTypeString).getJSONArray("channels");
|
|
|
|
+// if (null!=channels&&!channels.isEmpty()){
|
|
|
|
+// for(int i=0;i<channels.size();i++){
|
|
|
|
+// JSONObject object = channels.getJSONObject(i);
|
|
|
|
+// MusicKuaishouType kuaishouType = new MusicKuaishouType(object);
|
|
|
|
+// musicKuaishouTypeService.save(kuaishouType);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+ String llsid = "2000106667298730337";
|
|
|
|
+ String musicTypeString = crawlerService.getMusicList("200032",llsid);
|
|
|
|
+ System.out.println(musicTypeString);
|
|
}
|
|
}
|
|
}
|
|
}
|