|
@@ -7,9 +7,12 @@ 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.common.module.utils.HttpUtils;
|
|
import cn.com.ctop.common.module.utils.HttpUtils;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskService;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouTemplateService;
|
|
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.mapper.KuaishouAgentAccountMapper;
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
|
|
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.IBytedanceFundDailyService;
|
|
import cn.com.ctop.toutiao.modules.report.service.IBytedanceFundDailyService;
|
|
@@ -37,6 +40,8 @@ import java.util.concurrent.CountDownLatch;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.Executors;
|
|
|
|
|
|
|
|
+import static org.jeecg.common.util.DateUtils.getAnotherDay;
|
|
|
|
+
|
|
@RunWith(SpringRunner.class)
|
|
@RunWith(SpringRunner.class)
|
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
|
@ActiveProfiles("wps")
|
|
@ActiveProfiles("wps")
|
|
@@ -53,15 +58,40 @@ public class SampleTest {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ICtopOauthTokenService tokenService;
|
|
private ICtopOauthTokenService tokenService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IByteDanceAdvertiserDataService byteDanceAdvertiserDataService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IKuaishouTemplateService kuaishouTemplateService;
|
|
|
|
+
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void loadBytedanceCreativeData() {
|
|
public void loadBytedanceCreativeData() {
|
|
- QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
|
|
|
|
- queryWrapper.eq("media_id", 2);
|
|
|
|
- List<CtopOauthToken> list = oauthTokenService.list(queryWrapper);
|
|
|
|
- for (CtopOauthToken token : list) {
|
|
|
|
- kuaiShouHistoryReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-20", "2020-09-20", "daily");
|
|
|
|
|
|
+
|
|
|
|
+ List<CtopOauthToken> ctopOauthTokens = tokenService.selectKuaiShouToken();
|
|
|
|
+ for (CtopOauthToken token : ctopOauthTokens) {
|
|
|
|
+ kuaishouTemplateService.getTemplateByAccountId(token.getAccountId(), token.getAccessToken(), 1);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /* Map<String, String> headers = new HashMap<>();
|
|
|
|
+ headers.put("Content-Type", "application/json");
|
|
|
|
+ headers.put("Access-Token", "d7048013910d63c434debabb058b9fe4d60e3b6b");
|
|
|
|
+
|
|
|
|
+ JSONObject params=new JSONObject();
|
|
|
|
+ params.put("advertiser_id","1660666858777607");
|
|
|
|
+ params.put("convert_id","1678604543575044");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(HttpUtils.httpGet("https://ad.oceanengine.com/open_api/2/tools/ad_convert/read/", params, headers));
|
|
|
|
+ System.err.println(jsonObject);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // JSONObject jsonObject = JSONObject.parseObject(HttpUtils.httpGet(QueryToolUrlConstant.AD_CONVERT_QUERY, params, headers));
|
|
|
|
+
|
|
|
|
+ byteDanceAdvertiserDataService.getBytedancePlanList("1660666858777607","d7048013910d63c434debabb058b9fe4d60e3b6b",1,null,"2020-11-12");*/
|
|
}
|
|
}
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -163,20 +193,20 @@ public class SampleTest {
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void testLoadBytedanceData() {
|
|
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());
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
|
|
String startDate = "2020-11-05";
|
|
String startDate = "2020-11-05";
|
|
String endDate = "2020-11-09";
|
|
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("任务结束");
|
|
System.out.println("任务结束");
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
- public void loadBytedancePlanData(){
|
|
|
|
|
|
+ public void loadBytedancePlanData() {
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(100198696723L);
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(100198696723L);
|
|
// advertiserDataService.getAdvertiserPlan(token, "", null, null);
|
|
// advertiserDataService.getAdvertiserPlan(token, "", null, null);
|
|
Date getDate = DateUtils.addDay(new Date(), 0);
|
|
Date getDate = DateUtils.addDay(new Date(), 0);
|
|
@@ -185,15 +215,16 @@ public class SampleTest {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private IBytedanceFundDailyService bytedanceFundDailyService;
|
|
private IBytedanceFundDailyService bytedanceFundDailyService;
|
|
|
|
+
|
|
@Test
|
|
@Test
|
|
public void loadFoudData() {
|
|
public void loadFoudData() {
|
|
List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
for (CtopOauthToken token : tokens) {
|
|
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 + "############################");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -205,25 +236,42 @@ public class SampleTest {
|
|
* 测试获取快手图片消耗数据任务
|
|
* 测试获取快手图片消耗数据任务
|
|
*/
|
|
*/
|
|
@Test
|
|
@Test
|
|
- public void loadKuaishouImageTask(){
|
|
|
|
|
|
+ public void loadKuaishouImageTask() {
|
|
List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
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);
|
|
Date getDate = DateUtils.addDay(new Date(), -i);
|
|
String getDateStr = DateUtils.formatDate(getDate);
|
|
String getDateStr = DateUtils.formatDate(getDate);
|
|
tokens.forEach(token -> reportTaskService.createTask(token.getAccountId(), token.getAccessToken(), getDateStr, getDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY));
|
|
tokens.forEach(token -> reportTaskService.createTask(token.getAccountId(), token.getAccessToken(), getDateStr, getDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IKuaiShouDailyReportTaskService dailyReportTaskService;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 测试获取快手图片消耗数据入库
|
|
|
|
+ */
|
|
|
|
+ @Test
|
|
|
|
+ public void loadKuaishouImageTaskFile() {
|
|
|
|
+ String nowDate = DateUtils.getDate("yyyy-MM-dd");
|
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
|
|
+ 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));
|
|
|
|
+ }
|
|
|
|
+ // 查询快手token
|
|
|
|
+ }
|
|
|
|
+
|
|
@Test
|
|
@Test
|
|
- public void testLoadBytedanceImageData(){
|
|
|
|
- List<CtopOauthToken>tokens = tokenService.selectToutiaoToken();
|
|
|
|
|
|
+ public void testLoadBytedanceImageData() {
|
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
countDownLatch = new CountDownLatch(tokens.size());
|
|
countDownLatch = new CountDownLatch(tokens.size());
|
|
executorService = Executors.newFixedThreadPool(8);
|
|
executorService = Executors.newFixedThreadPool(8);
|
|
- tokens.forEach(token->executorService.submit(()->{
|
|
|
|
|
|
+ tokens.forEach(token -> executorService.submit(() -> {
|
|
try {
|
|
try {
|
|
advertiserDataService.getMaterialList(token);
|
|
advertiserDataService.getMaterialList(token);
|
|
- }catch (Exception e){
|
|
|
|
- }finally {
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ } finally {
|
|
countDownLatch.countDown();
|
|
countDownLatch.countDown();
|
|
}
|
|
}
|
|
}));
|
|
}));
|
|
@@ -237,7 +285,11 @@ public class SampleTest {
|
|
}
|
|
}
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private KuaishouAgentAccountMapper kuaishouAgentAccountMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
private IKuaishouReportDailyAgentService kuaishouReportDailyAgentService;
|
|
private IKuaishouReportDailyAgentService kuaishouReportDailyAgentService;
|
|
|
|
+
|
|
@Test
|
|
@Test
|
|
public void loadKuaishouAgentData() throws JsonProcessingException {
|
|
public void loadKuaishouAgentData() throws JsonProcessingException {
|
|
kuaishouReportDailyAgentService.loginAgent();
|
|
kuaishouReportDailyAgentService.loginAgent();
|
|
@@ -254,13 +306,14 @@ public class SampleTest {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private IKuaishouInterfaceService kuaishouInterfaceService;
|
|
private IKuaishouInterfaceService kuaishouInterfaceService;
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void loadKuaishouGroupData() throws ParseException {
|
|
public void loadKuaishouGroupData() throws ParseException {
|
|
Date endDate = new Date();
|
|
Date endDate = new Date();
|
|
- String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
|
|
|
|
|
|
+ String anotherDay = getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
|
|
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
|
|
SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
|
|
Date startDate = sim.parse(anotherDay);
|
|
Date startDate = sim.parse(anotherDay);
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(7087890L);
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(7087890L);
|
|
@@ -268,6 +321,18 @@ public class SampleTest {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ @Test
|
|
|
|
+ public void loadAccountData() {
|
|
|
|
+// 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
|
|
IUReportExportService uReportExportService;
|
|
IUReportExportService uReportExportService;
|
|
@Autowired
|
|
@Autowired
|
|
@@ -275,11 +340,23 @@ public class SampleTest {
|
|
@Autowired
|
|
@Autowired
|
|
IUReportService uReportService;
|
|
IUReportService uReportService;
|
|
|
|
|
|
|
|
+ @Test
|
|
|
|
+ public void loadBytedanceData() {
|
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private IBytedanceReportService bytedanceReportService;
|
|
private IBytedanceReportService bytedanceReportService;
|
|
|
|
+
|
|
@Test
|
|
@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());
|
|
countDownLatch = new CountDownLatch(allocations.size());
|
|
executorService = Executors.newFixedThreadPool(2);
|
|
executorService = Executors.newFixedThreadPool(2);
|
|
allocations.forEach(allocation -> {
|
|
allocations.forEach(allocation -> {
|