|
@@ -1,23 +1,29 @@
|
|
|
package org.jeecg;
|
|
|
|
|
|
-import cn.com.ctop.check.component.execute.GroovyScriptExecutor;
|
|
|
-import cn.com.ctop.check.entity.CtopCheckTaskList;
|
|
|
-import cn.com.ctop.check.service.ICtopCheckTaskListService;
|
|
|
import cn.com.ctop.common.module.entity.BindAccountLogin;
|
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
|
import cn.com.ctop.common.module.entity.UserAllocation;
|
|
|
-import cn.com.ctop.common.module.message.handle.impl.EmailSendMsgHandle;
|
|
|
-import cn.com.ctop.common.module.service.*;
|
|
|
+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.service.IOauthConfigService;
|
|
|
+import cn.com.ctop.common.module.service.IUserAllocationService;
|
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
|
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
|
|
|
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
|
|
|
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
|
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountTargetTemplate;
|
|
|
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountTargetTemplateService;
|
|
|
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouNewCreateCampaign;
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.service.*;
|
|
|
import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
|
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
|
|
|
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouVideoEtlInfoService;
|
|
|
+import cn.com.ctop.kuaishou.modules.report.service.IRuleKuaiShouPlanService;
|
|
|
+import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
|
|
|
+import cn.com.ctop.oa.modules.service.IWechatNoListService;
|
|
|
+import cn.com.ctop.oa.modules.service.IWechatUserListService;
|
|
|
import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
|
|
|
-import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
|
|
|
-import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
|
|
|
-import cn.com.ctop.toutiao.modules.report.service.IReportService;
|
|
|
+import cn.com.ctop.toutiao.modules.report.entity.BytedanceAccountReportTaskRecord;
|
|
|
+import cn.com.ctop.toutiao.modules.report.mapper.BytedanceReportMaterialDailyMapper;
|
|
|
+import cn.com.ctop.toutiao.modules.report.service.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
import org.junit.Test;
|
|
@@ -27,6 +33,8 @@ import org.springframework.boot.test.context.SpringBootTest;
|
|
|
import org.springframework.test.context.ActiveProfiles;
|
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
@@ -35,6 +43,8 @@ import java.util.concurrent.CountDownLatch;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
|
|
|
|
+import static org.jeecg.common.util.DateUtils.getAnotherDay;
|
|
|
+
|
|
|
@RunWith(SpringRunner.class)
|
|
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
|
|
@ActiveProfiles("wps")
|
|
@@ -43,65 +53,77 @@ public class SampleTest {
|
|
|
@Autowired
|
|
|
private ICtopOauthTokenService oauthTokenService;
|
|
|
@Autowired
|
|
|
- private IKuaishouReportDailyAgentService kuaishouReportDailyAgentService;
|
|
|
- @Autowired
|
|
|
private IReportService reportService;
|
|
|
@Autowired
|
|
|
private IByteDanceAdvertiserDataService advertiserDataService;
|
|
|
@Autowired
|
|
|
- private IKuaiShouHistoryReportTaskService kuaiShouHistoryReportTaskService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
private ICtopOauthTokenService tokenService;
|
|
|
@Autowired
|
|
|
- private IRefreshTokenService refreshTokenService;
|
|
|
-
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IKuaishouInterfaceService kuaishouInterfaceService;
|
|
|
+ private IKuaiShouVideoGetService videoGetService;
|
|
|
@Autowired
|
|
|
- private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
|
|
|
-
|
|
|
-
|
|
|
- @Test
|
|
|
- public void getData() {
|
|
|
- //1:查询当日数据
|
|
|
- List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
|
- Date endDate = new Date();
|
|
|
- for (int i = 0; i < 8; i++) {
|
|
|
- Date getStartDate = DateUtils.addDay(endDate, -i);
|
|
|
- for (CtopOauthToken token : tokens) {
|
|
|
- kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getStartDate, getStartDate);
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- String format = simpleDateFormat.format(getStartDate);
|
|
|
- kuaiShouReportDailyMaterialService.getMaterialReportByAccountIdAndStatDate(token.getAccountId(), token.getAccessToken(), format, format, 1);
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void loadBytedanceCreativeData() {
|
|
|
- refreshTokenService.getKuaiShouRefresh();
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void getTaskList() {
|
|
|
- kuaiShouHistoryReportTaskService.getTaskList();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ private IKuaishouVideoRelateCreativesService kuaishouVideoRelateCreativesService;
|
|
|
@Autowired
|
|
|
private IBindAccountLoginService bindAccountLoginService;
|
|
|
@Autowired
|
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
|
+ @Autowired
|
|
|
+ private IOauthConfigService configService;
|
|
|
+ @Autowired
|
|
|
+ private CtopOauthTokenMapper oauthTokenMapper;
|
|
|
+ @Autowired
|
|
|
+ private IKuaishouInterfaceService iKuaishouInterfaceService;
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ @Test
|
|
|
+ public void loadBytedanceCreativeData() throws ParseException {
|
|
|
+ CtopOauthToken token = oauthTokenMapper.selectByAccountId(9784689L);
|
|
|
+
|
|
|
+ iKuaishouInterfaceService.getVideoList(token, null, null);
|
|
|
+
|
|
|
+ /* List<CtopOauthToken> oauthTokens = oauthTokenMapper.selectKuaiShouTokens(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
|
|
|
+ if (!Check.isNull(oauthTokens)) {
|
|
|
+ Map<Long, String> configMap = configService.getConfigMapByMediaId(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT);
|
|
|
+ for (CtopOauthToken oauthToken : oauthTokens) {
|
|
|
+ XxlJobHelper.log("刷新token,accountId:{}", oauthToken.getAccountId());
|
|
|
+ //快手
|
|
|
+ if (CtopAdConstant.PLATFORM_TYPE_KUAISHOU.equals(oauthToken.getMediaId().trim())) {
|
|
|
+ String secret = configMap.get(oauthToken.getAppId());
|
|
|
+ System.err.println(secret);
|
|
|
+ oauthTokenService.getKuaiShouRefreshToken(oauthToken.getAccountId(), oauthToken.getAccessToken(), oauthToken.getRefreshToken(), oauthToken.getAppId(), secret);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ XxlJobHelper.log("----------------------刷新token获取数据返回结果为空----------------------------------");
|
|
|
+ }*/
|
|
|
+
|
|
|
+
|
|
|
+ /* Map<Long, String> configMap = configService.getConfigMapByMediaId(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT);
|
|
|
+ System.err.println(configMap);*/
|
|
|
+
|
|
|
+
|
|
|
+ /* List<KuaiShouVideoGet> KuaiShouVideoGets = videoGetService.selectPhotoIdsByAccountId(9743746L);
|
|
|
+ if (!Check.isNull(KuaiShouVideoGets)) {
|
|
|
+ JSONArray dateList = new JSONArray();
|
|
|
+ JSONArray photoIds = new JSONArray();
|
|
|
+ Map<String, Object> statdateMap = new HashMap<>();
|
|
|
+ int count = 0;
|
|
|
+ for (KuaiShouVideoGet video : KuaiShouVideoGets) {
|
|
|
+ count++;
|
|
|
+ if (count < 10) {
|
|
|
+ photoIds.add(video.getPhotoId());
|
|
|
+ statdateMap.put(video.getPhotoId(), video.getStatDate());
|
|
|
+ } else {
|
|
|
+ photoIds.add(video.getPhotoId());
|
|
|
+ statdateMap.put(video.getPhotoId(), video.getStatDate());
|
|
|
+ dateList.add(photoIds);
|
|
|
+ photoIds = new JSONArray();
|
|
|
+ count = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dateList.add(photoIds);
|
|
|
+ kuaishouVideoRelateCreativesService.videoRelateCreatives(9743746L, dateList, statdateMap);
|
|
|
+ }*/
|
|
|
+ }
|
|
|
|
|
|
@Test
|
|
|
public void loadKuaishouCookie() {
|
|
@@ -110,9 +132,6 @@ public class SampleTest {
|
|
|
int i = 0;
|
|
|
for (BindAccountLogin login : list) {
|
|
|
if (null == login.getCookie() || "".equals(login.getCookie().trim())) {
|
|
|
- if (i > 5) {
|
|
|
- break;
|
|
|
- }
|
|
|
kuaishouWebInterfaceService.getkuaishouWebLoginCookie(login);
|
|
|
i++;
|
|
|
}
|
|
@@ -121,7 +140,6 @@ public class SampleTest {
|
|
|
}
|
|
|
|
|
|
static ExecutorService executorService = null;
|
|
|
- //线程计数器/bytedance/bytedanceMaterialReport
|
|
|
static CountDownLatch countDownLatch = null;
|
|
|
|
|
|
@Test
|
|
@@ -156,24 +174,134 @@ public class SampleTest {
|
|
|
@Test
|
|
|
public void testLoadBytedanceData() {
|
|
|
List<UserAllocation> allocations = allocationService.getByParams(633L, null, 0);
|
|
|
- for (UserAllocation allocation : allocations) {
|
|
|
-// for (int i = 2; i < 10; i++) {
|
|
|
- CtopOauthToken token = oauthTokenService.getTokenByAccountId(allocation.getAccountId());
|
|
|
- Date getDate = DateUtils.addDay(new Date(), 0);
|
|
|
-// reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
- reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
-// }
|
|
|
+ if (null != allocations && !allocations.isEmpty()) {
|
|
|
+ for (UserAllocation allocation : allocations) {
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
|
|
|
+ String startDate = "2020-11-10";
|
|
|
+ String endDate = "2020-11-10";
|
|
|
+ reportService.getAdvertiserReport(token, DateUtils.parseDate(startDate, "yyyy-MM-dd"), DateUtils.parseDate(endDate, "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println("任务结束");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void loadKuaishouPlanData() {
|
|
|
+ Date getDate = DateUtils.addDay(new Date(), -1);
|
|
|
+ //1:查询当日数据
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
|
+ tokens.forEach(token -> kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getDate, getDate));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBytedanceFundDailyService bytedanceFundDailyService;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void loadFoudData() {
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
|
+ 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 + "############################");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IKuaiShouHistoryReportTaskService reportTaskService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 测试获取快手图片消耗数据任务
|
|
|
+ */
|
|
|
+ @Test
|
|
|
+ public void loadKuaishouImageTask() {
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
|
+ for (int i = 1; i < 130; i++) {
|
|
|
+ Date getDate = DateUtils.addDay(new Date(), -i);
|
|
|
+ String getDateStr = DateUtils.formatDate(getDate);
|
|
|
+ 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
|
|
|
+ public void testLoadBytedanceImageData() {
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
|
+ countDownLatch = new CountDownLatch(tokens.size());
|
|
|
+ executorService = Executors.newFixedThreadPool(8);
|
|
|
+ tokens.forEach(token -> executorService.submit(() -> {
|
|
|
+ try {
|
|
|
+ advertiserDataService.getMaterialList(token);
|
|
|
+ } catch (Exception e) {
|
|
|
+ } finally {
|
|
|
+ countDownLatch.countDown();
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ try {
|
|
|
+ countDownLatch.await();
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ System.out.println("素材数据获取完成");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IKuaishouReportDailyAgentService kuaishouReportDailyAgentService;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testData() {
|
|
|
+ Date date = new Date();
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
|
+ executorService = Executors.newFixedThreadPool(10);
|
|
|
+ countDownLatch = new CountDownLatch(tokens.size());
|
|
|
+ tokens.forEach(token -> executorService.submit(() -> {
|
|
|
+ try {
|
|
|
+ reportService.getAdvertiserPlanRuleData(token, date, date, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ } finally {
|
|
|
+ countDownLatch.countDown();
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ try {
|
|
|
+ countDownLatch.await();
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testData11() {
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(9556344L);
|
|
|
+ int dimeDiff = 5;
|
|
|
+ Date now = new Date();
|
|
|
+ String startTime = DateUtils.formatDate("2021-01-11 18:25:00");
|
|
|
+ String endTime = DateUtils.formatDate(now, "2021-01-11 18:35:00");
|
|
|
+ kuaishouInterfaceService.getSuZaoList(token.getAccessToken(), token.getAccountId(), 1, startTime, endTime);
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
public void loadKuaishouAgentData() {
|
|
|
kuaishouReportDailyAgentService.loginAgent();
|
|
|
-// for (int i = 0; i < 20; i++) {
|
|
|
-// String currentDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -i));
|
|
|
-// kuaishouReportDailyAgentService.getReport(currentDate, DateUtils.getNowDate("yyyy-MM-dd"));
|
|
|
-// }
|
|
|
-//
|
|
|
try {
|
|
|
for (int i = 1; i < 30; i++) {
|
|
|
kuaishouReportDailyAgentService.getAccount(i);
|
|
@@ -183,22 +311,58 @@ public class SampleTest {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
- private GroovyScriptExecutor groovyScriptExecutor;
|
|
|
+ @Test
|
|
|
+ public void loadKuaishouData() {
|
|
|
+ Date getDate = DateUtils.addDay(new Date(), -1);
|
|
|
+ //1:查询当日数据
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
|
+ for (CtopOauthToken token : tokens) {
|
|
|
+ kuaishouInterfaceService.getAdvertiserCampaignReportDaily(token, getDate, getDate);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
@Autowired
|
|
|
- private ICtopCheckTaskListService checkTaskListService;
|
|
|
+ private IBytedanceReportService bytedanceReportService;
|
|
|
|
|
|
@Test
|
|
|
- public void checkDataStateJobTest() {
|
|
|
- //查询需要检查的任务列表
|
|
|
- List<CtopCheckTaskList> ctopCheckTaskList = checkTaskListService.queryExecuteList("checkDataStateJob");
|
|
|
- if (ctopCheckTaskList != null) {
|
|
|
- ctopCheckTaskList.forEach(it -> groovyScriptExecutor.execute(it));
|
|
|
+ public void loadBytedanceVideoReportData() {
|
|
|
+ Date getDate = DateUtils.addDay(new Date(), -1);
|
|
|
+ String date = DateUtils.formatDate(getDate);
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
|
|
|
+ for (CtopOauthToken token : tokens) {
|
|
|
+ bytedanceReportService.bytedanceVideoMaterialReport(token, date, date);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
+ public void loadKuaishouHourlyReportData() {
|
|
|
+ Date getDate = new Date();
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
|
|
|
+ String hour = simpleDateFormat.format(getDate);
|
|
|
+ if ("00".equals(hour)) {
|
|
|
+ getDate = DateUtils.addDay(getDate, -1);
|
|
|
+ }
|
|
|
+ //1:查询当日数据
|
|
|
+ List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
|
|
|
+ Date finalGetDate = getDate;
|
|
|
+ tokens.forEach(token -> kuaishouInterfaceService.getAdvertiserReportHourly(token, finalGetDate, finalGetDate));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IKuaishouInterfaceService kuaishouInterfaceService;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void loadKuaishouGroupData() throws ParseException {
|
|
|
+ Date endDate = new Date();
|
|
|
+ String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
|
|
|
+ SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date startDate = sim.parse(anotherDay);
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(7087890L);
|
|
|
+ kuaishouInterfaceService.getGroupList(token, startDate, endDate);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Test
|
|
|
public void loadAccountData() {
|
|
|
// List<UserAllocation> allocations = allocationService.getByParams(776L,null,0);
|
|
|
// for (UserAllocation allocation:allocations) {
|
|
@@ -211,27 +375,40 @@ public class SampleTest {
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
|
- IUReportExportService uReportExportService;
|
|
|
+ private IWechatCheckinDataService wechatCheckinDataService;
|
|
|
@Autowired
|
|
|
- EmailSendMsgHandle emailSendMsgHandle;
|
|
|
+ private IWechatUserListService wechatUserInfoService;
|
|
|
@Autowired
|
|
|
- IUReportService uReportService;
|
|
|
+ private IWechatNoListService wechatNoListService;
|
|
|
|
|
|
@Test
|
|
|
- public void loadBytedanceData() {
|
|
|
- List<UserAllocation> allocations = allocationService.getByParams(633L, null, 0);
|
|
|
- for (int i = 0; i < allocations.size(); i++) {
|
|
|
- CtopOauthToken token = tokenService.getTokenByAccountId(allocations.get(i).getAccountId());
|
|
|
- for (int j = 10; j < 110; j++) {
|
|
|
- Date getDate = DateUtils.addDay(new Date(), -j);
|
|
|
- reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
- }
|
|
|
- }
|
|
|
+ public void getData() {
|
|
|
+ //汇创 人员
|
|
|
+// wechatUserInfoService.getUserList();
|
|
|
+// //考勤记录
|
|
|
+// wechatCheckinDataService.getCheckinData("2020-11-01 00:00:00", "2020-12-01 23:59:59");
|
|
|
+ //异常记录
|
|
|
+// wechatNoListService.getNoDateByNo("2020-11-01 00:00:00", "2020-12-01 23:59:59", "0");
|
|
|
+ //优容
|
|
|
+ wechatUserInfoService.getYRUserList();
|
|
|
+ wechatCheckinDataService.getYRCheckinData("2020-11-01 00:00:00", "2020-11-30 23:59:59");
|
|
|
+ wechatNoListService.getNoDateByNo("2020-11-01 00:00:00", "2020-12-01 23:59:59", "1");
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IKuaiShouCommentService kuaiShouCommentService;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void kuaishouDeleteComment() {
|
|
|
+ kuaiShouCommentService.shieldComment(8018853L);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IByteDanceVideoReportDailyService videoReportDailyService;
|
|
|
+
|
|
|
@Test
|
|
|
- public void loaddata() {
|
|
|
- for (int i = 0; i < 30; i++) {
|
|
|
+ public void formatVideoReportData() {
|
|
|
+ for (int i = 1; i < 45; i++) {
|
|
|
Date getDate = DateUtils.addDay(new Date(), -i);
|
|
|
String date = DateUtils.formatDate(getDate);
|
|
|
videoReportDailyService.videoInfoList(date, date);
|
|
@@ -239,36 +416,135 @@ public class SampleTest {
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
|
- private IBytedanceReportService bytedanceReportService;
|
|
|
+ private IRuleKuaiShouPlanService ruleKuaiShouPlanService;
|
|
|
|
|
|
@Autowired
|
|
|
- private IByteDanceVideoReportDailyService videoReportDailyService;
|
|
|
+ private IBytedanceAccountReportTaskRecordService reportTaskRecordService;
|
|
|
|
|
|
@Test
|
|
|
- public void loadMatData() {
|
|
|
- List<UserAllocation> allocations = allocationService.getByParams(320L, null, 0);
|
|
|
- countDownLatch = new CountDownLatch(allocations.size());
|
|
|
- executorService = Executors.newFixedThreadPool(2);
|
|
|
- allocations.forEach(allocation -> {
|
|
|
- executorService.submit(new Runnable() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- try {
|
|
|
- CtopOauthToken token = tokenService.getTokenByAccountId(allocation.getAccountId());
|
|
|
- //获取全量视频素材数据
|
|
|
- advertiserDataService.getMaterialList(token);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- } finally {
|
|
|
- countDownLatch.countDown();
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- try {
|
|
|
- countDownLatch.await();
|
|
|
- } catch (InterruptedException e) {
|
|
|
- e.printStackTrace();
|
|
|
+ public void execute() {
|
|
|
+ List<UserAllocation> allocations = allocationService.listByMediaId("3", 0);
|
|
|
+ for (UserAllocation allocation : allocations) {
|
|
|
+ BytedanceAccountReportTaskRecord reportTaskRecord1 = new BytedanceAccountReportTaskRecord(allocation.getAccountId(), "2020-10-01", "2020-10-31");
|
|
|
+ reportTaskRecordService.save(reportTaskRecord1);
|
|
|
+ BytedanceAccountReportTaskRecord reportTaskRecord2 = new BytedanceAccountReportTaskRecord(allocation.getAccountId(), "2020-11-01", "2020-11-30");
|
|
|
+ reportTaskRecordService.save(reportTaskRecord2);
|
|
|
+ BytedanceAccountReportTaskRecord reportTaskRecord3 = new BytedanceAccountReportTaskRecord(allocation.getAccountId(), "2020-12-01", "2020-12-31");
|
|
|
+ reportTaskRecordService.save(reportTaskRecord3);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void loadBDAccoutData() {
|
|
|
+ CtopOauthToken token2 = tokenService.getTokenByAccountId(1674206482908163L);
|
|
|
+ bytedanceReportService.bytedanceMaterialReport(token2, "2020-10-14", "2020-10-14");
|
|
|
+ bytedanceReportMaterialDailyMapper.updateImageReportCode();
|
|
|
+ bytedanceReportMaterialDailyMapper.updateImageReportProjectId();
|
|
|
+ bytedanceReportMaterialDailyMapper.updateImageReportProjectName();
|
|
|
+ bytedanceReportMaterialDailyMapper.updateImageReportPlaneId();
|
|
|
+ bytedanceReportMaterialDailyMapper.updateImageReportPlaneName();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private BytedanceReportMaterialDailyMapper bytedanceReportMaterialDailyMapper;
|
|
|
+
|
|
|
+ private void load12AccountData(CtopOauthToken token) {
|
|
|
+ reportService.getAdvertiserReport(token, DateUtils.parseDate("2020-10-01", "yyyy-MM-dd"), DateUtils.parseDate("2020-10-31", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ reportService.getAdvertiserReport(token, DateUtils.parseDate("2020-11-01", "yyyy-MM-dd"), DateUtils.parseDate("2020-11-30", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ reportService.getAdvertiserReport(token, DateUtils.parseDate("2020-12-01", "yyyy-MM-dd"), DateUtils.parseDate("2020-12-31", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void load12Data(CtopOauthToken token) {
|
|
|
+ bytedanceReportService.bytedanceMaterialReport(token, "2020-10-11", "2020-10-13");
|
|
|
+ bytedanceReportService.bytedanceMaterialReport(token, "2020-10-14", "2020-10-16");
|
|
|
+ bytedanceReportService.bytedanceMaterialReport(token, "2020-10-17", "2020-10-19");
|
|
|
+ bytedanceReportService.bytedanceMaterialReport(token, "2020-10-20", "2020-10-21");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IKuaishouVideoEtlInfoService kuaishouVideoEtlInfoService;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void etlKuaishouData() {
|
|
|
+ String dateString = "2021-01-05";
|
|
|
+ Date startDate = DateUtils.parseDate(dateString, "yyyy-MM-dd");
|
|
|
+ for (int i = 0; i <= 10; i++) {
|
|
|
+ Date getDate = DateUtils.addDay(startDate, i);
|
|
|
+ kuaishouVideoEtlInfoService.etlKuaishouVideoInfo(getDate);
|
|
|
+ bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(getDate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBytedanceVideoEtlInfoService bytedanceVideoEtlInfoService;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void loadBytedanceVideo() {
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(1673731601820686L);
|
|
|
+ for (int i = 15; i < 60; i++) {
|
|
|
+ reportService.getAdvertiserReport(token, DateUtils.addDay(new Date(), -i), DateUtils.addDay(new Date(), -i), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void loadKuaishouVideo() {
|
|
|
+ Date date = new Date();
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(9556344L);
|
|
|
+// kuaishouInterfaceService.getAdvertiserCreativeReportDaily(token, new Date(), new Date(), null, null);
|
|
|
+ kuaishouInterfaceService.getVideoList(token, DateUtils.formatDate(DateUtils.addDay(date, -5)), DateUtils.formatDate(date));
|
|
|
+ // 获取图片信息数据
|
|
|
+// kuaishouInterfaceService.getImageList(token, DateUtils.getNowDate("yyyy-MM-dd"));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ IRuleByteDanceAccountService ruleByteDanceAccountService;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void cleanRuleDataAccount() {
|
|
|
+ List<CtopOauthToken> tokens = oauthTokenService.selectKuaiShouToken();
|
|
|
+ for (CtopOauthToken oauthToken : tokens) {
|
|
|
+ ruleKuaiShouPlanService.cleanRuleDataTarget(oauthToken.getAccountId(), 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ IAiKuaishouNewCreateCampaign aiKuaishouNewCreateCampaign;
|
|
|
+ @Autowired
|
|
|
+ private IAiKuaishouAccountTargetTemplateService aiKuaishouAccountTargetTemplateService;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void createPlan() {
|
|
|
+ List<AiKuaishouAccountTargetTemplate> accountTargetTemplates = aiKuaishouAccountTargetTemplateService.getAllEffectTemplate();
|
|
|
+ if (null == accountTargetTemplates || accountTargetTemplates.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ accountTargetTemplates.forEach(targetTemplate -> aiKuaishouNewCreateCampaign.kuaishouAiAdsNewMaterialCreativity(targetTemplate));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testCreatePlan() {
|
|
|
+// List<AiKuaishouAccountTargetTemplate> accountTargetTemplates = aiKuaishouAccountTargetTemplateService.getAllEffectTemplate();
|
|
|
+// if (null == accountTargetTemplates || accountTargetTemplates.isEmpty()) {
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// for (AiKuaishouAccountTargetTemplate template:accountTargetTemplates){
|
|
|
+// if(template.getAccountId()!=9556344L){
|
|
|
+// AiKuaishouAccountTargetTemplate accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getByAccountId(template.getAccountId());
|
|
|
+// aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2,50);
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ AiKuaishouAccountTargetTemplate accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(120001);
|
|
|
+ aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IBytedancePlanDailyReportService planDailyReportService;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void etlKuaishouProjectData() {
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(1660666858777607L);
|
|
|
+ reportService.getAdvertiserPlanReport(token, DateUtils.parseDate("2021-01-25", "yyyy-MM-dd"), DateUtils.parseDate("2021-01-25", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
+ }
|
|
|
}
|