|
@@ -3,10 +3,8 @@ package org.jeecg;
|
|
import cn.com.ctop.common.module.entity.BindAccountLogin;
|
|
import cn.com.ctop.common.module.entity.BindAccountLogin;
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
import cn.com.ctop.common.module.entity.CtopOauthToken;
|
|
import cn.com.ctop.common.module.entity.UserAllocation;
|
|
import cn.com.ctop.common.module.entity.UserAllocation;
|
|
-import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
|
|
|
|
import cn.com.ctop.common.module.service.IBindAccountLoginService;
|
|
import cn.com.ctop.common.module.service.IBindAccountLoginService;
|
|
import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
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.service.IUserAllocationService;
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountTargetTemplate;
|
|
import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountTargetTemplate;
|
|
@@ -15,15 +13,18 @@ import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouNewCreateCampaign;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.*;
|
|
import cn.com.ctop.kuaishou.modules.batch.service.*;
|
|
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.service.IKuaishouReportDailyAgentService;
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyImageService;
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaishouVideoEtlInfoService;
|
|
import cn.com.ctop.kuaishou.modules.report.service.IKuaishouVideoEtlInfoService;
|
|
import cn.com.ctop.kuaishou.modules.report.service.IRuleKuaiShouPlanService;
|
|
import cn.com.ctop.kuaishou.modules.report.service.IRuleKuaiShouPlanService;
|
|
import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
|
|
import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
|
|
import cn.com.ctop.oa.modules.service.IWechatNoListService;
|
|
import cn.com.ctop.oa.modules.service.IWechatNoListService;
|
|
import cn.com.ctop.oa.modules.service.IWechatUserListService;
|
|
import cn.com.ctop.oa.modules.service.IWechatUserListService;
|
|
|
|
+import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
|
|
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.entity.BytedanceAccountReportTaskRecord;
|
|
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.mapper.BytedanceReportMaterialDailyMapper;
|
|
import cn.com.ctop.toutiao.modules.report.service.*;
|
|
import cn.com.ctop.toutiao.modules.report.service.*;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.jeecg.common.util.DateUtils;
|
|
import org.jeecg.common.util.DateUtils;
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
@@ -47,7 +48,7 @@ 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("dev")
|
|
@Slf4j
|
|
@Slf4j
|
|
public class SampleTest {
|
|
public class SampleTest {
|
|
@Autowired
|
|
@Autowired
|
|
@@ -66,42 +67,36 @@ public class SampleTest {
|
|
private IBindAccountLoginService bindAccountLoginService;
|
|
private IBindAccountLoginService bindAccountLoginService;
|
|
@Autowired
|
|
@Autowired
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
- @Autowired
|
|
|
|
- private IOauthConfigService configService;
|
|
|
|
- @Autowired
|
|
|
|
- private CtopOauthTokenMapper oauthTokenMapper;
|
|
|
|
- @Autowired
|
|
|
|
- private IKuaishouInterfaceService iKuaishouInterfaceService;
|
|
|
|
|
|
+ /* @Autowired
|
|
|
|
+ private IByteDanceAdvertiserDataService advertiserDataService;
|
|
|
|
+
|
|
|
|
+*/
|
|
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
public void loadBytedanceCreativeData() throws ParseException {
|
|
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获取数据返回结果为空----------------------------------");
|
|
|
|
- }*/
|
|
|
|
|
|
+ // 1662234704806924
|
|
|
|
+ /* CtopOauthToken token = new CtopOauthToken();
|
|
|
|
+ token.setAccountId(9549277L);
|
|
|
|
+ token.setAccessToken("bc5327c8f2bd8a67513e51148c9206c8");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ Date parse = simpleDateFormat.parse("2021-02-02");
|
|
|
|
+ kuaishouInterfaceService.getAdvertiserReportDaily(token, parse, parse);*/
|
|
|
|
|
|
- /* Map<Long, String> configMap = configService.getConfigMapByMediaId(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT);
|
|
|
|
- System.err.println(configMap);*/
|
|
|
|
|
|
+ CtopOauthToken token = new CtopOauthToken();
|
|
|
|
+ token.setAccountId(9767055L);
|
|
|
|
+ token.setAccessToken("28e4e6b124e1443d6971ba4c699de6c9");
|
|
|
|
|
|
|
|
+ kuaishouInterfaceService.getVideoList(token, null, null);
|
|
|
|
+ kuaishouInterfaceService.getVideoInfo("28e4e6b124e1443d6971ba4c699de6c9",9767055L,"5208131540349742192");
|
|
|
|
|
|
- /* List<KuaiShouVideoGet> KuaiShouVideoGets = videoGetService.selectPhotoIdsByAccountId(9743746L);
|
|
|
|
|
|
+ /* CtopOauthToken tokenByAccountId = tokenService.getTokenByAccountId(1662234704806924L);
|
|
|
|
+ advertiserDataService.getMaterialList(tokenByAccountId);*/
|
|
|
|
+ /* getVideoByPage(token, "", 1);
|
|
|
|
+ List<KuaiShouVideoGet> KuaiShouVideoGets = videoGetService.selectPhotoIdsByAccountId(9743746L);
|
|
if (!Check.isNull(KuaiShouVideoGets)) {
|
|
if (!Check.isNull(KuaiShouVideoGets)) {
|
|
JSONArray dateList = new JSONArray();
|
|
JSONArray dateList = new JSONArray();
|
|
JSONArray photoIds = new JSONArray();
|
|
JSONArray photoIds = new JSONArray();
|
|
@@ -290,16 +285,6 @@ public class SampleTest {
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@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() {
|
|
public void loadKuaishouAgentData() {
|
|
kuaishouReportDailyAgentService.loginAgent();
|
|
kuaishouReportDailyAgentService.loginAgent();
|
|
try {
|
|
try {
|
|
@@ -534,17 +519,181 @@ public class SampleTest {
|
|
// aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2,50);
|
|
// aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2,50);
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
+ /**
|
|
|
|
+ * 120002
|
|
|
|
+ * 150001
|
|
|
|
+ * 150002
|
|
|
|
+ * 150003
|
|
|
|
+ * 150004
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ AiKuaishouAccountTargetTemplate accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(120002);
|
|
|
|
+ aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2, 250);
|
|
|
|
+ accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(150001);
|
|
|
|
+ aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2, 250);
|
|
|
|
+ accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(150002);
|
|
|
|
+ aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2, 250);
|
|
|
|
+ accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(150003);
|
|
|
|
+ aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2, 250);
|
|
|
|
+ accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(150004);
|
|
|
|
+ aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2, 250);
|
|
|
|
+ }
|
|
|
|
|
|
- AiKuaishouAccountTargetTemplate accountTargetTemplate2 = aiKuaishouAccountTargetTemplateService.getById(120001);
|
|
|
|
- aiKuaishouNewCreateCampaign.kuaishouAiAddNewMaterialCreativity(accountTargetTemplate2, 1);
|
|
|
|
|
|
+ @Test
|
|
|
|
+ public void testLoadBytedanceDataV2(){
|
|
|
|
+ String accountIds=
|
|
|
|
+ "1675440464386062," +
|
|
|
|
+ "1688606248211533," +
|
|
|
|
+ "1669181787105294," +
|
|
|
|
+ "1687571097467912," +
|
|
|
|
+ "1650079154438157," +
|
|
|
|
+ "1680697900744711," +
|
|
|
|
+ "1678156679964680," +
|
|
|
|
+ "1670727177043982," +
|
|
|
|
+ "1676160388944910," +
|
|
|
|
+ "1687559760306190," +
|
|
|
|
+ "1687382871519240," +
|
|
|
|
+ "1680312075164686," +
|
|
|
|
+ "1675440465991688," +
|
|
|
|
+ "1664657972166663," +
|
|
|
|
+ "1688193173408782," +
|
|
|
|
+ "1675616147056647," +
|
|
|
|
+ "1687308848716814," +
|
|
|
|
+ "1686394621234247," +
|
|
|
|
+ "1683594409340935," +
|
|
|
|
+ "1683676478859341," +
|
|
|
|
+ "1686384860112904," +
|
|
|
|
+ "1668290872519693," +
|
|
|
|
+ "1674063202781191," +
|
|
|
|
+ "1685024266033160," +
|
|
|
|
+ "1669714891201544," +
|
|
|
|
+ "1687758256277512," +
|
|
|
|
+ "1675434231118856," +
|
|
|
|
+ "1686394621807687," +
|
|
|
|
+ "1678411706704903," +
|
|
|
|
+ "1686223489547271," +
|
|
|
|
+ "1660120711467022," +
|
|
|
|
+ "1686833795211278," +
|
|
|
|
+ "1680697899143175," +
|
|
|
|
+ "1661313994984462," +
|
|
|
|
+ "1661313995480077," +
|
|
|
|
+ "1636295780727820," +
|
|
|
|
+ "1676540490482759," +
|
|
|
|
+ "1675342904713223," +
|
|
|
|
+ "1686771461984327," +
|
|
|
|
+ "1685841129360391," +
|
|
|
|
+ "1683676477736973," +
|
|
|
|
+ "1661313994470413," +
|
|
|
|
+ "1663465141771272," +
|
|
|
|
+ "1687758256732174," +
|
|
|
|
+ "1686223482927117," +
|
|
|
|
+ "1686835166313479," +
|
|
|
|
+ "1642648003678215," +
|
|
|
|
+ "1639753233213454," +
|
|
|
|
+ "1675239584963662," +
|
|
|
|
+ "1674634579279885," +
|
|
|
|
+ "1650263841162253," +
|
|
|
|
+ "1672178052130888";
|
|
|
|
+ String [] accountArray = accountIds.split(",");
|
|
|
|
+ for (int i=0;i<accountArray.length;i++){
|
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(Long.parseLong(accountArray[i]));
|
|
|
|
+
|
|
|
|
+ reportService.getAdvertiserReport(token, DateUtils.parseDate("2021-01-14","yyyy-MM-dd"), DateUtils.parseDate("2021-01-14","yyyy-MM-dd"),CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private IBytedancePlanDailyReportService planDailyReportService;
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
|
|
+ public void checkBytedanceReport(){
|
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(1678959391271949L);
|
|
|
|
+ String startDate = "2021-01-01 00:00:00";
|
|
|
|
+ String endDate = "2021-01-31 00:00:00";
|
|
|
|
+ bytedanceReportService.checkoutData(token,startDate,endDate);
|
|
|
|
+ }
|
|
|
|
+ @Test
|
|
public void etlKuaishouProjectData() {
|
|
public void etlKuaishouProjectData() {
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(1660666858777607L);
|
|
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);
|
|
reportService.getAdvertiserPlanReport(token, DateUtils.parseDate("2021-01-25", "yyyy-MM-dd"), DateUtils.parseDate("2021-01-25", "yyyy-MM-dd"), CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ IBytedanceVideoReportService bytedanceVideoReportService;
|
|
|
|
+
|
|
|
|
+ @Test
|
|
|
|
+ public void etlBytedanceVideoReport() {
|
|
|
|
+
|
|
|
|
+ for (int i = 27; i <= 35; i++) {
|
|
|
|
+ etlBytedanceVideo(DateUtils.formatDate(DateUtils.addDay(new Date(), -i)));
|
|
|
|
+ }
|
|
|
|
+ //etlBytedanceVideo("2021-02-03");
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void etlBytedanceVideo(String statDate) {
|
|
|
|
+ List<CtopOauthToken> tokens = oauthTokenService.selectToutiaoToken();
|
|
|
|
+ executorService = Executors.newFixedThreadPool(10);
|
|
|
|
+ countDownLatch = new CountDownLatch(tokens.size());
|
|
|
|
+ tokens.forEach(token -> executorService.submit(() -> {
|
|
|
|
+ try {
|
|
|
|
+ Long[] materials={6904990807503634445L,6904990807503634445L};
|
|
|
|
+ bytedanceVideoReportService.pullVideoReportByMaterialId(token, statDate, statDate, materials,1);
|
|
|
|
+ //bytedanceVideoReportService.pullVideoReport(token, statDate, statDate, 1);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+
|
|
|
|
+ } finally {
|
|
|
|
+ countDownLatch.countDown();
|
|
|
|
+ }
|
|
|
|
+ }));
|
|
|
|
+ try {
|
|
|
|
+ countDownLatch.await();
|
|
|
|
+ } catch (InterruptedException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ IETLReportBytedanceVideoService ietlReportBytedanceVideoService;
|
|
|
|
+
|
|
|
|
+ @Test
|
|
|
|
+ public void etlBytedanceVideoReportClean() {
|
|
|
|
+ //for (int i = 1; i <= 1; i++) {
|
|
|
|
+ // String statDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -i));
|
|
|
|
+ ietlReportBytedanceVideoService.cleanETL("2020-12-31");
|
|
|
|
+ //}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test
|
|
|
|
+ public void etlBytedanceVideoReportClean1() {
|
|
|
|
+
|
|
|
|
+ for (int i = 3; i <= 31; i++) {
|
|
|
|
+ String statDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -i));
|
|
|
|
+ ietlReportBytedanceVideoService.cleanETL(statDate);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ IKuaishouReportDailyImageService kuaishouReportDailyImageService;
|
|
|
|
+
|
|
|
|
+ @Test
|
|
|
|
+ public void loadKuaiShouImage() {
|
|
|
|
+ List<CtopOauthToken> tokens = oauthTokenService.selectKuaiShouToken();
|
|
|
|
+ executorService = Executors.newFixedThreadPool(22);
|
|
|
|
+ countDownLatch = new CountDownLatch(tokens.size());
|
|
|
|
+ tokens.forEach(token -> executorService.submit(() -> {
|
|
|
|
+ try {
|
|
|
|
+ kuaishouReportDailyImageService.getMaterialImageReport(token.getAccountId(),token.getAccessToken(), "2021-01-17", "2021-01-31", 1);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+
|
|
|
|
+ } finally {
|
|
|
|
+ countDownLatch.countDown();
|
|
|
|
+ }
|
|
|
|
+ }));
|
|
|
|
+ try {
|
|
|
|
+ countDownLatch.await();
|
|
|
|
+ } catch (InterruptedException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|