zhaoxian 4 роки тому
батько
коміт
e33d14857a
23 змінених файлів з 1711 додано та 38 видалено
  1. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  2. 41 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialCutFrameController.java
  3. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouBatchCampaignTemplateController.java
  4. 275 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouBatchCampaignPreviewController.java
  5. 253 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouBatchCreativePreviewController.java
  6. 256 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouBatchGroupPreviewController.java
  7. 97 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouBatchCampaignPreview.java
  8. 178 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouBatchCreativePreview.java
  9. 212 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouBatchGroupPreview.java
  10. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouBatchCampaignPreviewMapper.java
  11. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouBatchCreativePreviewMapper.java
  12. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouBatchGroupPreviewMapper.java
  13. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouBatchCampaignPreviewMapper.xml
  14. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouBatchCreativePreviewMapper.xml
  15. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouBatchGroupPreviewMapper.xml
  16. 0 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouBatchCampaignTemplateService.java
  17. 16 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouBatchCampaignPreviewService.java
  18. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouBatchCreativePreviewService.java
  19. 14 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouBatchGroupPreviewService.java
  20. 0 26
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouBatchCampaignTemplateServiceImpl.java
  21. 255 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCampaignPreviewServiceImpl.java
  22. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCreativePreviewServiceImpl.java
  23. 19 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchGroupPreviewServiceImpl.java

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -184,6 +184,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/kuaishou/material/*", "anon");
         filterChainDefinitionMap.put("/kuaishou/create/*", "anon");
         filterChainDefinitionMap.put("/template/**", "anon");
+        filterChainDefinitionMap.put("/kuaishouBatchCampaignPreview/*", "anon");
 
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);

+ 41 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialCutFrameController.java

@@ -8,6 +8,8 @@ import cn.com.ctop.common.module.service.IMaterialCutFrameService;
 import cn.com.ctop.common.module.service.IMaterialCutFrameTaskService;
 import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -17,7 +19,14 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
@@ -44,6 +53,8 @@ public class MaterialCutFrameController {
     private IMaterialInfoService materialInfoService;
     @Autowired
     private IMaterialCutFrameTaskService materialCutFrameTaskServiceTask;
+    @Autowired
+    private IKuaiShouVideoGetService videoGetService;
 
     /**
      * 分页列表查询
@@ -74,6 +85,28 @@ public class MaterialCutFrameController {
         return result;
     }
 
+    /**
+     * 分页列表查询
+     *
+     * @param materialCutFrame
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "截屏-查询")
+    @ApiOperation(value = "截屏-查询", notes = "截屏-查询")
+    @GetMapping(value = "/queryByPhotoId")
+    public Result<Object> queryByPhotoId(Long photoId) {
+        try {
+            KuaiShouVideoGet videoGet = videoGetService.getVideoByPhotoId(photoId);
+            List<MaterialCutFrame> list = materialCutFrameService.getListByVideoSignature(videoGet.getSignature());
+            return Result.ok(list);
+        } catch (Exception e) {
+            log.error("queryByPhotoId error", e);
+            return Result.error(e.getMessage());
+        }
+    }
 
     /**
      * 添加
@@ -185,7 +218,7 @@ public class MaterialCutFrameController {
     @ApiOperation(value = "腾讯云抽帧", notes = "腾讯云抽帧")
     @GetMapping(value = "/getCosCutFrameByTime")
     public Result getCosCutFrameByTime(@RequestParam(name = "startDate", required = true) String startDate,
-                                 @RequestParam(name = "endDate", required = true) String endDate) {
+                                       @RequestParam(name = "endDate", required = true) String endDate) {
         Result result = new Result();
         result.setSuccess(true);
 
@@ -199,7 +232,7 @@ public class MaterialCutFrameController {
                     }
                 }
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             log.error(e.getMessage());
             e.printStackTrace();
             result.setSuccess(false);
@@ -220,7 +253,7 @@ public class MaterialCutFrameController {
             if (!Check.isNull(materialInfo)) {
                 materialCutFrameService.getCosCutFrame(materialInfo.getUrl(), code);
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             log.error(e.getMessage());
             e.printStackTrace();
             result.setSuccess(false);
@@ -240,7 +273,7 @@ public class MaterialCutFrameController {
         log.info("开始抽帧定时任务");
         QueryWrapper<MaterialCutFrameTask> taskQueryWrapper = new QueryWrapper<>();
         taskQueryWrapper.eq("job_status", 0);
-        taskQueryWrapper.eq("cloud_type",2);  //2为腾讯云 1为阿里云
+        taskQueryWrapper.eq("cloud_type", 2);  //2为腾讯云 1为阿里云
         List<MaterialCutFrameTask> list = materialCutFrameTaskServiceTask.list(taskQueryWrapper);
 
         if (Check.isNull(list)) {
@@ -255,9 +288,9 @@ public class MaterialCutFrameController {
                 @Override
                 public void run() {
                     try {
-                    //获取广告计划信息数据
-                    materialCutFrameService.loadCosCutFrame(cutFrameTask.getJobId(), cutFrameTask.getVideoSignature());
-                    }catch (Exception e){
+                        //获取广告计划信息数据
+                        materialCutFrameService.loadCosCutFrame(cutFrameTask.getJobId(), cutFrameTask.getVideoSignature());
+                    } catch (Exception e) {
                         log.error(e.getMessage());
                         e.printStackTrace();
                     }
@@ -269,5 +302,4 @@ public class MaterialCutFrameController {
     }
 
 
-
 }

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouBatchCampaignTemplateController.java

@@ -49,7 +49,7 @@ import java.util.Map;
 @Slf4j
 @Api(tags = "计划模板")
 @RestController
-@RequestMapping("/template/kuaiShouBatchCampaignTemplate")
+@RequestMapping("/template/saveOrUpdatekuaiShouBatchCampaignTemplate")
 public class KuaiShouBatchCampaignTemplateController {
     @Autowired
     private IKuaiShouBatchCampaignTemplateService kuaiShouBatchCampaignTemplateService;

+ 275 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouBatchCampaignPreviewController.java

@@ -0,0 +1,275 @@
+package cn.com.ctop.kuaishou.modules.batch.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.module.annotation.AutoLog;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchCampaignPreview;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouBatchCampaignPreviewService;
+import com.alibaba.fastjson.JSONObject;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+
+import java.util.Date;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 快手-广告计划预览信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-26
+ */
+@Slf4j
+@Api(tags = "快手-广告计划预览信息")
+@RestController
+@RequestMapping("/kuaishouBatchCampaignPreview")
+public class KuaishouBatchCampaignPreviewController {
+    @Autowired
+    private IKuaishouBatchCampaignPreviewService kuaishouBatchCampaignPreviewService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaishouBatchCampaignPreview
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "快手-广告计划预览信息-分页列表查询")
+    @ApiOperation(value = "快手-广告计划预览信息-分页列表查询", notes = "快手-广告计划预览信息-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaishouBatchCampaignPreview>> queryPageList(KuaishouBatchCampaignPreview kuaishouBatchCampaignPreview,
+                                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                     HttpServletRequest req) {
+        Result<IPage<KuaishouBatchCampaignPreview>> result = new Result<>();
+        QueryWrapper<KuaishouBatchCampaignPreview> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouBatchCampaignPreview, req.getParameterMap());
+        Page<KuaishouBatchCampaignPreview> page = new Page<KuaishouBatchCampaignPreview>(pageNo, pageSize);
+        IPage<KuaishouBatchCampaignPreview> pageList = kuaishouBatchCampaignPreviewService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaishouBatchCampaignPreview
+     * @return
+     */
+    @AutoLog(value = "快手-广告计划预览信息-添加")
+    @ApiOperation(value = "快手-广告计划预览信息-添加", notes = "快手-广告计划预览信息-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaishouBatchCampaignPreview> add(@RequestBody KuaishouBatchCampaignPreview kuaishouBatchCampaignPreview) {
+        Result<KuaishouBatchCampaignPreview> result = new Result<>();
+        try {
+            kuaishouBatchCampaignPreviewService.save(kuaishouBatchCampaignPreview);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaishouBatchCampaignPreview
+     * @return
+     */
+    @AutoLog(value = "添加预览数据")
+    @ApiOperation(value = "添加预览数据", notes = "添加预览数据")
+    @PostMapping(value = "/addPreviewData")
+    public Result<KuaishouBatchCampaignPreview> addPreviewData(@RequestBody JSONObject data) {
+        Result<KuaishouBatchCampaignPreview> result = new Result<>();
+        try {
+            kuaishouBatchCampaignPreviewService.addPreviewData(data);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaishouBatchCampaignPreview
+     * @return
+     */
+    @AutoLog(value = "快手-广告计划预览信息-编辑")
+    @ApiOperation(value = "快手-广告计划预览信息-编辑", notes = "快手-广告计划预览信息-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaishouBatchCampaignPreview> edit(@RequestBody KuaishouBatchCampaignPreview kuaishouBatchCampaignPreview) {
+        Result<KuaishouBatchCampaignPreview> result = new Result<KuaishouBatchCampaignPreview>();
+        KuaishouBatchCampaignPreview kuaishouBatchCampaignPreviewEntity = kuaishouBatchCampaignPreviewService.getById(kuaishouBatchCampaignPreview.getId());
+        if (kuaishouBatchCampaignPreviewEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaishouBatchCampaignPreviewService.updateById(kuaishouBatchCampaignPreview);
+            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 {
+            kuaishouBatchCampaignPreviewService.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<KuaishouBatchCampaignPreview> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaishouBatchCampaignPreview> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaishouBatchCampaignPreviewService.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<KuaishouBatchCampaignPreview> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaishouBatchCampaignPreview> result = new Result<>();
+        KuaishouBatchCampaignPreview kuaishouBatchCampaignPreview = kuaishouBatchCampaignPreviewService.getById(id);
+        if (kuaishouBatchCampaignPreview == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaishouBatchCampaignPreview);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaishouBatchCampaignPreview> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaishouBatchCampaignPreview kuaishouBatchCampaignPreview = JSON.parseObject(deString, KuaishouBatchCampaignPreview.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaishouBatchCampaignPreview, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaishouBatchCampaignPreview> pageList = kuaishouBatchCampaignPreviewService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "快手-广告计划预览信息列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaishouBatchCampaignPreview.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<KuaishouBatchCampaignPreview> listKuaishouBatchCampaignPreviews = ExcelImportUtil.importExcel(file.getInputStream(), KuaishouBatchCampaignPreview.class, params);
+                kuaishouBatchCampaignPreviewService.saveBatch(listKuaishouBatchCampaignPreviews);
+                return Result.ok("文件导入成功!数据行数:" + listKuaishouBatchCampaignPreviews.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("文件导入失败!");
+    }
+
+}

+ 253 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouBatchCreativePreviewController.java

@@ -0,0 +1,253 @@
+package cn.com.ctop.kuaishou.modules.batch.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.module.annotation.AutoLog;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchCreativePreview;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouBatchCreativePreviewService;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+
+import java.util.Date;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 快手-广告创意预览信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-26
+ */
+@Slf4j
+@Api(tags = "快手-广告创意预览信息")
+@RestController
+@RequestMapping("/kuai/kuaishouBatchCreativePreview")
+public class KuaishouBatchCreativePreviewController {
+    @Autowired
+    private IKuaishouBatchCreativePreviewService kuaishouBatchCreativePreviewService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaishouBatchCreativePreview
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "快手-广告创意预览信息-分页列表查询")
+    @ApiOperation(value = "快手-广告创意预览信息-分页列表查询", notes = "快手-广告创意预览信息-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaishouBatchCreativePreview>> queryPageList(KuaishouBatchCreativePreview kuaishouBatchCreativePreview,
+                                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                     HttpServletRequest req) {
+        Result<IPage<KuaishouBatchCreativePreview>> result = new Result<>();
+        QueryWrapper<KuaishouBatchCreativePreview> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouBatchCreativePreview, req.getParameterMap());
+        Page<KuaishouBatchCreativePreview> page = new Page<KuaishouBatchCreativePreview>(pageNo, pageSize);
+        IPage<KuaishouBatchCreativePreview> pageList = kuaishouBatchCreativePreviewService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaishouBatchCreativePreview
+     * @return
+     */
+    @AutoLog(value = "快手-广告创意预览信息-添加")
+    @ApiOperation(value = "快手-广告创意预览信息-添加", notes = "快手-广告创意预览信息-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaishouBatchCreativePreview> add(@RequestBody KuaishouBatchCreativePreview kuaishouBatchCreativePreview) {
+        Result<KuaishouBatchCreativePreview> result = new Result<>();
+        try {
+            kuaishouBatchCreativePreviewService.save(kuaishouBatchCreativePreview);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaishouBatchCreativePreview
+     * @return
+     */
+    @AutoLog(value = "快手-广告创意预览信息-编辑")
+    @ApiOperation(value = "快手-广告创意预览信息-编辑", notes = "快手-广告创意预览信息-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaishouBatchCreativePreview> edit(@RequestBody KuaishouBatchCreativePreview kuaishouBatchCreativePreview) {
+        Result<KuaishouBatchCreativePreview> result = new Result<KuaishouBatchCreativePreview>();
+        KuaishouBatchCreativePreview kuaishouBatchCreativePreviewEntity = kuaishouBatchCreativePreviewService.getById(kuaishouBatchCreativePreview.getId());
+        if (kuaishouBatchCreativePreviewEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaishouBatchCreativePreviewService.updateById(kuaishouBatchCreativePreview);
+            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 {
+            kuaishouBatchCreativePreviewService.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<KuaishouBatchCreativePreview> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaishouBatchCreativePreview> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaishouBatchCreativePreviewService.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<KuaishouBatchCreativePreview> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaishouBatchCreativePreview> result = new Result<>();
+        KuaishouBatchCreativePreview kuaishouBatchCreativePreview = kuaishouBatchCreativePreviewService.getById(id);
+        if (kuaishouBatchCreativePreview == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaishouBatchCreativePreview);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaishouBatchCreativePreview> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaishouBatchCreativePreview kuaishouBatchCreativePreview = JSON.parseObject(deString, KuaishouBatchCreativePreview.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaishouBatchCreativePreview, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaishouBatchCreativePreview> pageList = kuaishouBatchCreativePreviewService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "快手-广告创意预览信息列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaishouBatchCreativePreview.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<KuaishouBatchCreativePreview> listKuaishouBatchCreativePreviews = ExcelImportUtil.importExcel(file.getInputStream(), KuaishouBatchCreativePreview.class, params);
+                kuaishouBatchCreativePreviewService.saveBatch(listKuaishouBatchCreativePreviews);
+                return Result.ok("文件导入成功!数据行数:" + listKuaishouBatchCreativePreviews.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("文件导入失败!");
+    }
+
+}

+ 256 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouBatchGroupPreviewController.java

@@ -0,0 +1,256 @@
+package cn.com.ctop.kuaishou.modules.batch.controller;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchGroupPreview;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouBatchGroupPreviewService;
+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.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 快手-广告组预览信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-26
+ */
+@Slf4j
+@Api(tags = "快手-广告组预览信息")
+@RestController
+@RequestMapping("/kuai/kuaishouBatchGroupPreview")
+public class KuaishouBatchGroupPreviewController {
+    @Autowired
+    private IKuaishouBatchGroupPreviewService kuaishouBatchGroupPreviewService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaishouBatchGroupPreview
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "快手-广告组预览信息-分页列表查询")
+    @ApiOperation(value = "快手-广告组预览信息-分页列表查询", notes = "快手-广告组预览信息-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaishouBatchGroupPreview>> queryPageList(KuaishouBatchGroupPreview kuaishouBatchGroupPreview,
+                                                                  @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                  @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                  HttpServletRequest req) {
+        Result<IPage<KuaishouBatchGroupPreview>> result = new Result<>();
+        QueryWrapper<KuaishouBatchGroupPreview> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouBatchGroupPreview, req.getParameterMap());
+        Page<KuaishouBatchGroupPreview> page = new Page<KuaishouBatchGroupPreview>(pageNo, pageSize);
+        IPage<KuaishouBatchGroupPreview> pageList = kuaishouBatchGroupPreviewService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaishouBatchGroupPreview
+     * @return
+     */
+    @AutoLog(value = "快手-广告组预览信息-添加")
+    @ApiOperation(value = "快手-广告组预览信息-添加", notes = "快手-广告组预览信息-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaishouBatchGroupPreview> add(@RequestBody KuaishouBatchGroupPreview kuaishouBatchGroupPreview) {
+        Result<KuaishouBatchGroupPreview> result = new Result<>();
+        try {
+            kuaishouBatchGroupPreviewService.save(kuaishouBatchGroupPreview);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaishouBatchGroupPreview
+     * @return
+     */
+    @AutoLog(value = "快手-广告组预览信息-编辑")
+    @ApiOperation(value = "快手-广告组预览信息-编辑", notes = "快手-广告组预览信息-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaishouBatchGroupPreview> edit(@RequestBody KuaishouBatchGroupPreview kuaishouBatchGroupPreview) {
+        Result<KuaishouBatchGroupPreview> result = new Result<KuaishouBatchGroupPreview>();
+        KuaishouBatchGroupPreview kuaishouBatchGroupPreviewEntity = kuaishouBatchGroupPreviewService.getById(kuaishouBatchGroupPreview.getId());
+        if (kuaishouBatchGroupPreviewEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaishouBatchGroupPreviewService.updateById(kuaishouBatchGroupPreview);
+            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 {
+            kuaishouBatchGroupPreviewService.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<KuaishouBatchGroupPreview> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<KuaishouBatchGroupPreview> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaishouBatchGroupPreviewService.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<KuaishouBatchGroupPreview> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaishouBatchGroupPreview> result = new Result<>();
+        KuaishouBatchGroupPreview kuaishouBatchGroupPreview = kuaishouBatchGroupPreviewService.getById(id);
+        if (kuaishouBatchGroupPreview == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaishouBatchGroupPreview);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaishouBatchGroupPreview> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaishouBatchGroupPreview kuaishouBatchGroupPreview = JSON.parseObject(deString, KuaishouBatchGroupPreview.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaishouBatchGroupPreview, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaishouBatchGroupPreview> pageList = kuaishouBatchGroupPreviewService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "快手-广告组预览信息列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaishouBatchGroupPreview.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<KuaishouBatchGroupPreview> listKuaishouBatchGroupPreviews = ExcelImportUtil.importExcel(file.getInputStream(), KuaishouBatchGroupPreview.class, params);
+                kuaishouBatchGroupPreviewService.saveBatch(listKuaishouBatchGroupPreviews);
+                return Result.ok("文件导入成功!数据行数:" + listKuaishouBatchGroupPreviews.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("文件导入失败!");
+    }
+
+}

+ 97 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouBatchCampaignPreview.java

@@ -0,0 +1,97 @@
+package cn.com.ctop.kuaishou.modules.batch.entity;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 快手-广告计划预览信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-26
+ */
+@Data
+@TableName("ctop_kuaishou_batch_campaign_preview")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_batch_campaign_preview对象", description = "快手-广告计划预览信息")
+public class KuaishouBatchCampaignPreview {
+
+    /**
+     * id
+     */
+    @TableId
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 计划名称
+     */
+    @Excel(name = "计划名称", width = 15)
+    @ApiModelProperty(value = "计划名称")
+    private String campaignName;
+    /**
+     * 2 - 提升应用安装;
+     */
+    @Excel(name = "2 - 提升应用安装;", width = 15)
+    @ApiModelProperty(value = "2 - 提升应用安装;")
+    private Integer campaignType;
+
+    /**
+     * 是否定时启动 1 是 2 否
+     */
+    private Integer isTime;
+    /**
+     * 投放状态 1:投放中;2:暂停
+     */
+    @Excel(name = "投放状态 1:投放中;2:暂停", width = 15)
+    @ApiModelProperty(value = "投放状态 1:投放中;2:暂停")
+    private Integer putStatus;
+    /**
+     * 每日预算
+     */
+    @Excel(name = "每日预算", width = 15)
+    @ApiModelProperty(value = "每日预算")
+    private Integer dayBudget;
+    /**
+     * dayBudgetSchedule
+     */
+    @Excel(name = "dayBudgetSchedule", width = 15)
+    @ApiModelProperty(value = "dayBudgetSchedule")
+    private String dayBudgetSchedule;
+    /**
+     * 广告投放时间
+     */
+    @Excel(name = "投放启动时间", width = 15)
+    @ApiModelProperty(value = "投放启动时间")
+    private String timeStart;
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+    /**
+     * 批次标识
+     */
+    @Excel(name = "批次标识", width = 15)
+    @ApiModelProperty(value = "批次标识")
+    private String batchId;
+}

+ 178 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouBatchCreativePreview.java

@@ -0,0 +1,178 @@
+package cn.com.ctop.kuaishou.modules.batch.entity;
+
+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;
+
+/**
+ * 快手-广告创意预览信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-26
+ */
+@Data
+@TableName("ctop_kuaishou_batch_creative_preview")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_batch_creative_preview对象", description = "快手-广告创意预览信息")
+public class KuaishouBatchCreativePreview {
+
+    /**
+     * id
+     */
+    @TableId
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 广告计划ID
+     */
+    @Excel(name = "广告计划ID", width = 15)
+    @ApiModelProperty(value = "广告计划ID")
+    private String planId;
+    /**
+     * 广告组ID
+     */
+    @Excel(name = "广告组ID", width = 15)
+    @ApiModelProperty(value = "广告组ID")
+    private String groupId;
+    /**
+     * 广告创意名称
+     */
+    @Excel(name = "广告创意名称", width = 15)
+    @ApiModelProperty(value = "广告创意名称")
+    private String creativeName;
+    /**
+     * 视频作品ID
+     */
+    @Excel(name = "视频作品ID", width = 15)
+    @ApiModelProperty(value = "视频作品ID")
+    private String photoId;
+    /**
+     * 封面图片MD5
+     */
+    @Excel(name = "封面图片MD5", width = 15)
+    @ApiModelProperty(value = "封面图片MD5")
+    private String imageSignature;
+    /**
+     * 封面图片URL
+     */
+    @Excel(name = "封面图片URL", width = 15)
+    @ApiModelProperty(value = "封面图片URL")
+    private String imageUrl;
+    /**
+     * stickerTitle
+     */
+    @Excel(name = "stickerTitle", width = 15)
+    @ApiModelProperty(value = "stickerTitle")
+    private String stickerTitle;
+    /**
+     * 贴纸样式类型
+     */
+    @Excel(name = "贴纸样式类型", width = 15)
+    @ApiModelProperty(value = "贴纸样式类型")
+    private String overlayType;
+    /**
+     * 广告语
+     */
+    @Excel(name = "广告语", width = 15)
+    @ApiModelProperty(value = "广告语")
+    private String description;
+    /**
+     * 行动号召按钮文案
+     */
+    @Excel(name = "行动号召按钮文案", width = 15)
+    @ApiModelProperty(value = "行动号召按钮文案")
+    private String actionBarText;
+    /**
+     * 点击测试链接
+     */
+    @Excel(name = "点击测试链接", width = 15)
+    @ApiModelProperty(value = "点击测试链接")
+    private String clickTrackUrl;
+    /**
+     * 视频封面来源 1:首帧,0:非首帧
+     */
+    @Excel(name = "视频封面来源 1:首帧,0:非首帧", width = 15)
+    @ApiModelProperty(value = "视频封面来源 1:首帧,0:非首帧")
+    private Integer firstFrameType;
+    /**
+     * 安卓下载中间页
+     */
+    @Excel(name = "安卓下载中间页", width = 15)
+    @ApiModelProperty(value = "安卓下载中间页")
+    private Integer siteId;
+    /**
+     * 便利贴创意短广告语
+     */
+    @Excel(name = "便利贴创意短广告语", width = 15)
+    @ApiModelProperty(value = "便利贴创意短广告语")
+    private String shortSlogan;
+    /**
+     * 第三方开始播放监测链接
+     */
+    @Excel(name = "第三方开始播放监测链接", width = 15)
+    @ApiModelProperty(value = "第三方开始播放监测链接")
+    private String impressionUrl;
+    /**
+     * 第三方有效播放监测链接
+     */
+    @Excel(name = "第三方有效播放监测链接", width = 15)
+    @ApiModelProperty(value = "第三方有效播放监测链接")
+    private String adPhotoPlayedT3sUrl;
+    /**
+     * 创意分类
+     */
+    @Excel(name = "创意分类", width = 15)
+    @ApiModelProperty(value = "创意分类")
+    private Integer creativeCategory;
+    /**
+     * 创意标签
+     */
+    @Excel(name = "创意标签", width = 15)
+    @ApiModelProperty(value = "创意标签")
+    private String creativeTag;
+    /**
+     * 第三方点击按钮监测链接
+     */
+    @Excel(name = "第三方点击按钮监测链接", width = 15)
+    @ApiModelProperty(value = "第三方点击按钮监测链接")
+    private String actionbarClickUrl;
+    /**
+     * 创建时间
+     */
+    @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;
+    /**
+     * updateTime
+     */
+    @Excel(name = "updateTime", 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 = "updateTime")
+    private Date updateTime;
+    /**
+     * 批次标识
+     */
+    @Excel(name = "批次标识", width = 15)
+    @ApiModelProperty(value = "批次标识")
+    private String batchId;
+}

+ 212 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouBatchGroupPreview.java

@@ -0,0 +1,212 @@
+package cn.com.ctop.kuaishou.modules.batch.entity;
+
+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;
+
+/**
+ * 快手-广告组预览信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-26
+ */
+@Data
+@TableName("ctop_kuaishou_batch_group_preview")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_batch_group_preview对象", description = "快手-广告组预览信息")
+public class KuaishouBatchGroupPreview {
+
+    /**
+     * id
+     */
+    @TableId
+    @ApiModelProperty(value = "id")
+    private String id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 定向模板id
+     */
+    private Long templateId;
+    /**
+     * 广告活动ID
+     */
+    @Excel(name = "广告活动ID", width = 15)
+    @ApiModelProperty(value = "广告活动ID")
+    private String planId;
+    /**
+     * 广告组名称
+     */
+    @Excel(name = "广告组名称", width = 15)
+    @ApiModelProperty(value = "广告组名称")
+    private String unitName;
+    /**
+     * 投放状态 1:投放中;2:暂停
+     */
+    @Excel(name = "投放状态 1:投放中;2:暂停", width = 15)
+    @ApiModelProperty(value = "投放状态 1:投放中;2:暂停")
+    private Integer putStatus;
+    /**
+     * 出价类型
+     */
+    @Excel(name = "出价类型", width = 15)
+    @ApiModelProperty(value = "出价类型")
+    private Integer bidType;
+    /**
+     * 出价
+     */
+    @Excel(name = "出价", width = 15)
+    @ApiModelProperty(value = "出价")
+    private Integer bid;
+    /**
+     * OCPC出价
+     */
+    @Excel(name = "OCPC出价", width = 15)
+    @ApiModelProperty(value = "OCPC出价")
+    private Integer cpaBid;
+    /**
+     * OCPX行为类型   1: CPM, 2: CPC,
+     */
+    @Excel(name = "OCPX行为类型   1: CPM, 2: CPC,", width = 15)
+    @ApiModelProperty(value = "OCPX行为类型   1: CPM, 2: CPC,")
+    private Integer ocpxActionType;
+    /**
+     * 深度转化目标 3: 付费,7: 次日留存,10: 完件, 11: 授信 ,0:无
+     */
+    @Excel(name = "深度转化目标 3: 付费,7: 次日留存,10: 完件, 11: 授信 ,0:无", width = 15)
+    @ApiModelProperty(value = "深度转化目标 3: 付费,7: 次日留存,10: 完件, 11: 授信 ,0:无")
+    private Integer deepConversionType;
+    /**
+     * 深度转化目标出价
+     */
+    @Excel(name = "深度转化目标出价", width = 15)
+    @ApiModelProperty(value = "深度转化目标出价")
+    private Integer deepConversionBid;
+    /**
+     * 单日预算
+     */
+    @Excel(name = "单日预算", width = 15)
+    @ApiModelProperty(value = "单日预算")
+    private Integer dayBudget;
+    /**
+     * 投放方式  0:未知, 1:正常投
+     */
+    @Excel(name = "投放方式  0:未知, 1:正常投", width = 15)
+    @ApiModelProperty(value = "投放方式  0:未知, 1:正常投")
+    private Integer speed;
+    /**
+     * 投放开始时间
+     */
+    @Excel(name = "投放开始时间", width = 15)
+    @ApiModelProperty(value = "投放开始时间")
+    private String beginTime;
+    /**
+     * 投放结束时间
+     */
+    @Excel(name = "投放结束时间", width = 15)
+    @ApiModelProperty(value = "投放结束时间")
+    private String endTime;
+    /**
+     * 投放时段
+     */
+    @Excel(name = "投放时段", width = 15)
+    @ApiModelProperty(value = "投放时段")
+    private Object scheduleTime;
+    /**
+     * 广告位 1:优选广告位;
+     */
+    @Excel(name = "广告位 1:优选广告位;", width = 15)
+    @ApiModelProperty(value = "广告位 1:优选广告位;")
+    private Object sceneId;
+    /**
+     * 创意展现方式  0:未知, 1:轮播,
+     */
+    @Excel(name = "创意展现方式  0:未知, 1:轮播,", width = 15)
+    @ApiModelProperty(value = "创意展现方式  0:未知, 1:轮播,")
+    private Integer showMode;
+    /**
+     * 创意制作方式 4: 自定义
+     */
+    @Excel(name = "创意制作方式 4: 自定义", width = 15)
+    @ApiModelProperty(value = "创意制作方式 4: 自定义")
+    private Integer unitType;
+    /**
+     * 当计划类型为3时(获取电商下单)时有返回。
+     */
+    @Excel(name = "当计划类型为3时(获取电商下单)时有返回。", width = 15)
+    @ApiModelProperty(value = "当计划类型为3时(获取电商下单)时有返回。")
+    private Integer urlType;
+    /**
+     * 落地页链接
+     */
+    @Excel(name = "落地页链接", width = 15)
+    @ApiModelProperty(value = "落地页链接")
+    private String url;
+    /**
+     * APP ID
+     */
+    @Excel(name = "APP ID", width = 15)
+    @ApiModelProperty(value = "APP ID")
+    private Integer appId;
+    /**
+     * APP图标存储地址
+     */
+    @Excel(name = "APP图标存储地址", width = 15)
+    @ApiModelProperty(value = "APP图标存储地址")
+    private String appIconUrl;
+    /**
+     * 转化目标
+     */
+    @Excel(name = "转化目标", width = 15)
+    @ApiModelProperty(value = "转化目标")
+    private Integer convertId;
+    /**
+     * 优先从系统应用商店下载
+     */
+    @Excel(name = "优先从系统应用商店下载", width = 15)
+    @ApiModelProperty(value = "优先从系统应用商店下载")
+    private Integer useAppMarket;
+    /**
+     * 应用列表
+     */
+    @Excel(name = "应用列表", width = 15)
+    @ApiModelProperty(value = "应用列表")
+    private String appStore;
+    /**
+     * 创建时间
+     */
+    @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;
+    /**
+     * 批次标识
+     */
+    @Excel(name = "批次标识", width = 15)
+    @ApiModelProperty(value = "批次标识")
+    private String batchId;
+}

+ 15 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouBatchCampaignPreviewMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.batch.mapper;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchCampaignPreview;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 快手-广告计划预览信息
+ *
+ * @author: jeecg-boot
+ * @date: 2021-01-26
+ * @cersion: V1.0
+ */
+public interface KuaishouBatchCampaignPreviewMapper extends BaseMapper<KuaishouBatchCampaignPreview> {
+
+}

+ 15 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouBatchCreativePreviewMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.batch.mapper;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchCreativePreview;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 快手-广告创意预览信息
+ *
+ * @author: jeecg-boot
+ * @date: 2021-01-26
+ * @cersion: V1.0
+ */
+public interface KuaishouBatchCreativePreviewMapper extends BaseMapper<KuaishouBatchCreativePreview> {
+
+}

+ 15 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouBatchGroupPreviewMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.batch.mapper;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchGroupPreview;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 快手-广告组预览信息
+ *
+ * @author: jeecg-boot
+ * @date: 2021-01-26
+ * @cersion: V1.0
+ */
+public interface KuaishouBatchGroupPreviewMapper extends BaseMapper<KuaishouBatchGroupPreview> {
+
+}

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouBatchCampaignPreviewMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouBatchCampaignPreviewMapper">
+
+</mapper>

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouBatchCreativePreviewMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouBatchCreativePreviewMapper">
+
+</mapper>

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouBatchGroupPreviewMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouBatchGroupPreviewMapper">
+
+</mapper>

+ 0 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouBatchCampaignTemplateService.java

@@ -12,6 +12,4 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IKuaiShouBatchCampaignTemplateService extends IService<KuaiShouBatchCampaignTemplate> {
 
-    String previewLogic(JSONObject data);
-
 }

+ 16 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouBatchCampaignPreviewService.java

@@ -0,0 +1,16 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchCampaignPreview;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 快手-广告计划预览信息
+ * @Author: jeecg-boot
+ * @Date: 2021-01-26
+ * @Version: V1.0
+ */
+public interface IKuaishouBatchCampaignPreviewService extends IService<KuaishouBatchCampaignPreview> {
+
+    void addPreviewData(JSONObject data) throws Exception;
+}

+ 14 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouBatchCreativePreviewService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchCreativePreview;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 快手-广告创意预览信息
+ * @Author: jeecg-boot
+ * @Date: 2021-01-26
+ * @Version: V1.0
+ */
+public interface IKuaishouBatchCreativePreviewService extends IService<KuaishouBatchCreativePreview> {
+
+}

+ 14 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouBatchGroupPreviewService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchGroupPreview;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 快手-广告组预览信息
+ * @Author: jeecg-boot
+ * @Date: 2021-01-26
+ * @Version: V1.0
+ */
+public interface IKuaishouBatchGroupPreviewService extends IService<KuaishouBatchGroupPreview> {
+
+}

+ 0 - 26
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouBatchCampaignTemplateServiceImpl.java

@@ -22,30 +22,4 @@ import org.springframework.stereotype.Service;
 @Service
 public class KuaiShouBatchCampaignTemplateServiceImpl extends ServiceImpl<KuaiShouBatchCampaignTemplateMapper, KuaiShouBatchCampaignTemplate> implements IKuaiShouBatchCampaignTemplateService {
 
-    @Autowired
-    IKuaiShouBatchGroupTemplateService kuaiShouBatchGroupTemplateService;
-
-    @Autowired
-    IKuaiShouBatchCreativeTemplateService kuaiShouBatchCreativeTemplateService;
-
-    @Override
-    public String previewLogic(JSONObject data) {
-
-
-        return null;
-    }
-
-    private JSONObject getCampaignsAndGroups(Integer type, JSONArray orientatPkg, JSONArray creativeGroup) {
-        JSONObject ob = new JSONObject();
-        //分组规则 1定向,2创意组
-        if (NoEn.NO1.valueInt() == type) {
-            for (int i = 0; i < orientatPkg.size(); i++) {
-
-            }
-        } else if (NoEn.NO2.valueInt() == type) {
-
-        }
-        return null;
-    }
-
 }

+ 255 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCampaignPreviewServiceImpl.java

@@ -0,0 +1,255 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchCampaignPreview;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchCreativePreview;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchGroupPreview;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouBatchCampaignPreviewMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouBatchCreativePreviewMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouBatchGroupPreviewMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouBatchCampaignPreviewService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.core.enums.NoEn;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 快手-广告计划预览信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-26
+ */
+@Service
+public class KuaishouBatchCampaignPreviewServiceImpl extends ServiceImpl<KuaishouBatchCampaignPreviewMapper, KuaishouBatchCampaignPreview> implements IKuaishouBatchCampaignPreviewService {
+
+
+    @Autowired
+    KuaishouBatchCampaignPreviewMapper campaignPreviewMapper;
+    @Autowired
+    KuaishouBatchGroupPreviewMapper groupPreviewMapper;
+    @Autowired
+    KuaishouBatchCreativePreviewMapper creativePreviewMapper;
+
+    @Override
+    public void addPreviewData(JSONObject data) throws Exception {
+        String batchId = data.getString("batchId");
+        //计划
+        JSONObject campaignJson = data.getJSONObject("campaignJson");
+        if (Check.isNull(campaignJson)) {
+            throw new Exception("数据异常,未获取到广告计划数据");
+        }
+        KuaishouBatchCampaignPreview campaignPreview = commonCampaign(campaignJson, batchId);
+        //组
+        JSONObject groupJson = data.getJSONObject("unitJson");
+        if (Check.isNull(groupJson)) {
+            throw new Exception("数据异常,未获取到广告组数据");
+        }
+        KuaishouBatchGroupPreview groupPreview = commonGroup(groupJson, batchId, campaignJson);
+        //创意
+        JSONObject creativeJson = data.getJSONObject("creativeJson");
+        if (Check.isNull(creativeJson)) {
+            throw new Exception("数据异常,未获取到广告创意数据");
+        }
+        KuaishouBatchCreativePreview creativePreview = commonCreative(creativeJson, batchId);
+        //素材数据
+        JSONObject materialArray = data.getJSONObject("materialArray");
+        if (Check.isNull(materialArray)) {
+            throw new Exception("数据异常,未获取到素材数据");
+        }
+        //创意组
+        JSONArray materialList = materialArray.getJSONArray("materialList");
+        if (Check.isNull(materialList)) {
+            throw new Exception("数据异常,未获取到创意组数据");
+        }
+        //应用数据
+        JSONObject appList = data.getJSONObject("appList");
+        if (Check.isNull(appList)) {
+            throw new Exception("数据异常,未获取到应用数据");
+        }
+        //定向包
+        JSONArray targetIds = data.getJSONArray("targetIds");
+        if (Check.isNull(targetIds)) {
+            throw new Exception("数据异常,未获取到应用数据");
+        }
+        //分组规则 1 定向 2 创意 3 落地页
+        Integer type = campaignJson.getInteger("groupRule");
+        insertCampaignsAndGroups(type, targetIds, materialArray, campaignPreview, groupPreview, creativePreview);
+    }
+
+    private JSONObject insertCampaignsAndGroups(Integer type, JSONArray targetIds, JSONObject materialArray, KuaishouBatchCampaignPreview campaignPreview, KuaishouBatchGroupPreview groupPreview, KuaishouBatchCreativePreview creativePreview) {
+        //创意组
+        JSONArray materialList = materialArray.getJSONArray("materialList");
+
+        JSONObject materialInfo = materialArray.getJSONObject("materialInfo");
+        //广告语匹配方式  1自定义,2按创意,3按创意组
+        Integer matchingMethod = materialInfo.getInteger("matchingMethod");
+        JSONArray descriptionList = materialArray.getJSONArray("descriptionList");
+        if (!Check.isNull(descriptionList)) {
+            //创意组匹配
+            descriptionList = advertisingSlogan(descriptionList, materialList);
+        }
+        creativePreview.setAccountId(campaignPreview.getAccountId());
+        //分组规则 1定向,2创意组
+        if (NoEn.NO1.valueInt() == type) {
+            for (int i = 0; i < targetIds.size(); i++) {
+                campaignPreviewMapper.insert(campaignPreview);
+                for (int j = 0; j < materialList.size(); j++) {
+                    groupPreview.setPlanId(campaignPreview.getId());
+                    groupPreview.setTemplateId(targetIds.getLong(i));
+                    groupPreviewMapper.insert(groupPreview);
+                    JSONObject material = materialList.getJSONObject(j);
+                    JSONArray photoArr = material.getJSONArray("photoArr");
+                    if (matchingMethod == 2) {
+                        //创意匹配
+                        descriptionList = advertisingSlogan(descriptionList, photoArr);
+                    }
+                    for (int k = 0; k < photoArr.size(); k++) {
+                        JSONObject photo = photoArr.getJSONObject(k);
+                        JSONObject image = photo.getJSONObject("image");
+                        creativePreview.setPlanId(campaignPreview.getId());
+                        creativePreview.setGroupId(groupPreview.getId());
+                        creativePreview.setPhotoId(photo.getString("photoId"));
+                        creativePreview.setCreativeName(photo.getString("creativeName"));
+                        creativePreview.setImageUrl(image.getString("url"));
+                        creativePreview.setImageSignature(image.getString("signature"));
+                        if (matchingMethod == 1) {
+                            creativePreview.setDescription(photo.getString("description"));
+                        } else if (matchingMethod == 2) {
+                            creativePreview.setDescription(descriptionList.getString(k));
+                        } else if (matchingMethod == 3) {
+                            creativePreview.setDescription(descriptionList.getString(j));
+                        }
+                        creativePreviewMapper.insert(creativePreview);
+                    }
+                }
+            }
+        } else if (NoEn.NO2.valueInt() == type) {
+
+        }
+        return null;
+    }
+
+    /**
+     * 广告语整理
+     *
+     * @param
+     * @return com.alibaba.fastjson.JSONArray
+     * @throws
+     * @author ZHAOXA
+     */
+    private static JSONArray advertisingSlogan(JSONArray descriptionList, JSONArray materialList) {
+        if (materialList.size() <= descriptionList.size()) {
+            return descriptionList;
+        }
+        JSONArray other = new JSONArray();
+        if (materialList.size() > descriptionList.size()) {
+            int num = materialList.size() / descriptionList.size();
+            for (int i = 0; i <= num; i++) {
+                other.addAll(descriptionList);
+            }
+        }
+        return other;
+    }
+
+    /**
+     * 整理通用广告计划数据
+     *
+     * @param
+     * @return cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchCampaignPreview
+     * @throws
+     * @author ZHAOXA
+     */
+    private KuaishouBatchCampaignPreview commonCampaign(JSONObject campaignJson, String batchId) {
+//        KuaishouBatchCampaignPreview sd =JSONObject.toJavaObject(campaignJson, KuaishouBatchCampaignPreview.class);
+        KuaishouBatchCampaignPreview campaignPreview = new KuaishouBatchCampaignPreview();
+        campaignPreview.setAccountId(campaignJson.getLong("accountId"));
+        campaignPreview.setCampaignName(campaignJson.getString("campaignName"));
+        campaignPreview.setCampaignType(campaignJson.getInteger("campaignType"));
+        campaignPreview.setPutStatus(campaignJson.getInteger("campaignStatus"));
+        campaignPreview.setDayBudget(campaignJson.getInteger("dayBudget"));
+        campaignPreview.setDayBudgetSchedule(campaignJson.getString("dayBudgetSchedule"));
+        campaignPreview.setTimeStart(campaignJson.getString("timeStart"));
+        campaignPreview.setIsTime(campaignJson.getInteger("isTime"));
+        campaignPreview.setBatchId(batchId);
+        return campaignPreview;
+    }
+
+    /**
+     * 整理通用广告组数据
+     *
+     * @param
+     * @return cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchGroupPreview
+     * @throws
+     * @author ZHAOXA
+     */
+    private KuaishouBatchGroupPreview commonGroup(JSONObject groupJson, String batchId, JSONObject campaignJson) {
+        KuaishouBatchGroupPreview groupPreview = new KuaishouBatchGroupPreview();
+        groupPreview.setAccountId(groupJson.getLong("accountId"));
+        groupPreview.setUnitName(groupJson.getString("unitName"));
+        groupPreview.setPutStatus(campaignJson.getInteger("unitStatus"));
+        groupPreview.setBidType(groupJson.getInteger("bidType"));
+        if (groupJson.getInteger("bidType") == 2) {
+            int bid = getRandom(groupJson.getInteger("bidMax"), groupJson.getInteger("bidMin"));
+            if (bid > 0) {
+                groupJson.put("bid", bid);
+            }
+        }
+
+        if (groupJson.getInteger("bidType") == 10) {
+            groupPreview.setCpaBid(groupJson.getInteger("cpaBid"));
+        } else {
+            groupPreview.setBid(groupJson.getInteger("bid"));
+        }
+        groupPreview.setOcpxActionType(groupJson.getInteger("ocpxActionType"));
+        groupPreview.setDeepConversionType(groupJson.getInteger("deepConversionType"));
+        groupPreview.setDeepConversionBid(groupJson.getInteger("deepConversionBid"));
+        groupPreview.setDayBudget(groupJson.getInteger("dayBudget"));
+        groupPreview.setSpeed(groupJson.getInteger("speed"));
+        groupPreview.setBeginTime(groupJson.getString("beginTime"));
+        groupPreview.setEndTime(groupJson.getString("endTime"));
+        groupPreview.setScheduleTime(groupJson.getString("scheduleTime"));
+        groupPreview.setSceneId(groupJson.getString("sceneId"));
+        groupPreview.setShowMode(groupJson.getInteger("showMode"));
+        groupPreview.setUseAppMarket(groupJson.getInteger("useAppMarket"));
+        groupPreview.setAppStore(groupJson.getString("appStore"));
+        groupPreview.setBatchId(batchId);
+        groupPreview.setUnitType(groupJson.getInteger("unitType"));
+        return groupPreview;
+    }
+
+    private static int getRandom(int x, int y) {
+        int num = -1;
+        //说明:两个数在合法范围内,并不限制输入的数哪个更大一些
+        if (x < 0 || y < 0) {
+            return num;
+        } else {
+            int max = Math.max(x, y);
+            int min = Math.min(x, y);
+            int mid = max - min;//求差
+            //产生随机数
+            return (int) (Math.random() * (mid + 1)) + min;
+        }
+    }
+
+    /**
+     * 整理通用创意数据
+     *
+     * @param
+     * @return cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchCreativePreview
+     * @throws
+     * @author ZHAOXA
+     */
+    private KuaishouBatchCreativePreview commonCreative(JSONObject creativeJson, String batchId) {
+        KuaishouBatchCreativePreview creativePreview = new KuaishouBatchCreativePreview();
+        creativePreview.setActionBarText(creativeJson.getString("actionBarText"));
+        creativePreview.setOverlayType(creativeJson.getString("overlayType"));
+        creativePreview.setStickerTitle(creativeJson.getString("stickerTitle"));
+        creativePreview.setCreativeTag(creativeJson.getString("creativeTag"));
+        creativePreview.setBatchId(batchId);
+        return creativePreview;
+    }
+
+}

+ 19 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchCreativePreviewServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchCreativePreview;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouBatchCreativePreviewMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouBatchCreativePreviewService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 快手-广告创意预览信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-26
+ */
+@Service
+public class KuaishouBatchCreativePreviewServiceImpl extends ServiceImpl<KuaishouBatchCreativePreviewMapper, KuaishouBatchCreativePreview> implements IKuaishouBatchCreativePreviewService {
+
+}

+ 19 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouBatchGroupPreviewServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouBatchGroupPreview;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouBatchGroupPreviewMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouBatchGroupPreviewService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 快手-广告组预览信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-26
+ */
+@Service
+public class KuaishouBatchGroupPreviewServiceImpl extends ServiceImpl<KuaishouBatchGroupPreviewMapper, KuaishouBatchGroupPreview> implements IKuaishouBatchGroupPreviewService {
+
+}