|
@@ -111,7 +111,25 @@ public class SampleTest {
|
|
|
|
|
|
@Test
|
|
|
public void loadKuaishouCookie() throws ParseException {
|
|
|
- sendMessageService.sendMessage("d2331a00e1be42ec8542167e321eeb01","测试消息");
|
|
|
+ List<Long> accList = new ArrayList<>();
|
|
|
+ accList.add(11789495L);
|
|
|
+ accList.add(11574866L);
|
|
|
+ for (int i = 0; i < accList.size(); i++) {
|
|
|
+ Long aLong = accList.get(i);
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(aLong);
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date parse = simpleDateFormat.parse("2021-12-17");
|
|
|
+ Date parse1 = simpleDateFormat.parse("2021-12-23");
|
|
|
+
|
|
|
+
|
|
|
+ kuaishouInterfaceService.getAdvertiserReportDaily(token, parse, parse1, null);
|
|
|
+ kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), "2021-12-17", "2021-12-23", "DAILY", 1);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // sendMessageService.sendMessage("d2331a00e1be42ec8542167e321eeb01", "测试消息");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -266,17 +284,19 @@ public class SampleTest {
|
|
|
|
|
|
@Autowired
|
|
|
private IEtlKuaishouVideoInfoService etlKuaishouVideoInfo;
|
|
|
+
|
|
|
@Test
|
|
|
- public void loadkuaishouVideoData(){
|
|
|
+ public void loadkuaishouVideoData() {
|
|
|
String startDate = "2021-05-07";
|
|
|
- for(int i=0;i<=60;i++){
|
|
|
- String getDate = DateUtils.formatDate(DateUtils.addDay(startDate,i));
|
|
|
+ for (int i = 0; i <= 60; i++) {
|
|
|
+ String getDate = DateUtils.formatDate(DateUtils.addDay(startDate, i));
|
|
|
etlKuaishouVideoInfo.etlKuaishouVideoInfo(getDate);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
|
private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
|
|
|
+
|
|
|
@Test
|
|
|
public void loadKuaishouMatData() throws InterruptedException {
|
|
|
String startDate = "2021-06-18";
|
|
@@ -287,16 +307,17 @@ public class SampleTest {
|
|
|
tokens.forEach(token -> executorService.submit(() -> {
|
|
|
try {
|
|
|
kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), startDate, endDate, "DAILY", 1);
|
|
|
- }catch (Exception e){
|
|
|
- }finally {
|
|
|
+ } catch (Exception e) {
|
|
|
+ } finally {
|
|
|
countDownLatch.countDown();
|
|
|
}
|
|
|
}));
|
|
|
countDownLatch.await();
|
|
|
System.out.println("数据获取完成");
|
|
|
}
|
|
|
+
|
|
|
@Test
|
|
|
- public void loadKuaiShouMatHourlyData() throws InterruptedException{
|
|
|
+ public void loadKuaiShouMatHourlyData() throws InterruptedException {
|
|
|
// kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(7411077l, tokenService.getOauthTokenByAccountId("7411077").getAccessToken(), "2021-07-02", "2021-07-02", "HOURLY", 1);
|
|
|
|
|
|
String startDate = "2021-07-19";
|
|
@@ -308,8 +329,8 @@ public class SampleTest {
|
|
|
tokens.forEach(token -> executorService.submit(() -> {
|
|
|
try {
|
|
|
kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), startDate, endDate, "HOURLY", 1);
|
|
|
- }catch (Exception e){
|
|
|
- }finally {
|
|
|
+ } catch (Exception e) {
|
|
|
+ } finally {
|
|
|
countDownLatch.countDown();
|
|
|
}
|
|
|
}));
|
|
@@ -334,7 +355,7 @@ public class SampleTest {
|
|
|
int recordsCount = 0;
|
|
|
int newRecordCount = 0;
|
|
|
|
|
|
- while (beginDate.before(endDate)){
|
|
|
+ while (beginDate.before(endDate)) {
|
|
|
System.out.println("开始拆分数据,当前时间为:" + beginDate);
|
|
|
List<KuaishouOperationRecord> records = kuaishouOperationRecordMapper.selectCreativeRecordByStatDate(DateUtils.formatDate(beginDate, "yyyy-MM-dd")); //开始拆分数据,当前时间为:Tue Apr 28 00:00:00 CST 2020
|
|
|
// List<KuaishouOperationRecord> records = kuaishouOperationRecordMapper.selectAccountRecordByStatDate(DateUtils.formatDate(beginDate, "yyyy-MM-dd"));
|
|
@@ -380,12 +401,12 @@ public class SampleTest {
|
|
|
this.saveOperationRecordListToDb(newRecords);
|
|
|
beginDate = DateUtils.addDay(beginDate, 1);
|
|
|
} else {
|
|
|
- System.out.print(" -> 今日的数据为空!!!");
|
|
|
- beginDate = DateUtils.addDay(beginDate, 1);
|
|
|
+ System.out.print(" -> 今日的数据为空!!!");
|
|
|
+ beginDate = DateUtils.addDay(beginDate, 1);
|
|
|
}
|
|
|
}
|
|
|
System.out.println("---------------------------------------------------------------");
|
|
|
- System.out.println("------------获取数据结束"+recordsCount+"条原始数据变成了"+newRecordCount+"条数据------------");
|
|
|
+ System.out.println("------------获取数据结束" + recordsCount + "条原始数据变成了" + newRecordCount + "条数据------------");
|
|
|
System.out.println("---------------------------------------------------------------");
|
|
|
}
|
|
|
|
|
@@ -446,11 +467,12 @@ public class SampleTest {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void testfreshBytedanceUrl(){
|
|
|
+ public void testfreshBytedanceUrl() {
|
|
|
etlReportBytedanceVideoService.etlBytedanceVideoClipIdJob(null);
|
|
|
etlReportBytedanceVideoService.etlBytedanceVideoPlanInfoJob();
|
|
|
etlReportBytedanceVideoService.etlBytedanceVideoShotInfoJob();
|
|
|
}
|
|
|
+
|
|
|
@Autowired
|
|
|
IKuaishouInterfaceService2 kuaishouInterfaceServiceImpl2;
|
|
|
|
|
@@ -472,21 +494,21 @@ public class SampleTest {
|
|
|
Date endDate = DateUtils.parseDate("2021-07-22", "yyyy-MM-dd");
|
|
|
|
|
|
List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
|
- while (beginDate.before(endDate)){
|
|
|
+ while (beginDate.before(endDate)) {
|
|
|
Date mulDate = beginDate;
|
|
|
countDownLatch = new CountDownLatch(tokens.size());
|
|
|
tokens.forEach(token -> executorService.submit(() -> {
|
|
|
- try{
|
|
|
- if(!accountIdList.contains(token.getAccountId())){
|
|
|
- kuaishouInterfaceServiceImpl2.getOperationRecord( token.getAccountId(),
|
|
|
+ try {
|
|
|
+ if (!accountIdList.contains(token.getAccountId())) {
|
|
|
+ kuaishouInterfaceServiceImpl2.getOperationRecord(token.getAccountId(),
|
|
|
token.getAccessToken(),
|
|
|
3, //先3组 后2计划
|
|
|
- DateUtils.formatDate(mulDate,"yyyy-MM-dd"),
|
|
|
- DateUtils.formatDate(mulDate,"yyyy-MM-dd"));
|
|
|
- System.out.println("获取完毕 -> accountId:" + token.getAccountId() +",日期:" + DateUtils.formatDate(mulDate,"yyyy-MM-dd"));
|
|
|
+ DateUtils.formatDate(mulDate, "yyyy-MM-dd"),
|
|
|
+ DateUtils.formatDate(mulDate, "yyyy-MM-dd"));
|
|
|
+ System.out.println("获取完毕 -> accountId:" + token.getAccountId() + ",日期:" + DateUtils.formatDate(mulDate, "yyyy-MM-dd"));
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
- }finally {
|
|
|
+ } catch (Exception e) {
|
|
|
+ } finally {
|
|
|
countDownLatch.countDown();
|
|
|
}
|
|
|
}));
|
|
@@ -502,6 +524,7 @@ public class SampleTest {
|
|
|
IKuaishouAudienceReportDailyService kuaishouAudienceReportDailyService;
|
|
|
@Resource
|
|
|
AiKuaishouUnitLevelOperationRecordMapper kuaishouUnitLevelOperationRecordMapper;
|
|
|
+
|
|
|
@Test
|
|
|
public void getAudienceReport() throws InterruptedException {
|
|
|
int page = 1;
|
|
@@ -509,28 +532,28 @@ public class SampleTest {
|
|
|
Date beginDate = DateUtils.parseDate("2021-05-01", "yyyy-MM-dd");
|
|
|
Date endDate = DateUtils.parseDate("2021-06-01", "yyyy-MM-dd");
|
|
|
|
|
|
- while (beginDate.before(endDate)){
|
|
|
+ while (beginDate.before(endDate)) {
|
|
|
Date mulDate = beginDate;
|
|
|
- List<AiKuaishouUnitLevelOperationRecord> planIdsAndUnitIds = kuaishouUnitLevelOperationRecordMapper.selectAllByAccountId(mulDate, DateUtils.addDay(mulDate,1));
|
|
|
+ List<AiKuaishouUnitLevelOperationRecord> planIdsAndUnitIds = kuaishouUnitLevelOperationRecordMapper.selectAllByAccountId(mulDate, DateUtils.addDay(mulDate, 1));
|
|
|
countDownLatch = new CountDownLatch(planIdsAndUnitIds.size());
|
|
|
planIdsAndUnitIds.forEach(planIdAndUnitId -> executorService.submit(() -> {
|
|
|
- try{
|
|
|
+ try {
|
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(planIdAndUnitId.getAccountId());
|
|
|
- if(!Check.isNull(token)){
|
|
|
+ if (!Check.isNull(token)) {
|
|
|
Date startDate = mulDate;
|
|
|
Date enDate = DateUtils.addDay(startDate, 30);
|
|
|
// province: 省级地域分布, city: 地级地域分布,gender: 性别分布,ageSegment: 年龄分布clientId: 系统分布 businessInterestTags: 商业兴趣分布
|
|
|
- while (startDate.before(enDate)){
|
|
|
- kuaishouAudienceReportDailyService.crowdAnalysisReport2(token, DateUtils.formatDate(startDate,"yyyy-MM-dd"), "ageSegment", planIdAndUnitId.getCampaignId(), planIdAndUnitId.getUnitId(), page, pageSize);
|
|
|
- System.out.println("获取完毕 -> unit:" + planIdAndUnitId.getUnitId() +",日期:" + DateUtils.formatDate(startDate,"yyyy-MM-dd"));
|
|
|
+ while (startDate.before(enDate)) {
|
|
|
+ kuaishouAudienceReportDailyService.crowdAnalysisReport2(token, DateUtils.formatDate(startDate, "yyyy-MM-dd"), "ageSegment", planIdAndUnitId.getCampaignId(), planIdAndUnitId.getUnitId(), page, pageSize);
|
|
|
+ System.out.println("获取完毕 -> unit:" + planIdAndUnitId.getUnitId() + ",日期:" + DateUtils.formatDate(startDate, "yyyy-MM-dd"));
|
|
|
startDate = DateUtils.addDay(startDate, 1);
|
|
|
}
|
|
|
|
|
|
- }else {
|
|
|
- System.out.println("token异常 -》 accountId:"+planIdAndUnitId.getAccountId());
|
|
|
+ } else {
|
|
|
+ System.out.println("token异常 -》 accountId:" + planIdAndUnitId.getAccountId());
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
- }finally {
|
|
|
+ } catch (Exception e) {
|
|
|
+ } finally {
|
|
|
countDownLatch.countDown();
|
|
|
}
|
|
|
}));
|