Преглед изворни кода

Merge remote-tracking branch 'origin/master' into master-crawler

# Conflicts:
#	module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/FfmpegUtils.java
#	module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/impl/EffectCaseServiceImpl.java
#	module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/impl/OceanEngineServiceImpl.java
syh пре 5 година
родитељ
комит
2cf7691dbd
13 измењених фајлова са 575 додато и 261 уклоњено
  1. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java
  2. 114 114
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  3. 0 14
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java
  4. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/MaterialTopServiceImpl.java
  5. 17 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/entity/KuaishouXxlEntity.java
  6. 1 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/FfmpegUtils.java
  7. 1 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/impl/EffectCaseServiceImpl.java
  8. 23 29
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/impl/OceanEngineServiceImpl.java
  9. 4 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  10. 173 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouMaterialUploadController.java
  11. 9 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouMaterialUploadService.java
  12. 9 95
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java
  13. 222 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouMaterialUploadServiceImpl.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 - 114
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,64 +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/byteDance/homePage/report/*", "anon");
+        filterChainDefinitionMap.put("/ctop/material/top/cost", "anon");
 
-		filterChainDefinitionMap.put("/pangolin/**", "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");
@@ -136,72 +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");
-		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;
-	}
+        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;
+    }
 
 }

+ 0 - 14
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java

@@ -384,13 +384,6 @@ public class AdvertiserController {
                 }
             }
         }
-        List<UserAllocation> allocations = userAllocationService.getByProjectId(projectId, systemType);
-        if (null != allocations && !allocations.isEmpty()) {
-            for (UserAllocation allocation : allocations) {
-                SheetInfoVo vo = advertiserService.getXxlStatisticInfo(projectId, systemType, allocation.getAccountId(), allocation.getAuthName());
-                sheets.add(vo);
-            }
-        }
         result.put("data", sheets);
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
@@ -419,13 +412,6 @@ public class AdvertiserController {
                 }
             }
         }
-        List<UserAllocation> allocations = userAllocationService.getByProjectId(projectId, systemType);
-        if (null != allocations && !allocations.isEmpty()) {
-            for (UserAllocation allocation : allocations) {
-                SheetInfoVo vo = advertiserService.getXxlStatisticInfo(projectId, systemType, allocation.getAccountId(), allocation.getAuthName());
-                sheets.add(vo);
-            }
-        }
 
         OutputStream outputStream = response.getOutputStream();
         String date = DateUtils.formatDate(new Date());

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

@@ -20,7 +20,7 @@ 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) {

+ 17 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/entity/KuaishouXxlEntity.java

@@ -30,18 +30,23 @@ public class KuaishouXxlEntity extends BaseRowModel {
     @ExcelProperty(index = 4, value = "非双出价(元)")
     private BigDecimal singleBid;
     /**
+     * 非双出价
+     */
+    @ExcelProperty(index = 5, value = "详情页消耗(元)")
+    private BigDecimal detailCost;
+    /**
      * 激活数
      */
-    @ExcelProperty(index = 5, value = "激活数")
+    @ExcelProperty(index = 6, value = "激活数")
     private int active;
     /**
      * 激活成本
      */
-    @ExcelProperty(index = 6, value = "激活成本")
+    @ExcelProperty(index = 7, value = "激活成本")
     private BigDecimal activeCost;
-    @ExcelProperty(index = 7, value = "每日计划(组)")
+    @ExcelProperty(index = 8, value = "每日计划(组)")
     private int planNum;
-    @ExcelProperty(index = 8, value = "每日素材安排")
+    @ExcelProperty(index = 9, value = "每日素材安排")
     private String mat;
 
     public String getDate() {
@@ -107,4 +112,12 @@ public class KuaishouXxlEntity extends BaseRowModel {
     public void setMat(String mat) {
         this.mat = mat;
     }
+
+    public BigDecimal getDetailCost() {
+        return detailCost;
+    }
+
+    public void setDetailCost(BigDecimal detailCost) {
+        this.detailCost = detailCost;
+    }
 }

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

@@ -19,7 +19,7 @@ public class FfmpegUtils {
             int i = 0;
             Frame f = null;
             while (i < lenght) {
-                // 过滤帧,避免出现全黑的图片,依自己情况而定
+// 过滤前5帧,避免出现全黑的图片,依自己情况而定
                 f = ff.grabFrame();
                 if ((i > frame) && (f.image != null)) {
                     break;

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

@@ -38,7 +38,7 @@ public class EffectCaseServiceImpl extends ServiceImpl<EffectCaseMapper, EffectC
     public IPage<EffectCase> queryHotFeeds(String userName, String start, String end, String orderByColumn, String orderByType, Integer pageNo, Integer pageSize) {
         QueryWrapper<EffectCase> 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);

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

@@ -84,18 +84,14 @@ public class OceanEngineServiceImpl implements IOceanEngineService {
                             if(material.getVideoUrl() == null){
                                 material.setVideoUrl(getVideoUrl(material.getVid()));
                             }
-
-                            String imageCode = FfmpegUtils.getVideoFirstImage(material.getVideoUrl(),20);
-                            if(null == imageCode){
-                                Thread.sleep(1000L);
-                                imageCode = FfmpegUtils.getVideoFirstImage(material.getVideoUrl(),20);
+                            String base64Code = FfmpegUtils.getVideoFirstImage(material.getVideoUrl(),20);
+                            if(base64Code == null){
+                                Thread.sleep(1000);
+                                base64Code = FfmpegUtils.getVideoFirstImage(material.getVideoUrl(),20);
                             }
-                            String destPath = "D:\\data\\effectCase\\hot-material\\";
-                            String fileName = material.getVid()+".jpg";
-                            EffectCase.base64ToFile(destPath,imageCode,fileName);
-                            InputStream inputStream = new FileInputStream(destPath+fileName);
-                            String finalUrl = OSSUtils.uploadFile2OSS(inputStream, "ocean-engine/hot-material/", fileName);
-                            material.setCoverUrl(finalUrl);
+                            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);
@@ -158,17 +154,14 @@ public class OceanEngineServiceImpl implements IOceanEngineService {
                     if (effectCase.getVideoUrl() == null){
                         effectCase.setVideoUrl(getVideoUrl(effectCase.getVid()));
                     }
-                    String imageCode = FfmpegUtils.getVideoFirstImage(effectCase.getVideoUrl(),20);
-                    if(null == imageCode){
-                        Thread.sleep(1000L);
-                        imageCode = FfmpegUtils.getVideoFirstImage(effectCase.getVideoUrl(),20);
+                    String base64Code = FfmpegUtils.getVideoFirstImage(effectCase.getVideoUrl(),20);
+                    if(base64Code == null){
+                        Thread.sleep(1000);
+                        base64Code = FfmpegUtils.getVideoFirstImage(effectCase.getVideoUrl(),20);
                     }
-                    String destPath = "D:\\data\\effectCase\\effect-case\\";
-                    String fileName = effectCase.getVid()+".jpg";
-                    EffectCase.base64ToFile(destPath,imageCode,fileName);
-                    InputStream inputStream = new FileInputStream(destPath+fileName);
-                    String finalUrl = OSSUtils.uploadFile2OSS(inputStream, "ocean-engine/effect-case/", fileName);
-                    effectCase.setCoverUrl(finalUrl);
+                    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);
@@ -195,19 +188,20 @@ public class OceanEngineServiceImpl implements IOceanEngineService {
                 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.isEmpty()){
+                    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 imageCode = FfmpegUtils.getVideoFirstImage(douyinHot.getUrl(),20);
-                            String destPath = "D:\\data\\effectCase\\douyin-hot\\";
-                            String fileName = douyinHot.getId()+".jpg";
-                            EffectCase.base64ToFile(destPath,imageCode,fileName);
-                            InputStream inputStream = new FileInputStream(destPath+fileName);
-                            String finalUrl = OSSUtils.uploadFile2OSS(inputStream, "ocean-engine/douyin-hot/", fileName);
-                            douyinHot.setCoverUrl(finalUrl);
+                            String base64Code = FfmpegUtils.getVideoFirstImage(douyinHot.getUrl(),20);
+                            if(base64Code == null){
+                                Thread.sleep(1000);
+                                base64Code = FfmpegUtils.getVideoFirstImage(douyinHot.getUrl(),20);
+                            }
+                            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);

+ 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;
+    }
+
+}