Bläddra i källkod

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

xuzuoyun 5 år sedan
förälder
incheckning
f0863454ea
30 ändrade filer med 1223 tillägg och 130 borttagningar
  1. 41 41
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RedisUtil.java
  2. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountLoginController.java
  3. 6 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceTemplateController.java
  4. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/YardController.java
  5. 12 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/BytedanceReportLoadJob.java
  6. 269 54
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java
  7. 6 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/controller/FileController.java
  8. 27 29
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  9. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IBindAccountLoginService.java
  10. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IFileInfoService.java
  11. 7 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountLoginServiceImpl.java
  12. 18 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java
  13. 2 1
      module-common/src/main/java/cn/com/ctop/common/module/utils/StatusCode.java
  14. 18 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/StringUtils.java
  15. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  16. 260 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/controller/BytedanceAppDownloadDetailPageController.java
  17. 254 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/controller/BytedanceCreativeLaunchTemplateController.java
  18. 63 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/entity/BytedanceAppDownloadDetailPage.java
  19. 106 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/entity/BytedanceCreativeLaunchTemplate.java
  20. 15 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/BytedanceAppDownloadDetailPageMapper.java
  21. 15 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/BytedanceCreativeLaunchTemplateMapper.java
  22. 5 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/xml/BytedanceAppDownloadDetailPageMapper.xml
  23. 5 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/xml/BytedanceCreativeLaunchTemplateMapper.xml
  24. 2 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/IByteDanceCreativeService.java
  25. 15 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/IBytedanceAppDownloadDetailPageService.java
  26. 15 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/IBytedanceCreativeLaunchTemplateService.java
  27. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertisePlanServiceImpl.java
  28. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceCreativeServiceImpl.java
  29. 19 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/BytedanceAppDownloadDetailPageServiceImpl.java
  30. 19 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/BytedanceCreativeLaunchTemplateServiceImpl.java

+ 41 - 41
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RedisUtil.java

@@ -1,16 +1,16 @@
 package org.jeecg.common.util;
 
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
 
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
 /**
  * redis 工具类
  * @Author Scott
@@ -26,7 +26,7 @@ public class RedisUtil {
 
 	/**
 	 * 指定缓存失效时间
-	 * 
+     *
 	 * @param key  键
 	 * @param time 时间(秒)
 	 * @return
@@ -45,7 +45,7 @@ public class RedisUtil {
 
 	/**
 	 * 根据key 获取过期时间
-	 * 
+     *
 	 * @param key 键 不能为null
 	 * @return 时间(秒) 返回0代表为永久有效
 	 */
@@ -55,7 +55,7 @@ public class RedisUtil {
 
 	/**
 	 * 判断key是否存在
-	 * 
+     *
 	 * @param key 键
 	 * @return true 存在 false不存在
 	 */
@@ -70,7 +70,7 @@ public class RedisUtil {
 
 	/**
 	 * 删除缓存
-	 * 
+     *
 	 * @param key 可以传一个值 或多个
 	 */
 	@SuppressWarnings("unchecked")
@@ -87,7 +87,7 @@ public class RedisUtil {
 	// ============================String=============================
 	/**
 	 * 普通缓存获取
-	 * 
+     *
 	 * @param key 键
 	 * @return 值
 	 */
@@ -97,7 +97,7 @@ public class RedisUtil {
 
 	/**
 	 * 普通缓存放入
-	 * 
+     *
 	 * @param key   键
 	 * @param value 值
 	 * @return true成功 false失败
@@ -115,7 +115,7 @@ public class RedisUtil {
 
 	/**
 	 * 普通缓存放入并设置时间
-	 * 
+     *
 	 * @param key   键
 	 * @param value 值
 	 * @param time  时间(秒) time要大于0 如果time小于等于0 将设置无限期
@@ -137,9 +137,9 @@ public class RedisUtil {
 
 	/**
 	 * 递增
-	 * 
+     *
 	 * @param key 键
-	 * @param by  要增加几(大于0)
+     * @param delta  要增加几(大于0)
 	 * @return
 	 */
 	public long incr(String key, long delta) {
@@ -151,9 +151,9 @@ public class RedisUtil {
 
 	/**
 	 * 递减
-	 * 
+     *
 	 * @param key 键
-	 * @param by  要减少几(小于0)
+     * @param delta 要减少几(小于0)
 	 * @return
 	 */
 	public long decr(String key, long delta) {
@@ -166,7 +166,7 @@ public class RedisUtil {
 	// ================================Map=================================
 	/**
 	 * HashGet
-	 * 
+     *
 	 * @param key  键 不能为null
 	 * @param item 项 不能为null
 	 * @return 值
@@ -177,7 +177,7 @@ public class RedisUtil {
 
 	/**
 	 * 获取hashKey对应的所有键值
-	 * 
+     *
 	 * @param key 键
 	 * @return 对应的多个键值
 	 */
@@ -187,7 +187,7 @@ public class RedisUtil {
 
 	/**
 	 * HashSet
-	 * 
+     *
 	 * @param key 键
 	 * @param map 对应多个键值
 	 * @return true 成功 false 失败
@@ -204,7 +204,7 @@ public class RedisUtil {
 
 	/**
 	 * HashSet 并设置时间
-	 * 
+     *
 	 * @param key  键
 	 * @param map  对应多个键值
 	 * @param time 时间(秒)
@@ -225,7 +225,7 @@ public class RedisUtil {
 
 	/**
 	 * 向一张hash表中放入数据,如果不存在将创建
-	 * 
+     *
 	 * @param key   键
 	 * @param item  项
 	 * @param value 值
@@ -243,7 +243,7 @@ public class RedisUtil {
 
 	/**
 	 * 向一张hash表中放入数据,如果不存在将创建
-	 * 
+     *
 	 * @param key   键
 	 * @param item  项
 	 * @param value 值
@@ -265,7 +265,7 @@ public class RedisUtil {
 
 	/**
 	 * 删除hash表中的值
-	 * 
+     *
 	 * @param key  键 不能为null
 	 * @param item 项 可以使多个 不能为null
 	 */
@@ -275,7 +275,7 @@ public class RedisUtil {
 
 	/**
 	 * 判断hash表中是否有该项的值
-	 * 
+     *
 	 * @param key  键 不能为null
 	 * @param item 项 不能为null
 	 * @return true 存在 false不存在
@@ -286,7 +286,7 @@ public class RedisUtil {
 
 	/**
 	 * hash递增 如果不存在,就会创建一个 并把新增后的值返回
-	 * 
+     *
 	 * @param key  键
 	 * @param item 项
 	 * @param by   要增加几(大于0)
@@ -298,7 +298,7 @@ public class RedisUtil {
 
 	/**
 	 * hash递减
-	 * 
+     *
 	 * @param key  键
 	 * @param item 项
 	 * @param by   要减少记(小于0)
@@ -311,7 +311,7 @@ public class RedisUtil {
 	// ============================set=============================
 	/**
 	 * 根据key获取Set中的所有值
-	 * 
+     *
 	 * @param key 键
 	 * @return
 	 */
@@ -326,7 +326,7 @@ public class RedisUtil {
 
 	/**
 	 * 根据value从一个set中查询,是否存在
-	 * 
+     *
 	 * @param key   键
 	 * @param value 值
 	 * @return true 存在 false不存在
@@ -342,7 +342,7 @@ public class RedisUtil {
 
 	/**
 	 * 将数据放入set缓存
-	 * 
+     *
 	 * @param key    键
 	 * @param values 值 可以是多个
 	 * @return 成功个数
@@ -358,7 +358,7 @@ public class RedisUtil {
 
 	/**
 	 * 将set数据放入缓存
-	 * 
+     *
 	 * @param key    键
 	 * @param time   时间(秒)
 	 * @param values 值 可以是多个
@@ -379,7 +379,7 @@ public class RedisUtil {
 
 	/**
 	 * 获取set缓存的长度
-	 * 
+     *
 	 * @param key 键
 	 * @return
 	 */
@@ -394,7 +394,7 @@ public class RedisUtil {
 
 	/**
 	 * 移除值为value的
-	 * 
+     *
 	 * @param key    键
 	 * @param values 值 可以是多个
 	 * @return 移除的个数
@@ -412,7 +412,7 @@ public class RedisUtil {
 
 	/**
 	 * 获取list缓存的内容
-	 * 
+     *
 	 * @param key   键
 	 * @param start 开始
 	 * @param end   结束 0 到 -1代表所有值
@@ -429,7 +429,7 @@ public class RedisUtil {
 
 	/**
 	 * 获取list缓存的长度
-	 * 
+     *
 	 * @param key 键
 	 * @return
 	 */
@@ -444,7 +444,7 @@ public class RedisUtil {
 
 	/**
 	 * 通过索引 获取list中的值
-	 * 
+     *
 	 * @param key   键
 	 * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
 	 * @return
@@ -460,7 +460,7 @@ public class RedisUtil {
 
 	/**
 	 * 将list放入缓存
-	 * 
+     *
 	 * @param key   键
 	 * @param value 值
 	 * @param time  时间(秒)
@@ -478,7 +478,7 @@ public class RedisUtil {
 
 	/**
 	 * 将list放入缓存
-	 * 
+     *
 	 * @param key   键
 	 * @param value 值
 	 * @param time  时间(秒)
@@ -499,7 +499,7 @@ public class RedisUtil {
 
 	/**
 	 * 将list放入缓存
-	 * 
+     *
 	 * @param key   键
 	 * @param value 值
 	 * @param time  时间(秒)
@@ -517,7 +517,7 @@ public class RedisUtil {
 
 	/**
 	 * 将list放入缓存
-	 * 
+     *
 	 * @param key   键
 	 * @param value 值
 	 * @param time  时间(秒)
@@ -538,7 +538,7 @@ public class RedisUtil {
 
 	/**
 	 * 根据索引修改list中的某条数据
-	 * 
+     *
 	 * @param key   键
 	 * @param index 索引
 	 * @param value 值
@@ -556,7 +556,7 @@ public class RedisUtil {
 
 	/**
 	 * 移除N个值为value
-	 * 
+     *
 	 * @param key   键
 	 * @param count 移除多少个
 	 * @param value 值

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

@@ -63,7 +63,6 @@ public class BindAccountLoginController {
     private ICreateInternalService createInternalService;
 
     /**
-     * TODO  需要爬虫校验用户名密码正确性
      *
      * @param json
      * @return

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

@@ -349,6 +349,12 @@ public class ByteDanceTemplateController {
         return fileInfoService.getSiteList(accountId);
     }
 
+    /**
+     * 获取动态词包信息
+     *
+     * @param accountId
+     * @return
+     */
     @GetMapping("creative/words/get")
     public Map<String, Object> getCreativeWords(Long accountId) {
         return fileInfoService.getCreativeWords(accountId);

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

@@ -6,11 +6,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.digest.DigestUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletRequest;
+import java.io.FileInputStream;
+import java.io.IOException;
 
 @RestController
 @Slf4j
@@ -268,4 +271,15 @@ public class YardController {
         result.setResult(pageList);
         return result;
     }
+
+    public static void main(String[] args) {
+        String path = "D:\\sign\\2\\2.jpg";
+        String md5 = null;
+        try {
+            md5 = DigestUtils.md5Hex(new FileInputStream(path));
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        System.out.println(md5);
+    }
 }

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

@@ -0,0 +1,12 @@
+package org.jeecg.modules.ctop.job;
+
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+public class BytedanceReportLoadJob implements Job {
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        //1:查询所有
+    }
+}

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

@@ -3,15 +3,21 @@ package org.jeecg.modules.ctop.service.impl;
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.mapper.BindAccountLoginMapper;
+import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IFileInfoService;
 import cn.com.ctop.common.module.utils.*;
 import cn.com.ctop.crawler.modules.core.util.FateadmHttpUtil;
 import cn.com.ctop.crawler.modules.core.util.FateadmUtil;
 import cn.com.ctop.toutiao.entity.ByteDanceUserOrientationTemplate;
+import cn.com.ctop.toutiao.entity.BytedanceCreativeLaunchTemplate;
 import cn.com.ctop.toutiao.entity.BytedanceUrlInfo;
 import cn.com.ctop.toutiao.mapper.ByteDanceUserOrientationTemplateMapper;
+import cn.com.ctop.toutiao.mapper.BytedanceCreativeLaunchTemplateMapper;
 import cn.com.ctop.toutiao.mapper.BytedanceUrlInfoMapper;
 import cn.com.ctop.toutiao.service.IByteDanceAdvertiserDataService;
+import cn.com.ctop.toutiao.service.IByteDanceCreativeService;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.JsonNode;
@@ -40,6 +46,8 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
     @Value("${jeecg.path.chrome-driver}")
     private String chromeDriver;
     @Autowired
+    private IBindAccountLoginService bindAccountLoginService;
+    @Autowired
     private BindAccountLoginMapper bindAccountLoginMapper;
 
     @Autowired
@@ -145,7 +153,6 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                 param.put("captcha", resp.pred_resl);
                 orderId = resp.req_id;
                 res = HttpUtils2.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
-                System.out.println("res:" + res);
                 jsonNode = mapper.readTree(res);
                 errorCode = jsonNode.get("error_code").asInt();
             }
@@ -189,13 +196,18 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
         Map<String, Object> resultMap = new HashMap<>();
         //1:获取用户名密码
         Long accountId = requestJson.getLong("accountId");
-        System.out.println(accountId);
         Long userOrientationId = requestJson.getLong("userOrientationId");
-        BindAccountLogin bindAccountLogin = bindAccountLoginMapper.selectById(accountId);
+        BindAccountLogin bindAccountLogin = bindAccountLoginService.selectByAccountId(accountId + "");
         if (null == bindAccountLogin) {
             ResultMapUtils.setResultMap(resultMap, StatusCode.ACCOUNT_HAS_NOT_EXIST.getCode());
             return resultMap;
         }
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId + "");
+        if (null == token) {
+            ResultMapUtils.setResultMap(resultMap, StatusCode.ACCOUNT_HAS_NOT_EXIST.getCode());
+            return resultMap;
+        }
+        JSONObject wordsObject = fileInfoService.getCreativeWord(token, token.getAccountId());
         String url = "https://ad.oceanengine.com/pages/login/index.html";
         System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
         ChromeOptions chromeOptions = new ChromeOptions();
@@ -210,7 +222,8 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
         chromeOptions.setAcceptInsecureCerts(true);
         WebDriver webDriver = new ChromeDriver(chromeOptions);
         try {
-            webDriver.get(url);  //获取登录页面
+            //获取登录页面
+            webDriver.get(url);
             for (Cookie cookie : webDriver.manage().getCookies()) {
                 BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());
                 ck.setDomain("ad.oceanengine.com");
@@ -272,10 +285,11 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                     Cookie cookie = new Cookie(ck.getName(), ck.getValue(), "." + ck.getDomain(), ck.getPath(), ck.getExpiryDate());
                     webDriver.manage().addCookie(cookie);
                 }
-
-                webDriver.get("https://ad.oceanengine.com/pages/promotion.html#/ad");//登录成功 进入推广页面
+                //登录成功 进入推广页面
+                webDriver.get("https://ad.oceanengine.com/pages/promotion.html#/ad");
                 Thread.sleep(3000);
-                webDriver.get("https://ad.oceanengine.com/pages/campaign/create.html");//创建广告组页面
+                //创建广告组页面
+                webDriver.get("https://ad.oceanengine.com/pages/campaign/create.html");
                 String templateName = requestJson.getString("templateName");
                 Map<String, Object> campaignParam = new HashMap<>();
                 String uuid = UUID.randomUUID().toString();
@@ -306,14 +320,17 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                 header.put("X-CSRFToken", csrftoken);
                 header.put("X-Requested-With", "XMLHttpRequest");
                 header.put("Referer", "https://ad.oceanengine.com/pages/campaign/create.html");
-                res = HttpUtils2.httpPostRequest("https://ad.oceanengine.com/overture/campaign/create/", campaignParam, header);// 创建广告组返回信息
+                // 创建广告组返回信息
+                res = HttpUtils2.httpPostRequest("https://ad.oceanengine.com/overture/campaign/create/", campaignParam, header);
                 System.out.println(res);
                 Integer itratorNum = requestJson.getInteger("itratorNum");
+                JSONObject data = new JSONObject();
                 if (null != itratorNum && itratorNum > 0) {
                     //循环创建广告计划
                     for (int i = 0; i < itratorNum; i++) {
                         JsonNode node = mapper.readTree(res);
-                        String campaignId = node.get("data").get("campaign_id").asText();  //广告组id
+                        //广告组id
+                        String campaignId = node.get("data").get("campaign_id").asText();
                         String url2 = "https://ad.oceanengine.com/pages/ad/create.html?campaign_id=" + campaignId + "&landing_type=3&temp_id=ADvQb";
                         webDriver.get(url2);
                         header.put("Referer", url2);
@@ -330,16 +347,19 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                         String tokenStr = HttpUtils2.httpPostRequest("https://ad.oceanengine.com/api/v1/hl/ad/audience/estimate/", audienceParam, header);
                         JsonNode tokenNode = mapper.readTree(tokenStr);
                         Map<String, Object> planParam = new HashMap<>();
-                        planParam.put("name", templateName + "-广告计划-" + uuid.substring(1, 7) + i);//模板名称
+                        //模板名称
+                        planParam.put("name", templateName + "-广告计划-" + uuid.substring(1, 7) + i);
                         Integer deliveryRange = requestJson.getInteger("deliveryRange");
-                        planParam.put("delivery_range", deliveryRange);  //投放形式
+                        //投放形式
+                        planParam.put("delivery_range", deliveryRange);
                         if (deliveryRange == 2) {
-                            planParam.put("union_video_type", requestJson.getInteger("deliveryForm")); //投放形式 1:激励视频 2:原生
+                            //投放形式 1:激励视频 2:原生
+                            planParam.put("union_video_type", requestJson.getInteger("deliveryForm"));
                         }
-                        planParam.put("classify", requestJson.getString("adCategory")); //广告类别
-                        planParam.put("projectid", ""); //
+                        planParam.put("projectid", "");
                         Integer downloadType = requestJson.getInteger("downloadType");
-                        planParam.put("download_type", downloadType); //下载方式  1:下载包 2:h5
+                        //下载方式  1:下载包 2:h5
+                        planParam.put("download_type", downloadType);
                         Long urlId = requestJson.getLong("urlId");
                         BytedanceUrlInfo urlInfo = urlInfoMapper.selectById(urlId);
                         if (downloadType == 1) {
@@ -347,59 +367,92 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                             planParam.put("package", urlInfo.getPackageName());
                         }
                         if (downloadType == 2) {
-                            planParam.put("external_url", urlInfo.getUrl());  // 落地页链接
+                            // 落地页链接
+                            planParam.put("external_url", urlInfo.getUrl());
                         }
-                        planParam.put("delivery_range", 1);  // 投放范围
-                        planParam.put("classify", 5);  //广告类别  5 内广
+                        // 投放范围
+                        planParam.put("delivery_range", 1);
+                        //广告类别  5 内广
+                        planParam.put("classify", 5);
                         planParam.put("projectid", "");
                         planParam.put("localGeolocation", new ArrayList<String>());
 //                        planParam.put("external_action", 4);
-                        planParam.put("open_url", ""); //  应用直达链接
+                        //  应用直达链接
+                        planParam.put("open_url", "");
                         planParam.put("style_type", 0);
-                        planParam.put("location_type", 4); //受众位置类型
-                        planParam.put("hide_if_exists", 0); // 过滤已安装,当推广目标为安卓应用下载时可填,0表示不过滤,1表示过滤,默认为不过滤
-                        planParam.put("interest_tag_mode", 0); //兴趣分类
+                        //受众位置类型
+                        planParam.put("location_type", 4);
+                        // 过滤已安装,当推广目标为安卓应用下载时可填,0表示不过滤,1表示过滤,默认为不过滤
+                        planParam.put("hide_if_exists", 0);
+                        //兴趣分类
+                        planParam.put("interest_tag_mode", 0);
                         planParam.put("token", tokenNode.get("data").get("token").asText());
-                        planParam.put("toutiao", 100000005);  //头条预估数据
-                        planParam.put("aweme", 150000005); //抖音预估数据
-                        planParam.put("video_app", 40000005);//西瓜预估数据
-                        planParam.put("hotsoon", 40000005); //火山预估数据
-                        planParam.put("aweme_account_fans", 0); //账号粉丝相似人群
-                        planParam.put("auto_extend_enabled", 0);// 智能放量????
-                        planParam.put("budget_mode", requestJson.getIntValue("budgetPriceMode"));  // 广告预算类型  0 日预算  1 总预算
-                        planParam.put("budget", requestJson.getIntValue("budgetPrice")); //广告预算
+                        //头条预估数据
+                        planParam.put("toutiao", 100000005);
+                        //抖音预估数据
+                        planParam.put("aweme", 150000005);
+                        //西瓜预估数据
+                        planParam.put("video_app", 40000005);
+                        //火山预估数据
+                        planParam.put("hotsoon", 40000005);
+                        //账号粉丝相似人群
+                        planParam.put("aweme_account_fans", 0);
+                        // 智能放量????
+                        planParam.put("auto_extend_enabled", 0);
+                        // 广告预算类型  0 日预算  1 总预算
+                        planParam.put("budget_mode", requestJson.getIntValue("budgetPriceMode"));
+                        //广告预算
+                        planParam.put("budget", requestJson.getIntValue("budgetPrice"));
                         int scheduleType = requestJson.getIntValue("dateQuantum");
-                        planParam.put("schedule_type", scheduleType); //广告投放时间类型   默认1 1:不限  2:按时间???
+                        //广告投放时间类型   默认1 1:不限  2:按时间???
+                        planParam.put("schedule_type", scheduleType);
                         if (scheduleType == 2) {
-                            planParam.put("start_time", requestJson.getString("startDate")); //广告投放起始时间
-                            planParam.put("end_time", requestJson.getString("endDate"));//广告投放结束时间
+                            //广告投放起始时间
+                            planParam.put("start_time", requestJson.getString("startDate"));
+                            //广告投放结束时间
+                            planParam.put("end_time", requestJson.getString("endDate"));
                         }
-                        planParam.put("week_schedule", new ArrayList<String>());  //投放时段
-                        planParam.put("week_time", new ArrayList<ArrayList<Integer>>());//投放时段
+                        //投放时段
+                        planParam.put("week_schedule", new ArrayList<String>());
+                        //投放时段
+                        planParam.put("week_time", new ArrayList<ArrayList<Integer>>());
                         int pricing = requestJson.getIntValue("pricing");
-                        planParam.put("pricing", pricing); //计划出价类型  9 按展示付费  7 按点击付费 8 按转化付费
-                        planParam.put("cpa_phrase", 2); //出价为OCPC时,计划处于哪个阶段??
+                        //计划出价类型  9 按展示付费  7 按点击付费 8 按转化付费
+                        planParam.put("pricing", pricing);
+                        //出价为OCPC时,计划处于哪个阶段??
+                        planParam.put("cpa_phrase", 2);
                         planParam.put("is_union_slot", "");
-                        planParam.put("hide_if_converted", 1); //过滤已转化用户类型字段,只有转化为目标时可填 优化目标为转化才展示
-                        planParam.put("flow_control_mode", requestJson.getIntValue("flowControlMode")); //投放速度/投放方式使用字段
+                        //过滤已转化用户类型字段,只有转化为目标时可填 优化目标为转化才展示
+                        planParam.put("hide_if_converted", 1);
+                        //投放速度/投放方式使用字段
+                        planParam.put("flow_control_mode", requestJson.getIntValue("flowControlMode"));
                         if (pricing == 9) {
                             planParam.put("cpa_bid", requestJson.getIntValue("convertPrice"));
                         } else {
                             planParam.put("bid", requestJson.getIntValue("convertPrice"));
                         }
-                        planParam.put("smart_bid_type", requestJson.getIntValue("bidType")); //自动出价类型,OCPM支持
-                        planParam.put("adjust_cpa", 0); //是否调整自动出价   允许值: "0", "1"  默认值: 0
+                        //自动出价类型,OCPM支持
+                        planParam.put("smart_bid_type", requestJson.getIntValue("bidType"));
+                        //是否调整自动出价   允许值: "0", "1"  默认值: 0
+                        planParam.put("adjust_cpa", 0);
                         planParam.put("app_bid_ratio", new Object());
                         planParam.put("campaign_id", campaignId);
-                        String downLoadMode = requestJson.getString("downloadMode");
                         if ("IOS".equals(urlInfo.getType())) {
-                            planParam.put("app_type", 202); //app 类型 201 应用推广 安卓 201 应用推广 ios
+                            //app 类型 201 应用推广 安卓 201 应用推广 ios
+                            planParam.put("app_type", 202);
                         } else if ("android".equals(urlInfo.getType())) {
                             planParam.put("app_type", 201);
                         }
-                        Long convertId = requestJson.getLong("convertId");
-                        if (null != convertId && convertId != 0) {
-                            planParam.put("convert_id", convertId);
+                        String convertType = requestJson.getString("convertType");
+                        if (null != convertType && convertType.equals("SIMPLE")) {
+                            //普通应用下载
+                            planParam.put("external_action", requestJson.getLong("simpleDeliverytarget"));
+                        }
+                        if (null != convertType && convertType.equals("API")) {
+                            Long convertId = requestJson.getLong("convertId");
+                            if (null != convertId && convertId != 0) {
+                                planParam.put("convert_id", convertId);
+                            }
                         }
                         System.out.println(planParam);
                         String createResult = HttpUtils2.httpPostRequest("https://ad.oceanengine.com/overture/ad/create/", planParam, header);
@@ -413,20 +466,158 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                             resultMap.put("success", false);
                             return resultMap;
                         }
+                        //广告计划id
                         Long adId = result.getJSONObject("data").getLong("ad_id");
-
                         //修改用户定向
                         ByteDanceUserOrientationTemplate template = userOrientationTemplateMapper.selectById(userOrientationId);
                         if (null != template) {
-                            CtopOauthToken token = tokenService.getOauthTokenByAccountId(bindAccountLogin.getAccountId());
-                            if (null != token) {
-                                //获取modify_time
-                                Thread.sleep(5000L);
-                                advertiserDataService.getAdvertiserPlan(bindAccountLogin.getAccountId(), adId + "");
+                            //获取modify_time
+                            Thread.sleep(5000L);
+                            advertiserDataService.getAdvertiserPlan(bindAccountLogin.getAccountId(), adId + "");
+                            advertiserDataService.updateAd(token, adId, template);
+                        }
+                        Long creativeTemplateId = requestJson.getLong("creativeTemplateId");
+
+                        //创建广告创意
+                        String name = requestJson.getString("name");
+                        data.put("title", name + "_" + System.currentTimeMillis() + "_" + "汇创广告创意");
+                        if (i == 0) {
+                            BytedanceCreativeLaunchTemplate launchTemplate = launchTemplateMapper.selectById(creativeTemplateId);
+                            data.put("ad_id", adId);
+                            String advertiseLoaction = launchTemplate.getAdvertiseLocation();
+                            //优选广告位
+                            if (null != advertiseLoaction && advertiseLoaction.equals("great") && null != launchTemplate.getSmartInventory() && !"".equals(launchTemplate.getSmartInventory())) {
+                                data.put("smart_inventory", launchTemplate.getSmartInventory());
+                            }
+                            //按媒体指定位置
+                            if (null != advertiseLoaction && "media".equals(advertiseLoaction)) {
+                                String inventoryTypeStr = launchTemplate.getInventoryType();
+                                JSONArray inventoryType = JSONArray.parseArray(inventoryTypeStr);
+                                data.put("inventory_type", inventoryType);
+                            }
+                            //按场景指定位置
+                            if (null != advertiseLoaction && "sence".equals(advertiseLoaction)) {
+                                data.put("scene_inventory", launchTemplate.getSceneInventory());
+                            }
+
+                            //广告评论
+                            data.put("is_comment_disable", launchTemplate.getCommentDisable());
+                            //创意展现方式
+                            data.put("creative_display_mode", launchTemplate.getCreativeDisplayMode());
+                            //创意分类
+                            JSONArray categorys = JSONArray.parseArray(launchTemplate.getThirdIndustryId());
+                            String thirdIndustryId = categorys.getString(2);
+                            data.put("third_industry_id", thirdIndustryId);
+                            //创意标签
+                            data.put("ad_keywords", JSONArray.parseArray(launchTemplate.getAdKeywords()));
+                            //创意标题
+                            data.put("title", name + "_" + System.currentTimeMillis() + "_" + "汇创广告创意");
 
-                                System.out.println(111);
-                                advertiserDataService.updateAd(token, adId, template);
+                            //创意方式
+                            String creativeType = requestJson.getString("creativeType");
+                            if (null != creativeType && creativeType.equals("customize")) {
+                                //自定义创意
+                                //拼装creative参数
+                                JSONArray creatives = new JSONArray();
+                                JSONArray getCreatives = requestJson.getJSONArray("creatives");
+                                if (null != getCreatives && getCreatives.size() > 0) {
+                                    getCreatives.forEach(k -> {
+                                        JSONObject createtive = JSONObject.parseObject(JSONObject.toJSONString(k));
+                                        JSONObject setCreatetive = new JSONObject();
+                                        String imageMode = createtive.getString("typeCode");
+                                        setCreatetive.put("image_mode", imageMode);
+                                        String title = createtive.getString("text");
+                                        setCreatetive.put("title", title);
+                                        JSONArray ids = getCreativeWordIds(title, wordsObject);
+                                        setCreatetive.put("creative_word_ids", ids);
+                                        String videoUrl = createtive.getString("vadioUrl");
+                                        String imageUrl = createtive.getString("imageUrl");
+                                        if ("CREATIVE_IMAGE_MODE_VIDEO".equals(imageMode) || "CREATIVE_IMAGE_MODE_VIDEO_VERTICAL".equals(imageMode)) {
+                                            //视频创意
+                                            if (null != videoUrl) {
+                                                Map<String, Object> getImageResult = fileInfoService.uploadImageToBytedance(token.getAccountId() + "", imageUrl);
+                                                JSONArray horizonVideoCoverImageArray = (JSONArray) getImageResult.get("imageIds");
+                                                String imageId = horizonVideoCoverImageArray.getString(0);
+                                                Map<String, Object> getVideoResult = fileInfoService.uploadVideoToBytedance(token.getAccountId() + "", videoUrl);
+                                                String videoId = (String) getVideoResult.get("videoId");
+                                                setCreatetive.put("image_id", imageId);
+                                                setCreatetive.put("video_id", videoId);
+                                                creatives.add(setCreatetive);
+                                            }
+                                        } else {
+                                            //图片创意
+                                            if (null != videoUrl && !"".equals(videoUrl.trim())) {
+                                                Map<String, Object> getImageResult = fileInfoService.uploadImageToBytedance(token.getAccountId() + "", videoUrl);
+                                                JSONArray imageArray = (JSONArray) getImageResult.get("imageIds");
+                                                setCreatetive.put("image_ids", imageArray);
+                                                creatives.add(setCreatetive);
+                                            }
+                                        }
+                                    });
+                                    data.put("creatives", creatives);
+                                }
+                            } else {
+                                data.put("creative_material_mode", "STATIC_ASSEMBLE");
+                                //程序化创意
+                                JSONArray titleArray = requestJson.getJSONArray("titles");
+                                if (null != titleArray && titleArray.size() > 0) {
+                                    JSONArray titleList = new JSONArray();
+                                    titleArray.forEach(v -> {
+                                        JSONObject getTitleObject = JSONObject.parseObject(JSONObject.toJSONString(v));
+                                        ;
+                                        JSONObject titleObject = new JSONObject();
+                                        String getTitle = getTitleObject.getString("text");
+                                        titleObject.put("title", getTitle);
+                                        JSONArray ids = getCreativeWordIds(getTitle, wordsObject);
+                                        titleObject.put("creative_word_ids", ids);
+                                        titleList.add(titleObject);
+                                    });
+                                    data.put("title_list", titleList);
+                                }
+
+                                JSONArray getCreatives = requestJson.getJSONArray("creatives");
+                                if (null != getCreatives && getCreatives.size() > 0) {
+                                    JSONArray imageList = new JSONArray();
+                                    getCreatives.forEach(v -> {
+                                        JSONObject createtive = JSONObject.parseObject(JSONObject.toJSONString(v));
+                                        JSONObject setCreatetive = new JSONObject();
+                                        String imageMode = createtive.getString("typeCode");
+                                        setCreatetive.put("image_mode", imageMode);
+                                        String videoUrl = createtive.getString("vadioUrl");
+                                        String imageUrl = createtive.getString("imageUrl");
+                                        if ("CREATIVE_IMAGE_MODE_VIDEO".equals(imageMode) || "CREATIVE_IMAGE_MODE_VIDEO_VERTICAL".equals(imageMode)) {
+                                            if (null != videoUrl) {
+                                                Map<String, Object> getImageResult = fileInfoService.uploadImageToBytedance(token.getAccountId() + "", imageUrl);
+                                                JSONArray horizonVideoCoverImageArray = (JSONArray) getImageResult.get("imageIds");
+                                                String imageId = horizonVideoCoverImageArray.getString(0);
+                                                Map<String, Object> getVideoResult = fileInfoService.uploadVideoToBytedance(token.getAccountId() + "", videoUrl);
+                                                String videoId = (String) getVideoResult.get("videoId");
+                                                setCreatetive.put("image_id", imageId);
+                                                setCreatetive.put("video_id", videoId);
+                                                imageList.add(setCreatetive);
+                                            }
+                                        } else {
+                                            if (null != videoUrl && !"".equals(videoUrl.trim())) {
+                                                Map<String, Object> getImageResult = fileInfoService.uploadImageToBytedance(token.getAccountId() + "", videoUrl);
+                                                JSONArray imageArray = (JSONArray) getImageResult.get("imageIds");
+                                                setCreatetive.put("image_ids", imageArray);
+                                                imageList.add(setCreatetive);
+                                            }
+                                        }
+                                    });
+                                    data.put("image_list", imageList);
+                                }
                             }
+                            //应用下载详情页
+                            data.put("web_url", requestJson.getString("webUrl"));
+                            //应用名
+                            data.put("app_name", requestJson.getString("appName"));
+                        }
+                        System.out.println(data.toJSONString());
+                        resultMap = byteDanceCreativeService.creativeCreate(token.getAccountId() + "", adId, data.toJSONString());
+                        Boolean createSuccess = (Boolean) resultMap.get("success");
+                        if (null != createSuccess && !createSuccess) {
+                            return resultMap;
                         }
                     }
                 }
@@ -444,6 +635,30 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
         return resultMap;
     }
 
+    public JSONArray getCreativeWordIds(String getTitle, JSONObject wordsObject) {
+        ArrayList<String> wordsString = StringUtils.stringCutFromBrace(getTitle);
+        JSONArray creativeWords = wordsObject.getJSONArray("creative_word");
+        JSONArray ids = new JSONArray();
+        wordsString.forEach(v -> {
+            creativeWords.forEach(word -> {
+                JSONObject wordObject = (JSONObject) word;
+                String name = wordObject.getString("name");
+                Integer id = wordObject.getInteger("creative_word_id");
+                if (v.equals(name)) {
+                    ids.add(id);
+                }
+            });
+        });
+        return ids;
+    }
+
+
+    @Autowired
+    private BytedanceCreativeLaunchTemplateMapper launchTemplateMapper;
+    @Autowired
+    private IByteDanceCreativeService byteDanceCreativeService;
+    @Autowired
+    private IFileInfoService fileInfoService;
     @Autowired
     private ByteDanceUserOrientationTemplateMapper userOrientationTemplateMapper;
     @Autowired

+ 6 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/fileupload/controller/FileController.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.fileupload.controller;
 
 import cn.com.ctop.common.module.service.IFileInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -21,4 +22,9 @@ public class FileController {
     public Map<String, Object> chenckFile(String code) {
         return fileInfoService.checkFile(code);
     }
+
+    @PostMapping("file/insert")
+    public Map<String, Object> insertFile(String code, String url) {
+        return fileInfoService.insertFile(code, url);
+    }
 }

+ 27 - 29
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -2,9 +2,10 @@ package org.jeecg;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IFileInfoService;
 import cn.com.ctop.common.module.utils.OSSUtils;
+import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.toutiao.entity.ByteDanceUserOrientationTemplate;
-import cn.com.ctop.toutiao.entity.BytedanceAreaInfo;
 import cn.com.ctop.toutiao.entity.BytedanceInterestCategory;
 import cn.com.ctop.toutiao.mapper.ByteDanceUserOrientationTemplateMapper;
 import cn.com.ctop.toutiao.mapper.BytedanceAreaInfoMapper;
@@ -26,6 +27,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 import javax.annotation.Resource;
 import java.io.File;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.Map;
 
@@ -134,36 +136,32 @@ public class SampleTest {
         }
     }
 
+    @Autowired
+    private IFileInfoService fileInfoService;
+
     @Test
     public void setJSONFile() {
-        String path = "C:\\Users\\宋英豪\\Downloads\\data_20190222\\city.json";
-        String jsonString = JsonschemaUtil.readJsonFile(path);
-        JSONObject data = JSONObject.parseObject(jsonString);
-        data.forEach((k, v) -> {
-            JSONObject getData = data.getJSONObject(k);
-            BytedanceAreaInfo areaInfo = new BytedanceAreaInfo();
-            Integer level = getData.getInteger("level");
-            Long id = getData.getLong("id");
-            String name = getData.getString("name");
-            System.out.println(name);
-            String parent = getData.getString("parent");
-            areaInfo.setId(id);
-            areaInfo.setLevel(level);
-            String code = id + "";
-            if (level == 1) {
-                areaInfo.setParentCode(parent);
-                areaInfo.setCode(code);
-            } else if (level == 2) {
-                areaInfo.setParentCode(code.substring(0, 2));
-                areaInfo.setCode(code.substring(0, 4));
-            } else {
-                areaInfo.setParentCode(code.substring(0, 4));
-                areaInfo.setCode(code);
-            }
-            areaInfo.setName(name);
-            areaInfo.setCreateTime(new Date());
-            areaInfo.setUpdateTime(new Date());
-            areaInfoMapper.insert(areaInfo);
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId("93289889842");
+        JSONObject wordsObject = fileInfoService.getCreativeWord(token, token.getAccountId());
+        String getTitle = "哈哈{日期}{男人女人}";
+        JSONArray ids = getCreativeWordIds(getTitle, wordsObject);
+        System.out.println(ids);
+    }
+
+    public JSONArray getCreativeWordIds(String getTitle, JSONObject wordsObject) {
+        ArrayList<String> wordsString = StringUtils.stringCutFromBrace(getTitle);
+        JSONArray creativeWords = wordsObject.getJSONArray("creative_word");
+        JSONArray ids = new JSONArray();
+        wordsString.forEach(v -> {
+            creativeWords.forEach(word -> {
+                JSONObject wordObject = (JSONObject) word;
+                String name = wordObject.getString("name");
+                Integer id = wordObject.getInteger("creative_word_id");
+                if (v.equals(name)) {
+                    ids.add(id);
+                }
+            });
         });
+        return ids;
     }
 }

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

@@ -10,4 +10,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @Version: V1.0
  */
 public interface IBindAccountLoginService extends IService<BindAccountLogin> {
+    BindAccountLogin selectByAccountId(String accountId);
 }

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IFileInfoService.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.common.module.service;
 
+import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.FileInfo;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -28,4 +29,8 @@ public interface IFileInfoService extends IService<FileInfo> {
     Map<String, Object> getCreativeWords(Long accountId);
 
     public JSONObject getSiteList(Long accountId);
+
+    JSONObject getCreativeWord(CtopOauthToken token, Long advertiserId);
+
+    Map<String, Object> insertFile(String code, String url);
 }

+ 7 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountLoginServiceImpl.java

@@ -3,6 +3,7 @@ package cn.com.ctop.common.module.service.impl;
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.mapper.BindAccountLoginMapper;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
@@ -16,4 +17,10 @@ import org.springframework.stereotype.Service;
 @Slf4j
 @Service
 public class BindAccountLoginServiceImpl extends ServiceImpl<BindAccountLoginMapper, BindAccountLogin> implements IBindAccountLoginService {
+    @Override
+    public BindAccountLogin selectByAccountId(String accountId) {
+        QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId).orderByDesc("id").last("limit 1");
+        return this.getOne(queryWrapper);
+    }
 }

+ 18 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/FileInfoServiceImpl.java

@@ -161,6 +161,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
         return null;
     }
 
+    @Override
     public JSONObject getCreativeWord(CtopOauthToken token, Long advertiserId) {
         // 请求地址
         String url = "https://ad.toutiao.com/open_api/2/tools/creative_word/select/";
@@ -186,6 +187,23 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
         return resultObject;
     }
 
+    @Override
+    public Map<String, Object> insertFile(String code, String url) {
+        Map<String, Object> resultMap = new HashMap();
+        FileInfo fileInfo = new FileInfo();
+        fileInfo.setFileName("");
+        fileInfo.setFileUrl(url);
+        fileInfo.setMd5(code);
+        fileInfo.setPath("");
+        fileInfo.setPlatformType("");
+        fileInfo.setAccountId(0L);
+        fileInfo.setFileId("");
+        fileInfo.setType("");
+        this.saveOrUpdate(fileInfo);
+        ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
+        return resultMap;
+    }
+
     public JSONObject searchIndustry(CtopOauthToken token, Integer level) {
         // 请求地址
         String url = "https://ad.toutiao.com/open_api/2/tools/industry/get/";

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

@@ -22,8 +22,9 @@ public enum StatusCode {
     TEMPLATE_NAME_HAS_EXIST("模板名称已存在", -204, false),
     TEMPLATE_NAME_IS_NULL("模板名称为空", -205, false),
     FILE_HAS_NOT_UPLOAD("文件尚未上传", -206, false),
-    ACCOUNT_HAS_NOT_EXIST("用户信息不存在", -207, false),
+    ACCOUNT_HAS_NOT_EXIST("用户信息不存在", -207, false),
     USERNAME_OR_PASSWORD_ERROR("登录用户名或密码错误", -208, false),
+    ACCOUNT_HAS_NO_AUTHORIZE("该用户尚未进行授权", -209, false),
     FILE_HAS_UPLOAD("文件已经上传过", 0, false),
     COMMON_SERVER_ERROR("服务器内部错误", -102, false);
     private String desc;

+ 18 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/StringUtils.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.common.module.utils;
+
+import java.util.ArrayList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class StringUtils {
+    public static ArrayList<String> stringCutFromBrace(String origin) {
+        String pattern = "(?<=\\{)(.+?)(?=\\})";
+        Pattern p = Pattern.compile(pattern);
+        ArrayList list = new ArrayList();
+        Matcher m = p.matcher(origin);
+        while (m.find()) {
+            list.add(m.group());
+        }
+        return list;
+    }
+}

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

@@ -209,7 +209,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     @Override
     public KuaishouResult<KuaishouReportHourlyCampaign> getCampaignHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CAMPAIGN_REPORT;
-        Map<String, String> headers = new HashMap<String, String>();
+        Map<String, String> headers = new HashMap<>();
         headers.put("Content-Type", "application/json");
         headers.put("Access-Token", accessToken);
         Map<String, Object> param = new HashMap<String, Object>();

+ 260 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/controller/BytedanceAppDownloadDetailPageController.java

@@ -0,0 +1,260 @@
+package cn.com.ctop.toutiao.controller;
+
+import cn.com.ctop.toutiao.entity.BytedanceAppDownloadDetailPage;
+import cn.com.ctop.toutiao.service.IBytedanceAppDownloadDetailPageService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 应用下载详情页信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-09-27
+ */
+@Slf4j
+@Api(tags = "应用下载详情页信息")
+@RestController
+@RequestMapping("/ctop/bytedanceAppDownloadDetailPage")
+public class BytedanceAppDownloadDetailPageController {
+    @Autowired
+    private IBytedanceAppDownloadDetailPageService bytedanceAppDownloadDetailPageService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param bytedanceAppDownloadDetailPage
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "应用下载详情页信息-分页列表查询")
+    @ApiOperation(value = "应用下载详情页信息-分页列表查询", notes = "应用下载详情页信息-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<BytedanceAppDownloadDetailPage>> queryPageList(BytedanceAppDownloadDetailPage bytedanceAppDownloadDetailPage,
+                                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                       HttpServletRequest req) {
+        Result<IPage<BytedanceAppDownloadDetailPage>> result = new Result<>();
+        QueryWrapper<BytedanceAppDownloadDetailPage> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceAppDownloadDetailPage, req.getParameterMap());
+        Page<BytedanceAppDownloadDetailPage> page = new Page<>(pageNo, pageSize);
+        IPage<BytedanceAppDownloadDetailPage> pageList = bytedanceAppDownloadDetailPageService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param appDownloadDetailPage
+     * @return
+     */
+    @AutoLog(value = "应用下载详情页信息-添加")
+    @ApiOperation(value = "应用下载详情页信息-添加", notes = "应用下载详情页信息-添加")
+    @PostMapping(value = "/add")
+    public Result<BytedanceAppDownloadDetailPage> add(@RequestBody BytedanceAppDownloadDetailPage appDownloadDetailPage) {
+        Result<BytedanceAppDownloadDetailPage> result = new Result<>();
+        try {
+            if (null == appDownloadDetailPage.getName() || "".equals(appDownloadDetailPage.getName().trim()) || null == appDownloadDetailPage.getDownloadUrl() || "".equals(appDownloadDetailPage.getDownloadUrl().trim()) || null == appDownloadDetailPage.getAppName() || "".equals(appDownloadDetailPage.getAppName().trim())) {
+                result.error500("参数异常");
+                return result;
+            }
+            QueryWrapper<BytedanceAppDownloadDetailPage> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("name", appDownloadDetailPage.getName()).last("limit 1");
+            BytedanceAppDownloadDetailPage detailPage = bytedanceAppDownloadDetailPageService.getOne(queryWrapper);
+            if (null != detailPage) {
+                result.error500("该名称已存在");
+                return result;
+            }
+            bytedanceAppDownloadDetailPageService.save(appDownloadDetailPage);
+            result.success("添加成功!");
+            return result;
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+            return result;
+        }
+    }
+
+    /**
+     * 编辑
+     *
+     * @param bytedanceAppDownloadDetailPage
+     * @return
+     */
+    @AutoLog(value = "应用下载详情页信息-编辑")
+    @ApiOperation(value = "应用下载详情页信息-编辑", notes = "应用下载详情页信息-编辑")
+    @PutMapping(value = "/edit")
+    public Result<BytedanceAppDownloadDetailPage> edit(@RequestBody BytedanceAppDownloadDetailPage bytedanceAppDownloadDetailPage) {
+        Result<BytedanceAppDownloadDetailPage> result = new Result<>();
+        BytedanceAppDownloadDetailPage bytedanceAppDownloadDetailPageEntity = bytedanceAppDownloadDetailPageService.getById(bytedanceAppDownloadDetailPage.getId());
+        if (bytedanceAppDownloadDetailPageEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = bytedanceAppDownloadDetailPageService.updateById(bytedanceAppDownloadDetailPage);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "应用下载详情页信息-通过id删除")
+    @ApiOperation(value = "应用下载详情页信息-通过id删除", notes = "应用下载详情页信息-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            bytedanceAppDownloadDetailPageService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "应用下载详情页信息-批量删除")
+    @ApiOperation(value = "应用下载详情页信息-批量删除", notes = "应用下载详情页信息-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<BytedanceAppDownloadDetailPage> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<BytedanceAppDownloadDetailPage> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.bytedanceAppDownloadDetailPageService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "应用下载详情页信息-通过id查询")
+    @ApiOperation(value = "应用下载详情页信息-通过id查询", notes = "应用下载详情页信息-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<BytedanceAppDownloadDetailPage> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<BytedanceAppDownloadDetailPage> result = new Result<>();
+        BytedanceAppDownloadDetailPage bytedanceAppDownloadDetailPage = bytedanceAppDownloadDetailPageService.getById(id);
+        if (bytedanceAppDownloadDetailPage == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(bytedanceAppDownloadDetailPage);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<BytedanceAppDownloadDetailPage> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                BytedanceAppDownloadDetailPage bytedanceAppDownloadDetailPage = JSON.parseObject(deString, BytedanceAppDownloadDetailPage.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(bytedanceAppDownloadDetailPage, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<BytedanceAppDownloadDetailPage> pageList = bytedanceAppDownloadDetailPageService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "应用下载详情页信息列表");
+        mv.addObject(NormalExcelConstants.CLASS, BytedanceAppDownloadDetailPage.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("应用下载详情页信息列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<BytedanceAppDownloadDetailPage> listBytedanceAppDownloadDetailPages = ExcelImportUtil.importExcel(file.getInputStream(), BytedanceAppDownloadDetailPage.class, params);
+                bytedanceAppDownloadDetailPageService.saveBatch(listBytedanceAppDownloadDetailPages);
+                return Result.ok("文件导入成功!数据行数:" + listBytedanceAppDownloadDetailPages.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

+ 254 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/controller/BytedanceCreativeLaunchTemplateController.java

@@ -0,0 +1,254 @@
+package cn.com.ctop.toutiao.controller;
+
+import cn.com.ctop.toutiao.entity.BytedanceCreativeLaunchTemplate;
+import cn.com.ctop.toutiao.service.IBytedanceCreativeLaunchTemplateService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 创意模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-09-27
+ */
+@Slf4j
+@Api(tags = "创意模板")
+@RestController
+@RequestMapping("/ctop/bytedanceCreativeLaunchTemplate")
+public class BytedanceCreativeLaunchTemplateController {
+    @Autowired
+    private IBytedanceCreativeLaunchTemplateService bytedanceCreativeLaunchTemplateService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param bytedanceCreativeLaunchTemplate
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "创意模板-分页列表查询")
+    @ApiOperation(value = "创意模板-分页列表查询", notes = "创意模板-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<BytedanceCreativeLaunchTemplate>> queryPageList(BytedanceCreativeLaunchTemplate bytedanceCreativeLaunchTemplate,
+                                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                        HttpServletRequest req) {
+        Result<IPage<BytedanceCreativeLaunchTemplate>> result = new Result<>();
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        bytedanceCreativeLaunchTemplate.setUserId(user.getId());
+        QueryWrapper<BytedanceCreativeLaunchTemplate> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceCreativeLaunchTemplate, req.getParameterMap());
+        Page<BytedanceCreativeLaunchTemplate> page = new Page<>(pageNo, pageSize);
+        IPage<BytedanceCreativeLaunchTemplate> pageList = bytedanceCreativeLaunchTemplateService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param bytedanceCreativeLaunchTemplate
+     * @return
+     */
+    @AutoLog(value = "创意模板-添加")
+    @ApiOperation(value = "创意模板-添加", notes = "创意模板-添加")
+    @PostMapping(value = "/add")
+    public Result<BytedanceCreativeLaunchTemplate> add(@RequestBody BytedanceCreativeLaunchTemplate bytedanceCreativeLaunchTemplate) {
+        Result<BytedanceCreativeLaunchTemplate> result = new Result<>();
+        try {
+            LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            bytedanceCreativeLaunchTemplate.setUserId(user.getId());
+            bytedanceCreativeLaunchTemplateService.save(bytedanceCreativeLaunchTemplate);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param bytedanceCreativeLaunchTemplate
+     * @return
+     */
+    @AutoLog(value = "创意模板-编辑")
+    @ApiOperation(value = "创意模板-编辑", notes = "创意模板-编辑")
+    @PutMapping(value = "/edit")
+    public Result<BytedanceCreativeLaunchTemplate> edit(@RequestBody BytedanceCreativeLaunchTemplate bytedanceCreativeLaunchTemplate) {
+        Result<BytedanceCreativeLaunchTemplate> result = new Result<>();
+        BytedanceCreativeLaunchTemplate bytedanceCreativeLaunchTemplateEntity = bytedanceCreativeLaunchTemplateService.getById(bytedanceCreativeLaunchTemplate.getId());
+        if (bytedanceCreativeLaunchTemplateEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = bytedanceCreativeLaunchTemplateService.updateById(bytedanceCreativeLaunchTemplate);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "创意模板-通过id删除")
+    @ApiOperation(value = "创意模板-通过id删除", notes = "创意模板-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            bytedanceCreativeLaunchTemplateService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "创意模板-批量删除")
+    @ApiOperation(value = "创意模板-批量删除", notes = "创意模板-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<BytedanceCreativeLaunchTemplate> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<BytedanceCreativeLaunchTemplate> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.bytedanceCreativeLaunchTemplateService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "创意模板-通过id查询")
+    @ApiOperation(value = "创意模板-通过id查询", notes = "创意模板-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<BytedanceCreativeLaunchTemplate> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<BytedanceCreativeLaunchTemplate> result = new Result<>();
+        BytedanceCreativeLaunchTemplate bytedanceCreativeLaunchTemplate = bytedanceCreativeLaunchTemplateService.getById(id);
+        if (bytedanceCreativeLaunchTemplate == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(bytedanceCreativeLaunchTemplate);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<BytedanceCreativeLaunchTemplate> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                BytedanceCreativeLaunchTemplate bytedanceCreativeLaunchTemplate = JSON.parseObject(deString, BytedanceCreativeLaunchTemplate.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(bytedanceCreativeLaunchTemplate, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<BytedanceCreativeLaunchTemplate> pageList = bytedanceCreativeLaunchTemplateService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "创意模板列表");
+        mv.addObject(NormalExcelConstants.CLASS, BytedanceCreativeLaunchTemplate.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("创意模板列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<BytedanceCreativeLaunchTemplate> listBytedanceCreativeLaunchTemplates = ExcelImportUtil.importExcel(file.getInputStream(), BytedanceCreativeLaunchTemplate.class, params);
+                bytedanceCreativeLaunchTemplateService.saveBatch(listBytedanceCreativeLaunchTemplates);
+                return Result.ok("文件导入成功!数据行数:" + listBytedanceCreativeLaunchTemplates.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

+ 63 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/entity/BytedanceAppDownloadDetailPage.java

@@ -0,0 +1,63 @@
+package cn.com.ctop.toutiao.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 应用下载详情页信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-09-27
+ */
+@Data
+@TableName("ctop_bytedance_app_download_detail_page")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_bytedance_app_download_detail_page对象", description = "应用下载详情页信息")
+public class BytedanceAppDownloadDetailPage {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * name
+     */
+    @Excel(name = "name", width = 15)
+    @ApiModelProperty(value = "name")
+    private String name;
+    /**
+     * 应用下载链接
+     */
+    @Excel(name = "应用下载链接", width = 15)
+    @ApiModelProperty(value = "应用下载链接")
+    private String downloadUrl;
+    /**
+     * 应用名
+     */
+    @Excel(name = "应用名", width = 15)
+    @ApiModelProperty(value = "应用名")
+    private String appName;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 106 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/entity/BytedanceCreativeLaunchTemplate.java

@@ -0,0 +1,106 @@
+package cn.com.ctop.toutiao.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 创意模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-09-27
+ */
+@Data
+@TableName("ctop_bytedance_creative_launch_template")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_bytedance_creative_launch_template对象", description = "创意模板")
+public class BytedanceCreativeLaunchTemplate {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 模板名称
+     */
+    @Excel(name = "模板名称", width = 15)
+    @ApiModelProperty(value = "模板名称")
+    private String name;
+    /**
+     * 是否关闭评论
+     */
+    @Excel(name = "是否关闭评论", width = 15)
+    @ApiModelProperty(value = "是否关闭评论")
+    private Integer commentDisable;
+    /**
+     * 是否关闭视频详情页落地页
+     */
+    @Excel(name = "是否关闭视频详情页落地页", width = 15)
+    @ApiModelProperty(value = "是否关闭视频详情页落地页")
+    private Integer closeVideoDetail;
+    /**
+     * 创意展现方式
+     */
+    @Excel(name = "创意展现方式", width = 15)
+    @ApiModelProperty(value = "创意展现方式")
+    private String creativeDisplayMode;
+    /**
+     * 是否使用优选广告位
+     */
+    @Excel(name = "是否使用优选广告位", width = 15)
+    @ApiModelProperty(value = "是否使用优选广告位")
+    private Integer smartInventory;
+    /**
+     * 场景广告位
+     */
+    @Excel(name = "场景广告位", width = 15)
+    @ApiModelProperty(value = "场景广告位")
+    private String sceneInventory;
+    /**
+     * 是否开启衍生计划
+     */
+    @Excel(name = "是否开启衍生计划", width = 15)
+    @ApiModelProperty(value = "是否开启衍生计划")
+    private String generateDerivedAd;
+    /**
+     * 创意投放位置
+     */
+    @Excel(name = "创意投放位置", width = 15)
+    @ApiModelProperty(value = "创意投放位置")
+    private String inventoryType;
+    /**
+     * 创意分类
+     */
+    @Excel(name = "创意分类", width = 100)
+    @ApiModelProperty(value = "创意分类")
+    private String thirdIndustryId;
+
+    @Excel(name = "创建时间")
+    @ApiModelProperty(value = "创建时间")
+    private String createTime;
+
+    @Excel(name = "修改时间")
+    @ApiModelProperty(value = "修改时间")
+    private String updateTime;
+
+    @Excel(name = "创意标签")
+    @ApiModelProperty(value = "创意标签")
+    private String adKeywords;
+
+    private String userId;
+
+    @Excel(name = "广告位置")
+    @ApiModelProperty(value = "广告位置")
+    private String advertiseLocation;
+
+}

+ 15 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/BytedanceAppDownloadDetailPageMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.toutiao.mapper;
+
+import cn.com.ctop.toutiao.entity.BytedanceAppDownloadDetailPage;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 应用下载详情页信息
+ *
+ * @author: jeecg-boot
+ * @date: 2019-09-27
+ * @cersion: V1.0
+ */
+public interface BytedanceAppDownloadDetailPageMapper extends BaseMapper<BytedanceAppDownloadDetailPage> {
+
+}

+ 15 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/BytedanceCreativeLaunchTemplateMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.toutiao.mapper;
+
+import cn.com.ctop.toutiao.entity.BytedanceCreativeLaunchTemplate;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 创意模板
+ *
+ * @author: jeecg-boot
+ * @date: 2019-09-27
+ * @cersion: V1.0
+ */
+public interface BytedanceCreativeLaunchTemplateMapper extends BaseMapper<BytedanceCreativeLaunchTemplate> {
+
+}

+ 5 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/xml/BytedanceAppDownloadDetailPageMapper.xml

@@ -0,0 +1,5 @@
+<?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.toutiao.mapper.BytedanceAppDownloadDetailPageMapper">
+
+</mapper>

+ 5 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/xml/BytedanceCreativeLaunchTemplateMapper.xml

@@ -0,0 +1,5 @@
+<?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.toutiao.mapper.BytedanceCreativeLaunchTemplateMapper">
+
+</mapper>

+ 2 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/IByteDanceCreativeService.java

@@ -17,4 +17,6 @@ public interface IByteDanceCreativeService extends IService<ByteDanceCreative> {
     Map<String, Object> creativeCreate(String accountId, Long campaignId, String dataString);
 
     Map<String, Object> insertBatch(JSONObject template);
+
+    JSONObject createCreative(JSONObject data, String token);
 }

+ 15 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/IBytedanceAppDownloadDetailPageService.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.toutiao.service;
+
+import cn.com.ctop.toutiao.entity.BytedanceAppDownloadDetailPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 应用下载详情页信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-09-27
+ */
+public interface IBytedanceAppDownloadDetailPageService extends IService<BytedanceAppDownloadDetailPage> {
+
+}

+ 15 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/IBytedanceCreativeLaunchTemplateService.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.toutiao.service;
+
+import cn.com.ctop.toutiao.entity.BytedanceCreativeLaunchTemplate;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 创意模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-09-27
+ */
+public interface IBytedanceCreativeLaunchTemplateService extends IService<BytedanceCreativeLaunchTemplate> {
+
+}

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertisePlanServiceImpl.java

@@ -93,7 +93,7 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
 
     private Map<String, Object> getAdConvertByUrlInfo(CtopOauthToken token, BytedanceUrlInfo urlInfo) {
 
-        final Long advertiserId = token.getAccountId();
+        Long advertiserId = token.getAccountId();
         // 请求地址
         String url = "https://ad.toutiao.com/open_api/2/tools/ad_convert/select/";
         // 请求参数

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceCreativeServiceImpl.java

@@ -254,7 +254,7 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
                 //创意标题
                 data.put("title", name + "_" + i + "_" + System.currentTimeMillis());
 
-                resultMap = creativeCreate(getAccountId, planId, data.toJSONString());
+                resultMap = this.creativeCreate(getAccountId, planId, data.toJSONString());
                 createSuccess = (Boolean) resultMap.get("success");
                 if (null != createSuccess && !createSuccess) {
                     return resultMap;
@@ -265,7 +265,7 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
         return resultMap;
     }
 
-
+    @Override
     public JSONObject createCreative(JSONObject data, String token) {
         // 构造请求
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_create_v2");

+ 19 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/BytedanceAppDownloadDetailPageServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.toutiao.service.impl;
+
+import cn.com.ctop.toutiao.entity.BytedanceAppDownloadDetailPage;
+import cn.com.ctop.toutiao.mapper.BytedanceAppDownloadDetailPageMapper;
+import cn.com.ctop.toutiao.service.IBytedanceAppDownloadDetailPageService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 应用下载详情页信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-09-27
+ */
+@Service
+public class BytedanceAppDownloadDetailPageServiceImpl extends ServiceImpl<BytedanceAppDownloadDetailPageMapper, BytedanceAppDownloadDetailPage> implements IBytedanceAppDownloadDetailPageService {
+
+}

+ 19 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/BytedanceCreativeLaunchTemplateServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.toutiao.service.impl;
+
+import cn.com.ctop.toutiao.entity.BytedanceCreativeLaunchTemplate;
+import cn.com.ctop.toutiao.mapper.BytedanceCreativeLaunchTemplateMapper;
+import cn.com.ctop.toutiao.service.IBytedanceCreativeLaunchTemplateService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 创意模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2019-09-27
+ */
+@Service
+public class BytedanceCreativeLaunchTemplateServiceImpl extends ServiceImpl<BytedanceCreativeLaunchTemplateMapper, BytedanceCreativeLaunchTemplate> implements IBytedanceCreativeLaunchTemplateService {
+
+}