123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- 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.entity.UserAllocation;
- import cn.com.ctop.common.module.service.IBindAccountLoginService;
- import cn.com.ctop.common.module.service.ICtopOauthTokenService;
- import cn.com.ctop.common.module.service.IUserAllocationService;
- import cn.com.ctop.common.module.utils.CtopAdConstant;
- import cn.com.ctop.kuaishou.modules.batch.service.*;
- import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
- import cn.com.ctop.kuaishou.modules.material.service.IEtlKuaishouVideoInfoService;
- import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
- import cn.com.ctop.kuaishou.modules.report.service.*;
- 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.link.service.IETLReportBytedanceVideoService;
- import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
- import cn.com.ctop.toutiao.modules.material.service.IByteDanceCampaignService;
- import cn.com.ctop.toutiao.modules.report.entity.BytedanceAccountReportTaskRecord;
- import cn.com.ctop.toutiao.modules.report.service.*;
- import lombok.extern.slf4j.Slf4j;
- import org.jeecg.common.util.DateUtils;
- 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.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;
- import java.util.List;
- 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")
- @Slf4j
- public class SampleTest {
- @Autowired
- private ICtopOauthTokenService tokenService;
- @Autowired
- private IBindAccountLoginService bindAccountLoginService;
- @Autowired
- private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
- @Test
- public void loadKuaishouCookie() {
- List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY, 1);
- if (list != null && !list.isEmpty()) {
- int i = 0;
- for (BindAccountLogin login : list) {
- if (null == login.getCookie() || "".equals(login.getCookie().trim())) {
- kuaishouWebInterfaceService.getkuaishouWebLoginCookie(login);
- i++;
- }
- }
- }
- }
- static ExecutorService executorService = null;
- static CountDownLatch countDownLatch = null;
- @Test
- public void deleteKuaishouComment() {
- Long start = System.currentTimeMillis();
- List<BindAccountLogin> loginList = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY, 1);
- if (loginList != null && !loginList.isEmpty()) {
- executorService = Executors.newFixedThreadPool(5);
- countDownLatch = new CountDownLatch(loginList.size());
- loginList.forEach(login -> executorService.submit(() -> {
- try {
- kuaishouWebInterfaceService.deleteAllComment(new HashMap<>(), login);
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- } finally {
- countDownLatch.countDown();
- }
- }));
- try {
- countDownLatch.await();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- Long end = System.currentTimeMillis();
- log.info("快手删评论所用时长:{}毫秒", end - start);
- }
- }
- @Autowired
- private IBytedanceReportService bytedanceReportService;
- @Test
- 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);
- }
- }
- @Autowired
- private IWechatNoListService wechatNoListService;
- @Test
- public void getData() {
- //汇创 人员
- // wechatUserInfoService.getUserList();
- // //考勤记录
- // wechatCheckinDataService.getCheckinData("2021-03-01 00:00:00", "2021-03-31 23:59:59");
- //异常记录
- wechatNoListService.getNoDateByNo("2021-03-01 00:00:00", "2021-03-31 23:59:59", "0");
- //优容
- // wechatUserInfoService.getYRUserList();
- // wechatCheckinDataService.getYRCheckinData("2021-03-01 00:00:00", "2021-03-31 23:59:59");
- wechatNoListService.getNoDateByNo("2021-03-01 00:00:00", "2021-03-31 23:59:59", "1");
- }
- @Autowired
- private IByteDanceVideoReportDailyService videoReportDailyService;
- @Test
- 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);
- }
- }
- @Autowired
- private IBytedanceVideoEtlInfoService bytedanceVideoEtlInfoService;
- @Autowired
- IBytedanceVideoReportService bytedanceVideoReportService;
- @Autowired
- IETLReportBytedanceVideoService ietlReportBytedanceVideoService;
- @Autowired
- IKuaishouReportDailyImageService kuaishouReportDailyImageService;
- @Autowired
- IRuleByteDanceAccountService ruleByteDanceAccountService;
- @Test
- public void loadBDAccoutData() {
- Date startDate = DateUtils.addDay(new Date(), -2000);
- for (int i = 0; i <= 2000; i++) {
- Date getDate = DateUtils.addDay(startDate, i);
- bytedanceVideoEtlInfoService.etlBytedanceVideoInfo(getDate);
- }
- }
- @Resource
- private EtlKuaishouAccountMaterialReportDailyMapper etlKuaishouAccountMaterialReportDailyMapper;
- @Test
- public void etlKuaishouVideoInfo() {
- etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouAccountMaterialReportDailyData(DateUtils.formatDate());
- }
- @Autowired
- private IByteDanceCampaignService campaignService;
- @Test
- public void testLoadBytedanceCampaign(){
- List<CtopOauthToken>tokens = tokenService.selectToutiaoToken();
- for(CtopOauthToken token :tokens){
- campaignService.getAdvertiserCampaign(token, null, null);
- }
- }
- }
|