|
@@ -1,17 +1,28 @@
|
|
|
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.service.IBindAccountLoginService;
|
|
|
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
|
import cn.com.ctop.crawler.modules.oceanengine.service.IOceanEngineService;
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.entity.vo.ConvertVo;
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
|
import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
|
|
|
+import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
|
|
|
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
|
|
|
+import io.swagger.models.auth.In;
|
|
|
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.junit4.SpringRunner;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.concurrent.CountDownLatch;
|
|
@@ -24,10 +35,57 @@ import java.util.concurrent.Executors;
|
|
|
public class SampleTest {
|
|
|
@Autowired
|
|
|
private IOceanEngineService oceanEngineService;
|
|
|
+ @Autowired
|
|
|
+ private IKuaishouInterfaceService interfaceService;
|
|
|
+ @Autowired
|
|
|
+ private IBytedanceReportService bytedanceReportService;
|
|
|
+ @Autowired
|
|
|
+ private IByteDanceVideoReportDailyService byteDanceVideoReportDailyService;
|
|
|
+ @Autowired
|
|
|
+ private ICtopOauthTokenService oauthTokenService;
|
|
|
+
|
|
|
@Test
|
|
|
- public void testOceanEngineJob(){
|
|
|
- String account="3248395570@qq.com";
|
|
|
- String password = "Ydxq-704127411";
|
|
|
+ public void testOceanEngineJob() {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ try {
|
|
|
+ CtopOauthToken byId = oauthTokenService.getById(303094936123368L);
|
|
|
+ String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
+ String endDate = DateUtils.addDay(nowDate, -180);
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ Date start = simpleDateFormat.parse(nowDate);
|
|
|
+ Date end = simpleDateFormat.parse(endDate);
|
|
|
+ List<Date> dates = DateUtils.findDates(end,start);
|
|
|
+ for (int i = 0; i < dates.size(); i++) {
|
|
|
+ String formatDate = simpleDateFormat.format(dates.get(i));
|
|
|
+ int code = bytedanceReportService.bytedanceMaterialReport(byId, formatDate, formatDate);
|
|
|
+ //如果成功的话跑视频清洗数据方法,失败会进入重试库,重试成功后再清洗数据
|
|
|
+ if (code == 200 || code == 1) {
|
|
|
+ byteDanceVideoReportDailyService.videoInfoListByAccountId(formatDate, formatDate, byId.getAccountId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+/*
|
|
|
+ List list = new ArrayList();
|
|
|
+ list.add(1);
|
|
|
+ list.add(2);
|
|
|
+ list.add(3);
|
|
|
+ list.add(7);
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ Integer o = (Integer) list.get(i);
|
|
|
+ List<ConvertVo> convertList = interfaceService.getConvertList(6435317L, "42761e184c6e966236fcfd167375a875", o);
|
|
|
+ System.err.println(convertList);
|
|
|
+ }*/
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ String account = "3248395570@qq.com";
|
|
|
+ /* String password = "Ydxq-704127411";
|
|
|
oceanEngineService.login(account,password);
|
|
|
oceanEngineService.douyinHotHandler(1,1);
|
|
|
oceanEngineService.effectCaseHandler(1);
|
|
@@ -36,45 +94,48 @@ public class SampleTest {
|
|
|
oceanEngineService.hotMaterialHandler(1,1,"西瓜");
|
|
|
oceanEngineService.hotMaterialHandler(1,3,"火山");
|
|
|
oceanEngineService.hotMaterialHandler(1,9,"穿山甲");
|
|
|
- log.info("巨量创意抓取完成");
|
|
|
+ log.info("巨量创意抓取完成");*/
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
|
private IBindAccountLoginService bindAccountLoginService;
|
|
|
@Autowired
|
|
|
private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
|
|
|
+
|
|
|
@Test
|
|
|
- public void kuaishouLogin(){
|
|
|
- Long start =System.currentTimeMillis();
|
|
|
- List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY,1);
|
|
|
- if(list!=null&&!list.isEmpty()){
|
|
|
- for (BindAccountLogin login:list) {
|
|
|
- if(null==login.getCookie()||"".equals(login.getCookie().trim())){
|
|
|
+ public void kuaishouLogin() {
|
|
|
+ Long start = System.currentTimeMillis();
|
|
|
+ List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY, 1);
|
|
|
+ if (list != null && !list.isEmpty()) {
|
|
|
+ for (BindAccountLogin login : list) {
|
|
|
+ if (null == login.getCookie() || "".equals(login.getCookie().trim())) {
|
|
|
kuaishouWebInterfaceService.getkuaishouWebLoginCookie(login);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
Long end = System.currentTimeMillis();
|
|
|
- log.info("总用时:{}毫秒",end-start);
|
|
|
+ log.info("总用时:{}毫秒", end - start);
|
|
|
}
|
|
|
+
|
|
|
static ExecutorService executorService = null;
|
|
|
static CountDownLatch countDownLatch = null;
|
|
|
+
|
|
|
@Test
|
|
|
- public void kuaishouCommentDelete(){
|
|
|
- Long start =System.currentTimeMillis();
|
|
|
- List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY,1);
|
|
|
- if(list!=null&&!list.isEmpty()){
|
|
|
+ public void kuaishouCommentDelete() {
|
|
|
+ Long start = System.currentTimeMillis();
|
|
|
+ List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY, 1);
|
|
|
+ if (list != null && !list.isEmpty()) {
|
|
|
executorService = Executors.newFixedThreadPool(10);
|
|
|
countDownLatch = new CountDownLatch(list.size());
|
|
|
list.forEach(login -> {
|
|
|
- executorService.submit(()->{
|
|
|
+ executorService.submit(() -> {
|
|
|
try {
|
|
|
- if(null!=login.getCookie()&&!"".equals(login.getCookie().trim())){
|
|
|
- kuaishouWebInterfaceService.deleteAllComment(new HashMap<>(),login);
|
|
|
+ if (null != login.getCookie() && !"".equals(login.getCookie().trim())) {
|
|
|
+ kuaishouWebInterfaceService.deleteAllComment(new HashMap<>(), login);
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
|
- }finally {
|
|
|
+ } finally {
|
|
|
countDownLatch.countDown();
|
|
|
}
|
|
|
});
|
|
@@ -86,7 +147,7 @@ public class SampleTest {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
Long end = System.currentTimeMillis();
|
|
|
- log.info("总用时:{}毫秒",end-start);
|
|
|
+ log.info("总用时:{}毫秒", end - start);
|
|
|
}
|
|
|
// @Autowired
|
|
|
// private PangolinLoginService pangolinLoginService;
|