yumeng 3 lat temu
rodzic
commit
90d4159663

+ 14 - 7
pom.xml

@@ -5,7 +5,7 @@
     <modelVersion>4.0.0</modelVersion>
 
     <groupId>cn.com.ctop</groupId>
-    <artifactId>track</artifactId>
+    <artifactId>material-upload</artifactId>
     <version>1.0-SNAPSHOT</version>
     <parent>
         <groupId>org.springframework.boot</groupId>
@@ -22,15 +22,21 @@
         <commons.version>2.6</commons.version>
     </properties>
     <dependencies>
+
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpmime</artifactId>
+            <version>4.5.9</version>
+        </dependency>
+
+       <!-- <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-spring-boot-starter</artifactId>
+            <version>1.4.0</version>
+        </dependency>-->
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
-<!--            <exclusions>-->
-<!--                <exclusion>-->
-<!--                    <groupId>ch.qos.logback</groupId>-->
-<!--                    <artifactId>logback-classic</artifactId>-->
-<!--                </exclusion>-->
-<!--            </exclusions>-->
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
@@ -49,6 +55,7 @@
             <artifactId>commons-io</artifactId>
             <version>${commons.version}</version>
         </dependency>
+
         <dependency>
             <groupId>commons-lang</groupId>
             <artifactId>commons-lang</artifactId>

+ 1 - 1
src/main/java/cn/com/ctop/material/Application.java

@@ -1,4 +1,4 @@
-package cn.com.ctop.track;
+package cn.com.ctop.material;
 
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.boot.SpringApplication;

+ 1 - 3
src/main/java/cn/com/ctop/material/config/MybatisPlusConfig.java

@@ -1,8 +1,6 @@
-package cn.com.ctop.track.config;
+package cn.com.ctop.material.config;
 
-import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
 import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
 @Configuration

+ 8 - 2
src/main/java/cn/com/ctop/material/controller/MaterialUploadTaskController.java

@@ -1,8 +1,9 @@
-package cn.com.ctop.track.controller;
+package cn.com.ctop.material.controller;
 
-import cn.com.ctop.track.service.IMaterialUploadTaskService;
+import cn.com.ctop.material.service.IMaterialUploadTaskService;
 import lombok.extern.slf4j.Slf4j;
 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;
 
@@ -20,5 +21,10 @@ public class MaterialUploadTaskController {
     @Autowired
     private IMaterialUploadTaskService materialUploadTaskService;
 
+    @GetMapping("/uploadMaterial")
+    public String uploadVideo(String signature) {
+        materialUploadTaskService.upload(signature);
+        return "success";
+    }
 
 }

+ 3 - 2
src/main/java/cn/com/ctop/material/entity/MaterialUploadTask.java

@@ -1,4 +1,4 @@
-package cn.com.ctop.track.entity;
+package cn.com.ctop.material.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -70,7 +70,7 @@ public class MaterialUploadTask {
     /**
      * 上传成功时间
      */
-    private Date updateSuccessTime;
+    private Date uploadTime;
     /**
      * updateTime
      */
@@ -79,4 +79,5 @@ public class MaterialUploadTask {
      * createTime
      */
     private Date createTime;
+    private Integer shieldBackwardSwitch;
 }

+ 1 - 1
src/main/java/cn/com/ctop/material/entity/TaskVo.java

@@ -1,4 +1,4 @@
-package cn.com.ctop.track.entity;
+package cn.com.ctop.material.entity;
 
 import java.util.List;
 

+ 1 - 1
src/main/java/cn/com/ctop/material/enums/MaterialEnum.java

@@ -1,4 +1,4 @@
-package cn.com.ctop.common.module.enums;
+package cn.com.ctop.material.enums;
 
 /**
  * 素材类型

+ 9 - 2
src/main/java/cn/com/ctop/material/mapper/MaterialUploadTaskMapper.java

@@ -1,10 +1,11 @@
-package cn.com.ctop.track.mapper;
+package cn.com.ctop.material.mapper;
 
-import cn.com.ctop.track.entity.MaterialUploadTask;
+import cn.com.ctop.material.entity.MaterialUploadTask;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -21,4 +22,10 @@ public interface MaterialUploadTaskMapper extends BaseMapper<MaterialUploadTask>
     String getTokenByAccountId(@Param("accountId") Long accountId);
 
     JSONObject getVideoSize(String signature);
+
+    void updateStatusById(@Param("id") Long id, @Param("taskStatus") Integer taskStatus, @Param("remarks") String remarks, @Param("uploadTime") Date uploadTime);
+
+    void syncBytedance(@Param("signature") String signature);
+
+    void syncKuaishou(@Param("signature") String signature);
 }

+ 21 - 1
src/main/java/cn/com/ctop/material/mapper/xml/MaterialUploadTaskMapper.xml

@@ -1,6 +1,26 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.ctop.track.mapper.MaterialUploadTaskMapper">
+<mapper namespace="cn.com.ctop.material.mapper.MaterialUploadTaskMapper">
+    <update id="updateStatusById">
+        UPDATE ctop_material_upload_task
+        SET task_status = #{taskStatus},
+        remarks = #{remarks},
+        upload_time = #{uploadTime}
+        WHERE
+	    id = #{id}
+    </update>
+    <update id="syncBytedance">
+        UPDATE ctop_material_info
+        SET sync_bytedance = 2
+        WHERE
+	   `code` = #{signature}
+    </update>
+    <update id="syncKuaishou">
+        UPDATE ctop_material_info
+        SET sync_kuaishou = 2
+        WHERE
+	   `code` = #{signature}
+    </update>
 
     <select id="getMediaList" resultType="java.lang.Integer">
         select media_id  from  ctop_material_upload_task

+ 2 - 2
src/main/java/cn/com/ctop/material/service/IMaterialUploadTaskService.java

@@ -1,6 +1,6 @@
-package cn.com.ctop.track.service;
+package cn.com.ctop.material.service;
 
-import cn.com.ctop.track.entity.MaterialUploadTask;
+import cn.com.ctop.material.entity.MaterialUploadTask;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 /**

+ 216 - 59
src/main/java/cn/com/ctop/material/service/impl/MaterialUploadTaskServiceImpl.java

@@ -1,22 +1,46 @@
-package cn.com.ctop.track.service.impl;
+package cn.com.ctop.material.service.impl;
 
-import cn.com.ctop.track.entity.MaterialUploadTask;
-import cn.com.ctop.track.entity.TaskVo;
-import cn.com.ctop.track.mapper.MaterialUploadTaskMapper;
-import cn.com.ctop.track.service.IMaterialUploadTaskService;
-import cn.com.ctop.track.utils.Check;
-import cn.com.ctop.track.utils.LoadFileUtil;
+import cn.com.ctop.material.entity.MaterialUploadTask;
+import cn.com.ctop.material.entity.TaskVo;
+import cn.com.ctop.material.enums.MaterialEnum;
+import cn.com.ctop.material.mapper.MaterialUploadTaskMapper;
+import cn.com.ctop.material.service.IMaterialUploadTaskService;
+import cn.com.ctop.material.utils.Check;
+import cn.com.ctop.material.utils.HttpConstant;
+import cn.com.ctop.material.utils.LoadFileUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
 import org.apache.http.entity.mime.content.FileBody;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
 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.http.client.SimpleClientHttpRequestFactory;
 import org.springframework.stereotype.Service;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestTemplate;
 
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.nio.charset.Charset;
+import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -34,66 +58,66 @@ public class MaterialUploadTaskServiceImpl extends ServiceImpl<MaterialUploadTas
     private MaterialUploadTaskMapper materialUploadTaskMapper;
     // private static String downloadUrl = "/data/file/video/";
     private static String downloadUrl = "D:\\file";
-    private static ExecutorService kuaishouTiaoExecutorService = Executors.newFixedThreadPool(5);
+    private static ExecutorService kuaishouExecutorService = Executors.newFixedThreadPool(5);
+    private static ExecutorService bytedanceExecutorService = Executors.newFixedThreadPool(5);
+    private static ExecutorService submitExecutorService = Executors.newFixedThreadPool(5);
 
     @Override
     public void upload(String signature) {
-        TaskVo taskVo = getTaskList(signature);
-        if (Check.isNull(taskVo)) {
-            log.info("此素材md5未获取到待上传的任务列表");
-            return;
-        }
-        List<MaterialUploadTask> taskList = taskVo.getTaskList();
-        if (Check.isNull(taskList)) {
-            log.info("此素材md5未获取到待上传的任务列表");
-            return;
-        }
-        MaterialUploadTask materialUploadTask = taskList.get(0);
-        String materialUrl = materialUploadTask.getMaterialUrl();
-        String localUrl = LoadFileUtil.downLoadFromUrl(materialUrl, downloadUrl);
-        File file = new File(localUrl);
-        FileSystemResource resource = null;
-        Integer materialType = null;
-        if (!Check.isNull(taskVo.getKuaiShou())) {
-            resource = new FileSystemResource(file);
-
-            JSONObject sizeJson = materialUploadTaskMapper.getVideoSize(signature);
-            if (Check.isNull(sizeJson)) {
-                Integer type = MaterialEnum.getTypeBySize(Integer.valueOf(materialParameter.getWidth()), Integer.valueOf(materialParameter.getHeight()));
-                if (!Check.isNull(type) && type != 0) {
-                    requestJson.put("type", type);
+        submitExecutorService.submit(new Runnable() {
+            @Override
+            public void run() {
+                TaskVo taskVo = getTaskList(signature);
+                if (Check.isNull(taskVo)) {
+                    log.info("此素材md5未获取到待上传的任务列表");
+                    return;
+                }
+                List<MaterialUploadTask> taskList = taskVo.getTaskList();
+                if (Check.isNull(taskList)) {
+                    log.info("此素材md5未获取到待上传的任务列表");
+                    return;
+                }
+                MaterialUploadTask materialUploadTask = taskList.get(0);
+                String materialUrl = materialUploadTask.getMaterialUrl();
+                String localUrl = LoadFileUtil.downLoadFromUrl(materialUrl, downloadUrl);
+                File file = new File(localUrl);
+                FileSystemResource resource = null;
+                Integer materialType = null;
+                if (!Check.isNull(taskVo.getKuaiShou())) {
+                    resource = new FileSystemResource(file);
+                    JSONObject sizeJson = materialUploadTaskMapper.getVideoSize(signature);
+                    if (!Check.isNull(sizeJson)) {
+                        Integer width = sizeJson.getInteger("width");
+                        Integer height = sizeJson.getInteger("height");
+                        Integer type = MaterialEnum.getTypeBySize(width, height);
+                        if (!Check.isNull(type) && type != 0) {
+                            materialType = type;
+                        }
+                    }
+                }
+                FileBody fileBody = null;
+                if (!Check.isNull(taskVo.getBytedance())) {
+                    fileBody = new FileBody(file);
+                }
+                for (MaterialUploadTask task : taskList) {
+                    if (task.getMediaId() == 2 || task.getMediaId() == 4) {
+                        uploadKuaiShou(task, resource, materialType);
+                    } else if (task.getMediaId() == 1 || task.getMediaId() == 3) {
+                        uploadBytedance(fileBody, task);
+                    }
                 }
             }
-
-        }
-        FileBody fileBody = null;
-        if (!Check.isNull(taskVo.getBytedance())) {
-            fileBody = new FileBody(file);
-        }
-
-        for (MaterialUploadTask task : taskList) {
-            if (task.getMediaId() == 2 || task.getMediaId() == 4) {
-                uploadKuaiShou(task, resource);
-
-            } else if (task.getMediaId() == 1 || task.getMediaId() == 3) {
-
-            }
-
-
-        }
-
-
+        });
     }
 
-
-    private void uploadKuaiShou(MaterialUploadTask task, FileSystemResource resource) {
-        kuaishouTiaoExecutorService.submit(new Runnable() {
+    private void uploadKuaiShou(MaterialUploadTask task, FileSystemResource resource, Integer type) {
+        kuaishouExecutorService.submit(new Runnable() {
             @Override
             public void run() {
                 try {
                     Long accountId = task.getAccountId();
                     if (Check.isNull(accountId)) {
-                        log.error("账户不能为空");
+                        log.error("账户不能为空。");
                         return;
                     }
                     String token = materialUploadTaskMapper.getTokenByAccountId(accountId);
@@ -101,16 +125,122 @@ public class MaterialUploadTaskServiceImpl extends ServiceImpl<MaterialUploadTas
                         log.error("此账户id未获取到token,accountId:{}", accountId);
                         return;
                     }
-
-
+                    Map<String, String> headerMap = new HashMap<>();
+                    headerMap.put("Content-Type", "multipart/form-data");
+                    headerMap.put("Access-Token", token);
+                    JSONObject requestJson = new JSONObject();
+                    requestJson.put("file", resource);
+                    requestJson.put("signature", task.getSignature());
+                    if (!Check.isNull(task.getShieldBackwardSwitch())) {
+                        if (task.getShieldBackwardSwitch() == 1) {
+                            requestJson.put("shield_backward_switch", true);
+                        } else {
+                            requestJson.put("shield_backward_switch", false);
+                        }
+                    }
+                    if (!Check.isNull(type)) {
+                        requestJson.put("type", type);
+                    }
+                    requestJson.put("photo_name", task.getMaterialName());
+                    requestJson.put("advertiser_id", accountId);
+                    String url = HttpConstant.VIDEO_UPLOAD;
+                    String result = exceptInfoForRestTemplate(url, requestJson, headerMap);
+                    JSONObject resultJson = JSONObject.parseObject(result);
+                    if (!Check.isNull(resultJson)) {
+                        if (resultJson.getInteger("code") == 0) {
+                            materialUploadTaskMapper.syncKuaishou(task.getSignature());
+                            materialUploadTaskMapper.updateStatusById(task.getId(), 3, "同步成功", new Date());
+                            log.info("快手素材同步完成,accountId:{},code:{},返回信息:{}", accountId, task.getSignature(), resultJson);
+                        } else {
+                            String message = resultJson.getString("message");
+                            materialUploadTaskMapper.updateStatusById(task.getId(), 4, message, new Date());
+                            log.error("快手同步素材失败,返回信息:{},请求参数:{}", resultJson, requestJson);
+                        }
+                    } else {
+                        materialUploadTaskMapper.updateStatusById(task.getId(), 4, "返回结果为空", new Date());
+                    }
                 } catch (Exception e) {
+                    materialUploadTaskMapper.updateStatusById(task.getId(), 4, "接口请求失败", new Date());
                     e.printStackTrace();
                 }
             }
         });
-
     }
 
+    private void uploadBytedance(FileBody fileBody, MaterialUploadTask task) {
+        bytedanceExecutorService.submit(new Runnable() {
+            @Override
+            public void run() {
+                Long accountId = task.getAccountId();
+                if (Check.isNull(accountId)) {
+                    log.error("账户不能为空");
+                    return;
+                }
+                String token = materialUploadTaskMapper.getTokenByAccountId(accountId);
+                if (Check.isNull(token)) {
+                    log.error("此账户id未获取到token,accountId:{}", accountId);
+                    return;
+                }
+                String url = HttpConstant.BYTEDANCE_VIDEO_UPLOAD;
+                CloseableHttpResponse response = null;
+                CloseableHttpClient client = null;
+                // 构造请求
+                HttpPost httpPost = new HttpPost(url);
+                httpPost.setHeader("Access-Token", token);
+                // 文件参数
+                try {
+                    MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create()
+                            .addPart("video_file", fileBody);
+                    // 其他参数
+                    entityBuilder.addTextBody("advertiser_id", String.valueOf(task.getAccountId()));
+                    entityBuilder.addTextBody("video_signature", task.getSignature());
+                    entityBuilder.addTextBody("filename", task.getMaterialName(), ContentType.create("text/plain", Charset.forName("UTF-8")));
+                    org.apache.http.HttpEntity entity = entityBuilder.build();
+                    client = HttpClientBuilder.create().build();
+                    httpPost.setURI(URI.create(url));
+                    httpPost.setEntity(entity);
+                    response = client.execute(httpPost);
+                    if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                        StringBuilder result = new StringBuilder();
+                        String line = "";
+                        while ((line = bufferedReader.readLine()) != null) {
+                            result.append(line);
+                        }
+                        bufferedReader.close();
+                        JSONObject resultJson = JSONObject.parseObject(result.toString());
+                        if (!Check.isNull(resultJson)) {
+                            if (resultJson.getInteger("code") == 0) {
+                                materialUploadTaskMapper.updateStatusById(task.getId(), 3, "同步成功", new Date());
+                                materialUploadTaskMapper.syncBytedance(task.getSignature());
+                                log.info("头条素材同步完成,accountId:{},code:{},返回信息:{}", accountId, task.getSignature(), resultJson);
+                            } else {
+                                String message = resultJson.getString("message");
+                                materialUploadTaskMapper.updateStatusById(task.getId(), 4, message, new Date());
+                                log.error("头条同步步素材失败,返回信息:{}", resultJson);
+                            }
+                        }
+                    } else {
+                        materialUploadTaskMapper.updateStatusById(task.getId(), 4, "返回结果为空", new Date());
+                    }
+                } catch (Exception e) {
+                    log.error(e.getMessage(), e);
+                    materialUploadTaskMapper.updateStatusById(task.getId(), 4, "接口请求失败", new Date());
+                } finally {
+                    try {
+                        if (response != null) {
+                            response.close();
+                        }
+                        if (null != client) {
+                            client.close();
+                        }
+                    } catch (IOException e) {
+                        log.error(e.getMessage(), e);
+                    }
+                }
+            }
+        });
+    }
 
     private TaskVo getTaskList(String signature) {
         TaskVo taskVo = new TaskVo();
@@ -135,5 +265,32 @@ public class MaterialUploadTaskServiceImpl extends ServiceImpl<MaterialUploadTas
         return taskVo;
     }
 
-
+    private String exceptInfoForRestTemplate(String url, Map<String, Object> paramMap, Map<String, String> headerMap) {
+        try {
+            long l = System.currentTimeMillis();
+            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));
+                    }
+                }
+                SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
+                requestFactory.setConnectTimeout(1000 * 500);// 设置超时
+                requestFactory.setReadTimeout(1000 * 500);
+                RestTemplate rest = new RestTemplate(requestFactory);
+                HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(param, headers);
+                ResponseEntity<String> responseEntity = rest.exchange(url, HttpMethod.POST, httpEntity, String.class);
+                log.info("上传素材时间:{} s ,账户:{}。code:{}", (System.currentTimeMillis() - l) / 1000, paramMap.get("advertiser_id"), paramMap.get("signature"));
+                return responseEntity.getBody();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
 }

+ 1 - 100
src/main/java/cn/com/ctop/material/utils/AesEncryptUtil.java

@@ -1,10 +1,6 @@
-package cn.com.ctop.track.utils;
+package cn.com.ctop.material.utils;
 
-import org.apache.shiro.codec.Base64;
 
-import javax.crypto.Cipher;
-import javax.crypto.spec.IvParameterSpec;
-import javax.crypto.spec.SecretKeySpec;
 import java.io.UnsupportedEncodingException;
 
 /**
@@ -12,101 +8,6 @@ import java.io.UnsupportedEncodingException;
  */
 public class AesEncryptUtil {
 
-    //使用AES-128-CBC加密模式,key需要为16位,key和iv可以相同!
-    private static String KEY = EncryptedString.key;
-    private static String IV = EncryptedString.iv;
-
-    /**
-     * 加密方法
-     *
-     * @param data 要加密的数据
-     * @param key  加密key
-     * @param iv   加密iv
-     * @return 加密的结果
-     * @throws Exception
-     */
-    public static String encrypt(String data, String key, String iv) {
-        try {
-
-            Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");//"算法/模式/补码方式"NoPadding PkcsPadding
-            int blockSize = cipher.getBlockSize();
-
-            byte[] dataBytes = data.getBytes();
-            int plaintextLength = dataBytes.length;
-            if (plaintextLength % blockSize != 0) {
-                plaintextLength = plaintextLength + (blockSize - (plaintextLength % blockSize));
-            }
-
-            byte[] plaintext = new byte[plaintextLength];
-            System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length);
-
-            SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
-            IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes());
-
-            cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
-            byte[] encrypted = cipher.doFinal(plaintext);
-
-            return Base64.encodeToString(encrypted);
-
-        } catch (Exception e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
-
-    /**
-     * 解密方法
-     *
-     * @param data 要解密的数据
-     * @param key  解密key
-     * @param iv   解密iv
-     * @return 解密的结果
-     * @throws Exception
-     */
-    public static String desEncrypt(String data, String key, String iv) {
-        try {
-            byte[] encrypted1 = Base64.decode(data);
-
-            Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
-            SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
-            IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes());
-
-            cipher.init(Cipher.DECRYPT_MODE, keyspec, ivspec);
-
-            byte[] original = cipher.doFinal(encrypted1);
-            String originalString = new String(original);
-            return originalString;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return null;
-        }
-    }
-
-    private AesEncryptUtil() {
-    }
-
-    /**
-     * 使用默认的key和iv加密
-     *
-     * @param data
-     * @return
-     * @throws Exception
-     */
-    public static String encrypt(String data) {
-        return encrypt(data, EncryptedString.key, EncryptedString.iv);
-    }
-
-    /**
-     * 使用默认的key和iv解密
-     *
-     * @param data
-     * @return
-     */
-    public static String desEncrypt(String data) {
-        return desEncrypt(data, EncryptedString.key, EncryptedString.iv);
-    }
-
-
     public static String getUrlDecoderString(String str) {
         String result = "";
         if (null == str) {

+ 1 - 1
src/main/java/cn/com/ctop/material/utils/Check.java

@@ -1,4 +1,4 @@
-package cn.com.ctop.track.utils;
+package cn.com.ctop.material.utils;
 
 import com.alibaba.fastjson.JSONArray;
 import lombok.extern.slf4j.Slf4j;

+ 1 - 1
src/main/java/cn/com/ctop/material/utils/EncryptedString.java

@@ -1,4 +1,4 @@
-package cn.com.ctop.track.utils;
+package cn.com.ctop.material.utils;
 
 
 import lombok.Data;

+ 4 - 364
src/main/java/cn/com/ctop/material/utils/HttpConstant.java

@@ -1,370 +1,10 @@
-package cn.com.ctop.common.module.utils;
+package cn.com.ctop.material.utils;
 
 /**
  * 2019年9月9日13:21:39
  */
-public class KuaishouInterfaceConstant {
-    public static final String AUTH_PATH = "/openapi/oauth";
-    public static final String AUTH_TOKEN = "/rest/openapi/oauth2/authorize/access_token";
-    public static final String REFRESH_TOKEN = "/rest/openapi/oauth2/authorize/refresh_token";
-    /**
-     * 广告主报表数据
-     */
-    public static final String ACCOUNT_REPORT = "/rest/openapi/v1/report/account_report";
-    /**
-     * 广告主报表数据
-     */
-    public static final String VIDEO_LIST = "/rest/openapi/v1/file/ad/video/list";
-    /**
-     * 广告计划报表数据
-     */
-    public static final String CAMPAIGN_REPORT = "/rest/openapi/v1/report/campaign_report";
-    /**
-     * 程序化2.0创意
-     */
-    public static final String PROGRAM_LIST = "/rest/openapi/v2/creative/advanced/program/list";
-    /**
-     * 广告组报表数据
-     */
-    public static final String GTOUP_REPORT = "/rest/openapi/v1/report/unit_report";
-    /**
-     * 广告创意报表数据
-     */
-    public static final String CREATIVE_REPORT = "/rest/openapi/v1/report/creative_report";
-    /**
-     * 广告计划信息
-     */
-    public static final String CAMPAIGN_LIST = "/rest/openapi/v1/campaign/list";
-    /**
-     * 广告组信息
-     */
-    public static final String GROUP_LIST = "/rest/openapi/v1/ad_unit/list";
-    /**
-     * 创意信息
-     */
-    public static final String CREATIVE_LIST = "/rest/openapi/v1/creative/list";
-    /**
-     * 创建广告计划
-     */
-    public static final String CAMPAIGN_CREATE = "/rest/openapi/v2/campaign/create";
-    /**
-     * 创建广告组
-     */
-    public static final String AD_UNIT_CREATE = "/rest/openapi/v2/ad_unit/create";
-    /**
-     * 创建广告创意
-     */
-    public static final String AD_CREATIVE_CREATE = "/rest/openapi/v2/creative/create";
-    /**
-     * 程序化创意 2.0
-     */
-    public static final String PROGRAM_CREATE = "/rest/openapi/v2/creative/advanced/program/create";
-    /**
-     * 获取可选的深度转化类型
-     */
-    public static final String DEEP_CONVERSION_INFOS = "/rest/openapi/v1/ad_unit/ocpc/conversion_infos";
-    /**
-     * 视频文件上传
-     */
-    public static final String VIDEO_UPLOAD = "/rest/openapi/v2/file/ad/video/upload";
-    /**
-     * 视频文件获取
-     */
-    public static final String VIDEO_GET = "/rest/openapi/v1/file/ad/video/get";
-    /**
-     * 图片文件获取
-     */
-    public static final String IMAGE_GET = "/rest/openapi/v1/file/ad/image/get";
-    /**
-     * 获取慕模列表
-     */
-    public static final String TEMPLATE_LIST = "/rest/openapi/v1/target/template/list";
-    /**
-     * 创建定向模板
-     */
-    public static final String TEMPLATE_CREATE = "/rest/openapi/v1/target/template/create";
-
-    public static final String TEMPLATE_UPDATE = "/rest/openapi/v1/target/template/update";
-
-    /**
-     * 删除定向模板
-     */
-    public static final String TEMPLATE_DELETE = "/rest/openapi/v1/target/template/delete";
-    /**
-     * 获取行为与兴趣"类目"
-     */
-    public static final String BEHAVIOR_INTEREST = "/rest/openapi/v1/tool/label/behavior_interest";
-
-    /**
-     * 获取行为兴趣"关键词"
-     */
-    public static final String KEYWORD_QUERY = "/rest/openapi/v1/tool/keyword/query";
-
-    /**
-     * 获取地域信息
-     */
-    public static final String REGION_LIST = "/rest/openapi/v1/region/list";
-    /**
-     * 图片文件上传
-     */
-    public static final String IMAGE_UPLOAD = "/rest/openapi/v2/file/ad/image/upload";
-    /**
-     * 创建应用
-     */
-    public static final String APP_CREATE = "/rest/openapi/v1/file/ad/app/create";
-    /**
-     * 创建应用
-     */
-    public static final String APP_UPDATE = "/rest/openapi/v1/file/ad/app/update";
-    /**
-     * 创建广告获取应用列表
-     */
-    public static final String APP_LIST = "/rest/openapi/v1/file/ad/app/list";
-    /**
-     * 创建广告获取应用列表(新版本)
-     */
-    public static final String APP_LIST_v2 = "/rest/openapi/v2/file/ad/app/list";
-    /**
-     * 获取app名称
-     */
-    public static final String APP_NAME = "/rest/openapi/v1/tool/keyword/query";
-
-    /**
-     * 账户日预算查询
-     */
-    public static final String ACCOUNT_BUDGET = "/rest/openapi/v1/advertiser/budget/get";
-
-
-    /**
-     * 获取账户余额
-     */
-    public static final String FUND_GET = "/rest/openapi/v1/advertiser/fund/get";
-
-    /**
-     * 获取账户流水数据
-     */
-    public static final String DAILY_FLOWS = "/rest/openapi/v1/advertiser/fund/daily_flows";
-
-    /**
-     * 上传人群接口
-     */
-    public static final String POPULATION_UPLOAD = "/rest/openapi/v1/dmp/population/upload";
-    /**
-     * 获取人群包接口
-     */
-    public static final String POPULATION_LIST = "/rest/openapi/v2/dmp/population/list";
-
-    /**
-     * 删除人群包接口
-     */
-    public static final String POPULATION_DELETE = "/rest/openapi/v1/dmp/population/delete";
-
-    /**
-     * 推送人群包接口
-     */
-    public static final String POPULATION_PUSH = "/rest/openapi/v1/dmp/population/push";
-
-    /**
-     * 跨账户人群包推送接口
-     */
-    public static final String POPULATION_PUSH_ACCOUNTS = "/rest/openapi/v1/dmp/population/accounts/push";
-
-    /**
-     * 游戏精选标签创建
-     * 获取游戏精选标签所有接口类型
-     */
-    public static final String POPULATION_GAME_TAG_LIST = "https://ad.e.kuaishou.com/rest/openapi/v1/dmp/population/paid/game_select_type/list";
-
-    /**
-     * 游戏精选标签人群包
-     * 游戏精选标签创建
-     */
-    public static final String POPULATION_GAME_TAG_CREATE = "/rest/openapi/v1/dmp/population/paid/game_select_tag/create";
-
-    /**
-     * DMP更新人群包接口
-     */
-    public static final String POPULATION_UPDATE = "/rest/openapi/v1/dmp/population/update";
-
-    /**
-     * 获取人群预估数量
-     */
-    public static final String POPULATION_PREDICTION = "/rest/openapi/v1/tool/audience/prediction";
-
-    /**
-     * 获取可选的应用定向
-     */
-    public static final String APP_SEARCH = "/rest/openapi/v1/tool/app/search";
-
-    /**
-     * 获取可选的应用定向
-     */
-    public static final String CONVERT_LIST = "/rest/openapi/v1/tool/convert/list";
-
-    /**
-     * 获取可选的动态词包
-     */
-    public static final String CREATIVE_WORD = "/rest/openapi/v1/tool/creative_word/list";
-    public static final String ACTION_BAR_TEXT_LIST = "/rest/openapi/v1/creative/action_bar_text/list";
-
-
-    /**
-     * 获取定向标签
-     */
-    public static final String TARGETING_TAGS = "/rest/openapi/v1/tool/targeting_tags/list";
-
-
-    /**
-     * 修改广告计划预算
-     */
-    public static final String UPDATE_CAMPAIGN_BUDGET = "/rest/openapi/v2/campaign/update";
-
-    /**
-     * 修改广告组预算
-     */
-    public static final String UPDATE_UNIT_BUDGET = "/rest/openapi/v1/ad_unit/update/day_budget";
-
-
-    /**
-     * 修改广告组出价
-     */
-    public static final String UPDATE_UNIT_BID = "/rest/openapi/v1/ad_unit/update/bid";
-
-
-    /**
-     * 修改广告计划状态
-     */
-    public static final String UPDATE_CAMPAIGN_STATUS = "/rest/openapi/v1/campaign/update/status";
-
-    /**
-     * 修改广告计划
-     */
-    public static final String UPDATE_CAMPAIGN = "/rest/openapi/v2/campaign/update";
-
-
-    /**
-     * 修改广告组
-     */
-    public static final String UPDATE_UNIT = "/rest/openapi/v2/ad_unit/update";
-
-    /**
-     * 修改广告组状态
-     */
-    public static final String UPDATE_UNIT_STATUS = "/rest/openapi/v1/ad_unit/update/status";
-
-    /**
-     * 修改广告创意状态
-     */
-    public static final String UPDATE_CREATIVE_STATUS = "/rest/openapi/v1/creative/update/status";
-    /**
-     * 快手-广告主信息
-     */
-    public static final String ADVERTISER_INFO = "/rest/openapi/v1/advertiser/info";
-
-
-    /**
-     * 修改广告创意
-     */
-    public static final String UPDATE_CREATIVE = "/rest/openapi/v2/creative/update";
-
-    /**
-     * 快手-查询图片列表
-     */
-    public static final String IMAGE_LIST = "/rest/openapi/v1/file/ad/image/list";
-
-
-    /**
-     * 历史数据查询任务
-     */
-    public static final String ASYNC_TASK_CREAT = "/rest/openapi/v1/async_task/create";
-    /**
-     * 获取任务列表
-     */
-    public static final String ASYNC_TASK_LIST = "/rest/openapi/v1/async_task/list";
-
-    /**
-     * 下载数据
-     */
-    public static final String ASYNC_TASK_DOWNLOAD = "/rest/openapi/v1/async_task/download";
-
-    /**
-     * 落地页查询
-     */
-    public static final String PAGE_LIST = "/rest/openapi/v2/lp/page/list";
-
-    /**
-     * 获取操作记录
-     */
-    public static final String OPERATION_RECORD = "/rest/openapi/v1/tool/operation_record/list";
-
-
-    /**
-     * 登录
-     */
-    public static final String TYPE_LOGIN = "login";
-    /**
-     * 授权
-     */
-    public static final String TYPE_AUTHORIZATION = "authorization";
-    /**
-     * 登录方式-快手
-     */
-    public static final String LOGIN_TYPE_KUAISHOU = "kuaishou";
-    /**
-     * 登录方式-快手
-     */
-    public static final String LOGIN_TYPE_BYTEDANCE = "bytedance";
-    /**
-     * 请求前缀
-     */
-    public static final String HTTPS_PREFIX = "https:";
-    /**
-     * 评论列表数据查询接口
-     */
-    public static final String COMMENT_LIST = "/rest/openapi/v1/comment/list";
-    /**
-     * 批量回复评论接口
-     */
-    public static final String COMMENT_REPLY = "/rest/openapi/v1/comment/reply";
-    /**
-     * 回复评论接口
-     */
-    public static final String COMMENT_TREE = "/rest/openapi/v1/comment/tree";
-    /**
-     * 屏蔽评论接口
-     */
-    public static final String COMMENT_SHIELD = "/rest/openapi/v1/comment/shield";
-    /**
-     * 人群分析报表
-     */
-    public static final String AUDIENCE_REPORT = "/rest/openapi/v1/report/audience_report";
-    /**
-     * 视频库-推送视频
-     */
-    public static final String VIDEO_SHARE = "/rest/openapi/v1/file/ad/video/share";
-    /**
-     * 频库-视频关联创意数查询
-     */
-    public static final String VIDEO_RELATE_CREATIVES = "/rest/openapi/v1/file/ad/video/relate/creatives";
-    /**
-     * 查询加速探索信息接口
-     */
-    public static final String UNIT_EXPLORE_INFO_GET = "/rest/openapi/v1/ad_unit/explore/info/get";
-    /**
-     * 广告组的加速探索预算设置
-     */
-    public static final String UNIT_EXPLORE_BUDGET_UPDATE = "/rest/openapi/v1/ad_unit/explore/budget/update";
-    /**
-     * 暂停广告组的加速探索预算
-     */
-    public static final String UNIT_EXPLORE_STATUS_PAUSE = "/rest/openapi/v1/ad_unit/explore/status/pause";
-    /**
-     * 查询广告组的加速探索报表接口
-     */
-    public static final String QUERY_SPEED_EXPLORE_REPORT = "/rest/openapi/v1/report/speed_explore";
-  /**
-     * 辅助探索
-     */
-    public static final String AD_UNIT_EXPLORE_SUPPORT = "/rest/openapi/v1/ad_unit/explore/support";
+public class HttpConstant {
+    public static final String VIDEO_UPLOAD = "https://ad.e.kuaishou.com/rest/openapi/v2/file/ad/video/upload";
+    public static final String BYTEDANCE_VIDEO_UPLOAD = "https://ad.oceanengine.com/open_api/2/file/video/ad/";
 
 }

+ 1 - 3
src/main/java/cn/com/ctop/material/utils/HttpUtils.java

@@ -1,4 +1,4 @@
-package cn.com.ctop.track.utils;
+package cn.com.ctop.material.utils;
 
 import com.alibaba.fastjson.JSONObject;
 import com.google.gson.Gson;
@@ -35,8 +35,6 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
-import java.net.URL;
-import java.net.URLConnection;
 import java.net.URLEncoder;
 import java.nio.charset.Charset;
 import java.security.cert.CertificateException;

+ 1 - 1
src/main/java/cn/com/ctop/material/utils/LoadFileUtil.java

@@ -1,4 +1,4 @@
-package cn.com.ctop.track.utils;
+package cn.com.ctop.material.utils;
 
 import org.apache.commons.codec.digest.DigestUtils;
 

+ 3 - 3
src/main/resources/application.yml

@@ -1,5 +1,5 @@
 server:
-  port: 8803
+  port: 8910
   ip: 127.0.0.1
   servlet:
     context-path: /
@@ -80,7 +80,7 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://172.30.0.4:3390/track?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true
+          url: jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true
           username: hcst
           password: hcst@2020
           driver-class-name: com.mysql.jdbc.Driver
@@ -92,7 +92,7 @@ spring:
 #          driver-class-name: com.mysql.jdbc.Driver
 #mybatis plus 设置
 mybatis-plus:
-  mapper-locations: classpath*:classpath*:cn/com/ctop/**/xml/*Mapper.xml
+  mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml,classpath*:cn/com/ctop/**/xml/*Mapper.xml
   global-config:
     # 关闭MP3.0自带的banner
     banner: false