syh %!s(int64=5) %!d(string=hai) anos
pai
achega
f8674909de
Modificáronse 22 ficheiros con 1122 adicións e 18 borrados
  1. 1 1
      .gitignore
  2. 6 0
      jeecg-boot-module-system/pom.xml
  3. 3 13
      jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java
  4. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceTemplateController.java
  5. 253 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BytedanceNameModelRuleController.java
  6. 4 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java
  7. 34 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  8. 144 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/crawler/WxAccountCrawler.java
  9. 66 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BytedanceNameModelRule.java
  10. 17 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/BytedanceNameModelRuleMapper.java
  11. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/BytedanceNameModelRuleMapper.xml
  12. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IByteDanceCampaignTemplateService.java
  13. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IBytedanceNameModelRuleService.java
  14. 23 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceCampaignTemplateServiceImpl.java
  15. 19 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BytedanceNameModelRuleServiceImpl.java
  16. 173 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/BytedanceNameModelRuleList.vue
  17. 138 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/BytedanceNameModelRuleModal.vue
  18. 145 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/BytedanceNameModelRuleModal__Style#Drawer.vue
  19. 4 0
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  20. 4 0
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  21. 56 0
      module-common/src/main/java/cn/com/ctop/common/utils/HttpUtils.java
  22. 6 0
      pom.xml

+ 1 - 1
.gitignore

@@ -32,4 +32,4 @@ gen
 # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
 hs_err_pid*
 **/target/
-#application-dev.yml
+application.yml

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

@@ -58,6 +58,12 @@
             <artifactId>aliyun-sdk-oss</artifactId>
             <version>3.5.0</version>
         </dependency>
+
+        <dependency>
+            <groupId>cn.edu.hfut.dmic.webcollector</groupId>
+            <artifactId>WebCollector</artifactId>
+            <version>2.52</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 3 - 13
jeecg-boot-module-system/src/main/java/org/jeecg/JeecgApplication.java

@@ -1,10 +1,11 @@
 package org.jeecg;
 
 import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.web.servlet.MultipartConfigFactory;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
@@ -13,7 +14,6 @@ import org.springframework.core.env.Environment;
 import org.springframework.web.client.RestTemplate;
 import springfox.documentation.swagger2.annotations.EnableSwagger2;
 
-import javax.servlet.MultipartConfigElement;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 
@@ -27,10 +27,8 @@ import java.net.UnknownHostException;
 
 
 public class JeecgApplication {
-
+    Logger logger = LoggerFactory.getLogger(JeecgApplication.class);
     public static void main(String[] args) throws UnknownHostException {
-        //System.setProperty("spring.devtools.restart.enabled", "true");
-
         ConfigurableApplicationContext application = SpringApplication.run(JeecgApplication.class, args);
         Environment env = application.getEnvironment();
         String ip = InetAddress.getLocalHost().getHostAddress();
@@ -49,14 +47,6 @@ public class JeecgApplication {
     }
 
     @Bean
-    public MultipartConfigElement multipartConfigElement() {
-        MultipartConfigFactory factory = new MultipartConfigFactory();
-        factory.setMaxFileSize("10240000KB");
-        factory.setMaxRequestSize("102400000KB");
-        return factory.createMultipartConfig();
-    }
-
-    @Bean
     public RestTemplate restTemplate() {
         return new RestTemplate();
     }

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

@@ -35,6 +35,11 @@ public class ByteDanceTemplateController {
         return campaignTemplateService.insertTemplate(template);
     }
 
+    @GetMapping("cover/suggest")
+    public Map<String, Object> suggestCover(String accountId, String videoId) {
+        return campaignTemplateService.getSuggestCover(accountId, videoId);
+    }
+
     /**
      * 预算与出价模板
      *

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

@@ -0,0 +1,253 @@
+package org.jeecg.modules.ctop.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.ctop.entity.BytedanceNameModelRule;
+import org.jeecg.modules.ctop.service.IBytedanceNameModelRuleService;
+
+import java.util.Date;
+
+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.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 com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * @Description: 名称生成规则模板信息
+ * @Author: jeecg-boot
+ * @Date: 2019-08-15
+ * @Version: V1.0
+ */
+@Slf4j
+@Api(tags = "名称生成规则模板信息")
+@RestController
+@RequestMapping("/ctop/bytedanceNameModelRule")
+public class BytedanceNameModelRuleController {
+    @Autowired
+    private IBytedanceNameModelRuleService bytedanceNameModelRuleService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param bytedanceNameModelRule
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "名称生成规则模板信息-分页列表查询")
+    @ApiOperation(value = "名称生成规则模板信息-分页列表查询", notes = "名称生成规则模板信息-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<BytedanceNameModelRule>> queryPageList(BytedanceNameModelRule bytedanceNameModelRule,
+                                                               @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                               @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                               HttpServletRequest req) {
+        Result<IPage<BytedanceNameModelRule>> result = new Result<IPage<BytedanceNameModelRule>>();
+        QueryWrapper<BytedanceNameModelRule> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceNameModelRule, req.getParameterMap());
+        Page<BytedanceNameModelRule> page = new Page<BytedanceNameModelRule>(pageNo, pageSize);
+        IPage<BytedanceNameModelRule> pageList = bytedanceNameModelRuleService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param bytedanceNameModelRule
+     * @return
+     */
+    @AutoLog(value = "名称生成规则模板信息-添加")
+    @ApiOperation(value = "名称生成规则模板信息-添加", notes = "名称生成规则模板信息-添加")
+    @PostMapping(value = "/add")
+    public Result<BytedanceNameModelRule> add(@RequestBody BytedanceNameModelRule bytedanceNameModelRule) {
+        Result<BytedanceNameModelRule> result = new Result<BytedanceNameModelRule>();
+        try {
+            bytedanceNameModelRuleService.save(bytedanceNameModelRule);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param bytedanceNameModelRule
+     * @return
+     */
+    @AutoLog(value = "名称生成规则模板信息-编辑")
+    @ApiOperation(value = "名称生成规则模板信息-编辑", notes = "名称生成规则模板信息-编辑")
+    @PutMapping(value = "/edit")
+    public Result<BytedanceNameModelRule> edit(@RequestBody BytedanceNameModelRule bytedanceNameModelRule) {
+        Result<BytedanceNameModelRule> result = new Result<BytedanceNameModelRule>();
+        BytedanceNameModelRule bytedanceNameModelRuleEntity = bytedanceNameModelRuleService.getById(bytedanceNameModelRule.getId());
+        if (bytedanceNameModelRuleEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = bytedanceNameModelRuleService.updateById(bytedanceNameModelRule);
+            //TODO 返回false说明什么?
+            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 {
+            bytedanceNameModelRuleService.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<BytedanceNameModelRule> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<BytedanceNameModelRule> result = new Result<BytedanceNameModelRule>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.bytedanceNameModelRuleService.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<BytedanceNameModelRule> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<BytedanceNameModelRule> result = new Result<BytedanceNameModelRule>();
+        BytedanceNameModelRule bytedanceNameModelRule = bytedanceNameModelRuleService.getById(id);
+        if (bytedanceNameModelRule == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(bytedanceNameModelRule);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<BytedanceNameModelRule> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                BytedanceNameModelRule bytedanceNameModelRule = JSON.parseObject(deString, BytedanceNameModelRule.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(bytedanceNameModelRule, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<BytedanceNameModelRule> pageList = bytedanceNameModelRuleService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "名称生成规则模板信息列表");
+        mv.addObject(NormalExcelConstants.CLASS, BytedanceNameModelRule.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<BytedanceNameModelRule> listBytedanceNameModelRules = ExcelImportUtil.importExcel(file.getInputStream(), BytedanceNameModelRule.class, params);
+                bytedanceNameModelRuleService.saveBatch(listBytedanceNameModelRules);
+                return Result.ok("文件导入成功!数据行数:" + listBytedanceNameModelRules.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("文件导入失败!");
+    }
+
+}

+ 4 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java

@@ -116,12 +116,12 @@ public class CallbackController {
                     cTopOauthTokenMapper.insert(topOauthToken);
                     bindAccountAuthService.addBindAccount(accountId, KuaishouInterfaceConstant.LOGIN_TYPE_KUAISHOU, advertiser_id); //账号绑定
                 }
-                return "auth_success";
+                return "授权绑定成功";
             }
         } catch (Exception e) {
             e.printStackTrace();
         }
-        return "auth_fail";
+        return "授权绑定失败!";
     }
 
 
@@ -136,10 +136,10 @@ public class CallbackController {
             Map<String, Object> map = this.getByteDanceAccessToken(authCode, state);
             Integer code = (Integer) map.get("code");
             if (code == 0) {
-                return "auth_success";
+                return "授权绑定成功";
             }
         }
-        return "auth_fail";
+        return "授权绑定失败";
     }
 
     @Autowired

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

@@ -1,12 +1,22 @@
 package org.jeecg.modules.ctop.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.modules.ctop.service.ICreateInternalService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+
 @RestController
 @RequestMapping("/test")
 public class TestController {
@@ -19,4 +29,28 @@ public class TestController {
         System.err.println(json);
         createInternalService.createInternal(json);
     }
+
+    public static void main(String[] args) throws Exception {
+        File f = new File("D:\\upload\\excel\\template.xlsx");
+        InputStream inputStream = new FileInputStream(f);
+        XSSFWorkbook xssfWorkbook = new XSSFWorkbook(inputStream);
+//        //获取第一个sheet
+        XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(0);
+        for (int i = 1; i < 6; i++) {
+            System.out.println("i:" + i);
+            Row row = xssfSheet.getRow(i);
+            for (int j = 1; j < 4; j++) {
+                Cell cell = row.createCell(j);
+                if (j == 3) {
+                    cell.setCellType(XSSFCell.CELL_TYPE_FORMULA);
+                    cell.setCellFormula("B2*C2");
+                } else {
+                    cell.setCellValue(i);
+                }
+            }
+        }
+        FileOutputStream fileOutputStream = new FileOutputStream("D:\\upload\\excel\\get.xlsx");
+        xssfWorkbook.write(fileOutputStream);
+        fileOutputStream.close();
+    }
 }

+ 144 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/crawler/WxAccountCrawler.java

@@ -0,0 +1,144 @@
+//package org.jeecg.modules.ctop.crawler;
+//
+//import cn.edu.hfut.dmic.webcollector.model.CrawlDatum;
+//import cn.edu.hfut.dmic.webcollector.model.CrawlDatums;
+//import cn.edu.hfut.dmic.webcollector.model.Page;
+//import cn.edu.hfut.dmic.webcollector.plugin.berkeley.BreadthCrawler;
+//
+//import cn.edu.hfut.dmic.webcollector.plugin.nextfilter.HashSetNextFilter;
+//import com.alibaba.fastjson.JSONArray;
+//import com.alibaba.fastjson.JSONObject;
+//import org.jsoup.nodes.Element;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//
+//import java.io.*;
+//import java.net.URLEncoder;
+//
+//public class WxAccountCrawler extends BreadthCrawler {
+//    public static final Logger LOG = LoggerFactory.getLogger(WxAccountCrawler.class);
+//
+//    protected String historyKeysPath;
+//    protected BufferedWriter historyKeysWriter;
+//
+//    public WxAccountCrawler(String crawlPath, String historyKeysPath) throws Exception {
+//        super(crawlPath, false);
+//        this.historyKeysPath = historyKeysPath;
+//        LOG.info("initializing history-keys-filter ......");
+//        this.setNextFilter(new HistoryKeysFilter(historyKeysPath));
+//        LOG.info("creating history-keys-writer");
+//        historyKeysWriter = new BufferedWriter(new OutputStreamWriter(
+//                new FileOutputStream(historyKeysPath, true), "utf-8"));
+//
+//    }
+//
+//    @Override
+//    public void visit(Page page, CrawlDatums next) {
+//        String account = page.meta("account");
+//
+//        if (page.matchType("account_search")) {
+//            //对于账号搜索页面
+//
+//            //抽取公众号文章列表页URL
+//            Element accountLinkEle = page.select("p.tit>a").first();
+//            //防止搜索结果为空
+//            if (accountLinkEle == null) {
+//                LOG.info("公众号\"" + account + "\"不存在,请给出准确的公众号名");
+//                return;
+//            }
+//            //防止公众号名错误
+//            String detectedAccount = accountLinkEle.text().trim();
+//            if (!account.equals(detectedAccount)) {
+//                LOG.info("公众号\"" + account + "\"与搜索结果\"" + detectedAccount + "\"名称不符,请给出准确的公众号名");
+//                return;
+//            }
+//            String accountUrl = accountLinkEle.attr("abs:href");
+//            next.add(new CrawlDatum(accountUrl, "article_list").meta("account", account));
+//
+//        } else if (page.matchType("article_list")) {
+//            //对于公众号文章列表页
+//
+//            String prefix = "msgList = ";
+//            String suffix = "seajs.use";
+//            int startIndex = page.html().indexOf(prefix) + prefix.length();
+//            int endIndex = page.html().indexOf(suffix);
+//            String jsonStr = page.html().substring(startIndex, endIndex);
+//            JSONObject json = JSONObject.parseObject(jsonStr);
+//            JSONArray articleJSONArray = json.getJSONArray("list");
+//            for (int i = 0; i < articleJSONArray.size(); i++) {
+//                JSONObject articleJSON = articleJSONArray.getJSONObject(i).getJSONObject("app_msg_ext_info");
+//                String title = articleJSON.getString("title").trim();
+//                String key = account + "_" + title;
+//                String articleUrl = "http://mp.weixin.qq.com" + articleJSON.getString("content_url").replace("&", "&");
+//                next.add(new CrawlDatum(articleUrl, "article").key(key).meta("account", account));
+//            }
+//
+//        } else if (page.matchType("article")) {
+//            //对于文章页
+//            //抽取标题、内容等信息,此处仅print少数信息作为参考
+//            String title = page.select("h2.rich_media_title").first().text().trim();
+//            String date = page.select("em#post-date").first().text().trim();
+//            String content = page.select("div.rich_media_content").first().text().trim();
+//
+//            try {
+//                writeHistoryKey(page.key());
+//                JSONObject articleJSON = new JSONObject();
+//                articleJSON.put("account", account);
+//                articleJSON.put("title", title);
+//                articleJSON.put("date", date);
+//                articleJSON.put("content", content);
+//                System.out.println(articleJSON);
+//            } catch (IOException ex) {
+//                LOG.info("writer exception", ex);
+//            }
+//
+//        }
+//    }
+//
+//    public synchronized void writeHistoryKey(String key) throws IOException {
+//        historyKeysWriter.write(key + "\n");
+//    }
+//
+//    @Override
+//    public void start(int depth) throws Exception {
+//        super.start(depth);
+//        //关闭文件,保存history keys
+//        historyKeysWriter.close();
+//        LOG.info("save history keys");
+//    }
+//
+//    public void addAccount(String account) throws UnsupportedEncodingException {
+//        String seedUrl = "http://weixin.sogou.com/weixin?type=1&"
+//                + "s_from=input&ie=utf8&query=" + URLEncoder.encode(account, "utf-8");
+//        CrawlDatum seed = new CrawlDatum(seedUrl, "account_search").meta("account", account);
+//        addSeed(seed);
+//    }
+//
+//    //该示例读取文件中的key进行文章去重
+//    //线上应用请老老实实用数据库
+//    public class HistoryKeysFilter extends HashSetNextFilter {
+//
+//        //读取历史文章标题,用于去重
+//        public HistoryKeysFilter(String historyKeysPath) throws Exception {
+//            File historyFile = new File(historyKeysPath);
+//            if (historyFile.exists()) {
+//                FileInputStream fis = new FileInputStream(historyKeysPath);
+//                BufferedReader reader = new BufferedReader(new InputStreamReader(fis, "utf-8"));
+//                String line;
+//                while ((line = reader.readLine()) != null) {
+//                    this.add(line);
+//                }
+//                reader.close();
+//            }
+//        }
+//    }
+//
+//    public static void main(String[] args) throws Exception {
+//        WxAccountCrawler crawler = new WxAccountCrawler("crawl_weixin", "wx_history.txt");
+//        crawler.addAccount("机器之心");
+//        crawler.addAccount("ZEALER订阅号");
+//        crawler.setThreads(5);
+//        crawler.start(10);
+//    }
+//
+//}

+ 66 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BytedanceNameModelRule.java

@@ -0,0 +1,66 @@
+package org.jeecg.modules.ctop.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * @Description: 名称生成规则模板信息
+ * @Author: jeecg-boot
+ * @Date: 2019-08-15
+ * @Version: V1.0
+ */
+@Data
+@TableName("ctop_bytedance_advertise_name_model_rule_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_bytedance_advertise_name_model_rule_info对象", description = "名称生成规则模板信息")
+public class BytedanceNameModelRule {
+
+    /**
+     * 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 String rule;
+    /**
+     * 模板状态信息
+     */
+    @Excel(name = "模板状态信息", width = 15)
+    @ApiModelProperty(value = "模板状态信息")
+    private Integer status;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 17 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/BytedanceNameModelRuleMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.ctop.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.ctop.entity.BytedanceNameModelRule;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: 名称生成规则模板信息
+ * @Author: jeecg-boot
+ * @Date: 2019-08-15
+ * @Version: V1.0
+ */
+public interface BytedanceNameModelRuleMapper extends BaseMapper<BytedanceNameModelRule> {
+
+}

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/BytedanceNameModelRuleMapper.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="org.jeecg.modules.ctop.mapper.BytedanceNameModelRuleMapper">
+
+</mapper>

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IByteDanceCampaignTemplateService.java

@@ -26,4 +26,6 @@ public interface IByteDanceCampaignTemplateService extends IService<ByteDanceCam
     Map<String, Object> campaignCreate(String getAccountId, Long campaignId, String getName);
 
     Map<String, Object> campaignCreate(String accountId, String campaignName, String budgetMode, Integer budget, String landingType);
+
+    Map<String, Object> getSuggestCover(String accountId, String videoId);
 }

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

@@ -0,0 +1,14 @@
+package org.jeecg.modules.ctop.service;
+
+import org.jeecg.modules.ctop.entity.BytedanceNameModelRule;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 名称生成规则模板信息
+ * @Author: jeecg-boot
+ * @Date: 2019-08-15
+ * @Version: V1.0
+ */
+public interface IBytedanceNameModelRuleService extends IService<BytedanceNameModelRule> {
+
+}

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

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.service.impl;
 
+import cn.com.ctop.common.utils.HttpUtils;
 import cn.com.ctop.common.utils.PropertiesUtils;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -8,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.entity.ContentType;
 import org.apache.http.entity.StringEntity;
@@ -35,6 +37,7 @@ import javax.servlet.http.HttpServletRequest;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.net.URI;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
@@ -128,6 +131,26 @@ public class ByteDanceCampaignTemplateServiceImpl extends ServiceImpl<ByteDanceC
     }
 
     @Override
+    public Map<String, Object> getSuggestCover(String accountId, String videoId) {
+        CTopOauthToken token = tokenService.getOAuthTokenByAccountId(accountId);
+        JSONObject result = suggestVideo(token, videoId);
+        return null;
+    }
+
+    public JSONObject suggestVideo(CTopOauthToken token, String videoId) {
+        // 请求地址
+        String url = "https://ad.toutiao.com/open_api/2/tools/video_cover/suggest/";
+        // 请求参数
+        Map data = new HashMap() {
+            {
+                put("advertiser_id", token.getAccountId());
+                put("video_id", videoId);
+            }
+        };
+        return HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, data);
+    }
+
+    @Override
     public Map<String, Object> campaignCreate(CTopOauthToken token, ByteDanceCampaignTemplate template) {
         Map<String, Object> resultMap = new HashMap<>();
         //2: 根据token以及用户id获取用户信息数据

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

@@ -0,0 +1,19 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import org.jeecg.modules.ctop.entity.BytedanceNameModelRule;
+import org.jeecg.modules.ctop.mapper.BytedanceNameModelRuleMapper;
+import org.jeecg.modules.ctop.service.IBytedanceNameModelRuleService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * @Description: 名称生成规则模板信息
+ * @Author: jeecg-boot
+ * @Date: 2019-08-15
+ * @Version: V1.0
+ */
+@Service
+public class BytedanceNameModelRuleServiceImpl extends ServiceImpl<BytedanceNameModelRuleMapper, BytedanceNameModelRule> implements IBytedanceNameModelRuleService {
+
+}

+ 173 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/BytedanceNameModelRuleList.vue

@@ -0,0 +1,173 @@
+<template>
+    <a-card :bordered="false">
+
+        <!-- 查询区域 -->
+        <div class="table-page-search-wrapper">
+            <a-form layout="inline">
+                <a-row :gutter="24">
+
+                    <a-col :md="6" :sm="8">
+                        <a-form-item label="模板名称">
+                            <a-input placeholder="请输入模板名称" v-model="queryParam.name"></a-input>
+                        </a-form-item>
+                    </a-col>
+                    <a-col :md="6" :sm="8">
+                        <a-form-item label="生成规格">
+                            <a-input placeholder="请输入生成规格" v-model="queryParam.rule"></a-input>
+                        </a-form-item>
+                    </a-col>
+                    <template v-if="toggleSearchStatus">
+                        <a-col :md="6" :sm="8">
+                            <a-form-item label="模板状态信息">
+                                <a-input placeholder="请输入模板状态信息" v-model="queryParam.status"></a-input>
+                            </a-form-item>
+                        </a-col>
+                    </template>
+                    <a-col :md="6" :sm="8">
+            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
+              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
+              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
+              <a @click="handleToggleSearch" style="margin-left: 8px">
+                {{ toggleSearchStatus ? '收起' : '展开' }}
+                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
+              </a>
+            </span>
+                    </a-col>
+
+                </a-row>
+            </a-form>
+        </div>
+
+        <!-- 操作按钮区域 -->
+        <div class="table-operator">
+            <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
+            <a-button type="primary" icon="download" @click="handleExportXls('名称生成规则模板信息')">导出</a-button>
+            <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader"
+                      :action="importExcelUrl" @change="handleImportExcel">
+                <a-button type="primary" icon="import">导入</a-button>
+            </a-upload>
+            <a-dropdown v-if="selectedRowKeys.length > 0">
+                <a-menu slot="overlay">
+                    <a-menu-item key="1" @click="batchDel">
+                        <a-icon type="delete"/>
+                        删除
+                    </a-menu-item>
+                </a-menu>
+                <a-button style="margin-left: 8px"> 批量操作
+                    <a-icon type="down"/>
+                </a-button>
+            </a-dropdown>
+        </div>
+
+        <!-- table区域-begin -->
+        <div>
+            <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
+                <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{
+                selectedRowKeys.length }}</a>项
+                <a style="margin-left: 24px" @click="onClearSelected">清空</a>
+            </div>
+
+            <a-table
+                    ref="table"
+                    size="middle"
+                    bordered
+                    rowKey="id"
+                    :columns="columns"
+                    :dataSource="dataSource"
+                    :pagination="ipagination"
+                    :loading="loading"
+                    :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
+                    @change="handleTableChange">
+
+        <span slot="action" slot-scope="text, record">
+          <a @click="handleEdit(record)">编辑</a>
+
+          <a-divider type="vertical"/>
+          <a-dropdown>
+            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
+            <a-menu slot="overlay">
+              <a-menu-item>
+                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
+                  <a>删除</a>
+                </a-popconfirm>
+              </a-menu-item>
+            </a-menu>
+          </a-dropdown>
+        </span>
+
+            </a-table>
+        </div>
+        <!-- table区域-end -->
+
+        <!-- 表单区域 -->
+        <bytedanceNameModelRule-modal ref="modalForm" @ok="modalFormOk"></bytedanceNameModelRule-modal>
+    </a-card>
+</template>
+
+<script>
+    import BytedanceNameModelRuleModal from './modules/BytedanceNameModelRuleModal'
+    import {JeecgListMixin} from '@/mixins/JeecgListMixin'
+
+    export default {
+        name: "BytedanceNameModelRuleList",
+        mixins: [JeecgListMixin],
+        components: {
+            BytedanceNameModelRuleModal
+        },
+        data() {
+            return {
+                description: '名称生成规则模板信息管理页面',
+                // 表头
+                columns: [
+                    {
+                        title: '#',
+                        dataIndex: '',
+                        key: 'rowIndex',
+                        width: 60,
+                        align: "center",
+                        customRender: function (t, r, index) {
+                            return parseInt(index) + 1;
+                        }
+                    },
+                    {
+                        title: '模板名称',
+                        align: "center",
+                        dataIndex: 'name'
+                    },
+                    {
+                        title: '生成规格',
+                        align: "center",
+                        dataIndex: 'rule'
+                    },
+                    {
+                        title: '模板状态信息',
+                        align: "center",
+                        dataIndex: 'status'
+                    },
+                    {
+                        title: '操作',
+                        dataIndex: 'action',
+                        align: "center",
+                        scopedSlots: {customRender: 'action'},
+                    }
+                ],
+                url: {
+                    list: "/ctop/bytedanceNameModelRule/list",
+                    delete: "/ctop/bytedanceNameModelRule/delete",
+                    deleteBatch: "/ctop/bytedanceNameModelRule/deleteBatch",
+                    exportXlsUrl: "ctop/bytedanceNameModelRule/exportXls",
+                    importExcelUrl: "ctop/bytedanceNameModelRule/importExcel",
+                },
+            }
+        },
+        computed: {
+            importExcelUrl: function () {
+                return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
+            }
+        },
+        methods: {}
+    }
+</script>
+<style scoped>
+    @import '~@assets/less/common.less'
+</style>

+ 138 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/BytedanceNameModelRuleModal.vue

@@ -0,0 +1,138 @@
+<template>
+    <a-modal
+            :title="title"
+            :width="800"
+            :visible="visible"
+            :confirmLoading="confirmLoading"
+            @ok="handleOk"
+            @cancel="handleCancel"
+            cancelText="关闭">
+
+        <a-spin :spinning="confirmLoading">
+            <a-form :form="form">
+
+                <a-form-item
+                        :labelCol="labelCol"
+                        :wrapperCol="wrapperCol"
+                        label="模板名称">
+                    <a-input placeholder="请输入模板名称" v-decorator="['name', validatorRules.name ]"/>
+                </a-form-item>
+                <a-form-item
+                        :labelCol="labelCol"
+                        :wrapperCol="wrapperCol"
+                        label="生成规格">
+                    <a-input placeholder="请输入生成规格" v-decorator="['rule', validatorRules.rule ]"/>
+                </a-form-item>
+                <a-form-item
+                        :labelCol="labelCol"
+                        :wrapperCol="wrapperCol"
+                        label="模板状态信息">
+                    <a-input-number v-decorator="[ 'status', validatorRules.status ]"/>
+                </a-form-item>
+
+            </a-form>
+        </a-spin>
+    </a-modal>
+</template>
+
+<script>
+    import {httpAction} from '@/api/manage'
+    import pick from 'lodash.pick'
+    import moment from "moment"
+
+    export default {
+        name: "BytedanceNameModelRuleModal",
+        data() {
+            return {
+                title: "操作",
+                visible: false,
+                model: {},
+                labelCol: {
+                    xs: {span: 24},
+                    sm: {span: 5},
+                },
+                wrapperCol: {
+                    xs: {span: 24},
+                    sm: {span: 16},
+                },
+
+                confirmLoading: false,
+                form: this.$form.createForm(this),
+                validatorRules: {
+                    name: {rules: [{required: true, message: '请输入模板名称!'}]},
+                    rule: {rules: [{required: true, message: '请输入生成规格!'}]},
+                    status: {rules: [{required: true, message: '请输入模板状态信息!'}]},
+                },
+                url: {
+                    add: "/ctop/bytedanceNameModelRule/add",
+                    edit: "/ctop/bytedanceNameModelRule/edit",
+                },
+            }
+        },
+        created() {
+        },
+        methods: {
+            add() {
+                this.edit({});
+            },
+            edit(record) {
+                this.form.resetFields();
+                this.model = Object.assign({}, record);
+                this.visible = true;
+                this.$nextTick(() => {
+                    this.form.setFieldsValue(pick(this.model, 'name', 'rule', 'status'))
+                    //时间格式化
+                });
+
+            },
+            close() {
+                this.$emit('close');
+                this.visible = false;
+            },
+            handleOk() {
+                const that = this;
+                // 触发表单验证
+                this.form.validateFields((err, values) => {
+                    if (!err) {
+                        that.confirmLoading = true;
+                        let httpurl = '';
+                        let method = '';
+                        if (!this.model.id) {
+                            httpurl += this.url.add;
+                            method = 'post';
+                        } else {
+                            httpurl += this.url.edit;
+                            method = 'put';
+                        }
+                        let formData = Object.assign(this.model, values);
+                        //时间格式化
+
+                        console.log(formData)
+                        httpAction(httpurl, formData, method).then((res) => {
+                            if (res.success) {
+                                that.$message.success(res.message);
+                                that.$emit('ok');
+                            } else {
+                                that.$message.warning(res.message);
+                            }
+                        }).finally(() => {
+                            that.confirmLoading = false;
+                            that.close();
+                        })
+
+
+                    }
+                })
+            },
+            handleCancel() {
+                this.close()
+            },
+
+
+        }
+    }
+</script>
+
+<style lang="less" scoped>
+
+</style>

+ 145 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/vue/modules/BytedanceNameModelRuleModal__Style#Drawer.vue

@@ -0,0 +1,145 @@
+<template>
+    <a-drawer
+            :title="title"
+            :width="800"
+            placement="right"
+            :closable="false"
+            @close="close"
+            :visible="visible"
+    >
+
+        <a-spin :spinning="confirmLoading">
+            <a-form :form="form">
+
+                <a-form-item
+                        :labelCol="labelCol"
+                        :wrapperCol="wrapperCol"
+                        label="模板名称">
+                    <a-input placeholder="请输入模板名称" v-decorator="['name', validatorRules.name ]"/>
+                </a-form-item>
+                <a-form-item
+                        :labelCol="labelCol"
+                        :wrapperCol="wrapperCol"
+                        label="生成规格">
+                    <a-input placeholder="请输入生成规格" v-decorator="['rule', validatorRules.rule ]"/>
+                </a-form-item>
+                <a-form-item
+                        :labelCol="labelCol"
+                        :wrapperCol="wrapperCol"
+                        label="模板状态信息">
+                    <a-input-number v-decorator="[ 'status', validatorRules.status ]"/>
+                </a-form-item>
+
+            </a-form>
+        </a-spin>
+        <a-button type="primary" @click="handleOk">确定</a-button>
+        <a-button type="primary" @click="handleCancel">取消</a-button>
+    </a-drawer>
+</template>
+
+<script>
+    import {httpAction} from '@/api/manage'
+    import pick from 'lodash.pick'
+    import moment from "moment"
+
+    export default {
+        name: "BytedanceNameModelRuleModal",
+        data() {
+            return {
+                title: "操作",
+                visible: false,
+                model: {},
+                labelCol: {
+                    xs: {span: 24},
+                    sm: {span: 5},
+                },
+                wrapperCol: {
+                    xs: {span: 24},
+                    sm: {span: 16},
+                },
+
+                confirmLoading: false,
+                form: this.$form.createForm(this),
+                validatorRules: {
+                    name: {rules: [{required: true, message: '请输入模板名称!'}]},
+                    rule: {rules: [{required: true, message: '请输入生成规格!'}]},
+                    status: {rules: [{required: true, message: '请输入模板状态信息!'}]},
+                },
+                url: {
+                    add: "/ctop/bytedanceNameModelRule/add",
+                    edit: "/ctop/bytedanceNameModelRule/edit",
+                },
+            }
+        },
+        created() {
+        },
+        methods: {
+            add() {
+                this.edit({});
+            },
+            edit(record) {
+                this.form.resetFields();
+                this.model = Object.assign({}, record);
+                this.visible = true;
+                this.$nextTick(() => {
+                    this.form.setFieldsValue(pick(this.model, 'name', 'rule', 'status'))
+                    //时间格式化
+                });
+
+            },
+            close() {
+                this.$emit('close');
+                this.visible = false;
+            },
+            handleOk() {
+                const that = this;
+                // 触发表单验证
+                this.form.validateFields((err, values) => {
+                    if (!err) {
+                        that.confirmLoading = true;
+                        let httpurl = '';
+                        let method = '';
+                        if (!this.model.id) {
+                            httpurl += this.url.add;
+                            method = 'post';
+                        } else {
+                            httpurl += this.url.edit;
+                            method = 'put';
+                        }
+                        let formData = Object.assign(this.model, values);
+                        //时间格式化
+
+                        console.log(formData)
+                        httpAction(httpurl, formData, method).then((res) => {
+                            if (res.success) {
+                                that.$message.success(res.message);
+                                that.$emit('ok');
+                            } else {
+                                that.$message.warning(res.message);
+                            }
+                        }).finally(() => {
+                            that.confirmLoading = false;
+                            that.close();
+                        })
+
+
+                    }
+                })
+            },
+            handleCancel() {
+                this.close()
+            },
+
+
+        }
+    }
+</script>
+
+<style lang="less" scoped>
+    /** Button按钮间距 */
+    .ant-btn {
+        margin-left: 30px;
+        margin-bottom: 30px;
+        float: right;
+    }
+</style>

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

@@ -13,6 +13,10 @@ management:
         include: metrics,httptrace
 
 spring:
+  servlet:
+    multipart:
+      max-file-size: -1
+      max-request-size: -1
   mail:
     host: smtp.163.com
     username: jeecgos@163.com

+ 4 - 0
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -13,6 +13,10 @@ management:
         include: metrics,httptrace
 
 spring:
+  servlet:
+    multipart:
+      max-file-size: -1
+      max-request-size: -1
   mail:
     host: smtp.163.com
     username: jeecgos@163.com

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

@@ -10,30 +10,38 @@ import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
 import org.apache.http.NameValuePair;
+import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.CookieStore;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.config.CookieSpecs;
 import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
 import org.apache.http.conn.ssl.TrustStrategy;
 import org.apache.http.cookie.Cookie;
+import org.apache.http.entity.ContentType;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.BasicCookieStore;
 import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.message.BasicNameValuePair;
 import org.apache.http.ssl.SSLContextBuilder;
 import org.apache.http.util.EntityUtils;
 import org.eclipse.jetty.util.UrlEncoded;
+import org.omg.CORBA.OBJ_ADAPTER;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.net.ssl.SSLContext;
 import java.io.BufferedReader;
+import java.io.IOException;
 import java.io.InputStreamReader;
+import java.net.URI;
 import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLEncoder;
@@ -43,6 +51,54 @@ import java.security.cert.X509Certificate;
 import java.util.*;
 
 public class HttpUtils {
+
+    public static JSONObject bytedanceGetRequest(String accessToken, String url, Map<String, Object> params) {
+        // 构造请求
+        HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {
+            @Override
+            public String getMethod() {
+                return "GET";
+            }
+        };
+
+        httpEntity.setHeader("Access-Token", accessToken);
+
+        CloseableHttpResponse response = null;
+        CloseableHttpClient client = null;
+
+        try {
+            client = HttpClientBuilder.create().build();
+            httpEntity.setURI(URI.create(url));
+            httpEntity.setEntity(new StringEntity(JSONObject.toJSONString(params), ContentType.APPLICATION_JSON));
+
+            response = client.execute(httpEntity);
+            if (response != null && response.getStatusLine().getStatusCode() == 200) {
+                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
+                StringBuffer result = new StringBuffer();
+                String line = "";
+                while ((line = bufferedReader.readLine()) != null) {
+                    result.append(line);
+                }
+                bufferedReader.close();
+                return JSONObject.parseObject(result.toString());
+            }
+
+        } catch (ClientProtocolException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (response != null) {
+                    response.close();
+                }
+                client.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
     private static final Logger logger = LoggerFactory.getLogger(HttpUtils.class);
     public static CookieStore cookieStore = new BasicCookieStore();
     //.setProxy(new HttpHost("106.125.239.179", 4245))

+ 6 - 0
pom.xml

@@ -85,6 +85,12 @@
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>ch.qos.logback</groupId>
+                    <artifactId>logback-classic</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>