|
@@ -5,7 +5,6 @@ import cn.com.ctop.check.entity.CtopCheckTaskList;
|
|
|
import cn.com.ctop.check.service.ICtopCheckTaskListService;
|
|
|
import cn.com.ctop.common.module.entity.BindAccountLogin;
|
|
|
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.message.handle.impl.EmailSendMsgHandle;
|
|
|
import cn.com.ctop.common.module.service.*;
|
|
@@ -18,8 +17,11 @@ import cn.com.ctop.oa.modules.service.IWechatDepartmentService;
|
|
|
import cn.com.ctop.oa.modules.service.IWechatNoListService;
|
|
|
import cn.com.ctop.oa.modules.service.IWechatUserListService;
|
|
|
import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
|
|
|
+import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
|
|
|
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
|
|
|
import cn.com.ctop.toutiao.modules.report.service.IReportService;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.xxl.job.core.log.XxlJobLogger;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
import org.junit.Test;
|
|
@@ -29,7 +31,6 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.ActiveProfiles;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
-import java.io.File;
|
|
|
import java.text.ParseException;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
@@ -187,18 +188,18 @@ public class SampleTest {
|
|
|
@Test
|
|
|
public void loadKuaishouAgentData() {
|
|
|
kuaishouReportDailyAgentService.loginAgent();
|
|
|
- for (int i = 0; i < 20; i++) {
|
|
|
- String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -i));
|
|
|
- kuaishouReportDailyAgentService.getReport(currentDate, DateUtils.getNowDate("yyyy-MM-dd"));
|
|
|
- }
|
|
|
-//
|
|
|
-// try {
|
|
|
-// for (int i = 1; i < 30; i++) {
|
|
|
-// kuaishouReportDailyAgentService.getAccount(i);
|
|
|
-// }
|
|
|
-// } catch (Exception e) {
|
|
|
-// e.printStackTrace();
|
|
|
+// for (int i = 0; i < 20; i++) {
|
|
|
+// String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -i));
|
|
|
+// kuaishouReportDailyAgentService.getReport(currentDate, DateUtils.getNowDate("yyyy-MM-dd"));
|
|
|
// }
|
|
|
+//
|
|
|
+ try {
|
|
|
+ for (int i = 1; i < 30; i++) {
|
|
|
+ kuaishouReportDailyAgentService.getAccount(i);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
@@ -218,8 +219,14 @@ public class SampleTest {
|
|
|
|
|
|
@Test
|
|
|
public void loadAccountData() {
|
|
|
- CtopOauthToken token = oauthTokenService.getTokenByAccountId(1665922219192387L);
|
|
|
- reportService.getAdvertiserReport(token, DateUtils.parseDate("2020-09-01", "yy-MM-dd"), DateUtils.parseDate("2020-09-01", "yy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
+// List<UserAllocation> allocations = allocationService.getByParams(776L,null,0);
|
|
|
+// for (UserAllocation allocation:allocations) {
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(93238965516L);
|
|
|
+ for(int i=92;i<100;i++){
|
|
|
+ Date getDate = DateUtils.addDay(new Date(),-i);
|
|
|
+ reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
@@ -230,27 +237,65 @@ public class SampleTest {
|
|
|
IUReportService uReportService;
|
|
|
|
|
|
@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"));
|
|
|
- });
|
|
|
+ public void loadBytedanceData(){
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
|
+ for (CtopOauthToken token:tokens) {
|
|
|
+ for(int i=0;i<20;i++){
|
|
|
+ Date getDate = DateUtils.addDay(new Date(), -i);
|
|
|
+ String date = DateUtils.formatDate(getDate);
|
|
|
+ bytedanceReportService.bytedanceMaterialReport(token, date, date);
|
|
|
+// videoReportDailyService.videoInfoList(date, date);
|
|
|
}
|
|
|
- });
|
|
|
- //发完全部订阅,删除文件
|
|
|
- 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();
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void loaddata(){
|
|
|
+// List<UserAllocation> allocations = allocationService.getByParams(643L,null,0);
|
|
|
+// for (UserAllocation allocation:allocations) {
|
|
|
+ for(int i=0;i<50;i++){
|
|
|
+// CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
|
|
|
+ Date getDate = DateUtils.addDay(new Date(), -i);
|
|
|
+ String date = DateUtils.formatDate(getDate);
|
|
|
+// bytedanceReportService.bytedanceMaterialReport(token, date, date);
|
|
|
+ videoReportDailyService.videoInfoList(date, date);
|
|
|
}
|
|
|
+
|
|
|
+// }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBytedanceReportService bytedanceReportService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IByteDanceVideoReportDailyService videoReportDailyService;
|
|
|
+ @Test
|
|
|
+ public void loadMatData(){
|
|
|
+ List<UserAllocation> allocations = allocationService.getByParams(320L,null,0);
|
|
|
+ countDownLatch = new CountDownLatch(allocations.size());
|
|
|
+ executorService = Executors.newFixedThreadPool(2);
|
|
|
+ allocations.forEach(allocation -> {
|
|
|
+ executorService.submit(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ try {
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
|
|
|
+ //获取全量视频素材数据
|
|
|
+ advertiserDataService.getMaterialList(token);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ countDownLatch.countDown();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ try {
|
|
|
+ countDownLatch.await();
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
+ XxlJobLogger.log("物料数据同步完成");
|
|
|
}
|
|
|
}
|