Ver código fonte

Merge branch 'test' of http://39.106.184.70:3000/ctop/adsp-boot into test

hcst_sunzhen 5 anos atrás
pai
commit
1469dcab16
50 arquivos alterados com 2004 adições e 1271 exclusões
  1. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java
  2. 114 122
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  3. 4 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountLoginController.java
  4. 34 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  5. 52 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/PangolinController.java
  6. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java
  7. 8 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  8. 27 30
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCommentAutoDelete.java
  9. 47 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCommentAutoLoginJob.java
  10. 10 342
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/OceanengineJob.java
  11. 2 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/PangolinLoginJob.java
  12. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICreateInternalService.java
  13. 4 13
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java
  14. 4 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/MaterialTopServiceImpl.java
  15. 144 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/opencv/utils/ExtractionVideoKeyFrames.java
  16. 1 1
      jeecg-boot-module-system/src/main/resources/application-test.yml
  17. 70 67
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  18. 10 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/BindAccountLogin.java
  19. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IBindAccountLoginService.java
  20. 4 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java
  21. 94 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountLoginServiceImpl.java
  22. 39 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
  23. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/CtopAdConstant.java
  24. 51 1
      module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils2.java
  25. 54 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/FfmpegUtils.java
  26. 1 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/entity/DouyinHot.java
  27. 196 3
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/entity/EffectCase.java
  28. 1 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/entity/HotMaterial.java
  29. 3 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/IDouyinHotService.java
  30. 5 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/IHotMaterialService.java
  31. 7 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/IOceanEngineService.java
  32. 8 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/impl/DouyinHotServiceImpl.java
  33. 2 2
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/impl/EffectCaseServiceImpl.java
  34. 10 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/impl/HotMaterialServiceImpl.java
  35. 317 347
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/impl/OceanEngineServiceImpl.java
  36. 1 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/PangolinAppMapper.java
  37. 4 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/xml/PangolinAppMapper.xml
  38. 2 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/PangolinAppService.java
  39. 7 2
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinAppServiceImpl.java
  40. 4 13
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinCrawlerServiceImpl.java
  41. 1 2
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinLoginServiceImpl.java
  42. 4 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  43. 173 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouMaterialUploadController.java
  44. 9 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouMaterialUploadService.java
  45. 9 95
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java
  46. 222 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouMaterialUploadServiceImpl.java
  47. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  48. 18 13
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/IKuaishouWebInterfaceService.java
  49. 203 163
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java
  50. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceReportController.java

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java

@@ -49,4 +49,5 @@ public class JeecgApplication {
         return new PaginationInterceptor();
     }
 
+
 }

+ 114 - 122
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -28,20 +28,20 @@ import java.util.Map;
 @Configuration
 public class ShiroConfig {
 
-	/**
-	 * Filter Chain定义说明
-	 *
-	 * 1、一个URL可以配置多个Filter,使用逗号分隔
-	 * 2、当设置多个过滤器时,全部验证通过,才视为通过
-	 * 3、部分过滤器可指定参数,如perms,roles
-	 */
-	@Bean("shiroFilter")
-	public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) {
-		ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
-		shiroFilterFactoryBean.setSecurityManager(securityManager);
-		// 拦截器
-		Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
-		// 配置不会被拦截的链接 顺序判断
+    /**
+     * Filter Chain定义说明
+     * <p>
+     * 1、一个URL可以配置多个Filter,使用逗号分隔
+     * 2、当设置多个过滤器时,全部验证通过,才视为通过
+     * 3、部分过滤器可指定参数,如perms,roles
+     */
+    @Bean("shiroFilter")
+    public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) {
+        ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
+        shiroFilterFactoryBean.setSecurityManager(securityManager);
+        // 拦截器
+        Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
+        // 配置不会被拦截的链接 顺序判断
         //登录接口排除
         filterChainDefinitionMap.put("/sys/login", "anon");
         filterChainDefinitionMap.put("/sys/wxlogin", "anon");
@@ -70,73 +70,63 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/sys/common/download/**", "anon");
         //pdf预览
         filterChainDefinitionMap.put("/sys/common/pdf/**", "anon");
-		filterChainDefinitionMap.put("/ctop/bytedanceAreaInfo/**", "anon");
-		filterChainDefinitionMap.put("/ctop/bytedanceInterestCategory/**", "anon");
-		filterChainDefinitionMap.put("/template/creative/words/get", "anon");
-		filterChainDefinitionMap.put("/appium/crawler/*", "anon");
+        filterChainDefinitionMap.put("/ctop/bytedanceAreaInfo/**", "anon");
+        filterChainDefinitionMap.put("/ctop/bytedanceInterestCategory/**", "anon");
+        filterChainDefinitionMap.put("/template/creative/words/get", "anon");
+        filterChainDefinitionMap.put("/appium/crawler/*", "anon");
 
         filterChainDefinitionMap.put("/ctop/kuaishouChannelRegInfo/*", "anon");
 
 
-		filterChainDefinitionMap.put("/ctop/byteDance/homePage/report/*", "anon");
-		filterChainDefinitionMap.put("/ctop/material/top/cost", "anon");
-
-
-
-
-		//优化师相关
-		//filterChainDefinitionMap.put("/ctop/performanceOptimizer/detail", "anon");
-		//filterChainDefinitionMap.put("/ctop/performanceOptimizer/ranking/list", "anon");
-		//filterChainDefinitionMap.put("/ctop/performance/project/list", "anon");
-		//filterChainDefinitionMap.put("/ctop/performance/account/list", "anon");
-		//filterChainDefinitionMap.put("/ctop/optimizerRoleInfo/manager/detail", "anon");
+        filterChainDefinitionMap.put("/ctop/byteDance/homePage/report/*", "anon");
+        filterChainDefinitionMap.put("/ctop/material/top/cost", "anon");
 
+        filterChainDefinitionMap.put("/pangolin/**", "anon");
 
         filterChainDefinitionMap.put("/generic/**", "anon");
-		filterChainDefinitionMap.put("/", "anon");
-		filterChainDefinitionMap.put("/doc.html", "anon");
-		filterChainDefinitionMap.put("/**/*.js", "anon");
-		filterChainDefinitionMap.put("/**/*.css", "anon");
-		filterChainDefinitionMap.put("/**/*.html", "anon");
-		filterChainDefinitionMap.put("/**/*.svg", "anon");
-		filterChainDefinitionMap.put("/**/*.jpg", "anon");
-		filterChainDefinitionMap.put("/**/*.png", "anon");
-		filterChainDefinitionMap.put("/**/*.ico", "anon");
-		filterChainDefinitionMap.put("/druid/**", "anon");
-		filterChainDefinitionMap.put("/swagger-ui.html", "anon");
-		filterChainDefinitionMap.put("/swagger**/**", "anon");
-		filterChainDefinitionMap.put("/webjars/**", "anon");
-		filterChainDefinitionMap.put("/v2/**", "anon");
+        filterChainDefinitionMap.put("/", "anon");
+        filterChainDefinitionMap.put("/doc.html", "anon");
+        filterChainDefinitionMap.put("/**/*.js", "anon");
+        filterChainDefinitionMap.put("/**/*.css", "anon");
+        filterChainDefinitionMap.put("/**/*.html", "anon");
+        filterChainDefinitionMap.put("/**/*.svg", "anon");
+        filterChainDefinitionMap.put("/**/*.jpg", "anon");
+        filterChainDefinitionMap.put("/**/*.png", "anon");
+        filterChainDefinitionMap.put("/**/*.ico", "anon");
+        filterChainDefinitionMap.put("/druid/**", "anon");
+        filterChainDefinitionMap.put("/swagger-ui.html", "anon");
+        filterChainDefinitionMap.put("/swagger**/**", "anon");
+        filterChainDefinitionMap.put("/webjars/**", "anon");
+        filterChainDefinitionMap.put("/v2/**", "anon");
         filterChainDefinitionMap.put("/kuaishou", "anon");
         filterChainDefinitionMap.put("/kuaishou/report", "anon");
-		filterChainDefinitionMap.put("/ctop/bindAccount/**", "anon");
-		filterChainDefinitionMap.put("/**/*.mp4", "anon");
-
+        filterChainDefinitionMap.put("/ctop/bindAccount/**", "anon");
+        filterChainDefinitionMap.put("/**/*.mp4", "anon");
 
-		//性能监控
-		filterChainDefinitionMap.put("/actuator/metrics/**", "anon");
-		filterChainDefinitionMap.put("/actuator/httptrace/**", "anon");
-		filterChainDefinitionMap.put("/actuator/redis/**", "anon");
+        //性能监控
+        filterChainDefinitionMap.put("/actuator/metrics/**", "anon");
+        filterChainDefinitionMap.put("/actuator/httptrace/**", "anon");
+        filterChainDefinitionMap.put("/actuator/redis/**", "anon");
         //消息队列
         filterChainDefinitionMap.put("/mq/**", "anon");
         //模板测试
         filterChainDefinitionMap.put("/test/**", "anon");
-		//oauth接口
+        //oauth接口
         filterChainDefinitionMap.put("/auth/**", "anon");
-		filterChainDefinitionMap.put("/ctop/syncdata/**", "anon");
-		//头条接口
+        filterChainDefinitionMap.put("/ctop/syncdata/**", "anon");
+        //头条接口
         filterChainDefinitionMap.put("/bytedance", "anon");
-		filterChainDefinitionMap.put("/toutiao/dictitem/list", "anon");
+        filterChainDefinitionMap.put("/toutiao/dictitem/list", "anon");
         filterChainDefinitionMap.put("/toutiao/loadAllData", "anon");
         filterChainDefinitionMap.put("/toutiao/loadSingleData", "anon");
-		filterChainDefinitionMap.put("/kuaishou/getReport/historyData", "anon");
-		filterChainDefinitionMap.put("/toutiao/advertiser/**", "anon");
+        filterChainDefinitionMap.put("/kuaishou/getReport/historyData", "anon");
+        filterChainDefinitionMap.put("/toutiao/advertiser/**", "anon");
         filterChainDefinitionMap.put("/toutiao/industry/list", "anon");
         filterChainDefinitionMap.put("/template/bytedance/industry/list", "anon");
         filterChainDefinitionMap.put("/template/convert/list", "anon");
-		filterChainDefinitionMap.put("/template/convert/list/url", "anon");
+        filterChainDefinitionMap.put("/template/convert/list/url", "anon");
         //文件上传接口
-		filterChainDefinitionMap.put("/upload/**", "anon");
+        filterChainDefinitionMap.put("/upload/**", "anon");
         filterChainDefinitionMap.put("/appium/appiumTask/run", "anon");
 
         filterChainDefinitionMap.put("/system/userCompany/**", "anon");
@@ -145,71 +135,73 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/test/getVideoAndImage/**", "anon");
         filterChainDefinitionMap.put("/test/gerCreative/**", "anon");
 
-		filterChainDefinitionMap.put("/report/kuaishouReportDailyAgent/get","anon");
+        filterChainDefinitionMap.put("/report/kuaishouReportDailyAgent/get", "anon");
 
-		filterChainDefinitionMap.put("/appium/appiumTask/run/login", "anon");
-		filterChainDefinitionMap.put("/zip/download", "anon");
-		//爬虫接口
-		filterChainDefinitionMap.put("/graphql/video", "anon");
-		filterChainDefinitionMap.put("/ks/web/test", "anon");
+        filterChainDefinitionMap.put("/appium/appiumTask/run/login", "anon");
+        filterChainDefinitionMap.put("/zip/download", "anon");
+        //爬虫接口
+        filterChainDefinitionMap.put("/graphql/video", "anon");
+        filterChainDefinitionMap.put("/ks/web/test", "anon");
         filterChainDefinitionMap.put("/ureport/**", "anon");
         filterChainDefinitionMap.put("/ctop/advertiser/**", "anon");
-
-		// 添加自己的过滤器并且取名为jwt
-		Map<String, Filter> filterMap = new HashMap<>(1);
-		filterMap.put("jwt", new JwtFilter());
-		shiroFilterFactoryBean.setFilters(filterMap);
-		// <!-- 过滤链定义,从上向下顺序执行,一般将/**放在最为下边
-		filterChainDefinitionMap.put("/**", "jwt");
-
-		// 未授权界面返回JSON
-		shiroFilterFactoryBean.setUnauthorizedUrl("/sys/common/403");
-		shiroFilterFactoryBean.setLoginUrl("/sys/common/403");
-		shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
-		return shiroFilterFactoryBean;
-	}
-
-	@Bean("securityManager")
-	public DefaultWebSecurityManager securityManager(ShiroRealm myRealm) {
-		DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
-		securityManager.setRealm(myRealm);
-
-		/*
-		 * 关闭shiro自带的session,详情见文档
-		 * http://shiro.apache.org/session-management.html#SessionManagement-
-		 * StatelessApplications%28Sessionless%29
-		 */
-		DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
-		DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator();
-		defaultSessionStorageEvaluator.setSessionStorageEnabled(false);
-		subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator);
-		securityManager.setSubjectDAO(subjectDAO);
-
-		return securityManager;
-	}
-
-	/**
-	 * 下面的代码是添加注解支持
-	 * @return
-	 */
-	@Bean
-	@DependsOn("lifecycleBeanPostProcessor")
-	public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
-		DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
-		defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
-		return defaultAdvisorAutoProxyCreator;
-	}
-
-	@Bean
-	public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
-		return new LifecycleBeanPostProcessor();
-	}
-
-	@Bean
-	public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) {
-		AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
-		advisor.setSecurityManager(securityManager);
-		return advisor;
-	}
+        filterChainDefinitionMap.put("/pangolin/**", "anon");
+
+        // 添加自己的过滤器并且取名为jwt
+        Map<String, Filter> filterMap = new HashMap<>(1);
+        filterMap.put("jwt", new JwtFilter());
+        shiroFilterFactoryBean.setFilters(filterMap);
+        // <!-- 过滤链定义,从上向下顺序执行,一般将/**放在最为下边
+        filterChainDefinitionMap.put("/**", "jwt");
+
+        // 未授权界面返回JSON
+        shiroFilterFactoryBean.setUnauthorizedUrl("/sys/common/403");
+        shiroFilterFactoryBean.setLoginUrl("/sys/common/403");
+        shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
+        return shiroFilterFactoryBean;
+    }
+
+    @Bean("securityManager")
+    public DefaultWebSecurityManager securityManager(ShiroRealm myRealm) {
+        DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
+        securityManager.setRealm(myRealm);
+
+        /*
+         * 关闭shiro自带的session,详情见文档
+         * http://shiro.apache.org/session-management.html#SessionManagement-
+         * StatelessApplications%28Sessionless%29
+         */
+        DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
+        DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator();
+        defaultSessionStorageEvaluator.setSessionStorageEnabled(false);
+        subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator);
+        securityManager.setSubjectDAO(subjectDAO);
+
+        return securityManager;
+    }
+
+    /**
+     * 下面的代码是添加注解支持
+     *
+     * @return
+     */
+    @Bean
+    @DependsOn("lifecycleBeanPostProcessor")
+    public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
+        DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
+        defaultAdvisorAutoProxyCreator.setProxyTargetClass(true);
+        return defaultAdvisorAutoProxyCreator;
+    }
+
+    @Bean
+    public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
+        return new LifecycleBeanPostProcessor();
+    }
+
+    @Bean
+    public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) {
+        AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
+        advisor.setSecurityManager(securityManager);
+        return advisor;
+    }
 
 }

+ 4 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountLoginController.java

@@ -65,10 +65,12 @@ public class BindAccountLoginController {
         String loginType = json.getString("loginType");
         // 广告主名称
         String advertiserName = json.getString("advertiser_name");
+        //项目id
+        Long projectId = json.getLong("projectId");
         //账号
         String accountName = json.getString("accountName");
         String password = json.getString("password");
-        Map<String, Object> stringObjectMap = createInternalService.bindLogin(advertiserId, accountName, password, loginType, userId, advertiserName);
+        Map<String, Object> stringObjectMap = createInternalService.bindLogin(projectId,advertiserId, accountName, password, loginType, userId, advertiserName);
         Boolean trueOrFalse = (Boolean) stringObjectMap.get("success");
         if (Boolean.TRUE.equals(trueOrFalse)&&!loginType.equals(CtopAdConstant.PLATFORM_TYPE_PANGOLIN_PY)) {
             Map<String, Object> deleteMap = new HashMap<>();
@@ -77,10 +79,9 @@ public class BindAccountLoginController {
             deleteMap.put("advertiser_id", advertiserId);
             userAllocationMapper.deleteByMap(deleteMap);
             Long accountId = (Long) stringObjectMap.get("accountId");
+            String mediaId = json.getString("mediaId");
             String userName = json.getString("userName");
             // 媒体类型: 1 头条 2 快手
-            String mediaId = json.getString("mediaId");
-            Long projectId = json.getLong("projectId");
             String projectName = json.getString("projectName");
             String systemType = json.getString("systemType");
             UserAllocation userAllocation = new UserAllocation();

+ 34 - 12
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java

@@ -1,8 +1,7 @@
 package org.jeecg.modules.ctop.controller;
 
 
-import cn.com.ctop.common.module.entity.MaterialImageInfo;
-import cn.com.ctop.common.module.entity.MaterialInfo;
+import cn.com.ctop.common.module.entity.*;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.JsonUtil;
@@ -336,7 +335,29 @@ public class MaterialInfoController {
                 materialInfo.setUrl(url);
             }
 
+            //  修改素材库 相关联code
+            if (!Check.isNull(materialInfo.getCode())) {
+                String code = materialInfoEntity.getCode();
+                if (!Check.isNull(code)) {
+                    MaterialTag updateMaterialTag = new MaterialTag();
+                    updateMaterialTag.setMaterialId(materialInfo.getCode());
+                    QueryWrapper<MaterialTag> tagQueryWrapper = new QueryWrapper<>();
+                    tagQueryWrapper.eq("material_id", code);
+                    materialTagService.update(updateMaterialTag, tagQueryWrapper);
+                    MaterialParameter updateParameter = new MaterialParameter();
+                    updateParameter.setMaterialId(materialInfo.getCode());
+                    QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
+                    parameterQueryWrapper.eq("material_id", code);
+                    materialParameterService.update(updateParameter, parameterQueryWrapper);
+                    MaterialAscription updateMaterialAscription = new MaterialAscription();
+                    updateMaterialAscription.setMaterialId(materialInfo.getCode());
+                    QueryWrapper<MaterialAscription> ascriptionQueryWrapper = new QueryWrapper<>();
+                    ascriptionQueryWrapper.eq("material_id", code);
+                    materialAscriptionService.update(updateMaterialAscription, ascriptionQueryWrapper);
+                }
+            }
 
+            //  审核通过自动同步到到媒体后台
            /* Long projectId = materialInfoEntity.getProjectId();
             Project project = projectService.getById(projectId);
             if (!Check.isNull(projectId)) {
@@ -358,7 +379,6 @@ public class MaterialInfoController {
 
             }*/
 
-
             boolean ok = materialInfoService.updateById(materialInfo);
             if (ok) {
                 result.success("修改成功!");
@@ -381,16 +401,18 @@ public class MaterialInfoController {
     @DeleteMapping(value = "/delete")
     public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
+            MaterialInfo materialInfo = materialInfoService.getById(id);
+            if (!Check.isNull(materialInfo)) {
+                Map<String, Object> deleteMap = new HashMap<>();
+                deleteMap.put("material_id", materialInfo.getCode());
+                materialAscriptionService.removeByMap(deleteMap);
+                materialParameterService.removeByMap(deleteMap);
+                materialTagService.removeByMap(deleteMap);
+                Map<String, Object> deleteWatermarkMap = new HashMap<>();
+                deleteWatermarkMap.put("video_id", id);
+                watermarkTaskService.removeByMap(deleteWatermarkMap);
+            }
             materialInfoService.removeById(id);
-            Map<String, Object> deleteMap = new HashMap<>();
-            deleteMap.put("material_id", id);
-            materialAscriptionService.removeByMap(deleteMap);
-            materialParameterService.removeByMap(deleteMap);
-            materialTagService.removeByMap(deleteMap);
-            Map<String, Object> deleteWatermarkMap = new HashMap<>();
-            deleteWatermarkMap.put("video_id", id);
-            watermarkTaskService.removeByMap(deleteWatermarkMap);
-
         } catch (Exception e) {
             log.error("删除失败", e.getMessage());
             return Result.error("删除失败!");

+ 52 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/PangolinController.java

@@ -1,6 +1,8 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ISysRoleService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.crawler.modules.pangolin.service.*;
@@ -33,8 +35,13 @@ public class PangolinController {
     private PangolinChannelService pangolinChannelService;
     @Autowired
     private ISysRoleService sysRoleService;
-    @PostMapping("api/channel/list")
-    public Map<String, Object> channelList(@RequestBody JSONObject data) {
+    @Autowired
+    private IBindAccountLoginService bindAccountLoginService;
+
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @PostMapping("api/user/list")
+    public Map<String, Object> userList(@RequestBody JSONObject data) {
 //        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 //        String userId = user.getId();
         String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
@@ -42,12 +49,12 @@ public class PangolinController {
         if(null!=roleCode&&(roleCode.equals("admin"))){
             userId = null;
         }
-        return pangolinChannelService.getListByUserId(userId);
-    }
 
+        return userAllocationService.getPangolinAccountListByParams(userId,data);
+    }
 
-    @PostMapping("api/app/list")
-    public Map<String, Object> appList() {
+    @PostMapping("api/project/list")
+    public Map<String, Object> projectList(@RequestBody JSONObject data) {
 //        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 //        String userId = user.getId();
         String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
@@ -55,7 +62,43 @@ public class PangolinController {
         if(null!=roleCode&&(roleCode.equals("admin"))){
             userId = null;
         }
-        return pangolinAppService.getListByUserId(userId);
+        return userAllocationService.getPangolinProjectListByParams(userId);
+    }
+
+    @PostMapping("api/channel/list")
+    public Map<String, Object> channelList(@RequestBody JSONObject data) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = user.getId();
+//        String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
+        String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+        if(null!=roleCode&&(roleCode.equals("admin"))){
+            userId = null;
+        }
+        return pangolinChannelService.getListByUserId(userId);
+    }
+
+//    @PostMapping("api/user/list")
+//    public Map<String, Object> userList() {
+//        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+//        String userId = user.getId();
+////        String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
+//        String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+//        if(null!=roleCode&&(roleCode.equals("admin"))){
+//            userId = null;
+//        }
+//        return bindAccountLoginService.getListByUserId(userId);
+//    }
+
+    @PostMapping("api/app/list")
+    public Map<String, Object> appList(@RequestBody JSONObject data) {
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = user.getId();
+//        String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
+        String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+        if(null!=roleCode&&(roleCode.equals("admin"))){
+            userId = null;
+        }
+        return pangolinAppService.getListByUserId(userId,data);
     }
 
 
@@ -80,8 +123,8 @@ public class PangolinController {
     @PostMapping("api/activation/list")
     public Map<String, Object> activationList(@RequestBody JSONObject data) {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        String userId = user.getId();
-//        String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
+//        String userId = user.getId();
+        String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         if(null!=roleCode&&(roleCode.equals("admin"))){
             userId = null;

+ 3 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java

@@ -182,10 +182,10 @@ public class ProjectController {
             queryWrapper.eq("user_id", sysUser.getId());
             queryWrapper.orderByDesc("create_time");
         }
-        if(null!=industryId&&"".equals(industryId.trim())){
+        if(null!=industryId&&!"".equals(industryId.trim())){
             SysCategory category = sysCategoryService.getById(industryId);
             if(null!=category){
-                queryWrapper.likeLeft("industry_code",category.getCode());
+                queryWrapper.likeRight("industry_code",category.getCode());
             }
         }
         IPage<Project> pageList = projectService.page(page, queryWrapper);
@@ -307,7 +307,7 @@ public class ProjectController {
             userAllocationQueryWrapper.eq("project_id", project.getId());
             UserAllocation updateUserAllocation = new UserAllocation();
             updateUserAllocation.setProjectName(project.getProjectName());
-            updateUserAllocation.setMediaId(project.getMediaId());
+           // updateUserAllocation.setMediaId(project.getMediaId());
             userAllocationService.update(updateUserAllocation, userAllocationQueryWrapper);
 
             if (ok) {

+ 8 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java

@@ -147,10 +147,11 @@ public class UserAllocationController {
         try {
             QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("project_id", projectId);
+
+           /* if (!Check.isNull(project)) {
             Project project = projectService.getById(projectId);
-            if (!Check.isNull(project)) {
                 queryWrapper.eq("media_id", project.getMediaId());
-            }
+            }*/
 
             String roleCode = sysRoleService.getRoleCodeByUserId(userId);
             if (!"admin".equals(roleCode) && !"kuaishouOperationManager".equals(roleCode) && !"designTeamLeader".equals(roleCode) && !"touTiaoOperationManager".equals(roleCode)) {
@@ -183,10 +184,11 @@ public class UserAllocationController {
 
             QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("project_id", projectId);
-            Project project = projectService.getById(projectId);
-            if (!Check.isNull(project)) {
-                queryWrapper.eq("media_id", project.getMediaId());
-            }
+
+           /* if (!Check.isNull(project)) {
+                 Project project = projectService.getById(projectId);
+                 queryWrapper.eq("media_id", project.getMediaId());
+            }*/
             queryWrapper.isNotNull("account_id");
             List<UserAllocation> userAllocations = userAllocationMapper.selectList(queryWrapper);
             result.setSuccess(true);

+ 27 - 30
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCommentAutoDelete.java

@@ -2,8 +2,8 @@ package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
@@ -13,6 +13,9 @@ import org.springframework.beans.factory.annotation.Value;
 
 import java.util.HashMap;
 import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 @Slf4j
 public class KuaishouCommentAutoDelete implements Job {
@@ -22,39 +25,33 @@ public class KuaishouCommentAutoDelete implements Job {
     private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
     @Autowired
     private IBindAccountLoginService bindAccountLoginService;
+    static ExecutorService executorService = null;
+    //线程计数器
+    static CountDownLatch countDownLatch = null;
 
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        Thread thread = new Thread() {
-            @Override
-            public void run() {
-                QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
-                queryWrapper.eq("login_type", "kuaishou");
-                queryWrapper.eq("status", 1);
-                List<BindAccountLogin> list = bindAccountLoginService.list(queryWrapper);
-                if (list != null && list.size() > 0) {
-                    for (BindAccountLogin account : list) {
-                        try {
-                            log.info("正在删除评论:{}", account.getAccountName());
-                            kuaishouWebInterfaceService.adkuaishouWebLogin(account.getAccountName(), account.getPassword());
-                            kuaishouWebInterfaceService.deleteAllComment(new HashMap<>());
-                            Runtime runtime = Runtime.getRuntime();
-                            Process pro = runtime.exec(cleanUrl);
-                            int status = pro.waitFor();
-                            if (status == 0) {
-                                log.info("success,删除评论调用shell脚本执行成功");
-                            } else {
-                                log.info("error,删除评论调用shell脚本执行失败");
-                            }
-                            Thread.sleep(5 * 1000L);
-                        } catch (Exception e) {
-                            e.printStackTrace();
-                        }
-                    }
+        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();
             }
-        };
-        thread.start();
-
+            Long end = System.currentTimeMillis();
+            log.info("快手删评论所用时长:{}毫秒",end-start);
+        }
     }
 }

+ 47 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouCommentAutoLoginJob.java

@@ -0,0 +1,47 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.entity.BindAccountLogin;
+import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
+import lombok.extern.slf4j.Slf4j;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+
+import java.util.List;
+
+@Slf4j
+public class KuaishouCommentAutoLoginJob implements Job {
+    @Value("${chrome.script.clean}")
+    private String cleanUrl;
+    @Autowired
+    private IBindAccountLoginService bindAccountLoginService;
+    @Autowired
+    private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        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);
+                    Runtime runtime = Runtime.getRuntime();
+                    try {
+                        Process pro = runtime.exec(cleanUrl);
+                        int status = pro.waitFor();
+                        if (status == 0) {
+                            log.info("success,删除评论调用shell脚本执行成功");
+                        } else {
+                            log.info("error,删除评论调用shell脚本执行失败");
+                        }
+                    } catch (Exception e) {
+                        log.error(e.getMessage(),e);
+                    }
+                }
+            }
+        }
+    }
+}

+ 10 - 342
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/OceanengineJob.java

@@ -1,361 +1,29 @@
 package org.jeecg.modules.ctop.job;
 
-import cn.com.ctop.common.module.utils.Base64Utils;
-import cn.com.ctop.common.module.utils.HttpUtils2;
-import cn.com.ctop.crawler.modules.core.util.FateadmHttpUtil;
-import cn.com.ctop.crawler.modules.core.util.FateadmUtil;
-import cn.com.ctop.crawler.modules.oceanengine.entity.DouyinHot;
-import cn.com.ctop.crawler.modules.oceanengine.entity.EffectCase;
-import cn.com.ctop.crawler.modules.oceanengine.entity.HotMaterial;
-import cn.com.ctop.crawler.modules.oceanengine.service.IDouyinHotService;
-import cn.com.ctop.crawler.modules.oceanengine.service.IEffectCaseService;
-import cn.com.ctop.crawler.modules.oceanengine.service.IHotMaterialService;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import cn.com.ctop.crawler.modules.oceanengine.service.IOceanEngineService;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.http.impl.cookie.BasicClientCookie;
-import org.bytedeco.javacv.FFmpegFrameGrabber;
-import org.bytedeco.javacv.Frame;
-import org.bytedeco.javacv.Java2DFrameConverter;
-import org.openqa.selenium.Cookie;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.chrome.ChromeDriver;
-import org.openqa.selenium.chrome.ChromeOptions;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-
-import javax.imageio.ImageIO;
-import java.awt.*;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayOutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.List;
-import java.util.*;
 
 @Slf4j
 public class OceanengineJob implements Job {
-    @Value("${jeecg.path.chrome-driver}")
-    private String chromeDriver;
-    @Autowired
-    private IDouyinHotService douyinHotService;
-    @Autowired
-    private IEffectCaseService effectCaseService;
     @Autowired
-    private IHotMaterialService hotMaterialService;
-
-    public static String getVideoUrlByVid(String vid) {
-        String url = "https://aweme.snssdk.com/aweme/v1/playwm/?video_id=" + vid + "&line=0";
-        return getRealVideoUrl(url);
-    }
+    private IOceanEngineService oceanEngineService;
 
-    public static String getRealVideoUrl(String url) {
-        try {
-            URL serverUrl = new URL(url);
-            HttpURLConnection conn = (HttpURLConnection) serverUrl
-                    .openConnection();
-            conn.setRequestMethod("GET");
-            // 必须设置false,否则会自动redirect到Location的地址
-            conn.setInstanceFollowRedirects(false);
-            conn.addRequestProperty("User-Agent",
-                    "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.8) Firefox/3.6.8");
-            conn.connect();
-            String location = conn.getHeaderField("Location");
-            return location;
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-    private void hotMaterialHandler(int page,int appCode,String appName){
-        String result = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/hot_material/list?material_type=3&order_by=convert_show_rate&period_type=3&aggr_app_code="+appCode+"&page="+page+"&limit=20");
-        ObjectMapper mapper = new ObjectMapper();
-        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-        try {
-            JsonNode node = mapper.readTree(result);
-            int code = node.get("code").asInt();
-            if (code == 0) {
-                if (node.get("data") != null&&node.get("data").get("materials")!=null) {
-                    String dataJson = node.get("data").get("materials").toString();
-                    List<HotMaterial> list = mapper.readValue(dataJson,new TypeReference<List<HotMaterial>>() {});
-                    if(list != null && list.size() > 0){
-                        for (HotMaterial material : list){
-                            material.setAppCode(appCode);
-                            material.setAppName(appName);
-                            material.setVideoUrl(getRealVideoUrl("https://aweme.snssdk.com/aweme/v1/playwm/?video_id="+material.getVid()+"&line=0"));
-                            if(material.getVideoUrl() == null){
-                                material.setVideoUrl(getVideoUrl(material.getVid()));
-                            }
-//                            material.setVideoUrl(getVideoUrl(material.getVid()));
-                            material.setCoverImage(getVideoFirstImage(material.getVideoUrl()));
-                            if(material.getCoverImage() == null){
-                                Thread.sleep(1000);
-                                material.setCoverImage(getVideoFirstImage(material.getVideoUrl()));
-                            }
-                            hotMaterialService.saveOrUpdate(material);
-                        }
-                        hotMaterialHandler(page+1,appCode,appName);
-                    }
-                }
-            }
-        }catch (Exception e){
-            e.printStackTrace();
-        }
-    }
-
-    public static String getVideoUrl(String vid) throws Exception {
-        String url = "http://i.snssdk.com/video/urls/1/toutiao/mp4/"+vid;
-        String result = HttpUtils2.httpGetRequest(url);
-        ObjectMapper mapper = new ObjectMapper();
-        if(result != null){
-            JsonNode node = mapper.readTree(result);
-            String mainUrl = node.get("data").get("video_list").get("video_1").get("main_url").asText();
-            return Base64Utils.decode(mainUrl);
-        }
-        return null;
-    }
-    private void effectCaseHandler(int page){
-        String result = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/case/effect_case_list?industry=0&style=0&mode=0&page="+page+"&limit=20");
-        ObjectMapper mapper = new ObjectMapper();
-        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-        try {
-            JsonNode node = mapper.readTree(result);
-            int code = node.get("code").asInt();
-            if(code == 0) {
-                if (node.get("data") != null) {
-                    String dataJson = node.get("data").get("effect_cases").toString();
-                    List<EffectCase> list = mapper.readValue(dataJson,new TypeReference<List<EffectCase>>() {});
-                    if (list != null && list.size() > 0) {
-                        for (EffectCase effectCase:list){
-                            String resultDetail = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/case/effect_case/"+effectCase.getId());
-                            JsonNode detailNode = mapper.readTree(resultDetail);
-                            int detailCode = detailNode.get("code").asInt();
-                            if(detailCode == 0){
-                                if(detailNode.get("data") != null){
-//                                    String detailJson = node.get("data").get("effect_cases").toString();
-//                                    EffectCase effectCase1 = mapper.readValue(detailJson,EffectCase.class);
-                                    effectCase.setAuthor(detailNode.get("data").get("effect_case").get("author").asText());
-                                    effectCase.setCreateDate(detailNode.get("data").get("effect_case").get("create_date").asText());
-                                    effectCase.setCreativeId(detailNode.get("data").get("effect_case").get("creative_id").asLong());
-                                    effectCase.setCreativeScore(detailNode.get("data").get("effect_case").get("creative_score").asText());
-                                    effectCase.setEffect(detailNode.get("data").get("effect_case").get("effect").toString());
-                                    effectCase.setMethods(detailNode.get("data").get("effect_case").get("methods").toString());
-                                    effectCase.setVideoUrl(getRealVideoUrl("https://aweme.snssdk.com/aweme/v1/playwm/?video_id="+effectCase.getVid()+"&line=0"));
-                                    if (effectCase.getVideoUrl() == null){
-                                        effectCase.setVideoUrl(getVideoUrl(effectCase.getVid()));
-                                    }
-//                                    effectCase.setVideoUrl(getVideoUrl(effectCase.getVid()));
-                                    effectCase.setCoverImage(getVideoFirstImage(effectCase.getVideoUrl()));
-                                    if (effectCase.getCoverImage() == null){
-                                        Thread.sleep(1000);
-                                        effectCase.setCoverImage(getVideoFirstImage(effectCase.getVideoUrl()));
-                                    }
-                                    effectCase.setCreativeLabel(detailNode.get("data").get("effect_case").get("creative_label").toString());
-                                }
-                            }
-                            effectCaseService.saveOrUpdate(effectCase);
-                        }
-                        effectCaseHandler(page+1);
-                    }
-                }
-            }
-        }catch (Exception e){
-            e.printStackTrace();
-        }
-    }
-
-    private String getVideoFirstImage(String url){
-        try {
-            FFmpegFrameGrabber ff = new FFmpegFrameGrabber(url);
-            ff.start();
-            int lenght = ff.getLengthInFrames();
-            int i = 0;
-            Frame f = null;
-            while (i < lenght) {
-// 过滤前5帧,避免出现全黑的图片,依自己情况而定
-                f = ff.grabFrame();
-                if ((i > 5) && (f.image != null)) {
-                    break;
-                }
-                i++;
-            }
-//            opencv_core.IplImage img = f.image;
-            int owidth = f.imageWidth;
-            int oheight = f.imageHeight;
-            Java2DFrameConverter converter =new Java2DFrameConverter();
-            BufferedImage fecthedImage =converter.getBufferedImage(f);
-// 对截取的帧进行等比例缩放
-            int width = 800;
-            int height = (int) (((double) width / owidth) * oheight);
-            BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
-            bi.getGraphics().drawImage(fecthedImage.getScaledInstance(width, height, Image.SCALE_SMOOTH),
-                    0, 0, null);
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();//io流
-            ImageIO.write(bi, "jpg", baos);
-            byte[] bytes = baos.toByteArray();//转换成字节
-            String png_base64 = Base64.getEncoder().encodeToString(bytes).trim();//转换成base64串
-            png_base64 = png_base64.replaceAll("\n", "").replaceAll("\r", "");//删除 \r\n
-            //        ImageIO.write(bufferedImage, "png", new File("D:/qrcode1.png"));
-            baos.close();
-            ff.close();
-            return "data:image/jpg;base64,"+png_base64;
-        }catch (Exception e){
-            e.printStackTrace();
-            return null;
-        }
-
-    }
-    private void douyinHotHandler(int page,int listType){
-        String result = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/hot_video/user_side/list?page="+page+"&limit=20&list_type="+listType+"&aggr_duration_type=-1");
-        ObjectMapper mapper = new ObjectMapper();
-        try {
-            JsonNode node = mapper.readTree(result);
-            int code = node.get("code").asInt();
-            if(code == 0){
-                if(node.get("data")!= null){
-                    String dataJson = node.get("data").get("items").toString();
-                    List<DouyinHot> list = mapper.readValue(dataJson,new TypeReference<List<DouyinHot>>() {});
-                    if (list != null && list.size() > 0){
-                        for (DouyinHot douyinHot : list){
-                            douyinHot.setUrl(getRealVideoUrl("https://aweme.snssdk.com/aweme/v1/playwm/?video_id="+douyinHot.getVideoId()+"&line=0"));
-                            if(douyinHot.getUrl() == null){
-                                douyinHot.setUrl(getVideoUrl(douyinHot.getVideoId()));
-                            }
-//                            douyinHot.setUrl(getVideoUrl(douyinHot.getVideoId()));
-                            douyinHot.setCoverImage(getVideoFirstImage(douyinHot.getUrl()));
-                            if(douyinHot.getCoverImage() == null){
-                                Thread.sleep(1000);
-                                douyinHot.setCoverImage(getVideoFirstImage(douyinHot.getUrl()));
-                            }
-                            douyinHotService.saveOrUpdate(douyinHot);
-                        }
-                        douyinHotHandler(page+1,listType);
-                    }else {
-                        if(listType < 4){
-                            douyinHotHandler(1,listType+1);
-                        }
-                    }
-                }
-            }
-        }catch (Exception e){
-            e.printStackTrace();
-        }
-
-    }
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         String account="3248395570@qq.com";
         String password = "Ydxq-704127411";
-        login(account,password);
-        douyinHotHandler(1,1);
-        effectCaseHandler(1);
-        hotMaterialHandler(1,1,"西瓜");
-        hotMaterialHandler(1,3,"火山");
-        hotMaterialHandler(1,4,"抖音");
-        hotMaterialHandler(1,8,"头条");
-        hotMaterialHandler(1,9,"穿山甲");
+        oceanEngineService.login(account,password);
+        oceanEngineService.douyinHotHandler(1,1);
+        oceanEngineService.effectCaseHandler(1);
+        oceanEngineService.hotMaterialHandler(1,1,"西瓜");
+        oceanEngineService.hotMaterialHandler(1,3,"火山");
+        oceanEngineService.hotMaterialHandler(1,4,"抖音");
+        oceanEngineService.hotMaterialHandler(1,8,"头条");
+        oceanEngineService.hotMaterialHandler(1,9,"穿山甲");
         log.info("巨量创意抓取完成");
     }
-
-    private void login(String account,String password){
-        String url = "https://cc.oceanengine.com/login";
-        System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
-        ChromeOptions chromeOptions = new ChromeOptions();
-        chromeOptions.addArguments("--headless");
-        chromeOptions.addArguments("--no-sandbox");
-        chromeOptions.addArguments("--window-size=1920,1080");
-        chromeOptions.addArguments("--user-agent=" + HttpUtils2.USER_AGENT);
-        chromeOptions.setAcceptInsecureCerts(true);
-        WebDriver webDriver = new ChromeDriver(chromeOptions);
-        //清除所有的缓存
-        webDriver.manage().deleteAllCookies();
-        try {
-            //获取登录页面
-            webDriver.get(url);
-            for (Cookie cookie : webDriver.manage().getCookies()) {
-                BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());
-                ck.setDomain("oceanengine.com");
-                ck.setExpiryDate(cookie.getExpiry());
-                ck.setPath(cookie.getPath());
-                HttpUtils2.cookieStore.addCookie(ck);
-            }
-            Map<String, String> header = new HashMap<>();
-            header.put("Accept", "*/*");
-            header.put("Connection", "keep-alive");
-            header.put("Host", "sso.toutiao.com");
-            header.put("Content-Type", "application/x-www-form-urlencoded");
-            header.put("Origin", "https://cc.oceanengine.com");
-            header.put("Referer", "https://cc.oceanengine.com/login");
-            Map<String, Object> param = new HashMap<>();
-            param.put("mobile", "");
-            param.put("code", "");
-            param.put("account", account);
-            param.put("password", password);
-            param.put("captcha", "hqde");
-            param.put("is_30_days_no_login", "true");
-            param.put("service", "https://cc.oceanengine.com");
-            String res = HttpUtils2.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
-            ObjectMapper mapper = new ObjectMapper();
-            mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-            JsonNode jsonNode = mapper.readTree(res);
-            //errorcode == 1102 验证码错误,请重新输入验证码
-            //errorcode == 1101 验证码为空
-
-            Integer errorCode = jsonNode.get("error_code").asInt();
-            String orderId = null;
-            while (errorCode != 0) {
-                //用户名或者密码错误
-                if (null != errorCode && errorCode == 1009) {
-                    return;
-                }
-                FateadmUtil fateadmUtil = new FateadmUtil();
-                fateadmUtil.init();
-                if (orderId != null) {
-                    fateadmUtil.justice(orderId);
-                }
-                String captcha = jsonNode.get("captcha").asText();
-                Base64.Decoder decoder = Base64.getDecoder();
-                FateadmHttpUtil.HttpResp resp = fateadmUtil.Predict("30400", decoder.decode(captcha));
-                param.put("captcha", resp.predResl);
-                orderId = resp.reqId;
-                res = HttpUtils2.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
-                jsonNode = mapper.readTree(res);
-                errorCode = jsonNode.get("error_code").asInt();
-            }
-            if (errorCode == 0) {
-                //表示登录成功
-                List<org.apache.http.cookie.Cookie> cookies = HttpUtils2.cookieStore.getCookies();
-                for (org.apache.http.cookie.Cookie ck : cookies) {
-                    Cookie cookie = new Cookie(ck.getName(), ck.getValue(), "." + ck.getDomain(), ck.getPath(), ck.getExpiryDate());
-                    webDriver.manage().addCookie(cookie);
-                }
-                String redirectUrl = jsonNode.get("redirect_url").asText();
-                webDriver.get(redirectUrl);
-                //登录成功 进入推广页面
-                webDriver.get("https://cc.oceanengine.com/inspiration/douyin-rank-list");
-                Thread.sleep(3000);
-                for (Cookie cookie : webDriver.manage().getCookies()) {
-                    BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());
-                    ck.setDomain("cc.oceanengine.com");
-                    ck.setExpiryDate(cookie.getExpiry());
-                    ck.setPath(cookie.getPath());
-                    HttpUtils2.cookieStore.addCookie(ck);
-                }
-
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            //获得cookie
-            Set<Cookie> coo = webDriver.manage().getCookies();
-            //清除所有的缓存
-            webDriver.manage().deleteAllCookies();
-            webDriver.quit();
-        }
-    }
 }

+ 2 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/PangolinLoginJob.java

@@ -2,8 +2,8 @@ package org.jeecg.modules.ctop.job;
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinLoginService;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
@@ -18,10 +18,7 @@ public class PangolinLoginJob implements Job {
     private PangolinLoginService pangolinLoginService;
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("login_type","pangolin");
-        queryWrapper.eq("status",1);
-        List<BindAccountLogin> list = bindAccountLoginService.list(queryWrapper);
+        List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_PANGOLIN_PY,1);
         if(list!=null&&!list.isEmpty()){
             for (BindAccountLogin login:list) {
                 if(null==login.getCookie()||"".equals(login.getCookie().trim())){

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICreateInternalService.java

@@ -6,5 +6,5 @@ public interface ICreateInternalService {
 
     Map<String, Object> checkAccountPassword(String account, String password);
 
-    Map<String, Object> bindLogin(String advertiserId, String accountName, String password, String loginType, String userId, String advertiserName);
+    Map<String, Object> bindLogin(Long projectId,String advertiserId, String accountName, String password, String loginType, String userId, String advertiserName);
 }

+ 4 - 13
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java

@@ -35,25 +35,15 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
     private BindAccountLoginMapper bindAccountLoginMapper;
 
     @Override
-    public Map<String, Object> bindLogin(String advertiserId, String accountName, String password, String loginType, String userId, String advertiserName) {
+    public Map<String, Object> bindLogin(Long projectId,String advertiserId, String accountName, String password, String loginType, String userId, String advertiserName) {
         Map<String, Object> returnMap = new HashMap<>();
         Map<String, Object> requestMap = new HashMap<>();
         requestMap.put("advertiser_id", advertiserId);
         requestMap.put("account_name", accountName);
         requestMap.put("login_type", loginType);
         requestMap.put("user_id", userId);
-        Map<String, Object> deleteMap = new HashMap<>();
-        deleteMap.put("advertiser_id", advertiserId);
-        deleteMap.put("account_name", accountName);
-        deleteMap.put("login_type", loginType);
-        deleteMap.put("user_id", userId);
-        bindAccountLoginMapper.deleteByMap(deleteMap);
-        List<BindAccountLogin> bindAccounts = bindAccountLoginMapper.selectByMap(requestMap);
-        if (!Check.isNull(bindAccounts)) {
-            returnMap.put("success", false);
-            returnMap.put("message", "账号已存在");
-            return returnMap;
-        }
+        requestMap.put("project_id", projectId);
+        bindAccountLoginMapper.deleteByMap(requestMap);
         String accountId = "";
         //头条登录
         if (null != loginType && loginType.equals(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_PY)) {
@@ -72,6 +62,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
         bindAccountLogin.setPassword(password);
         bindAccountLogin.setAccountId(accountId);
         bindAccountLogin.setLoginType(loginType);
+        bindAccountLogin.setProjectId(projectId);
         bindAccountLogin.setUserId(userId);
         int i = bindAccountLoginMapper.insert(bindAccountLogin);
         if (i > 0) {

+ 4 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/MaterialTopServiceImpl.java

@@ -20,12 +20,12 @@ import org.springframework.stereotype.Service;
 public class MaterialTopServiceImpl  implements IMaterialTopService {
 
     @Autowired
-    MaterialTopMapper materialTopMapper;
+    private MaterialTopMapper materialTopMapper;
 
     @Override
     public IPage<MaterialTopVO> selectByPage(String endDate, String startDate, String target, String order, int pageNo, int pageSize) {
-        QueryWrapper<MaterialTopVO> wrapper = new QueryWrapper();
-        wrapper.ge("stat_date", startDate).le("stat_date", endDate).isNotNull("url");
+        QueryWrapper<MaterialTopVO> wrapper = new QueryWrapper<>();
+        wrapper.ge("stat_date", startDate).le("stat_date", endDate).ne("url","").isNotNull("url");
         target = StringUtils.humpToLine2(target);
         if(order.equals(CtopAdConstant.COMMON_ORDER_TYPE_ASC)){
             wrapper.orderByAsc(target);
@@ -34,8 +34,7 @@ public class MaterialTopServiceImpl  implements IMaterialTopService {
         }
         wrapper.groupBy("code");
         Page<MaterialTopVO> page = new Page<>((pageNo-1)*pageSize,pageSize);
-        IPage<MaterialTopVO> mapIPage = materialTopMapper.selectMapsPage(page, wrapper);
-        return mapIPage;
+        return materialTopMapper.selectMapsPage(page, wrapper);
     }
 
     @Override

+ 144 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/opencv/utils/ExtractionVideoKeyFrames.java

@@ -0,0 +1,144 @@
+package org.jeecg.modules.opencv.utils;
+
+import org.opencv.core.*;
+import org.opencv.imgcodecs.Imgcodecs;
+import org.opencv.imgproc.Imgproc;
+import org.opencv.videoio.VideoCapture;
+import org.opencv.videoio.Videoio;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ExtractionVideoKeyFrames {
+    Mat computeColorHist3D(Mat im, Size size)
+    {
+        Mat dst = new Mat(), hist = new Mat();
+        Imgproc.resize(im, dst, size, 0, 0, Imgproc.INTER_NEAREST);
+        Mat hsv_src = new Mat();
+        Imgproc.cvtColor(im, hsv_src, Imgproc.COLOR_BGR2HSV);
+        List<Mat> images=new ArrayList<Mat>(3);
+        images.add(hsv_src);
+
+        MatOfInt channels= new MatOfInt(0);
+        MatOfInt hSize = new MatOfInt(256);
+        MatOfFloat ranges= new MatOfFloat(0,255);
+        //获取图像直方图
+        Imgproc.calcHist(images, channels, new Mat(), hist, hSize, ranges);
+        return hist;
+    }
+
+    Mat computeColorHist(Mat im, Size size)
+    {
+        Mat dst = new Mat(), hist = new Mat();
+        Imgproc.resize(im, dst, size, 0, 0, Imgproc.INTER_NEAREST);
+        Mat gray = new Mat(im.size(),CvType.CV_8UC1);
+        Imgproc.cvtColor(im,gray,Imgproc.COLOR_RGB2GRAY);
+
+        List<Mat> images = new ArrayList<Mat>();
+        images.add(gray);
+
+        MatOfInt channels= new MatOfInt(0);
+        MatOfInt hSize = new MatOfInt(128);
+        MatOfFloat ranges= new MatOfFloat(0,128);
+        Imgproc.calcHist(images, channels, new Mat(), hist, hSize, ranges);
+        return hist;
+    }
+
+    double computeASE(Mat a, Mat b) {
+        return  1 - Imgproc.compareHist(a, b, 0);
+    }
+
+    int ExtractKeyframes(String videoPath, double rate, String outImgPath){
+        VideoCapture cap = new VideoCapture();
+        System.out.println(cap.isOpened());
+        if (!cap.open(videoPath)) {
+            System.out.println("Open video file error!");
+            return -1;
+        }
+
+        File file = new File(outImgPath);
+        if(!file.exists()){
+            file.mkdirs();
+        }
+        //  Videoio.CAP_PROP_FRAME_COUNT
+        int width = (int)cap.get(Videoio.CAP_PROP_FRAME_WIDTH);
+        int height = (int)cap.get(Videoio.CAP_PROP_FRAME_HEIGHT);
+        float fps = (float)cap.get(Videoio.CAP_PROP_FPS);
+        int nframes = (int)cap.get(Videoio.CAP_PROP_FRAME_COUNT);
+        System.out.println("W:"+width+";H:"+height+";FPS:"+fps+";N:"+nframes);
+
+        int nscale = 1;
+        if (width%4==0 && height%4==0){
+            nscale = 4;
+        }else if (width%2==0 && height%2==0){
+            nscale = 2;
+        }
+        Size size = new Size(width/nscale, height/nscale);
+
+        Mat frame = new Mat();
+        Mat lastFrame = new Mat();
+        Mat histA = new Mat();
+        Mat histB = new Mat();
+        long nCount = 0;
+        int frameID = 1;
+        int lastFrameID = 1;
+        double tic = (double)Core.getTickCount();
+        while (cap.read(frame)) {
+            if (frame.empty()){
+                break;
+            }
+
+            if (lastFrameID==1) {
+                frameID = (int)cap.get(Videoio.CAP_PROP_POS_FRAMES);
+                lastFrameID = frameID;
+                frame.copyTo(lastFrame);
+                continue;
+            }
+            if (++nCount % 15 != 0){
+                continue;	// Processing one frame in each second
+            }
+
+            frameID = (int)cap.get(Videoio.CAP_PROP_POS_FRAMES);
+            histA = computeColorHist3D(frame, size);
+
+            double aseV = rate;
+            if (histB.empty()){
+                System.out.println(aseV);
+            }
+            else{
+                aseV = computeASE(histA, histB);
+                System.out.println(aseV);
+            }
+
+            if (aseV >= rate) {
+                String imagePath = outImgPath+"/"+lastFrameID+".jpg";
+                if (!Imgcodecs.imwrite(imagePath, lastFrame)){
+                    return -2;
+                }
+                lastFrameID = frameID;
+                frame.copyTo(lastFrame);
+            }
+
+            histA.copyTo(histB);
+        }
+
+        if (!lastFrame.empty()) {
+            String imagePath=outImgPath+"/"+ lastFrameID+".jpg";
+            if (!Imgcodecs.imwrite(imagePath, lastFrame)){
+                return -2;
+            }
+        }
+        System.out.println("NFRAMES(in reality)="+nCount);
+
+        double toc = (double)Core.getTickCount();
+        System.out.println("ELAPSED TIME="+(toc-tic)/Core.getTickFrequency());
+        return 0;
+    }
+
+    public static void main(String[] args) {
+        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
+        ExtractionVideoKeyFrames evf = new ExtractionVideoKeyFrames();
+        evf.ExtractKeyframes("D:\\data\\fill.mp4",0.5,"D:\\data\\");
+    }
+}

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -152,7 +152,7 @@ jeecg:
     webapp: /data/webapp
     video-upload: /data/upload/video/
     image-upload: /data/upload/image/
-    chrome-driver: /usr/bin/chromedriver
+    chrome-driver: D://chromedriver.exe
     csv-upload: /data/upload/csv/
     report-history: /data/report/history/
     report-daily: /data/report/daily/

+ 70 - 67
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -1,24 +1,20 @@
 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.pangolin.entity.PangolinApp;
-import cn.com.ctop.crawler.modules.pangolin.service.PangolinAppService;
-import cn.com.ctop.crawler.modules.pangolin.service.PangolinCrawlerService;
-import cn.com.ctop.crawler.modules.pangolin.service.PangolinLoginService;
-import cn.com.ctop.toutiao.modules.report.service.IBytedanceFundDailyService;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+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 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.util.HashMap;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
@@ -29,87 +25,94 @@ import java.util.concurrent.Executors;
 @Slf4j
 public class SampleTest {
     @Autowired
-    private IBindAccountLoginService bindAccountLoginService;
+    private IOceanEngineService oceanEngineService;
     @Autowired
-    private PangolinLoginService pangolinLoginService;
+    private IHotMaterialService hotMaterialService;
+    @Test
+    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";
+//                EffectCase.base64ToFile(destPath,image,fileName);
+            });
+        }
+    }
+    @Test
+    public void testOceanEngineJob(){
+        String account="3248395570@qq.com";
+        String password = "Ydxq-704127411";
+        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,"穿山甲");
+        log.info("巨量创意抓取完成");
+    }
+
     @Autowired
-    private PangolinCrawlerService pangolinCrawlerService;
+    private IBindAccountLoginService bindAccountLoginService;
     @Autowired
-    private PangolinAppService pangolinAppService;
+    private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
     @Test
-    public void testPangolinLogin(){
-        QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("login_type","pangolin");
-        queryWrapper.eq("status",1);
-        List<BindAccountLogin> list = bindAccountLoginService.list(queryWrapper);
+    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())){
-                    pangolinLoginService.pangolinLogin(login.getAccountName(), login.getPassword());
-                }
-            }
-        }
-    }
-
-    @Test
-    public void testPangolinData(){
-        QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("login_type", "pangolin");
-        queryWrapper.eq("status", 1);
-        queryWrapper.isNotNull("cookie");
-        List<BindAccountLogin> list = bindAccountLoginService.list(queryWrapper);
-        if (list != null && !list.isEmpty()) {
-            for (BindAccountLogin bindAccountLogin : list) {
-                pangolinCrawlerService.getChannelList(bindAccountLogin);
-                pangolinCrawlerService.getActivationList(bindAccountLogin, DateUtils.getNowDate("yyyy-MM-dd"), 1);
-                pangolinCrawlerService.getCheckList(bindAccountLogin);
-                QueryWrapper<PangolinApp> queryWrapper1 = new QueryWrapper<>();
-                queryWrapper1.eq("account_name", bindAccountLogin.getAccountName());
-                List<PangolinApp> appList = pangolinAppService.list(queryWrapper1);
-                if (appList != null && !appList.isEmpty()) {
-                    appList.forEach(pangolinApp -> pangolinCrawlerService.getRealTimeList(bindAccountLogin, pangolinApp.getId()));
+                    kuaishouWebInterfaceService.getkuaishouWebLoginCookie(login);
                 }
             }
         }
+        Long end = System.currentTimeMillis();
+        log.info("总用时:{}毫秒",end-start);
     }
-
-    @Autowired
-    private ICtopOauthTokenService tokenService;
-    @Autowired
-    private IBytedanceFundDailyService bytedanceFundDailyService;
     static ExecutorService executorService = null;
-
-
+    static CountDownLatch countDownLatch = null;
     @Test
-    public void testflowFund(){
-        List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
-            log.error("头条账户流水数据异常:未获取到可用的token");
-            return ;
-        }
-        CountDownLatch countDownLatch   = new CountDownLatch(tokens.size());
-        executorService = Executors.newFixedThreadPool(5);
-        tokens.forEach(token -> {
-            executorService.submit(() -> {
-                try {
-                    for(int i=0;i<60;i++){
-                        String findDate = DateUtils.addDay(DateUtils.formatDate(),-i);
-                        bytedanceFundDailyService.loadFundDataByPage(token, findDate, findDate,1);
+    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(()->{
+                    try {
+                        if(null!=login.getCookie()&&!"".equals(login.getCookie().trim())){
+                            kuaishouWebInterfaceService.deleteAllComment(new HashMap<>(),login);
+                        }
+                    }catch (Exception e){
+
+                    }finally {
+                        countDownLatch.countDown();
                     }
-                }catch (Exception e){
-                }finally {
-                    countDownLatch.countDown();
-                }
+                });
             });
-        });
+        }
         try {
             countDownLatch.await();
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
+        Long end = System.currentTimeMillis();
+        log.info("总用时:{}毫秒",end-start);
     }
+    @Test
+    public void testBase64(){
 
+    }
 }
+//刷新token:885936毫秒
+
+
 
 
 

+ 10 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/BindAccountLogin.java

@@ -101,4 +101,14 @@ public class BindAccountLogin {
     private Date updateTime;
 
     private String cookie;
+
+    public BindAccountLogin(Long id,String accountName) {
+        this.id = id;
+        this.accountName = accountName;
+    }
+
+    public BindAccountLogin() {
+    }
+
+    private Long projectId;
 }

+ 15 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IBindAccountLoginService.java

@@ -2,6 +2,11 @@ package cn.com.ctop.common.module.service;
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.apache.http.client.CookieStore;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 账号绑定-登陆
@@ -10,6 +15,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @Version: V1.0
  */
 public interface IBindAccountLoginService extends IService<BindAccountLogin> {
+    boolean checkLogin(BindAccountLogin bindAccountLogin, String response);
+
     /**
      * 查询
      *
@@ -17,4 +24,12 @@ public interface IBindAccountLoginService extends IService<BindAccountLogin> {
      * @return
      */
     BindAccountLogin selectByAccountId(String accountId);
+
+    Map<String, Object> getListByUserId(String userId);
+
+    List<BindAccountLogin> getListByParams(String loginType,Integer status);
+
+    CookieStore setCookie(BindAccountLogin bindAccountLogin,String domain) throws JsonProcessingException;
+
+    BindAccountLogin getByParams(String accountName, String password, String advertiserId);
 }

+ 4 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java

@@ -17,5 +17,9 @@ public interface IUserAllocationService extends IService<UserAllocation> {
 
     List<UserAllocation> getByProjectId(Long projectId, String systemType);
 
+    Map<String, Object> getPangolinAccountListByParams(String userId, JSONObject data);
+
+    Map<String, Object> getPangolinProjectListByParams(String userId);
+
     List<UserAllocation> selectAccountListByProjectId(Long projectId);
 }

+ 94 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountLoginServiceImpl.java

@@ -3,12 +3,26 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.mapper.BindAccountLoginMapper;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.http.client.CookieStore;
+import org.apache.http.impl.client.BasicCookieStore;
+import org.apache.http.impl.cookie.BasicClientCookie;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * @Description: 账号绑定-登陆
  * @Author: jeecg-boot
@@ -17,12 +31,91 @@ import org.springframework.stereotype.Service;
  */
 @Slf4j
 @Service
-@Primary
 public class BindAccountLoginServiceImpl extends ServiceImpl<BindAccountLoginMapper, BindAccountLogin> implements IBindAccountLoginService {
     @Override
+    public boolean checkLogin(BindAccountLogin bindAccountLogin, String response) {
+        if (response.contains("<html>")) {
+            bindAccountLogin.setCookie("");
+            this.updateById(bindAccountLogin);
+            return false;
+        }
+        return true;
+    }
+    @Override
     public BindAccountLogin selectByAccountId(String accountId) {
         QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("account_id", accountId).orderByDesc("id").last("limit 1");
         return this.getOne(queryWrapper);
     }
+
+    @Override
+    public BindAccountLogin getByParams(String accountName, String password, String advertiserId) {
+        QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
+        if(null!=accountName&&!"".equals(accountName)){
+            queryWrapper.eq("account_name",accountName);
+        }
+        if(null!=password&&!"".equals(password)){
+            queryWrapper.eq("password",password);
+        }
+        if(null!=advertiserId&&!"".equals(advertiserId)){
+            queryWrapper.eq("advertiser_id",advertiserId);
+        }
+        queryWrapper.orderByDesc("create_time").last("limit 1");
+        return this.getOne(queryWrapper);
+    }
+
+    @Override
+    public Map<String, Object> getListByUserId(String userId) {
+        Map<String,Object>result = new HashMap<>();
+        QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("login_type", CtopAdConstant.PLATFORM_TYPE_PANGOLIN_PY);
+        List<BindAccountLogin> loginList = new ArrayList<>();
+        if(userId == null||"".equals(userId.trim())){
+            loginList.add(new BindAccountLogin(0L,"全部"));
+        }else{
+            queryWrapper.eq("user_id",userId);
+        }
+        loginList.addAll(this.list(queryWrapper));
+        result.put("data",loginList);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        return result;
+    }
+
+    @Override
+    public List<BindAccountLogin> getListByParams(String loginType, Integer status) {
+        QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
+        if(null!=loginType&&!loginType.equals("")){
+            queryWrapper.eq("login_type",loginType);
+        }
+        if(status!=null){
+            queryWrapper.eq("status",status);
+        }
+        return this.list(queryWrapper);
+    }
+
+    @Override
+    public CookieStore setCookie(BindAccountLogin bindAccountLogin,String domain) throws JsonProcessingException {
+        ObjectMapper mapper = new ObjectMapper();
+        List<String> cookieList = mapper.readValue(bindAccountLogin.getCookie(), new TypeReference<List<String>>() {});
+        if(cookieList == null||cookieList.isEmpty()){
+            return null;
+        }
+        CookieStore cookieStore = new BasicCookieStore();
+        for (String cookieStr : cookieList) {
+            String[] cookieArray = cookieStr.split(";");
+            Map<String, String> cookieMap = new HashMap<>();
+            for (String cookie : cookieArray) {
+                String[] kv = cookie.split("=");
+                if (kv.length > 1) {
+                    cookieMap.put(kv[0].trim(), kv[1].trim());
+                }
+            }
+            BasicClientCookie clientCookie = new BasicClientCookie(cookieArray[0].split("=")[0],
+                    cookieArray[0].split("=")[1]);
+            clientCookie.setDomain(domain);
+            clientCookie.setPath(cookieMap.get("path"));
+            cookieStore.addCookie(clientCookie);
+        }
+        return cookieStore;
+    }
 }

+ 39 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java

@@ -3,13 +3,19 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.context.annotation.Primary;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 用户分配
@@ -44,6 +50,39 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     }
 
     @Override
+    public Map<String, Object> getPangolinAccountListByParams(String userId, JSONObject data) {
+        Map<String,Object>result = new HashMap<>();
+        Long projectId = data.getLong("project_id");
+        QueryWrapper<UserAllocation>queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("media_id", CtopAdConstant.PLATFORM_TYPE_PANGOLIN);
+        if(null != userId&&!"".equals(userId.trim())){
+            queryWrapper.eq("user_id",userId);
+        }
+        if(null != projectId&&projectId != 0){
+            queryWrapper.eq("project_id",projectId);
+        }
+        List<UserAllocation> allocations = this.list(queryWrapper);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        result.put("data",allocations);
+        return result;
+    }
+
+    @Override
+    public Map<String, Object> getPangolinProjectListByParams(String userId) {
+        Map<String,Object>result = new HashMap<>();
+        QueryWrapper<UserAllocation>queryWrapper = new QueryWrapper<>();
+        queryWrapper.select("distinct project_id,project_name");
+        queryWrapper.eq("media_id",CtopAdConstant.PLATFORM_TYPE_PANGOLIN);
+        if(null != userId&&!"".equals(userId.trim())){
+            queryWrapper.eq("user_id",userId);
+        }
+        List<UserAllocation> allocations = this.list(queryWrapper);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        result.put("data",allocations);
+        return result;
+    }
+
+    @Override
     public List<UserAllocation> selectAccountListByProjectId(Long projectId) {
         List<UserAllocation> list = userAllocationMapper.selectAccountListByProjectId(projectId);
         return list;

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/CtopAdConstant.java

@@ -8,6 +8,7 @@ import java.math.BigDecimal;
 public class CtopAdConstant {
     public static final String PLATFORM_TYPE_BYTEDANCE = "1";
     public static final String PLATFORM_TYPE_KUAISHOU = "2";
+    public static final String PLATFORM_TYPE_PANGOLIN = "3";
 
     public static final String PLATFORM_TYPE_BYTEDANCE_PY = "bytedance";
     public static final String PLATFORM_TYPE_KUAISHOU_PY = "kuaishou";

+ 51 - 1
module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils2.java

@@ -45,7 +45,7 @@ public class HttpUtils2 {
     /**
      * setProxy(new HttpHost("106.125.239.179", 4245))
      */
-    public static Map<String, Map<String, String>> fontsMap = new HashMap<String, Map<String, String>>();
+    public static Map<String, Map<String, String>> fontsMap = new HashMap<>();
     public static String USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36";
 
     public static CloseableHttpClient createSSLClientDefault() {
@@ -66,6 +66,24 @@ public class HttpUtils2 {
         return HttpClients.createDefault();
     }
 
+    public static CloseableHttpClient createSSLClientDefault(CookieStore setCookieStore) {
+        try {
+            SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy() {
+                //信任所有证书
+                @Override
+                public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
+                    return true;
+                }
+            }).build();
+            RequestConfig globalConfig = RequestConfig.custom().setConnectTimeout(30000).setSocketTimeout(30000).setCookieSpec(CookieSpecs.STANDARD).build();
+            SSLConnectionSocketFactory sslFactory = new SSLConnectionSocketFactory(sslContext);
+            return HttpClients.custom().setDefaultCookieStore(setCookieStore).setDefaultRequestConfig(globalConfig).setConnectionReuseStrategy((response, context) -> false).setSSLSocketFactory(sslFactory).build();
+        } catch (Exception e) {
+            log.error("处理Https证书异常", e);
+        }
+        return HttpClients.createDefault();
+    }
+
     public static String httpPostParamRequest(String url, Map<String, Object> param, Map<String, String> headers) {
         HttpClient httpClient = createSSLClientDefault();
         String strReturn = "";
@@ -569,4 +587,36 @@ public class HttpUtils2 {
     }
 
 
+    public static String httpPostRequest(String url, Map<String, Object> param, Map<String, String> headers, CookieStore cookieStore) {
+        HttpClient httpClient = createSSLClientDefault(cookieStore);
+        String strReturn = "";
+        try {
+            HttpPost httppost = new HttpPost(url);
+            httppost.setHeader("User-Agent", USER_AGENT);
+            httppost.addHeader("Content-Type", "application/json");
+            if (headers != null) {
+                for (String key : headers.keySet()) {
+                    httppost.setHeader(key, headers.get(key));
+                }
+            }
+
+            httppost.setEntity(new StringEntity(new Gson().toJson(param), Charset.forName("UTF-8")));
+            HttpEntity respentity;
+
+            HttpResponse response = httpClient.execute(httppost);
+            int statusCode = response.getStatusLine().getStatusCode();
+            if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
+                String newUrl = response.getFirstHeader("Location").getValue();
+                return httpPostRequest(newUrl, param, headers);
+            } else if (statusCode == HttpStatus.SC_OK) {
+                respentity = response.getEntity();
+                strReturn = EntityUtils.toString(respentity);
+                return strReturn;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage());
+        }
+        return strReturn;
+    }
 }

+ 54 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/FfmpegUtils.java

@@ -0,0 +1,54 @@
+package cn.com.ctop.crawler.modules.core.util;
+
+import org.bytedeco.javacv.FFmpegFrameGrabber;
+import org.bytedeco.javacv.Frame;
+import org.bytedeco.javacv.Java2DFrameConverter;
+
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.util.Base64;
+
+public class FfmpegUtils {
+    public static String getVideoFirstImage(String url){
+        try {
+            FFmpegFrameGrabber ff = new FFmpegFrameGrabber(url);
+            ff.start();
+            int lenght = ff.getLengthInFrames();
+            int i = 0;
+            Frame f = null;
+            while (i < lenght) {
+// 过滤前5帧,避免出现全黑的图片,依自己情况而定
+                f = ff.grabFrame();
+                if ((i > 20) && (f.image != null)) {
+                    break;
+                }
+                i++;
+            }
+//            opencv_core.IplImage img = f.image;
+            int owidth = f.imageWidth;
+            int oheight = f.imageHeight;
+            Java2DFrameConverter converter =new Java2DFrameConverter();
+            BufferedImage fecthedImage =converter.getBufferedImage(f);
+// 对截取的帧进行等比例缩放
+            int width = 800;
+            int height = (int) (((double) width / owidth) * oheight);
+            BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
+            bi.getGraphics().drawImage(fecthedImage.getScaledInstance(width, height, Image.SCALE_SMOOTH),
+                    0, 0, null);
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();//io流
+            ImageIO.write(bi, "jpg", baos);
+            byte[] bytes = baos.toByteArray();//转换成字节
+            String png_base64 = Base64.getEncoder().encodeToString(bytes).trim();//转换成base64串
+            png_base64 = png_base64.replaceAll("\n", "").replaceAll("\r", "");//删除 \r\n
+            //        ImageIO.write(bufferedImage, "png", new File("D:/qrcode1.png"));
+            baos.close();
+            ff.close();
+            return png_base64;
+        }catch (Exception e){
+            e.printStackTrace();
+            return null;
+        }
+    }
+}

+ 1 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/entity/DouyinHot.java

@@ -20,7 +20,7 @@ public class DouyinHot {
     private Long userId;
     @JsonProperty("core_user_name")
     private String userName;
-    private String coverImage;
+    private String coverUrl;
     private String title;
     @JsonProperty("head_image_uri")
     private String headImageUri;

+ 196 - 3
module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/entity/EffectCase.java

@@ -6,16 +6,22 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Data;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.Base64;
 import java.util.Date;
 
-@Data
-@TableName("ctop_oceanengine_effect_case")
 /**
  * 效果案例
  */
+@Data
+@TableName("ctop_oceanengine_effect_case")
 public class EffectCase {
     @TableId(value = "id", type = IdType.INPUT)
     private String id;
+    private String coverUrl;
     private String vid;
     @JsonProperty("creative_label_1")
     @TableField(value = "creative_label_1")
@@ -34,7 +40,7 @@ public class EffectCase {
     private String effect;
     @JsonProperty("conversion_type")
     private String conversionType;
-    private String coverImage;
+//    private String coverImage;
     private String creativeLabel;
     private String tag;
     @JsonProperty("creative_title")
@@ -47,4 +53,191 @@ public class EffectCase {
     private String industryTag;
     private Date createTime;
     private Date updateTime;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getVid() {
+        return vid;
+    }
+
+    public void setVid(String vid) {
+        this.vid = vid;
+    }
+
+    public String getCreativeLabel1() {
+        return creativeLabel1;
+    }
+
+    public void setCreativeLabel1(String creativeLabel1) {
+        this.creativeLabel1 = creativeLabel1;
+    }
+
+    public Integer getCreativeLabel2() {
+        return creativeLabel2;
+    }
+
+    public void setCreativeLabel2(Integer creativeLabel2) {
+        this.creativeLabel2 = creativeLabel2;
+    }
+
+    public String getCreateDate() {
+        return createDate;
+    }
+
+    public void setCreateDate(String createDate) {
+        this.createDate = createDate;
+    }
+
+    public Long getCreativeId() {
+        return creativeId;
+    }
+
+    public void setCreativeId(Long creativeId) {
+        this.creativeId = creativeId;
+    }
+
+    public String getMethods() {
+        return methods;
+    }
+
+    public void setMethods(String methods) {
+        this.methods = methods;
+    }
+
+    public String getVideoUrl() {
+        return videoUrl;
+    }
+
+    public void setVideoUrl(String videoUrl) {
+        this.videoUrl = videoUrl;
+    }
+
+    public String getAuthor() {
+        return author;
+    }
+
+    public void setAuthor(String author) {
+        this.author = author;
+    }
+
+    public String getEffect() {
+        return effect;
+    }
+
+    public void setEffect(String effect) {
+        this.effect = effect;
+    }
+
+    public String getConversionType() {
+        return conversionType;
+    }
+
+    public void setConversionType(String conversionType) {
+        this.conversionType = conversionType;
+    }
+    public String getCreativeLabel() {
+        return creativeLabel;
+    }
+
+    public void setCreativeLabel(String creativeLabel) {
+        this.creativeLabel = creativeLabel;
+    }
+
+    public String getTag() {
+        return tag;
+    }
+
+    public void setTag(String tag) {
+        this.tag = tag;
+    }
+
+    public String getCreativeTitle() {
+        return creativeTitle;
+    }
+
+    public void setCreativeTitle(String creativeTitle) {
+        this.creativeTitle = creativeTitle;
+    }
+
+    public String getCreativeInfo() {
+        return creativeInfo;
+    }
+
+    public void setCreativeInfo(String creativeInfo) {
+        this.creativeInfo = creativeInfo;
+    }
+
+    public String getCreativeScore() {
+        return creativeScore;
+    }
+
+    public void setCreativeScore(String creativeScore) {
+        this.creativeScore = creativeScore;
+    }
+
+    public String getIndustryTag() {
+        return industryTag;
+    }
+
+    public void setIndustryTag(String industryTag) {
+        this.industryTag = industryTag;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public static void base64ToFile(String destPath,String base64, String fileName) {
+        File file = null;
+        //创建文件目录
+        String filePath=destPath;
+        File  dir=new File(filePath);
+        if (!dir.exists() && !dir.isDirectory()) {
+            dir.mkdirs();
+        }
+        BufferedOutputStream bos = null;
+        java.io.FileOutputStream fos = null;
+        try {
+            byte[] bytes = Base64.getMimeDecoder().decode(base64);
+            file=new File(filePath+"/"+fileName);
+            fos = new java.io.FileOutputStream(file);
+            bos = new BufferedOutputStream(fos);
+            bos.write(bytes);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (bos != null) {
+                try {
+                    bos.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (fos != null) {
+                try {
+                    fos.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
 }

+ 1 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/entity/HotMaterial.java

@@ -20,7 +20,7 @@ public class HotMaterial {
     private String videoUrl;
     private String title;
     private Integer appCode;
-    private String coverImage;
+    private String coverUrl;
     private String appName;
     private Date createTime;
     private Date updateTime;

+ 3 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/IDouyinHotService.java

@@ -10,4 +10,7 @@ public interface IDouyinHotService extends IService<DouyinHot> {
     public void replaceBatch(List<DouyinHot> list);
 
     IPage<DouyinHot> queryHotFeeds(String userName, String start, String end, String orderByColumn, String orderByType, Integer pageNo, Integer pageSize);
+
+    List<DouyinHot> getId();
+
 }

+ 5 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/IHotMaterialService.java

@@ -4,6 +4,11 @@ import cn.com.ctop.crawler.modules.oceanengine.entity.HotMaterial;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 public interface IHotMaterialService extends IService<HotMaterial> {
     IPage<HotMaterial> queryHotFeeds(String userName, String start, String end, String orderByColumn, String orderByType, Integer pageNo, Integer pageSize);
+
+    List<HotMaterial> getId();
+
 }

+ 7 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/IOceanEngineService.java

@@ -1,4 +1,11 @@
 package cn.com.ctop.crawler.modules.oceanengine.service;
 
 public interface IOceanEngineService {
+    void hotMaterialHandler(int page, int appCode, String appName);
+
+    void effectCaseHandler(int page);
+
+    void douyinHotHandler(int page, int listType);
+
+    void login(String account, String password);
 }

+ 8 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/impl/DouyinHotServiceImpl.java

@@ -40,4 +40,12 @@ public class DouyinHotServiceImpl extends ServiceImpl<DouyinHotMapper, DouyinHot
         Page<DouyinHot> page = new Page<>(pageNo, pageSize);
         return this.page(page, queryWrapper);
     }
+
+    @Override
+    public List<DouyinHot> getId() {
+        QueryWrapper<DouyinHot> queryWrapper = new QueryWrapper<>();
+        queryWrapper.select("id").orderByDesc("create_time");
+        return this.list(queryWrapper);
+
+    }
 }

+ 2 - 2
module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/impl/EffectCaseServiceImpl.java

@@ -44,9 +44,9 @@ public class EffectCaseServiceImpl extends ServiceImpl<EffectCaseMapper, EffectC
             queryWrapper.between("create_time", start, end);
         }
         if (null != orderByType && "desc".equals(orderByType)) {
-            queryWrapper.orderByDesc(orderByColumn);
-        } else {
             queryWrapper.orderByAsc(orderByColumn);
+        } else {
+            queryWrapper.orderByDesc(orderByColumn);
         }
         Page<EffectCase> page = new Page<>(pageNo, pageSize);
         return this.page(page, queryWrapper);

+ 10 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/impl/HotMaterialServiceImpl.java

@@ -10,6 +10,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
 @Primary
 
@@ -18,7 +20,7 @@ public class HotMaterialServiceImpl extends ServiceImpl<HotMaterialMapper, HotMa
     public IPage<HotMaterial> queryHotFeeds(String userName, String start, String end, String orderByColumn, String orderByType, Integer pageNo, Integer pageSize) {
         QueryWrapper<HotMaterial> queryWrapper = new QueryWrapper<>();
         if (null != userName && !"".equals(userName)) {
-            queryWrapper.like("author", "%" + userName + "%");
+            queryWrapper.like("author", userName);
         }
         if (null != start && !"".equals(start) && null != end && !"".equals(end)) {
             queryWrapper.between("create_time", start, end);
@@ -31,4 +33,11 @@ public class HotMaterialServiceImpl extends ServiceImpl<HotMaterialMapper, HotMa
         Page<HotMaterial> page = new Page<>(pageNo, pageSize);
         return this.page(page, queryWrapper);
     }
+
+    @Override
+    public List<HotMaterial> getId() {
+        QueryWrapper<HotMaterial> queryWrapper = new QueryWrapper<>();
+        queryWrapper.select("id").orderByDesc("create_time");
+        return this.list(queryWrapper);
+    }
 }

+ 317 - 347
module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/impl/OceanEngineServiceImpl.java

@@ -1,347 +1,317 @@
-//package cn.com.ctop.crawler.modules.oceanengine.service.impl;
-//
-//import cn.com.ctop.common.module.utils.Base64Utils;
-//import cn.com.ctop.common.module.utils.HttpUtils2;
-//import cn.com.ctop.crawler.modules.core.util.FateadmHttpUtil;
-//import cn.com.ctop.crawler.modules.core.util.FateadmUtil;
-//import cn.com.ctop.crawler.modules.oceanengine.entity.DouyinHot;
-//import cn.com.ctop.crawler.modules.oceanengine.entity.EffectCase;
-//import cn.com.ctop.crawler.modules.oceanengine.entity.HotMaterial;
-//import cn.com.ctop.crawler.modules.oceanengine.service.IOceanEngineService;
-//import com.fasterxml.jackson.core.type.TypeReference;
-//import com.fasterxml.jackson.databind.DeserializationFeature;
-//import com.fasterxml.jackson.databind.JsonNode;
-//import com.fasterxml.jackson.databind.ObjectMapper;
-//import org.apache.http.impl.cookie.BasicClientCookie;
-//import org.bytedeco.javacv.FFmpegFrameGrabber;
-//import org.bytedeco.javacv.Frame;
-//import org.bytedeco.javacv.Java2DFrameConverter;
-//import org.openqa.selenium.Cookie;
-//import org.openqa.selenium.WebDriver;
-//import org.openqa.selenium.chrome.ChromeDriver;
-//import org.openqa.selenium.chrome.ChromeOptions;
-//import org.quartz.JobExecutionContext;
-//import org.quartz.JobExecutionException;
-//import org.springframework.stereotype.Service;
-//
-//import javax.imageio.ImageIO;
-//import java.awt.*;
-//import java.awt.image.BufferedImage;
-//import java.io.ByteArrayOutputStream;
-//import java.net.HttpURLConnection;
-//import java.net.URL;
-//import java.util.*;
-//import java.util.List;
-//
-//@Service
-//public class OceanEngineServiceImpl implements IOceanEngineService {
-//    public static String getVideoUrlByVid(String vid) {
-//        String url = "https://aweme.snssdk.com/aweme/v1/playwm/?video_id=" + vid + "&line=0";
-//        return getRealVideoUrl(url);
-//    }
-//
-//    public static String getRealVideoUrl(String url) {
-//        try {
-//            URL serverUrl = new URL(url);
-//            HttpURLConnection conn = (HttpURLConnection) serverUrl
-//                    .openConnection();
-//            conn.setRequestMethod("GET");
-//            // 必须设置false,否则会自动redirect到Location的地址
-//            conn.setInstanceFollowRedirects(false);
-//            conn.addRequestProperty("User-Agent",
-//                    "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.8) Firefox/3.6.8");
-//            conn.connect();
-//            String location = conn.getHeaderField("Location");
-//            return location;
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        }
-//        return null;
-//    }
-//    private void hotMaterialHandler(int page,int appCode,String appName){
-//        String result = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/hot_material/list?material_type=3&order_by=convert_show_rate&period_type=3&aggr_app_code="+appCode+"&page="+page+"&limit=20");
-//        ObjectMapper mapper = new ObjectMapper();
-//        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-//        try {
-//            JsonNode node = mapper.readTree(result);
-//            int code = node.get("code").asInt();
-//            if (code == 0) {
-//                if (node.get("data") != null&&node.get("data").get("materials")!=null) {
-//                    String dataJson = node.get("data").get("materials").toString();
-//                    List<HotMaterial> list = mapper.readValue(dataJson,new TypeReference<List<HotMaterial>>() {});
-//                    if(list != null && list.size() > 0){
-//                        for (HotMaterial material : list){
-//                            material.setAppCode(appCode);
-//                            material.setAppName(appName);
-//                            material.setVideoUrl(getRealVideoUrl("https://aweme.snssdk.com/aweme/v1/playwm/?video_id="+material.getVid()+"&line=0"));
-//                            if(material.getVideoUrl() == null){
-//                                material.setVideoUrl(getVideoUrl(material.getVid()));
-//                            }
-////                            material.setVideoUrl(getVideoUrl(material.getVid()));
-//                            material.setCoverImage(getVideoFirstImage(material.getVideoUrl()));
-//                            if(material.getCoverImage() == null){
-//                                Thread.sleep(1000);
-//                                material.setCoverImage(getVideoFirstImage(material.getVideoUrl()));
-//                            }
-//                            hotMaterialService.saveOrUpdate(material);
-//                        }
-//                        hotMaterialHandler(page+1,appCode,appName);
-//                    }
-//                }
-//            }
-//        }catch (Exception e){
-//            e.printStackTrace();
-//        }
-//    }
-//
-//    public static String getVideoUrl(String vid) throws Exception {
-//        String url = "http://i.snssdk.com/video/urls/1/toutiao/mp4/"+vid;
-//        String result = HttpUtils2.httpGetRequest(url);
-//        ObjectMapper mapper = new ObjectMapper();
-//        if(result != null){
-//            JsonNode node = mapper.readTree(result);
-//            String mainUrl = node.get("data").get("video_list").get("video_1").get("main_url").asText();
-//            return Base64Utils.decode(mainUrl);
-//        }
-//        return null;
-//    }
-//    private void effectCaseHandler(int page){
-//        String result = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/case/effect_case_list?industry=0&style=0&mode=0&page="+page+"&limit=20");
-//        ObjectMapper mapper = new ObjectMapper();
-//        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-//        try {
-//            JsonNode node = mapper.readTree(result);
-//            int code = node.get("code").asInt();
-//            if(code == 0) {
-//                if (node.get("data") != null) {
-//                    String dataJson = node.get("data").get("effect_cases").toString();
-//                    List<EffectCase> list = mapper.readValue(dataJson,new TypeReference<List<EffectCase>>() {});
-//                    if (list != null && list.size() > 0) {
-//                        for (EffectCase effectCase:list){
-//                            String resultDetail = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/case/effect_case/"+effectCase.getId());
-//                            JsonNode detailNode = mapper.readTree(resultDetail);
-//                            int detailCode = detailNode.get("code").asInt();
-//                            if(detailCode == 0){
-//                                if(detailNode.get("data") != null){
-////                                    String detailJson = node.get("data").get("effect_cases").toString();
-////                                    EffectCase effectCase1 = mapper.readValue(detailJson,EffectCase.class);
-//                                    effectCase.setAuthor(detailNode.get("data").get("effect_case").get("author").asText());
-//                                    effectCase.setCreateDate(detailNode.get("data").get("effect_case").get("create_date").asText());
-//                                    effectCase.setCreativeId(detailNode.get("data").get("effect_case").get("creative_id").asLong());
-//                                    effectCase.setCreativeScore(detailNode.get("data").get("effect_case").get("creative_score").asText());
-//                                    effectCase.setEffect(detailNode.get("data").get("effect_case").get("effect").toString());
-//                                    effectCase.setMethods(detailNode.get("data").get("effect_case").get("methods").toString());
-//                                    effectCase.setVideoUrl(getRealVideoUrl("https://aweme.snssdk.com/aweme/v1/playwm/?video_id="+effectCase.getVid()+"&line=0"));
-//                                    if (effectCase.getVideoUrl() == null){
-//                                        effectCase.setVideoUrl(getVideoUrl(effectCase.getVid()));
-//                                    }
-////                                    effectCase.setVideoUrl(getVideoUrl(effectCase.getVid()));
-//                                    effectCase.setCoverImage(getVideoFirstImage(effectCase.getVideoUrl()));
-//                                    if (effectCase.getCoverImage() == null){
-//                                        Thread.sleep(1000);
-//                                        effectCase.setCoverImage(getVideoFirstImage(effectCase.getVideoUrl()));
-//                                    }
-//                                    effectCase.setCreativeLabel(detailNode.get("data").get("effect_case").get("creative_label").toString());
-//                                }
-//                            }
-//                            effectCaseService.saveOrUpdate(effectCase);
-//                        }
-//                        effectCaseHandler(page+1);
-//                    }
-//                }
-//            }
-//        }catch (Exception e){
-//            e.printStackTrace();
-//        }
-//    }
-//
-//    private String getVideoFirstImage(String url){
-//        try {
-//            FFmpegFrameGrabber ff = new FFmpegFrameGrabber(url);
-//            ff.start();
-//            int lenght = ff.getLengthInFrames();
-//            int i = 0;
-//            Frame f = null;
-//            while (i < lenght) {
-//// 过滤前5帧,避免出现全黑的图片,依自己情况而定
-//                f = ff.grabFrame();
-//                if ((i > 5) && (f.image != null)) {
-//                    break;
-//                }
-//                i++;
-//            }
-////            opencv_core.IplImage img = f.image;
-//            int owidth = f.imageWidth;
-//            int oheight = f.imageHeight;
-//            Java2DFrameConverter converter =new Java2DFrameConverter();
-//            BufferedImage fecthedImage =converter.getBufferedImage(f);
-//// 对截取的帧进行等比例缩放
-//            int width = 800;
-//            int height = (int) (((double) width / owidth) * oheight);
-//            BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
-//            bi.getGraphics().drawImage(fecthedImage.getScaledInstance(width, height, Image.SCALE_SMOOTH),
-//                    0, 0, null);
-//            ByteArrayOutputStream baos = new ByteArrayOutputStream();//io流
-//            ImageIO.write(bi, "jpg", baos);
-//            byte[] bytes = baos.toByteArray();//转换成字节
-//            String png_base64 = Base64.getEncoder().encodeToString(bytes).trim();//转换成base64串
-//            png_base64 = png_base64.replaceAll("\n", "").replaceAll("\r", "");//删除 \r\n
-//            //        ImageIO.write(bufferedImage, "png", new File("D:/qrcode1.png"));
-//            baos.close();
-//            ff.close();
-//            return "data:image/jpg;base64,"+png_base64;
-//        }catch (Exception e){
-//            e.printStackTrace();
-//            return null;
-//        }
-//
-//    }
-//    private void douyinHotHandler(int page,int listType){
-//        String result = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/hot_video/user_side/list?page="+page+"&limit=20&list_type="+listType+"&aggr_duration_type=-1");
-//        ObjectMapper mapper = new ObjectMapper();
-//        try {
-//            JsonNode node = mapper.readTree(result);
-//            int code = node.get("code").asInt();
-//            if(code == 0){
-//                if(node.get("data")!= null){
-//                    String dataJson = node.get("data").get("items").toString();
-//                    List<DouyinHot> list = mapper.readValue(dataJson,new TypeReference<List<DouyinHot>>() {});
-//                    if (list != null && list.size() > 0){
-//                        for (DouyinHot douyinHot : list){
-//                            douyinHot.setUrl(getRealVideoUrl("https://aweme.snssdk.com/aweme/v1/playwm/?video_id="+douyinHot.getVideoId()+"&line=0"));
-//                            if(douyinHot.getUrl() == null){
-//                                douyinHot.setUrl(getVideoUrl(douyinHot.getVideoId()));
-//                            }
-////                            douyinHot.setUrl(getVideoUrl(douyinHot.getVideoId()));
-//                            douyinHot.setCoverImage(getVideoFirstImage(douyinHot.getUrl()));
-//                            if(douyinHot.getCoverImage() == null){
-//                                Thread.sleep(1000);
-//                                douyinHot.setCoverImage(getVideoFirstImage(douyinHot.getUrl()));
-//                            }
-//                            douyinHotService.saveOrUpdate(douyinHot);
-//                        }
-//                        douyinHotHandler(page+1,listType);
-//                    }else {
-//                        if(listType < 4){
-//                            douyinHotHandler(1,listType+1);
-//                        }
-//                    }
-//                }
-//            }
-//        }catch (Exception e){
-//            e.printStackTrace();
-//        }
-//
-//    }
-//    @Override
-//    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-//        String account="3248395570@qq.com";
-//        String password = "Ydxq-704127411";
-//        login(account,password);
-//        douyinHotHandler(1,1);
-//        effectCaseHandler(1);
-//        hotMaterialHandler(1,1,"西瓜");
-//        hotMaterialHandler(1,3,"火山");
-//        hotMaterialHandler(1,4,"抖音");
-//        hotMaterialHandler(1,8,"头条");
-//        hotMaterialHandler(1,9,"穿山甲");
-//        log.info("巨量创意抓取完成");
-//    }
-//
-//    private void login(String account,String password){
-//        String url = "https://cc.oceanengine.com/login";
-//        System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
-//        ChromeOptions chromeOptions = new ChromeOptions();
-//        chromeOptions.addArguments("--headless");
-//        chromeOptions.addArguments("--no-sandbox");
-//        chromeOptions.addArguments("--window-size=1920,1080");
-//        chromeOptions.addArguments("--user-agent=" + HttpUtils2.USER_AGENT);
-//        chromeOptions.setAcceptInsecureCerts(true);
-//        WebDriver webDriver = new ChromeDriver(chromeOptions);
-//        //清除所有的缓存
-//        webDriver.manage().deleteAllCookies();
-//        try {
-//            //获取登录页面
-//            webDriver.get(url);
-//            for (Cookie cookie : webDriver.manage().getCookies()) {
-//                BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());
-//                ck.setDomain("oceanengine.com");
-//                ck.setExpiryDate(cookie.getExpiry());
-//                ck.setPath(cookie.getPath());
-//                HttpUtils2.cookieStore.addCookie(ck);
-//            }
-//            Map<String, String> header = new HashMap<>();
-//            header.put("Accept", "*/*");
-//            header.put("Connection", "keep-alive");
-//            header.put("Host", "sso.toutiao.com");
-//            header.put("Content-Type", "application/x-www-form-urlencoded");
-//            header.put("Origin", "https://cc.oceanengine.com");
-//            header.put("Referer", "https://cc.oceanengine.com/login");
-//            Map<String, Object> param = new HashMap<>();
-//            param.put("mobile", "");
-//            param.put("code", "");
-//            param.put("account", account);
-//            param.put("password", password);
-//            param.put("captcha", "hqde");
-//            param.put("is_30_days_no_login", "true");
-//            param.put("service", "https://cc.oceanengine.com");
-//            String res = HttpUtils2.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
-//            ObjectMapper mapper = new ObjectMapper();
-//            mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-//            JsonNode jsonNode = mapper.readTree(res);
-//            //errorcode == 1102 验证码错误,请重新输入验证码
-//            //errorcode == 1101 验证码为空
-//
-//            Integer errorCode = jsonNode.get("error_code").asInt();
-//            String orderId = null;
-//            while (errorCode != 0) {
-//                //用户名或者密码错误
-//                if (null != errorCode && errorCode == 1009) {
-//                    return;
-//                }
-//                FateadmUtil fateadmUtil = new FateadmUtil();
-//                fateadmUtil.init();
-//                if (orderId != null) {
-//                    fateadmUtil.justice(orderId);
-//                }
-//                String captcha = jsonNode.get("captcha").asText();
-//                Base64.Decoder decoder = Base64.getDecoder();
-//                FateadmHttpUtil.HttpResp resp = fateadmUtil.Predict("30400", decoder.decode(captcha));
-//                param.put("captcha", resp.predResl);
-//                orderId = resp.reqId;
-//                res = HttpUtils2.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
-//                jsonNode = mapper.readTree(res);
-//                errorCode = jsonNode.get("error_code").asInt();
-//            }
-//            if (errorCode == 0) {
-//                //表示登录成功
-//                List<org.apache.http.cookie.Cookie> cookies = HttpUtils2.cookieStore.getCookies();
-//                for (org.apache.http.cookie.Cookie ck : cookies) {
-//                    Cookie cookie = new Cookie(ck.getName(), ck.getValue(), "." + ck.getDomain(), ck.getPath(), ck.getExpiryDate());
-//                    webDriver.manage().addCookie(cookie);
-//                }
-//                String redirectUrl = jsonNode.get("redirect_url").asText();
-//                webDriver.get(redirectUrl);
-//                //登录成功 进入推广页面
-//                webDriver.get("https://cc.oceanengine.com/inspiration/douyin-rank-list");
-//                Thread.sleep(3000);
-//                for (Cookie cookie : webDriver.manage().getCookies()) {
-//                    BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());
-//                    ck.setDomain("cc.oceanengine.com");
-//                    ck.setExpiryDate(cookie.getExpiry());
-//                    ck.setPath(cookie.getPath());
-//                    HttpUtils2.cookieStore.addCookie(ck);
-//                }
-//
-//            }
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        } finally {
-//            //获得cookie
-//            Set<Cookie> coo = webDriver.manage().getCookies();
-//            //清除所有的缓存
-//            webDriver.manage().deleteAllCookies();
-//            webDriver.quit();
-//        }
-//    }
-//}
+package cn.com.ctop.crawler.modules.oceanengine.service.impl;
+
+import cn.com.ctop.common.module.utils.Base64Utils;
+import cn.com.ctop.common.module.utils.HttpUtils2;
+import cn.com.ctop.common.module.utils.OSSUtils;
+import cn.com.ctop.crawler.modules.core.util.FateadmHttpUtil;
+import cn.com.ctop.crawler.modules.core.util.FateadmUtil;
+import cn.com.ctop.crawler.modules.core.util.FfmpegUtils;
+import cn.com.ctop.crawler.modules.oceanengine.entity.DouyinHot;
+import cn.com.ctop.crawler.modules.oceanengine.entity.EffectCase;
+import cn.com.ctop.crawler.modules.oceanengine.entity.HotMaterial;
+import cn.com.ctop.crawler.modules.oceanengine.service.IDouyinHotService;
+import cn.com.ctop.crawler.modules.oceanengine.service.IEffectCaseService;
+import cn.com.ctop.crawler.modules.oceanengine.service.IHotMaterialService;
+import cn.com.ctop.crawler.modules.oceanengine.service.IOceanEngineService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.impl.cookie.BasicClientCookie;
+import org.openqa.selenium.Cookie;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.chrome.ChromeOptions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.io.FileInputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.*;
+
+@Service
+@Slf4j
+public class OceanEngineServiceImpl implements IOceanEngineService {
+    @Value("${jeecg.path.chrome-driver}")
+    private String chromeDriver;
+    private String getVideoUrlByVid(String vid) {
+        String url = "https://aweme.snssdk.com/aweme/v1/playwm/?video_id=" + vid + "&line=0";
+        return getRealVideoUrl(url);
+    }
+
+    private String getRealVideoUrl(String url) {
+        try {
+            URL serverUrl = new URL(url);
+            HttpURLConnection conn = (HttpURLConnection) serverUrl
+                    .openConnection();
+            conn.setRequestMethod("GET");
+            // 必须设置false,否则会自动redirect到Location的地址
+            conn.setInstanceFollowRedirects(false);
+            conn.addRequestProperty("User-Agent",
+                    "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.8) Firefox/3.6.8");
+            conn.connect();
+            String location = conn.getHeaderField("Location");
+            return location;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    @Override
+    public void hotMaterialHandler(int page, int appCode, String appName){
+        String result = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/hot_material/list?material_type=3&order_by=click_show_rate&period_type=30&aggr_app_code="+appCode+"&page="+page+"&limit=20");
+        System.out.println(result);
+        ObjectMapper mapper = new ObjectMapper();
+        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+        try {
+            JsonNode node = mapper.readTree(result);
+            int code = node.get("code").asInt();
+            if (code == 0) {
+                if (node.get("data") != null&&node.get("data").get("materials")!=null) {
+                    String dataJson = node.get("data").get("materials").toString();
+                    List<HotMaterial> list = mapper.readValue(dataJson,new TypeReference<List<HotMaterial>>() {});
+                    if(list != null && list.size() > 0){
+                        for (HotMaterial material : list){
+                            material.setAppCode(appCode);
+                            material.setAppName(appName);
+                            material.setVideoUrl(getRealVideoUrl("https://aweme.snssdk.com/aweme/v1/playwm/?video_id="+material.getVid()+"&line=0"));
+                            if(material.getVideoUrl() == null){
+                                material.setVideoUrl(getVideoUrl(material.getVid()));
+                            }
+                            String base64Code = FfmpegUtils.getVideoFirstImage(material.getVideoUrl());
+                            if(base64Code == null){
+                                Thread.sleep(1000);
+                                base64Code = FfmpegUtils.getVideoFirstImage(material.getVideoUrl());
+                            }
+                            EffectCase.base64ToFile("/mnt/crawler/hotmat/",base64Code,material.getVid()+".jpg");
+                            String coverUrl = OSSUtils.uploadFile2OSS(new FileInputStream("/mnt/crawler/hotmat/"+material.getVid()+".jpg"),"ocean-engine/hot-material/",material.getVid()+".jpg");
+                            material.setCoverUrl(coverUrl);
+                            hotMaterialService.saveOrUpdate(material);
+                        }
+                        hotMaterialHandler(page+1,appCode,appName);
+                    }
+                }
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
+    @Autowired
+    private IHotMaterialService hotMaterialService;
+
+    private String getVideoUrl(String vid) throws Exception {
+        String url = "http://i.snssdk.com/video/urls/1/toutiao/mp4/"+vid;
+        String result = HttpUtils2.httpGetRequest(url);
+        ObjectMapper mapper = new ObjectMapper();
+        if(result != null){
+            JsonNode node = mapper.readTree(result);
+            String mainUrl = node.get("data").get("video_list").get("video_1").get("main_url").asText();
+            return Base64Utils.decode(mainUrl);
+        }
+        return null;
+    }
+
+    @Override
+    public void effectCaseHandler(int page){
+        String result = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/case/effect_case_list?industry=0&style=0&mode=0&page="+page+"&limit=20");
+        try {
+            JSONObject node = JSONObject.parseObject(result);
+            Integer code = node.getInteger("code");
+            String message = node.getString("msg");
+            if(null==code||code != 0) {
+                log.error("巨量创意获取效果案例异常:{}",message);
+                return;
+            }
+            JSONArray effectCaseList = node.getJSONObject("data").getJSONArray("effect_cases");
+            if (effectCaseList == null || effectCaseList.isEmpty()) {
+                log.error("巨量创意获取效果案例数据为空:{}",message);
+                return;
+            }
+            List<EffectCase> effectCases = effectCaseList.toJavaList(EffectCase.class);
+            for (EffectCase effectCase:effectCases){
+                String resultDetail = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/case/effect_case/"+effectCase.getId());
+                JSONObject detailNode = JSONObject.parseObject(resultDetail);
+                Integer detailCode = detailNode.getInteger("code");
+                if(null ==detailCode|| detailCode != 0){
+                    continue;
+                }
+                JSONObject getCase = detailNode.getJSONObject("data").getJSONObject("effect_case");
+                if(getCase != null){
+                    effectCase.setAuthor(getCase.getString("author"));
+                    effectCase.setCreateDate(getCase.getString("create_date"));
+                    effectCase.setCreativeId(getCase.getLong("creative_id"));
+                    effectCase.setCreativeScore(getCase.getString("creative_score"));
+                    effectCase.setEffect(getCase.getString("effect"));
+                    effectCase.setMethods(getCase.getString("methods"));
+                    effectCase.setVideoUrl(getRealVideoUrl("https://aweme.snssdk.com/aweme/v1/playwm/?video_id="+effectCase.getVid()+"&line=0"));
+                    if (effectCase.getVideoUrl() == null){
+                        effectCase.setVideoUrl(getVideoUrl(effectCase.getVid()));
+                    }
+                    String base64Code = FfmpegUtils.getVideoFirstImage(effectCase.getVideoUrl());
+                    if(base64Code == null){
+                        Thread.sleep(1000);
+                        base64Code = FfmpegUtils.getVideoFirstImage(effectCase.getVideoUrl());
+                    }
+                    EffectCase.base64ToFile("/mnt/crawler/effectcase/",base64Code,effectCase.getVid()+".jpg");
+                    String coverUrl = OSSUtils.uploadFile2OSS(new FileInputStream("/mnt/crawler/effectcase/"+effectCase.getVid()+".jpg"),"ocean-engine/effect-case/",effectCase.getVid()+".jpg");
+                    effectCase.setCoverUrl(coverUrl);
+                    effectCase.setCreativeLabel(getCase.getString("creative_label"));
+                }
+                effectCaseService.saveOrUpdate(effectCase);
+            }
+            effectCaseHandler(page+1);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
+    @Autowired
+    private IEffectCaseService effectCaseService;
+
+    @Autowired
+    private IDouyinHotService douyinHotService;
+    @Override
+    public void douyinHotHandler(int page, int listType){
+        String result = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/hot_video/user_side/list?page="+page+"&limit=20&list_type="+listType+"&aggr_duration_type=-1");
+        ObjectMapper mapper = new ObjectMapper();
+        try {
+            JsonNode node = mapper.readTree(result);
+            int code = node.get("code").asInt();
+            if(code == 0){
+                if(node.get("data")!= null){
+                    String dataJson = node.get("data").get("items").toString();
+                    List<DouyinHot> list = mapper.readValue(dataJson,new TypeReference<List<DouyinHot>>() {});
+                    if (list != null && list.size() > 0){
+                        for (DouyinHot douyinHot : list){
+                            douyinHot.setUrl(getRealVideoUrl("https://aweme.snssdk.com/aweme/v1/playwm/?video_id="+douyinHot.getVideoId()+"&line=0"));
+                            if(douyinHot.getUrl() == null){
+                                douyinHot.setUrl(getVideoUrl(douyinHot.getVideoId()));
+                            }
+                            String base64Code = FfmpegUtils.getVideoFirstImage(douyinHot.getUrl());
+                            if(base64Code == null){
+                                Thread.sleep(1000);
+                                base64Code = FfmpegUtils.getVideoFirstImage(douyinHot.getUrl());
+                            }
+                            EffectCase.base64ToFile("/mnt/crawler/douyinhot/",base64Code,douyinHot.getMid()+".jpg");
+                            String coverUrl = OSSUtils.uploadFile2OSS(new FileInputStream("/mnt/crawler/douyinhot/"+douyinHot.getMid()+".jpg"),"ocean-engine/doyin-hot/",douyinHot.getMid()+".jpg");
+                            douyinHot.setCoverUrl(coverUrl);
+                            douyinHotService.saveOrUpdate(douyinHot);
+                        }
+                        douyinHotHandler(page+1,listType);
+                    }else {
+                        if(listType < 4){
+                            douyinHotHandler(1,listType+1);
+                        }
+                    }
+                }
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public void login(String account, String password){
+        String url = "https://cc.oceanengine.com/login";
+        System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
+        ChromeOptions chromeOptions = new ChromeOptions();
+        chromeOptions.addArguments("--headless");
+        chromeOptions.addArguments("--no-sandbox");
+        chromeOptions.addArguments("--window-size=1920,1080");
+        chromeOptions.addArguments("--user-agent=" + HttpUtils2.USER_AGENT);
+        chromeOptions.setAcceptInsecureCerts(true);
+        WebDriver webDriver = new ChromeDriver(chromeOptions);
+        //清除所有的缓存
+        webDriver.manage().deleteAllCookies();
+        try {
+            //获取登录页面
+            webDriver.get(url);
+            for (Cookie cookie : webDriver.manage().getCookies()) {
+                BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());
+                ck.setDomain("oceanengine.com");
+                ck.setExpiryDate(cookie.getExpiry());
+                ck.setPath(cookie.getPath());
+                HttpUtils2.cookieStore.addCookie(ck);
+            }
+            Map<String, String> header = new HashMap<>();
+            header.put("Accept", "*/*");
+            header.put("Connection", "keep-alive");
+            header.put("Host", "sso.toutiao.com");
+            header.put("Content-Type", "application/x-www-form-urlencoded");
+            header.put("Origin", "https://cc.oceanengine.com");
+            header.put("Referer", "https://cc.oceanengine.com/login");
+            Map<String, Object> param = new HashMap<>();
+            param.put("mobile", "");
+            param.put("code", "");
+            param.put("account", account);
+            param.put("password", password);
+            param.put("captcha", "hqde");
+            param.put("is_30_days_no_login", "true");
+            param.put("service", "https://cc.oceanengine.com");
+            String res = HttpUtils2.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
+            ObjectMapper mapper = new ObjectMapper();
+            mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+            JsonNode jsonNode = mapper.readTree(res);
+            //errorcode == 1102 验证码错误,请重新输入验证码
+            //errorcode == 1101 验证码为空
+
+            Integer errorCode = jsonNode.get("error_code").asInt();
+            String orderId = null;
+            while (errorCode != 0) {
+                //用户名或者密码错误
+                if (null != errorCode && errorCode == 1009) {
+                    return;
+                }
+                FateadmUtil fateadmUtil = new FateadmUtil();
+                fateadmUtil.init();
+                if (orderId != null) {
+                    fateadmUtil.justice(orderId);
+                }
+                String captcha = jsonNode.get("captcha").asText();
+                Base64.Decoder decoder = Base64.getDecoder();
+                FateadmHttpUtil.HttpResp resp = fateadmUtil.Predict("30400", decoder.decode(captcha));
+                param.put("captcha", resp.predResl);
+                orderId = resp.reqId;
+                res = HttpUtils2.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
+                jsonNode = mapper.readTree(res);
+                errorCode = jsonNode.get("error_code").asInt();
+            }
+            if (errorCode == 0) {
+                //表示登录成功
+                List<org.apache.http.cookie.Cookie> cookies = HttpUtils2.cookieStore.getCookies();
+                for (org.apache.http.cookie.Cookie ck : cookies) {
+                    Cookie cookie = new Cookie(ck.getName(), ck.getValue(), "." + ck.getDomain(), ck.getPath(), ck.getExpiryDate());
+                    webDriver.manage().addCookie(cookie);
+                }
+                String redirectUrl = jsonNode.get("redirect_url").asText();
+                webDriver.get(redirectUrl);
+                //登录成功 进入推广页面
+                webDriver.get("https://cc.oceanengine.com/inspiration/douyin-rank-list");
+                Thread.sleep(3000);
+                for (Cookie cookie : webDriver.manage().getCookies()) {
+                    BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());
+                    ck.setDomain("cc.oceanengine.com");
+                    ck.setExpiryDate(cookie.getExpiry());
+                    ck.setPath(cookie.getPath());
+                    HttpUtils2.cookieStore.addCookie(ck);
+                }
+
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            //获得cookie
+            Set<Cookie> coo = webDriver.manage().getCookies();
+            //清除所有的缓存
+            webDriver.manage().deleteAllCookies();
+            webDriver.quit();
+        }
+    }
+}

+ 1 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/PangolinAppMapper.java

@@ -7,5 +7,5 @@ import org.apache.ibatis.annotations.Param;
 import java.util.List;
 
 public interface PangolinAppMapper extends BaseMapper<PangolinApp> {
-    List<PangolinApp> getListByUserId(@Param(value = "userId") String userId);
+    List<PangolinApp> getListByUserId(@Param(value = "userId") String userId,@Param(value = "projectId") Long projectID);
 }

+ 4 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/xml/PangolinAppMapper.xml

@@ -5,9 +5,13 @@
         select app.*
             from ctop_pangolin_app app
         left join ctop_bind_account_login login on login.account_name = app.account_name
+        left join ctop_user_allocation allocation on allocation.account_id = login.id
         where 1=1
         <if test="userId!=null">
             and login.user_id = #{userId}
         </if>
+        <if test="projectId!=null">
+            and allocation.project_id = #{projectId}
+        </if>
     </select>
 </mapper>

+ 2 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/PangolinAppService.java

@@ -1,10 +1,11 @@
 package cn.com.ctop.crawler.modules.pangolin.service;
 
 import cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 import java.util.Map;
 
 public interface PangolinAppService extends IService<PangolinApp> {
-    Map<String, Object> getListByUserId(String userId);
+    Map<String, Object> getListByUserId(String userId, JSONObject data);
 }

+ 7 - 2
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinAppServiceImpl.java

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp;
 import cn.com.ctop.crawler.modules.pangolin.mapper.PangolinAppMapper;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinAppService;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -18,9 +19,13 @@ public class PangolinAppServiceImpl extends ServiceImpl<PangolinAppMapper, Pango
     @Autowired
     private PangolinAppMapper pangolinAppMapper;
     @Override
-    public Map<String, Object> getListByUserId(String userId) {
+    public Map<String, Object> getListByUserId(String userId, JSONObject data) {
         Map<String,Object>result = new HashMap<>();
-        List<PangolinApp>appList = pangolinAppMapper.getListByUserId(userId);
+        Long projectId = data.getLong("projectId");
+        if(null == projectId||projectId == 0){
+            projectId = null;
+        }
+        List<PangolinApp>appList = pangolinAppMapper.getListByUserId(userId,projectId);
         result.put("data",appList);
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;

+ 4 - 13
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinCrawlerServiceImpl.java

@@ -58,7 +58,7 @@ public class PangolinCrawlerServiceImpl implements PangolinCrawlerService {
                 }
             }
             String result = HttpUtils2.httpPostRequest(url, null, null);
-            if (checkLogin(bindAccountLogin, result)) {
+            if (bindAccountLoginService.checkLogin(bindAccountLogin, result)) {
                 JsonNode resultNode = mapper.readTree(result);
                 Iterator<JsonNode> appIterator = resultNode.get("data").get("List").elements();
                 while (appIterator.hasNext()) {
@@ -122,7 +122,7 @@ public class PangolinCrawlerServiceImpl implements PangolinCrawlerService {
                 }
             }
             String result = HttpUtils2.httpGetRequest(url);
-            if (checkLogin(bindAccountLogin, result)) {
+            if (bindAccountLoginService.checkLogin(bindAccountLogin, result)) {
                 JsonNode resultNode = mapper.readTree(result);
                 Iterator<JsonNode> appIterator = resultNode.get("data").get("AppNameList").elements();
                 while (appIterator.hasNext()) {
@@ -188,7 +188,7 @@ public class PangolinCrawlerServiceImpl implements PangolinCrawlerService {
             paramMap.put("search", searchMap);
             paramMap.put("page", pageMap);
             String result = HttpUtils2.httpPostRequest(url, paramMap, null);
-            if (checkLogin(bindAccountLogin, result)) {
+            if (bindAccountLoginService.checkLogin(bindAccountLogin, result)) {
                 JsonNode resultNode = mapper.readTree(result);
                 Iterator<JsonNode> listIterator = resultNode.get("data").get("list").elements();
                 while (listIterator.hasNext()) {
@@ -259,7 +259,7 @@ public class PangolinCrawlerServiceImpl implements PangolinCrawlerService {
             paramMap.put("channelName", "");
             paramMap.put("appId", appIds);
             String result = HttpUtils2.httpPostRequest(url, paramMap, null);
-            if (checkLogin(bindAccountLogin, result)) {
+            if (bindAccountLoginService.checkLogin(bindAccountLogin, result)) {
                 JsonNode resultNode = mapper.readTree(result);
                 Iterator<String> clickIterator = resultNode.get("data").get("ChartData").get("click_num").fieldNames();
                 while (clickIterator.hasNext()) {
@@ -341,13 +341,4 @@ public class PangolinCrawlerServiceImpl implements PangolinCrawlerService {
             e.printStackTrace();
         }
     }
-
-    public boolean checkLogin(BindAccountLogin bindAccountLogin, String response) {
-        if (response.contains("<html>")) {
-            bindAccountLogin.setCookie("");
-            bindAccountLoginService.updateById(bindAccountLogin);
-            return false;
-        }
-        return true;
-    }
 }

+ 1 - 2
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinLoginServiceImpl.java

@@ -79,7 +79,7 @@ public class PangolinLoginServiceImpl implements PangolinLoginService {
                 String cookieStr = iterator.next().toString();
                 cookieList.add(cookieStr);
                 String[] cookieArray = cookieStr.split(";");
-                Map<String, String> cookieMap = new HashMap<String, String>();
+                Map<String, String> cookieMap = new HashMap<>();
                 for (String cookie : cookieArray) {
                     String[] kv = cookie.split("=");
                     if (kv.length > 1) {
@@ -105,7 +105,6 @@ public class PangolinLoginServiceImpl implements PangolinLoginService {
             e.printStackTrace();
         } finally {
             webDriver.manage().deleteAllCookies();
-//            webDriver.close();
             webDriver.quit();
         }
     }

+ 4 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -907,7 +907,9 @@ public class BatchController {
                         Map<String, Object> updateMap = updateService.updateUnitBid(token.getAccessToken(), accountId, unitId, multiply, userId);
                         if (!Check.isNull(updateMap)) {
                             Integer code = (Integer) updateMap.get("code");
-                            if (code != 0) {
+                            if (code == 0) {
+                                iKuaishouInterfaceService.getGroup(token.getAccessToken(), accountId, unitId);
+                            } else {
                                 JSONObject failJson = new JSONObject();
                                 failJson.put("message", updateMap.get("message"));
                                 if (!Check.isNull(group)) {
@@ -970,8 +972,8 @@ public class BatchController {
                             if (!Check.isNull(updateDeepConversionBid) && updateDeepConversionBid != 0) {
                                 Map<String, Object> updateDeepMap = updateService.updateUnitDeepConversionBid(token.getAccessToken(), accountId, unitId, deepConversionBid, userId);
                             }
-                            iKuaishouInterfaceService.getGroup(token.getAccessToken(), accountId, unitId);
                         }
+                        iKuaishouInterfaceService.getGroup(token.getAccessToken(), accountId, unitId);
                         if (!Check.isNull(updateMap)) {
                             Integer code = (Integer) updateMap.get("code");
                             if (code != 0) {

+ 173 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouMaterialUploadController.java

@@ -0,0 +1,173 @@
+package cn.com.ctop.kuaishou.modules.batch.controller;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("/kusiShouUpload")
+public class KuaiShouMaterialUploadController {
+
+    @Autowired
+    private IKuaiShouMaterialUploadService uploadService;
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+    @Autowired
+    private IKuaiShouImageGetService iKuaiShouImageGetService;
+    @Autowired
+    private IKuaiShouVideoGetService videoGetService;
+
+    @PostMapping(value = "/video")
+    public Result<JSONObject> video(@RequestBody JSONObject requestJson) throws Exception {
+        Result<JSONObject> result = new Result<>();
+        try {
+            Long accountId = requestJson.getLong("accountId");
+            if (Check.isNull(accountId)) {
+                throw new Exception("请传入账户id");
+            }
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(oauthToken)) {
+                throw new Exception("未获取到账户信息");
+            }
+            String url = requestJson.getString("url");
+            if (Check.isNull(url)) {
+                throw new Exception("请传入视频");
+            }
+            String videoUrl;
+            if (!url.contains("https:")) {
+                videoUrl = KuaishouInterfaceConstant.HTTPS_PREFIX + url;
+            } else {
+                videoUrl = url;
+            }
+            Integer type = requestJson.getInteger("type");
+            if (Check.isNull(type)) {
+                throw new Exception("请传入视频类型");
+            }
+            String signature = requestJson.getString("signature");
+            if (Check.isNull(type)) {
+                throw new Exception("视频标识错误");
+            }
+            JSONObject videoJson = uploadService.video(videoUrl, type, accountId, oauthToken.getAccessToken(), signature);
+            JSONObject returnJson = new JSONObject();
+            if (videoJson.getBoolean("success")) {
+                result.setSuccess(true);
+                returnJson.put("photoId", videoJson.getString("photoId"));
+                returnJson.put("signature", videoJson.getString("signature"));
+                returnJson.put("videoUrl", videoUrl);
+                result.setResult(returnJson);
+                result.setMessage(videoJson.getString("message"));
+            } else {
+                result.setSuccess(false);
+                result.setMessage(videoJson.getString("message"));
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+
+
+        return result;
+    }
+
+
+    @GetMapping(value = "/checkVideo")
+    public Result<JSONObject> video(String signature, Long accountId) {
+        Result<JSONObject> result = new Result();
+        try {
+            JSONObject returnJson = new JSONObject();
+            QueryWrapper<KuaiShouVideoGet> videoGetQueryWrapper = new QueryWrapper<>();
+            videoGetQueryWrapper.eq("signature", signature);
+            videoGetQueryWrapper.eq("account_id", accountId);
+            videoGetQueryWrapper.last("limit 1");
+            KuaiShouVideoGet videoGet = videoGetService.getOne(videoGetQueryWrapper);
+            if (Check.isNull(videoGet)) {
+                returnJson.put("isExistence", false); // 未存在
+            } else {
+                returnJson.put("isExistence", true);
+                returnJson.put("videoUrl", videoGet.getUrl());
+                returnJson.put("photoId", videoGet.getPhotoId());
+                returnJson.put("signature", signature);
+            }
+            result.setSuccess(true);
+            result.setResult(returnJson);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+
+        return result;
+    }
+
+
+    @PostMapping(value = "/image")
+    public Result<JSONArray> image(@RequestBody JSONObject requestJson) throws Exception {
+        Result<JSONArray> result = new Result<>();
+
+        try {
+            Long accountId = requestJson.getLong("accountId");
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(oauthToken)) {
+                throw new Exception("未获取到账户信息");
+            }
+            JSONArray returnArr = new JSONArray();
+            JSONArray imageArr = requestJson.getJSONArray("uploadImageArr");
+            if (!Check.isNull(imageArr)) {
+                for (int i = 0; i < imageArr.size(); i++) {
+                    JSONObject imageJson = imageArr.getJSONObject(i);
+                    String url = imageJson.getString("url");
+                    String imageUrl;
+                    if (!url.contains("https:")) {
+                        imageUrl = KuaishouInterfaceConstant.HTTPS_PREFIX + url;
+                    } else {
+                        imageUrl = url;
+                    }
+                    String signature = imageJson.getString("signature");
+                    QueryWrapper<KuaiShouImageGet> imageGetQueryWrapper = new QueryWrapper<>();
+                    imageGetQueryWrapper.eq("signature", signature);
+                    imageGetQueryWrapper.eq("account_id", accountId);
+                    imageGetQueryWrapper.last("limit 1");
+                    KuaiShouImageGet imageGet = iKuaiShouImageGetService.getOne(imageGetQueryWrapper);
+                    if (Check.isNull(imageGet)) {
+                        String imageToken = uploadService.kuauiShouImageUpload(imageUrl, signature, accountId, oauthToken.getAccessToken());
+                        if (!Check.isNull(imageToken)) {
+                            JSONObject returnJson = new JSONObject();
+                            returnJson.put("url", imageUrl);
+                            returnJson.put("signature", signature);
+                            returnArr.add(returnJson);
+                        }
+                    } else {
+                        JSONObject returnJson = new JSONObject();
+                        returnJson.put("url", imageUrl);
+                        returnJson.put("signature", signature);
+                        returnArr.add(returnJson);
+                    }
+                }
+
+            }
+            result.setSuccess(true);
+            result.setResult(returnArr);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+        }
+
+        return result;
+    }
+
+
+}

+ 9 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouMaterialUploadService.java

@@ -0,0 +1,9 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import com.alibaba.fastjson.JSONObject;
+
+public interface IKuaiShouMaterialUploadService {
+    JSONObject video(String url, Integer type, Long accountId, String accessToken, String signature);
+
+    String kuauiShouImageUpload(String url, String signature, Long accountId, String token);
+}

+ 9 - 95
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java

@@ -2,20 +2,14 @@ package cn.com.ctop.kuaishou.modules.batch.service.impl;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.UserAllocation;
-import cn.com.ctop.common.module.enums.MaterialEnum;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.service.IMaterialParameterService;
 import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.LoadFileUtil;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.mapper.*;
-import cn.com.ctop.kuaishou.modules.batch.service.IBatchService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -36,7 +30,6 @@ import org.springframework.web.client.RestTemplate;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -59,6 +52,12 @@ public class BatchServiceImpl implements IBatchService {
     private UserAllocationMapper userAllocationMapper;
     @Autowired
     private IKuaiShouUpdateService updateService;
+    @Autowired
+    private IKuaiShouMaterialUploadService uploadService;
+    @Autowired
+    private KuaiShouGroupMapper groupMapper;
+    @Autowired
+    private KuaiShouCreativeMapper creativeMapper;
 
 
     /**
@@ -788,8 +787,7 @@ public class BatchServiceImpl implements IBatchService {
      * @param unitId
      * @return
      */
-    @Autowired
-    private KuaiShouGroupMapper groupMapper;
+
 
     @Override
     public KuaiShouGroup getUnitInfo(Long accountId, Long unitId) {
@@ -878,7 +876,7 @@ public class BatchServiceImpl implements IBatchService {
                                         imageToken = imageGet.getImageToken();
                                     } else {
                                         String url = imageGetService.getUrlByCode(signature);
-                                        imageToken = this.kuauiShouImageUpload(url, signature, accountId, oauthToken.getAccessToken());
+                                        imageToken = uploadService.kuauiShouImageUpload(url, signature, accountId, oauthToken.getAccessToken());
                                     }
                                     if (Check.isNull(imageToken)) {
                                         JSONObject failJson = new JSONObject();
@@ -915,9 +913,6 @@ public class BatchServiceImpl implements IBatchService {
         return returnJson;
     }
 
-    @Autowired
-    private KuaiShouCreativeMapper creativeMapper;
-
 
     /**
      * 获取创意信息
@@ -1253,87 +1248,6 @@ public class BatchServiceImpl implements IBatchService {
         return returnJson;
     }
 
-    @Autowired
-    private IMaterialParameterService materialParameterService;
-
-    public String kuauiShouImageUpload(String url, String signature, Long accountId, String token) {
-        System.err.println(url);
-        System.err.println(signature);
-        try {
-            // String replaceUrl = url.replace(replaceOldValue, replaceValue);
-            // log.info("replaceUrl:{}", replaceUrl);
-          /*  String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
-            FileSystemResource resource = new FileSystemResource(new File(localUrl));*/
-            Map<String, String> headerMap = new HashMap<>();
-            headerMap.put("Content-Type", "multipart/form-data");
-            JSONObject requestJson = new JSONObject();
-            //     requestJson.put("file", resource);
-            requestJson.put("signature", signature);
-            requestJson.put("url", url);
-            requestJson.put("type", 2);
-          /*   QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
-               parameterQueryWrapper.eq("material_id", signature);
-               parameterQueryWrapper.orderByDesc("create_time").last("limit 1");
-              MaterialParameter materialParameter = materialParameterService.getOne(parameterQueryWrapper);
-              if (!Check.isNull(materialParameter)) {
-                Integer type = MaterialEnum.getTypeBySize(Integer.valueOf(materialParameter.getWidth()), Integer.valueOf(materialParameter.getHeight()));
-                if (!Check.isNull(type) && type != 0) {
-                    requestJson.put("type", type);
-                }
-            }*/
-
-            requestJson.put("advertiser_id", accountId);
-            headerMap.put("Access-Token", token);
-            String requestUrl = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.IMAGE_UPLOAD;
-            requestJson.put("upload_type", "2");
-            String result = exceptInfoForRestTemplate(requestUrl, requestJson, headerMap);
-            JSONObject resultJson = JSONObject.parseObject(result);
-            System.err.println(resultJson);
-            if (!Check.isNull(resultJson)) {
-                if (resultJson.getInteger("code") == 0) {
-                    JSONObject dataJson = resultJson.getJSONObject("data");
-                    if (!Check.isNull(dataJson)) {
-                        String image_token = dataJson.getString("image_token");
-                        KuaiShouImageGet imageGet = new KuaiShouImageGet();
-                        imageGet.setId(accountId + image_token);
-                        imageGet.setAccountId(accountId);
-                        imageGet.setUrl(dataJson.getString("url"));
-                        imageGet.setWidth(dataJson.getInteger("width"));
-                        imageGet.setHeight(dataJson.getInteger("height"));
-                        imageGet.setSize(dataJson.getInteger("size"));
-                        imageGet.setFormat(dataJson.getString("format"));
-                        Integer type = MaterialEnum.getTypeBySize(dataJson.getInteger("width"), dataJson.getInteger("height"));
-                        if (!Check.isNull(type)) {
-                            imageGet.setMaterialType(type);
-                        }
-                        imageGet.setSignature(signature);
-                        imageGet.setImageToken(image_token);
-                        iKuaiShouImageGetService.saveOrUpdate(imageGet);
-                        return dataJson.getString("image_token");
-
-
-                    }
-
-
-                } else {
-                    log.error("上传图片失败,accountId:{},code:{},data:{}", accountId, signature, resultJson);
-                }
-
-
-            } else {
-                log.error("上传图片,返回结果为空,accountId:{},code:{},data:{}", accountId, signature, resultJson);
-            }
-
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            return null;
-
-        }
-
-        return null;
-    }
-
 
     @Autowired
     private RestTemplate rest;

+ 222 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouMaterialUploadServiceImpl.java

@@ -0,0 +1,222 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.common.module.enums.MaterialEnum;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.LoadFileUtil;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+@Slf4j
+@Service
+public class KuaiShouMaterialUploadServiceImpl implements IKuaiShouMaterialUploadService {
+
+    @Value("${oss.replace.replace-value}")
+    private String replaceValue;
+    @Value("${oss.replace.replace-old-value}")
+    private String replaceOldValue;
+    @Value("${oss.replace.download}")
+    private String downloadUrl;
+
+    @Autowired
+    private IKuaiShouImageGetService iKuaiShouImageGetService;
+    @Autowired
+    private IKuaiShouVideoGetService kuaiShouVideoGetService;
+
+    /**
+     * 上传文件
+     *
+     * @param
+     * @param type
+     * @param accountId
+     */
+    @Override
+    public JSONObject video(String url, Integer type, Long accountId, String accessToken, String signature) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            log.info("开始本地视频上传");
+            String requestUrl = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_UPLOAD;
+            String videoUrl = url.replace(replaceOldValue, replaceValue);
+            String localUrl = LoadFileUtil.downLoadFromUrl(videoUrl, downloadUrl);
+            File file = new File(localUrl);
+            FileSystemResource resource = new FileSystemResource(file);
+            Map<String, String> headerMap = new HashMap<>();
+            headerMap.put("Content-Type", "multipart/form-data");
+            headerMap.put("Access-Token", accessToken);
+            JSONObject requestJson = new JSONObject();
+            requestJson.put("signature", signature);
+            requestJson.put("file", resource);
+            requestJson.put("type", type);
+            requestJson.put("advertiser_id", accountId);
+            String result = exceptInfoForRestTemplate(requestUrl, requestJson, headerMap);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                if (resultJson.getInteger("code") == 0) {
+                    JSONObject dataJson = resultJson.getJSONObject("data");
+                    if (!Check.isNull(dataJson)) {
+                        String photoId = dataJson.getString("photo_id");
+                        KuaiShouVideoGet videoGet = new KuaiShouVideoGet();
+                        videoGet.setAccountId(accountId);
+                        videoGet.setId(accountId + photoId);
+                        videoGet.setUrl(url);
+                        videoGet.setMaterialType(type);
+                        videoGet.setPhotoId(photoId);
+                        videoGet.setSignature(signature);
+                        kuaiShouVideoGetService.saveOrUpdate(videoGet);
+                        returnJson.put("success", true);
+                        returnJson.put("photoId", photoId);
+                        returnJson.put("signature", signature);
+                        returnJson.put("message", "上传成功");
+
+                    }
+                    LoadFileUtil.delFile(localUrl);
+                    log.info("快手素材上传完成,accountId:{},code:{},返回信息:{}", accountId, signature, resultJson);
+                } else {
+                    log.error("快手上传素材失败,返回信息:{},请求参数:{}", resultJson, requestJson);
+                    returnJson.put("success", false);
+                    returnJson.put("signature", signature);
+                    returnJson.put("message", resultJson.getString("message"));
+
+                }
+            } else {
+                log.error("快手上传素材返回信息为空请求参数:{}", requestJson);
+                returnJson.put("success", false);
+                returnJson.put("signature", signature);
+                returnJson.put("message", "调用快手后台返回结果为空");
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            returnJson.put("success", false);
+            returnJson.put("signature", signature);
+            returnJson.put("message", "系统异常");
+
+        }
+        return returnJson;
+
+
+    }
+
+
+    @Override
+    public String kuauiShouImageUpload(String url, String signature, Long accountId, String token) {
+        try {
+            Map<String, String> headerMap = new HashMap<>();
+            headerMap.put("Content-Type", "multipart/form-data");
+            JSONObject requestJson = new JSONObject();
+            requestJson.put("signature", signature);
+            requestJson.put("url", url);
+            requestJson.put("type", 2);
+            requestJson.put("advertiser_id", accountId);
+            headerMap.put("Access-Token", token);
+            String requestUrl = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.IMAGE_UPLOAD;
+            requestJson.put("upload_type", "2");
+            String result = exceptInfoForRestTemplate(requestUrl, requestJson, headerMap);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                if (resultJson.getInteger("code") == 0) {
+                    JSONObject dataJson = resultJson.getJSONObject("data");
+                    if (!Check.isNull(dataJson)) {
+                        String image_token = dataJson.getString("image_token");
+                        KuaiShouImageGet imageGet = new KuaiShouImageGet();
+                        imageGet.setId(accountId + image_token);
+                        imageGet.setAccountId(accountId);
+                        imageGet.setUrl(dataJson.getString("url"));
+                        imageGet.setWidth(dataJson.getInteger("width"));
+                        imageGet.setHeight(dataJson.getInteger("height"));
+                        imageGet.setSize(dataJson.getInteger("size"));
+                        imageGet.setFormat(dataJson.getString("format"));
+                        Integer type = MaterialEnum.getTypeBySize(dataJson.getInteger("width"), dataJson.getInteger("height"));
+                        if (!Check.isNull(type)) {
+                            imageGet.setMaterialType(type);
+                        }
+                        imageGet.setSignature(signature);
+                        imageGet.setImageToken(image_token);
+                        iKuaiShouImageGetService.saveOrUpdate(imageGet);
+                        return dataJson.getString("image_token");
+                    }
+
+                } else {
+                    log.error("上传图片失败,accountId:{},code:{},data:{}", accountId, signature, resultJson);
+                }
+
+
+            } else {
+                log.error("上传图片,返回结果为空,accountId:{},code:{},data:{}", accountId, signature, resultJson);
+            }
+
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+
+        }
+
+        return null;
+    }
+
+
+    public String uploadFile(MultipartFile multipartFile, String dirPath) throws IOException {
+        String fileName = multipartFile.getOriginalFilename();
+        String fileSuffix = fileName.substring(fileName.lastIndexOf("."), fileName.length());
+        String localFileName = System.currentTimeMillis() + fileSuffix;
+        String filePath = dirPath + File.separator + localFileName;
+        File localFile = new File(filePath);
+        File imagePath = new File(dirPath);
+        if (!imagePath.exists()) {
+            imagePath.mkdirs();
+        }
+        multipartFile.transferTo(localFile);
+        return filePath;
+    }
+
+    @Autowired
+    private RestTemplate rest;
+
+    private String exceptInfoForRestTemplate(String url, Map<String, Object> paramMap, Map<String, String> headerMap) {
+        try {
+            MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
+            if (!Check.isNullMap(paramMap)) {
+                for (String key : paramMap.keySet()) {
+                    param.add(key, paramMap.get(key));
+                }
+                HttpHeaders headers = new HttpHeaders();
+                if (!Check.isNullMap(headerMap)) {
+                    for (String key : headerMap.keySet()) {
+                        headers.add(key, headerMap.get(key));
+                    }
+                }
+                HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(param, headers);
+                ResponseEntity<String> responseEntity = rest.exchange(url, HttpMethod.POST, httpEntity, String.class);
+                return responseEntity.getBody();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+}

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -3011,7 +3011,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         }
         JSONObject dataJson = resultJson.getJSONObject("data");
         if (!Check.isNull(dataJson)) {
-            JSONArray details = dataJson.getJSONArray("detail");
+            JSONArray details = dataJson.getJSONArray("details");
             if (Check.isNull(details)) {
                 return;
             }

+ 18 - 13
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/IKuaishouWebInterfaceService.java

@@ -1,31 +1,36 @@
 package cn.com.ctop.kuaishou.modules.graphql.service;
 
+import cn.com.ctop.common.module.entity.BindAccountLogin;
+
 import java.io.IOException;
 import java.util.Map;
 
 public interface IKuaishouWebInterfaceService {
-    public void getVideoList(String uid) throws IOException;
+    void getVideoList(String uid) throws IOException;
+
+    String checkKuaishouUser(String videoUrl);
 
-    public String checkKuaishouUser(String videoUrl);
+    void adkuaishouWebLogin(String phone, String password) throws IOException;
 
-    public void adkuaishouWebLogin(String phone, String password) throws IOException;
+    void deleteAllComment(Map<String, String> pcursorMap);
+    void deleteAllComment(Map<String,String>pcursorMap,BindAccountLogin login);
 
-    public void deleteAllComment(Map<String, String> pcursorMap);
+    String qrLogin(String taskId) throws Exception;
 
-    public String qrLogin(String taskId) throws Exception;
+    Map<String, Object> loginStatus(String taskId);
 
-    public Map<String, Object> loginStatus(String taskId);
+    Map<String, Object> commentDelete(String userId, String ksid, String photoId, Long commentId);
 
-    public Map<String, Object> commentDelete(String userId, String ksid, String photoId, Long commentId);
+    Map<String, Object> videoList(String userId, String ksid, String pcursor);
 
-    public Map<String, Object> videoList(String userId, String ksid, String pcursor);
+    Map<String, Object> commentList(String userId, String ksid, String photoId, String pcursor);
 
-    public Map<String, Object> commentList(String userId, String ksid, String photoId, String pcursor);
+    Map<String, Object> commentAdd(String userId, String ksid, String photoId, String content, Long replyToCommentId, Long replyTo);
 
-    public Map<String, Object> commentAdd(String userId, String ksid, String photoId, String content, Long replyToCommentId, Long replyTo);
+    void getkuaishouWebLoginCookie(BindAccountLogin login);
 
-    public void sendPreview(Integer creativeId, String kwid);
+    void sendPreview(Integer creativeId, String kwid);
 
-    public void adekuaishouWebLogin(String phone, String password) throws IOException;
-    public Map<String, Object> subCommentList(String userId, String ksid, String photoId, Long rootCommentId, String pcursor);
+    void adekuaishouWebLogin(String phone, String password) throws IOException;
+    Map<String, Object> subCommentList(String userId, String ksid, String photoId, Long rootCommentId, String pcursor);
 }

Diferenças do arquivo suprimidas por serem muito extensas
+ 203 - 163
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java


+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceReportController.java

@@ -133,7 +133,6 @@ public class BytedanceReportController {
             result.error500("开始时间和结束时间不能为空");
             return result;
         }
-
         try {
             log.info("头条获取素材报表数据任务执行开始");
             Long starttime = System.currentTimeMillis();
@@ -149,7 +148,8 @@ public class BytedanceReportController {
                     @Override
                     public void run() {
                         try {
-                            Long days = DateUtils.getDiscrepantDays(startDate, endDate); //间隔天数
+                            //间隔天数
+                            Long days = DateUtils.getDiscrepantDays(startDate, endDate);
                             String start = null;
                             String end = null;
                             for (int i = 0; i <= days; i++) {