Parcourir la source

快手-批量创建

yumeng il y a 5 ans
Parent
commit
cb7c168d57
56 fichiers modifiés avec 3601 ajouts et 748 suppressions
  1. 96 0
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/LoadFileUtil.java
  2. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CTopOauthTokenServiceImpl.java
  3. 266 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouActionBarTextController.java
  4. 6 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouCampaignTemplateController.java
  5. 0 35
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouController.java
  6. 207 175
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouConversionTypesController.java
  7. 6 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouCreateAppTemplateController.java
  8. 78 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouCreateController.java
  9. 259 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouGroupCreateLogController.java
  10. 80 81
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouGroupCreateTemplateController.java
  11. 247 208
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouVideoController.java
  12. 55 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/entity/KuaiShouActionBarText.java
  13. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/entity/KuaiShouCreativeCreate.java
  14. 57 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/entity/KuaiShouGroupCreateTemplate.java
  15. 94 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/entity/KuaiShouImage.java
  16. 9 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/entity/KuaiShouVideo.java
  17. 17 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/mapper/KuaiShouActionBarTextMapper.java
  18. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/mapper/KuaiShouGroupCreateLogMapper.java
  19. 0 17
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/mapper/KuaiShouGroupCreateTemplateMapper.java
  20. 17 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/mapper/KuaiShouImageMapper.java
  21. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/mapper/KuaiShouVideoMapper.java
  22. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/mapper/xml/KuaiShouActionBarTextMapper.xml
  23. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/mapper/xml/KuaiShouGroupCreateLogMapper.xml
  24. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/mapper/xml/KuaiShouImageMapper.xml
  25. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaiShouActionBarTextService.java
  26. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaiShouCampaignCreateService.java
  27. 17 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaiShouCreateService.java
  28. 17 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaiShouGroupCreateLogService.java
  29. 0 17
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaiShouGroupCreateTemplateService.java
  30. 19 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaiShouImageService.java
  31. 4 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaiShouVideoService.java
  32. 11 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaishouInterfaceService.java
  33. 19 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaiShouActionBarTextServiceImpl.java
  34. 13 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaiShouCampaignCreateServiceImpl.java
  35. 430 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaiShouCreateServiceImpl.java
  36. 10 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaiShouGroupCreateTemplateServiceImpl.java
  37. 79 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaiShouImageServiceImpl.java
  38. 41 11
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaiShouVideoServiceImpl.java
  39. 292 129
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaishouInterfaceServiceImpl.java
  40. 157 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/KuaiShouActionBarTextList.vue
  41. 56 21
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/KuaiShouGroupCreateTemplateList.vue
  42. 188 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/KuaiShouImageList.vue
  43. 7 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/KuaiShouVideoList.vue
  44. 130 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/modules/KuaiShouActionBarTextModal.vue
  45. 137 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/modules/KuaiShouActionBarTextModal__Style#Drawer.vue
  46. 46 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/modules/KuaiShouGroupCreateTemplateModal.vue
  47. 46 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/modules/KuaiShouGroupCreateTemplateModal__Style#Drawer.vue
  48. 148 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/modules/KuaiShouImageModal.vue
  49. 155 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/modules/KuaiShouImageModal__Style#Drawer.vue
  50. 7 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/modules/KuaiShouVideoModal.vue
  51. 7 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/modules/KuaiShouVideoModal__Style#Drawer.vue
  52. 1 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/shiro/authc/ShiroRealm.java
  53. 12 0
      module-common/src/main/java/cn/com/ctop/common/utils/DateUtils.java
  54. 1 0
      module-common/src/main/java/cn/com/ctop/common/utils/HttpUtils.java
  55. 3 1
      module-kuaishou/src/main/java/constant/KuaishouInterfaceConstant.java
  56. 6 1
      module-kuaishou/src/main/resources/kuaishou_config.properties

+ 96 - 0
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/LoadFileUtil.java

@@ -0,0 +1,96 @@
+package org.jeecg.common.util;
+
+import org.jeecg.common.util.encryption.AesEncryptUtil;
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+public class LoadFileUtil {
+
+    public static void main(String[] args) {
+        try {
+            //  downLoadFromUrl("", "");
+
+            delFile("D:\\tets1\\app\\TEST视频-1565073368755.mp4");
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 上传文件
+     *
+     * @param urlStr
+     * @param savePath
+     * @return
+     * @throws IOException
+     */
+    public static String downLoadFromUrl(String urlStr, String savePath) throws IOException {
+        String fileName = AesEncryptUtil.getURLDecoderString(urlStr.substring(urlStr.lastIndexOf("/") + 1));
+        URL url = new URL(urlStr);
+        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+        //设置超时间为3秒
+        conn.setConnectTimeout(60 * 1000);
+        //防止屏蔽程序抓取而返回403错误
+        conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+        //得到输入流
+        InputStream inputStream = conn.getInputStream();
+        //获取自己数组
+        byte[] getData = readInputStream(inputStream);
+
+        //文件保存位置
+        File saveDir = new File(savePath);
+        if (!saveDir.exists()) {
+            saveDir.mkdir();
+        }
+        String localPath = saveDir + File.separator + fileName;
+        File file = new File(localPath);
+        FileOutputStream fos = new FileOutputStream(file);
+        fos.write(getData);
+        if (fos != null) {
+            fos.close();
+        }
+        if (inputStream != null) {
+            inputStream.close();
+        }
+        return localPath;
+
+
+    }
+
+    public static byte[] readInputStream(InputStream inputStream) throws IOException {
+        byte[] buffer = new byte[1024];
+        int len = 0;
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        while ((len = inputStream.read(buffer)) != -1) {
+            bos.write(buffer, 0, len);
+        }
+        bos.close();
+        return bos.toByteArray();
+    }
+
+
+    /**
+     * 删除文件
+     *
+     * @param path
+     * @return
+     */
+    public static boolean delFile(String path) {
+        boolean flag = false;
+        File file = new File(path);
+        if (!file.exists()) {
+            return flag;
+        }
+        try {
+            flag = file.delete();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return flag;
+    }
+
+
+}

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

@@ -38,6 +38,7 @@ public class CTopOauthTokenServiceImpl extends ServiceImpl<CTopOauthTokenMapper,
     public CTopOauthToken getOAuthTokenByAccountId(String accountId) {
         QueryWrapper<CTopOauthToken> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("account_id", accountId).orderByDesc("create_time");
+        queryWrapper.last("limit 1");
         CTopOauthToken cTopOauthToken = cTopOauthTokenMapper.selectOne(queryWrapper);
         return cTopOauthToken;
     }

+ 266 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouActionBarTextController.java

@@ -0,0 +1,266 @@
+package org.jeecg.modules.kuaishou.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 cn.com.ctop.common.utils.Check;
+import com.alibaba.fastjson.JSONObject;
+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.kuaishou.entity.KuaiShouActionBarText;
+import org.jeecg.modules.kuaishou.entity.KuaiShouCampaignCreate;
+import org.jeecg.modules.kuaishou.service.IKuaiShouActionBarTextService;
+
+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.jeecg.modules.kuaishou.service.IKuaiShouCampaignCreateService;
+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("/kuaishou/kuaiShouActionBarText")
+public class KuaiShouActionBarTextController {
+    @Autowired
+    private IKuaiShouActionBarTextService kuaiShouActionBarTextService;
+    @Autowired
+    private IKuaiShouCampaignCreateService campaignCreateService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaiShouActionBarText
+     * @param pageNo
+     * @param pageSize
+     * @return
+     */
+    @AutoLog(value = "快手-行动号召文案-分页列表查询")
+    @ApiOperation(value = "快手-行动号召文案-分页列表查询", notes = "快手-行动号召文案-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaiShouActionBarText>> queryPageList(KuaiShouActionBarText kuaiShouActionBarText,
+                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                              @RequestParam(name = "campaignId") String campaignId) {
+        Result<IPage<KuaiShouActionBarText>> result = new Result<IPage<KuaiShouActionBarText>>();
+        KuaiShouCampaignCreate campaignCreate = campaignCreateService.selectCampaignByCampaignId(campaignId);
+        if (!Check.isNull(campaignCreate)) {
+            QueryWrapper<KuaiShouActionBarText> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("type", campaignCreate.getType());
+            Page<KuaiShouActionBarText> page = new Page<KuaiShouActionBarText>(pageNo, pageSize);
+            IPage<KuaiShouActionBarText> pageList = kuaiShouActionBarTextService.page(page, queryWrapper);
+            result.setSuccess(true);
+            result.setResult(pageList);
+        } else {
+            result.setSuccess(false);
+            result.setMessage("未获取到广告计划信息");
+        }
+
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouActionBarText
+     * @return
+     */
+    @AutoLog(value = "快手-行动号召文案-添加")
+    @ApiOperation(value = "快手-行动号召文案-添加", notes = "快手-行动号召文案-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouActionBarText> add(@RequestBody KuaiShouActionBarText kuaiShouActionBarText) {
+        Result<KuaiShouActionBarText> result = new Result<KuaiShouActionBarText>();
+        try {
+            kuaiShouActionBarTextService.save(kuaiShouActionBarText);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouActionBarText
+     * @return
+     */
+    @AutoLog(value = "快手-行动号召文案-编辑")
+    @ApiOperation(value = "快手-行动号召文案-编辑", notes = "快手-行动号召文案-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouActionBarText> edit(@RequestBody KuaiShouActionBarText kuaiShouActionBarText) {
+        Result<KuaiShouActionBarText> result = new Result<KuaiShouActionBarText>();
+        KuaiShouActionBarText kuaiShouActionBarTextEntity = kuaiShouActionBarTextService.getById(kuaiShouActionBarText.getId());
+        if (kuaiShouActionBarTextEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouActionBarTextService.updateById(kuaiShouActionBarText);
+            //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 {
+            kuaiShouActionBarTextService.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<KuaiShouActionBarText> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaiShouActionBarText> result = new Result<KuaiShouActionBarText>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouActionBarTextService.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<KuaiShouActionBarText> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouActionBarText> result = new Result<KuaiShouActionBarText>();
+        KuaiShouActionBarText kuaiShouActionBarText = kuaiShouActionBarTextService.getById(id);
+        if (kuaiShouActionBarText == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouActionBarText);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouActionBarText> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouActionBarText kuaiShouActionBarText = JSON.parseObject(deString, KuaiShouActionBarText.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouActionBarText, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouActionBarText> pageList = kuaiShouActionBarTextService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "快手-行动号召文案列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouActionBarText.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<KuaiShouActionBarText> listKuaiShouActionBarTexts = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouActionBarText.class, params);
+                kuaiShouActionBarTextService.saveBatch(listKuaiShouActionBarTexts);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouActionBarTexts.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("文件导入失败!");
+    }
+
+}

+ 6 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouCampaignTemplateController.java

@@ -8,13 +8,16 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
+import org.apache.shiro.SecurityUtils;
 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.system.vo.LoginUser;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.kuaishou.entity.KuaiShouCampaignTemplate;
 import org.jeecg.modules.kuaishou.service.IKuaiShouCampaignTemplateService;
-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;
@@ -74,6 +77,8 @@ public class KuaiShouCampaignTemplateController {
 									  HttpServletRequest req) {
 		Result<IPage<KuaiShouCampaignTemplate>> result = new Result<IPage<KuaiShouCampaignTemplate>>();
 		QueryWrapper<KuaiShouCampaignTemplate> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouCampaignTemplate, req.getParameterMap());
+		LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+		queryWrapper.eq("login_id", user.getId());
 		Page<KuaiShouCampaignTemplate> page = new Page<KuaiShouCampaignTemplate>(pageNo, pageSize);
 		IPage<KuaiShouCampaignTemplate> pageList = kuaiShouCampaignTemplateService.page(page, queryWrapper);
 		result.setSuccess(true);

+ 0 - 35
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouController.java

@@ -112,13 +112,6 @@ public class KuaiShouController {
     }
 
 
-    @RequestMapping(value = "/video/upload", consumes = "multipart/form-data;charset=utf-8")
-    public void upload(@RequestParam("multipartFile") MultipartFile multipartFile, HttpServletRequest request) throws IOException {
-        String accessToken = "75d8c4291d275c73a00f8f60d821b6bd";
-        Long advertiserId = 23212L;
-        kuaishouInterfaceService.videoUpload(advertiserId, accessToken, multipartFile, request);
-
-    }
 
 
     @RequestMapping("/video/get")
@@ -177,34 +170,6 @@ public class KuaiShouController {
     }
 
 
-    @RequestMapping(value = "/image/upload", consumes = "multipart/form-data;charset=utf-8")
-    public void imgUpload(@RequestParam("multipartFile") MultipartFile multipartFile, HttpServletRequest request) throws IOException {
-
-        String accessToken = "360d43b49553684a011d6607322582b1";
-        Long advertiserId = 23212L;
-
-        kuaishouInterfaceService.imageUpload(advertiserId, accessToken, multipartFile, request);
-
-    }
-
-
-    @RequestMapping(value = "/app/create", consumes = "multipart/form-data;charset=utf-8")
-    public void appCreate(@RequestParam("multipartFile") MultipartFile multipartFile, HttpServletRequest request) throws IOException {
-
-        String accessToken = "360d43b49553684a011d6607322582b1";
-        Long advertiserId = 23212L;
-
-        JSONObject requestJson = new JSONObject();
-        requestJson.put("app_version", "2.3.6");
-        requestJson.put("app_name", "微信开发1");
-        requestJson.put("image_token", "market81dd2187353e4cb19918b61276797ce5.jpg");
-        requestJson.put("advertiser_id", advertiserId);
-        requestJson.put("package_name", "2");
-        requestJson.put("platform", 1);
-        kuaishouInterfaceService.appCreate(advertiserId, accessToken, multipartFile, request, requestJson);
-
-    }
-
     @RequestMapping("/getAppList")
     public void getAppList() throws IOException {
         String accessToken = "360d43b49553684a011d6607322582b1";

+ 207 - 175
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouConversionTypesController.java

@@ -1,44 +1,46 @@
 package org.jeecg.modules.kuaishou.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 cn.com.ctop.common.utils.Check;
+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.system.query.QueryGenerator;
 import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.ctop.entity.CTopOauthToken;
+import org.jeecg.modules.ctop.service.ICTopOauthTokenService;
 import org.jeecg.modules.kuaishou.entity.KuaiShouConversionTypes;
 import org.jeecg.modules.kuaishou.service.IKuaiShouConversionTypesService;
-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.jeecg.modules.kuaishou.service.IKuaishouInterfaceService;
 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: 快手-可选深度转化类型-详情
+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;
+
+/**
+ * @Description: 快手-可选深度转化类型-详情
  * @Author: jeecg-boot
-  * @Date: 2019-07-24
+ * @Date: 2019-07-24
  * @Version: V1.0
  */
 @Slf4j
@@ -46,20 +48,45 @@ import io.swagger.annotations.ApiOperation;
 @RestController
 @RequestMapping("/kuaishou/kuaiShouConversionTypes")
 public class KuaiShouConversionTypesController {
-	@Autowired
+    @Autowired
     private IKuaiShouConversionTypesService kuaiShouConversionTypesService;
-	
-	/**
-	  * 分页列表查询
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private ICTopOauthTokenService oauthTokenService;
+
+    @GetMapping(value = "/getIsActivate")
+    public Result<IPage<KuaiShouConversionTypes>> queryPageList(Long accountId) {
+        Result result = new Result<IPage<KuaiShouConversionTypes>>();
+        CTopOauthToken token = oauthTokenService.getOAuthTokenByAccountId(String.valueOf(accountId));
+        if (Check.isNull(token)) {
+            result.setSuccess(false);
+            result.setMessage("未获取到授权信息");
+            return result;
+        }
+        Map<String, Object> resultMap = kuaishouInterfaceService.getDeepConversionInfos(accountId, token.getAccessToken());
+        if ((Integer) resultMap.get("code") == 0) {
+            result.setResult(resultMap.get("isActivate"));
+        }
+        result.setSuccess(true);
+
+        return result;
+
+    }
+
+
+    /**
+     * 分页列表查询
+     *
      * @param kuaiShouConversionTypes
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
     @AutoLog(value = "快手-可选深度转化类型-详情-分页列表查询")
     @ApiOperation(value = "快手-可选深度转化类型-详情-分页列表查询", notes = "快手-可选深度转化类型-详情-分页列表查询")
-	@GetMapping(value = "/list")
+    @GetMapping(value = "/list")
     public Result<IPage<KuaiShouConversionTypes>> queryPageList(KuaiShouConversionTypes kuaiShouConversionTypes,
                                                                 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@@ -68,177 +95,182 @@ public class KuaiShouConversionTypesController {
         QueryWrapper<KuaiShouConversionTypes> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouConversionTypes, req.getParameterMap());
         Page<KuaiShouConversionTypes> page = new Page<KuaiShouConversionTypes>(pageNo, pageSize);
         IPage<KuaiShouConversionTypes> pageList = kuaiShouConversionTypesService.page(page, queryWrapper);
-		result.setSuccess(true);
-		result.setResult(pageList);
-		return result;
-	}
-	
-	/**
-	  *   添加
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
      * @param kuaiShouConversionTypes
-	 * @return
-	 */
+     * @return
+     */
     @AutoLog(value = "快手-可选深度转化类型-详情-添加")
     @ApiOperation(value = "快手-可选深度转化类型-详情-添加", notes = "快手-可选深度转化类型-详情-添加")
-	@PostMapping(value = "/add")
+    @PostMapping(value = "/add")
     public Result<KuaiShouConversionTypes> add(@RequestBody KuaiShouConversionTypes kuaiShouConversionTypes) {
         Result<KuaiShouConversionTypes> result = new Result<KuaiShouConversionTypes>();
-		try {
+        try {
             kuaiShouConversionTypesService.save(kuaiShouConversionTypes);
-			result.success("添加成功!");
-		} catch (Exception e) {
-			log.error(e.getMessage(),e);
-			result.error500("操作失败");
-		}
-		return result;
-	}
-	
-	/**
-	  *  编辑
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
      * @param kuaiShouConversionTypes
-	 * @return
-	 */
+     * @return
+     */
     @AutoLog(value = "快手-可选深度转化类型-详情-编辑")
     @ApiOperation(value = "快手-可选深度转化类型-详情-编辑", notes = "快手-可选深度转化类型-详情-编辑")
-	@PutMapping(value = "/edit")
+    @PutMapping(value = "/edit")
     public Result<KuaiShouConversionTypes> edit(@RequestBody KuaiShouConversionTypes kuaiShouConversionTypes) {
         Result<KuaiShouConversionTypes> result = new Result<KuaiShouConversionTypes>();
         KuaiShouConversionTypes kuaiShouConversionTypesEntity = kuaiShouConversionTypesService.getById(kuaiShouConversionTypes.getId());
         if (kuaiShouConversionTypesEntity == null) {
-			result.error500("未找到对应实体");
-		}else {
+            result.error500("未找到对应实体");
+        } else {
             boolean ok = kuaiShouConversionTypesService.updateById(kuaiShouConversionTypes);
-			//TODO 返回false说明什么?
-			if(ok) {
-				result.success("修改成功!");
-			}
-		}
-		
-		return result;
-	}
-	
-	/**
-	  *   通过id删除
-	 * @param id
-	 * @return
-	 */
+            //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 {
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
             kuaiShouConversionTypesService.removeById(id);
-		} catch (Exception e) {
-			log.error("删除失败",e.getMessage());
-			return Result.error("删除失败!");
-		}
-		return Result.ok("删除成功!");
-	}
-	
-	/**
-	  *  批量删除
-	 * @param ids
-	 * @return
-	 */
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
     @AutoLog(value = "快手-可选深度转化类型-详情-批量删除")
     @ApiOperation(value = "快手-可选深度转化类型-详情-批量删除", notes = "快手-可选深度转化类型-详情-批量删除")
-	@DeleteMapping(value = "/deleteBatch")
+    @DeleteMapping(value = "/deleteBatch")
     public Result<KuaiShouConversionTypes> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
         Result<KuaiShouConversionTypes> result = new Result<KuaiShouConversionTypes>();
-		if(ids==null || "".equals(ids.trim())) {
-			result.error500("参数不识别!");
-		}else {
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
             this.kuaiShouConversionTypesService.removeByIds(Arrays.asList(ids.split(",")));
-			result.success("删除成功!");
-		}
-		return result;
-	}
-	
-	/**
-	  * 通过id查询
-	 * @param id
-	 * @return
-	 */
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
     @AutoLog(value = "快手-可选深度转化类型-详情-通过id查询")
     @ApiOperation(value = "快手-可选深度转化类型-详情-通过id查询", notes = "快手-可选深度转化类型-详情-通过id查询")
-	@GetMapping(value = "/queryById")
+    @GetMapping(value = "/queryById")
     public Result<KuaiShouConversionTypes> queryById(@RequestParam(name = "id", required = true) String id) {
         Result<KuaiShouConversionTypes> result = new Result<KuaiShouConversionTypes>();
         KuaiShouConversionTypes kuaiShouConversionTypes = kuaiShouConversionTypesService.getById(id);
         if (kuaiShouConversionTypes == null) {
-			result.error500("未找到对应实体");
-		}else {
+            result.error500("未找到对应实体");
+        } else {
             result.setResult(kuaiShouConversionTypes);
-			result.setSuccess(true);
-		}
-		return result;
-	}
-
-  /**
-      * 导出excel
-   *
-   * @param request
-   * @param response
-   */
-  @RequestMapping(value = "/exportXls")
-  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-      // Step.1 组装查询条件
-      QueryWrapper<KuaiShouConversionTypes> queryWrapper = null;
-      try {
-          String paramsStr = request.getParameter("paramsStr");
-          if (oConvertUtils.isNotEmpty(paramsStr)) {
-              String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              KuaiShouConversionTypes kuaiShouConversionTypes = JSON.parseObject(deString, KuaiShouConversionTypes.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouConversionTypes, request.getParameterMap());
-          }
-      } catch (UnsupportedEncodingException e) {
-          e.printStackTrace();
-      }
-
-      //Step.2 AutoPoi 导出Excel
-      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<KuaiShouConversionTypes> pageList = kuaiShouConversionTypesService.list(queryWrapper);
-      //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "快手-可选深度转化类型-详情列表");
-      mv.addObject(NormalExcelConstants.CLASS, KuaiShouConversionTypes.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<KuaiShouConversionTypes> listKuaiShouConversionTypess = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouConversionTypes.class, params);
-              kuaiShouConversionTypesService.saveBatch(listKuaiShouConversionTypess);
-              return Result.ok("文件导入成功!数据行数:" + listKuaiShouConversionTypess.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("文件导入失败!");
-  }
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouConversionTypes> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouConversionTypes kuaiShouConversionTypes = JSON.parseObject(deString, KuaiShouConversionTypes.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouConversionTypes, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouConversionTypes> pageList = kuaiShouConversionTypesService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "快手-可选深度转化类型-详情列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouConversionTypes.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<KuaiShouConversionTypes> listKuaiShouConversionTypess = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouConversionTypes.class, params);
+                kuaiShouConversionTypesService.saveBatch(listKuaiShouConversionTypess);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouConversionTypess.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("文件导入失败!");
+    }
 
 }

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

@@ -8,11 +8,15 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
+import org.apache.shiro.SecurityUtils;
 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.system.vo.LoginUser;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.kuaishou.entity.KuaiShouCreateAppTemplate;
+import org.jeecg.modules.kuaishou.entity.KuaiShouImage;
 import org.jeecg.modules.kuaishou.service.IKuaiShouCreateAppTemplateService;
 import java.util.Date;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -72,6 +76,8 @@ public class KuaiShouCreateAppTemplateController {
 									  HttpServletRequest req) {
 		Result<IPage<KuaiShouCreateAppTemplate>> result = new Result<IPage<KuaiShouCreateAppTemplate>>();
 		QueryWrapper<KuaiShouCreateAppTemplate> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouCreateAppTemplate, req.getParameterMap());
+		LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+		queryWrapper.eq("login_id", user.getId());
 		Page<KuaiShouCreateAppTemplate> page = new Page<KuaiShouCreateAppTemplate>(pageNo, pageSize);
 		IPage<KuaiShouCreateAppTemplate> pageList = kuaiShouCreateAppTemplateService.page(page, queryWrapper);
 		result.setSuccess(true);

+ 78 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouCreateController.java

@@ -0,0 +1,78 @@
+package org.jeecg.modules.kuaishou.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.kuaishou.entity.KuaiShouGroupCreateLog;
+import org.jeecg.modules.kuaishou.service.IKuaiShouCreateService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+@RestController
+@RequestMapping("/kuaishou/create")
+public class KuaiShouCreateController {
+
+    @Autowired
+    private IKuaiShouCreateService kuaiShouCreateService;
+
+    /**
+     * 创建 广告组
+     *
+     * @param groupCreateTemplate
+     * @return
+     */
+    @PostMapping("/createGroups")
+    public Result<KuaiShouGroupCreateLog> createGroups(@RequestBody KuaiShouGroupCreateLog groupCreateTemplate) {
+        Result<KuaiShouGroupCreateLog> result = new Result<KuaiShouGroupCreateLog>();
+        Map<String, Object> map = kuaiShouCreateService.createGroups(groupCreateTemplate);
+        if ((Integer) map.get("code") == 0) {
+            result.setSuccess(true);
+        } else {
+            result.setSuccess(false);
+            result.setMessage((String) map.get("desc"));
+        }
+        return result;
+
+
+    }
+
+    /**
+     * 创建创意
+     *
+     * @param requestJson
+     * @return
+     */
+    @PostMapping("/createCreative")
+    public Result<KuaiShouGroupCreateLog> createCreative(@RequestBody JSONObject requestJson) {
+        Result<KuaiShouGroupCreateLog> result = new Result<KuaiShouGroupCreateLog>();
+        Map<String, Object> map = kuaiShouCreateService.createCreative(requestJson);
+        if ((Integer) map.get("code") == 0) {
+            result.setSuccess(true);
+        } else {
+            result.setSuccess(false);
+            result.setMessage((String) map.get("desc"));
+        }
+        return result;
+
+
+    }
+
+
+    @PostMapping("/getOptions")
+    public JSONArray getOptions(@RequestBody JSONObject requestJson) {
+        return kuaiShouCreateService.getOptions(requestJson.getString("loginId"), requestJson.getLong("accountId"));
+    }
+
+    @PostMapping("/getChildren")
+    public JSONArray getChildren(@RequestBody JSONObject requestJson) {
+        return kuaiShouCreateService.getChildren(requestJson.getString("loginId"), requestJson.getLong("campaignId"), requestJson.getLong("accountId"));
+    }
+
+
+}

+ 259 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouGroupCreateLogController.java

@@ -0,0 +1,259 @@
+package org.jeecg.modules.kuaishou.controller;
+
+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.jeecg.modules.kuaishou.entity.KuaiShouGroupCreateLog;
+import org.jeecg.modules.kuaishou.service.IKuaiShouGroupCreateLogService;
+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;
+
+/**
+ * @Description: 快手-批量创建广告组
+ * @Author: jeecg-boot
+ * @Date: 2019-08-09
+ * @Version: V1.0
+ */
+@Slf4j
+@Api(tags = "快手-批量创建广告组")
+@RestController
+@RequestMapping("/kuaishou/kuaiShouGroupCreateLog")
+public class KuaiShouGroupCreateLogController {
+    @Autowired
+    private IKuaiShouGroupCreateLogService kuaiShouGroupCreateLogService;
+
+
+    @PostMapping(value = "/insert")
+    public Map<String, Object> insert(@RequestBody KuaiShouGroupCreateLog groupCreateTemplate) {
+        System.err.println(groupCreateTemplate);
+        return kuaiShouGroupCreateLogService.insert(groupCreateTemplate);
+    }
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaiShouGroupCreateLog
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "快手-批量创建广告组-分页列表查询")
+    @ApiOperation(value = "快手-批量创建广告组-分页列表查询", notes = "快手-批量创建广告组-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaiShouGroupCreateLog>> queryPageList(KuaiShouGroupCreateLog kuaiShouGroupCreateLog,
+                                                               @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                               @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                               HttpServletRequest req) {
+        Result<IPage<KuaiShouGroupCreateLog>> result = new Result<IPage<KuaiShouGroupCreateLog>>();
+        QueryWrapper<KuaiShouGroupCreateLog> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouGroupCreateLog, req.getParameterMap());
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        queryWrapper.eq("login_id", user.getId());
+        Page<KuaiShouGroupCreateLog> page = new Page<KuaiShouGroupCreateLog>(pageNo, pageSize);
+        IPage<KuaiShouGroupCreateLog> pageList = kuaiShouGroupCreateLogService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouGroupCreateLog
+     * @return
+     */
+    @AutoLog(value = "快手-批量创建广告组-添加")
+    @ApiOperation(value = "快手-批量创建广告组-添加", notes = "快手-批量创建广告组-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouGroupCreateLog> add(@RequestBody KuaiShouGroupCreateLog kuaiShouGroupCreateLog) {
+        Result<KuaiShouGroupCreateLog> result = new Result<KuaiShouGroupCreateLog>();
+        try {
+            kuaiShouGroupCreateLogService.save(kuaiShouGroupCreateLog);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouGroupCreateLog
+     * @return
+     */
+    @AutoLog(value = "快手-批量创建广告组-编辑")
+    @ApiOperation(value = "快手-批量创建广告组-编辑", notes = "快手-批量创建广告组-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouGroupCreateLog> edit(@RequestBody KuaiShouGroupCreateLog kuaiShouGroupCreateLog) {
+        Result<KuaiShouGroupCreateLog> result = new Result<KuaiShouGroupCreateLog>();
+        KuaiShouGroupCreateLog kuaiShouGroupCreateLogEntity = kuaiShouGroupCreateLogService.getById(kuaiShouGroupCreateLog.getId());
+        if (kuaiShouGroupCreateLogEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouGroupCreateLogService.updateById(kuaiShouGroupCreateLog);
+            //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 {
+            kuaiShouGroupCreateLogService.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<KuaiShouGroupCreateLog> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaiShouGroupCreateLog> result = new Result<KuaiShouGroupCreateLog>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouGroupCreateLogService.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<KuaiShouGroupCreateLog> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouGroupCreateLog> result = new Result<KuaiShouGroupCreateLog>();
+        KuaiShouGroupCreateLog kuaiShouGroupCreateLog = kuaiShouGroupCreateLogService.getById(id);
+        if (kuaiShouGroupCreateLog == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouGroupCreateLog);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouGroupCreateLog> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouGroupCreateLog kuaiShouGroupCreateLog = JSON.parseObject(deString, KuaiShouGroupCreateLog.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouGroupCreateLog, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouGroupCreateLog> pageList = kuaiShouGroupCreateLogService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "快手-批量创建广告组列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouGroupCreateLog.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<KuaiShouGroupCreateLog> listKuaiShouGroupCreateLogs = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouGroupCreateLog.class, params);
+                kuaiShouGroupCreateLogService.saveBatch(listKuaiShouGroupCreateLogs);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouGroupCreateLogs.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("文件导入失败!");
+    }
+
+}

+ 80 - 81
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouGroupCreateTemplateController.java

@@ -1,80 +1,79 @@
 package org.jeecg.modules.kuaishou.controller;
 
-import com.alibaba.fastjson.JSON;
+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.apache.shiro.SecurityUtils;
+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.system.vo.LoginUser;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.kuaishou.entity.KuaiShouImage;
+import org.jeecg.modules.kuaishou.service.IKuaiShouImageService;
+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 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.jeecg.modules.kuaishou.entity.KuaiShouCreateAppTemplate;
-import org.jeecg.modules.kuaishou.entity.KuaiShouGroupCreateTemplate;
-import org.jeecg.modules.kuaishou.service.IKuaiShouGroupCreateTemplateService;
+
 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;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 
  /**
- * @Description: 快手-创建广告组信息模板
+ * @Description: 快手-本地图片保存
  * @Author: jeecg-boot
- * @Date:   2019-08-07
+ * @Date:   2019-08-14
  * @Version: V1.0
  */
 @Slf4j
-@Api(tags="快手-创建广告组信息模板")
+@Api(tags="快手-本地图片保存")
 @RestController
-@RequestMapping("/kuaishou/kuaiShouGroupCreateTemplate")
-public class KuaiShouGroupCreateTemplateController {
+@RequestMapping("/kuaishou/kuaiShouImage")
+public class KuaiShouImageController {
 	@Autowired
-	private IKuaiShouGroupCreateTemplateService kuaiShouGroupCreateTemplateService;
-
-
-	 @PostMapping(value = "/insert")
-	 public Map<String, Object> insert(@RequestBody KuaiShouGroupCreateTemplate groupCreateTemplate) {
-		 System.err.println(groupCreateTemplate);
-		 return kuaiShouGroupCreateTemplateService.insert(groupCreateTemplate);
-	 }
-
-
+	private IKuaiShouImageService kuaiShouImageService;
+	
 	/**
 	  * 分页列表查询
-	 * @param kuaiShouGroupCreateTemplate
+	 * @param kuaiShouImage
 	 * @param pageNo
 	 * @param pageSize
 	 * @param req
 	 * @return
 	 */
-	@AutoLog(value = "快手-创建广告组信息模板-分页列表查询")
-	@ApiOperation(value="快手-创建广告组信息模板-分页列表查询", notes="快手-创建广告组信息模板-分页列表查询")
+	@AutoLog(value = "快手-本地图片保存-分页列表查询")
+	@ApiOperation(value="快手-本地图片保存-分页列表查询", notes="快手-本地图片保存-分页列表查询")
 	@GetMapping(value = "/list")
-	public Result<IPage<KuaiShouGroupCreateTemplate>> queryPageList(KuaiShouGroupCreateTemplate kuaiShouGroupCreateTemplate,
+	public Result<IPage<KuaiShouImage>> queryPageList(KuaiShouImage kuaiShouImage,
 									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 									  HttpServletRequest req) {
-		Result<IPage<KuaiShouGroupCreateTemplate>> result = new Result<IPage<KuaiShouGroupCreateTemplate>>();
-		QueryWrapper<KuaiShouGroupCreateTemplate> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouGroupCreateTemplate, req.getParameterMap());
-		Page<KuaiShouGroupCreateTemplate> page = new Page<KuaiShouGroupCreateTemplate>(pageNo, pageSize);
-		IPage<KuaiShouGroupCreateTemplate> pageList = kuaiShouGroupCreateTemplateService.page(page, queryWrapper);
+		Result<IPage<KuaiShouImage>> result = new Result<IPage<KuaiShouImage>>();
+
+		LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+		QueryWrapper<KuaiShouImage> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouImage, req.getParameterMap());
+		queryWrapper.eq("login_id", user.getId());
+		Page<KuaiShouImage> page = new Page<KuaiShouImage>(pageNo, pageSize);
+		IPage<KuaiShouImage> pageList = kuaiShouImageService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
 		return result;
@@ -82,16 +81,16 @@ public class KuaiShouGroupCreateTemplateController {
 	
 	/**
 	  *   添加
-	 * @param kuaiShouGroupCreateTemplate
+	 * @param kuaiShouImage
 	 * @return
 	 */
-	@AutoLog(value = "快手-创建广告组信息模板-添加")
-	@ApiOperation(value="快手-创建广告组信息模板-添加", notes="快手-创建广告组信息模板-添加")
+	@AutoLog(value = "快手-本地图片保存-添加")
+	@ApiOperation(value="快手-本地图片保存-添加", notes="快手-本地图片保存-添加")
 	@PostMapping(value = "/add")
-	public Result<KuaiShouGroupCreateTemplate> add(@RequestBody KuaiShouGroupCreateTemplate kuaiShouGroupCreateTemplate) {
-		Result<KuaiShouGroupCreateTemplate> result = new Result<KuaiShouGroupCreateTemplate>();
+	public Result<KuaiShouImage> add(@RequestBody KuaiShouImage kuaiShouImage) {
+		Result<KuaiShouImage> result = new Result<KuaiShouImage>();
 		try {
-			kuaiShouGroupCreateTemplateService.save(kuaiShouGroupCreateTemplate);
+			kuaiShouImageService.save(kuaiShouImage);
 			result.success("添加成功!");
 		} catch (Exception e) {
 			log.error(e.getMessage(),e);
@@ -102,19 +101,19 @@ public class KuaiShouGroupCreateTemplateController {
 	
 	/**
 	  *  编辑
-	 * @param kuaiShouGroupCreateTemplate
+	 * @param kuaiShouImage
 	 * @return
 	 */
-	@AutoLog(value = "快手-创建广告组信息模板-编辑")
-	@ApiOperation(value="快手-创建广告组信息模板-编辑", notes="快手-创建广告组信息模板-编辑")
+	@AutoLog(value = "快手-本地图片保存-编辑")
+	@ApiOperation(value="快手-本地图片保存-编辑", notes="快手-本地图片保存-编辑")
 	@PutMapping(value = "/edit")
-	public Result<KuaiShouGroupCreateTemplate> edit(@RequestBody KuaiShouGroupCreateTemplate kuaiShouGroupCreateTemplate) {
-		Result<KuaiShouGroupCreateTemplate> result = new Result<KuaiShouGroupCreateTemplate>();
-		KuaiShouGroupCreateTemplate kuaiShouGroupCreateTemplateEntity = kuaiShouGroupCreateTemplateService.getById(kuaiShouGroupCreateTemplate.getId());
-		if(kuaiShouGroupCreateTemplateEntity==null) {
+	public Result<KuaiShouImage> edit(@RequestBody KuaiShouImage kuaiShouImage) {
+		Result<KuaiShouImage> result = new Result<KuaiShouImage>();
+		KuaiShouImage kuaiShouImageEntity = kuaiShouImageService.getById(kuaiShouImage.getId());
+		if(kuaiShouImageEntity==null) {
 			result.error500("未找到对应实体");
 		}else {
-			boolean ok = kuaiShouGroupCreateTemplateService.updateById(kuaiShouGroupCreateTemplate);
+			boolean ok = kuaiShouImageService.updateById(kuaiShouImage);
 			//TODO 返回false说明什么?
 			if(ok) {
 				result.success("修改成功!");
@@ -129,12 +128,12 @@ public class KuaiShouGroupCreateTemplateController {
 	 * @param id
 	 * @return
 	 */
-	@AutoLog(value = "快手-创建广告组信息模板-通过id删除")
-	@ApiOperation(value="快手-创建广告组信息模板-通过id删除", notes="快手-创建广告组信息模板-通过id删除")
+	@AutoLog(value = "快手-本地图片保存-通过id删除")
+	@ApiOperation(value="快手-本地图片保存-通过id删除", notes="快手-本地图片保存-通过id删除")
 	@DeleteMapping(value = "/delete")
 	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
 		try {
-			kuaiShouGroupCreateTemplateService.removeById(id);
+			kuaiShouImageService.removeById(id);
 		} catch (Exception e) {
 			log.error("删除失败",e.getMessage());
 			return Result.error("删除失败!");
@@ -147,15 +146,15 @@ public class KuaiShouGroupCreateTemplateController {
 	 * @param ids
 	 * @return
 	 */
-	@AutoLog(value = "快手-创建广告组信息模板-批量删除")
-	@ApiOperation(value="快手-创建广告组信息模板-批量删除", notes="快手-创建广告组信息模板-批量删除")
+	@AutoLog(value = "快手-本地图片保存-批量删除")
+	@ApiOperation(value="快手-本地图片保存-批量删除", notes="快手-本地图片保存-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
-	public Result<KuaiShouGroupCreateTemplate> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<KuaiShouGroupCreateTemplate> result = new Result<KuaiShouGroupCreateTemplate>();
+	public Result<KuaiShouImage> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<KuaiShouImage> result = new Result<KuaiShouImage>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
 		}else {
-			this.kuaiShouGroupCreateTemplateService.removeByIds(Arrays.asList(ids.split(",")));
+			this.kuaiShouImageService.removeByIds(Arrays.asList(ids.split(",")));
 			result.success("删除成功!");
 		}
 		return result;
@@ -166,16 +165,16 @@ public class KuaiShouGroupCreateTemplateController {
 	 * @param id
 	 * @return
 	 */
-	@AutoLog(value = "快手-创建广告组信息模板-通过id查询")
-	@ApiOperation(value="快手-创建广告组信息模板-通过id查询", notes="快手-创建广告组信息模板-通过id查询")
+	@AutoLog(value = "快手-本地图片保存-通过id查询")
+	@ApiOperation(value="快手-本地图片保存-通过id查询", notes="快手-本地图片保存-通过id查询")
 	@GetMapping(value = "/queryById")
-	public Result<KuaiShouGroupCreateTemplate> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<KuaiShouGroupCreateTemplate> result = new Result<KuaiShouGroupCreateTemplate>();
-		KuaiShouGroupCreateTemplate kuaiShouGroupCreateTemplate = kuaiShouGroupCreateTemplateService.getById(id);
-		if(kuaiShouGroupCreateTemplate==null) {
+	public Result<KuaiShouImage> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<KuaiShouImage> result = new Result<KuaiShouImage>();
+		KuaiShouImage kuaiShouImage = kuaiShouImageService.getById(id);
+		if(kuaiShouImage==null) {
 			result.error500("未找到对应实体");
 		}else {
-			result.setResult(kuaiShouGroupCreateTemplate);
+			result.setResult(kuaiShouImage);
 			result.setSuccess(true);
 		}
 		return result;
@@ -190,13 +189,13 @@ public class KuaiShouGroupCreateTemplateController {
   @RequestMapping(value = "/exportXls")
   public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
       // Step.1 组装查询条件
-      QueryWrapper<KuaiShouGroupCreateTemplate> queryWrapper = null;
+      QueryWrapper<KuaiShouImage> queryWrapper = null;
       try {
           String paramsStr = request.getParameter("paramsStr");
           if (oConvertUtils.isNotEmpty(paramsStr)) {
               String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              KuaiShouGroupCreateTemplate kuaiShouGroupCreateTemplate = JSON.parseObject(deString, KuaiShouGroupCreateTemplate.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouGroupCreateTemplate, request.getParameterMap());
+              KuaiShouImage kuaiShouImage = JSON.parseObject(deString, KuaiShouImage.class);
+              queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouImage, request.getParameterMap());
           }
       } catch (UnsupportedEncodingException e) {
           e.printStackTrace();
@@ -204,11 +203,11 @@ public class KuaiShouGroupCreateTemplateController {
 
       //Step.2 AutoPoi 导出Excel
       ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<KuaiShouGroupCreateTemplate> pageList = kuaiShouGroupCreateTemplateService.list(queryWrapper);
+      List<KuaiShouImage> pageList = kuaiShouImageService.list(queryWrapper);
       //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "快手-创建广告组信息模板列表");
-      mv.addObject(NormalExcelConstants.CLASS, KuaiShouGroupCreateTemplate.class);
-      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("快手-创建广告组信息模板列表数据", "导出人:Jeecg", "导出信息"));
+      mv.addObject(NormalExcelConstants.FILE_NAME, "快手-本地图片保存列表");
+      mv.addObject(NormalExcelConstants.CLASS, KuaiShouImage.class);
+      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("快手-本地图片保存列表数据", "导出人:Jeecg", "导出信息"));
       mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
       return mv;
   }
@@ -231,9 +230,9 @@ public class KuaiShouGroupCreateTemplateController {
           params.setHeadRows(1);
           params.setNeedSave(true);
           try {
-              List<KuaiShouGroupCreateTemplate> listKuaiShouGroupCreateTemplates = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouGroupCreateTemplate.class, params);
-              kuaiShouGroupCreateTemplateService.saveBatch(listKuaiShouGroupCreateTemplates);
-              return Result.ok("文件导入成功!数据行数:" + listKuaiShouGroupCreateTemplates.size());
+              List<KuaiShouImage> listKuaiShouImages = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouImage.class, params);
+              kuaiShouImageService.saveBatch(listKuaiShouImages);
+              return Result.ok("文件导入成功!数据行数:" + listKuaiShouImages.size());
           } catch (Exception e) {
               log.error(e.getMessage(),e);
               return Result.error("文件导入失败:"+e.getMessage());

+ 247 - 208
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/controller/KuaiShouVideoController.java

@@ -9,14 +9,18 @@ import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 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.kuaishou.entity.KuaiShouVideo;
+import org.jeecg.modules.kuaishou.service.IKuaiShouImageService;
 import org.jeecg.modules.kuaishou.service.IKuaiShouVideoService;
+
 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;
@@ -37,226 +41,261 @@ import com.alibaba.fastjson.JSON;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
- /**
- * @Description: 快手-上传视频
+/**
+ * @Description: 快手-本地图片保存
  * @Author: jeecg-boot
- * @Date:   2019-08-06
+ * @Date: 2019-08-14
  * @Version: V1.0
  */
 @Slf4j
-@Api(tags="快手-上传视频")
+@Api(tags = "快手-本地图片保存")
 @RestController
 @RequestMapping("/kuaishou/kuaiShouVideo")
 public class KuaiShouVideoController {
-	@Autowired
-	private IKuaiShouVideoService kuaiShouVideoService;
+    @Autowired
+    private IKuaiShouVideoService kuaiShouVideoService;
+    @Autowired
+    private IKuaiShouImageService imageService;
+
+
+    @PostMapping(value = "/insert")
+    public Result<KuaiShouVideo> insert(@RequestBody JSONObject requestJson) {
+        System.err.println(requestJson);
+        Result<KuaiShouVideo> result = new Result<>();
+        try {
+            kuaiShouVideoService.insert(requestJson);
+            imageService.insert(requestJson);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+
+    /**
+     * 通过id查询
+     *
+     * @return
+     */
+    @AutoLog(value = "快手-本地图片保存-通过id查询")
+    @ApiOperation(value = "快手-本地图片保存-通过id查询", notes = "快手-本地图片保存-通过id查询")
+    @PostMapping(value = "/queryShouVideo")
+    public Result<KuaiShouVideo> queryShouVideo(@RequestBody JSONObject requestJson) {
+        Result<KuaiShouVideo> result = new Result<KuaiShouVideo>();
+        QueryWrapper<KuaiShouVideo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("local_url", requestJson.getString("localUrl"));
+        queryWrapper.eq("login_id", requestJson.getString("loginId"));
+        queryWrapper.orderByDesc("create_time");
+        queryWrapper.last("limit 1");
+        KuaiShouVideo kuaiShouVideo = kuaiShouVideoService.getOne(queryWrapper);
+        if (kuaiShouVideo == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouVideo);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaiShouVideo
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "快手-本地图片保存-分页列表查询")
+    @ApiOperation(value = "快手-本地图片保存-分页列表查询", notes = "快手-本地图片保存-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaiShouVideo>> queryPageList(KuaiShouVideo kuaiShouVideo,
+                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                      HttpServletRequest req) {
+        Result<IPage<KuaiShouVideo>> result = new Result<IPage<KuaiShouVideo>>();
+        QueryWrapper<KuaiShouVideo> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouVideo, req.getParameterMap());
+        Page<KuaiShouVideo> page = new Page<KuaiShouVideo>(pageNo, pageSize);
+        IPage<KuaiShouVideo> pageList = kuaiShouVideoService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaiShouVideo
+     * @return
+     */
+    @AutoLog(value = "快手-本地图片保存-添加")
+    @ApiOperation(value = "快手-本地图片保存-添加", notes = "快手-本地图片保存-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaiShouVideo> add(@RequestBody KuaiShouVideo kuaiShouVideo) {
+        Result<KuaiShouVideo> result = new Result<KuaiShouVideo>();
+        try {
+            kuaiShouVideoService.save(kuaiShouVideo);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaiShouVideo
+     * @return
+     */
+    @AutoLog(value = "快手-本地图片保存-编辑")
+    @ApiOperation(value = "快手-本地图片保存-编辑", notes = "快手-本地图片保存-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaiShouVideo> edit(@RequestBody KuaiShouVideo kuaiShouVideo) {
+        Result<KuaiShouVideo> result = new Result<KuaiShouVideo>();
+        KuaiShouVideo kuaiShouVideoEntity = kuaiShouVideoService.getById(kuaiShouVideo.getId());
+        if (kuaiShouVideoEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaiShouVideoService.updateById(kuaiShouVideo);
+            //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 {
+            kuaiShouVideoService.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<KuaiShouVideo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaiShouVideo> result = new Result<KuaiShouVideo>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaiShouVideoService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
 
-	 @PostMapping(value = "/insert")
-	 public Result<KuaiShouVideo> insert(@RequestBody JSONObject requestJson) {
-		 System.err.println(requestJson);
-		 Result<KuaiShouVideo> result = new Result<KuaiShouVideo>();
-		 try {
-			 kuaiShouVideoService.insert(requestJson);
-			 result.success("添加成功!");
-		 } catch (Exception e) {
-			 log.error(e.getMessage(), e);
-			 result.error500("操作失败");
-		 }
-		 return result;
-	 }
-	
-	/**
-	  * 分页列表查询
-	 * @param kuaiShouVideo
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	@AutoLog(value = "快手-上传视频-分页列表查询")
-	@ApiOperation(value="快手-上传视频-分页列表查询", notes="快手-上传视频-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<KuaiShouVideo>> queryPageList(KuaiShouVideo kuaiShouVideo,
-									  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-									  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-									  HttpServletRequest req) {
-		Result<IPage<KuaiShouVideo>> result = new Result<IPage<KuaiShouVideo>>();
-		QueryWrapper<KuaiShouVideo> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouVideo, req.getParameterMap());
-		Page<KuaiShouVideo> page = new Page<KuaiShouVideo>(pageNo, pageSize);
-		IPage<KuaiShouVideo> pageList = kuaiShouVideoService.page(page, queryWrapper);
-		result.setSuccess(true);
-		result.setResult(pageList);
-		return result;
-	}
-	
-	/**
-	  *   添加
-	 * @param kuaiShouVideo
-	 * @return
-	 */
-	@AutoLog(value = "快手-上传视频-添加")
-	@ApiOperation(value="快手-上传视频-添加", notes="快手-上传视频-添加")
-	@PostMapping(value = "/add")
-	public Result<KuaiShouVideo> add(@RequestBody KuaiShouVideo kuaiShouVideo) {
-		Result<KuaiShouVideo> result = new Result<KuaiShouVideo>();
-		try {
-			kuaiShouVideoService.save(kuaiShouVideo);
-			result.success("添加成功!");
-		} catch (Exception e) {
-			log.error(e.getMessage(),e);
-			result.error500("操作失败");
-		}
-		return result;
-	}
-	
-	/**
-	  *  编辑
-	 * @param kuaiShouVideo
-	 * @return
-	 */
-	@AutoLog(value = "快手-上传视频-编辑")
-	@ApiOperation(value="快手-上传视频-编辑", notes="快手-上传视频-编辑")
-	@PutMapping(value = "/edit")
-	public Result<KuaiShouVideo> edit(@RequestBody KuaiShouVideo kuaiShouVideo) {
-		Result<KuaiShouVideo> result = new Result<KuaiShouVideo>();
-		KuaiShouVideo kuaiShouVideoEntity = kuaiShouVideoService.getById(kuaiShouVideo.getId());
-		if(kuaiShouVideoEntity==null) {
-			result.error500("未找到对应实体");
-		}else {
-			boolean ok = kuaiShouVideoService.updateById(kuaiShouVideo);
-			//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 {
-			kuaiShouVideoService.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<KuaiShouVideo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<KuaiShouVideo> result = new Result<KuaiShouVideo>();
-		if(ids==null || "".equals(ids.trim())) {
-			result.error500("参数不识别!");
-		}else {
-			this.kuaiShouVideoService.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<KuaiShouVideo> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<KuaiShouVideo> result = new Result<KuaiShouVideo>();
-		KuaiShouVideo kuaiShouVideo = kuaiShouVideoService.getById(id);
-		if(kuaiShouVideo==null) {
-			result.error500("未找到对应实体");
-		}else {
-			result.setResult(kuaiShouVideo);
-			result.setSuccess(true);
-		}
-		return result;
-	}
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "快手-本地图片保存-通过id查询")
+    @ApiOperation(value = "快手-本地图片保存-通过id查询", notes = "快手-本地图片保存-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaiShouVideo> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaiShouVideo> result = new Result<KuaiShouVideo>();
+        KuaiShouVideo kuaiShouVideo = kuaiShouVideoService.getById(id);
+        if (kuaiShouVideo == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaiShouVideo);
+            result.setSuccess(true);
+        }
+        return result;
+    }
 
-  /**
-      * 导出excel
-   *
-   * @param request
-   * @param response
-   */
-  @RequestMapping(value = "/exportXls")
-  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-      // Step.1 组装查询条件
-      QueryWrapper<KuaiShouVideo> queryWrapper = null;
-      try {
-          String paramsStr = request.getParameter("paramsStr");
-          if (oConvertUtils.isNotEmpty(paramsStr)) {
-              String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              KuaiShouVideo kuaiShouVideo = JSON.parseObject(deString, KuaiShouVideo.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouVideo, request.getParameterMap());
-          }
-      } catch (UnsupportedEncodingException e) {
-          e.printStackTrace();
-      }
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaiShouVideo> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaiShouVideo kuaiShouVideo = JSON.parseObject(deString, KuaiShouVideo.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouVideo, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
 
-      //Step.2 AutoPoi 导出Excel
-      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<KuaiShouVideo> pageList = kuaiShouVideoService.list(queryWrapper);
-      //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "快手-上传视频列表");
-      mv.addObject(NormalExcelConstants.CLASS, KuaiShouVideo.class);
-      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("快手-上传视频列表数据", "导出人:Jeecg", "导出信息"));
-      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-      return mv;
-  }
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaiShouVideo> pageList = kuaiShouVideoService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "快手-本地图片保存列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaiShouVideo.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<KuaiShouVideo> listKuaiShouVideos = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouVideo.class, params);
-              kuaiShouVideoService.saveBatch(listKuaiShouVideos);
-              return Result.ok("文件导入成功!数据行数:" + listKuaiShouVideos.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("文件导入失败!");
-  }
+    /**
+     * 通过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<KuaiShouVideo> listKuaiShouVideos = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouVideo.class, params);
+                kuaiShouVideoService.saveBatch(listKuaiShouVideos);
+                return Result.ok("文件导入成功!数据行数:" + listKuaiShouVideos.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("文件导入失败!");
+    }
 
 }

+ 55 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/entity/KuaiShouActionBarText.java

@@ -0,0 +1,55 @@
+package org.jeecg.modules.kuaishou.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_kuaishou_action_bar_text")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_kuaishou_action_bar_text对象", description="快手-行动号召文案")
+public class KuaiShouActionBarText {
+    
+	/**id*/
+	@TableId(type = IdType.UUID)
+    @ApiModelProperty(value = "id")
+	private Integer id;
+	/**类型*/
+	@Excel(name = "类型", width = 15)
+    @ApiModelProperty(value = "类型")
+	private Integer type;
+	/**行动号召文案*/
+	@Excel(name = "行动号召文案", width = 15)
+    @ApiModelProperty(value = "行动号召文案")
+	private String actionBarText;
+	/**创建时间*/
+	@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**修改时间*/
+	@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+	private Date updateTime;
+}

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/entity/KuaiShouCreativeCreate.java

@@ -30,7 +30,7 @@ public class KuaiShouCreativeCreate {
     /**
      * id
      */
-    @TableId(type = IdType.UUID)
+    @TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "id")
     private Long id;
     /**

+ 57 - 8
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/entity/KuaiShouGroupCreateTemplate.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.kuaishou.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -15,17 +16,17 @@ import org.springframework.format.annotation.DateTimeFormat;
 import java.util.Date;
 
 /**
- * @Description: 快手-创建广告组信息模板
+ * @Description: 快手-批量创建广告组
  * @Author: jeecg-boot
- * @Date: 2019-08-07
+ * @Date: 2019-08-09
  * @Version: V1.0
  */
 @Data
-@TableName("ctop_kuaishou_group_create_template")
+@TableName("ctop_kuaishou_group_create_log")
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
-@ApiModel(value = "ctop_kuaishou_group_create_template对象", description = "快手-创建广告组信息模板")
-public class KuaiShouGroupCreateTemplate {
+@ApiModel(value = "ctop_kuaishou_group_create_log对象", description = "快手-批量创建广告组")
+public class KuaiShouGroupCreateLog {
 
     /**
      * id
@@ -34,6 +35,24 @@ public class KuaiShouGroupCreateTemplate {
     @ApiModelProperty(value = "id")
     private Long id;
     /**
+     * 广告计划模板ID
+     */
+    @Excel(name = "广告计划模板ID", width = 15)
+    @ApiModelProperty(value = "广告计划模板ID")
+    private Long campaignTemplateId;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 广告活动ID
+     */
+    @Excel(name = "广告活动ID", width = 15)
+    @ApiModelProperty(value = "广告活动ID")
+    private Long campaignId;
+    /**
      * 广告组名称
      */
     @Excel(name = "广告组名称", width = 15)
@@ -50,13 +69,13 @@ public class KuaiShouGroupCreateTemplate {
      */
     @Excel(name = "出价", width = 15)
     @ApiModelProperty(value = "出价")
-    private Long bid;
+    private Integer bid;
     /**
      * OCPC出价
      */
     @Excel(name = "OCPC出价", width = 15)
     @ApiModelProperty(value = "OCPC出价")
-    private Long cpaBid;
+    private Integer cpaBid;
     /**
      * 优化目标
      */
@@ -92,7 +111,7 @@ public class KuaiShouGroupCreateTemplate {
      */
     @Excel(name = "投放时段", width = 15)
     @ApiModelProperty(value = "投放时段")
-    private String scheduleTime;
+    private Object scheduleTime;
     /**
      * 单日预算
      */
@@ -100,6 +119,24 @@ public class KuaiShouGroupCreateTemplate {
     @ApiModelProperty(value = "单日预算")
     private Integer dayBudget;
     /**
+     * url类型 1:淘宝商品短链 2:淘宝商品 itemID
+     */
+    @Excel(name = "url类型 1:淘宝商品短链 2:淘宝商品 itemID", width = 15)
+    @ApiModelProperty(value = "url类型 1:淘宝商品短链 2:淘宝商品 itemID")
+    private Integer urlType;
+    /**
+     * 投放链接
+     */
+    @Excel(name = "投放链接", width = 15)
+    @ApiModelProperty(value = "投放链接")
+    private Object url;
+    /**
+     * APP ID
+     */
+    @Excel(name = "APP ID", width = 15)
+    @ApiModelProperty(value = "APP ID")
+    private Integer appId;
+    /**
      * 创意展现方式  1:轮播 2:优选
      */
     @Excel(name = "创意展现方式  1:轮播 2:优选", width = 15)
@@ -112,6 +149,12 @@ public class KuaiShouGroupCreateTemplate {
     @ApiModelProperty(value = "投放方式 1:快速投放 2:平滑投放")
     private Integer speed;
     /**
+     * 广告组ID
+     */
+    @Excel(name = "广告组ID", width = 15)
+    @ApiModelProperty(value = "广告组ID")
+    private Long unitId;
+    /**
      * 当前登录人id
      */
     @Excel(name = "当前登录人id", width = 15)
@@ -123,6 +166,12 @@ public class KuaiShouGroupCreateTemplate {
     @Excel(name = "创建人", width = 15)
     @ApiModelProperty(value = "创建人")
     private String createBy;
+
+
+    @TableField(exist = false)
+    private Integer createCount;
+
+
     /**
      * 修改人
      */

+ 94 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/entity/KuaiShouImage.java

@@ -0,0 +1,94 @@
+package org.jeecg.modules.kuaishou.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+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 org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * @Description: 快手-本地图片保存
+ * @Author: jeecg-boot
+ * @Date: 2019-08-14
+ * @Version: V1.0
+ */
+@Data
+@TableName("ctop_kuaishou_image")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_image对象", description = "快手-本地图片保存")
+public class KuaiShouImage {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 图片保存本地地址
+     */
+    @Excel(name = "图片保存本地地址", width = 15)
+    @ApiModelProperty(value = "图片保存本地地址")
+    private Object localUrl;
+    /**
+     * videoName
+     */
+    @Excel(name = "imageName", width = 15)
+    @ApiModelProperty(value = "imageName")
+    private String imageName;
+    /**
+     * 视频类别
+     */
+    @Excel(name = "视频类别", width = 15)
+    @ApiModelProperty(value = "视频类别")
+    private String imageType;
+    /**
+     * 登录人id
+     */
+    @Excel(name = "登录人id", width = 15)
+    @ApiModelProperty(value = "登录人id")
+    private String loginId;
+    /**
+     * 图片类型 1-竖版图片 2-横版图片
+     */
+    @Excel(name = "图片类型 1-竖版图片 2-横版图片", width = 15)
+    @ApiModelProperty(value = "图片类型 1-竖版图片 2-横版图片")
+    private String materialType;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+    /**
+     * createBy
+     */
+    @Excel(name = "createBy", width = 15)
+    @ApiModelProperty(value = "createBy")
+    private String createBy;
+    /**
+     * updateBy
+     */
+    @Excel(name = "updateBy", width = 15)
+    @ApiModelProperty(value = "updateBy")
+    private String updateBy;
+}

+ 9 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/entity/KuaiShouVideo.java

@@ -15,16 +15,16 @@ import org.springframework.format.annotation.DateTimeFormat;
 import java.util.Date;
 
 /**
- * @Description: 快手-上传视频
+ * @Description: 快手-本地图片保存
  * @Author: jeecg-boot
- * @Date: 2019-08-06
+ * @Date: 2019-08-14
  * @Version: V1.0
  */
 @Data
 @TableName("ctop_kuaishou_video")
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
-@ApiModel(value = "ctop_kuaishou_video对象", description = "快手-上传视频")
+@ApiModel(value = "ctop_kuaishou_video对象", description = "快手-本地图片保存")
 public class KuaiShouVideo {
 
     /**
@@ -64,6 +64,12 @@ public class KuaiShouVideo {
     @ApiModelProperty(value = "登录人id")
     private String loginId;
     /**
+     * 视频类型 1-竖版视频 2-横版视频
+     */
+    @Excel(name = "视频类型 1-竖版视频 2-横版视频", width = 15)
+    @ApiModelProperty(value = "视频类型 1-竖版视频 2-横版视频")
+    private String materialType;
+    /**
      * 创建时间
      */
     @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")

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

@@ -0,0 +1,17 @@
+package org.jeecg.modules.kuaishou.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.kuaishou.entity.KuaiShouActionBarText;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: 快手-行动号召文案
+ * @Author: jeecg-boot
+ * @Date:   2019-08-15
+ * @Version: V1.0
+ */
+public interface KuaiShouActionBarTextMapper extends BaseMapper<KuaiShouActionBarText> {
+
+}

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/mapper/KuaiShouGroupCreateLogMapper.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.kuaishou.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.kuaishou.entity.KuaiShouGroupCreateLog;
+
+/**
+ * @Description: 快手-批量创建广告组
+ * @Author: jeecg-boot
+ * @Date: 2019-08-09
+ * @Version: V1.0
+ */
+public interface KuaiShouGroupCreateLogMapper extends BaseMapper<KuaiShouGroupCreateLog> {
+
+}

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

@@ -1,17 +0,0 @@
-package org.jeecg.modules.kuaishou.mapper;
-
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
-import org.jeecg.modules.kuaishou.entity.KuaiShouGroupCreateTemplate;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- * @Description: 快手-创建广告组信息模板
- * @Author: jeecg-boot
- * @Date:   2019-08-07
- * @Version: V1.0
- */
-public interface KuaiShouGroupCreateTemplateMapper extends BaseMapper<KuaiShouGroupCreateTemplate> {
-
-}

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

@@ -0,0 +1,17 @@
+package org.jeecg.modules.kuaishou.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.kuaishou.entity.KuaiShouImage;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: 快手-本地图片保存
+ * @Author: jeecg-boot
+ * @Date:   2019-08-14
+ * @Version: V1.0
+ */
+public interface KuaiShouImageMapper extends BaseMapper<KuaiShouImage> {
+
+}

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/mapper/KuaiShouVideoMapper.java

@@ -7,9 +7,9 @@ import org.jeecg.modules.kuaishou.entity.KuaiShouVideo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 /**
- * @Description: 快手-上传视频
+ * @Description: 快手-本地图片保存
  * @Author: jeecg-boot
- * @Date:   2019-08-06
+ * @Date:   2019-08-14
  * @Version: V1.0
  */
 public interface KuaiShouVideoMapper extends BaseMapper<KuaiShouVideo> {

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

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

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

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

@@ -0,0 +1,14 @@
+package org.jeecg.modules.kuaishou.service;
+
+import org.jeecg.modules.kuaishou.entity.KuaiShouActionBarText;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 快手-行动号召文案
+ * @Author: jeecg-boot
+ * @Date:   2019-08-15
+ * @Version: V1.0
+ */
+public interface IKuaiShouActionBarTextService extends IService<KuaiShouActionBarText> {
+
+}

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaiShouCampaignCreateService.java

@@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IKuaiShouCampaignCreateService extends IService<KuaiShouCampaignCreate> {
 
+    KuaiShouCampaignCreate selectCampaignByCampaignId(String campaignId);
 }

+ 17 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaiShouCreateService.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.kuaishou.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.modules.kuaishou.entity.KuaiShouGroupCreateLog;
+
+import java.util.Map;
+
+public interface IKuaiShouCreateService {
+    Map<String, Object> createGroups(KuaiShouGroupCreateLog groupCreateTemplate);
+
+    JSONArray getOptions(String loginId, Long accountId);
+
+    JSONArray getChildren(String loginId, Long campaignId, Long accountId);
+
+    Map<String, Object> createCreative(JSONObject requestJson);
+}

+ 17 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaiShouGroupCreateLogService.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.kuaishou.service;
+
+import org.jeecg.modules.kuaishou.entity.KuaiShouGroupCreateLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.Map;
+
+/**
+ * @Description: 快手-批量创建广告组
+ * @Author: jeecg-boot
+ * @Date:   2019-08-09
+ * @Version: V1.0
+ */
+public interface IKuaiShouGroupCreateLogService extends IService<KuaiShouGroupCreateLog> {
+
+    Map<String, Object> insert(KuaiShouGroupCreateLog groupCreateTemplate);
+}

+ 0 - 17
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaiShouGroupCreateTemplateService.java

@@ -1,17 +0,0 @@
-package org.jeecg.modules.kuaishou.service;
-
-import org.jeecg.modules.kuaishou.entity.KuaiShouGroupCreateTemplate;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-import java.util.Map;
-
-/**
- * @Description: 快手-创建广告组信息模板
- * @Author: jeecg-boot
- * @Date:   2019-08-07
- * @Version: V1.0
- */
-public interface IKuaiShouGroupCreateTemplateService extends IService<KuaiShouGroupCreateTemplate> {
-
-    Map<String, Object> insert(KuaiShouGroupCreateTemplate groupCreateTemplate);
-}

+ 19 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaiShouImageService.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.kuaishou.service;
+
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.modules.kuaishou.entity.KuaiShouImage;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 快手-本地图片保存
+ * @Author: jeecg-boot
+ * @Date: 2019-08-14
+ * @Version: V1.0
+ */
+public interface IKuaiShouImageService extends IService<KuaiShouImage> {
+
+    void insert(JSONObject requestJson);
+
+
+    String localInsert(String url, JSONObject requestJson);
+}

+ 4 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaiShouVideoService.java

@@ -5,12 +5,14 @@ import org.jeecg.modules.kuaishou.entity.KuaiShouVideo;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 /**
- * @Description: 快手-上传视频
+ * @Description: 快手-本地图片保存
  * @Author: jeecg-boot
- * @Date:   2019-08-06
+ * @Date: 2019-08-14
  * @Version: V1.0
  */
 public interface IKuaiShouVideoService extends IService<KuaiShouVideo> {
 
     void insert(JSONObject requestJson) throws Exception;
+
+    String localInsert(JSONObject requestJson) throws Exception;
 }

+ 11 - 12
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/IKuaishouInterfaceService.java

@@ -5,7 +5,6 @@ import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResult;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
 import cn.com.ctop.kuaishou.modules.report.entity.*;
 import com.alibaba.fastjson.JSONObject;
-import org.springframework.http.HttpRequest;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
@@ -89,8 +88,9 @@ public interface IKuaishouInterfaceService {
      * 获取可选的深度转化类型
      *
      * @param advertiserId
+     * @return
      */
-    void getDeepConversionInfos(Long advertiserId, String accessToken);
+    Map<String, Object> getDeepConversionInfos(Long advertiserId, String accessToken);
 
 
     /**
@@ -104,12 +104,11 @@ public interface IKuaishouInterfaceService {
 
     /**
      * 文件上传
-     *
-     * @param advertiserId
+     *  @param advertiserId
      * @param accessToken
-     * @param multipartFile
+     * @return
      */
-    void videoUpload(Long advertiserId, String accessToken, MultipartFile multipartFile, HttpServletRequest request);
+    Map<String, Object> videoUpload(Long advertiserId, String accessToken, String videoUrl);
 
     /**
      * 获取视频
@@ -142,10 +141,9 @@ public interface IKuaishouInterfaceService {
      *
      * @param advertiserId
      * @param accessToken
-     * @param multipartFile
-     * @param request
+     * @return
      */
-    void imageUpload(Long advertiserId, String accessToken, MultipartFile multipartFile, HttpServletRequest request);
+    Map<String, Object> imageUpload(Long advertiserId, String accessToken, String filePath, Integer type);
 
 
     /**
@@ -153,10 +151,9 @@ public interface IKuaishouInterfaceService {
      *
      * @param advertiserId
      * @param accessToken
-     * @param multipartFile
-     * @param request
+     * @return
      */
-    void appCreate(Long advertiserId, String accessToken, MultipartFile multipartFile, HttpServletRequest request, JSONObject requestJson);
+    Map<String, Object> appCreate(Long advertiserId, String accessToken, JSONObject requestJson);
 
 
     /**
@@ -188,4 +185,6 @@ public interface IKuaishouInterfaceService {
      * @param request
      */
     void appUpdate(Long advertiserId, String accessToken, JSONObject requestJson, MultipartFile multipartFile, HttpServletRequest request);
+
+    Map<String, Object> urlAppCreate(Long accountId, String accessToken, JSONObject apkJson);
 }

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

@@ -0,0 +1,19 @@
+package org.jeecg.modules.kuaishou.service.impl;
+
+import org.jeecg.modules.kuaishou.entity.KuaiShouActionBarText;
+import org.jeecg.modules.kuaishou.mapper.KuaiShouActionBarTextMapper;
+import org.jeecg.modules.kuaishou.service.IKuaiShouActionBarTextService;
+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 KuaiShouActionBarTextServiceImpl extends ServiceImpl<KuaiShouActionBarTextMapper, KuaiShouActionBarText> implements IKuaiShouActionBarTextService {
+
+}

+ 13 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaiShouCampaignCreateServiceImpl.java

@@ -1,8 +1,10 @@
 package org.jeecg.modules.kuaishou.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.jeecg.modules.kuaishou.entity.KuaiShouCampaignCreate;
 import org.jeecg.modules.kuaishou.mapper.KuaiShouCampaignCreateMapper;
 import org.jeecg.modules.kuaishou.service.IKuaiShouCampaignCreateService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -15,5 +17,16 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  */
 @Service
 public class KuaiShouCampaignCreateServiceImpl extends ServiceImpl<KuaiShouCampaignCreateMapper, KuaiShouCampaignCreate> implements IKuaiShouCampaignCreateService {
+    @Autowired
+    private KuaiShouCampaignCreateMapper campaignCreateMapper;
 
+    @Override
+    public KuaiShouCampaignCreate selectCampaignByCampaignId(String campaignId) {
+        QueryWrapper<KuaiShouCampaignCreate> wrapper = new QueryWrapper<>();
+        wrapper.eq("campaign_id", campaignId);
+        wrapper.orderByDesc("create_time");
+        wrapper.last("limit 1");
+        KuaiShouCampaignCreate campaignCreate = campaignCreateMapper.selectOne(wrapper);
+        return campaignCreate;
+    }
 }

+ 430 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaiShouCreateServiceImpl.java

@@ -0,0 +1,430 @@
+package org.jeecg.modules.kuaishou.service.impl;
+
+import cn.com.ctop.common.utils.Check;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import org.jeecg.modules.ctop.entity.CTopOauthToken;
+import org.jeecg.modules.ctop.service.ICTopOauthTokenService;
+import org.jeecg.modules.kuaishou.entity.KuaiShouCampaignCreate;
+import org.jeecg.modules.kuaishou.entity.KuaiShouCampaignTemplate;
+import org.jeecg.modules.kuaishou.entity.KuaiShouCreateAppTemplate;
+import org.jeecg.modules.kuaishou.entity.KuaiShouGroupCreateLog;
+import org.jeecg.modules.kuaishou.mapper.KuaiShouCampaignCreateMapper;
+import org.jeecg.modules.kuaishou.mapper.KuaiShouCampaignTemplateMapper;
+import org.jeecg.modules.kuaishou.mapper.KuaiShouCreateAppTemplateMapper;
+import org.jeecg.modules.kuaishou.mapper.KuaiShouGroupCreateLogMapper;
+import org.jeecg.modules.kuaishou.service.IKuaiShouCreateService;
+import org.jeecg.modules.kuaishou.service.IKuaiShouImageService;
+import org.jeecg.modules.kuaishou.service.IKuaiShouVideoService;
+import org.jeecg.modules.kuaishou.service.IKuaishouInterfaceService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+@Service
+public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
+    private static final Logger logger = LoggerFactory.getLogger(KuaiShouCreateServiceImpl.class);
+    @Autowired
+    private KuaiShouCampaignTemplateMapper campaignTemplateMapper;
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private KuaiShouCreateAppTemplateMapper createAppTemplateMapper;
+    @Autowired
+    private KuaiShouGroupCreateLogMapper groupCreateLogMapper;
+    @Autowired
+    private ICTopOauthTokenService oauthTokenService;
+
+    @Override
+    public Map<String, Object> createGroups(KuaiShouGroupCreateLog groupCreateTemplate) {
+        Map<String, Object> returnMap = new HashMap<>();
+        try {
+            Integer createCount = groupCreateTemplate.getCreateCount();
+            if (Check.isNull(createCount) || createCount == 0) {
+                returnMap.put("code", -1);
+                returnMap.put("success", false);
+                returnMap.put("desc", "迭代次数不能为空或为0");
+                return returnMap;
+            }
+            Long accountId = groupCreateTemplate.getAccountId();
+            if (Check.isNull(accountId)) {
+                returnMap.put("code", -1);
+                returnMap.put("success", false);
+                returnMap.put("desc", "请选择快手账号");
+                return returnMap;
+            }
+
+            CTopOauthToken cTopOauthToken = oauthTokenService.getOAuthTokenByAccountId(String.valueOf(accountId));
+            if (Check.isNull(cTopOauthToken)) {
+                logger.error("未获取到token信息,accountId:{}", accountId);
+                throw new Exception("未获取到token信息");
+            }
+            String accessToken = cTopOauthToken.getAccessToken();
+
+            Long campaignTemplateId = groupCreateTemplate.getCampaignTemplateId(); // 广告计划模板id
+            if (Check.isNull(campaignTemplateId)) {
+                returnMap.put("code", -1);
+                returnMap.put("success", false);
+                returnMap.put("desc", "请选择广告计划模板");
+                return returnMap;
+            }
+            KuaiShouCampaignTemplate kuaiShouCampaignTemplate = campaignTemplateMapper.selectById(campaignTemplateId); // 广告计划信息
+            if (Check.isNull(kuaiShouCampaignTemplate)) {
+                logger.error("查询广告计划为空:模板id:{}", campaignTemplateId);
+                throw new Exception("根据模板id查询创意模板信息为空");
+            }
+
+            JSONObject campaignJson = new JSONObject();
+            campaignJson.put("campaign_name", kuaiShouCampaignTemplate.getCampaignName() + "_" + UUID.randomUUID().toString().substring(0, 6));
+            campaignJson.put("type", kuaiShouCampaignTemplate.getType());
+            campaignJson.put("day_budget", kuaiShouCampaignTemplate.getDayBudget());
+
+
+            Map<String, Object> campaignMap = kuaishouInterfaceService.campaignCreate(accessToken, accountId, campaignJson);
+            Integer code = (Integer) campaignMap.get("code");
+            if (code != 0) {
+                returnMap.put("code", -1);
+                returnMap.put("success", false);
+                returnMap.put("desc", "创建广告计划失败");
+                return returnMap;
+            }
+            Long campaignId = (Long) campaignMap.get("campaign_id");
+            groupCreateTemplate.setCampaignId(campaignId);
+
+            JSONObject groupJson = new JSONObject();
+            Integer type = kuaiShouCampaignTemplate.getType();// 计划类型
+            if (type == 3 || type == 4 || type == 5) {
+                if (type == 3) {
+                    groupJson.put("url_type", kuaiShouCampaignTemplate.getUrlType());
+                }
+                groupJson.put("url", kuaiShouCampaignTemplate.getUrl());
+            }
+            if (type == 2) { // app推广
+                KuaiShouCreateAppTemplate appTemplate = createAppTemplateMapper.selectById(kuaiShouCampaignTemplate.getAppId());
+                if (Check.isNull(appTemplate)) {
+                    logger.error("快手上传视频未获取到本地app信息,appId:{}", kuaiShouCampaignTemplate.getAppId());
+                    throw new Exception("快手上传视频未获取到本地app信息");
+                }
+                JSONObject apkJson = new JSONObject();
+                String platform = appTemplate.getPlatform();
+                apkJson.put("platform", platform);
+                apkJson.put("app_name", appTemplate.getAppName());
+                apkJson.put("app_version", appTemplate.getAppVersion());
+                if (!Check.isNull(appTemplate.getPackageName())) {
+                    apkJson.put("package_name", appTemplate.getPackageName());
+                }
+                if (!Check.isNull(appTemplate.getImageUrl()) && ("1".equals(platform) || "3".equals(platform))) {
+                    Map<String, Object> imageMap = kuaishouInterfaceService.imageUpload(accountId, accessToken, (String) appTemplate.getImageUrl(), 1);
+                    Integer imageCode = (Integer) imageMap.get("code");
+                    if (imageCode != 0) {
+                        returnMap.put("code", -1);
+                        returnMap.put("success", false);
+                        returnMap.put("desc", "上传图片失败");
+                        return returnMap;
+                    }
+                    apkJson.put("image_token", imageMap.get("imageToken"));
+                }
+
+                Map<String, Object> apkMap;
+                if ("1".equals(platform)) {
+                    apkJson.put("file", appTemplate.getFile());
+                    apkMap = kuaishouInterfaceService.appCreate(accountId, accessToken, apkJson);
+
+                } else {
+                    apkJson.put("url", appTemplate.getUrl());
+                    apkMap = kuaishouInterfaceService.urlAppCreate(accountId, accessToken, apkJson);
+                }
+                if ((Integer) apkMap.get("code") != 0) {
+                    returnMap.put("code", -1);
+                    returnMap.put("success", false);
+                    returnMap.put("desc", "上传apk文件失败");
+                    return returnMap;
+                }
+                System.err.println(apkMap);
+                groupJson.put("app_id", apkMap.get("appId"));
+            }
+
+            groupJson.put("bid_type", groupCreateTemplate.getBidType());
+            groupJson.put("campaign_id", campaignId);
+            if (!Check.isNull(groupCreateTemplate.getBid())) {
+                groupJson.put("bid", groupCreateTemplate.getBid());
+            }
+            if (!Check.isNull(groupCreateTemplate.getCpaBid())) {
+                groupJson.put("cpa_bid", groupCreateTemplate.getCpaBid());
+            }
+            if (!Check.isNull(groupCreateTemplate.getOcpxActionType())) {
+                groupJson.put("ocpx_action_type", groupCreateTemplate.getOcpxActionType());
+            }
+            if (!Check.isNull(groupCreateTemplate.getDeepConversionType())) {
+                groupJson.put("deep_conversion_type", groupCreateTemplate.getDeepConversionType());
+            }
+            if (!Check.isNull(groupCreateTemplate.getPage())) {
+                groupJson.put("page", groupCreateTemplate.getPage());
+            }
+            if (!Check.isNull(groupCreateTemplate.getBeginTime())) {
+                groupJson.put("begin_time", groupCreateTemplate.getBeginTime());
+            }
+            if (!Check.isNull(groupCreateTemplate.getEndTime())) {
+                groupJson.put("end_time", groupCreateTemplate.getEndTime());
+            }
+            if (!Check.isNull(groupCreateTemplate.getScheduleTime())) {
+                groupJson.put("schedule_time", groupCreateTemplate.getScheduleTime());
+            }
+            if (!Check.isNull(groupCreateTemplate.getDayBudget())) {
+                groupJson.put("day_budget", groupCreateTemplate.getDayBudget());
+            }
+            if (!Check.isNull(groupCreateTemplate.getShowModel())) {
+                groupJson.put("show_mode", groupCreateTemplate.getShowModel());
+            }
+            if (!Check.isNull(groupCreateTemplate.getSpeed())) {
+                groupJson.put("speed", groupCreateTemplate.getSpeed());
+            }
+            JSONObject targetJson = new JSONObject();
+            groupJson.put("target", targetJson);
+
+            String unitName = groupCreateTemplate.getUnitName();
+            for (int i = 0; i < createCount; i++) {
+                String name = unitName + "_" + i;
+                groupJson.put("unit_name", name);
+                Map<String, Object> groupMap = kuaishouInterfaceService.adUnitCreate(accessToken, accountId, groupJson);
+                if ((Integer) groupMap.get("code") != 0) {
+                    logger.error("创建广告组失败,accountId:{},unitName:{}", accountId, unitName);
+                    throw new Exception("创建广告组失败");
+                }
+                groupCreateTemplate.setUnitId((Long) groupMap.get("unitId"));
+                groupCreateTemplate.setUnitName(name);
+                int y = groupCreateLogMapper.insert(groupCreateTemplate);
+                if (y > 0) {
+                    logger.info("创建广告组记录信息入库完成,accountId:{},unitName:{}", accountId, unitName);
+                }
+            }
+            returnMap.put("code", 0);
+            returnMap.put("success", true);
+            returnMap.put("desc", "批量创建广告组成功");
+        } catch (Exception e) {
+            e.printStackTrace();
+            returnMap.put("code", -1);
+            returnMap.put("success", false);
+            returnMap.put("desc", "批量创建广告组失败") ;
+
+        }
+        return returnMap;
+    }
+
+
+    /**
+     * 批量创建创意
+     *
+     * @param requestJson
+     * @return
+     */
+    @Autowired
+    private IKuaiShouVideoService videoService;
+    @Autowired
+    private IKuaiShouImageService imageService;
+
+    @Override
+    public Map<String, Object> createCreative(JSONObject requestJson) {
+        Map<String, Object> returnMap = new HashMap<>();
+        try {
+            if (Check.isNull(requestJson)) {
+                logger.error("创建创意入参为空");
+                returnMap.put("code", -1);
+                returnMap.put("success", false);
+                returnMap.put("message", "入参为空");
+                return returnMap;
+            }
+
+            JSONObject createJson = new JSONObject();
+            Long accountId = requestJson.getLong("accountId");
+            if (Check.isNull(accountId)) {
+                logger.error("创建创意广告主id为空,accountId:{}", accountId);
+                returnMap.put("code", -1);
+                returnMap.put("success", false);
+                returnMap.put("message", "请选择快手账号");
+                return returnMap;
+            }
+
+            CTopOauthToken cTopOauthToken = oauthTokenService.getOAuthTokenByAccountId(String.valueOf(accountId));
+            if (Check.isNull(cTopOauthToken)) {
+                logger.error("未获取到token信息,accountId:{}", accountId);
+                throw new Exception("未获取到token信息");
+            }
+            String accessToken = cTopOauthToken.getAccessToken();
+
+            Long unitId = requestJson.getLong("unitId");
+            if (Check.isNull(unitId)) {
+                logger.error("创建创意广告组为空,accountId:{}", accountId);
+                returnMap.put("code", -1);
+                returnMap.put("success", false);
+                returnMap.put("message", "请选择广告组");
+                return returnMap;
+            }
+            createJson.put("unit_id", unitId);
+
+            String videoUrl;
+            String videoUploadType = requestJson.getString("videoUploadType");
+            if ("2".equals(videoUploadType)) {
+                videoUrl = videoService.localInsert(requestJson);
+            } else {
+                videoUrl = requestJson.getString("videoUrl");
+            }
+
+            if (Check.isNull(videoUrl)) {
+                logger.error("创建创意视频为空,accountId:{}", accountId);
+                returnMap.put("code", -1);
+                returnMap.put("success", false);
+                returnMap.put("message", "请选择上传的视频");
+                return returnMap;
+            }
+
+            Map<String, Object> videoMap = kuaishouInterfaceService.videoUpload(accountId, accessToken, videoUrl);
+            if ((Integer) videoMap.get("code") != 0) {
+                logger.error("上传视频失败,accountId:{}", accountId);
+                returnMap.put("code", -1);
+                returnMap.put("success", false);
+                returnMap.put("message", "上传视频失败");
+                return returnMap;
+            }
+            createJson.put("photo_id", videoMap.get("photoId"));
+
+
+            if (!Check.isNull(requestJson.getString("actionBarText"))) {
+                createJson.put("action_bar_text", requestJson.getString("actionBarText"));
+            }
+
+            if (Check.isNull(requestJson.getString("description"))) {
+                logger.error("请填写广告语,accountId:{}", accountId);
+                returnMap.put("code", -1);
+                returnMap.put("success", false);
+                returnMap.put("message", "请填写广告语");
+                return returnMap;
+            }
+            createJson.put("description", requestJson.getString("description"));
+
+            JSONArray imageUrlArr = requestJson.getJSONArray("imageUrl");
+            if (Check.isNull(imageUrlArr)) {
+                logger.error("请选择封面图,accountId:{}", accountId);
+                returnMap.put("code", -1);
+                returnMap.put("success", false);
+                returnMap.put("message", "请选择广告创意封面图");
+                return returnMap;
+            }
+
+            String creativeName = requestJson.getString("creativeName");
+            for (int i = 0; i < imageUrlArr.size(); i++) {
+                String imagePath;
+                String imageUrl = imageUrlArr.get(i).toString();
+                if (!Check.isNull(imageUrl)) {
+                    if ("2".equals(requestJson.getString("imageType"))) {
+                        imagePath = imageService.localInsert(imageUrl, requestJson);
+                    } else {
+                        imagePath = imageUrl;
+                    }
+
+                    Map<String, Object> imageMap = kuaishouInterfaceService.imageUpload(accountId, accessToken, imagePath, 0);
+                    if ((Integer) imageMap.get("code") != 0) {
+                        returnMap.put("code", -1);
+                        returnMap.put("success", false);
+                        returnMap.put("message", "上传图片失败");
+                        return returnMap;
+                    }
+                    createJson.put("image_token", imageMap.get("imageToken"));
+                    createJson.put("creative_name", creativeName + "_" + i);
+                    System.err.println(createJson);
+                    Map<String, Object> creativeMap = kuaishouInterfaceService.creativeCreate(accessToken, accountId, createJson);
+                    if ((Integer) creativeMap.get("code") != 0) {
+                        throw new Exception("批量创建创意失败");
+                    }
+                }
+
+            }
+            returnMap.put("code", 0);
+            returnMap.put("success", true);
+            returnMap.put("message", "创建创意成功");
+            return returnMap;
+
+        } catch (Exception e) {
+            returnMap.put("code", -1);
+            returnMap.put("success", false);
+            returnMap.put("message", "批量创建广告创意失败");
+            e.printStackTrace();
+
+        }
+        return returnMap;
+    }
+
+
+    /**
+     * 三级联动 查询账号 计划 模板信息
+     *
+     * @param loginId
+     * @return
+     */
+
+    @Autowired
+    private KuaiShouCampaignCreateMapper campaignCreateMapper;
+
+    @Override
+    public JSONArray getOptions(String loginId, Long accountId) {
+        JSONArray result = new JSONArray();
+        QueryWrapper<KuaiShouGroupCreateLog> wrapper = new QueryWrapper<>();
+        wrapper.eq("login_id", loginId).eq("account_id", accountId).orderByDesc("create_time");
+        wrapper.groupBy("campaign_id");
+        List<KuaiShouGroupCreateLog> accounts = groupCreateLogMapper.selectList(wrapper);
+        if (!Check.isNull(accounts)) {
+            for (KuaiShouGroupCreateLog groupCreateLog : accounts) {
+                JSONObject optionsJson = new JSONObject();
+                Long campaignId = groupCreateLog.getCampaignId();
+                optionsJson.put("value", campaignId);
+                QueryWrapper<KuaiShouCampaignCreate> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("account_id", accountId).eq("campaign_id", campaignId).orderByDesc("create_time");
+                queryWrapper.last("limit 1");
+                KuaiShouCampaignCreate campaignCreate = campaignCreateMapper.selectOne(queryWrapper);
+                optionsJson.put("label", campaignCreate.getCampaignName());
+                optionsJson.put("isLeaf", false);
+                result.add(optionsJson);
+            }
+
+        }
+        return result;
+    }
+
+    /**
+     * 获取组信息
+     *
+     * @param loginId
+     * @param campaignId
+     * @return
+     */
+    @Override
+    public JSONArray getChildren(String loginId, Long campaignId, Long accountId) {
+        JSONArray result = new JSONArray();
+        QueryWrapper<KuaiShouGroupCreateLog> wrapper = new QueryWrapper<>();
+        wrapper.eq("account_id", accountId);
+        wrapper.eq("campaign_id", campaignId);
+        wrapper.eq("login_id", loginId);
+        wrapper.orderByDesc("create_time");
+        wrapper.groupBy("unit_name");
+        List<KuaiShouGroupCreateLog> accounts = groupCreateLogMapper.selectList(wrapper);
+        if (!Check.isNull(accounts)) {
+            for (KuaiShouGroupCreateLog groupCreateLog : accounts) {
+                JSONObject optionsJson = new JSONObject();
+                optionsJson.put("value", groupCreateLog.getUnitId());
+                optionsJson.put("label", groupCreateLog.getUnitName());
+                result.add(optionsJson);
+            }
+
+        }
+        return result;
+    }
+
+
+}

+ 10 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaiShouGroupCreateTemplateServiceImpl.java

@@ -1,32 +1,33 @@
 package org.jeecg.modules.kuaishou.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.jeecg.modules.kuaishou.entity.KuaiShouGroupCreateTemplate;
-import org.jeecg.modules.kuaishou.mapper.KuaiShouGroupCreateTemplateMapper;
-import org.jeecg.modules.kuaishou.service.IKuaiShouGroupCreateTemplateService;
+import org.jeecg.modules.kuaishou.entity.KuaiShouGroupCreateLog;
+import org.jeecg.modules.kuaishou.mapper.KuaiShouGroupCreateLogMapper;
+import org.jeecg.modules.kuaishou.service.IKuaiShouGroupCreateLogService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.HashMap;
 import java.util.Map;
 
+
 /**
- * @Description: 快手-创建广告组信息模板
+ * @Description: 快手-批量创建广告组
  * @Author: jeecg-boot
- * @Date: 2019-08-07
+ * @Date: 2019-08-09
  * @Version: V1.0
  */
 @Service
-public class KuaiShouGroupCreateTemplateServiceImpl extends ServiceImpl<KuaiShouGroupCreateTemplateMapper, KuaiShouGroupCreateTemplate> implements IKuaiShouGroupCreateTemplateService {
+public class KuaiShouGroupCreateLogServiceImpl extends ServiceImpl<KuaiShouGroupCreateLogMapper, KuaiShouGroupCreateLog> implements IKuaiShouGroupCreateLogService {
 
     @Autowired
-    private KuaiShouGroupCreateTemplateMapper groupCreateMapper;
+    private KuaiShouGroupCreateLogMapper createLogMapper;
 
     @Override
-    public Map<String, Object> insert(KuaiShouGroupCreateTemplate groupCreateTemplate) {
+    public Map<String, Object> insert(KuaiShouGroupCreateLog createLog) {
         Map<String, Object> resultMap = new HashMap<>();
         try {
-            groupCreateMapper.insert(groupCreateTemplate);
+            createLogMapper.insert(createLog);
             resultMap.put("success", true);
             resultMap.put("message", "创建广告组成功");
             resultMap.put("code", 0);

+ 79 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaiShouImageServiceImpl.java

@@ -0,0 +1,79 @@
+package org.jeecg.modules.kuaishou.service.impl;
+
+import cn.com.ctop.common.utils.Check;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import constant.KuaishouInterfaceConstant;
+import org.jeecg.common.util.encryption.AesEncryptUtil;
+import org.jeecg.modules.kuaishou.entity.KuaiShouImage;
+import org.jeecg.modules.kuaishou.entity.KuaiShouVideo;
+import org.jeecg.modules.kuaishou.mapper.KuaiShouImageMapper;
+import org.jeecg.modules.kuaishou.service.IKuaiShouImageService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * @Description: 快手-本地图片保存
+ * @Author: jeecg-boot
+ * @Date: 2019-08-14
+ * @Version: V1.0
+ */
+@Service
+public class KuaiShouImageServiceImpl extends ServiceImpl<KuaiShouImageMapper, KuaiShouImage> implements IKuaiShouImageService {
+
+    @Autowired
+    private KuaiShouImageMapper imageMapper;
+
+    @Override
+    public void insert(JSONObject requestJson) {
+        JSONArray imageArr = requestJson.getJSONArray("localImageUrl");
+        if (!Check.isNull(imageArr)) {
+            for (int i = 0; i < imageArr.size(); i++) {
+                KuaiShouImage image = new KuaiShouImage();
+                String imageUrl = imageArr.get(i).toString();
+                String fileName = imageUrl.substring(imageUrl.lastIndexOf("/") + 1);
+                String fileNameStr = null;
+                if (!Check.isNull(fileName)) {
+                    String[] split = fileName.split("-");
+                    fileNameStr = split[0];
+                }
+                image.setImageName(AesEncryptUtil.getURLDecoderString(fileNameStr));
+                image.setLoginId(requestJson.getString("loginId"));
+                image.setMaterialType(requestJson.getString("materialType"));
+                image.setLocalUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + imageUrl);
+                imageMapper.insert(image);
+
+            }
+
+        }
+
+
+    }
+
+    @Override
+    public String localInsert(String url, JSONObject requestJson) {
+        String imageUrl = "";
+        if (!Check.isNull(url)) {
+            KuaiShouImage image = new KuaiShouImage();
+
+            String fileName = url.substring(url.lastIndexOf("/") + 1);
+            String fileNameStr = null;
+            if (!Check.isNull(fileName)) {
+                String[] split = fileName.split("-");
+                fileNameStr = split[0];
+            }
+            image.setLoginId(requestJson.getString("loginId"));
+            image.setImageName(AesEncryptUtil.getURLDecoderString(fileNameStr));
+            image.setMaterialType(requestJson.getString("videoUploadType"));
+            imageUrl = KuaishouInterfaceConstant.HTTPS_PREFIX + url;
+            image.setLocalUrl(imageUrl);
+            imageMapper.insert(image);
+
+
+        }
+
+        return imageUrl;
+    }
+}

+ 41 - 11
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaiShouVideoServiceImpl.java

@@ -3,6 +3,7 @@ package org.jeecg.modules.kuaishou.service.impl;
 import cn.com.ctop.common.utils.Check;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import constant.KuaishouInterfaceConstant;
 import org.jeecg.common.util.encryption.AesEncryptUtil;
 import org.jeecg.modules.kuaishou.entity.KuaiShouVideo;
@@ -11,12 +12,10 @@ import org.jeecg.modules.kuaishou.service.IKuaiShouVideoService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-
 /**
- * @Description: 快手-上传视频
+ * @Description: 快手-本地图片保存
  * @Author: jeecg-boot
- * @Date: 2019-08-06
+ * @Date: 2019-08-14
  * @Version: V1.0
  */
 @Service
@@ -30,23 +29,54 @@ public class KuaiShouVideoServiceImpl extends ServiceImpl<KuaiShouVideoMapper, K
             throw new Exception("传递参数不能为空");
         }
         JSONArray localArr = requestJson.getJSONArray("localUrl");
-        if (Check.isNull(localArr)) {
-            throw new Exception("地址不能为空");
+        if (!Check.isNull(localArr)) {
+            for (int i = 0; i < localArr.size(); i++) {
+                KuaiShouVideo video = new KuaiShouVideo();
+                video.setVideoDesc(requestJson.getString("videoDesc"));
+                String url = localArr.get(i).toString();
+                String fileName = url.substring(url.lastIndexOf("/") + 1);
+                String fileNameStr = null;
+                if (!Check.isNull(fileName)) {
+                    String[] split = fileName.split("-");
+                    fileNameStr = split[0];
+                }
+                video.setLoginId(requestJson.getString("loginId"));
+                video.setVideoName(AesEncryptUtil.getURLDecoderString(fileNameStr));
+                video.setLocalUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
+                video.setMaterialType(requestJson.getString("materialType"));
+                kuaiShouVideoMapper.insert(video);
+            }
         }
-        for (int i = 0; i < localArr.size(); i++) {
+
+    }
+
+    @Override
+    public String localInsert(JSONObject requestJson) throws Exception {
+
+        String url = null;
+        String videoUrl = requestJson.getString("videoUrl");
+        if (!Check.isNull(videoUrl)) {
+
             KuaiShouVideo video = new KuaiShouVideo();
-            video.setVideoDesc(requestJson.getString("videoDesc"));
-            String url = localArr.get(i).toString();
-            String fileName = url.substring(url.lastIndexOf("/") + 1);
+            video.setVideoDesc(requestJson.getString("description"));
+            String fileName = videoUrl.substring(videoUrl.lastIndexOf("/") + 1);
             String fileNameStr = null;
             if (!Check.isNull(fileName)) {
                 String[] split = fileName.split("-");
                 fileNameStr = split[0];
             }
+            url = KuaishouInterfaceConstant.HTTPS_PREFIX + videoUrl;
+            video.setLocalUrl(url);
             video.setLoginId(requestJson.getString("loginId"));
+            video.setMaterialType(requestJson.getString("videoType"));
             video.setVideoName(AesEncryptUtil.getURLDecoderString(fileNameStr));
-            video.setLocalUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
+
+
             kuaiShouVideoMapper.insert(video);
+
         }
+
+        return url;
     }
+
 }

+ 292 - 129
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/service/impl/KuaishouInterfaceServiceImpl.java

@@ -4,8 +4,10 @@ import cn.com.ctop.common.utils.*;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResult;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
 import cn.com.ctop.kuaishou.modules.report.entity.*;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fasterxml.jackson.core.JsonParseException;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.DeserializationFeature;
@@ -15,6 +17,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.type.TypeFactory;
 import constant.KuaishouInterfaceConstant;
 import org.apache.http.ParseException;
+import org.jeecg.common.util.LoadFileUtil;
 import org.jeecg.modules.kuaishou.entity.*;
 import org.jeecg.modules.kuaishou.mapper.*;
 import org.jeecg.modules.kuaishou.service.IKuaishouInterfaceService;
@@ -38,6 +41,7 @@ import java.io.IOException;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -46,7 +50,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private static final Logger logger = LoggerFactory.getLogger(KuaishouInterfaceServiceImpl.class);
 
 
-    @Override
     public KuaishouResult<KuaishouReportHourlyAccount> getAccountHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.ACCOUNT_REPORT;
         Map<String, String> headers = new HashMap<String, String>();
@@ -76,7 +79,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return kuaishouResult;
     }
 
-    @Override
     public KuaishouResult<KuaishouReportDailyAccount> getAccountDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.ACCOUNT_REPORT;
         Map<String, String> headers = new HashMap<String, String>();
@@ -103,7 +105,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return kuaishouResult;
     }
 
-    @Override
     public KuaishouResult<KuaishouReportDailyCampaign> getCampaignDailyReport(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>();
@@ -130,7 +131,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return kuaishouResult;
     }
 
-    @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>();
@@ -157,7 +157,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return kuaishouResult;
     }
 
-    @Override
     public KuaishouResult<KuaishouReportDailyGroup> getGroupDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GTOUP_REPORT;
         Map<String, String> headers = new HashMap<String, String>();
@@ -184,7 +183,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return kuaishouResult;
     }
 
-    @Override
     public KuaishouResult<KuaishouReportHourlyGroup> getGroupHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GTOUP_REPORT;
         Map<String, String> headers = new HashMap<String, String>();
@@ -211,7 +209,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return kuaishouResult;
     }
 
-    @Override
     public KuaishouResult<KuaishouReportDailyCreative> getCreativeDailyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_REPORT;
         Map<String, String> headers = new HashMap<String, String>();
@@ -238,7 +235,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         return kuaishouResult;
     }
 
-    @Override
     public KuaishouResult<KuaishouReportHourlyCreative> getCreativeHourlyReport(String accessToken, Long advertiserId, String startDate, String endDate, int pageSize, int pageNum) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_REPORT;
         Map<String, String> headers = new HashMap<String, String>();
@@ -304,6 +300,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     }
                     returnMap.put("code", 0);
                     returnMap.put("message", "success");
+                    returnMap.put("campaign_id", campaign_id);
 
                 } else {
                     logger.error("创建广告信息失败,advertiser_id:{},返回信息:{}", advertiser_id, resultJson);
@@ -353,14 +350,12 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         try {
             if (Check.isNull(requestJson)) {
                 throw new Exception("参数不能为空");
-
             }
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.AD_UNIT_CREATE;
             Map<String, String> headers = new HashMap<String, String>();
             requestJson.put("advertiser_id", advertiser_id);
             headers.put("Access-Token", accessToken);
             headers.put("Content-Type", " application/json");
-
             String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
             JSONObject resultJson = JSONObject.parseObject(result);
             if (!Check.isNull(resultJson)) {
@@ -414,6 +409,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
                         returnMap.put("code", 0);
                         returnMap.put("message", "success");
+                        returnMap.put("unitId", unitId);
                     }
 
                 } else {
@@ -744,18 +740,20 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private KuaiShouConversionTypesMapper conversionTypesMapper;
 
     @Override
-    public void getDeepConversionInfos(Long advertiserId, String accessToken) {
+    public Map<String, Object> getDeepConversionInfos(Long advertiserId, String accessToken) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.DEEP_CONVERSION_INFOS;
         JSONObject param = new JSONObject();
         param.put("advertiser_id", advertiserId);
         Map<String, String> headers = new HashMap<String, String>();
         headers.put("Access-Token", accessToken);
         headers.put("Content-Type", " application/json");
+        Map<String, Object> resultMap = new HashMap<>();
         try {
             String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
             JSONObject resultJson = JSONObject.parseObject(result);
             if (!Check.isNullMap(resultJson)) {
                 Integer code = resultJson.getInteger("code");
+                boolean isActivate = false;
                 if (code == 0) {
                     Map<String, Object> deleteMap = new HashMap<>();
                     deleteMap.put("account_id", advertiserId);
@@ -765,7 +763,11 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     if (!Check.isNullMap(dataJson)) {
                         KuaiShouConversionInfos conversionInfos = new KuaiShouConversionInfos();
                         conversionInfos.setAccountId(advertiserId);
-                        conversionInfos.setIsActivate(dataJson.getInteger("is_activate"));
+                        Integer is_activate = dataJson.getInteger("is_activate");
+                        if (is_activate == 1) {
+                            isActivate = true;
+                        }
+                        conversionInfos.setIsActivate(is_activate);
                         conversionInfos.setIsFormSubmit(dataJson.getInteger("is_form_submit"));
                         conversionInfosMapper.insert(conversionInfos);
                         JSONArray ConversionTypeArr = dataJson.getJSONArray("deep_conversion_types");
@@ -783,19 +785,32 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                         }
                     }
 
+                    resultMap.put("code", 0);
+                    resultMap.put("success", true);
+                    resultMap.put("isActivate", isActivate);
+
                 } else {
                     logger.error("获取可选的深度转化类型返回异常,advertiserId:{},异常信息:{}", advertiserId, resultJson);
+                    resultMap.put("code", -1);
+                    resultMap.put("success", false);
+                    resultMap.put("message", "获取可选的深度转化类型返回异常");
 
                 }
 
             } else {
                 logger.error("快手,获取可选的深度转化类型返回为空,advertiserId:{}", advertiserId);
+                resultMap.put("code", -1);
+                resultMap.put("success", false);
+                resultMap.put("message", "获取可选的深度转化类型返回为空");
             }
 
-        } catch (
-                Exception e) {
+        } catch (Exception e) {
             e.printStackTrace();
+            resultMap.put("code", -1);
+            resultMap.put("success", false);
+            resultMap.put("message", "接口异常");
         }
+        return resultMap;
 
     }
 
@@ -813,7 +828,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     public Map<String, Object> creativeCreate(String accessToken, Long advertiserId, JSONObject requestJson) {
         Map<String, Object> returnMap = new HashMap<>();
         try {
-            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CAMPAIGN_CREATE;
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.AD_CREATIVE_CREATE;
             requestJson.put("advertiser_id", advertiserId);
             Map<String, String> header = new HashMap<String, String>();
             header.put("Content-Type", " application/json");
@@ -877,56 +892,83 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private KuaiShouVideoUploadMapper videoUploadMapper;
 
     @Override
-    public void videoUpload(Long advertiserId, String accessToken, MultipartFile multipartFile, HttpServletRequest request) {
+    public Map<String, Object> videoUpload(Long advertiserId, String accessToken, String videoUrl) {
         Map<String, Object> returnMap = new HashMap<>();
         try {
-            String savaPath = "D:\\tets1";
-            FileUploadTool fileUploadTool = new FileUploadTool();
-            FileEntity entity;
-            entity = fileUploadTool.createFile(multipartFile, request, savaPath);
-            if (!Check.isNull(entity)) {
-                String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_UPLOAD;
-                JSONObject requestJson = new JSONObject();
-                requestJson.put("advertiser_id", advertiserId);
-                Map<String, String> headerMap = new HashMap<String, String>();
-                headerMap.put("Access-Token", accessToken);
-                headerMap.put("Content-Type", "multipart/form-data");
-                String result = exceptInfoForRestTemplate(url, requestJson, headerMap, entity.getPath());
-                JSONObject resultJson = JSONObject.parseObject(result);
-                if (!Check.isNull(result)) {
-                    Integer code = resultJson.getInteger("code");
-                    if (code == 0) {
-                        JSONObject dataJson = resultJson.getJSONObject("data");
-                        if (!Check.isNull(dataJson)) {
-                            KuaiShouVideoUpload videoUpload = new KuaiShouVideoUpload();
-                            videoUpload.setPhotoId(dataJson.getString("photo_id"));
-                            videoUpload.setAccountId(advertiserId);
-                            videoUpload.setSavaPath(entity.getPath());
-                            videoUpload.setSize(entity.getSize());
-                            videoUpload.setType(entity.getType());
-                            videoUpload.setUploadTime(DateUtils.timeStamp2Date(entity.getUploadTime()));
-                            int i = videoUploadMapper.insert(videoUpload);
-                            if (i > 0) {
-                                logger.info("上传快手视频完成");
-                            }
+            QueryWrapper<KuaiShouVideoUpload> wrapper = new QueryWrapper<>();
+            wrapper.eq("account_id", advertiserId).eq("sava_path", videoUrl).orderByDesc("create_time");
+            wrapper.last("limit 1");
+            KuaiShouVideoUpload videoUpload = videoUploadMapper.selectOne(wrapper);
+            if (!Check.isNull(videoUpload)) {
+                returnMap.put("code", 0);
+                returnMap.put("message", "视频已上传文件");
+                returnMap.put("success", true);
+                returnMap.put("photoId", videoUpload.getPhotoId());
+                return returnMap;
+            }
+            String localUrl = LoadFileUtil.downLoadFromUrl(videoUrl, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
+            if (Check.isNull(localUrl)) {
+                logger.error("下载文件到本地文件夹失败,filePath:{},accountId:{}", videoUrl, advertiserId);
+                throw new Exception("下载文件到本地失败");
+            }
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_UPLOAD;
+            JSONObject requestJson = new JSONObject();
+            requestJson.put("advertiser_id", advertiserId);
+            Map<String, String> headerMap = new HashMap<String, String>();
+            headerMap.put("Access-Token", accessToken);
+            headerMap.put("Content-Type", "multipart/form-data");
+            String result = exceptInfoForRestTemplate(url, requestJson, headerMap, localUrl);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(result)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    JSONObject dataJson = resultJson.getJSONObject("data");
+                    if (!Check.isNull(dataJson)) {
+                        KuaiShouVideoUpload kuaiShouVideoUpload = new KuaiShouVideoUpload();
+                        kuaiShouVideoUpload.setPhotoId(dataJson.getString("photo_id"));
+                        kuaiShouVideoUpload.setAccountId(advertiserId);
+                        kuaiShouVideoUpload.setSavaPath(videoUrl);
+                        kuaiShouVideoUpload.setSize(null);
+                        kuaiShouVideoUpload.setType(null);
+                        kuaiShouVideoUpload.setUploadTime(DateUtils.timeStamp2Date(System.currentTimeMillis()));
+                        int i = videoUploadMapper.insert(kuaiShouVideoUpload);
+                        if (i > 0) {
+                            logger.info("上传快手视频完成");
                         }
-                    } else {
-                        logger.error("快手上传视频返回信息异常 ,advertiserId:{},异常信息:{}", advertiserId, resultJson);
+                        returnMap.put("code", 0);
+                        returnMap.put("message", "视频已上传文件");
+                        returnMap.put("success", true);
+                        returnMap.put("photoId", dataJson.getString("photo_id"));
+                        return returnMap;
                     }
-
                 } else {
-                    logger.error("快手上传视频返回信息为空,advertiserId:{}", advertiserId);
+                    logger.error("快手上传视频返回信息异常 ,advertiserId:{},异常信息:{}", advertiserId, resultJson);
+                    returnMap.put("code", -1);
+                    returnMap.put("message", "视频上传失败");
+                    returnMap.put("success", false);
+                    return returnMap;
                 }
+
+            } else {
+                logger.error("快手上传视频返回信息为空,advertiserId:{}", advertiserId);
+                returnMap.put("code", -1);
+                returnMap.put("message", "视频上传失败");
+                returnMap.put("success", false);
+                return returnMap;
             }
 
+
         } catch (Exception e) {
             logger.error("上传视频失败,advertiser_id:{}", advertiserId);
+
+            e.printStackTrace();
             returnMap.put("code", -1);
             returnMap.put("message", "error");
             returnMap.put("desc", "Interface exception");
-            e.printStackTrace();
+            returnMap.put("success", false);
+            return returnMap;
         }
-
+        return null;
     }
 
 
@@ -1120,51 +1162,75 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private KuaiShouImageUploandMapper imageUploandMapper;
 
     @Override
-    public void imageUpload(Long advertiserId, String accessToken, MultipartFile multipartFile, HttpServletRequest request) {
+    public Map<String, Object> imageUpload(Long advertiserId, String accessToken, String filePath, Integer type) {
         Map<String, Object> returnMap = new HashMap<>();
         try {
-            String savaPath = "D:\\tets1\\image";
-            FileUploadTool fileUploadTool = new FileUploadTool();
-            FileEntity entity;
-            entity = fileUploadTool.createFile(multipartFile, request, savaPath);
-
-            if (!Check.isNull(entity)) {
-                String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.IMAGE_UPLOAD;
-                JSONObject requestJson = new JSONObject();
-                requestJson.put("advertiser_id", advertiserId);
-                Map<String, String> headerMap = new HashMap<String, String>();
-                headerMap.put("Content-Type", "multipart/form-data");
-                headerMap.put("Access-Token", accessToken);
-                String result = exceptInfoForRestTemplate(url, requestJson, headerMap, entity.getPath());
-                JSONObject resultJson = JSONObject.parseObject(result);
-                if (!Check.isNull(result)) {
-                    Integer code = resultJson.getInteger("code");
-                    if (code == 0) {
-                        JSONObject dataJson = resultJson.getJSONObject("data");
-                        if (!Check.isNull(dataJson)) {
-                            KuaiShouImageUploand imageUploand = new KuaiShouImageUploand();
-                            imageUploand.setAccountId(advertiserId);
-                            imageUploand.setSavaPath(entity.getPath());
-                            imageUploand.setUploadTime(DateUtils.timeStamp2Date(entity.getUploadTime()));
-                            imageUploand.setUrl(dataJson.getString("url"));
-                            imageUploand.setImageToken(dataJson.getString("image_token"));
-                            imageUploand.setHeight(dataJson.getLong("height"));
-                            imageUploand.setSize(dataJson.getLong("size"));
-                            imageUploand.setFormat(dataJson.getString("format"));
-                            imageUploand.setWidth(dataJson.getLong("width"));
-                            int i = imageUploandMapper.insert(imageUploand);
-                            if (i > 0) {
-                                logger.info("快手-图片上传成功");
-                            }
+            QueryWrapper<KuaiShouImageUploand> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("account_id", advertiserId).eq("sava_path", filePath).orderByDesc("create_time");
+            queryWrapper.last("limit 1");
+            KuaiShouImageUploand kuaiShouImageUploand = imageUploandMapper.selectOne(queryWrapper);
+            if (!Check.isNull(kuaiShouImageUploand)) {
+                returnMap.put("code", 0);
+                returnMap.put("message", "图片已上传文件已上传");
+                returnMap.put("success", true);
+                returnMap.put("imageToken", kuaiShouImageUploand.getImageToken());
+                return returnMap;
+            }
+            String localUrl = LoadFileUtil.downLoadFromUrl(filePath, PropertiesUtils.getValue("kuaishou_config", "image_sava_path"));
+            if (Check.isNull(localUrl)) {
+                logger.error("下载文件到本地文件夹失败,filePath:{},accountId:{}", filePath, advertiserId);
+                throw new Exception("下载文件到本地失败");
+            }
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.IMAGE_UPLOAD;
+            JSONObject requestJson = new JSONObject();
+            requestJson.put("advertiser_id", advertiserId);
+            requestJson.put("type", type);
+            Map<String, String> headerMap = new HashMap<String, String>();
+            headerMap.put("Content-Type", "multipart/form-data");
+            headerMap.put("Access-Token", accessToken);
+            String result = exceptInfoForRestTemplate(url, requestJson, headerMap, localUrl);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(result)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    JSONObject dataJson = resultJson.getJSONObject("data");
+                    if (!Check.isNull(dataJson)) {
+                        KuaiShouImageUploand imageUploand = new KuaiShouImageUploand();
+                        imageUploand.setAccountId(advertiserId);
+                        imageUploand.setSavaPath(filePath);
+                        imageUploand.setUploadTime(new Date().toString());
+                        imageUploand.setUrl(dataJson.getString("url"));
+                        imageUploand.setImageToken(dataJson.getString("image_token"));
+                        imageUploand.setHeight(dataJson.getLong("height"));
+                        imageUploand.setSize(dataJson.getLong("size"));
+                        imageUploand.setFormat(dataJson.getString("format"));
+                        imageUploand.setWidth(dataJson.getLong("width"));
+                        int i = imageUploandMapper.insert(imageUploand);
+                        if (i > 0) {
+                            logger.info("快手-图片上传成功");
                         }
-
-                    } else {
-                        logger.error("快手上传图片返回信息异常 ,advertiserId:{},异常信息:{}", advertiserId, resultJson);
+                        returnMap.put("code", 0);
+                        returnMap.put("desc", "上传图片完成");
+                        returnMap.put("imageToken", dataJson.getString("image_token"));
+                        return returnMap;
                     }
 
                 } else {
-                    logger.error("快手上传图片返回信息为空,advertiserId:{}", advertiserId);
+                    logger.error("快手上传图片返回信息异常 ,advertiserId:{},异常信息:{}", advertiserId, resultJson);
+                    returnMap.put("code", -1);
+                    returnMap.put("message", "error");
+                    returnMap.put("desc", resultJson.getString("message"));
                 }
+
+            } else {
+                logger.error("快手上传图片返回信息为空,advertiserId:{}", advertiserId);
+                returnMap.put("code", -1);
+                returnMap.put("message", "error");
+                returnMap.put("desc", "上传失败");
+            }
+            boolean trueOrFalse = LoadFileUtil.delFile(localUrl);
+            if (trueOrFalse) {
+                logger.info("删除本地文件成功,accountId:{}", advertiserId);
             }
         } catch (Exception e) {
             logger.error("上传图片失败,advertiser_id:{}", advertiserId);
@@ -1173,6 +1239,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             returnMap.put("desc", "Interface exception");
             e.printStackTrace();
         }
+        return returnMap;
 
     }
 
@@ -1188,50 +1255,76 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private KuaiShouAppCreateMapper appCreateMapper;
 
     @Override
-    public void appCreate(Long advertiserId, String accessToken, MultipartFile multipartFile, HttpServletRequest request, JSONObject requestJson) {
+    public Map<String, Object> appCreate(Long advertiserId, String accessToken, JSONObject requestJson) {
         Map<String, Object> returnMap = new HashMap<>();
         try {
-            String savaPath = "D:\\tets1\\app";
-            FileUploadTool fileUploadTool = new FileUploadTool();
-            FileEntity entity;
-            entity = fileUploadTool.createFile(multipartFile, request, savaPath);
-            if (!Check.isNull(entity)) {
-                String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.APP_CREATE;
-                Map<String, String> header = new HashMap<String, String>();
-                header.put("Content-Type", "multipart/form-data");
-                header.put("Access-Token", accessToken);
-                String result = exceptInfoForRestTemplate(url, requestJson, header, entity.getPath());
-                JSONObject resultJson = JSONObject.parseObject(result);
-                if (!Check.isNull(result)) {
-                    Integer code = resultJson.getInteger("code");
-                    if (code == 0) {
-                        JSONObject dataJson = resultJson.getJSONObject("data");
-                        if (!Check.isNull(dataJson)) {
-                            KuaiShouAppCreate appCreate = new KuaiShouAppCreate();
-                            appCreate.setAccountId(advertiserId);
-                            appCreate.setSavaPath(entity.getPath());
-                            appCreate.setUrl(requestJson.getString("url"));// 上传应用地址
-                            appCreate.setAppVersion(requestJson.getString("app_version"));
-                            appCreate.setAppName(requestJson.getString("app_name"));
-                            appCreate.setImageToken(requestJson.getString("image_token"));
-                            appCreate.setPackageName(requestJson.getString("package_name"));
-                            appCreate.setPlatform(requestJson.getInteger("platform"));
-                            appCreate.setReturnUrl(dataJson.getString("url"));
-                            appCreate.setAppId(dataJson.getLong("app_id"));
-                            appCreate.setUploadTime(DateUtils.timeStamp2Date(entity.getUploadTime()));
-                            int i = appCreateMapper.insert(appCreate);
-                            if (i > 0) {
-                                logger.info("快手创建应用成功");
-                            }
+            String filePath = requestJson.getString("file");
+
+            QueryWrapper<KuaiShouAppCreate> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("account_id", advertiserId).eq("sava_path", filePath).orderByDesc("create_time");
+            queryWrapper.last("limit 1");
+            KuaiShouAppCreate kuaiShouAppCreate = appCreateMapper.selectOne(queryWrapper);
+            if (!Check.isNull(kuaiShouAppCreate)) {
+                returnMap.put("code", 0);
+                returnMap.put("message", "文件已上传");
+                returnMap.put("success", true);
+                returnMap.put("appId", kuaiShouAppCreate.getAppId());
+                return returnMap;
+            }
+            String localUrl = LoadFileUtil.downLoadFromUrl(filePath, PropertiesUtils.getValue("kuaishou_config", "apk_sava_path"));
+            if (Check.isNull(localUrl)) {
+                logger.error("下载文件到本地文件夹失败,filePath:{},accountId:{}", filePath, advertiserId);
+                throw new Exception("下载文件到本地失败");
+            }
+            requestJson.put("advertiser_id", advertiserId);
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.APP_CREATE;
+            Map<String, String> header = new HashMap<String, String>();
+            header.put("Content-Type", "multipart/form-data");
+            header.put("Access-Token", accessToken);
+            String result = exceptInfoForRestTemplate(url, requestJson, header, localUrl);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(result)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    JSONObject dataJson = resultJson.getJSONObject("data");
+                    if (!Check.isNull(dataJson)) {
+                        KuaiShouAppCreate appCreate = new KuaiShouAppCreate();
+                        appCreate.setAccountId(advertiserId);
+                        appCreate.setSavaPath(filePath);
+                        appCreate.setUrl(requestJson.getString("url"));// 上传应用地址
+                        appCreate.setAppVersion(requestJson.getString("app_version"));
+                        appCreate.setAppName(requestJson.getString("app_name"));
+                        appCreate.setImageToken(requestJson.getString("image_token"));
+                        appCreate.setPackageName(requestJson.getString("package_name"));
+                        appCreate.setPlatform(requestJson.getInteger("platform"));
+                        appCreate.setReturnUrl(dataJson.getString("url"));
+                        appCreate.setAppId(dataJson.getLong("app_id"));
+                        appCreate.setUploadTime(new Date().toString());
+                        int i = appCreateMapper.insert(appCreate);
+                        if (i > 0) {
+                            logger.info("快手创建应用成功");
                         }
-
-                    } else {
-                        logger.error("快手创建应用返回信息异常 ,advertiserId:{},异常信息:{}", advertiserId, resultJson);
+                        returnMap.put("code", 0);
+                        returnMap.put("message", "success");
+                        returnMap.put("appId", dataJson.getLong("app_id"));
                     }
 
                 } else {
-                    logger.error("快手创建应用返回信息为空,advertiserId:{}", advertiserId);
+                    logger.error("快手创建应用返回信息异常 ,advertiserId:{},异常信息:{}", advertiserId, resultJson);
+                    returnMap.put("code", -1);
+                    returnMap.put("message", "error");
+                    returnMap.put("desc", "Interface exception");
                 }
+
+            } else {
+                logger.error("快手创建应用返回信息为空,advertiserId:{}", advertiserId);
+                returnMap.put("code", -1);
+                returnMap.put("message", "error");
+                returnMap.put("desc", "Interface exception");
+            }
+            boolean trueOrFalse = LoadFileUtil.delFile(localUrl);
+            if (trueOrFalse) {
+                logger.info("删除本地文件成功,accountId:{}", advertiserId);
             }
         } catch (Exception e) {
             logger.error("创建应用失败,advertiser_id:{}", advertiserId);
@@ -1240,8 +1333,76 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             returnMap.put("desc", "Interface exception");
             e.printStackTrace();
         }
+        return returnMap;
+    }
+
+
+    @Override
+    public Map<String, Object> urlAppCreate(Long accountId, String accessToken, JSONObject apkJson) {
+        Map<String, Object> returnMap = new HashMap<>();
+        try {
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.APP_CREATE;
+            Map<String, String> headers = new HashMap<String, String>();
+            headers.put("Access-Token", accessToken);
+            headers.put("Content-Type", "multipart/form-data");
+            apkJson.put("advertiser_id", accountId + "");
+            String result = exceptInfoForRestTemplate(url, apkJson, headers, null);
+            System.err.println(apkJson);
+            System.err.println(url);
+            System.err.println(JSON.toJSONString(headers));
+
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(result)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    JSONObject dataJson = resultJson.getJSONObject("data");
+                    if (!Check.isNull(dataJson)) {
+                        KuaiShouAppCreate appCreate = new KuaiShouAppCreate();
+                        appCreate.setAccountId(accountId);
+                        appCreate.setUrl(apkJson.getString("url"));
+                        appCreate.setPackageName(apkJson.getString("package_name"));
+                        appCreate.setPlatform(apkJson.getInteger("platform"));
+                        appCreate.setReturnUrl(dataJson.getString("url"));
+                        appCreate.setAppId(dataJson.getLong("app_id"));
+                        appCreate.setAppVersion(apkJson.getString("app_version"));
+
+                        appCreate.setImageToken(apkJson.getString("image_token"));
+                        appCreate.setAppName(apkJson.getString("app_name"));
+                        int i = appCreateMapper.insert(appCreate);
+                        if (i > 0) {
+                            logger.info("快手创建应用成功");
+                        }
+                        returnMap.put("code", 0);
+                        returnMap.put("message", "success");
+                        returnMap.put("appId", dataJson.getLong("app_id"));
+                    }
+
+                } else {
+                    logger.error("快手创建应用返回信息异常 ,advertiserId:{},异常信息:{}", accountId, resultJson);
+                    returnMap.put("code", -1);
+                    returnMap.put("message", "error");
+                    returnMap.put("desc", "Interface exception");
+                }
+
+            } else {
+                logger.error("快手创建应用返回信息为空,advertiserId:{}", accountId);
+                returnMap.put("code", -1);
+                returnMap.put("message", "error");
+                returnMap.put("desc", "Interface exception");
+            }
+
+
+        } catch (Exception e) {
+            logger.error("创建应用失败,advertiser_id:{}", accountId);
+            returnMap.put("code", -1);
+            returnMap.put("message", "error");
+            returnMap.put("desc", "Interface exception");
+            e.printStackTrace();
+        }
+        return returnMap;
     }
 
+
     /**
      * 获取应用列表
      *
@@ -1350,13 +1511,15 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     @Autowired
     private RestTemplate rest;
 
-    @Override
     public String exceptInfoForRestTemplate(String url, Map<String, Object> paramMap, Map<String, String> headerMap, String filePath) throws ParseException {
 
         try {
-            FileSystemResource resource = new FileSystemResource(new File(filePath));
             MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
-            param.add("file", resource);
+            if (!Check.isNull(filePath)) {
+                FileSystemResource resource = new FileSystemResource(new File(filePath));
+                param.add("file", resource);
+            }
+
             if (!Check.isNullMap(paramMap)) {
                 for (String key : paramMap.keySet()) {
                     param.add(key, paramMap.get(key));

+ 157 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/KuaiShouActionBarTextList.vue

@@ -0,0 +1,157 @@
+<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.type"></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="8">
+            <a-form-item label="行动号召文案">
+              <a-input placeholder="请输入行动号召文案" v-model="queryParam.actionBarText"></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 -->
+
+    <!-- 表单区域 -->
+    <kuaiShouActionBarText-modal ref="modalForm" @ok="modalFormOk"></kuaiShouActionBarText-modal>
+  </a-card>
+</template>
+
+<script>
+  import KuaiShouActionBarTextModal from './modules/KuaiShouActionBarTextModal'
+  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+
+  export default {
+    name: "KuaiShouActionBarTextList",
+    mixins:[JeecgListMixin],
+    components: {
+      KuaiShouActionBarTextModal
+    },
+    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: 'type'
+           },
+		   {
+            title: '行动号召文案',
+            align:"center",
+            dataIndex: 'actionBarText'
+           },
+          {
+            title: '操作',
+            dataIndex: 'action',
+            align:"center",
+            scopedSlots: { customRender: 'action' },
+          }
+        ],
+		url: {
+          list: "/kuaishou/kuaiShouActionBarText/list",
+          delete: "/kuaishou/kuaiShouActionBarText/delete",
+          deleteBatch: "/kuaishou/kuaiShouActionBarText/deleteBatch",
+          exportXlsUrl: "kuaishou/kuaiShouActionBarText/exportXls",
+          importExcelUrl: "kuaishou/kuaiShouActionBarText/importExcel",
+       },
+    }
+  },
+  computed: {
+    importExcelUrl: function(){
+      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
+    }
+  },
+    methods: {
+     
+    }
+  }
+</script>
+<style scoped>
+  @import '~@assets/less/common.less'
+</style>

+ 56 - 21
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/KuaiShouGroupCreateTemplateList.vue

@@ -7,29 +7,29 @@
         <a-row :gutter="24">
 
           <a-col :md="6" :sm="8">
-            <a-form-item label="广告组名称">
-              <a-input placeholder="请输入广告组名称" v-model="queryParam.unitName"></a-input>
+            <a-form-item label="广告计划模板ID">
+              <a-input placeholder="请输入广告计划模板ID" v-model="queryParam.campaignTemplateId"></a-input>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="8">
-            <a-form-item label="出价类型">
-              <a-input placeholder="请输入出价类型" v-model="queryParam.bidType"></a-input>
+            <a-form-item label="账户ID">
+              <a-input placeholder="请输入账户ID" v-model="queryParam.accountId"></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.bid"></a-input>
+            <a-form-item label="广告活动ID">
+              <a-input placeholder="请输入广告活动ID" v-model="queryParam.campaignId"></a-input>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="8">
-            <a-form-item label="OCPC出价">
-              <a-input placeholder="请输入OCPC出价" v-model="queryParam.cpaBid"></a-input>
+            <a-form-item label="广告组名称">
+              <a-input placeholder="请输入广告组名称" v-model="queryParam.unitName"></a-input>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="8">
-            <a-form-item label="优化目标">
-              <a-input placeholder="请输入优化目标" v-model="queryParam.ocpxActionType"></a-input>
+            <a-form-item label="出价类型">
+              <a-input placeholder="请输入出价类型" v-model="queryParam.bidType"></a-input>
             </a-form-item>
           </a-col>
           </template>
@@ -51,7 +51,7 @@
     <!-- 操作按钮区域 -->
     <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-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>
@@ -103,23 +103,23 @@
     <!-- table区域-end -->
 
     <!-- 表单区域 -->
-    <kuaiShouGroupCreateTemplate-modal ref="modalForm" @ok="modalFormOk"></kuaiShouGroupCreateTemplate-modal>
+    <kuaiShouGroupCreateLog-modal ref="modalForm" @ok="modalFormOk"></kuaiShouGroupCreateLog-modal>
   </a-card>
 </template>
 
 <script>
-  import KuaiShouGroupCreateTemplateModal from './modules/KuaiShouGroupCreateTemplateModal'
+  import KuaiShouGroupCreateLogModal from './modules/KuaiShouGroupCreateLogModal'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 
   export default {
-    name: "KuaiShouGroupCreateTemplateList",
+    name: "KuaiShouGroupCreateLogList",
     mixins:[JeecgListMixin],
     components: {
-      KuaiShouGroupCreateTemplateModal
+      KuaiShouGroupCreateLogModal
     },
     data () {
       return {
-        description: '快手-创建广告组信息模板管理页面',
+        description: '快手-批量创建广告组管理页面',
         // 表头
         columns: [
           {
@@ -133,6 +133,21 @@
             }
            },
 		   {
+            title: '广告计划模板ID',
+            align:"center",
+            dataIndex: 'campaignTemplateId'
+           },
+		   {
+            title: '账户ID',
+            align:"center",
+            dataIndex: 'accountId'
+           },
+		   {
+            title: '广告活动ID',
+            align:"center",
+            dataIndex: 'campaignId'
+           },
+		   {
             title: '广告组名称',
             align:"center",
             dataIndex: 'unitName'
@@ -188,6 +203,21 @@
             dataIndex: 'dayBudget'
            },
 		   {
+            title: 'url类型 1:淘宝商品短链 2:淘宝商品 itemID',
+            align:"center",
+            dataIndex: 'urlType'
+           },
+		   {
+            title: '投放链接',
+            align:"center",
+            dataIndex: 'url'
+           },
+		   {
+            title: 'APP ID',
+            align:"center",
+            dataIndex: 'appId'
+           },
+		   {
             title: '创意展现方式  1:轮播 2:优选',
             align:"center",
             dataIndex: 'showModel'
@@ -198,6 +228,11 @@
             dataIndex: 'speed'
            },
 		   {
+            title: '广告组ID',
+            align:"center",
+            dataIndex: 'unitId'
+           },
+		   {
             title: '当前登录人id',
             align:"center",
             dataIndex: 'loginId'
@@ -210,11 +245,11 @@
           }
         ],
 		url: {
-          list: "/kuaishou/kuaiShouGroupCreateTemplate/list",
-          delete: "/kuaishou/kuaiShouGroupCreateTemplate/delete",
-          deleteBatch: "/kuaishou/kuaiShouGroupCreateTemplate/deleteBatch",
-          exportXlsUrl: "kuaishou/kuaiShouGroupCreateTemplate/exportXls",
-          importExcelUrl: "kuaishou/kuaiShouGroupCreateTemplate/importExcel",
+          list: "/kuaishou/kuaiShouGroupCreateLog/list",
+          delete: "/kuaishou/kuaiShouGroupCreateLog/delete",
+          deleteBatch: "/kuaishou/kuaiShouGroupCreateLog/deleteBatch",
+          exportXlsUrl: "kuaishou/kuaiShouGroupCreateLog/exportXls",
+          importExcelUrl: "kuaishou/kuaiShouGroupCreateLog/importExcel",
        },
     }
   },

+ 188 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/KuaiShouImageList.vue

@@ -0,0 +1,188 @@
+<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.localUrl"></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="8">
+            <a-form-item label="videoName">
+              <a-input placeholder="请输入videoName" v-model="queryParam.videoName"></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.imageType"></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="8">
+            <a-form-item label="登录人id">
+              <a-input placeholder="请输入登录人id" v-model="queryParam.loginId"></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="8">
+            <a-form-item label="图片类型 1-竖版图片 2-横版图片">
+              <a-input placeholder="请输入图片类型 1-竖版图片 2-横版图片" v-model="queryParam.materialType"></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 -->
+
+    <!-- 表单区域 -->
+    <kuaiShouImage-modal ref="modalForm" @ok="modalFormOk"></kuaiShouImage-modal>
+  </a-card>
+</template>
+
+<script>
+  import KuaiShouImageModal from './modules/KuaiShouImageModal'
+  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+
+  export default {
+    name: "KuaiShouImageList",
+    mixins:[JeecgListMixin],
+    components: {
+      KuaiShouImageModal
+    },
+    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: 'localUrl'
+           },
+		   {
+            title: 'videoName',
+            align:"center",
+            dataIndex: 'videoName'
+           },
+		   {
+            title: '视频类别',
+            align:"center",
+            dataIndex: 'imageType'
+           },
+		   {
+            title: '登录人id',
+            align:"center",
+            dataIndex: 'loginId'
+           },
+		   {
+            title: '图片类型 1-竖版图片 2-横版图片',
+            align:"center",
+            dataIndex: 'materialType'
+           },
+          {
+            title: '操作',
+            dataIndex: 'action',
+            align:"center",
+            scopedSlots: { customRender: 'action' },
+          }
+        ],
+		url: {
+          list: "/kuaishou/kuaiShouImage/list",
+          delete: "/kuaishou/kuaiShouImage/delete",
+          deleteBatch: "/kuaishou/kuaiShouImage/deleteBatch",
+          exportXlsUrl: "kuaishou/kuaiShouImage/exportXls",
+          importExcelUrl: "kuaishou/kuaiShouImage/importExcel",
+       },
+    }
+  },
+  computed: {
+    importExcelUrl: function(){
+      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
+    }
+  },
+    methods: {
+     
+    }
+  }
+</script>
+<style scoped>
+  @import '~@assets/less/common.less'
+</style>

+ 7 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/KuaiShouVideoList.vue

@@ -51,7 +51,7 @@
     <!-- 操作按钮区域 -->
     <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-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>
@@ -119,7 +119,7 @@
     },
     data () {
       return {
-        description: '快手-上传视频管理页面',
+        description: '快手-本地图片保存管理页面',
         // 表头
         columns: [
           {
@@ -157,6 +157,11 @@
             align:"center",
             dataIndex: 'loginId'
            },
+		   {
+            title: '视频类型 1-竖版视频 2-横版视频',
+            align:"center",
+            dataIndex: 'materialType'
+           },
           {
             title: '操作',
             dataIndex: 'action',

+ 130 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/modules/KuaiShouActionBarTextModal.vue

@@ -0,0 +1,130 @@
+<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-number v-decorator="[ 'type', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="行动号召文案">
+          <a-input placeholder="请输入行动号召文案" v-decorator="['actionBarText', {}]" />
+        </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: "KuaiShouActionBarTextModal",
+    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:{
+        },
+        url: {
+          add: "/kuaishou/kuaiShouActionBarText/add",
+          edit: "/kuaishou/kuaiShouActionBarText/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,'type','actionBarText'))
+		  //时间格式化
+        });
+
+      },
+      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>

+ 137 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/modules/KuaiShouActionBarTextModal__Style#Drawer.vue

@@ -0,0 +1,137 @@
+<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-number v-decorator="[ 'type', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="行动号召文案">
+          <a-input placeholder="请输入行动号召文案" v-decorator="['actionBarText', {}]" />
+        </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: "KuaiShouActionBarTextModal",
+    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:{
+        },
+        url: {
+          add: "/kuaishou/kuaiShouActionBarText/add",
+          edit: "/kuaishou/kuaiShouActionBarText/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,'type','actionBarText'))
+		  //时间格式化
+        });
+
+      },
+      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>

+ 46 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/modules/KuaiShouGroupCreateTemplateModal.vue

@@ -14,6 +14,24 @@
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
+          label="广告计划模板ID">
+          <a-input placeholder="请输入广告计划模板ID" v-decorator="['campaignTemplateId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="账户ID">
+          <a-input placeholder="请输入账户ID" v-decorator="['accountId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="广告活动ID">
+          <a-input placeholder="请输入广告活动ID" v-decorator="['campaignId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
           label="广告组名称">
           <a-input placeholder="请输入广告组名称" v-decorator="['unitName', {}]" />
         </a-form-item>
@@ -80,6 +98,24 @@
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
+          label="url类型 1:淘宝商品短链 2:淘宝商品 itemID">
+          <a-input-number v-decorator="[ 'urlType', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="投放链接">
+          <a-input placeholder="请输入投放链接" v-decorator="['url', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="APP ID">
+          <a-input placeholder="请输入APP ID" v-decorator="['appId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
           label="创意展现方式  1:轮播 2:优选">
           <a-input-number v-decorator="[ 'showModel', {}]" />
         </a-form-item>
@@ -92,6 +128,12 @@
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
+          label="广告组ID">
+          <a-input placeholder="请输入广告组ID" v-decorator="['unitId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
           label="当前登录人id">
           <a-input placeholder="请输入当前登录人id" v-decorator="['loginId', {}]" />
         </a-form-item>
@@ -107,7 +149,7 @@
   import moment from "moment"
 
   export default {
-    name: "KuaiShouGroupCreateTemplateModal",
+    name: "KuaiShouGroupCreateLogModal",
     data () {
       return {
         title:"操作",
@@ -127,8 +169,8 @@
         validatorRules:{
         },
         url: {
-          add: "/kuaishou/kuaiShouGroupCreateTemplate/add",
-          edit: "/kuaishou/kuaiShouGroupCreateTemplate/edit",
+          add: "/kuaishou/kuaiShouGroupCreateLog/add",
+          edit: "/kuaishou/kuaiShouGroupCreateLog/edit",
         },
       }
     },
@@ -143,7 +185,7 @@
         this.model = Object.assign({}, record);
         this.visible = true;
         this.$nextTick(() => {
-          this.form.setFieldsValue(pick(this.model,'unitName','bidType','bid','cpaBid','ocpxActionType','deepConversionType','page','beginTime','endTime','scheduleTime','dayBudget','showModel','speed','loginId'))
+          this.form.setFieldsValue(pick(this.model,'campaignTemplateId','accountId','campaignId','unitName','bidType','bid','cpaBid','ocpxActionType','deepConversionType','page','beginTime','endTime','scheduleTime','dayBudget','urlType','url','appId','showModel','speed','unitId','loginId'))
 		  //时间格式化
         });
 

+ 46 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/modules/KuaiShouGroupCreateTemplateModal__Style#Drawer.vue

@@ -14,6 +14,24 @@
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
+          label="广告计划模板ID">
+          <a-input placeholder="请输入广告计划模板ID" v-decorator="['campaignTemplateId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="账户ID">
+          <a-input placeholder="请输入账户ID" v-decorator="['accountId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="广告活动ID">
+          <a-input placeholder="请输入广告活动ID" v-decorator="['campaignId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
           label="广告组名称">
           <a-input placeholder="请输入广告组名称" v-decorator="['unitName', {}]" />
         </a-form-item>
@@ -80,6 +98,24 @@
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
+          label="url类型 1:淘宝商品短链 2:淘宝商品 itemID">
+          <a-input-number v-decorator="[ 'urlType', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="投放链接">
+          <a-input placeholder="请输入投放链接" v-decorator="['url', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="APP ID">
+          <a-input placeholder="请输入APP ID" v-decorator="['appId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
           label="创意展现方式  1:轮播 2:优选">
           <a-input-number v-decorator="[ 'showModel', {}]" />
         </a-form-item>
@@ -92,6 +128,12 @@
         <a-form-item
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
+          label="广告组ID">
+          <a-input placeholder="请输入广告组ID" v-decorator="['unitId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
           label="当前登录人id">
           <a-input placeholder="请输入当前登录人id" v-decorator="['loginId', {}]" />
         </a-form-item>
@@ -109,7 +151,7 @@
   import moment from "moment"
 
   export default {
-    name: "KuaiShouGroupCreateTemplateModal",
+    name: "KuaiShouGroupCreateLogModal",
     data () {
       return {
         title:"操作",
@@ -129,8 +171,8 @@
         validatorRules:{
         },
         url: {
-          add: "/kuaishou/kuaiShouGroupCreateTemplate/add",
-          edit: "/kuaishou/kuaiShouGroupCreateTemplate/edit",
+          add: "/kuaishou/kuaiShouGroupCreateLog/add",
+          edit: "/kuaishou/kuaiShouGroupCreateLog/edit",
         },
       }
     },
@@ -145,7 +187,7 @@
         this.model = Object.assign({}, record);
         this.visible = true;
         this.$nextTick(() => {
-          this.form.setFieldsValue(pick(this.model,'unitName','bidType','bid','cpaBid','ocpxActionType','deepConversionType','page','beginTime','endTime','scheduleTime','dayBudget','showModel','speed','loginId'))
+          this.form.setFieldsValue(pick(this.model,'campaignTemplateId','accountId','campaignId','unitName','bidType','bid','cpaBid','ocpxActionType','deepConversionType','page','beginTime','endTime','scheduleTime','dayBudget','urlType','url','appId','showModel','speed','unitId','loginId'))
 		  //时间格式化
         });
 

+ 148 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/modules/KuaiShouImageModal.vue

@@ -0,0 +1,148 @@
+<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="['localUrl', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="videoName">
+          <a-input placeholder="请输入videoName" v-decorator="['videoName', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="视频类别">
+          <a-input placeholder="请输入视频类别" v-decorator="['imageType', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="登录人id">
+          <a-input placeholder="请输入登录人id" v-decorator="['loginId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="图片类型 1-竖版图片 2-横版图片">
+          <a-input placeholder="请输入图片类型 1-竖版图片 2-横版图片" v-decorator="['materialType', {}]" />
+        </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: "KuaiShouImageModal",
+    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:{
+        },
+        url: {
+          add: "/kuaishou/kuaiShouImage/add",
+          edit: "/kuaishou/kuaiShouImage/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,'localUrl','videoName','imageType','loginId','materialType'))
+		  //时间格式化
+        });
+
+      },
+      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>

+ 155 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/modules/KuaiShouImageModal__Style#Drawer.vue

@@ -0,0 +1,155 @@
+<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="['localUrl', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="videoName">
+          <a-input placeholder="请输入videoName" v-decorator="['videoName', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="视频类别">
+          <a-input placeholder="请输入视频类别" v-decorator="['imageType', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="登录人id">
+          <a-input placeholder="请输入登录人id" v-decorator="['loginId', {}]" />
+        </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="图片类型 1-竖版图片 2-横版图片">
+          <a-input placeholder="请输入图片类型 1-竖版图片 2-横版图片" v-decorator="['materialType', {}]" />
+        </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: "KuaiShouImageModal",
+    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:{
+        },
+        url: {
+          add: "/kuaishou/kuaiShouImage/add",
+          edit: "/kuaishou/kuaiShouImage/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,'localUrl','videoName','imageType','loginId','materialType'))
+		  //时间格式化
+        });
+
+      },
+      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>

+ 7 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/modules/KuaiShouVideoModal.vue

@@ -41,6 +41,12 @@
           label="登录人id">
           <a-input placeholder="请输入登录人id" v-decorator="['loginId', {}]" />
         </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="视频类型 1-竖版视频 2-横版视频">
+          <a-input placeholder="请输入视频类型 1-竖版视频 2-横版视频" v-decorator="['materialType', {}]" />
+        </a-form-item>
 		
       </a-form>
     </a-spin>
@@ -89,7 +95,7 @@
         this.model = Object.assign({}, record);
         this.visible = true;
         this.$nextTick(() => {
-          this.form.setFieldsValue(pick(this.model,'localUrl','videoDesc','videoName','videoType','loginId'))
+          this.form.setFieldsValue(pick(this.model,'localUrl','videoDesc','videoName','videoType','loginId','materialType'))
 		  //时间格式化
         });
 

+ 7 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/kuaishou/vue/modules/KuaiShouVideoModal__Style#Drawer.vue

@@ -41,6 +41,12 @@
           label="登录人id">
           <a-input placeholder="请输入登录人id" v-decorator="['loginId', {}]" />
         </a-form-item>
+        <a-form-item
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          label="视频类型 1-竖版视频 2-横版视频">
+          <a-input placeholder="请输入视频类型 1-竖版视频 2-横版视频" v-decorator="['materialType', {}]" />
+        </a-form-item>
 		
       </a-form>
     </a-spin>
@@ -91,7 +97,7 @@
         this.model = Object.assign({}, record);
         this.visible = true;
         this.$nextTick(() => {
-          this.form.setFieldsValue(pick(this.model,'localUrl','videoDesc','videoName','videoType','loginId'))
+          this.form.setFieldsValue(pick(this.model,'localUrl','videoDesc','videoName','videoType','loginId','materialType'))
 		  //时间格式化
         });
 

+ 1 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/shiro/authc/ShiroRealm.java

@@ -51,8 +51,7 @@ public class ShiroRealm extends AuthorizingRealm {
 
 	/**
 	 * 功能: 获取用户权限信息,包括角色以及权限。只有当触发检测用户权限时才会调用此方法,例如checkRole,checkPermission
-	 * 
-	 * @param token token
+	 *
 	 * @return AuthorizationInfo 权限信息
 	 */
 	@Override

+ 12 - 0
module-common/src/main/java/cn/com/ctop/common/utils/DateUtils.java

@@ -142,4 +142,16 @@ public class DateUtils {
             return null;
         }
     }
+
+    public static String timeStamp2Date(long currentTimeMillis) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//要转换的时间格式
+        Date date;
+        try {
+            date = sdf.parse(sdf.format(currentTimeMillis));
+            return sdf.format(date);
+        } catch (ParseException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
 }

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

@@ -189,6 +189,7 @@ public class HttpUtils {
 
 
     public static String kuaiShouhttpPostRequest(String url, String body, Map<String, String> headers) {
+        System.err.println(body);
         HttpClient httpClient = createSSLClientDefault();
         String strReturn = "";
         try {

+ 3 - 1
module-kuaishou/src/main/java/constant/KuaishouInterfaceConstant.java

@@ -13,13 +13,15 @@ public class KuaishouInterfaceConstant {
     public static final String CREATIVE_LIST = "/rest/openapi/v1/creative/list"; //创意信息
     public static final String CAMPAIGN_CREATE = "/rest/openapi/v1/campaign/create"; //创建广告计划
     public static final String AD_UNIT_CREATE = "/rest/openapi/v1/ad_unit/create"; //创建广告组
+    public static final String AD_CREATIVE_CREATE = "/rest/openapi/v1/creative/create"; //创建广告组
+
 
     public static final String DEEP_CONVERSION_INFOS = "/rest/openapi/v1/ad_unit/ocpc/conversion_infos"; //获取可选的深度转化类型
     public static final String VIDEO_UPLOAD = "/rest/openapi/v1/file/ad/video/upload"; //视频文件上传
     public static final String VIDEO_GET = "/rest/openapi/v1/file/ad/video/get"; //视频文件获取
     public static final String IMAGE_GET = "/rest/openapi/v1/file/ad/image/get"; //图片文件获取获取地域信息图片文件获取
     public static final String REGION_LIST = "/rest/openapi/v1/region/list"; //图片文件获取获取地域信息图片文件获取
-    public static final String IMAGE_UPLOAD = "/rest/openapi/v1/file/ad/image/upload"; //视频文件上传
+    public static final String IMAGE_UPLOAD = "/rest/openapi/v1/file/ad/image/upload"; //图片文件上传
     public static final String APP_CREATE = "/rest/openapi/v1/file/ad/app/create"; //创建应用
     public static final String APP_LIST = "/rest/openapi/v1/file/ad/app/list"; //创建广告获取应用列表
 

+ 6 - 1
module-kuaishou/src/main/resources/kuaishou_config.properties

@@ -2,4 +2,9 @@ kuaishou_api_url=https://ad.e.kuaishou.com
 kuaishou_auth_url=https://ad.e.kuaishou.com
 kuaishou_appid=27
 kuaishou_secret=QovprB1tNhXptgDc
-kuaishou_callback_url=http://adsp.c-top.com.cn:8080/jeecg-boot/kuaishou
+kuaishou_callback_url=http://adsp.c-top.com.cn:8080/jeecg-boot/kuaishou
+
+
+apk_sava_path=D:\\file\\apk
+image_sava_path=D:\\file\\image
+video_sava_path=D:\\file\\video