|
@@ -1,15 +1,10 @@
|
|
|
package org.jeecg;
|
|
|
|
|
|
-import cn.com.ctop.alarm.modules.service.IRuleGroupService;
|
|
|
import cn.com.ctop.common.module.entity.BindAccountLogin;
|
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
|
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.IBindAccountLoginService;
|
|
|
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
|
-import cn.com.ctop.common.module.service.IUReportExportService;
|
|
|
-import cn.com.ctop.common.module.service.IUReportService;
|
|
|
-import cn.com.ctop.common.module.service.IUserAllocationService;
|
|
|
+import cn.com.ctop.common.module.service.*;
|
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskService;
|
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
|
|
@@ -124,10 +119,29 @@ public class SampleTest {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testLoadRulePlanData() {
|
|
|
+ public void testLoadRulePlanData(){
|
|
|
+ Date date = new Date();
|
|
|
List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
|
- for (CtopOauthToken token : tokens) {
|
|
|
- reportService.getAdvertiserPlanRuleData(token, new Date(), new Date(), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ executorService = Executors.newFixedThreadPool(10);
|
|
|
+ countDownLatch = new CountDownLatch(tokens.size());
|
|
|
+ tokens.forEach(token -> executorService.submit(()->{
|
|
|
+ try {
|
|
|
+ Long start = System.currentTimeMillis();
|
|
|
+ reportService.getAdvertiserPlanRuleData(token,date,date,CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ Long end = System.currentTimeMillis();
|
|
|
+ log.info("账户数据获取完成:accountId=>{},耗时{}毫秒",token.getAccountId(),end-start);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }finally {
|
|
|
+ countDownLatch.countDown();
|
|
|
+ }
|
|
|
+
|
|
|
+ }));
|
|
|
+
|
|
|
+ try {
|
|
|
+ countDownLatch.await();
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -136,20 +150,20 @@ public class SampleTest {
|
|
|
|
|
|
@Test
|
|
|
public void testLoadBytedanceData() {
|
|
|
- List<UserAllocation> allocations = allocationService.getByParams(273L, null, 0);
|
|
|
- if (null != allocations && !allocations.isEmpty()) {
|
|
|
- for (UserAllocation allocation : allocations) {
|
|
|
+ List<UserAllocation>allocations = allocationService.getByParams(273L,null,0);
|
|
|
+ if(null!=allocations&&!allocations.isEmpty()){
|
|
|
+ for(UserAllocation allocation:allocations){
|
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
|
|
|
String startDate = "2020-11-05";
|
|
|
String endDate = "2020-11-09";
|
|
|
- reportService.getAdvertiserPlanReport(token, DateUtils.parseDate(startDate, "yyyy-MM-dd"), DateUtils.parseDate(endDate, "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ reportService.getAdvertiserPlanReport(token, DateUtils.parseDate(startDate,"yyyy-MM-dd"), DateUtils.parseDate(endDate,"yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
}
|
|
|
}
|
|
|
System.out.println("任务结束");
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void loadBytedancePlanData() {
|
|
|
+ public void loadBytedancePlanData(){
|
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(100198696723L);
|
|
|
// advertiserDataService.getAdvertiserPlan(token, "", null, null);
|
|
|
Date getDate = DateUtils.addDay(new Date(), 0);
|
|
@@ -158,16 +172,15 @@ public class SampleTest {
|
|
|
|
|
|
@Autowired
|
|
|
private IBytedanceFundDailyService bytedanceFundDailyService;
|
|
|
-
|
|
|
@Test
|
|
|
public void loadFoudData() {
|
|
|
List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
|
for (CtopOauthToken token : tokens) {
|
|
|
- System.out.println(token.getAccountId() + "############################");
|
|
|
- for (int i = 20; i < 130; i++) {
|
|
|
- Date date = DateUtils.addDay(new Date(), -i);
|
|
|
- bytedanceFundDailyService.loadFundDataByPage(token, DateUtils.formatDate(date), DateUtils.formatDate(date), 1);
|
|
|
- System.out.println(i + "############################");
|
|
|
+ System.out.println(token.getAccountId()+"############################");
|
|
|
+ for(int i=20;i<130;i++){
|
|
|
+ Date date = DateUtils.addDay(new Date(),-i);
|
|
|
+ bytedanceFundDailyService.loadFundDataByPage(token, DateUtils.formatDate(date), DateUtils.formatDate(date),1);
|
|
|
+ System.out.println(i+"############################");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -179,9 +192,9 @@ public class SampleTest {
|
|
|
* 测试获取快手图片消耗数据任务
|
|
|
*/
|
|
|
@Test
|
|
|
- public void loadKuaishouImageTask() {
|
|
|
+ public void loadKuaishouImageTask(){
|
|
|
List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
|
- for (int i = 1; i < 130; i++) {
|
|
|
+ for(int i=1;i<130;i++) {
|
|
|
Date getDate = DateUtils.addDay(new Date(), -i);
|
|
|
String getDateStr = DateUtils.formatDate(getDate);
|
|
|
tokens.forEach(token -> reportTaskService.createTask(token.getAccountId(), token.getAccessToken(), getDateStr, getDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY));
|
|
@@ -190,15 +203,14 @@ public class SampleTest {
|
|
|
|
|
|
@Autowired
|
|
|
private IKuaiShouDailyReportTaskService dailyReportTaskService;
|
|
|
-
|
|
|
/**
|
|
|
* 测试获取快手图片消耗数据入库
|
|
|
*/
|
|
|
@Test
|
|
|
- public void loadKuaishouImageTaskFile() {
|
|
|
+ public void loadKuaishouImageTaskFile(){
|
|
|
String nowDate = DateUtils.getDate("yyyy-MM-dd");
|
|
|
List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
|
- for (int i = 1; i < 15; i++) {
|
|
|
+ for(int i=1;i<15;i++){
|
|
|
String statDate = getAnotherDay("yyyy-MM-dd", nowDate, -i);
|
|
|
tokens.forEach(token -> dailyReportTaskService.getTaskList(token.getAccountId(), token.getAccessToken(), statDate));
|
|
|
}
|
|
@@ -206,15 +218,15 @@ public class SampleTest {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testLoadBytedanceImageData() {
|
|
|
- List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
|
+ public void testLoadBytedanceImageData(){
|
|
|
+ List<CtopOauthToken>tokens = tokenService.selectToutiaoToken();
|
|
|
countDownLatch = new CountDownLatch(tokens.size());
|
|
|
executorService = Executors.newFixedThreadPool(8);
|
|
|
- tokens.forEach(token -> executorService.submit(() -> {
|
|
|
+ tokens.forEach(token->executorService.submit(()->{
|
|
|
try {
|
|
|
advertiserDataService.getMaterialList(token);
|
|
|
- } catch (Exception e) {
|
|
|
- } finally {
|
|
|
+ }catch (Exception e){
|
|
|
+ }finally {
|
|
|
countDownLatch.countDown();
|
|
|
}
|
|
|
}));
|
|
@@ -226,12 +238,10 @@ public class SampleTest {
|
|
|
System.out.println("素材数据获取完成");
|
|
|
|
|
|
}
|
|
|
-
|
|
|
@Autowired
|
|
|
private KuaishouAgentAccountMapper kuaishouAgentAccountMapper;
|
|
|
@Autowired
|
|
|
private IKuaishouReportDailyAgentService kuaishouReportDailyAgentService;
|
|
|
-
|
|
|
@Test
|
|
|
public void loadKuaishouAgentData() throws JsonProcessingException {
|
|
|
kuaishouReportDailyAgentService.loginAgent();
|
|
@@ -248,7 +258,6 @@ public class SampleTest {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
@Autowired
|
|
|
private IKuaishouInterfaceService kuaishouInterfaceService;
|
|
|
|
|
@@ -271,10 +280,10 @@ public class SampleTest {
|
|
|
IUReportService uReportService;
|
|
|
|
|
|
@Test
|
|
|
- public void loadBytedanceData() {
|
|
|
+ public void loadBytedanceData(){
|
|
|
List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
|
- for (int i = 0; i < tokens.size(); i++) {
|
|
|
- for (int j = 0; j < 4; j++) {
|
|
|
+ for (int i=0;i<tokens.size();i++) {
|
|
|
+ for(int j=0;j<4;j++){
|
|
|
String getDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -j));
|
|
|
bytedanceReportService.bytedanceVideoMaterialReport(tokens.get(i), getDate, getDate);
|
|
|
}
|
|
@@ -283,10 +292,9 @@ public class SampleTest {
|
|
|
|
|
|
@Autowired
|
|
|
private IBytedanceReportService bytedanceReportService;
|
|
|
-
|
|
|
@Test
|
|
|
- public void loadMatData() {
|
|
|
- List<UserAllocation> allocations = allocationService.getByParams(289L, null, 0);
|
|
|
+ public void loadMatData(){
|
|
|
+ List<UserAllocation> allocations = allocationService.getByParams(289L,null,0);
|
|
|
countDownLatch = new CountDownLatch(allocations.size());
|
|
|
executorService = Executors.newFixedThreadPool(2);
|
|
|
allocations.forEach(allocation -> {
|
|
@@ -312,12 +320,4 @@ public class SampleTest {
|
|
|
}
|
|
|
XxlJobLogger.log("物料数据同步完成");
|
|
|
}
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IRuleGroupService ruleGroupService;
|
|
|
-
|
|
|
- @Test
|
|
|
- public void checkRules() {
|
|
|
- ruleGroupService.checkRules();
|
|
|
- }
|
|
|
}
|