|
@@ -1,18 +1,18 @@
|
|
|
package org.jeecg;
|
|
|
|
|
|
+import cn.com.ctop.common.module.entity.BindAccountLogin;
|
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
|
-import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
|
|
|
+import cn.com.ctop.common.module.service.IBindAccountLoginService;
|
|
|
import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
|
-import cn.com.ctop.common.module.utils.HttpUtils;
|
|
|
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
|
|
|
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
|
-import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
+import cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp;
|
|
|
+import cn.com.ctop.crawler.modules.pangolin.service.PangolinAppService;
|
|
|
+import cn.com.ctop.crawler.modules.pangolin.service.PangolinCrawlerService;
|
|
|
+import cn.com.ctop.crawler.modules.pangolin.service.PangolinLoginService;
|
|
|
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceFundDailyService;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
-import org.jeecg.modules.ctop.service.IPerformanceSaleService;
|
|
|
import org.junit.Test;
|
|
|
import org.junit.runner.RunWith;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -20,132 +20,92 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.CountDownLatch;
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
+import java.util.concurrent.Executors;
|
|
|
|
|
|
@RunWith(SpringRunner.class)
|
|
|
@SpringBootTest
|
|
|
@Slf4j
|
|
|
public class SampleTest {
|
|
|
@Autowired
|
|
|
- private IKuaishouInterfaceService kuaishouInterfaceService;
|
|
|
-
|
|
|
-
|
|
|
+ private IBindAccountLoginService bindAccountLoginService;
|
|
|
@Autowired
|
|
|
- private IKuaiShouHistoryReportTaskService reportTaskService;
|
|
|
+ private PangolinLoginService pangolinLoginService;
|
|
|
@Autowired
|
|
|
- private CtopOauthTokenMapper tokenMapper;
|
|
|
+ private PangolinCrawlerService pangolinCrawlerService;
|
|
|
@Autowired
|
|
|
- private ICtopOauthTokenService oauthTokenService;
|
|
|
-
|
|
|
+ private PangolinAppService pangolinAppService;
|
|
|
@Test
|
|
|
- public void kuaisShouReport() {
|
|
|
- try {
|
|
|
- oauthTokenService.getKuaiShouRefreshToken(4801802L, "3874f4adb984a371cf92e5fc9a585e6b", 1);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ public void testPangolinLogin(){
|
|
|
+ QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("login_type","pangolin");
|
|
|
+ queryWrapper.eq("status",1);
|
|
|
+ List<BindAccountLogin> list = bindAccountLoginService.list(queryWrapper);
|
|
|
+ if(list!=null&&!list.isEmpty()){
|
|
|
+ for (BindAccountLogin login:list) {
|
|
|
+ if(null==login.getCookie()||"".equals(login.getCookie().trim())){
|
|
|
+ pangolinLoginService.pangolinLogin(login.getAccountName(), login.getPassword());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
- private ICtopOauthTokenService tokenService;
|
|
|
@Test
|
|
|
- public void wanHuaTong() {
|
|
|
- String url = "https://ad.oceanengine.com/open_api/2/kaleidoscope/job/smart_cut/submit/";
|
|
|
-
|
|
|
- JSONObject conditions = new JSONObject();
|
|
|
- conditions.put("advertiser_id", "1659671533108238");
|
|
|
- JSONObject job = new JSONObject();
|
|
|
- job.put("job_conf_id", 10);
|
|
|
- JSONArray input = new JSONArray();
|
|
|
- JSONObject inputJson = new JSONObject();
|
|
|
- inputJson.put("task_id", 1);
|
|
|
- JSONArray videoIds = new JSONArray();
|
|
|
- videoIds.add("v02033aa0000bpspgippskdk4jcuso80");
|
|
|
- inputJson.put("video_ids", videoIds);
|
|
|
- JSONArray music_id = new JSONArray();
|
|
|
- JSONArray image_urls = new JSONArray();
|
|
|
- JSONArray texts = new JSONArray();
|
|
|
-
|
|
|
- texts.add("哈哈哈哈,这是一个测试文案");
|
|
|
- inputJson.put("texts", texts);
|
|
|
-
|
|
|
- JSONArray tts = new JSONArray();
|
|
|
- tts.add("true");
|
|
|
- inputJson.put("tts", tts);
|
|
|
-
|
|
|
- JSONArray video_ratio = new JSONArray();
|
|
|
- video_ratio.add("1");
|
|
|
- inputJson.put("video_ratio", video_ratio);
|
|
|
-
|
|
|
-
|
|
|
- JSONArray music_style = new JSONArray();
|
|
|
- music_style.add("1");
|
|
|
- inputJson.put("music_style", music_style);
|
|
|
-
|
|
|
- JSONArray video_duration = new JSONArray();
|
|
|
- video_duration.add("8");
|
|
|
- inputJson.put("video_duration", video_duration);
|
|
|
-
|
|
|
-
|
|
|
- JSONArray speed = new JSONArray();
|
|
|
- speed.add("1.2");
|
|
|
- inputJson.put("speed", speed);
|
|
|
-
|
|
|
- job.put("input", inputJson);
|
|
|
- job.put("mesg", "测试万花筒");
|
|
|
- conditions.put("job", job);
|
|
|
-
|
|
|
-
|
|
|
- JSONObject jsonObject = HttpUtils.bytedancePostRequest("f925c180e05d585f7a9fce048ba62eecc5dab7c2", url, conditions);
|
|
|
- System.err.println(jsonObject);
|
|
|
-
|
|
|
-
|
|
|
+ public void testPangolinData(){
|
|
|
+ QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("login_type", "pangolin");
|
|
|
+ queryWrapper.eq("status", 1);
|
|
|
+ queryWrapper.isNotNull("cookie");
|
|
|
+ List<BindAccountLogin> list = bindAccountLoginService.list(queryWrapper);
|
|
|
+ if (list != null && !list.isEmpty()) {
|
|
|
+ for (BindAccountLogin bindAccountLogin : list) {
|
|
|
+ pangolinCrawlerService.getChannelList(bindAccountLogin);
|
|
|
+ pangolinCrawlerService.getActivationList(bindAccountLogin, DateUtils.getNowDate("yyyy-MM-dd"), 1);
|
|
|
+ pangolinCrawlerService.getCheckList(bindAccountLogin);
|
|
|
+ QueryWrapper<PangolinApp> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.eq("account_name", bindAccountLogin.getAccountName());
|
|
|
+ List<PangolinApp> appList = pangolinAppService.list(queryWrapper1);
|
|
|
+ if (appList != null && !appList.isEmpty()) {
|
|
|
+ appList.forEach(pangolinApp -> pangolinCrawlerService.getRealTimeList(bindAccountLogin, pangolinApp.getId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICtopOauthTokenService tokenService;
|
|
|
+ @Autowired
|
|
|
+ private IBytedanceFundDailyService bytedanceFundDailyService;
|
|
|
+ static ExecutorService executorService = null;
|
|
|
|
|
|
- @Test
|
|
|
- public void testSalePerformance() {
|
|
|
- performanceSaleService.loadSalsePerformance();
|
|
|
- }
|
|
|
|
|
|
@Test
|
|
|
- public void loadBtPlanData() {
|
|
|
+ public void testflowFund(){
|
|
|
List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
|
|
|
+ if (null == tokens || tokens.size() <= 0) {
|
|
|
+ log.error("头条账户流水数据异常:未获取到可用的token");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ CountDownLatch countDownLatch = new CountDownLatch(tokens.size());
|
|
|
+ executorService = Executors.newFixedThreadPool(5);
|
|
|
tokens.forEach(token -> {
|
|
|
- advertiserDataService.getAdvertiserPlan(token, "", null, null);
|
|
|
+ executorService.submit(() -> {
|
|
|
+ try {
|
|
|
+ for(int i=0;i<60;i++){
|
|
|
+ String findDate = DateUtils.addDay(DateUtils.formatDate(),-i);
|
|
|
+ bytedanceFundDailyService.loadFundDataByPage(token, findDate, findDate,1);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ }finally {
|
|
|
+ countDownLatch.countDown();
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
- }
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IByteDanceAdvertiserDataService advertiserDataService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IPerformanceSaleService performanceSaleService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IKuaiShouHistoryReportTaskService historyReportTaskService;
|
|
|
-
|
|
|
- @Test
|
|
|
- public void testLoadData() throws Exception {
|
|
|
- CtopOauthToken token = tokenService.getTokenByAccountId(5473041L);
|
|
|
- String endDateStr = DateUtils.getDate("yyyy-MM-dd");
|
|
|
- String startDate = DateUtils.addMonth(endDateStr, -6);
|
|
|
-
|
|
|
- historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void suZhao() {
|
|
|
- Long accountId = 3917130L;
|
|
|
- String token = "0a42e23921e486108105263e75561404";
|
|
|
-// kuaishouInterfaceService.getVideoList("e91c778d7de1bd0e9d8f3213d1e0e57c",3820093L, null,null,1);
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void testLog() {
|
|
|
try {
|
|
|
- System.out.println(1 / 0);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error(e.getMessage(), e);
|
|
|
+ countDownLatch.await();
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|