|
@@ -1,154 +1,34 @@
|
|
|
package org.jeecg;
|
|
|
|
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
|
-import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
|
|
|
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.toutiao.modules.report.service.IReportService;
|
|
|
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;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
-import java.util.List;
|
|
|
+import java.util.Date;
|
|
|
|
|
|
@RunWith(SpringRunner.class)
|
|
|
@SpringBootTest
|
|
|
@Slf4j
|
|
|
public class SampleTest {
|
|
|
@Autowired
|
|
|
- private IKuaishouInterfaceService kuaishouInterfaceService;
|
|
|
-
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IKuaiShouHistoryReportTaskService reportTaskService;
|
|
|
- @Autowired
|
|
|
- private CtopOauthTokenMapper tokenMapper;
|
|
|
- @Autowired
|
|
|
- private ICtopOauthTokenService oauthTokenService;
|
|
|
-
|
|
|
- @Test
|
|
|
- public void kuaisShouReport() {
|
|
|
- try {
|
|
|
- oauthTokenService.getKuaiShouRefreshToken(4801802L, "3874f4adb984a371cf92e5fc9a585e6b", 1);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @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);
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Test
|
|
|
- public void testSalePerformance() {
|
|
|
- performanceSaleService.loadSalsePerformance();
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void loadBtPlanData() {
|
|
|
- List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
|
|
|
- tokens.forEach(token -> {
|
|
|
- advertiserDataService.getAdvertiserPlan(token, "", null, null);
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- @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);
|
|
|
- }
|
|
|
+ private IReportService reportService;
|
|
|
|
|
|
@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);
|
|
|
- }
|
|
|
+ public void kuaisShouReport() {
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(1666360425745416L);
|
|
|
+ Date getDate = new Date();
|
|
|
+ reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|