|
@@ -1,21 +1,24 @@
|
|
|
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.IMaterialCutFrameService;
|
|
|
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
|
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
|
import cn.com.ctop.crawler.modules.oceanengine.entity.HotMaterial;
|
|
|
import cn.com.ctop.crawler.modules.oceanengine.service.IHotMaterialService;
|
|
|
import cn.com.ctop.crawler.modules.oceanengine.service.IOceanEngineService;
|
|
|
import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
|
|
|
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceFundDailyService;
|
|
|
+import com.xxl.job.core.log.XxlJobLogger;
|
|
|
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.io.IOException;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.concurrent.CountDownLatch;
|
|
@@ -30,47 +33,31 @@ public class SampleTest {
|
|
|
private IOceanEngineService oceanEngineService;
|
|
|
@Autowired
|
|
|
private IHotMaterialService hotMaterialService;
|
|
|
- @Autowired
|
|
|
- private IMaterialCutFrameService cutFrameService;
|
|
|
-
|
|
|
-
|
|
|
@Test
|
|
|
- public void load() throws IOException {
|
|
|
- cutFrameService.loadCutFrame("a7f3ec7c2db14f5389d9975e8a05490d", "009422ceef3e0552e57eb8f4423c26d6");
|
|
|
- }
|
|
|
-
|
|
|
- @Test
|
|
|
- public void cut() throws IOException {
|
|
|
- cutFrameService.getCutFrame("https://ctop-media.oss-cn-beijing.aliyuncs.com/video/2020-02-20/2.20-%E8%B6%A3%E7%BA%A6%E4%BC%9A-%E6%8A%A2%E7%94%B7%E5%8F%8B-%E4%B8%B9%E5%AE%87%E7%BB%84-1582195096720.mp4", "009422ceef3e0552e57eb8f4423c26d6", 58L, "1280", "720");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Test
|
|
|
- public void initImageUrl() {
|
|
|
- List<HotMaterial> hotMaterials = hotMaterialService.getId();
|
|
|
- if (null != hotMaterials && !hotMaterials.isEmpty()) {
|
|
|
+ public void initImageUrl(){
|
|
|
+ List<HotMaterial> hotMaterials = hotMaterialService.getId();
|
|
|
+ if(null!=hotMaterials&&!hotMaterials.isEmpty()){
|
|
|
hotMaterials.forEach(douyinHot -> {
|
|
|
HotMaterial getHot = hotMaterialService.getById(douyinHot.getId());
|
|
|
// String image = getHot.getCoverImage().replace("data:image/jpg;base64,", "");
|
|
|
String destPath = "D:\\data\\effectCase\\";
|
|
|
- String fileName = getHot.getId() + ".jpg";
|
|
|
+ String fileName = getHot.getId()+".jpg";
|
|
|
// EffectCase.base64ToFile(destPath,image,fileName);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
@Test
|
|
|
- public void testOceanEngineJob() {
|
|
|
- String account = "3248395570@qq.com";
|
|
|
+ public void testOceanEngineJob(){
|
|
|
+ String account="3248395570@qq.com";
|
|
|
String password = "Ydxq-704127411";
|
|
|
- oceanEngineService.login(account, password);
|
|
|
- oceanEngineService.douyinHotHandler(1, 1);
|
|
|
+ oceanEngineService.login(account,password);
|
|
|
+ oceanEngineService.douyinHotHandler(1,1);
|
|
|
oceanEngineService.effectCaseHandler(1);
|
|
|
- oceanEngineService.hotMaterialHandler(1, 4, "抖音");
|
|
|
- oceanEngineService.hotMaterialHandler(1, 8, "头条");
|
|
|
- oceanEngineService.hotMaterialHandler(1, 1, "西瓜");
|
|
|
- oceanEngineService.hotMaterialHandler(1, 3, "火山");
|
|
|
- oceanEngineService.hotMaterialHandler(1, 9, "穿山甲");
|
|
|
+ oceanEngineService.hotMaterialHandler(1,4,"抖音");
|
|
|
+ oceanEngineService.hotMaterialHandler(1,8,"头条");
|
|
|
+ oceanEngineService.hotMaterialHandler(1,1,"西瓜");
|
|
|
+ oceanEngineService.hotMaterialHandler(1,3,"火山");
|
|
|
+ oceanEngineService.hotMaterialHandler(1,9,"穿山甲");
|
|
|
log.info("巨量创意抓取完成");
|
|
|
}
|
|
|
|
|
@@ -78,41 +65,38 @@ public class SampleTest {
|
|
|
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();
|
|
|
}
|
|
|
});
|
|
@@ -124,15 +108,43 @@ public class SampleTest {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
Long end = System.currentTimeMillis();
|
|
|
- log.info("总用时:{}毫秒", end - start);
|
|
|
+ log.info("总用时:{}毫秒",end-start);
|
|
|
}
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private ICtopOauthTokenService tokenService;
|
|
|
+ @Autowired
|
|
|
+ private IBytedanceFundDailyService bytedanceFundDailyService;
|
|
|
@Test
|
|
|
- public void testBase64() {
|
|
|
+ public void testBase64(){
|
|
|
+ List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
|
|
|
+ if (null == tokens || tokens.size() <= 0) {
|
|
|
+ XxlJobLogger.log("头条账户流水数据异常:未获取到可用的token");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ executorService = Executors.newFixedThreadPool(4);
|
|
|
+ countDownLatch = new CountDownLatch(tokens.size());
|
|
|
+ tokens.forEach(token -> {
|
|
|
+ executorService.submit(() -> {
|
|
|
+ try {
|
|
|
+ for(int i=0;i<12;i++){
|
|
|
+ String getDate = DateUtils.addDay("2020-05-28",-i);
|
|
|
+ bytedanceFundDailyService.loadFundDataByPage(token, getDate, getDate,1);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
|
|
|
+ }finally {
|
|
|
+ countDownLatch.countDown();
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ });
|
|
|
+ try {
|
|
|
+ countDownLatch.await();
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ }
|
|
|
+ System.out.println("执行完成");
|
|
|
}
|
|
|
}
|
|
|
-//刷新token:885936毫秒
|
|
|
|
|
|
|
|
|
|