|
@@ -13,10 +13,7 @@ import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouUnitLevelOperationRecord
|
|
import cn.com.ctop.kuaishou.modules.ai.mapper.AiKuaishouUnitLevelOperationRecordMapper;
|
|
import cn.com.ctop.kuaishou.modules.ai.mapper.AiKuaishouUnitLevelOperationRecordMapper;
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouOperationRecord;
|
|
import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouOperationRecord;
|
|
import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouOperationRecordMapper;
|
|
import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouOperationRecordMapper;
|
|
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
|
|
|
|
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
|
|
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService2;
|
|
|
|
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouProgramCreativeService;
|
|
|
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.service.*;
|
|
import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionStrategyService;
|
|
import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionStrategyService;
|
|
import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionVariableService;
|
|
import cn.com.ctop.kuaishou.modules.dimension.service.IKuaiShouDimensionVariableService;
|
|
import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
|
|
import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
|
|
@@ -111,6 +108,42 @@ public class SampleTest {
|
|
private IOauthAgentTokenService agentTokenService;
|
|
private IOauthAgentTokenService agentTokenService;
|
|
@Autowired
|
|
@Autowired
|
|
private KuaiShouDailyAgentMapper agentMapper;
|
|
private KuaiShouDailyAgentMapper agentMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IKuaishouSupplyChainService ikuaishouSupplyChainService;
|
|
|
|
+
|
|
|
|
+ @Test
|
|
|
|
+ public void getRuiXuanCcrInfo() throws ParseException, InterruptedException {
|
|
|
|
+ List<JSONObject> cookies = ikuaishouSupplyChainService.getCookie();
|
|
|
|
+ if (Check.isNull(cookies)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < cookies.size(); i++) {
|
|
|
|
+ JSONObject jsonObject = cookies.get(i);
|
|
|
|
+ String cookie = jsonObject.getString("cookie");
|
|
|
|
+ ikuaishouSupplyChainService.getCcrInfo(cookie, 100, "ruixuan");
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Thread.sleep(5 * 1000);
|
|
|
|
+
|
|
|
|
+ List<JSONObject> mgsCookies = ikuaishouSupplyChainService.getMgsCookie();
|
|
|
|
+ for (int i = 0; i < mgsCookies.size(); i++) {
|
|
|
|
+ JSONObject jsonObject = mgsCookies.get(i);
|
|
|
|
+ String cookie = jsonObject.getString("cookie");
|
|
|
|
+ ikuaishouSupplyChainService.getCcrInfo(cookie, 100, "miaogousi");
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Thread.sleep(5 * 1000);
|
|
|
|
+ List<JSONObject> rocketCookies = ikuaishouSupplyChainService.getRocketCookie();
|
|
|
|
+ for (int i = 0; i < rocketCookies.size(); i++) {
|
|
|
|
+ JSONObject jsonObject = rocketCookies.get(i);
|
|
|
|
+ String cookie = jsonObject.getString("cookie");
|
|
|
|
+ ikuaishouSupplyChainService.getCcrInfo(cookie, 100, "rocket");
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void loadKuaishouCookie() throws ParseException {
|
|
public void loadKuaishouCookie() throws ParseException {
|
|
@@ -121,7 +154,7 @@ public class SampleTest {
|
|
Long appId = appList.get(i);
|
|
Long appId = appList.get(i);
|
|
OauthAgentToken agentToken = agentTokenService.getTokenByAppId(appId);
|
|
OauthAgentToken agentToken = agentTokenService.getTokenByAppId(appId);
|
|
System.err.println(agentToken);
|
|
System.err.println(agentToken);
|
|
- // getAgentReport(agentToken.getAccessToken(), agentToken.getAgentId(), startDate, endDate, 1);
|
|
|
|
|
|
+ // getAgentReport(agentToken.getAccessToken(), agentToken.getAgentId(), startDate, endDate, 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -277,17 +310,19 @@ public class SampleTest {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private IEtlKuaishouVideoInfoService etlKuaishouVideoInfo;
|
|
private IEtlKuaishouVideoInfoService etlKuaishouVideoInfo;
|
|
|
|
+
|
|
@Test
|
|
@Test
|
|
- public void loadkuaishouVideoData(){
|
|
|
|
|
|
+ public void loadkuaishouVideoData() {
|
|
String startDate = "2021-05-07";
|
|
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);
|
|
etlKuaishouVideoInfo.etlKuaishouVideoInfo(getDate);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
|
|
private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
|
|
|
|
+
|
|
@Test
|
|
@Test
|
|
public void loadKuaishouMatData() throws InterruptedException {
|
|
public void loadKuaishouMatData() throws InterruptedException {
|
|
String startDate = "2021-06-18";
|
|
String startDate = "2021-06-18";
|
|
@@ -298,16 +333,17 @@ public class SampleTest {
|
|
tokens.forEach(token -> executorService.submit(() -> {
|
|
tokens.forEach(token -> executorService.submit(() -> {
|
|
try {
|
|
try {
|
|
kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), startDate, endDate, "DAILY", 1);
|
|
kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), startDate, endDate, "DAILY", 1);
|
|
- }catch (Exception e){
|
|
|
|
- }finally {
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ } finally {
|
|
countDownLatch.countDown();
|
|
countDownLatch.countDown();
|
|
}
|
|
}
|
|
}));
|
|
}));
|
|
countDownLatch.await();
|
|
countDownLatch.await();
|
|
System.out.println("数据获取完成");
|
|
System.out.println("数据获取完成");
|
|
}
|
|
}
|
|
|
|
+
|
|
@Test
|
|
@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);
|
|
// kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(7411077l, tokenService.getOauthTokenByAccountId("7411077").getAccessToken(), "2021-07-02", "2021-07-02", "HOURLY", 1);
|
|
|
|
|
|
String startDate = "2021-07-19";
|
|
String startDate = "2021-07-19";
|
|
@@ -319,8 +355,8 @@ public class SampleTest {
|
|
tokens.forEach(token -> executorService.submit(() -> {
|
|
tokens.forEach(token -> executorService.submit(() -> {
|
|
try {
|
|
try {
|
|
kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), startDate, endDate, "HOURLY", 1);
|
|
kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), startDate, endDate, "HOURLY", 1);
|
|
- }catch (Exception e){
|
|
|
|
- }finally {
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ } finally {
|
|
countDownLatch.countDown();
|
|
countDownLatch.countDown();
|
|
}
|
|
}
|
|
}));
|
|
}));
|
|
@@ -345,7 +381,7 @@ public class SampleTest {
|
|
int recordsCount = 0;
|
|
int recordsCount = 0;
|
|
int newRecordCount = 0;
|
|
int newRecordCount = 0;
|
|
|
|
|
|
- while (beginDate.before(endDate)){
|
|
|
|
|
|
+ while (beginDate.before(endDate)) {
|
|
System.out.println("开始拆分数据,当前时间为:" + beginDate);
|
|
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.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"));
|
|
// List<KuaishouOperationRecord> records = kuaishouOperationRecordMapper.selectAccountRecordByStatDate(DateUtils.formatDate(beginDate, "yyyy-MM-dd"));
|
|
@@ -391,12 +427,12 @@ public class SampleTest {
|
|
this.saveOperationRecordListToDb(newRecords);
|
|
this.saveOperationRecordListToDb(newRecords);
|
|
beginDate = DateUtils.addDay(beginDate, 1);
|
|
beginDate = DateUtils.addDay(beginDate, 1);
|
|
} else {
|
|
} else {
|
|
- System.out.print(" -> 今日的数据为空!!!");
|
|
|
|
- beginDate = DateUtils.addDay(beginDate, 1);
|
|
|
|
|
|
+ System.out.print(" -> 今日的数据为空!!!");
|
|
|
|
+ beginDate = DateUtils.addDay(beginDate, 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
System.out.println("---------------------------------------------------------------");
|
|
System.out.println("---------------------------------------------------------------");
|
|
- System.out.println("------------获取数据结束"+recordsCount+"条原始数据变成了"+newRecordCount+"条数据------------");
|
|
|
|
|
|
+ System.out.println("------------获取数据结束" + recordsCount + "条原始数据变成了" + newRecordCount + "条数据------------");
|
|
System.out.println("---------------------------------------------------------------");
|
|
System.out.println("---------------------------------------------------------------");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -457,11 +493,12 @@ public class SampleTest {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public void testfreshBytedanceUrl(){
|
|
|
|
|
|
+ public void testfreshBytedanceUrl() {
|
|
etlReportBytedanceVideoService.etlBytedanceVideoClipIdJob(null);
|
|
etlReportBytedanceVideoService.etlBytedanceVideoClipIdJob(null);
|
|
etlReportBytedanceVideoService.etlBytedanceVideoPlanInfoJob();
|
|
etlReportBytedanceVideoService.etlBytedanceVideoPlanInfoJob();
|
|
etlReportBytedanceVideoService.etlBytedanceVideoShotInfoJob();
|
|
etlReportBytedanceVideoService.etlBytedanceVideoShotInfoJob();
|
|
}
|
|
}
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
IKuaishouInterfaceService2 kuaishouInterfaceServiceImpl2;
|
|
IKuaishouInterfaceService2 kuaishouInterfaceServiceImpl2;
|
|
|
|
|
|
@@ -483,21 +520,21 @@ public class SampleTest {
|
|
Date endDate = DateUtils.parseDate("2021-07-22", "yyyy-MM-dd");
|
|
Date endDate = DateUtils.parseDate("2021-07-22", "yyyy-MM-dd");
|
|
|
|
|
|
List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
- while (beginDate.before(endDate)){
|
|
|
|
|
|
+ while (beginDate.before(endDate)) {
|
|
Date mulDate = beginDate;
|
|
Date mulDate = beginDate;
|
|
countDownLatch = new CountDownLatch(tokens.size());
|
|
countDownLatch = new CountDownLatch(tokens.size());
|
|
tokens.forEach(token -> executorService.submit(() -> {
|
|
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(),
|
|
token.getAccessToken(),
|
|
3, //先3组 后2计划
|
|
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();
|
|
countDownLatch.countDown();
|
|
}
|
|
}
|
|
}));
|
|
}));
|
|
@@ -513,6 +550,7 @@ public class SampleTest {
|
|
IKuaishouAudienceReportDailyService kuaishouAudienceReportDailyService;
|
|
IKuaishouAudienceReportDailyService kuaishouAudienceReportDailyService;
|
|
@Resource
|
|
@Resource
|
|
AiKuaishouUnitLevelOperationRecordMapper kuaishouUnitLevelOperationRecordMapper;
|
|
AiKuaishouUnitLevelOperationRecordMapper kuaishouUnitLevelOperationRecordMapper;
|
|
|
|
+
|
|
@Test
|
|
@Test
|
|
public void getAudienceReport() throws InterruptedException {
|
|
public void getAudienceReport() throws InterruptedException {
|
|
int page = 1;
|
|
int page = 1;
|
|
@@ -520,28 +558,28 @@ public class SampleTest {
|
|
Date beginDate = DateUtils.parseDate("2021-05-01", "yyyy-MM-dd");
|
|
Date beginDate = DateUtils.parseDate("2021-05-01", "yyyy-MM-dd");
|
|
Date endDate = DateUtils.parseDate("2021-06-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;
|
|
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());
|
|
countDownLatch = new CountDownLatch(planIdsAndUnitIds.size());
|
|
planIdsAndUnitIds.forEach(planIdAndUnitId -> executorService.submit(() -> {
|
|
planIdsAndUnitIds.forEach(planIdAndUnitId -> executorService.submit(() -> {
|
|
- try{
|
|
|
|
|
|
+ try {
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(planIdAndUnitId.getAccountId());
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(planIdAndUnitId.getAccountId());
|
|
- if(!Check.isNull(token)){
|
|
|
|
|
|
+ if (!Check.isNull(token)) {
|
|
Date startDate = mulDate;
|
|
Date startDate = mulDate;
|
|
Date enDate = DateUtils.addDay(startDate, 30);
|
|
Date enDate = DateUtils.addDay(startDate, 30);
|
|
// province: 省级地域分布, city: 地级地域分布,gender: 性别分布,ageSegment: 年龄分布clientId: 系统分布 businessInterestTags: 商业兴趣分布
|
|
// 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);
|
|
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();
|
|
countDownLatch.countDown();
|
|
}
|
|
}
|
|
}));
|
|
}));
|