yumeng преди 3 години
родител
ревизия
6761435873
променени са 30 файла, в които са добавени 1217 реда и са изтрити 486 реда
  1. 0 0
      README.md
  2. 2 1
      src/main/java/cn/com/ctop/track/Application.java
  3. 0 0
      src/main/java/cn/com/ctop/material/config/MybatisPlusConfig.java
  4. 24 0
      src/main/java/cn/com/ctop/material/controller/MaterialUploadTaskController.java
  5. 82 0
      src/main/java/cn/com/ctop/material/entity/MaterialUploadTask.java
  6. 42 0
      src/main/java/cn/com/ctop/material/entity/TaskVo.java
  7. 108 0
      src/main/java/cn/com/ctop/material/enums/MaterialEnum.java
  8. 24 0
      src/main/java/cn/com/ctop/material/mapper/MaterialUploadTaskMapper.java
  9. 30 0
      src/main/java/cn/com/ctop/material/mapper/xml/MaterialUploadTaskMapper.xml
  10. 16 0
      src/main/java/cn/com/ctop/material/service/IMaterialUploadTaskService.java
  11. 139 0
      src/main/java/cn/com/ctop/material/service/impl/MaterialUploadTaskServiceImpl.java
  12. 122 0
      src/main/java/cn/com/ctop/material/utils/AesEncryptUtil.java
  13. 57 0
      src/main/java/cn/com/ctop/material/utils/Check.java
  14. 12 0
      src/main/java/cn/com/ctop/material/utils/EncryptedString.java
  15. 370 0
      src/main/java/cn/com/ctop/material/utils/HttpConstant.java
  16. 0 0
      src/main/java/cn/com/ctop/material/utils/HttpUtils.java
  17. 189 0
      src/main/java/cn/com/ctop/material/utils/LoadFileUtil.java
  18. 0 269
      src/main/java/cn/com/ctop/track/controller/TrackController.java
  19. 0 31
      src/main/java/cn/com/ctop/track/entity/ClickInfo.java
  20. 0 37
      src/main/java/cn/com/ctop/track/entity/ConvertInfo.java
  21. 0 26
      src/main/java/cn/com/ctop/track/entity/TaobaoNotice.java
  22. 0 8
      src/main/java/cn/com/ctop/track/mapper/ClickInfoMapper.java
  23. 0 7
      src/main/java/cn/com/ctop/track/mapper/ConvertInfoMapper.java
  24. 0 8
      src/main/java/cn/com/ctop/track/mapper/TaobaoNoticeMapper.java
  25. 0 7
      src/main/java/cn/com/ctop/track/service/ClickInfoService.java
  26. 0 7
      src/main/java/cn/com/ctop/track/service/ConvertInfoService.java
  27. 0 8
      src/main/java/cn/com/ctop/track/service/TaobaoNoticeService.java
  28. 0 11
      src/main/java/cn/com/ctop/track/service/impl/ClickInfoServiceImpl.java
  29. 0 11
      src/main/java/cn/com/ctop/track/service/impl/ConvertInfoServiceImpl.java
  30. 0 55
      src/main/java/cn/com/ctop/track/service/impl/TaobaoNoticeServiceImpl.java

+ 0 - 0
README.md


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

@@ -10,6 +10,7 @@ import org.springframework.core.env.Environment;
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
+
 @Slf4j
 @SpringBootApplication
 @ComponentScan(basePackages = {"cn.com.ctop"})
@@ -22,7 +23,7 @@ public class Application {
         String port = env.getProperty("server.port");
         String path = env.getProperty("server.servlet.context-path");
         log.info("\n----------------------------------------------------------\n\t" +
-                "track service is running\n\t" +
+                "material-upload service is running\n\t" +
                 "----------------------------------------------------------");
     }
 }

src/main/java/cn/com/ctop/track/config/MybatisPlusConfig.java → src/main/java/cn/com/ctop/material/config/MybatisPlusConfig.java


+ 24 - 0
src/main/java/cn/com/ctop/material/controller/MaterialUploadTaskController.java

@@ -0,0 +1,24 @@
+package cn.com.ctop.track.controller;
+
+import cn.com.ctop.track.service.IMaterialUploadTaskService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 同步素材任务
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-10-21
+ */
+@Slf4j
+@RestController
+@RequestMapping("/material/materialUploadTask")
+public class MaterialUploadTaskController {
+    @Autowired
+    private IMaterialUploadTaskService materialUploadTaskService;
+
+
+}

+ 82 - 0
src/main/java/cn/com/ctop/material/entity/MaterialUploadTask.java

@@ -0,0 +1,82 @@
+package cn.com.ctop.track.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * 同步素材任务
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-10-21
+ */
+@Data
+@TableName("ctop_material_upload_task")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class MaterialUploadTask {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.UUID)
+    private Long id;
+    /**
+     * 媒体
+     */
+    private Integer mediaId;
+    /**
+     * 素材md5
+     */
+    private String signature;
+    /**
+     * 账户id
+     */
+    private Long accountId;
+    /**
+     * 快手账户id
+     */
+    private Long kuaishouUserId;
+    /**
+     * 上传人id
+     */
+    private String userId;
+    /**
+     * 上传人姓名
+     */
+    private String userName;
+    /**
+     * 素材名称
+     */
+    private String materialName;
+    /**
+     * 素材链接
+     */
+    private String materialUrl;
+    /**
+     * 上传状态
+     */
+    private Integer taskStatus;
+    /**
+     * remarks
+     */
+    private String remarks;
+    /**
+     * 上传成功时间
+     */
+    private Date updateSuccessTime;
+    /**
+     * updateTime
+     */
+    private Date updateTime;
+    /**
+     * createTime
+     */
+    private Date createTime;
+}

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

@@ -0,0 +1,42 @@
+package cn.com.ctop.track.entity;
+
+import java.util.List;
+
+public class TaskVo {
+    private List<MaterialUploadTask> taskList;
+    private Integer kuaiShou;
+    private Integer bytedance;
+
+    public List<MaterialUploadTask> getTaskList() {
+        return taskList;
+    }
+
+    public void setTaskList(List<MaterialUploadTask> taskList) {
+        this.taskList = taskList;
+    }
+
+    public Integer getKuaiShou() {
+        return kuaiShou;
+    }
+
+    public void setKuaiShou(Integer kuaiShou) {
+        this.kuaiShou = kuaiShou;
+    }
+
+    public Integer getBytedance() {
+        return bytedance;
+    }
+
+    public void setBytedance(Integer bytedance) {
+        this.bytedance = bytedance;
+    }
+
+    @Override
+    public String toString() {
+        return "TaskVo{" +
+                "taskList=" + taskList +
+                ", kuaiShou=" + kuaiShou +
+                ", bytedance=" + bytedance +
+                '}';
+    }
+}

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

@@ -0,0 +1,108 @@
+package cn.com.ctop.common.module.enums;
+
+/**
+ * 素材类型
+ */
+public enum MaterialEnum {
+
+
+    VerticalVideoSmall(1, 720, 1280),
+    VerticalVideo787Small(1, 787, 1280),
+    VerticalVideo846Small(1, 846, 1536),
+    VerticalVideo1080mall(1, 1080, 2200),
+    VerticalVideoBig(1, 1080, 1920),
+    VerticalVideo360(1, 360, 640),
+    VerticalVideo362(1, 362, 640),
+    VerticalVideo368(1, 368, 490),
+    VerticalVideo363(1, 363, 640),
+    VerticalVideo438(1, 438, 640),
+    VerticalVideo480(1, 480, 640),
+    VerticalVideo525(1, 525, 640),
+    VerticalVideo540(1, 540, 960),
+    VerticalVideo544(1, 544, 726),
+    VerticalVideo590(1, 590, 1280),
+    VerticalVideo694(1, 694, 1236),
+    VerticalVideo704(1, 704, 1252),
+    VerticalVideo710(1, 710, 1264),
+    VerticalVideo714(1, 714, 1270),
+    VerticalVideo716(1, 716, 1276),
+    VerticalVideo718(1, 718, 1278),
+    VerticalVideo719(1, 719, 1170),
+    VerticalVideo720(1, 720, 960),
+    VerticalVideo750(1, 750, 1334),
+    VerticalVideo787(1, 787, 1280),
+    VerticalVideo864(1, 864, 1536),
+    VerticalVideo1088(1, 1088, 1920),
+    VerticalVideo1181(1, 1181, 1920),
+    VerticalVideo1216(1, 1216, 2160),
+    VerticalVideo1296(1, 1296, 2304),
+    VerticalVideo1440(1, 1440, 2560),
+    VerticalVideo2160(1, 2160, 3840),
+    HorizontalVideoSmall(2, 1280, 720),
+    HorizontalVideoBig(2, 1920, 1080),
+    HorizontalVideo640(2, 640, 368),
+    HorizontalVideo1281(2, 1281, 720),
+    HorizontalVideo1400(2, 1400, 720),
+    HorizontalVideo1700(2, 1700, 1080),
+    HorizontalVideo1902(2, 1902, 1080),
+    HorizontalVideo1920(2, 1920, 1080),
+    BianlitieImageBig(4, 540, 540),
+    BianLitieImageSmall(4, 450, 450);
+
+    private Integer type;
+    private Integer width;
+    private Integer height;
+
+
+    private MaterialEnum(Integer type, Integer width, Integer height) {
+        this.type = type;
+        this.width = width;
+        this.height = height;
+    }
+
+    public static Integer getTypeBySize(Integer widthStr, Integer heightStr) {
+        for (MaterialEnum material : MaterialEnum.values()) {
+            Integer width = material.getWidth();
+            Integer height = material.getHeight();
+            if (widthStr.equals(width) && heightStr.equals(height)) {
+                return material.getType();
+            }
+        }
+
+        return 1;
+    }
+
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Integer getWidth() {
+        return width;
+    }
+
+    public void setWidth(Integer width) {
+        this.width = width;
+    }
+
+    public Integer getHeight() {
+        return height;
+    }
+
+    public void setHeight(Integer height) {
+        this.height = height;
+    }
+
+    @Override
+    public String toString() {
+        return "MaterialEnum{" +
+                "type=" + type +
+                ", width=" + width +
+                ", height=" + height +
+                '}';
+    }
+}

+ 24 - 0
src/main/java/cn/com/ctop/material/mapper/MaterialUploadTaskMapper.java

@@ -0,0 +1,24 @@
+package cn.com.ctop.track.mapper;
+
+import cn.com.ctop.track.entity.MaterialUploadTask;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 同步素材任务
+ *
+ * @author jeecg-boot
+ * 2021-10-21
+ * @version V1.0
+ */
+public interface MaterialUploadTaskMapper extends BaseMapper<MaterialUploadTask> {
+
+    List<Integer> getMediaList(@Param("signature") String signature);
+
+    String getTokenByAccountId(@Param("accountId") Long accountId);
+
+    JSONObject getVideoSize(String signature);
+}

+ 30 - 0
src/main/java/cn/com/ctop/material/mapper/xml/MaterialUploadTaskMapper.xml

@@ -0,0 +1,30 @@
+<?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">
+
+    <select id="getMediaList" resultType="java.lang.Integer">
+        select media_id  from  ctop_material_upload_task
+        WHERE signature = #{signature}
+        AND task_status = 1
+        GROUP BY media_id
+    </select>
+    <select id="getTokenByAccountId" resultType="java.lang.String">
+        SELECT
+	    access_token
+        FROM
+	    ctop_oauth_token
+        WHERE
+	    account_id = #{accountId}
+    </select>
+    <select id="getVideoSize" resultType="com.alibaba.fastjson.JSONObject">
+    SELECT
+	width,
+	height
+    FROM
+	ctop_material_parameter
+    WHERE
+	material_id = #{signature}
+	limit 1
+
+    </select>
+</mapper>

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

@@ -0,0 +1,16 @@
+package cn.com.ctop.track.service;
+
+import cn.com.ctop.track.entity.MaterialUploadTask;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 同步素材任务
+ *
+ * @author jeecg-boot
+ * 2021-10-21
+ * @version V1.0
+ */
+public interface IMaterialUploadTaskService extends IService<MaterialUploadTask> {
+    void upload(String signature);
+
+}

+ 139 - 0
src/main/java/cn/com/ctop/material/service/impl/MaterialUploadTaskServiceImpl.java

@@ -0,0 +1,139 @@
+package cn.com.ctop.track.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 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.entity.mime.content.FileBody;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 同步素材任务
+ *
+ * @author jeecg-boot
+ * 2021-10-21
+ * @version V1.0
+ */
+@Service
+@Slf4j
+public class MaterialUploadTaskServiceImpl extends ServiceImpl<MaterialUploadTaskMapper, MaterialUploadTask> implements IMaterialUploadTaskService {
+    @Autowired
+    private MaterialUploadTaskMapper materialUploadTaskMapper;
+    // private static String downloadUrl = "/data/file/video/";
+    private static String downloadUrl = "D:\\file";
+    private static ExecutorService kuaishouTiaoExecutorService = 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);
+                }
+            }
+
+        }
+        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() {
+            @Override
+            public void run() {
+                try {
+                    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;
+                    }
+
+
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        });
+
+    }
+
+
+    private TaskVo getTaskList(String signature) {
+        TaskVo taskVo = new TaskVo();
+        QueryWrapper<MaterialUploadTask> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("signature", signature);
+        queryWrapper.eq("task_status", 1);
+        List<MaterialUploadTask> materialUploadTasks = materialUploadTaskMapper.selectList(queryWrapper);
+        if (Check.isNull(materialUploadTasks)) {
+            return null;
+        }
+        taskVo.setTaskList(materialUploadTasks);
+        List<Integer> mediaList = materialUploadTaskMapper.getMediaList(signature);
+        for (int i = 0; i < mediaList.size(); i++) {
+            Integer mediaId = mediaList.get(i);
+            if (mediaId == 2 || mediaId == 4) {
+                taskVo.setKuaiShou(1);
+            }
+            if (mediaId == 1 || mediaId == 3) {
+                taskVo.setBytedance(1);
+            }
+        }
+        return taskVo;
+    }
+
+
+}

+ 122 - 0
src/main/java/cn/com/ctop/material/utils/AesEncryptUtil.java

@@ -0,0 +1,122 @@
+package cn.com.ctop.track.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;
+
+/**
+ * AES 加密
+ */
+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) {
+            return "";
+        }
+        try {
+            result = java.net.URLDecoder.decode(str, "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+        }
+        return result;
+
+    }
+}

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

@@ -0,0 +1,57 @@
+package cn.com.ctop.track.utils;
+
+import com.alibaba.fastjson.JSONArray;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+public class Check {
+    private Check() {
+    }
+
+    public static boolean isNull(List<?> list) {
+        return list == null || list.isEmpty();
+    }
+
+    public static boolean isNull(Long l) {
+        return l == null || l == 0;
+    }
+
+    public static boolean isNull(Collection<?> collection) {
+        return collection == null || collection.isEmpty();
+    }
+
+    public static boolean isNull(JSONArray jsonArray) {
+        return jsonArray == null || jsonArray.isEmpty();
+    }
+
+
+    public static boolean isNull(String str) {
+        return str == null || str.isEmpty();
+    }
+
+    public static boolean isNull(byte[] bytes) {
+        return bytes == null || bytes.length == 0;
+    }
+
+    public static boolean hasNull(Object... objects) {
+        for (Object obj : objects) {
+            if (obj == null) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+    public static boolean isNull(Object object) {
+        return object == null;
+    }
+
+    public static boolean isNullMap(Map<?, ?> map) {
+        return map == null || map.isEmpty();
+    }
+}

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

@@ -0,0 +1,12 @@
+package cn.com.ctop.track.utils;
+
+
+import lombok.Data;
+
+@Data
+public class EncryptedString {
+
+    public static  String key = "1234567890adbcde";//长度为16个字符
+
+    public static  String iv  = "1234567890hjlkew";//长度为16个字符
+}

+ 370 - 0
src/main/java/cn/com/ctop/material/utils/HttpConstant.java

@@ -0,0 +1,370 @@
+package cn.com.ctop.common.module.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";
+
+}

src/main/java/cn/com/ctop/track/utils/HttpUtils.java → src/main/java/cn/com/ctop/material/utils/HttpUtils.java


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

@@ -0,0 +1,189 @@
+package cn.com.ctop.track.utils;
+
+import org.apache.commons.codec.digest.DigestUtils;
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.Map;
+
+public class LoadFileUtil {
+    /**
+     * 上传文件
+     *
+     * @param urlStr
+     * @param savePath
+     * @return
+     * @throws IOException
+     */
+    public static String downLoadFromUrl(String urlStr, String savePath) {
+        try {
+            String fileName = AesEncryptUtil.getUrlDecoderString(urlStr.substring(urlStr.lastIndexOf("/") + 1));
+            URL url = new URL(urlStr);
+
+            System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2,SSLv3");
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+            //设置超时间为3秒
+            conn.setConnectTimeout(60 * 1000);
+            //防止屏蔽程序抓取而返回403错误
+            conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+            //得到输入流
+            InputStream inputStream = conn.getInputStream();
+            //获取自己数组
+            byte[] getData = readInputStream(inputStream);
+
+            //文件保存位置
+            File saveDir = new File(savePath);
+            if (!saveDir.exists()) {
+                saveDir.mkdirs();
+            }
+            String localPath = saveDir + File.separator + fileName;
+            File file = new File(localPath);
+            if (!file.exists()) {
+                file.getParentFile().mkdirs();
+            }
+            FileOutputStream fos = new FileOutputStream(file);
+            fos.write(getData);
+            if (fos != null) {
+                fos.close();
+            }
+            if (inputStream != null) {
+                inputStream.close();
+            }
+            return localPath;
+        } catch (Exception e) {
+            return null;
+        }
+
+
+    }
+
+    public static byte[] readInputStream(InputStream inputStream) throws IOException {
+        byte[] buffer = new byte[1024];
+        int len = 0;
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        while ((len = inputStream.read(buffer)) != -1) {
+            bos.write(buffer, 0, len);
+        }
+        bos.close();
+        return bos.toByteArray();
+    }
+
+
+    /**
+     * 删除文件
+     *
+     * @param path
+     * @return
+     */
+    public static boolean delFile(String path) {
+        boolean flag = false;
+        File file = new File(path);
+        if (!file.exists()) {
+            return false;
+        }
+        try {
+            flag = file.delete();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return flag;
+    }
+
+    /**
+     * 获取文件md5
+     *
+     * @param path
+     * @return
+     * @throws IOException
+     */
+    public static String getMD5(String path) throws IOException {
+        return DigestUtils.md5Hex(new FileInputStream(path));
+    }
+
+    public static String getMD5ByFile(FileInputStream inputStream) throws IOException {
+        return DigestUtils.md5Hex(inputStream);
+    }
+
+    public static void checkFile(String filePackageName) {
+        File file = new File(filePackageName);
+        if (!file.exists()) {
+            file.mkdir();
+        }
+    }
+
+    public static String downloadByUrl(Map<String, Object> requestMap, String downloadPath, String urlStr, String token, String fileName) {
+
+        try {
+            StringBuilder postBody = null;
+            if (!Check.isNull(requestMap)) {
+                postBody = new StringBuilder();
+                for (Map.Entry<String, Object> entry : requestMap.entrySet()) {
+                    if (entry.getValue() == null) {
+                        continue;
+                    }
+                    postBody.append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue().toString(),
+                            "utf-8")).append("&");
+                }
+                if (!requestMap.isEmpty()) {
+                    postBody.deleteCharAt(postBody.length() - 1);
+                }
+            }
+
+            URL url = new URL(urlStr + "?" + postBody);
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+            //设置超时间为3秒
+            conn.setConnectTimeout(120 * 1000);
+            //防止屏蔽程序抓取而返回403错误
+            conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+            conn.setRequestProperty("Access-Token", token);
+            //得到输入流
+            InputStream inputStream = null;
+
+            inputStream = conn.getInputStream();
+
+            //获取自己数组
+            byte[] getData = readInputStream(inputStream);
+
+            //文件保存位置
+            File saveDir = new File(downloadPath);
+            if (!saveDir.exists()) {
+                saveDir.mkdirs();
+            }
+            String filePath = downloadPath + fileName;
+
+            File file = new File(saveDir + File.separator + fileName);
+            FileOutputStream fos = new FileOutputStream(file);
+            fos.write(getData);
+            fos.close();
+            inputStream.close();
+            return filePath;
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+
+        return null;
+
+    }
+
+
+    public static InputStream getFileStream(String url) {
+        try {
+            HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
+            connection.setReadTimeout(60000);
+            connection.setConnectTimeout(60000);
+            connection.setRequestMethod("GET");
+            if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
+                InputStream inputStream = connection.getInputStream();
+                return inputStream;
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+
+}

+ 0 - 269
src/main/java/cn/com/ctop/track/controller/TrackController.java

@@ -1,269 +0,0 @@
-package cn.com.ctop.track.controller;
-
-import cn.com.ctop.track.entity.ConvertInfo;
-import cn.com.ctop.track.service.ClickInfoService;
-import cn.com.ctop.track.service.ConvertInfoService;
-import cn.com.ctop.track.service.TaobaoNoticeService;
-import cn.com.ctop.track.utils.HttpUtils;
-import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Date;
-
-@Controller
-@RequestMapping("/")
-public class TrackController {
-    private static Logger logger = Logger.getLogger(TrackController.class);
-    @Autowired
-    private ClickInfoService clickInfoService;
-    @Autowired
-    private TaobaoNoticeService taobaoNoticeService;
-    @Autowired
-    private ConvertInfoService convertInfoService;
-
-    @ResponseBody
-    @RequestMapping(value = "/convert")
-    public String convert(HttpServletRequest request,
-                          HttpServletResponse response) {
-        logger.info(request.getQueryString());
-        try {
-            //test
-            String clickId = request.getParameter("click_id");
-            String clickIdStr = request.getParameter("click_id_str");
-            String spaceId = request.getParameter("space_id");
-            String accountId = request.getParameter("account_id");
-            String os = request.getParameter("os_type");
-            String platform = request.getParameter("platform");
-            String advertisor = request.getParameter("advertisor");
-            String groupId = request.getParameter("group_id");
-            String campaignId = request.getParameter("compaign_id");
-            String creativeId = request.getParameter("creative_id");
-            String campaignName = request.getParameter("campaign_name");
-            String mac = request.getParameter("mac");
-            String macMd5 = request.getParameter("mac_md5");
-            String ts = request.getParameter("ts");
-            String osString = request.getParameter("os");
-            String ip = request.getParameter("ip");
-            String sence = request.getParameter("sence");
-            String imeiMd5 = null;
-            String idfaMd5 = null;
-            String oaid = null;
-            if (os != null) {
-                if (os.equals("Android")) {
-                    imeiMd5 = request.getParameter("imei_md5");
-                    oaid = request.getParameter("oaid");
-                } else if (os.equals("IOS")) {
-                    idfaMd5 = request.getParameter("idfa_md5");
-                }
-            }
-            String callbackUrl = request.getParameter("callback_url");
-            String transformType = request.getParameter("transformType");
-            if (transformType != null) {
-                if (platform != null && platform.equals("sigmob")) {
-                    String e = request.getParameter("e");
-                    String p = request.getParameter("p");
-                    callbackUrl = callbackUrl + "&e=" + e + "&p=" + p;
-                }
-                if (transformType.equals("1")) {
-                    if (platform != null && platform.equals("bytedance")) {
-                        callbackUrl = "https://ad.oceanengine.com/track/activate/?callback=" + callbackUrl;
-                        callbackUrl = callbackUrl + "&event_type=0&conv_time=" + new Date().getTime() + "&imei=" + imeiMd5 + "&oaid=" + oaid;
-                    } else if (platform != null && platform.equals("kuaishou")) {
-                        callbackUrl = callbackUrl + "&event_type=1&event_time=" + new Date().getTime();
-                    }
-
-                } else if (transformType.equals("2")) {
-                    if (platform != null && platform.equals("bytedance")) {
-                        callbackUrl = "https://ad.oceanengine.com/track/activate/?callback=" + callbackUrl;
-                        callbackUrl = callbackUrl + "&event_type=1&conv_time=" + new Date().getTime() + "&imei=" + imeiMd5 + "&oaid=" + oaid;
-                    } else if (platform != null && platform.equals("kuaishou")) {
-                        callbackUrl = callbackUrl + "&event_type=2&event_time=" + new Date().getTime();
-                    }
-                } else if (transformType.equals("23")) {
-                    if (platform != null && platform.equals("kuaishou")) {
-                        callbackUrl = callbackUrl + "&event_type=1&event_time=" + new Date().getTime();
-                    }
-                }
-            }
-            String result = HttpUtils.httpGetRequest(callbackUrl);
-            ConvertInfo convertInfo = new ConvertInfo();
-            convertInfo.setCallbackUrl(callbackUrl);
-            try {
-                convertInfo.setClickId(Long.parseLong(clickId));
-            } catch (Exception e) {
-
-            }
-            convertInfo.setClickIdStr(clickIdStr);
-            convertInfo.setTransformType(transformType);
-            convertInfo.setResponse(result);
-            convertInfo.setAdvertisor(advertisor);
-            convertInfo.setCampaignId(campaignId);
-            convertInfo.setCampaignName(campaignName);
-            convertInfo.setCreativeId(creativeId);
-            convertInfo.setGroupId(groupId);
-            convertInfo.setIdfaMd5(idfaMd5);
-            convertInfo.setImeiMd5(imeiMd5);
-            convertInfo.setIp(ip);
-            convertInfo.setMac(mac);
-            convertInfo.setMacMd5(macMd5);
-            convertInfo.setOaid(oaid);
-            convertInfo.setOsType(os);
-            convertInfo.setPlatform(platform);
-            convertInfo.setSence(sence);
-            convertInfo.setSpaceId(spaceId);
-            convertInfo.setAccountId(accountId);
-            try {
-                convertInfo.setTs(new Date(Long.parseLong(ts)));
-            } catch (NumberFormatException e) {
-
-            }
-            convertInfoService.save(convertInfo);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return "{\"code\":200,\"result\":\"success\"}";
-    }
-
-    @ResponseBody
-    @RequestMapping(value = "/convert2")
-    public String convert2(HttpServletRequest request,
-                           HttpServletResponse response) {
-        logger.info(request.getQueryString());
-        try {
-            //test
-            String clickId = request.getParameter("click_id");
-            String spaceId = request.getParameter("space_id");
-            String accountId = request.getParameter("account_id");
-            String os = request.getParameter("os_type");
-            String platform = request.getParameter("platform");
-            String advertisor = request.getParameter("advertisor");
-            String groupId = request.getParameter("group_id");
-            String campaignId = request.getParameter("compaign_id");
-            String creativeId = request.getParameter("creative_id");
-            String campaignName = request.getParameter("campaign_name");
-            String mac = request.getParameter("mac");
-            String macMd5 = request.getParameter("mac_md5");
-            String ts = request.getParameter("ts");
-            String osString = request.getParameter("os");
-            String ip = request.getParameter("ip");
-            String sence = request.getParameter("sence");
-            String imeiMd5 = null;
-            String idfaMd5 = null;
-            String oaid = null;
-            if (os != null) {
-                if (os.equals("Android")) {
-                    imeiMd5 = request.getParameter("imei_md5");
-                    oaid = request.getParameter("oaid");
-                } else if (os.equals("IOS")) {
-                    idfaMd5 = request.getParameter("idfa_md5");
-                }
-            }
-            String callbackUrl = request.getParameter("callback_url");
-            String transformType = request.getParameter("transformType");
-            String result = null;
-            if (transformType != null) {
-                if (transformType.equals("2")) {
-                    if (platform != null && platform.equals("bytedance")) {
-                        callbackUrl = "https://ad.oceanengine.com/track/activate/?callback=" + callbackUrl;
-                        callbackUrl = callbackUrl + "&event_type=0&conv_time=" + new Date().getTime() + "&imei=" + imeiMd5 + "&oaid=" + oaid;
-                    } else if (platform != null && platform.equals("kuaishou")) {
-                        callbackUrl = callbackUrl + "&event_type=1&event_time=" + new Date().getTime();
-                    }
-                    result = HttpUtils.httpGetRequest(callbackUrl);
-                }
-//                }else if (transformType.equals("2")){
-//                    if(platform !=null && platform.equals("bytedance")){
-//                        callbackUrl = "https://ad.oceanengine.com/track/activate/?callback="+callbackUrl;
-//                        callbackUrl = callbackUrl+"&event_type=1&conv_time="+new Date().getTime()+"&imei="+imeiMd5+"&oaid="+oaid;
-//                    }else if(platform !=null && platform.equals("kuaishou")){
-//                        callbackUrl = callbackUrl+"&event_type=2&event_time="+new Date().getTime();
-//                    }
-//
-//                }
-            }
-
-            ConvertInfo convertInfo = new ConvertInfo();
-            convertInfo.setCallbackUrl(callbackUrl);
-            try {
-                convertInfo.setClickId(Long.parseLong(clickId));
-            } catch (Exception e) {
-
-            }
-            convertInfo.setTransformType(transformType);
-            convertInfo.setResponse(result);
-            convertInfo.setAdvertisor(advertisor);
-            convertInfo.setCampaignId(campaignId);
-            convertInfo.setCampaignName(campaignName);
-            convertInfo.setCreativeId(creativeId);
-            convertInfo.setGroupId(groupId);
-            convertInfo.setIdfaMd5(idfaMd5);
-            convertInfo.setImeiMd5(imeiMd5);
-            convertInfo.setIp(ip);
-            convertInfo.setMac(mac);
-            convertInfo.setMacMd5(macMd5);
-            convertInfo.setOaid(oaid);
-            convertInfo.setOsType(os);
-            convertInfo.setPlatform(platform);
-            convertInfo.setSence(sence);
-            convertInfo.setSpaceId(spaceId);
-            convertInfo.setAccountId(accountId);
-            try {
-                convertInfo.setTs(new Date(Long.parseLong(ts)));
-            } catch (NumberFormatException e) {
-
-            }
-            convertInfoService.save(convertInfo);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return "{\"code\":200,\"result\":\"success\"}";
-    }
-
-    @ResponseBody
-    @RequestMapping(value = "/click")
-    public String click(HttpServletRequest request,
-                        HttpServletResponse response) {
-        try {
-            logger.info(request.getQueryString());
-            String os = request.getParameter("os_type");
-            String spaceId = request.getParameter("space_id");
-            String advertisor = request.getParameter("advertisor");
-            String campaignId = request.getParameter("compaign_id");
-            String creativeId = request.getParameter("creative_id");
-            String campaignName = request.getParameter("campaign_name");
-            String dpaId = request.getParameter("dpa_id");
-            String dpaType = request.getParameter("dpa_type");
-            String imeiMd5 = null;
-            String idfaMd5 = null;
-            String oaid = null;
-            if (os != null) {
-                if (os.equals("Android")) {
-                    imeiMd5 = request.getParameter("imei_md5");
-                    oaid = request.getParameter("oaid");
-                } else if (os.equals("IOS")) {
-                    idfaMd5 = request.getParameter("idfa_md5");
-                }
-            }
-            if (spaceId == null || spaceId.equals("")) {
-                spaceId = "11709";
-            }
-            if (advertisor != null && advertisor.equals("taobao")) {
-                try {
-                    String convertUrl = "https://track.c-top.com.cn/convert?" + request.getQueryString();
-                    logger.info(convertUrl);
-                    taobaoNoticeService.sendNotice(spaceId, campaignId, campaignName, creativeId, imeiMd5, idfaMd5, oaid, dpaId, dpaType, convertUrl);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-        } catch (NumberFormatException e) {
-            e.printStackTrace();
-        }
-        return "{\"code\":200,\"result\":\"success\"}";
-    }
-}

+ 0 - 31
src/main/java/cn/com/ctop/track/entity/ClickInfo.java

@@ -1,31 +0,0 @@
-package cn.com.ctop.track.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-import java.util.Date;
-@Data
-@TableName("tb_click_info")
-public class ClickInfo {
-    @TableId(value = "id",type = IdType.AUTO)
-    private Long id;
-    private String platform;
-    private String advertisor;
-    private String osType;
-    private String oaid;
-    private String imeiMd5;
-    private String idfaMd5;
-    private String groupId;
-    private String campaignId;
-    private String creativeId;
-    private String campaignName;
-    private String mac;
-    private String macMd5;
-    private Date ts;
-    private String ip;
-    private String sence;
-    private String callbackUrl;
-    private Integer isConvert;
-}

+ 0 - 37
src/main/java/cn/com/ctop/track/entity/ConvertInfo.java

@@ -1,37 +0,0 @@
-package cn.com.ctop.track.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-import java.util.Date;
-
-@Data
-@TableName("tb_convert_info_new")
-public class ConvertInfo {
-    @TableId(type = IdType.INPUT)
-    private Long id;
-    private Long clickId;
-    private String clickIdStr;
-    private String accountId;
-    private String spaceId;
-    private String platform;
-    private String advertisor;
-    private String osType;
-    private String oaid;
-    private String imeiMd5;
-    private String idfaMd5;
-    private String groupId;
-    private String campaignId;
-    private String creativeId;
-    private String campaignName;
-    private String mac;
-    private String macMd5;
-    private Date ts;
-    private String ip;
-    private String sence;
-    private String callbackUrl;
-    private String response;
-    private String transformType;
-}

+ 0 - 26
src/main/java/cn/com/ctop/track/entity/TaobaoNotice.java

@@ -1,26 +0,0 @@
-package cn.com.ctop.track.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-@Data
-@TableName("tb_taobao_notice")
-public class TaobaoNotice {
-    @TableId(type = IdType.INPUT)
-    private Long id;
-    private String oaid;
-    private String channel;
-    private String advertisingSpaceId;
-    private String taskId;
-    private String adid;
-    private String cid;
-    private String serviceProviderName;
-    private String imeiMd5;
-    private String idfaMd5;
-    private String callbackUrl;
-    private String app;
-    private String adname;
-    private String response;
-}

+ 0 - 8
src/main/java/cn/com/ctop/track/mapper/ClickInfoMapper.java

@@ -1,8 +0,0 @@
-package cn.com.ctop.track.mapper;
-
-import cn.com.ctop.track.entity.ClickInfo;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-public interface ClickInfoMapper extends BaseMapper<ClickInfo> {
-
-}

+ 0 - 7
src/main/java/cn/com/ctop/track/mapper/ConvertInfoMapper.java

@@ -1,7 +0,0 @@
-package cn.com.ctop.track.mapper;
-
-import cn.com.ctop.track.entity.ConvertInfo;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-public interface ConvertInfoMapper extends BaseMapper<ConvertInfo> {
-}

+ 0 - 8
src/main/java/cn/com/ctop/track/mapper/TaobaoNoticeMapper.java

@@ -1,8 +0,0 @@
-package cn.com.ctop.track.mapper;
-
-import cn.com.ctop.track.entity.TaobaoNotice;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-public interface TaobaoNoticeMapper extends BaseMapper<TaobaoNotice> {
-
-}

+ 0 - 7
src/main/java/cn/com/ctop/track/service/ClickInfoService.java

@@ -1,7 +0,0 @@
-package cn.com.ctop.track.service;
-
-import cn.com.ctop.track.entity.ClickInfo;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-public interface ClickInfoService extends IService<ClickInfo> {
-}

+ 0 - 7
src/main/java/cn/com/ctop/track/service/ConvertInfoService.java

@@ -1,7 +0,0 @@
-package cn.com.ctop.track.service;
-
-import cn.com.ctop.track.entity.ConvertInfo;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-public interface ConvertInfoService extends IService<ConvertInfo> {
-}

+ 0 - 8
src/main/java/cn/com/ctop/track/service/TaobaoNoticeService.java

@@ -1,8 +0,0 @@
-package cn.com.ctop.track.service;
-
-import cn.com.ctop.track.entity.TaobaoNotice;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-public interface TaobaoNoticeService extends IService<TaobaoNotice> {
-    public void sendNotice(String spaceId,String campaignId,String campaignName,String creativeId,String imei,String idfa,String oaid,String dpaId,String dpaType,String callbackUrl);
-}

+ 0 - 11
src/main/java/cn/com/ctop/track/service/impl/ClickInfoServiceImpl.java

@@ -1,11 +0,0 @@
-package cn.com.ctop.track.service.impl;
-
-import cn.com.ctop.track.entity.ClickInfo;
-import cn.com.ctop.track.mapper.ClickInfoMapper;
-import cn.com.ctop.track.service.ClickInfoService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-@Service
-public class ClickInfoServiceImpl extends ServiceImpl<ClickInfoMapper, ClickInfo> implements ClickInfoService {
-}

+ 0 - 11
src/main/java/cn/com/ctop/track/service/impl/ConvertInfoServiceImpl.java

@@ -1,11 +0,0 @@
-package cn.com.ctop.track.service.impl;
-
-import cn.com.ctop.track.entity.ConvertInfo;
-import cn.com.ctop.track.mapper.ConvertInfoMapper;
-import cn.com.ctop.track.service.ConvertInfoService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-@Service
-public class ConvertInfoServiceImpl extends ServiceImpl<ConvertInfoMapper, ConvertInfo> implements ConvertInfoService {
-}

+ 0 - 55
src/main/java/cn/com/ctop/track/service/impl/TaobaoNoticeServiceImpl.java

@@ -1,55 +0,0 @@
-package cn.com.ctop.track.service.impl;
-
-import cn.com.ctop.track.entity.TaobaoNotice;
-import cn.com.ctop.track.mapper.TaobaoNoticeMapper;
-import cn.com.ctop.track.service.TaobaoNoticeService;
-import cn.com.ctop.track.utils.HttpUtils;
-import cn.hutool.http.HttpUtil;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.log4j.Logger;
-
-@Service
-public class TaobaoNoticeServiceImpl extends ServiceImpl<TaobaoNoticeMapper, TaobaoNotice> implements TaobaoNoticeService {
-    private static Logger logger = Logger.getLogger(TaobaoNoticeServiceImpl.class);
-    public void sendNotice(String spaceId,String campaignId,String campaignName,String creativeId,String imei,String idfa,String oaid,String dpaId,String dpaType,String callbackUrl){
-        TaobaoNotice taobaoNotice = new TaobaoNotice();
-        taobaoNotice.setAdid(campaignId);
-        taobaoNotice.setAdname(campaignName);
-        taobaoNotice.setAdvertisingSpaceId(spaceId);
-        taobaoNotice.setApp("1");
-        taobaoNotice.setCallbackUrl(callbackUrl);
-        taobaoNotice.setChannel("2200803434135");
-        taobaoNotice.setCid(creativeId);
-        taobaoNotice.setOaid(oaid);
-        taobaoNotice.setIdfaMd5(idfa);
-        taobaoNotice.setImeiMd5(imei);
-        taobaoNotice.setServiceProviderName("北京汇创思拓数字科技有限公司");
-        taobaoNotice.setTaskId("346834137");
-
-        String url = "https://wcp.taobao.com/adstrack/track.json?action=2";
-        Map<String,Object> paramMap = new HashMap<>();
-        paramMap.put("adid",taobaoNotice.getAdid());
-        paramMap.put("oaid",taobaoNotice.getOaid());
-        paramMap.put("adname",taobaoNotice.getAdname());
-        paramMap.put("advertisingSpaceId",taobaoNotice.getAdvertisingSpaceId());
-        paramMap.put("app",taobaoNotice.getApp());
-        paramMap.put("callbackUrl",taobaoNotice.getCallbackUrl());
-        paramMap.put("channel",taobaoNotice.getChannel());
-        paramMap.put("cid",taobaoNotice.getCid());
-        paramMap.put("imeiMd5",taobaoNotice.getImeiMd5());
-        paramMap.put("serviceProviderName",taobaoNotice.getServiceProviderName());
-        paramMap.put("taskId",taobaoNotice.getTaskId());
-        if (dpaId != null && !dpaId.equals("")){
-            paramMap.put("dpaId",dpaId);
-            paramMap.put("dpaType",dpaType);
-        }
-        String response = HttpUtils.httpPostParamRequest(url,paramMap,null);
-        logger.info(response);
-//        taobaoNotice.setResponse(response);
-//        this.save(taobaoNotice);
-    }
-}