|
@@ -5,21 +5,19 @@ 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.kuaishou.modules.batch.service.*;
|
|
|
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
|
|
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.oa.modules.service.IWechatCheckinDataService;
|
|
|
|
-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.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 cn.com.ctop.toutiao.modules.report.service.IReportService;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.xxl.job.core.log.XxlJobLogger;
|
|
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;
|
|
@@ -29,8 +27,6 @@ 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.text.ParseException;
|
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -50,54 +46,12 @@ public class SampleTest {
|
|
@Autowired
|
|
@Autowired
|
|
private IReportService reportService;
|
|
private IReportService reportService;
|
|
@Autowired
|
|
@Autowired
|
|
- private IUserAllocationService userAllocationService;
|
|
|
|
- @Autowired
|
|
|
|
private IByteDanceAdvertiserDataService advertiserDataService;
|
|
private IByteDanceAdvertiserDataService advertiserDataService;
|
|
@Autowired
|
|
@Autowired
|
|
private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
|
|
private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
|
|
- @Autowired
|
|
|
|
- private IKuaiShouDailyReportTaskService dailyReportTaskService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private IWechatDepartmentService wechatDepartment;
|
|
|
|
- @Autowired
|
|
|
|
- private IKuaishouInterfaceService kuaishouInterfaceService;
|
|
|
|
- @Autowired
|
|
|
|
- private IWechatUserListService wechatUserInfoService;
|
|
|
|
- @Autowired
|
|
|
|
- private IWechatCheckinDataService wechatCheckinDataService;
|
|
|
|
- @Autowired
|
|
|
|
- private IWechatNoListService wechatNoListService;
|
|
|
|
- @Autowired
|
|
|
|
private ICtopOauthTokenService tokenService;
|
|
private ICtopOauthTokenService tokenService;
|
|
- @Autowired
|
|
|
|
- private IKuaishouRealTimeDataService realTimeDataService;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private IKuaiShouCreativeService creativeService;
|
|
|
|
- @Autowired
|
|
|
|
- private IMessageTemplate messageTemplate;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private ISendMessageService sendMessageService;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private IKuaiShouOverRunSendMessageService overRunSendMessageService;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @Test
|
|
|
|
- public void getDepartment() throws ParseException {
|
|
|
|
-
|
|
|
|
- /* String message = messageTemplate.getCreativeOverRunMessage(23212L, 2000, "hahah");
|
|
|
|
- // LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
- sendMessageService.sendMessage("14c3cd
|
|
|
|
- 5e5e434211a9bb5e8f9d8a335d", message);*/
|
|
|
|
-
|
|
|
|
- overRunSendMessageService.creativeOverRunSendMessage(23212L);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void loadBytedanceCreativeData() {
|
|
public void loadBytedanceCreativeData() {
|
|
@@ -108,7 +62,6 @@ public class SampleTest {
|
|
kuaiShouHistoryReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-20", "2020-09-20", "daily");
|
|
kuaiShouHistoryReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-20", "2020-09-20", "daily");
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -187,18 +140,18 @@ public class SampleTest {
|
|
@Test
|
|
@Test
|
|
public void loadKuaishouAgentData() {
|
|
public void loadKuaishouAgentData() {
|
|
kuaishouReportDailyAgentService.loginAgent();
|
|
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
|
|
@Autowired
|
|
@@ -218,8 +171,14 @@ public class SampleTest {
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void loadAccountData() {
|
|
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
|
|
@Autowired
|
|
@@ -230,27 +189,64 @@ public class SampleTest {
|
|
IUReportService uReportService;
|
|
IUReportService uReportService;
|
|
|
|
|
|
@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"));
|
|
|
|
- });
|
|
|
|
|
|
+ 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);
|
|
}
|
|
}
|
|
- });
|
|
|
|
- //发完全部订阅,删除文件
|
|
|
|
- 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("物料数据同步完成");
|
|
}
|
|
}
|
|
}
|
|
}
|