浏览代码

修改代码逻辑

syh 5 年之前
父节点
当前提交
804d7ab5a9
共有 25 个文件被更改,包括 1029 次插入56 次删除
  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. 132 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java
  7. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IBindAccountLoginService.java
  8. 7 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/BindAccountLoginServiceImpl.java
  9. 2 1
      module-common/src/main/java/cn/com/ctop/common/module/utils/StatusCode.java
  10. 18 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/StringUtils.java
  11. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  12. 260 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/controller/BytedanceAppDownloadDetailPageController.java
  13. 254 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/controller/BytedanceCreativeLaunchTemplateController.java
  14. 63 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/entity/BytedanceAppDownloadDetailPage.java
  15. 106 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/entity/BytedanceCreativeLaunchTemplate.java
  16. 15 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/BytedanceAppDownloadDetailPageMapper.java
  17. 15 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/BytedanceCreativeLaunchTemplateMapper.java
  18. 5 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/xml/BytedanceAppDownloadDetailPageMapper.xml
  19. 5 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/xml/BytedanceCreativeLaunchTemplateMapper.xml
  20. 2 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/IByteDanceCreativeService.java
  21. 15 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/IBytedanceAppDownloadDetailPageService.java
  22. 15 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/IBytedanceCreativeLaunchTemplateService.java
  23. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceCreativeServiceImpl.java
  24. 19 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/BytedanceAppDownloadDetailPageServiceImpl.java
  25. 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

@@ -61,7 +61,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:查询所有
+    }
+}

+ 132 - 10
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
@@ -144,7 +152,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();
             }
@@ -190,11 +197,16 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
         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;
+        }
         String url = "https://ad.oceanengine.com/pages/login/index.html";
         System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
         ChromeOptions chromeOptions = new ChromeOptions();
@@ -308,6 +320,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                 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++) {
@@ -412,20 +425,120 @@ 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.parseObject(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) k;
+                                        JSONObject setCreatetive = new JSONObject();
+                                        String imageMode = createtive.getString("typeCode");
+                                        setCreatetive.put("image_mode", imageMode);
+                                        setCreatetive.put("title", createtive.getString("text"));
+                                        //TODO 添加动态词包id
+                                        if ("CREATIVE_IMAGE_MODE_VIDEO".equals(imageMode) || "CREATIVE_IMAGE_MODE_VIDEO_VERTICAL".equals(imageMode)) {
+                                            //视频创意
+                                            String videoUrl = createtive.getString("vadioUrl");
+                                            String imageUrl = createtive.getString("imageUrl");
+                                            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 {
+                                            //图片创意
+                                            String imageUrl = requestJson.getString("imageUrl");
+                                            if (null != imageUrl && !"".equals(imageUrl.trim())) {
+                                                Map<String, Object> getImageResult = fileInfoService.uploadImageToBytedance(token.getAccountId() + "", imageUrl);
+                                                JSONArray imageArray = (JSONArray) getImageResult.get("imageIds");
+                                                setCreatetive.put("image_ids", imageArray);
+                                                creatives.add(setCreatetive);
+                                            }
+                                        }
+                                    });
+                                    data.put("creatives", creatives);
+                                }
+                            } else {
+                                //程序化创意
+                                JSONArray titleArray = requestJson.getJSONArray("titles");
+                                if (null != titleArray && titleArray.size() > 0) {
+                                    JSONArray setTitleArray = new JSONArray();
+                                    titleArray.forEach(v -> {
+                                        JSONObject getTitleObject = (JSONObject) v;
+                                        JSONObject titleObject = new JSONObject();
+                                        String getTitle = getTitleObject.getString("text");
+                                        titleObject.put("title", getTitle);
+                                        ArrayList<String> wordsString = StringUtils.stringCutFromBrace(getTitle);
+                                        fileInfoService.getCreativeWords(accountId);
+                                        titleArray.add(titleObject);
+                                    });
+                                }
                             }
+                            //应用下载详情页
+                            data.put("web_url", requestJson.getString("webUrl"));
+                            //应用名
+                            data.put("app_name", requestJson.getString("appName"));
+                        }
+                        resultMap = byteDanceCreativeService.creativeCreate(token.getAccountId() + "", adId, data.toJSONString());
+                        Boolean createSuccess = (Boolean) resultMap.get("success");
+                        if (null != createSuccess && !createSuccess) {
+                            return resultMap;
                         }
                     }
                 }
@@ -443,6 +556,15 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
         return resultMap;
     }
 
+
+    @Autowired
+    private BytedanceCreativeLaunchTemplateMapper launchTemplateMapper;
+    @Autowired
+    private IByteDanceCreativeService byteDanceCreativeService;
+    @Autowired
+    private IFileInfoService fileInfoService;
+
+
     @Autowired
     private ByteDanceUserOrientationTemplateMapper userOrientationTemplateMapper;
     @Autowired

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

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

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

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