Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/test-V2' into test-V2

# Conflicts:
#	jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/KuaishouMaterialsLoadJob.java
hcst_sunzhen 5 gadi atpakaļ
vecāks
revīzija
b562239a50
46 mainītis faili ar 1411 papildinājumiem un 203 dzēšanām
  1. 6 0
      jeecg-boot-module-system/pom.xml
  2. 12 0
      jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java
  3. 7 7
      jeecg-boot-module-system/src/main/java/org/jeecg/JeecgOneToMainUtil.java
  4. 65 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/RabbitConfig.java
  5. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  6. 22 19
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ActorController.java
  7. 34 1
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/controller/MaterialInfoController.java
  8. 75 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialUploadController.java
  9. 49 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestMqController.java
  10. 62 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  11. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/Project.java
  12. 0 17
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java
  13. 17 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/mq/Receiver.java
  14. 21 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/mq/Sender.java
  15. 5 0
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  16. 9 2
      jeecg-boot-module-system/src/main/resources/application-test.yml
  17. 109 1
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  18. 2 13
      module-common/pom.xml
  19. 9 2
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  20. 7 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/UserAllocation.java
  21. 3 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java
  22. 18 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  23. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  24. 18 8
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  25. 0 9
      module-common/src/main/java/cn/com/ctop/common/module/utils/CsvUtils.java
  26. 0 10
      module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java
  27. 0 48
      module-common/src/main/java/cn/com/ctop/common/module/utils/ImageUtils.java
  28. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java
  29. 4 12
      module-common/src/main/java/cn/com/ctop/common/module/utils/LoadFileUtil.java
  30. 254 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/MpsUtils.java
  31. 5 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/controller/AppiumJobController.java
  32. 8 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/service/IAppiumJobService.java
  33. 223 3
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/service/impl/AppiumJobServiceImpl.java
  34. 17 6
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/service/impl/KuaishouCrawlerServiceImpl.java
  35. 9 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/AppiumUtil.java
  36. 1 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/KuaimiUtil.java
  37. 12 10
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/KuaishouUtil.java
  38. 17 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/IMaterialUploadService.java
  39. 239 0
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java
  40. 5 13
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java
  41. 4 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouImageGet.java
  42. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java
  43. 15 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  44. 2 8
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java
  45. 33 0
      mondule-jbpm/pom.xml
  46. 6 1
      pom.xml

+ 6 - 0
jeecg-boot-module-system/pom.xml

@@ -36,6 +36,12 @@
     </repositories>
 
     <dependencies>
+        <!-- rabbitmq 依赖jar包-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-amqp</artifactId>
+            <version>1.5.2.RELEASE</version>
+        </dependency>
         <dependency>
             <groupId>org.jeecgframework.boot</groupId>
             <artifactId>jeecg-boot-base-common</artifactId>

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

@@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.servlet.MultipartConfigFactory;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
@@ -12,6 +13,7 @@ import org.springframework.core.env.Environment;
 import org.springframework.web.client.RestTemplate;
 import springfox.documentation.swagger2.annotations.EnableSwagger2;
 
+import javax.servlet.MultipartConfigElement;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 
@@ -45,4 +47,14 @@ public class JeecgApplication {
         return new RestTemplate();
     }
 
+    @Bean
+    public MultipartConfigElement multipartConfigElement() {
+        MultipartConfigFactory factory = new MultipartConfigFactory();
+        //  单个数据大小
+        factory.setMaxFileSize("10240KB"); // KB,MB
+        /// 总上传数据大小
+        factory.setMaxRequestSize("102400KB");
+        return factory.createMultipartConfig();
+    }
+
 }

+ 7 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/JeecgOneToMainUtil.java

@@ -23,33 +23,33 @@ public class JeecgOneToMainUtil {
 		//第一步:设置主表配置
 		MainTableVo mainTable = new MainTableVo();
         //表名
-        mainTable.setTableName("sys_category");
+        mainTable.setTableName("ctop_material_info");
         //实体名
-        mainTable.setEntityName("Category");
+        mainTable.setEntityName("MaterialInfo");
         //包名
         mainTable.setEntityPackage("ctop");
         //描述
-        mainTable.setFtlDescription("主分类信息");
+        mainTable.setFtlDescription("素材库");
 		
 		//第二步:设置子表集合配置
 		List<SubTableVo> subTables = new ArrayList<SubTableVo>();
 		//[1].子表一
 		SubTableVo po = new SubTableVo();
         //表名
-        po.setTableName("sys_category");
+        po.setTableName("ctop_material_ascription");
         //实体名
-        po.setEntityName("Category");
+        po.setEntityName("MaterialAscription");
         //包名
         po.setEntityPackage("ctop");
         //描述
-        po.setFtlDescription("子分类信息");
+        po.setFtlDescription("素材归属");
 		//子表外键参数配置
 		/*说明: 
 		 * a) 子表引用主表主键ID作为外键,外键字段必须以_ID结尾;
 		 * b) 主表和子表的外键字段名字,必须相同(除主键ID外);
 		 * c) 多个外键字段,采用逗号分隔;
 		*/
-        po.setForeignKeys(new String[]{"pid"});
+        po.setForeignKeys(new String[]{"material_id"});
 		subTables.add(po);
 		mainTable.setSubTables(subTables);
 		

+ 65 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/config/RabbitConfig.java

@@ -0,0 +1,65 @@
+package org.jeecg.config;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.core.Queue;
+import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
+import org.springframework.amqp.rabbit.connection.ConnectionFactory;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Scope;
+
+@Configuration
+@Slf4j
+public class RabbitConfig {
+    @Value("${spring.rabbitmq.host}")
+    private String host;
+
+    @Value("${spring.rabbitmq.port}")
+    private int port;
+
+    @Value("${spring.rabbitmq.username}")
+    private String username;
+
+    @Value("${spring.rabbitmq.password}")
+    private String password;
+
+
+    public static final String EXCHANGE_A = "my-mq-exchange_A";
+    public static final String EXCHANGE_B = "my-mq-exchange_B";
+    public static final String EXCHANGE_C = "my-mq-exchange_C";
+
+
+    public static final String QUEUE_A = "QUEUE_A";
+    public static final String QUEUE_B = "QUEUE_B";
+    public static final String QUEUE_C = "QUEUE_C";
+
+    public static final String ROUTINGKEY_A = "spring-boot-routingKey_A";
+    public static final String ROUTINGKEY_B = "spring-boot-routingKey_B";
+    public static final String ROUTINGKEY_C = "spring-boot-routingKey_C";
+
+    @Bean
+    public ConnectionFactory connectionFactory() {
+        CachingConnectionFactory connectionFactory = new CachingConnectionFactory(host, port);
+        connectionFactory.setUsername(username);
+        connectionFactory.setPassword(password);
+        connectionFactory.setVirtualHost("/");
+        connectionFactory.setPublisherConfirms(true);
+        return connectionFactory;
+    }
+
+    @Bean
+    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+    //必须是prototype类型
+    public RabbitTemplate rabbitTemplate() {
+        RabbitTemplate template = new RabbitTemplate(connectionFactory());
+        return template;
+    }
+
+    @Bean
+    public Queue helloQueue() {
+        return new Queue("hello");
+    }
+}

+ 2 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -100,9 +100,10 @@ public class ShiroConfig {
 		filterChainDefinitionMap.put("/actuator/metrics/**", "anon");
 		filterChainDefinitionMap.put("/actuator/httptrace/**", "anon");
 		filterChainDefinitionMap.put("/actuator/redis/**", "anon");
+        //消息队列
+        filterChainDefinitionMap.put("/mq/**", "anon");
         //模板测试
         filterChainDefinitionMap.put("/test/**", "anon");
-        //报表测试
 		//oauth接口
         filterChainDefinitionMap.put("/auth/**", "anon");
 		filterChainDefinitionMap.put("/ctop/syncdata/**", "anon");

+ 22 - 19
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ActorController.java

@@ -42,25 +42,6 @@ public class ActorController {
     public Result<Actor> getDetail(@RequestParam(name = "actorId") Long actorId) {
         Result<Actor> result = new Result<>();
         Actor actor = actorService.getById(actorId);
-//        ActorComment actorComment = new ActorComment();
-//        actorComment.setActorId(actorId);
-//        QueryWrapper<ActorComment> actorCommentQueryWrapper = QueryGenerator.initQueryWrapper(actorComment, null);
-//        List<ActorComment> actorCommentList = actorCommentService.list(actorCommentQueryWrapper);
-//
-//        ActorPhoto actorPhoto = new ActorPhoto();
-//        actorPhoto.setActorId(actorId);
-//        QueryWrapper<ActorPhoto> actorPhotoQueryWrapper = QueryGenerator.initQueryWrapper(actorPhoto, null);
-//        List<ActorPhoto> actorPhotoList = actorPhotoService.list(actorPhotoQueryWrapper);
-//
-//        ActorVideo actorVideo = new ActorVideo();
-//        actorVideo.setActorId(actorId);
-//        QueryWrapper<ActorVideo> actorVideoQueryWrapper = QueryGenerator.initQueryWrapper(actorVideo, null);
-//        List<ActorVideo> actorVideoList = actorVideoService.list(actorVideoQueryWrapper);
-//        Map<String, Object> map = new HashMap<String, Object>();
-//        map.put("actor", actor);
-//        map.put("actorCommentList", actorCommentList);
-//        map.put("actorPhotoList", actorPhotoList);
-//        map.put("actorVideoList", actorVideoList);
         result.setResult(actor);
         result.setSuccess(true);
         return result;
@@ -338,4 +319,26 @@ public class ActorController {
 
         return result;
     }
+
+    public static String longestCommonPrefix(String[] strs) {
+        if (strs.length == 0) {
+            return "";
+        }
+        String prefix = strs[0];
+        for (int i = 1; i < strs.length; i++) {
+            while (strs[i].indexOf(prefix) != 0) {
+                prefix = prefix.substring(0, prefix.length() - 1);
+                if (prefix.isEmpty()) {
+                    return "";
+                }
+            }
+        }
+        return prefix;
+    }
+
+
+    public static void main(String[] args) {
+        String[] strings = {"abcd", "adc", "ab", "a"};
+        System.out.println(longestCommonPrefix(strings));
+    }
 }

+ 34 - 1
module-ctop/src/main/java/cn/com/ctop/manage/modules/material/controller/MaterialInfoController.java

@@ -1,9 +1,12 @@
-package cn.com.ctop.manage.modules.material.controller;
+package org.jeecg.modules.ctop.controller;
 
 
 import cn.com.ctop.common.module.entity.MaterialInfo;
 import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.FileEntity;
+import cn.com.ctop.common.module.utils.FileUploadTool;
+import cn.com.ctop.common.module.utils.LoadFileUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -35,6 +38,7 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.text.ParseException;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -60,6 +64,26 @@ public class MaterialInfoController {
     }
 
 
+    @RequestMapping(value = "/getMd5", consumes = "multipart/form-data;charset=utf-8")
+    public String getMd5(@RequestParam("multipartFile") MultipartFile multipartFile, HttpServletRequest request) throws IOException {
+
+        Map<String, Object> returnMap = new HashMap<>();
+        try {
+            String savaPath = "D:\\tets1\\image";
+            FileUploadTool fileUploadTool = new FileUploadTool();
+            FileEntity entity;
+            entity = fileUploadTool.createFile(multipartFile, request, savaPath);
+
+            String path = entity.getPath();
+            String md5 = LoadFileUtil.getMD5(path);
+            return md5;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+
     @GetMapping(value = "/getDetail")
     public JSONObject getDetail(String materialId) {
 
@@ -77,6 +101,8 @@ public class MaterialInfoController {
      * @param req
      * @return
      */
+
+
     @AutoLog(value = "素材信息-分页列表查询")
     @ApiOperation(value = "素材信息-分页列表查询", notes = "素材信息-分页列表查询")
     @GetMapping(value = "/list")
@@ -88,6 +114,12 @@ public class MaterialInfoController {
         Result<IPage<MaterialInfo>> result = new Result<>();
         Object createTime = materialInfo.getCreateTime();
         materialInfo.setCreateTime(null);
+        if (!Check.isNull(materialInfo.getUserId())) {
+            String roleCode = materialInfoService.getRoleCodeByUserId(materialInfo.getUserId());
+            if ("admin".equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode)) {
+                materialInfo.setUserId(null);
+            }
+        }
         QueryWrapper<MaterialInfo> queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
         if (!Check.isNull(createTime)) {
             try {
@@ -148,6 +180,7 @@ public class MaterialInfoController {
         }
 
         return result;
+
     }
 
     /**

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

@@ -0,0 +1,75 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.manage.modules.material.service.IMaterialUploadService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 素材归属标
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-11-23
+ */
+@Slf4j
+@Api(tags = "素材归属标")
+@RestController
+@RequestMapping("/ctop/materialUpload")
+public class MaterialUploadController {
+
+    @Autowired
+    private IMaterialUploadService materialUploadService;
+
+    @PostMapping(value = "/uploadAccount")
+    public Map<String, Object> uploadAccount(@RequestBody JSONObject json) {
+        Map<String, Object> returnMap = new HashMap<>();
+        String mediaId = json.getString("mediaId");
+        JSONArray materialArray = json.getJSONArray("materialArray");
+        JSONArray accountArray = json.getJSONArray("accountArray");
+        try {
+            if (Check.isNull(mediaId)) {
+                throw new Exception("请选择项目媒体类型");
+            }
+            if (Check.isNull(materialArray) || Check.isNull(accountArray)) {
+                throw new Exception("请选择账号或素材");
+            }
+            Thread thread = new Thread() {
+                @Override
+                public void run() {
+                    try {
+                        materialUploadService.uploadAccount(mediaId, materialArray, accountArray);
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                }
+            };
+            thread.start();
+
+            returnMap.put("success", true);
+            returnMap.put("message", "开始上传文件");
+            returnMap.put("code", 0);
+
+        } catch (Exception e) {
+            returnMap.put("success", false);
+            returnMap.put("message", e.getMessage());
+        }
+
+
+        return returnMap;
+
+    }
+
+
+}

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

@@ -0,0 +1,49 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
+import cn.com.ctop.crawler.modules.appium.service.IAppiumJobService;
+import cn.com.ctop.crawler.modules.appium.service.IAppiumTaskService;
+import org.jeecg.modules.mq.Sender;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@RestController
+@RequestMapping("mq")
+public class TestMqController {
+    @Autowired
+    private Sender sender;
+    @Autowired
+    private IAppiumJobService jobService;
+    @Autowired
+    private IAppiumTaskService appiumTaskService;
+
+    @GetMapping("hello")
+    public Map<String, Object> sayHello() {
+        Map<String, Object> result = new HashMap<>();
+        sender.send();
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS.getCode());
+        return result;
+    }
+
+    @GetMapping("task1")
+    public Map<String, Object> task1() {
+        Map<String, Object> result = new HashMap<>();
+        jobService.loginTask(2L);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS.getCode());
+        return result;
+    }
+
+    @GetMapping("task2")
+    public Map<String, Object> task2() {
+        Map<String, Object> result = new HashMap<>();
+        appiumTaskService.runTask(1, 1);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS.getCode());
+        return result;
+    }
+}

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

@@ -1,7 +1,9 @@
 package org.jeecg.modules.ctop.controller;
 
 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.Check;
 import cn.com.ctop.common.module.utils.StringUtils;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -16,6 +18,8 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.ctop.entity.Project;
+import org.jeecg.modules.ctop.service.IProjectService;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -38,9 +42,10 @@ import java.util.Map;
 
 /**
  * 用户分配
+ *
  * @author jeecg-boot
- * @date 2019-08-08
  * @version V1.0
+ * @date 2019-08-08
  */
 @Slf4j
 @Api(tags = "用户分配")
@@ -49,6 +54,62 @@ import java.util.Map;
 public class UserAllocationController {
     @Autowired
     private IUserAllocationService userAllocationService;
+    @Autowired
+    private UserAllocationMapper userAllocationMapper;
+    @Autowired
+    private IProjectService projectService;
+
+
+    @GetMapping(value = "/getAccountList")
+    public Result<List<UserAllocation>> getAccountList(String userId, Long projectId) {
+        Result<List<UserAllocation>> result = new Result<>();
+        try {
+
+            QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("user_id", userId);
+            queryWrapper.eq("project_id", projectId);
+            Project project = projectService.getById(projectId);
+            if (!Check.isNull(project)) {
+                queryWrapper.eq("media_id", project.getMediaId());
+            }
+
+            List<UserAllocation> userAllocations = userAllocationMapper.selectList(queryWrapper);
+            result.setSuccess(true);
+            result.setResult(userAllocations);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.success("查询失败");
+        }
+
+        return result;
+
+    }
+
+
+    @GetMapping(value = "/getAccountListByProjectId")
+    public Result<List<UserAllocation>> getAccountListByProjectId(Long projectId) {
+        Result<List<UserAllocation>> result = new Result<>();
+        try {
+
+            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());
+            }
+
+            List<UserAllocation> userAllocations = userAllocationMapper.selectList(queryWrapper);
+            result.setSuccess(true);
+            result.setResult(userAllocations);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.success("查询失败");
+        }
+
+        return result;
+
+    }
+
 
     /**
      * 分页列表查询

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/Project.java

@@ -55,7 +55,7 @@ public class Project {
      */
     @Excel(name = "创建人", width = 15)
     @ApiModelProperty(value = "创建人")
-    private String createBy;
+    private String userId;
     /**
      * 负责人id
      */

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

@@ -207,23 +207,6 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
         return resultMap;
     }
 
-    public Map<String, Object> bindAdByKuaishou() {
-        Map<String, Object> result = new HashMap<>();
-        String url = "https://ad.oceanengine.com/pages/login/index.html";
-        System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
-        ChromeOptions chromeOptions = new ChromeOptions();
-        chromeOptions.addArguments("--headless");
-        chromeOptions.addArguments("--incognito");
-        chromeOptions.addArguments("--disable-gpu");
-        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);
-        WebElement element = webDriver.findElement(By.xpath(""));
-        return result;
-    }
-
     @Override
     public Map<String, Object> createInternal(JSONObject requestJson) {
         Map<String, Object> resultMap = new HashMap<>();

+ 17 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/mq/Receiver.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.mq;
+
+import org.springframework.amqp.rabbit.annotation.RabbitHandler;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.stereotype.Component;
+
+@Component
+@RabbitListener(queues = "hello")
+public class Receiver {
+    /**
+     * 通过@RabbitHandler声明的方法,对hello队列中的消息进行处理
+     */
+    @RabbitHandler
+    public void receiver(String str) {
+        System.out.println("Receiver says:[" + str + "]");
+    }
+}

+ 21 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/mq/Sender.java

@@ -0,0 +1,21 @@
+package org.jeecg.modules.mq;
+
+import org.springframework.amqp.core.AmqpTemplate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class Sender {
+
+    @Autowired
+    AmqpTemplate rabbitmqTemplate;
+
+    /**
+     * 发送消息
+     */
+    public void send() {
+        String content = "Sender says:" + "'hello, I'm sender'";
+        System.out.println(content);
+        rabbitmqTemplate.convertAndSend("hello", content);
+    }
+}

+ 5 - 0
jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -13,6 +13,11 @@ management:
         include: metrics,httptrace
 
 spring:
+  rabbitmq:
+    host: 39.106.184.70
+    port: 5672
+    username: guest
+    password: guest
   servlet:
     multipart:
       max-file-size: -1

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

@@ -13,6 +13,11 @@ management:
         include: metrics,httptrace
 
 spring:
+  rabbitmq:
+    host: 127.0.0.1
+    port: 5672
+    username: guest
+    password: guest
   servlet:
     multipart:
       max-file-size: -1
@@ -95,9 +100,11 @@ spring:
       datasource:
         master:
           #          url: jdbc:mysql://192.168.0.23:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-          url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          #          url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          url: jdbc:mysql://33.97.120.42:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
           username: hcst
-          password: hcst2019
+          #          password: hcst2019
+          password: test@20190531
           driver-class-name: com.mysql.jdbc.Driver
           # 多数据源配置
           #multi-datasource1:

+ 109 - 1
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -1,10 +1,21 @@
 package org.jeecg;
 
+import cn.com.ctop.common.module.utils.HttpUtils2;
 import cn.com.ctop.crawler.modules.appium.service.IAppiumJobService;
+import cn.com.ctop.crawler.modules.appium.service.IAppiumTaskService;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.http.impl.client.BasicCookieStore;
+import org.jeecg.modules.ctop.service.ICreateInternalService;
+import org.jeecg.modules.mq.Sender;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+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.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
@@ -12,10 +23,107 @@ import org.springframework.test.context.junit4.SpringRunner;
 @SpringBootTest
 @Slf4j
 public class SampleTest {
+    @Value("${jeecg.path.chrome-driver}")
+    private String chromeDriver;
     @Autowired
     private IAppiumJobService jobService;
+    @Autowired
+    private ICreateInternalService createInternalService;
+    @Autowired
+    private IAppiumTaskService appiumTaskService;
     @Test
-    public void testJob() {
+    public void testGetKuaishouId() {
         jobService.loginTask(2L);
     }
+
+    @Test
+    public void testKsDown() {
+        appiumTaskService.runTask(1, 1);
+    }
+
+    @Test
+    public void testKs() throws InterruptedException {
+        String url = "https://ad.e.kuaishou.com/#/welcome?redirectUrl=https%3A%2F%2Fad.e.kuaishou.com%2F%23%2Findex";
+        System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
+        ChromeOptions chromeOptions = new ChromeOptions();
+//        chromeOptions.addArguments("--headless");
+        chromeOptions.addArguments("--incognito");
+        chromeOptions.addArguments("--disable-gpu");
+//        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);
+        try {
+            Thread.sleep(3000L);
+            HttpUtils2.cookieStore = new BasicCookieStore();
+            webDriver.manage().deleteAllCookies();
+            //获取登录页面
+            webDriver.get(url);
+            Thread.sleep(3000L);
+            WebElement accountElement = webDriver.findElement(By.xpath("//div[@class='phone ']/input[@type='text']"));
+            accountElement.sendKeys("19845004383");
+            Thread.sleep(3000L);
+            WebElement passwordElement = webDriver.findElement(By.xpath("//div[@class='password ']/input[@type='password']"));
+            passwordElement.sendKeys("a123456");
+            WebElement loginElement = webDriver.findElement(By.xpath("//div[@class='foot']"));
+            Thread.sleep(3000L);
+            //点击登录
+            loginElement.click();
+            Thread.sleep(3000L);
+            //获取推广按钮
+            WebElement spreadElement = webDriver.findElement(By.linkText("推广"));
+            spreadElement.click();
+            Thread.sleep(3000L);
+            //选择广告创意
+            WebElement creativeElement = webDriver.findElement(By.xpath("//div[text()='广告创意']"));
+            creativeElement.click();
+            Thread.sleep(3000L);
+            //输入创意名称,点击搜索
+            WebElement searchElement = webDriver.findElement(By.xpath("//input[@type='text']"));
+            searchElement.sendKeys("2-这个是你画的吗-设计-11.19");
+            Thread.sleep(3000L);
+            WebElement searchButton = webDriver.findElement(By.xpath("//button[@class='ant-btn ant-input-search-button ant-btn-primary']"));
+            searchButton.click();
+            Thread.sleep(3000L);
+            WebElement tiyanElement = webDriver.findElement(By.linkText("体验"));
+            tiyanElement.click();
+            Thread.sleep(2000L);
+            WebElement inputKsIdElement = webDriver.findElement(By.xpath("//textarea[@placeholder='请输入快手账号…']"));
+            inputKsIdElement.sendKeys("123456765");
+            Thread.sleep(2000L);
+            WebElement chufaElement = webDriver.findElement(By.xpath("//button[@class='creative-experience-btn-enable']"));
+            chufaElement.click();
+
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            webDriver.manage().deleteAllCookies();
+            webDriver.close();
+        }
+    }
+
+    @Test
+    public void test() {
+        jobService.refreshWebPhone();
+    }
+
+    @Test
+    public void testCrawler() {
+        String account = "";
+        String password = "";
+        String creativeName = "";
+        //1:获取快手账号id
+        String ksId = jobService.loginTask(2L);
+        //2:绑定体验账号
+        boolean isbind = jobService.bindCreative(account, password, creativeName, ksId);
+        //3:转化
+        appiumTaskService.runTask(1, 1);
+    }
+
+    @Test
+    public void testMq() {
+        Sender sender = new Sender();
+        sender.send();
+    }
 }

+ 2 - 13
module-common/pom.xml

@@ -68,17 +68,6 @@
         </dependency>
 
 
-        <!--<dependency>
-            <groupId>org.jeecgframework.boot</groupId>
-            <artifactId>jeecg-boot-base-common</artifactId>
-            <version>2.0.2</version>
-        </dependency>-->
-        <!--<dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-csv</artifactId>
-            <version>1.5</version>
-            <scope>compile</scope>
-        </dependency>-->
         <dependency>
             <groupId>net.sourceforge.javacsv</groupId>
             <artifactId>javacsv</artifactId>
@@ -87,7 +76,7 @@
 
     </dependencies>
     <build>
-
+<!--
         <plugins>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
@@ -96,7 +85,7 @@
                     <includeSystemScope>true</includeSystemScope>
                 </configuration>
             </plugin>
-        </plugins>
+        </plugins>-->
 
 
         <resources>

+ 9 - 2
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.common.module.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -67,8 +68,8 @@ public class MaterialInfo {
     /**
      * userId
      */
-    @Excel(name = "status", width = 15)
-    @ApiModelProperty(value = "status")
+    @Excel(name = "user_id", width = 15)
+    @ApiModelProperty(value = "user_id")
     private String userId;
 
 
@@ -97,6 +98,12 @@ public class MaterialInfo {
     private String refuseFile;
 
     /**
+     * 创意文案
+     */
+    private String creativeCopywriter;
+
+
+    /**
      * createTime
      */
     @ApiModelProperty(value = "createTime")

+ 7 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/UserAllocation.java

@@ -59,7 +59,14 @@ public class UserAllocation {
     @ApiModelProperty(value = "广告主ID")
     private String advertiserId;
 
+    /**
+     * 项目id
+     */
     private Long projectId;
+
+    /**
+     * 项目名称
+     */
     private String projectName;
 
     /**

+ 3 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java

@@ -17,5 +17,7 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
 
     String selectUserNameById(@Param("auditorId") String auditorId);
 
-    String selectCountByMap(@Param("requestMap") Map<String, Object> requestMap);
+    Integer selectCountByMap(Map<String, Object> requestMap);
+
+    String getRoleCodeByUserId(@Param("userId") String userId);
 }

+ 18 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -7,7 +7,7 @@
     </select>
 
 
-    <select id="selectCountByMap" parameterType="java.util.Map" resultType="java.lang.String">
+    <select id="selectCountByMap" parameterType="java.util.Map" resultType="java.lang.Integer">
 
         select count(1)
         from ctop_material_info
@@ -23,5 +23,22 @@
 
     </select>
 
+    <select id="getRoleCodeByUserId" resultType="java.lang.String">
+   SELECT
+    role_code
+    FROM
+    sys_role
+    WHERE
+    id = (
+    SELECT
+    t2.role_id
+    FROM
+    sys_user t1
+    LEFT JOIN sys_user_role t2 ON t1.id = t2.user_id
+    WHERE
+    t1.id = #{userId,jdbcType=VARCHAR}
+    )
+    </select>
+
 
 </mapper>

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java

@@ -23,4 +23,6 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
     JSONObject getDetail(String materialId);
 
     JSONObject report(String userId);
+
+    String getRoleCodeByUserId(String userId);
 }

+ 18 - 8
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -72,7 +72,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
     public boolean imgLocation(String fileName) throws IOException {
-        String reg = "(mp4|flv|avi|rm|rmvb|wmv)";
+        String reg = "(mp4|flv|avi|rm|rmvb|wmv|MP4)";
         Pattern p = Pattern.compile(reg);
         return p.matcher(fileName).find();
     }
@@ -96,8 +96,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             MaterialInfo info = new MaterialInfo();
             info.setId(jsonObject.getString("code"));
             info.setCode(jsonObject.getString("code"));
-            info.setWatermarkUrl("https:" + jsonObject.getString("watermarkUrl"));
-            info.setUrl("https:" + jsonObject.getString("url"));
+
+            if (!Check.isNull(jsonObject.getString("watermarkUrl"))) {
+                info.setWatermarkUrl("https:" + jsonObject.getString("watermarkUrl"));
+            }
+            if (!Check.isNull(jsonObject.getString("url"))) {
+                info.setUrl("https:" + jsonObject.getString("url"));
+            }
             info.setUserId(jsonObject.getString("userId"));
             info.setProjectId(jsonObject.getLong("projectId"));
             info.setWatermarkCode(jsonObject.getString("watermarkCode"));
@@ -122,7 +127,7 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 materialAscription.setMaterialId(info.getId());
                 materialAscription.setClipId(ascription.getString("clipId")); // 剪辑人
                 materialAscription.setShotId(ascription.getString("shotId")); // 拍摄人id
-                materialAscription.setPlaneId(ascription.getString("planId")); // 策划id
+                materialAscription.setPlanId(ascription.getString("planId")); // 策划id
                 materialAscription.setPlaneId(ascription.getString("planeId")); //平面id
                 materialAscriptionMapper.deleteByMap(deleteMap);
                 int i = materialAscriptionMapper.insert(materialAscription);
@@ -213,19 +218,19 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             Map<String, Object> requestMap = new HashMap<>();
             requestMap.put("userId", userId);
 
-            String totalCount = materialInfoMapper.selectCountByMap(requestMap);
+            Integer totalCount = materialInfoMapper.selectCountByMap(requestMap);
             json.put("total", totalCount);
 
             requestMap.put("status", 0);
-            String waitAudit = materialInfoMapper.selectCountByMap(requestMap);
+            Integer waitAudit = materialInfoMapper.selectCountByMap(requestMap);
             json.put("waitAudit", waitAudit);
 
             requestMap.put("status", 1);
-            String passAudit = materialInfoMapper.selectCountByMap(requestMap);
+            Integer passAudit = materialInfoMapper.selectCountByMap(requestMap);
             json.put("passAudit", passAudit);
 
             requestMap.put("status", 2);
-            String refuseAudit = materialInfoMapper.selectCountByMap(requestMap);
+            Integer refuseAudit = materialInfoMapper.selectCountByMap(requestMap);
             json.put("refuseAudit", refuseAudit);
         } catch (Exception e) {
             e.printStackTrace();
@@ -235,6 +240,11 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         return json;
     }
 
+    @Override
+    public String getRoleCodeByUserId(String userId) {
+        return materialInfoMapper.getRoleCodeByUserId(userId);
+    }
+
 
     @Autowired
     private MaterialParameterMapper materialParameterMapper;

+ 0 - 9
module-common/src/main/java/cn/com/ctop/common/module/utils/CsvUtils.java

@@ -47,13 +47,4 @@ public class CsvUtils {
         }
         wr.close();
     }
-
-    public static void main(String[] args) throws IOException {
-        String[] header = new String[]{"日期", "plan", "广告组", "花费", "曝光数", "点击数", "行为数", "点击率", "行为率", "平均千次曝光花费", "平均点击单价", "平均行为单价", "提交按钮点击", "表单提交率", "表单提交单价"};
-        String inPath = "D:\\工作文件\\360借条\\effect_unit_2019-08-02-00_2019-08-02-00.csv";
-        String outPath = "D:\\工作文件\\360借条\\effect_unit_2019-08-02-00_2019-08-02-00_bak.csv";
-        List<String[]> list = CsvUtils.readCsv(inPath, "utf8");
-        CsvUtils.writeCsv(outPath, list);
-
-    }
 }

+ 0 - 10
module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java

@@ -543,16 +543,6 @@ public class HttpUtils {
         return result;
     }
 
-    public static void main(String[] args) {
-        Map<String, Object> params = new HashMap<>();
-        params.put("add", 1);
-        params.forEach((k, v) -> {
-
-        });
-
-    }
-
-
     public static String httpGetRequest(String url, Map<String, String> headers, TreeMap<String, Object> params) {
         HttpClient httpClient = createSslClientDefault();
         String strReturn = "";

+ 0 - 48
module-common/src/main/java/cn/com/ctop/common/module/utils/ImageUtils.java

@@ -140,54 +140,6 @@ public class ImageUtils {
     public int getContentLength(String content, Graphics2D graphics2D) {
         return graphics2D.getFontMetrics(graphics2D.getFont()).charsWidth(content.toCharArray(), 0, content.length());
     }
-
-    public static void main(String[] args) {
-        ImageUtils i = new ImageUtils();
-        String theme = "两件套";
-        Font font = new Font("Aa棉花糖", Font.BOLD + Font.PLAIN, 60);
-        String borderPath = "D:/border/mb/ff0099.png";
-        String coverPath = "D:/image/cover/" + theme;
-        String sourcePath = "D:/image/source/" + theme;
-        String targetPath = "D:/image/target/" + theme;
-        File coverFile = new File(coverPath);
-        if (!coverFile.exists()) {
-            coverFile.mkdirs();
-        }
-
-        int bx = 20;
-        int by = 50;
-        int cx = 70;
-        int cy = 200;
-
-        Color color = new Color(255, 0, 153, 255);
-        List<String> list = i.getContentList();
-        File sourceFile = new File(sourcePath);
-
-        String[] sourceFiles = sourceFile.list();
-        for (String str : sourceFiles) {
-            String imagePath = sourceFile.getAbsolutePath() + "/" + str;
-            new ImageUtils().resize(720, 1280, imagePath, targetPath + "/" + UUID.randomUUID() + ".jpg");
-        }
-
-        File file = new File(targetPath);
-        if (!file.exists()) {
-            file.mkdirs();
-        }
-        String[] files = file.list();
-        for (String str : files) {
-            String imagePath = file.getAbsolutePath() + "/" + str;
-            try {
-                File imageFile = new File(imagePath);
-                for (String content : list) {
-                    InputStream inputStream = new FileInputStream(imageFile);
-                    i.addTextInImage(theme, inputStream, content, color, font, borderPath, coverPath, bx, by, cx, cy);
-                }
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-    }
-
     public List<String> getContentList() {
         List<String> list = new ArrayList<String>();
         //秋装

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

@@ -74,7 +74,7 @@ public class KuaishouInterfaceConstant {
     /**
      * 图片文件上传
      */
-    public static final String IMAGE_UPLOAD = "/rest/openapi/v1/file/ad/image/upload";
+    public static final String IMAGE_UPLOAD = "/rest/openapi/v2/file/ad/image/upload";
     /**
      * 创建应用
      */

+ 4 - 12
module-common/src/main/java/cn/com/ctop/common/module/utils/LoadFileUtil.java

@@ -7,18 +7,6 @@ import java.net.HttpURLConnection;
 import java.net.URL;
 
 public class LoadFileUtil {
-
-    public static void main(String[] args) {
-        try {
-            //  downLoadFromUrl("", "");
-
-            delFile("D:\\tets1\\app\\TEST视频-1565073368755.mp4");
-
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
     /**
      * 上传文件
      *
@@ -105,5 +93,9 @@ public class LoadFileUtil {
         return DigestUtils.md5Hex(new FileInputStream(path));
     }
 
+    public static String getMD5ByFile(FileInputStream inputStream) throws IOException {
+        return DigestUtils.md5Hex(inputStream);
+    }
+
 
 }

+ 254 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/MpsUtils.java

@@ -0,0 +1,254 @@
+package cn.com.ctop.common.module.utils;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.aliyuncs.DefaultAcsClient;
+import com.aliyuncs.IAcsClient;
+import com.aliyuncs.exceptions.ClientException;
+import com.aliyuncs.exceptions.ServerException;
+import com.aliyuncs.mts.model.v20140618.*;
+import com.aliyuncs.profile.DefaultProfile;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@Configuration
+@PropertySource("classpath:config.properties")
+public class MpsUtils {
+    public static final String ossLocation = "oss-cn-beijing";
+    public static final String ossBucket = "ctop-part";
+    public static void main(String[] args){
+        String[] a = {"1","2","3","4","5"};
+        combinationSelect(a,3);
+        arrangementSelect(a,3);
+    }
+    /**
+     * 排列计算公式A<sup>m</sup><sub>n</sub> = n!/(n - m)!
+     * @param m
+     * @param n
+     * @return
+     */
+    public static long arrangement(int m, int n) {
+        return m <= n ? factorial(n) / factorial(n - m) : 0;
+    }
+
+    /**
+     * 排列选择(从列表中选择n个排列)
+     * @param dataList 待选列表
+     * @param n 选择个数
+     */
+    public static void arrangementSelect(String[] dataList, int n) {
+        System.out.println(String.format("A(%d, %d) = %d", dataList.length, n,
+                arrangement(n, dataList.length)));
+        arrangementSelect(dataList, new String[n], 0);
+    }
+
+    /**
+     * 排列选择
+     * @param dataList 待选列表
+     * @param resultList 前面(resultIndex-1)个的排列结果
+     * @param resultIndex 选择索引,从0开始
+     */
+    private static void arrangementSelect(String[] dataList, String[] resultList, int resultIndex) {
+        int resultLen = resultList.length;
+        // 全部选择完时,输出排列结果
+        if (resultIndex >= resultLen) {
+            System.out.println(Arrays.asList(resultList));
+            return;
+        }
+
+        // 递归选择下一个
+        for (int i = 0; i < dataList.length; i++) {
+            // 判断待选项是否存在于排列结果中
+            boolean exists = false;
+            for (int j = 0; j < resultIndex; j++) {
+                if (dataList[i].equals(resultList[j])) {
+                    exists = true;
+                    break;
+                }
+            }
+            // 排列结果不存在该项,才可选择
+            if (!exists) {
+                resultList[resultIndex] = dataList[i];
+                arrangementSelect(dataList, resultList, resultIndex + 1);
+            }
+        }
+    }
+
+    /**
+     * 计算阶乘数,即n! = n * (n-1) * ... * 2 * 1
+     * @param n
+     * @return
+     */
+    private static long factorial(int n) {
+        long sum = 1;
+        while( n > 0 ) {
+            sum = sum * n--;
+        }
+        return sum;
+    }
+
+    /**
+     * 组合计算公式C<sup>m</sup><sub>n</sub> = n! / (m! * (n - m)!)
+     * @param m
+     * @param n
+     * @return
+     */
+    public static long combination(int m, int n) {
+        return m <= n ? factorial(n) / (factorial(m) * factorial((n - m))) : 0;
+    }
+
+    /**
+     * 组合选择(从列表中选择n个组合)
+     * @param dataList 待选列表
+     * @param n 选择个数
+     */
+    public static void combinationSelect(String[] dataList, int n) {
+        System.out.println(String.format("C(%d, %d) = %d",
+                dataList.length, n, combination(n, dataList.length)));
+        combinationSelect(dataList, 0, new String[n], 0);
+    }
+
+    /**
+     * 组合选择
+     * @param dataList 待选列表
+     * @param dataIndex 待选开始索引
+     * @param resultList 前面(resultIndex-1)个的组合结果
+     * @param resultIndex 选择索引,从0开始
+     */
+    private static void combinationSelect(String[] dataList, int dataIndex, String[] resultList, int resultIndex) {
+        int resultLen = resultList.length;
+        int resultCount = resultIndex + 1;
+        // 全部选择完时,输出组合结果
+        if (resultCount > resultLen) {
+            System.out.println(Arrays.asList(resultList));
+            return;
+        }
+
+        // 递归选择下一个
+        for (int i = dataIndex; i < dataList.length + resultCount - resultLen; i++) {
+            resultList[resultIndex] = dataList[i];
+            combinationSelect(dataList, i + 1, resultList, resultIndex + 1);
+        }
+    }
+
+    public IAcsClient getClient(){
+        DefaultProfile profile = DefaultProfile.getProfile(
+                "cn-beijing",      // 地域ID
+                "LTAIbNbqWzSOklQV",      // RAM账号的AccessKey ID
+                "1rkPz7JNoXk8sJevPaeYHWqfkQXBGh"); // RAM账号Access Key Secret
+        IAcsClient client = new DefaultAcsClient(profile);
+        return client;
+    }
+
+    public String mergeOneVideo(String startPart,List<String> videoPart,String endPart){
+        IAcsClient client = getClient();
+        String pipelineId = getPipelineId(client);
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        String outputFilename = "output/"+sdf.format(new Date())+"/"+ UUID.randomUUID()+".mp4";
+        List<String> videos = new ArrayList<>();
+        videos.add(startPart);
+        videos.addAll(videoPart);
+        videos.add(endPart);
+        mergeVideo(client,pipelineId,videos,outputFilename);
+        return outputFilename;
+    }
+
+    public String mergeVideo(IAcsClient client, String pipelineId, List<String> videos, String outputName){
+        String jobId = null;
+        SubmitJobsRequest request = new SubmitJobsRequest();
+        JSONArray mergeList = new JSONArray();
+        if (videos != null && videos.size() > 0){
+            for (int i = 0; i < videos.size();i++){
+                String url = videos.get(i);
+                if (i == 0){
+                    JSONObject input = new JSONObject();
+                    input.put("Location", ossLocation);
+                    input.put("Bucket", ossBucket);
+                    try {
+                        input.put("Object", URLEncoder.encode(url, "utf-8"));
+                    } catch (UnsupportedEncodingException e) {
+                        throw new RuntimeException("input URL encode failed");
+                    }
+                    request.setInput(input.toJSONString());
+                }else {
+                    JSONObject mergeVideo = new JSONObject();
+                    String mergeVideoURL;
+                    try {
+                        mergeVideoURL = String.format(
+                                "http://%s.%s.aliyuncs.com/%s",
+                                ossBucket,
+                                ossLocation,
+                                URLEncoder.encode(url, "utf-8"));
+                    } catch (UnsupportedEncodingException e) {
+                        throw new RuntimeException("mergeVideoURL encode failed");
+                    }
+                    mergeVideo.put("MergeURL", mergeVideoURL);
+                    mergeList.add(mergeVideo);
+                }
+            }
+        }
+        String outputOSSObject;
+        try {
+            outputOSSObject = URLEncoder.encode(outputName, "utf-8");
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException("output URL encode failed");
+        }
+        JSONObject output = new JSONObject();
+        output.put("OutputObject", outputOSSObject);
+        JSONObject video = new JSONObject();
+        video.put("Width", "1280");
+        video.put("Height", "720");
+        output.put("Video", video.toJSONString());
+        output.put("MergeList", mergeList.toJSONString());
+        // Outputs
+        JSONArray outputs = new JSONArray();
+        outputs.add(output);
+        request.setOutputs(outputs.toJSONString());
+        request.setOutputBucket(ossBucket);
+        request.setOutputLocation(ossLocation);
+        // PipelineId
+        request.setPipelineId(pipelineId);
+        // call api
+        SubmitJobsResponse response;
+        try {
+            response = client.getAcsResponse(request);
+            System.out.println("RequestId is:"+response.getRequestId());
+            if (response.getJobResultList().get(0).getSuccess()) {
+                jobId = response.getJobResultList().get(0).getJob().getJobId();
+                System.out.println("JobId is:" + response.getJobResultList().get(0).getJob().getJobId());
+            } else {
+                System.out.println("SubmitJobs Failed code:" + response.getJobResultList().get(0).getCode() +
+                        " message:" + response.getJobResultList().get(0).getMessage());
+            }
+        } catch (ServerException e) {
+            e.printStackTrace();
+        } catch (ClientException e) {
+            e.printStackTrace();
+        }
+        return jobId;
+    }
+
+    public String getPipelineId(IAcsClient client){
+        String pipelineId = null;
+        // 创建API请求并设置参数
+        SearchPipelineRequest request = new SearchPipelineRequest();
+        // 发起请求并处理应答或异常
+        SearchPipelineResponse response;
+        try {
+            response = client.getAcsResponse(request);
+            pipelineId = response.getPipelineList().get(0).getId();
+            System.out.println("PipelineName is:" + response.getPipelineList().get(0).getName());
+            System.out.println("PipelineId is:" + response.getPipelineList().get(0).getId());
+        } catch (ServerException e) {
+            e.printStackTrace();
+        } catch (ClientException e) {
+            e.printStackTrace();
+        }
+        return pipelineId;
+    }
+}

+ 5 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/controller/AppiumJobController.java

@@ -263,4 +263,9 @@ public class AppiumJobController {
         }
         return result;
     }
+
+    @PostMapping("startTask")
+    public Map<String, Object> startTask(String account, String password, String creativeName, Integer num) {
+        return appiumJobService.startTask(account, password, creativeName, num);
+    }
 }

+ 8 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/service/IAppiumJobService.java

@@ -3,6 +3,8 @@ package cn.com.ctop.crawler.modules.appium.service;
 import cn.com.ctop.crawler.modules.appium.entity.AppiumJob;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.Map;
+
 /**
  * 爬虫调度任务
  *
@@ -15,4 +17,10 @@ public interface IAppiumJobService extends IService<AppiumJob> {
     void runTask(Long jobId, Long num);
 
     String loginTask(Long taskId);
+
+    boolean bindCreative(String account, String password, String creativeName, String ksId);
+
+    Map<String, Object> startTask(String account, String password, String creativeName, Integer num);
+
+    boolean refreshWebPhone();
 }

+ 223 - 3
module-crawler/src/main/java/cn/com/ctop/crawler/modules/appium/service/impl/AppiumJobServiceImpl.java

@@ -1,23 +1,33 @@
 package cn.com.ctop.crawler.modules.appium.service.impl;
 
+import cn.com.ctop.common.module.utils.HttpUtils2;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
-import cn.com.ctop.crawler.modules.appium.entity.AppiumJob;
-import cn.com.ctop.crawler.modules.appium.entity.AppiumTask;
-import cn.com.ctop.crawler.modules.appium.entity.AppiumTaskItem;
+import cn.com.ctop.crawler.modules.appium.entity.*;
 import cn.com.ctop.crawler.modules.appium.mapper.AppiumJobMapper;
 import cn.com.ctop.crawler.modules.appium.mapper.AppiumTaskItemMapper;
+import cn.com.ctop.crawler.modules.appium.mapper.AppiumTaskLogMapper;
+import cn.com.ctop.crawler.modules.appium.service.IAppiumDeviceService;
 import cn.com.ctop.crawler.modules.appium.service.IAppiumJobService;
+import cn.com.ctop.crawler.modules.appium.service.IAppiumTaskService;
 import cn.com.ctop.crawler.modules.core.util.AppiumUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import io.appium.java_client.android.AndroidDriver;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.http.impl.client.BasicCookieStore;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+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.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Stack;
 
 /**
  * 爬虫调度任务
@@ -33,6 +43,12 @@ public class AppiumJobServiceImpl extends ServiceImpl<AppiumJobMapper, AppiumJob
     private AppiumJobMapper appiumJobMapper;
     @Autowired
     private AppiumTaskItemMapper taskItemMapper;
+    @Value("${jeecg.path.chrome-driver}")
+    private String chromeDriver;
+    @Autowired
+    private IAppiumDeviceService appiumDeviceService;
+    @Autowired
+    private AppiumTaskLogMapper appiumTaskLogMapper;
 
     @Override
     public void runTask(Long jobId, Long num) {
@@ -76,4 +92,208 @@ public class AppiumJobServiceImpl extends ServiceImpl<AppiumJobMapper, AppiumJob
         System.out.println(kuaishouId);
         return kuaishouId;
     }
+
+    @Override
+    public boolean bindCreative(String account, String password, String creativeName, String ksId) {
+        boolean isBind = false;
+        String url = "https://ad.e.kuaishou.com/#/welcome?redirectUrl=https%3A%2F%2Fad.e.kuaishou.com%2F%23%2Findex";
+        System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
+        ChromeOptions chromeOptions = new ChromeOptions();
+        chromeOptions.addArguments("--headless");
+        chromeOptions.addArguments("--incognito");
+        chromeOptions.addArguments("--disable-gpu");
+//        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);
+        try {
+            Thread.sleep(3000L);
+            HttpUtils2.cookieStore = new BasicCookieStore();
+            webDriver.manage().deleteAllCookies();
+            //获取登录页面
+            webDriver.get(url);
+            Thread.sleep(3000L);
+            WebElement accountElement = webDriver.findElement(By.xpath("//div[@class='phone ']/input[@type='text']"));
+            accountElement.sendKeys(account);
+            Thread.sleep(3000L);
+            WebElement passwordElement = webDriver.findElement(By.xpath("//div[@class='password ']/input[@type='password']"));
+            passwordElement.sendKeys(password);
+            WebElement loginElement = webDriver.findElement(By.xpath("//div[@class='foot']"));
+            Thread.sleep(3000L);
+            //点击登录
+            loginElement.click();
+            Thread.sleep(3000L);
+            //获取推广按钮
+            WebElement spreadElement = webDriver.findElement(By.linkText("推广"));
+            spreadElement.click();
+            Thread.sleep(3000L);
+            //选择广告创意
+            WebElement creativeElement = webDriver.findElement(By.xpath("//div[text()='广告创意']"));
+            creativeElement.click();
+            Thread.sleep(3000L);
+            //输入创意名称,点击搜索
+            WebElement searchElement = webDriver.findElement(By.xpath("//input[@type='text']"));
+            searchElement.sendKeys(creativeName);
+            Thread.sleep(3000L);
+            WebElement searchButton = webDriver.findElement(By.xpath("//button[@class='ant-btn ant-input-search-button ant-btn-primary']"));
+            searchButton.click();
+            Thread.sleep(3000L);
+            WebElement tiyanElement = webDriver.findElement(By.linkText("体验"));
+            tiyanElement.click();
+            Thread.sleep(2000L);
+            WebElement inputKsIdElement = webDriver.findElement(By.xpath("//textarea[@placeholder='请输入快手账号…']"));
+            inputKsIdElement.sendKeys(ksId);
+            Thread.sleep(2000L);
+            WebElement chufaElement = webDriver.findElement(By.xpath("//button[@class='creative-experience-btn-enable']"));
+            chufaElement.click();
+            isBind = true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("绑定体验快手账号失败");
+        } finally {
+            webDriver.manage().deleteAllCookies();
+            webDriver.close();
+            return isBind;
+        }
+    }
+
+    @Autowired
+    private IAppiumTaskService appiumTaskService;
+
+    @Override
+    public Map<String, Object> startTask(String account, String password, String creativeName, Integer num) {
+        Map<String, Object> result = new HashMap<>();
+        int i = 0;
+        while (i < num) {
+            if (i > num) {
+                break;
+            }
+            //获取手机设备信息
+            AppiumDevice appiumDevice = appiumDeviceService.getById(2L);
+            appiumDevice.setStatus(2);
+            appiumDeviceService.updateById(appiumDevice);
+            AppiumTaskLog log = new AppiumTaskLog();
+            log.setDeviceId(2);
+            log.setDeviceIp(appiumDevice.getIp());
+            log.setDevicePort(appiumDevice.getPort());
+            log.setStatus(1);
+            log.setTaskId(1);
+            log.setTaskName("快手刷量任务");
+            appiumTaskLogMapper.insert(log);
+            log.setId(log.getId());
+            try {
+                //一键新机
+                boolean success = refreshWebPhone();
+                String ksId = loginTask(2L);
+                if (null == ksId) {
+                    updateStatus(appiumDevice, log, -1, 1);
+                    continue;
+                }
+                boolean isBind = bindCreative(account, password, creativeName, ksId);
+                if (!isBind) {
+                    updateStatus(appiumDevice, log, -2, 1);
+                    continue;
+                }
+                appiumTaskService.runTask(1, 1);
+                i++;
+            } catch (Exception e) {
+                updateStatus(appiumDevice, log, -3, 1);
+                continue;
+            }
+        }
+        return result;
+    }
+
+    @Override
+    public boolean refreshWebPhone() {
+        boolean success = false;
+        String url = "https://lcloud.longene.com.cn/";
+        System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
+        ChromeOptions chromeOptions = new ChromeOptions();
+//        chromeOptions.addArguments("--headless");
+        chromeOptions.addArguments("--incognito");
+        chromeOptions.addArguments("--disable-gpu");
+//        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);
+        try {
+            Thread.sleep(3000L);
+            HttpUtils2.cookieStore = new BasicCookieStore();
+            webDriver.manage().deleteAllCookies();
+            //获取登录页面
+            webDriver.get(url);
+            Thread.sleep(3000L);
+            WebElement accountElement = webDriver.findElement(By.id("username"));
+            accountElement.sendKeys("18600471989");
+            Thread.sleep(3000L);
+            WebElement passwordElement = webDriver.findElement(By.id("userpwd"));
+            passwordElement.sendKeys("0759125184xu");
+            WebElement loginElement = webDriver.findElement(By.xpath("//input[@class='quc-submit quc-button quc-button-primary quc-button-sign-in']"));
+            Thread.sleep(3000L);
+            //点击登录
+            loginElement.click();
+            Thread.sleep(3000L);
+            //选择华东二站
+            WebElement spreadElement = webDriver.findElement(By.xpath("//a[@href='javascript:gotobranch(2)']"));
+            spreadElement.click();
+            Thread.sleep(3000L);
+            //
+            webDriver.get("https://ecsite.longene.com.cn/userWeb!batchipswitch?ids=4293&groupid=8729&mode=5&ipbind=0&region=0&ipareas=");
+            Thread.sleep(5000L);
+            webDriver.get("https://ecsite.longene.com.cn/userWeb!batchnewphone?groupid=8729&pkgnames=com.smile.gifmaker&ids=4293");
+            Thread.sleep(5000L);
+            success = true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("一键新机操作失败");
+        } finally {
+            webDriver.manage().deleteAllCookies();
+            webDriver.close();
+            return success;
+        }
+    }
+
+    private void updateStatus(AppiumDevice appiumDevice, AppiumTaskLog log, Integer logStatus, Integer deviceStatus) {
+        log.setStatus(3);
+        appiumTaskLogMapper.updateById(log);
+        appiumDevice.setStatus(1);
+        appiumDeviceService.updateById(appiumDevice);
+    }
+
+    public static boolean isValid(String s) {
+        if (null == s || s.length() <= 0) {
+            return true;
+        }
+        if (s.length() % 2 == 1) {
+            return false;
+        }
+        Stack<Character> stack = new Stack<>();
+        for (int i = 0; i < s.length(); i++) {
+            char getchar = s.charAt(i);
+            if (getchar == '(' || getchar == '{' || getchar == '[') {
+                stack.push(getchar);
+            }
+            if (getchar == ')' || getchar == '}' || getchar == ']') {
+                if (stack.empty()) {
+                    return false;
+                }
+                char sufix = stack.pop();
+                if ((getchar == ')' && sufix != '(') || (getchar == '}' && sufix != '{') || (getchar == ']' && sufix != '[')) {
+                    stack.push(sufix);
+                }
+            }
+        }
+        if (stack.empty()) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    public static void main(String[] args) {
+        System.out.println(isValid("[]()[]"));
+    }
 }

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 17 - 6
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/service/impl/KuaishouCrawlerServiceImpl.java


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

@@ -741,7 +741,15 @@ public class AppiumUtil {
                             } else if (appiumTaskItem.getClickType().equals("point")) {
                                 Point point = element.getLocation();
                                 System.out.println(point.getX() + ":" + point.getY());
-                                tapPoint(androidDriver, point.getX() + appiumTaskItem.getOffsiteX(), point.getY() + appiumTaskItem.getOffsiteY());
+                                Integer x = point.getX();
+                                Integer y = point.getY();
+                                if (null != appiumTaskItem.getOffsiteX()) {
+                                    x += appiumTaskItem.getOffsiteX();
+                                }
+                                if (null != appiumTaskItem.getOffsiteY()) {
+                                    y += appiumTaskItem.getOffsiteY();
+                                }
+                                tapPoint(androidDriver, x, y);
                             } else if (appiumTaskItem.getClickType().equals("send")) {
                                 String text = appiumTaskItem.getTextEqualKey();
                                 element.sendKeys(text);

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

@@ -10,7 +10,7 @@ import java.util.regex.Pattern;
  * 2019年11月12日10:04:00
  */
 public class KuaimiUtil {
-    public static final String KUAIMI_API_URL = "http://api.kmiyz.com/api/do.php";
+    public static final String KUAIMI_API_URL = "http://api.caihyz.com/api/do.php";
 
     public static String kuaimiLogin() throws Exception {
         String result = HttpUtils.httpPostNoParamRequest(KUAIMI_API_URL + "?action=loginIn&name=xuzuoyun&password=heaven01");

+ 12 - 10
module-crawler/src/main/java/cn/com/ctop/crawler/modules/core/util/KuaishouUtil.java

@@ -1,21 +1,19 @@
 package cn.com.ctop.crawler.modules.core.util;
 
+import cn.com.ctop.common.module.entity.IpPool;
 import cn.com.ctop.crawler.modules.core.entity.HttpBody;
 import cn.com.ctop.crawler.modules.core.entity.HttpCookie;
 import cn.com.ctop.crawler.modules.core.entity.HttpEntity;
 import cn.com.ctop.crawler.modules.core.entity.HttpHeader;
 import cn.com.ctop.crawler.modules.log.entity.CrawlerLog;
 import com.google.gson.Gson;
+import org.apache.http.HttpHost;
 import org.apache.http.HttpResponse;
-import org.apache.http.client.CookieStore;
 import org.apache.http.client.config.CookieSpecs;
 import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
 import org.apache.http.conn.ssl.TrustStrategy;
-import org.apache.http.cookie.ClientCookie;
-import org.apache.http.cookie.Cookie;
-import org.apache.http.cookie.CookieOrigin;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.BasicCookieStore;
 import org.apache.http.impl.client.CloseableHttpClient;
@@ -30,7 +28,7 @@ import java.security.cert.X509Certificate;
 import java.util.*;
 
 public class KuaishouUtil {
-    public static CrawlerLog requestData(HttpEntity httpEntity){
+    public static CrawlerLog requestData(HttpEntity httpEntity, IpPool ipPool) {
         long beginTime = System.currentTimeMillis();
         CrawlerLog crawlerLog = new CrawlerLog();
         String salt = "382700b563f4";
@@ -64,8 +62,14 @@ public class KuaishouUtil {
                     return true;
                 }
             }).build();
-            RequestConfig globalConfig = RequestConfig.custom().setConnectTimeout(30000).setSocketTimeout(30000).setCookieSpec(CookieSpecs.STANDARD).build();
+            RequestConfig globalConfig = null;
             SSLConnectionSocketFactory sslFactory = new SSLConnectionSocketFactory(sslContext);
+            if (ipPool != null) {
+                HttpHost proxy = new HttpHost(ipPool.getIp(), ipPool.getPort(), "http");
+                globalConfig = RequestConfig.custom().setProxy(proxy).setConnectTimeout(60000).setSocketTimeout(60000).setCookieSpec(CookieSpecs.STANDARD).build();
+            } else {
+                globalConfig = RequestConfig.custom().setConnectTimeout(60000).setSocketTimeout(60000).setCookieSpec(CookieSpecs.STANDARD).build();
+            }
             CloseableHttpClient httpClient = HttpClients.custom().setDefaultCookieStore(cookieStore).setDefaultRequestConfig(globalConfig).setConnectionReuseStrategy((response, context) -> false ).setSSLSocketFactory(sslFactory).build();
             HttpPost httppost = new HttpPost(httpEntity.getUrl()+httpEntity.getPath()+"?"+staticQueryString);
             HttpHeader header = httpEntity.getHttpHeader();
@@ -106,7 +110,7 @@ public class KuaishouUtil {
         return String.valueOf(nextInt);
     }
 
-    public static CrawlerLog kuaishouAppDataFeatch(String url,String path,String urlParam,String bodyParam,String headerParam,String token){
+    public static CrawlerLog kuaishouAppDataFeatch(String url, String path, String urlParam, String bodyParam, String headerParam, String token, IpPool ipPool) {
         HttpEntity httpEntity = new HttpEntity();
         Map<String,String> staticParams = HttpParamUtil.urlParamToMap(urlParam);
         Map<String,String> dynamicParams = HttpParamUtil.urlParamToMap(bodyParam);
@@ -128,8 +132,6 @@ public class KuaishouUtil {
         httpBody.setStaticParams(staticParams);
         httpEntity.setHttpHeader(header);
         httpEntity.setHttpBody(httpBody);
-        return KuaishouUtil.requestData(httpEntity);
+        return KuaishouUtil.requestData(httpEntity, ipPool);
     }
-
-
 }

+ 17 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/IMaterialUploadService.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.manage.modules.material.service;
+
+import com.alibaba.fastjson.JSONArray;
+
+import java.io.IOException;
+
+public interface IMaterialUploadService {
+
+    /**
+     * 同步素材到账号下
+     *
+     * @param mediaId
+     * @param materialArray
+     * @param accountArray
+     */
+    void uploadAccount(String mediaId, JSONArray materialArray, JSONArray accountArray) throws IOException;
+}

+ 239 - 0
module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java

@@ -0,0 +1,239 @@
+package cn.com.ctop.manage.modules.material.service.impl;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.entity.MaterialInfo;
+import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
+import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
+import cn.com.ctop.common.module.service.IFileInfoService;
+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.service.IKuaishouInterfaceService;
+import cn.com.ctop.manage.modules.material.service.IMaterialUploadService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.ParseException;
+import org.springframework.beans.factory.annotation.Autowired;
+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 java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Slf4j
+@Service
+public class MaterialUploadServiceImpl implements IMaterialUploadService {
+    static ExecutorService executorService = Executors.newFixedThreadPool(3);
+
+
+    @Autowired
+    private CtopOauthTokenMapper oauthTokenMapper;
+    @Autowired
+    private MaterialInfoMapper materialInfoMapper;
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private IFileInfoService fileInfoService;
+
+
+    /**
+     * 同步素材到账号下
+     *
+     * @param mediaId
+     * @param materialArray
+     * @param accountArray
+     */
+
+    @Override
+    public void uploadAccount(String mediaId, JSONArray materialArray, JSONArray accountArray) {
+        try {
+            if ("2".equals(mediaId)) {
+                this.KuaiShouUpload(mediaId, materialArray, accountArray);
+            } else if ("1".equals(mediaId)) {
+                this.TouTiaoUpload(mediaId, materialArray, accountArray);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+
+    }
+
+
+    private void TouTiaoUpload(String mediaId, JSONArray materialArray, JSONArray accountArray) {
+        for (int j = 0; j < materialArray.size(); j++) {
+            String materialId = materialArray.getString(j);
+            MaterialInfo materialInfo = materialInfoMapper.selectById(materialId);
+            if (Check.isNull(materialInfo)) {
+                continue;
+            }
+            try {
+
+                for (int i = 0; i < accountArray.size(); i++) {
+                    Long accountId = accountArray.getLong(i);
+                    QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
+                    tokenQueryWrapper.eq("account_id", accountId);
+                    tokenQueryWrapper.eq("media_id", mediaId);
+                    tokenQueryWrapper.orderByDesc("create_time");
+                    tokenQueryWrapper.last("limit 1");
+                    CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(tokenQueryWrapper);
+                    if (Check.isNull(ctopOauthToken)) {
+                        continue;
+                    }
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+                                System.err.println(Thread.currentThread().getName());
+                                if ("VIDEO".equals(materialInfo.getType())) {
+                                    fileInfoService.uploadVideoToBytedance(String.valueOf(accountId), materialInfo.getUrl());
+
+                                } else if ("IMAGE".equals(materialInfo.getType())) {
+                                    fileInfoService.uploadImageToBytedance(String.valueOf(accountId), materialInfo.getUrl());
+                                }
+
+
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                        }
+                    });
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+
+
+        }
+
+
+    }
+
+
+    private void KuaiShouUpload(String mediaId, JSONArray materialArray, JSONArray accountArray) {
+        for (int j = 0; j < materialArray.size(); j++) {
+            String materialId = materialArray.getString(j);
+            MaterialInfo materialInfo = materialInfoMapper.selectById(materialId);
+            if (Check.isNull(materialInfo)) {
+                continue;
+            }
+            try {
+                String localUrl = LoadFileUtil.downLoadFromUrl(materialInfo.getUrl(), "D:\\tets1\\video");
+                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", materialInfo.getCode());
+                for (int i = 0; i < accountArray.size(); i++) {
+                    Long accountId = accountArray.getLong(i);
+                    QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
+                    tokenQueryWrapper.eq("account_id", accountId);
+                    tokenQueryWrapper.eq("media_id", mediaId);
+                    tokenQueryWrapper.orderByDesc("create_time");
+                    tokenQueryWrapper.last("limit 1");
+                    CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(tokenQueryWrapper);
+                    if (Check.isNull(ctopOauthToken)) {
+                        continue;
+                    }
+                    requestJson.put("advertiser_id", accountId);
+                    headerMap.put("Access-Token", ctopOauthToken.getAccessToken());
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+                                System.err.println(Thread.currentThread().getName());
+                                String url = "";
+                                if ("VIDEO".equals(materialInfo.getType())) {
+                                    url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_UPLOAD;
+
+                                } else if ("IMAGE".equals(materialInfo.getType())) {
+                                    url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.IMAGE_UPLOAD;
+                                    requestJson.put("type", "2");
+                                    requestJson.put("upload_type", "1");
+                                }
+
+                                String result = exceptInfoForRestTemplate(url, 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)) {
+                                            if ("IMAGE".equals(materialInfo.getType())) {
+                                                kuaishouInterfaceService.imageGet(accountId, ctopOauthToken.getAccessToken(), dataJson.getString("image_token"));
+                                            } else if ("VIDEO".equals(materialInfo.getType())) {
+                                                kuaishouInterfaceService.videoGet(accountId, ctopOauthToken.getAccessToken(), dataJson.getString("photo_id"), dataJson.getString("signature"));
+                                            }
+                                        }
+
+                                        log.info("素材同步完成,accountId:{},code:{}", accountId, materialInfo.getCode());
+                                    } else {
+                                        log.error("同步素材失败,返回信息:{},请求参数:{}", resultJson, requestJson);
+                                    }
+                                }
+
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                        }
+                    });
+
+                }
+                /*boolean isTrue = LoadFileUtil.delFile(localUrl);
+                if (isTrue) {
+                    log.info("删除本地缓存素材成功,code:{}", materialInfo.getCode());
+                }*/
+
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+
+
+        }
+
+
+    }
+
+
+
+
+    @Autowired
+    private RestTemplate rest;
+
+    private String exceptInfoForRestTemplate(String url, Map<String, Object> paramMap, Map<String, String> headerMap) throws ParseException {
+        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<MultiValueMap<String, Object>>(param, headers);
+                ResponseEntity<String> responseEntity = rest.exchange(url, HttpMethod.POST, httpEntity, String.class);
+                return responseEntity.getBody();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+}

+ 5 - 13
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java

@@ -2,6 +2,10 @@ 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.FileEntity;
+import cn.com.ctop.common.module.utils.FileUploadTool;
+import cn.com.ctop.common.module.utils.LoadFileUtil;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
@@ -119,24 +123,11 @@ public class KuaiShouController {
     }
 
 
-    @RequestMapping("/video/get")
-    public void videoGet() {
 
-        String accessToken = "360d43b49553684a011d6607322582b1";
-        Long advertiserId = 23212L;
-        String photoId = "5249789805735604135";
-        /*FileUploadTool fileUploadTool = new FileUploadTool();
-        FileEntity entity = new FileEntity();
-
-        entity = fileUploadTool.createFile(multipartFile, request);
-        System.err.println(entity);*/
 
 
-        kuaishouInterfaceService.videoGet(advertiserId, accessToken, photoId);
 
 
-    }
-
     @RequestMapping("/image/get")
     public void imageGet() {
 
@@ -251,4 +242,5 @@ public class KuaiShouController {
         kuaishouInterfaceService.getImageList(accessToken, advertiserId, new Date(), new Date(), 1);
     }
 
+
 }

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.batch.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -29,9 +30,9 @@ public class KuaiShouImageGet {
     /**
      * id
      */
-    @TableId
+    @TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "id")
-    private String id;
+    private Long id;
     /**
      * 账户ID
      */
@@ -68,6 +69,7 @@ public class KuaiShouImageGet {
     @Excel(name = "图片格式", width = 15)
     @ApiModelProperty(value = "图片格式")
     private String format;
+    private String signature;
     /**
      * 图片 token
      */

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

@@ -151,7 +151,7 @@ public interface IKuaishouInterfaceService {
      * @param accessToken
      * @param photoId
      */
-    void videoGet(Long advertiserId, String accessToken, String photoId);
+    void videoGet(Long advertiserId, String accessToken, String photoId, String signature);
 
     /**
      * 获取图片信息

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

@@ -1985,7 +1985,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
      * @param accessToken
      */
     @Override
-    public void videoGet(Long advertiserId, String accessToken, String photoId) {
+    public void videoGet(Long advertiserId, String accessToken, String photoId, String signature) {
         try {
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_GET;
             JSONObject param = new JSONObject();
@@ -2008,12 +2008,15 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                             if (!Check.isNull(dataJson)) {
                                 KuaiShouVideoGet videoGet = new KuaiShouVideoGet();
                                 videoGet.setAccountId(advertiserId);
+                                videoGet.setId(advertiserId + photoId);
                                 videoGet.setWidth(dataJson.getInteger("width"));
                                 videoGet.setHeight(dataJson.getInteger("height"));
                                 videoGet.setUrl(dataJson.getString("url"));
                                 videoGet.setPhotoId(dataJson.getString("photo_id"));
                                 videoGet.setCoverUrl(dataJson.getString("cover_url"));
-                                videoGetMapper.insert(videoGet);
+                                videoGet.setSignature(signature);
+                                kuaiShouVideoGetService.saveOrUpdate(videoGet);
+
                             }
                         }
                     }
@@ -2059,7 +2062,14 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                         imageGet.setHeight(dataJson.getLong("height"));
                         imageGet.setSize(dataJson.getLong("size"));
                         imageGet.setFormat(dataJson.getString("format"));
+                        String signature = dataJson.getString("signature");
+                        imageGet.setSignature(signature);
                         imageGet.setImageToken(dataJson.getString("image_token"));
+                        Map<String, Object> deleteMap = new HashMap<>();
+                        deleteMap.put("account_id", advertiserId);
+                        deleteMap.put("signature", signature);
+                        imageGetMapper.deleteByMap(deleteMap);
+
                         imageGetMapper.insert(imageGet);
                     }
                 } else {
@@ -2157,11 +2167,14 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                 log.error("下载文件到本地文件夹失败,filePath:{},accountId:{}", filePath, advertiserId);
                 throw new Exception("下载文件到本地失败");
             }
+            String signature = LoadFileUtil.getMD5(localUrl);
             Long startTime = System.currentTimeMillis();
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.IMAGE_UPLOAD;
             JSONObject requestJson = new JSONObject();
             requestJson.put("advertiser_id", advertiserId);
+            requestJson.put("signature", signature);
             requestJson.put("type", type);
+            requestJson.put("upload_type", 1);
             Map<String, String> headerMap = new HashMap<String, String>();
             headerMap.put("Content-Type", "multipart/form-data");
             headerMap.put("Access-Token", accessToken);

+ 2 - 8
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java

@@ -24,7 +24,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.gson.Gson;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.io.FileUtils;
-import org.apache.commons.logging.LogFactory;
 import org.apache.fontbox.ttf.CmapSubtable;
 import org.apache.fontbox.ttf.GlyphData;
 import org.apache.fontbox.ttf.TTFParser;
@@ -715,6 +714,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
         }
     }
 
+    @Override
     public void sendPreview(Integer creativeId, String kwid) {
         try {
             List<Cookie> list = HttpUtils2.cookieStore.getCookies();
@@ -744,6 +744,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
         }
     }
 
+    @Override
     public void adekuaishouWebLogin(String phone, String password) throws IOException {
         ChromeDriverService service = new ChromeDriverService.Builder().usingDriverExecutable(new File("D:/chromedriver.exe")).usingAnyFreePort().build();
         service.start();
@@ -818,19 +819,12 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                 clientCookie.setDomain("ad.e.kuaishou.com");
                 clientCookie.setPath(cookieMap.get("path"));
                 HttpUtils2.cookieStore.addCookie(clientCookie);
-//                clientCookie.setDomain("id.kuaishou.com");
-////                HttpUtils2.cookieStore.addCookie(clientCookie);
-////                clientCookie.setDomain("uc.e.kuaishou.com");
-////                HttpUtils2.cookieStore.addCookie(clientCookie);
             }
             String result = HttpUtils2.httpGetRequest("https://uc.e.kuaishou.com/rest/web/login?sid=kuaishou.ad.dsp&followUrl=https%3A%2F%2Fad.e.kuaishou.com%2F%23%2Findex");
             System.out.println(result);
         } catch (Exception e) {
             e.printStackTrace();
         } finally {
-//            webDriver.quit();
-//            service.stop();
-//            HttpUtils.cookieStore.clear();
         }
     }
 

+ 33 - 0
mondule-jbpm/pom.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>jeecg-boot-parent</artifactId>
+        <groupId>org.jeecgframework.boot</groupId>
+        <version>2.0.2</version>
+    </parent>
+    <groupId>cn.com.ctop</groupId>
+    <artifactId>jbpm</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>jbpm</name>
+
+    <properties>
+        <java.version>1.8</java.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>cn.com.ctop</groupId>
+            <artifactId>module-common</artifactId>
+            <version>2.0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.activiti</groupId>
+            <artifactId>activiti-spring</artifactId>
+            <version>6.0.0</version>
+        </dependency>
+    </dependencies>
+
+
+</project>

+ 6 - 1
pom.xml

@@ -76,7 +76,7 @@
         <mybatis-plus.version>3.0.6</mybatis-plus.version>
         <druid.version>1.1.10</druid.version>
         <commons.version>2.6</commons.version>
-        <aliyun-java-sdk-core.version>3.2.3</aliyun-java-sdk-core.version>
+        <aliyun-java-sdk-core.version>3.5.0</aliyun-java-sdk-core.version>
         <aliyun-java-sdk-dysmsapi.version>1.0.0</aliyun-java-sdk-dysmsapi.version>
 
     </properties>
@@ -357,6 +357,11 @@
             <artifactId>aliyun-sdk-oss</artifactId>
             <version>2.8.3</version>
         </dependency>
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>aliyun-java-sdk-mts</artifactId>
+            <version>2.5.2</version>
+        </dependency>
     </dependencies>
 
     <dependencyManagement>