Browse Source

自动投放账户重构——初版

zhaoxian 3 years ago
parent
commit
84bb11bf6b
32 changed files with 4311 additions and 5 deletions
  1. 238 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouAccountAutoDoController.java
  2. 356 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouAccountAutoStrategyController.java
  3. 259 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouAccountAutoTargetController.java
  4. 671 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAccountAutoStrategy.java
  5. 255 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAccountAutoTarget.java
  6. 15 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouCampaignLevelOperationRecord.java
  7. 69 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/enums/KuaishouAutoTypeEnum.java
  8. 20 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaishouAccountAutoStrategyMapper.java
  9. 19 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaishouAccountAutoTargetMapper.java
  10. 8 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaishouAccountAutoVideoMapper.java
  11. 31 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaishouAccountAutoStrategyMapper.xml
  12. 16 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaishouAccountAutoTargetMapper.xml
  13. 97 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaishouAccountAutoVideoMapper.xml
  14. 20 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAccountAutoDoService.java
  15. 16 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAccountAutoStrategyService.java
  16. 22 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAccountAutoTargetService.java
  17. 15 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAccountAutoVideoService.java
  18. 1866 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountAutoDoServiceImpl.java
  19. 28 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountAutoStrategyServiceImpl.java
  20. 78 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountAutoTargetServiceImpl.java
  21. 24 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountAutoVideoServiceImpl.java
  22. 20 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/controller/KuaishouChannelController.java
  23. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/KuaishouChannelMapper.java
  24. 21 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelMapper.xml
  25. 8 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/IKuaishouChannelService.java
  26. 31 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelServiceImpl.java
  27. 21 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/document/controller/DocumentLibraryController.java
  28. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/document/mapper/DocumentLibraryMapper.java
  29. 11 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/document/mapper/xml/DocumentLibraryMapper.xml
  30. 4 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/document/service/DocumentLibraryService.java
  31. 62 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/document/service/impl/DocumentLibraryServiceImpl.java
  32. 6 1
      jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-dev.yml

+ 238 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouAccountAutoDoController.java

@@ -0,0 +1,238 @@
+package cn.com.ctop.kuaishou.modules.ai.controller;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoStrategy;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountAutoDoService;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountAutoStrategyService;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
+import com.alibaba.fastjson.JSONObject;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.text.ParseException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Slf4j
+@Api(tags = "快手-自动投放")
+@RestController
+@RequestMapping("/auto/create")
+public class AiKuaishouAccountAutoDoController {
+    @Autowired
+    private IAiKuaishouAccountAutoDoService autoDoService;
+    @Autowired
+    private IAiKuaishouAccountAutoStrategyService strategyService;
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+    static ExecutorService kuaishouCustomCreativeSupplementExecutorService = Executors.newFixedThreadPool(3);
+    static ExecutorService kuaishouProgramCreativeAutoService = Executors.newFixedThreadPool(3);
+    static ExecutorService kuaishouProgramTopCreativeAutoService = Executors.newFixedThreadPool(3);
+
+
+    /**
+     * 自动上新
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping(value = "/customCreativeLimitNew")
+    public JSONObject customCreativeLimitNew(String id) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("主键id不能为空");
+            }
+            AiKuaishouAccountAutoStrategy strategy = strategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Boolean unitOverrun = autoDoService.getUnitOverrun(strategy.getAccountId());
+            if (unitOverrun) {
+                log.error("组创建超限,accountId:{}", strategy.getAccountId());
+                throw new Exception("今日组创建已超限");
+            }
+
+            executorService.submit(() ->
+                    autoDoService.customCreativeLimitNew(strategy)
+            );
+            returnJson.put("code", 0);
+            returnJson.put("message", "异步创建中");
+        } catch (Exception e) {
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+
+    }
+
+    /**
+     * 自动上新
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping(value = "/customCreativeLimit")
+    public JSONObject customCreativeLimit(String id) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("主键id不能为空");
+            }
+            AiKuaishouAccountAutoStrategy strategy = strategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Boolean unitOverrun = autoDoService.getUnitOverrun(strategy.getAccountId());
+            if (unitOverrun) {
+                log.error("组创建超限,accountId:{}", strategy.getAccountId());
+                throw new Exception("今日组创建已超限");
+            }
+
+            executorService.submit(() ->
+                    autoDoService.customCreativeLimit(strategy)
+            );
+            returnJson.put("code", 0);
+            returnJson.put("message", "异步创建中");
+        } catch (Exception e) {
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+
+    }
+
+    /**
+     * 自定义创意补充
+     *
+     * @param id
+     * @param hour
+     * @return
+     */
+    @GetMapping(value = "/kuaishouCustomCreativeSupplement")
+    public JSONObject kuaishouCustomCreativeSupplement(String id, Integer hour) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("主键id不能为空");
+            }
+            AiKuaishouAccountAutoStrategy strategy = strategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Boolean unitOverrun = autoDoService.getUnitOverrun(strategy.getAccountId());
+            if (unitOverrun) {
+                log.error("组创建超限,accountId:{}", strategy.getAccountId());
+                throw new Exception("今日组创建已超限");
+            }
+            if (Check.isNull(hour)) {
+                throw new Exception("小时数据为空");
+            }
+            if (strategy.getHistoryTop() == 0) {
+                kuaishouCustomCreativeSupplementExecutorService.submit(() -> {
+                    try {
+                        autoDoService.customCreativeSupplement(strategy, hour);
+                    } catch (ParseException e) {
+                        e.printStackTrace();
+                    }
+                });
+            } else {
+                log.info("高质量暂停搭建,accountId:{}", strategy.getAccountId());
+            }
+            returnJson.put("code", 0);
+            returnJson.put("message", "异步创建中");
+        } catch (Exception e) {
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+
+    }
+
+    /**
+     * 程序化上新素材
+     *
+     * @param id
+     * @param videoCnt
+     * @return
+     */
+    @GetMapping(value = "/kuaishouProgramCreativeAuto")
+    public JSONObject kuaishouProgramCreativeAuto(String id, Integer videoCnt) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("主键id不能为空");
+            }
+            AiKuaishouAccountAutoStrategy strategy = strategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Boolean unitOverrun = autoDoService.getUnitOverrun(strategy.getAccountId());
+            if (unitOverrun) {
+                log.error("组创建超限,accountId:{}", strategy.getAccountId());
+                throw new Exception("今日组创建已超限");
+            }
+            if (Check.isNull(videoCnt)) {
+                throw new Exception("视频数量不能为空");
+            }
+            kuaishouProgramCreativeAutoService.submit(() -> {
+                autoDoService.autoCreateProgramCreative(strategy, 1, videoCnt);
+
+            });
+            returnJson.put("code", 0);
+            returnJson.put("message", "异步创建中");
+        } catch (Exception e) {
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+
+    }
+
+    /**
+     * 程序化历史高质量
+     *
+     * @param id
+     * @param videoCnt
+     * @return
+     */
+    @GetMapping(value = "/autoCreateProgramHistoryTopCreative")
+    public JSONObject autoCreateProgramHistoryTopCreative(String id, Integer videoCnt) {
+        JSONObject returnJson = new JSONObject();
+        try {
+            if (Check.isNull(id)) {
+                throw new Exception("主键id不能为空");
+            }
+            AiKuaishouAccountAutoStrategy strategy = strategyService.getById(id);
+            if (Check.isNull(strategy)) {
+                throw new Exception("根据id获取详细信息为空");
+            }
+            Boolean unitOverrun = autoDoService.getUnitOverrun(strategy.getAccountId());
+            if (unitOverrun) {
+                log.error("组创建超限,accountId:{}", strategy.getAccountId());
+                throw new Exception("今日组创建已超限");
+            }
+            if (Check.isNull(videoCnt)) {
+                throw new Exception("视频数量不能为空");
+            }
+            if (strategy.getHistoryTop() == 0) {
+                kuaishouProgramTopCreativeAutoService.submit(() -> {
+                    autoDoService.autoCreateProgramCreative(strategy, 2, videoCnt);
+                });
+            } else {
+                log.info("历史高质量暂停搭建,accountId:{}", strategy.getAccountId());
+            }
+            returnJson.put("code", 0);
+            returnJson.put("message", "异步创建中");
+        } catch (Exception e) {
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+
+    }
+
+
+}

+ 356 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouAccountAutoStrategyController.java

@@ -0,0 +1,356 @@
+package cn.com.ctop.kuaishou.modules.ai.controller;
+
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoStrategy;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountAutoStrategyService;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAdvertiserStrategyService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouVideoRelateCreativesService;
+import cn.com.ctop.kuaishou.modules.document.service.DocumentLibraryService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+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.jeecg.modules.system.service.ISysRoleService;
+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.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 自动投放重构-账户策略表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-10-12
+ */
+@Slf4j
+@Api(tags = "自动投放重构-账户策略表")
+@RestController
+@RequestMapping("/auto/aiKuaishouAccountAutoStrategy")
+public class AiKuaishouAccountAutoStrategyController {
+    @Autowired
+    private IAiKuaishouAccountAutoStrategyService aiKuaishouAccountAutoStrategyService;
+
+    @Autowired
+    private ISysRoleService sysRoleService;
+
+    @Autowired
+    private IUserAllocationService allocationService;
+
+    @Autowired
+    private IKuaishouVideoRelateCreativesService kuaishouVideoRelateCreativesService;
+
+    @Autowired
+    private DocumentLibraryService documentLibraryService;
+
+    @Autowired
+    private IAiKuaishouAdvertiserStrategyService aiKuaishouAdvertiserStrategyService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param AiKuaishouAccountAutoStrategy
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @GetMapping(value = "/list")
+    public Result<PageInfo<AiKuaishouAccountAutoStrategy>> queryPageList(AiKuaishouAccountAutoStrategy aiKuaishouAccountAutoStrategy,
+                                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                         HttpServletRequest req) {
+        Result<PageInfo<AiKuaishouAccountAutoStrategy>> result = new Result<>();
+        if(Check.isNull(aiKuaishouAccountAutoStrategy.getUserId())){
+            result.setSuccess(false);
+            result.setMessage("请选择用户");
+            return result;
+        }
+        String roleCode = sysRoleService.getRoleCodeByUserId(aiKuaishouAccountAutoStrategy.getUserId());
+        if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
+            aiKuaishouAccountAutoStrategy.setUserId(null);
+        }
+        PageHelper.startPage(pageNo, pageSize);
+        PageInfo<AiKuaishouAccountAutoStrategy> pageInfo = aiKuaishouAccountAutoStrategyService.queryList(aiKuaishouAccountAutoStrategy);
+        List<AiKuaishouAccountAutoStrategy> list = pageInfo.getList();
+        List<AiKuaishouAccountAutoStrategy> setData = new ArrayList<>();
+        if (null != list && !list.isEmpty()) {
+            list.forEach(record -> {
+                Long accountId = record.getAccountId();
+                UserAllocation allocation = allocationService.getByAccountId(accountId);
+                if (null != allocation) {
+                    record.setAuthName(allocation.getAuthName());
+                }
+            });
+        }
+        pageInfo.setList(list);
+        result.setSuccess(true);
+        result.setResult(pageInfo);
+        return result;
+    }
+
+    /**
+     * 校验新旧版本自动投放账户配置不重复
+     * type 0 旧版 ,1 重构版
+     */
+    @GetMapping(value = "/checkStrategy")
+    private Result<Object> checkStrategy(Long accountId, Integer type) {
+        if (Check.isNull(accountId) || Check.isNull(type)) {
+            return Result.error("缺少参数");
+        }
+        if (type == 1) {
+            AiKuaishouAdvertiserStrategy getEntity = aiKuaishouAdvertiserStrategyService.getByAccountId(accountId);
+            if (null != getEntity) {
+                return Result.error("该账户旧版自动投放配置信息已存在,请删除后再创建");
+            }
+        } else {
+            QueryWrapper<AiKuaishouAccountAutoStrategy> queryWrapper = new QueryWrapper();
+            queryWrapper.eq("account_id", accountId).last("limit 1");
+            AiKuaishouAccountAutoStrategy one = aiKuaishouAccountAutoStrategyService.getOne(queryWrapper);
+            if (null != one) {
+                return Result.error("该账户重构版自动投放配置信息已存在,请删除后再创建");
+            }
+        }
+        return Result.ok("success");
+    }
+
+    /**
+     * 添加
+     *
+     * @param aiKuaishouAccountAutoStrategy
+     * @return
+     */
+    @ApiOperation(value = "自动投放重构-账户策略表-添加", notes = "自动投放重构-账户策略表-添加")
+    @PostMapping(value = "/add")
+    public Result<AiKuaishouAccountAutoStrategy> add(@RequestBody AiKuaishouAccountAutoStrategy autoStrategy) {
+        Result<AiKuaishouAccountAutoStrategy> result = new Result<>();
+        try {
+            Long accountId = autoStrategy.getAccountId();
+
+            QueryWrapper<AiKuaishouAccountAutoStrategy> queryWrapper = new QueryWrapper();
+            queryWrapper.eq("account_id", accountId).last("limit 1");
+            AiKuaishouAccountAutoStrategy one = aiKuaishouAccountAutoStrategyService.getOne(queryWrapper);
+            if (null != one) {
+                result.error500("该账户配置信息已经被创建");
+                return result;
+            }
+            UserAllocation allocation = allocationService.getByAccountId(accountId);
+            if (null != allocation) {
+                autoStrategy.setUserId(allocation.getUserId());
+            }
+            Integer singleAppId = autoStrategy.getSingleAppid();
+            if (null != singleAppId && singleAppId == 1) {
+                if (autoStrategy.getCampaignType() == 2 || autoStrategy.getCampaignType() == 7) {
+                    Long appId = Long.valueOf(JSONArray.parseArray(autoStrategy.getAppIdArray()).getString(0));
+                    autoStrategy.setAppId(appId);
+                }
+            }
+            aiKuaishouAccountAutoStrategyService.save(autoStrategy);
+            //添加广告语到文案库
+            documentLibraryService.insertBatch(autoStrategy.getDescription(), accountId);
+            Thread thread = new Thread() {
+                @Override
+                public void run() {
+                    kuaishouVideoRelateCreativesService.videoRelateCreatives(autoStrategy.getAccountId());
+                }
+            };
+            thread.start();
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param aiKuaishouAccountAutoStrategy
+     * @return
+     */
+    @ApiOperation(value = "自动投放重构-账户策略表-编辑", notes = "自动投放重构-账户策略表-编辑")
+    @PutMapping(value = "/edit")
+    public Result<AiKuaishouAccountAutoStrategy> edit(@RequestBody AiKuaishouAccountAutoStrategy aiKuaishouAccountAutoStrategy) {
+        Result<AiKuaishouAccountAutoStrategy> result = new Result<AiKuaishouAccountAutoStrategy>();
+        AiKuaishouAccountAutoStrategy aiKuaishouAccountAutoStrategyEntity = aiKuaishouAccountAutoStrategyService.getById(aiKuaishouAccountAutoStrategy.getId());
+        if (aiKuaishouAccountAutoStrategyEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            Integer singleAppId = aiKuaishouAccountAutoStrategy.getSingleAppid();
+            if (aiKuaishouAccountAutoStrategy.getCampaignType() == 2 || aiKuaishouAccountAutoStrategy.getCampaignType() == 7) {
+                if (null != singleAppId && singleAppId == 1) {
+                    Long appId = Long.valueOf(JSONArray.parseArray(aiKuaishouAccountAutoStrategy.getAppIdArray()).getString(0));
+                    aiKuaishouAccountAutoStrategy.setAppId(appId);
+                }
+            }
+
+            boolean ok = aiKuaishouAccountAutoStrategyService.updateById(aiKuaishouAccountAutoStrategy);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "自动投放重构-账户策略表-通过id删除", notes = "自动投放重构-账户策略表-通过id删除")
+    @GetMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            aiKuaishouAccountAutoStrategyService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @ApiOperation(value = "自动投放重构-账户策略表-批量删除", notes = "自动投放重构-账户策略表-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<AiKuaishouAccountAutoStrategy> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<AiKuaishouAccountAutoStrategy> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.aiKuaishouAccountAutoStrategyService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "自动投放重构-账户策略表-通过id查询", notes = "自动投放重构-账户策略表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<AiKuaishouAccountAutoStrategy> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<AiKuaishouAccountAutoStrategy> result = new Result<>();
+        AiKuaishouAccountAutoStrategy aiKuaishouAccountAutoStrategy = aiKuaishouAccountAutoStrategyService.getById(id);
+        if (aiKuaishouAccountAutoStrategy == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(aiKuaishouAccountAutoStrategy);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<AiKuaishouAccountAutoStrategy> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                AiKuaishouAccountAutoStrategy aiKuaishouAccountAutoStrategy = JSON.parseObject(deString, AiKuaishouAccountAutoStrategy.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(aiKuaishouAccountAutoStrategy, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<AiKuaishouAccountAutoStrategy> pageList = aiKuaishouAccountAutoStrategyService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "自动投放重构-账户策略表列表");
+        mv.addObject(NormalExcelConstants.CLASS, AiKuaishouAccountAutoStrategy.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<AiKuaishouAccountAutoStrategy> listAiKuaishouAccountAutoStrategys = ExcelImportUtil.importExcel(file.getInputStream(), AiKuaishouAccountAutoStrategy.class, params);
+                aiKuaishouAccountAutoStrategyService.saveBatch(listAiKuaishouAccountAutoStrategys);
+                return Result.ok("文件导入成功!数据行数:" + listAiKuaishouAccountAutoStrategys.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("文件导入失败!");
+    }
+
+}

+ 259 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouAccountAutoTargetController.java

@@ -0,0 +1,259 @@
+package cn.com.ctop.kuaishou.modules.ai.controller;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoTarget;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountAutoTargetService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+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.GetMapping;
+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.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-10-12
+ */
+@Slf4j
+@Api(tags = "自动投放重构-本地定向表")
+@RestController
+@RequestMapping("/auto/aiKuaishouAccountAutoTarget")
+public class AiKuaishouAccountAutoTargetController {
+    @Autowired
+    private IAiKuaishouAccountAutoTargetService aiKuaishouAccountAutoTargetService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param aiKuaishouAccountAutoTarget
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "自动投放重构-本地定向表-分页列表查询", notes = "自动投放重构-本地定向表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<Object> queryPageList(Long accountId, String targetName, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        try {
+            if (Check.isNull(accountId)) {
+                return Result.error("请选择账户");
+            }
+            return aiKuaishouAccountAutoTargetService.queryPageList(accountId, targetName, pageNo, pageSize);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
+     * 创建定向包
+     *
+     * @param
+     * @return
+     */
+    @PostMapping(value = "/addLocalTarget")
+    public Result<Object> addLocalTarget(@RequestBody JSONObject requestJson) {
+        try {
+            if (Check.isNull(requestJson.getString("targetName"))) {
+                return Result.error("定向包名称为必传项");
+            }
+            Long accountId = requestJson.getLong("accountId");
+            if (Check.isNull(accountId)) {
+                return Result.error("请选择账户id");
+            }
+            return aiKuaishouAccountAutoTargetService.addLocalTarget(requestJson);
+        } catch (Exception e) {
+            log.error("创建定向包失败", e);
+            return Result.error("创建失败" + e.getMessage());
+        }
+    }
+
+    /**
+     * 修改定向包
+     *
+     * @param
+     * @return
+     */
+    @PostMapping(value = "/updateLocalTarget")
+    public Result<Object> updateLocalTarget(@RequestBody JSONObject requestJson) {
+        try {
+            if (Check.isNull(requestJson.getString("id"))) {
+                return Result.error("请选择定向包");
+            }
+            AiKuaishouAccountAutoTarget aiKuaishouAccountAutoTarget = aiKuaishouAccountAutoTargetService.getById(requestJson.getString("id"));
+            if (aiKuaishouAccountAutoTarget == null) {
+                return Result.ok("修改失败,未查到对应定向包");
+            }
+            return aiKuaishouAccountAutoTargetService.updateLocalTarget(requestJson);
+        } catch (Exception e) {
+            return Result.error("修改异常");
+        }
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "自动投放重构-本地定向表-通过id删除", notes = "自动投放重构-本地定向表-通过id删除")
+    @GetMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            aiKuaishouAccountAutoTargetService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @ApiOperation(value = "自动投放重构-本地定向表-批量删除", notes = "自动投放重构-本地定向表-批量删除")
+    @GetMapping(value = "/deleteBatch")
+    public Result<AiKuaishouAccountAutoTarget> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<AiKuaishouAccountAutoTarget> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.aiKuaishouAccountAutoTargetService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "自动投放重构-本地定向表-通过id查询", notes = "自动投放重构-本地定向表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<Object> queryById(@RequestParam(name = "id", required = true) String id) {
+        try {
+            if (Check.isNull(id)) {
+                return Result.error("请选择定向");
+            }
+            AiKuaishouAccountAutoTarget aiKuaishouAccountAutoTarget = aiKuaishouAccountAutoTargetService.getById(id);
+            if (aiKuaishouAccountAutoTarget == null) {
+                return Result.ok("未找到对应实体");
+            } else {
+                JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(aiKuaishouAccountAutoTarget)).toJavaObject(JSONObject.class);
+                if (!Check.isNull(data.getString("keyword"))) {
+                    data.put("keyword", data.getJSONArray("keyword"));
+                }
+                return Result.ok(data);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("查询异常");
+        }
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<AiKuaishouAccountAutoTarget> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                AiKuaishouAccountAutoTarget aiKuaishouAccountAutoTarget = JSON.parseObject(deString, AiKuaishouAccountAutoTarget.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(aiKuaishouAccountAutoTarget, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<AiKuaishouAccountAutoTarget> pageList = aiKuaishouAccountAutoTargetService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "自动投放重构-本地定向表列表");
+        mv.addObject(NormalExcelConstants.CLASS, AiKuaishouAccountAutoTarget.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<AiKuaishouAccountAutoTarget> listAiKuaishouAccountAutoTargets = ExcelImportUtil.importExcel(file.getInputStream(), AiKuaishouAccountAutoTarget.class, params);
+                aiKuaishouAccountAutoTargetService.saveBatch(listAiKuaishouAccountAutoTargets);
+                return Result.ok("文件导入成功!数据行数:" + listAiKuaishouAccountAutoTargets.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("文件导入失败!");
+    }
+
+}

+ 671 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAccountAutoStrategy.java

@@ -0,0 +1,671 @@
+package cn.com.ctop.kuaishou.modules.ai.entity;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+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;
+
+/**
+ * 自动投放重构-账户策略表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-10-12
+ */
+@Data
+@TableName("ctop_ai_kuaishou_account_auto_strategy")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_ai_kuaishou_account_auto_strategy对象", description = "自动投放重构-账户策略表")
+public class AiKuaishouAccountAutoStrategy {
+
+    /**
+     * 客户策略ID
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "客户策略ID")
+    private Long id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 策略状态 1-使用 0-停用
+     */
+    @Excel(name = "策略状态 1-使用 0-停用", width = 15)
+    @ApiModelProperty(value = "策略状态 1-使用 0-停用")
+    private Integer status;
+    /**
+     * 客户要求的计划名称规范
+     */
+    @Excel(name = "客户要求的计划名称规范", width = 15)
+    @ApiModelProperty(value = "客户要求的计划名称规范")
+    private String campaignName;
+    /**
+     * 计划状态: 1:投放 2:暂停
+     */
+    @Excel(name = "计划状态: 1:投放 2:暂停 ", width = 15)
+    @ApiModelProperty(value = "计划状态: 1:投放 2:暂停 ")
+    private Integer campaignStatus;
+    /**
+     * 计划类型 2-提升应用安装 3-获取电商下单 4-推广品牌活动 5-收集销售线索 7-提高应用活跃
+     */
+    @Excel(name = "计划类型 2-提升应用安装 3-获取电商下单 4-推广品牌活动 5-收集销售线索 7-提高应用活跃", width = 15)
+    @ApiModelProperty(value = "计划类型 2-提升应用安装 3-获取电商下单 4-推广品牌活动 5-收集销售线索 7-提高应用活跃")
+    private Integer campaignType;
+    /**
+     * 客户要求的广告组名称规范
+     */
+    @Excel(name = "客户要求的广告组名称规范", width = 15)
+    @ApiModelProperty(value = "客户要求的广告组名称规范")
+    private String groupName;
+    /**
+     * -1:投放 2 暂停
+     */
+    @Excel(name = "-1:投放 2 暂停", width = 15)
+    @ApiModelProperty(value = "-1:投放 2 暂停")
+    private Integer groupStatus;
+    /**
+     * 定向模板id
+     */
+    @Excel(name = "定向模板id", width = 15)
+    @ApiModelProperty(value = "定向模板id")
+    private String templateId;
+    /**
+     * 优化目标出价类型
+     */
+    @Excel(name = "优化目标出价类型", width = 15)
+    @ApiModelProperty(value = "优化目标出价类型")
+    private Integer bidType;
+    /**
+     * 优先从系统应用商店下载
+     */
+    @Excel(name = "优先从系统应用商店下载", width = 15)
+    @ApiModelProperty(value = "优先从系统应用商店下载")
+    private Integer useAppMarket;
+    /**
+     * 应用商店列表
+     */
+    @Excel(name = "应用商店列表", width = 15)
+    @ApiModelProperty(value = "应用商店列表")
+    private String appStore;
+    /**
+     * 出价
+     */
+    @Excel(name = "出价", width = 15)
+    @ApiModelProperty(value = "出价")
+    private BigDecimal bid;
+    /**
+     * 出价
+     */
+    @Excel(name = "出价", width = 15)
+    @ApiModelProperty(value = "出价")
+    private BigDecimal cpaBid;
+    /**
+     * 优先低成本出价
+     */
+    @Excel(name = "优先低成本出价", width = 15)
+    @ApiModelProperty(value = "优先低成本出价")
+    private BigDecimal smartBid;
+    /**
+     * 优化目标
+     */
+    @Excel(name = "优化目标", width = 15)
+    @ApiModelProperty(value = "优化目标")
+    private Integer ocpxActionType;
+    /**
+     * 深度转化目标
+     */
+    @Excel(name = "深度转化目标", width = 15)
+    @ApiModelProperty(value = "深度转化目标")
+    private Integer deepConversionType;
+    /**
+     * 付费ROI系数
+     */
+    @Excel(name = "付费ROI系数", width = 15)
+    @ApiModelProperty(value = "付费ROI系数")
+    private BigDecimal roiRatio;
+    /**
+     * 资源位置
+     */
+    @Excel(name = "资源位置", width = 15)
+    @ApiModelProperty(value = "资源位置")
+    private String sceneId;
+    /**
+     * 创意制作方式 4-自定义 5-程序化创意 7-程序化创意2.0
+     */
+    @Excel(name = " 创意制作方式 4-自定义 5-程序化创意 7-程序化创意2.0", width = 15)
+    @ApiModelProperty(value = " 创意制作方式 4-自定义 5-程序化创意 7-程序化创意2.0")
+    private Integer unitType;
+    /**
+     * 投放开始时间
+     */
+    @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 String scheduleTime;
+    /**
+     * 转化目标ID
+     */
+    @Excel(name = "转化目标ID", width = 15)
+    @ApiModelProperty(value = "转化目标ID")
+    private Integer convertId;
+    /**
+     * url类型
+     */
+    @Excel(name = "url类型", width = 15)
+    @ApiModelProperty(value = "url类型")
+    private Integer urlType;
+    /**
+     * url类型
+     */
+    @Excel(name = "url类型", width = 15)
+    @ApiModelProperty(value = "url类型")
+    private Integer webUriType;
+    /**
+     * 投放链接
+     */
+    @Excel(name = "投放链接", width = 15)
+    @ApiModelProperty(value = "投放链接")
+    private String url;
+    /**
+     * 调起链接
+     */
+    @Excel(name = "调起链接", width = 15)
+    @ApiModelProperty(value = "调起链接")
+    private String schemaUri;
+    /**
+     * 应用ID
+     */
+    @Excel(name = "应用ID", width = 15)
+    @ApiModelProperty(value = "应用ID")
+    private Long appId;
+    /**
+     * 创意展现方式 1-轮播  2-优选
+     */
+    @Excel(name = "创意展现方式 1-轮播  2-优选", width = 15)
+    @ApiModelProperty(value = "创意展现方式 1-轮播  2-优选")
+    private Integer showMode;
+    /**
+     * 投放方式 1-加速投放  2-平滑投放 3-优先低成本
+     */
+    @Excel(name = "投放方式 1-加速投放  2-平滑投放 3-优先低成本", width = 15)
+    @ApiModelProperty(value = "投放方式 1-加速投放  2-平滑投放 3-优先低成本")
+    private Integer speed;
+    /**
+     * 预约广告
+     */
+    @Excel(name = "预约广告", width = 15)
+    @ApiModelProperty(value = "预约广告")
+    private Integer siteType;
+    /**
+     * 游戏礼包码
+     */
+    @Excel(name = "游戏礼包码", width = 15)
+    @ApiModelProperty(value = "游戏礼包码")
+    private String giftData;
+    /**
+     * 是否使用落地页前置功能
+     */
+    @Excel(name = "是否使用落地页前置功能", width = 15)
+    @ApiModelProperty(value = "是否使用落地页前置功能")
+    private Integer videoLandingPage;
+    /**
+     * 智能定向
+     */
+    @Excel(name = "智能定向", width = 15)
+    @ApiModelProperty(value = "智能定向")
+    private Integer autoTarget;
+    /**
+     * 是否开启自动生成视频
+     */
+    @Excel(name = "是否开启自动生成视频", width = 15)
+    @ApiModelProperty(value = "是否开启自动生成视频")
+    private Integer autoCreatePhoto;
+    /**
+     * 地域
+     */
+    @Excel(name = "地域", width = 15)
+    @ApiModelProperty(value = "地域")
+    private String region;
+    /**
+     * 商圈定向
+     */
+    @Excel(name = "商圈定向", width = 15)
+    @ApiModelProperty(value = "商圈定向")
+    private String districtIds;
+    /**
+     * 用户类型
+     */
+    @Excel(name = "用户类型", width = 15)
+    @ApiModelProperty(value = "用户类型")
+    private Integer userType;
+    /**
+     * 最大年龄
+     */
+    @Excel(name = "最大年龄", width = 15)
+    @ApiModelProperty(value = "最大年龄")
+    private Integer ageMin;
+    /**
+     * 最小年龄
+     */
+    @Excel(name = "最小年龄", width = 15)
+    @ApiModelProperty(value = "最小年龄")
+    private Integer ageMax;
+    /**
+     * 固定年龄段
+     */
+    @Excel(name = "固定年龄段", width = 15)
+    @ApiModelProperty(value = "固定年龄段")
+    private String agesRange;
+    /**
+     * 性别
+     */
+    @Excel(name = "性别", width = 15)
+    @ApiModelProperty(value = "性别")
+    private Integer gender;
+    /**
+     * 操作系统
+     */
+    @Excel(name = "操作系统", width = 15)
+    @ApiModelProperty(value = "操作系统")
+    private Integer platformOs;
+    /**
+     * Android版本
+     */
+    @Excel(name = "Android版本", width = 15)
+    @ApiModelProperty(value = "Android版本")
+    private Integer androidOsv;
+    /**
+     * iOS版本
+     */
+    @Excel(name = "iOS版本", width = 15)
+    @ApiModelProperty(value = "iOS版本")
+    private Integer iosOsv;
+    /**
+     * 网络环境
+     */
+    @Excel(name = "网络环境", width = 15)
+    @ApiModelProperty(value = "网络环境")
+    private Integer network;
+    /**
+     * 设备品牌
+     */
+    @Excel(name = "设备品牌", width = 15)
+    @ApiModelProperty(value = "设备品牌")
+    private String deviceBrand;
+    /**
+     * 设备价格
+     */
+    @Excel(name = "设备价格", width = 15)
+    @ApiModelProperty(value = "设备价格")
+    private String devicePrice;
+    /**
+     * 商业兴趣类型
+     */
+    @Excel(name = "商业兴趣类型", width = 15)
+    @ApiModelProperty(value = "商业兴趣类型")
+    private Integer businessInterestType;
+    /**
+     * 商业兴趣
+     */
+    @Excel(name = "商业兴趣", width = 15)
+    @ApiModelProperty(value = "商业兴趣")
+    private String businessInterest;
+    /**
+     * 网红粉丝
+     */
+    @Excel(name = "网红粉丝", width = 15)
+    @ApiModelProperty(value = "网红粉丝")
+    private String fansStar;
+    /**
+     * 兴趣视频用户
+     */
+    @Excel(name = "兴趣视频用户", width = 15)
+    @ApiModelProperty(value = "兴趣视频用户")
+    private String interestVideo;
+    /**
+     * APP行为-按分类
+     */
+    @Excel(name = "APP行为-按分类", width = 15)
+    @ApiModelProperty(value = "APP行为-按分类")
+    private String appInterest;
+    /**
+     * APP行为-按APP名称
+     */
+    @Excel(name = "APP行为-按APP名称", width = 15)
+    @ApiModelProperty(value = "APP行为-按APP名称")
+    private String appIds;
+    /**
+     * 过滤已转化人群纬度
+     */
+    @Excel(name = "过滤已转化人群纬度", width = 15)
+    @ApiModelProperty(value = "过滤已转化人群纬度")
+    private Integer filterConvertedLevel;
+    /**
+     * 人群包定向
+     */
+    @Excel(name = "人群包定向", width = 15)
+    @ApiModelProperty(value = "人群包定向")
+    private String population;
+    /**
+     * 人群包排除
+     */
+    @Excel(name = "人群包排除", width = 15)
+    @ApiModelProperty(value = "人群包排除")
+    private String excludePopulation;
+    /**
+     * 付费人群包id
+     */
+    @Excel(name = "付费人群包id", width = 15)
+    @ApiModelProperty(value = "付费人群包id")
+    private String paidAudience;
+    /**
+     * 开启智能扩量
+     */
+    @Excel(name = "开启智能扩量", width = 15)
+    @ApiModelProperty(value = "开启智能扩量")
+    private Integer isOpen;
+    /**
+     * 不可突破年龄
+     */
+    @Excel(name = "不可突破年龄", width = 15)
+    @ApiModelProperty(value = "不可突破年龄")
+    private Integer noAgeBreak;
+    /**
+     * 不可突破性别
+     */
+    @Excel(name = "不可突破性别", width = 15)
+    @ApiModelProperty(value = "不可突破性别")
+    private Integer noGenderBreak;
+    /**
+     * 不可突破地域
+     */
+    @Excel(name = "不可突破地域", width = 15)
+    @ApiModelProperty(value = "不可突破地域")
+    private Integer noAreaBreak;
+    /**
+     * 行为兴趣定向
+     */
+    @Excel(name = "行为兴趣定向", width = 15)
+    @ApiModelProperty(value = "行为兴趣定向")
+    private String behaviorInterest;
+    /**
+     * 创意名称
+     */
+    @Excel(name = "创意名称", width = 15)
+    @ApiModelProperty(value = "创意名称")
+    private String creativeName;
+    /**
+     * 行动号召按钮文案
+     */
+    @Excel(name = "行动号召按钮文案", width = 15)
+    @ApiModelProperty(value = "行动号召按钮文案")
+    private String actionBarText;
+    /**
+     * 广告语
+     */
+    @Excel(name = "广告语", width = 15)
+    @ApiModelProperty(value = "广告语")
+    private String description;
+    /**
+     * 便利贴创意短广告语
+     */
+    @Excel(name = "便利贴创意短广告语", width = 15)
+    @ApiModelProperty(value = "便利贴创意短广告语")
+    private String shortSlogan;
+    /**
+     * 封面广告语标题
+     */
+    @Excel(name = "封面广告语标题", width = 15)
+    @ApiModelProperty(value = "封面广告语标题")
+    private String stickerTitle;
+    /**
+     * 贴纸样式类型
+     */
+    @Excel(name = "贴纸样式类型", width = 15)
+    @ApiModelProperty(value = "贴纸样式类型")
+    private String overlayType;
+    /**
+     * 广告标签
+     */
+    @Excel(name = "广告标签", width = 15)
+    @ApiModelProperty(value = "广告标签")
+    private String exposeTag;
+    /**
+     * 广告标签2期
+     */
+    @Excel(name = "广告标签2期", width = 15)
+    @ApiModelProperty(value = "广告标签2期")
+    private String newExposeTag;
+    /**
+     * 安卓下载中间页ID
+     */
+    @Excel(name = "安卓下载中间页ID", width = 15)
+    @ApiModelProperty(value = "安卓下载中间页ID")
+    private String siteId;
+    /**
+     * 第三方点击检测链接
+     */
+    @Excel(name = "第三方点击检测链接", width = 15)
+    @ApiModelProperty(value = "第三方点击检测链接")
+    private String clickTrackUrl;
+    /**
+     * 第三方开始播放监测链接
+     */
+    @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 String actionbarClickUrl;
+    /**
+     * 创意分类
+     */
+    @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 Integer imageCnt;
+    /**
+     * 创建时间
+     */
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 生效时间
+     */
+    @ApiModelProperty(value = "生效时间")
+    private Date effectiveTime;
+    /**
+     * 失效时间
+     */
+    @ApiModelProperty(value = "失效时间")
+    private Date expiryTime;
+    /**
+     * timerTaskStatus
+     */
+    @Excel(name = "timerTaskStatus", width = 15)
+    @ApiModelProperty(value = "timerTaskStatus")
+    private Integer timerTaskStatus;
+    /**
+     * 程序化创意2.0-是否开启智能抽帧
+     */
+    @Excel(name = "程序化创意2.0-是否开启智能抽帧", width = 15)
+    @ApiModelProperty(value = "程序化创意2.0-是否开启智能抽帧")
+    private Integer smartCover;
+    /**
+     * 程序化创意2.0-是否开启素材挖掘
+     */
+    @Excel(name = "程序化创意2.0-是否开启素材挖掘", width = 15)
+    @ApiModelProperty(value = "程序化创意2.0-是否开启素材挖掘")
+    private Integer assetMining;
+    /**
+     * 是否单一应用 0 是 1 否
+     */
+    @Excel(name = "是否单一应用 0 是 1 否", width = 15)
+    @ApiModelProperty(value = "是否单一应用 0 是 1 否")
+    private Integer singleAppid;
+    /**
+     * 应用ID列表
+     */
+    @Excel(name = "应用ID列表", width = 15)
+    @ApiModelProperty(value = "应用ID列表")
+    private String appIdArray;
+    /**
+     * 是否通用监测链接
+     */
+    @Excel(name = "是否通用监测链接", width = 15)
+    @ApiModelProperty(value = "是否通用监测链接")
+    private Integer generalTrack;
+    /**
+     * 深度转化出价
+     */
+    @Excel(name = "深度转化出价", width = 15)
+    @ApiModelProperty(value = "深度转化出价")
+    private BigDecimal deepConversionBid;
+    /**
+     * 是否创建程序化创意
+     */
+    @Excel(name = "是否创建程序化创意", width = 15)
+    @ApiModelProperty(value = "是否创建程序化创意")
+    private Integer openProgramCreate;
+    /**
+     * userId
+     */
+    @Excel(name = "userId", width = 15)
+    @ApiModelProperty(value = "userId")
+    private String userId;
+    /**
+     * 素材来源
+     */
+    @Excel(name = "素材来源", width = 15)
+    @ApiModelProperty(value = "素材来源")
+    private Integer channelType;
+    /**
+     * 计划日预算
+     */
+    @Excel(name = "计划日预算", width = 15)
+    @ApiModelProperty(value = "计划日预算")
+    private BigDecimal campaignDayBudget;
+    /**
+     * 组日预算
+     */
+    @Excel(name = "组日预算", width = 15)
+    @ApiModelProperty(value = "组日预算")
+    private BigDecimal unitDayBudget;
+    /**
+     * campaignDayBudgetSchedule
+     */
+    @Excel(name = "campaignDayBudgetSchedule", width = 15)
+    @ApiModelProperty(value = "campaignDayBudgetSchedule")
+    private String campaignDayBudgetSchedule;
+    /**
+     * unitDayBudgetSchedule
+     */
+    @Excel(name = "unitDayBudgetSchedule", width = 15)
+    @ApiModelProperty(value = "unitDayBudgetSchedule")
+    private String unitDayBudgetSchedule;
+    /**
+     * 自定义组数量
+     */
+    @Excel(name = "自定义组数量", width = 15)
+    @ApiModelProperty(value = "自定义组数量")
+    private Integer customUnitCnt;
+    /**
+     * 程序化数量
+     */
+    @Excel(name = "程序化数量", width = 15)
+    @ApiModelProperty(value = "程序化数量")
+    private Integer programUnitCnt;
+    /**
+     * 0:搭建 1:不搭建
+     */
+    @Excel(name = "0:搭建 1:不搭建", width = 15)
+    @ApiModelProperty(value = "0:搭建 1:不搭建")
+    private Integer historyTop;
+    /**
+     * 素材名称关键字
+     */
+    @Excel(name = "素材名称关键字", width = 15)
+    @ApiModelProperty(value = "素材名称关键字")
+    private String materialKeyword;
+    /**
+     * 是否多应用多出价 0 否 1 是
+     */
+    @Excel(name = "是否多应用多出价 0 否 1 是", width = 15)
+    @ApiModelProperty(value = "是否多应用多出价 0 否 1 是")
+    private Integer multipleBids;
+    /**
+     * 层级
+     */
+    @Excel(name = "层级", width = 15)
+    @ApiModelProperty(value = "层级")
+    private String usageLevel;
+    /**
+     * 是否使用渠道号0不使用,1使用
+     */
+    @Excel(name = "是否使用渠道号0不使用,1使用", width = 15)
+    @ApiModelProperty(value = "是否使用渠道号0不使用,1使用")
+    private Integer useChannel;
+    /**
+     * 是否开启系统优选 0 否 1 是
+     */
+    @Excel(name = "是否开启系统优选 0 否 1 是", width = 15)
+    @ApiModelProperty(value = "是否开启系统优选 0 否 1 是")
+    private Integer systemOptimization;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+
+
+
+	@TableField(exist = false)
+	private String authName;
+}

+ 255 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAccountAutoTarget.java

@@ -0,0 +1,255 @@
+package cn.com.ctop.kuaishou.modules.ai.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 自动投放重构-本地定向表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-10-12
+ */
+@Data
+@TableName("ctop_ai_kuaishou_account_auto_target")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_ai_kuaishou_account_auto_target对象", description = "自动投放重构-本地定向表")
+public class AiKuaishouAccountAutoTarget {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "ID")
+    private Long id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 定向包名称
+     */
+    @Excel(name = "定向包名称", width = 15)
+    @ApiModelProperty(value = "定向包名称")
+    private String targetName;
+    /**
+     * 地域
+     */
+    @Excel(name = "地域", width = 15)
+    @ApiModelProperty(value = "地域")
+    private String region;
+    /**
+     * 商圈定向
+     */
+    @Excel(name = "商圈定向", width = 15)
+    @ApiModelProperty(value = "商圈定向")
+    private String districtIds;
+    /**
+     * 用户类型 0:实时1:常驻 2:不限
+     */
+    @Excel(name = "用户类型 0:实时1:常驻 2:不限 ", width = 15)
+    @ApiModelProperty(value = "用户类型 0:实时1:常驻 2:不限 ")
+    private Integer userType;
+    /**
+     * 可选年龄段 18:18-23岁 24:24-30岁 31:31-40岁 41:41-49岁 50:50-100岁
+     */
+    @Excel(name = "可选年龄段 18:18-23岁 24:24-30岁 31:31-40岁 41:41-49岁 50:50-100岁 ", width = 15)
+    @ApiModelProperty(value = "可选年龄段 18:18-23岁 24:24-30岁 31:31-40岁 41:41-49岁 50:50-100岁 ")
+    private String agesRange;
+    /**
+     * 年龄最小值
+     */
+    @Excel(name = "年龄最小值", width = 15)
+    @ApiModelProperty(value = "年龄最小值")
+    private Integer min;
+    /**
+     * 年龄最大值
+     */
+    @Excel(name = "年龄最大值", width = 15)
+    @ApiModelProperty(value = "年龄最大值")
+    private Integer max;
+    /**
+     * 性别 1:女性, 2:男性,0 表示不限
+     */
+    @Excel(name = "性别 1:女性, 2:男性,0 表示不限", width = 15)
+    @ApiModelProperty(value = "性别 1:女性, 2:男性,0 表示不限")
+    private Integer gender;
+    /**
+     * 定向的 os 版本 应用安装类计划以app_id中的platform_os为准 1:Android,2:iOS,0 表示不限
+     */
+    @Excel(name = "定向的 os 版本 应用安装类计划以app_id中的platform_os为准 1:Android,2:iOS,0 表示不限", width = 15)
+    @ApiModelProperty(value = "定向的 os 版本 应用安装类计划以app_id中的platform_os为准 1:Android,2:iOS,0 表示不限")
+    private Integer platformOs;
+    /**
+     * Android 版本 3:不限,4:4.x+,5:5.x+,6:6.x+,7:7.x+
+     */
+    @Excel(name = "Android 版本 3:不限,4:4.x+,5:5.x+,6:6.x+,7:7.x+", width = 15)
+    @ApiModelProperty(value = "Android 版本 3:不限,4:4.x+,5:5.x+,6:6.x+,7:7.x+")
+    private Integer androidOsv;
+    /**
+     * iOS 版本 6:不限, 7:7.x+, 8:8.x+, 9:9.x+, 10:10.x+
+     */
+    @Excel(name = "iOS 版本 6:不限, 7:7.x+, 8:8.x+, 9:9.x+, 10:10.x+", width = 15)
+    @ApiModelProperty(value = "iOS 版本 6:不限, 7:7.x+, 8:8.x+, 9:9.x+, 10:10.x+")
+    private Integer iosOsv;
+    /**
+     * 网络环境 1:WI-FI,2:移动网络,0:表示不限
+     */
+    @Excel(name = "网络环境 1:WI-FI,2:移动网络,0:表示不限", width = 15)
+    @ApiModelProperty(value = "网络环境 1:WI-FI,2:移动网络,0:表示不限")
+    private Integer network;
+    /**
+     * 过滤已转化人群纬度 0:不限 1:广告组 2:广告计划 3:本账户 4:公司主体 5:APP
+     */
+    @Excel(name = "过滤已转化人群纬度 0:不限 1:广告组 2:广告计划 3:本账户 4:公司主体 5:APP", width = 15)
+    @ApiModelProperty(value = "过滤已转化人群纬度 0:不限 1:广告组 2:广告计划 3:本账户 4:公司主体 5:APP")
+    private Integer filterConvertedLevel;
+    /**
+     * 设备品牌  1:OPPO,2:VIVO, 3:华为,4:小米,5:荣耀,6:三星,7:金立,8:魅族,9:乐视,10:其他,11:苹果(只有 platform_os 为不限时支持此选项);传值为 [] 表示不限;当 platform_os 表示 iOS 的时候,没有设备品牌定向
+     */
+    @Excel(name = "设备品牌  1:OPPO,2:VIVO, 3:华为,4:小米,5:荣耀,6:三星,7:金立,8:魅族,9:乐视,10:其他,11:苹果(只有 platform_os 为不限时支持此选项);传值为 [] 表示不限;当 platform_os 表示 iOS 的时候,没有设备品牌定向", width = 15)
+    @ApiModelProperty(value = "设备品牌  1:OPPO,2:VIVO, 3:华为,4:小米,5:荣耀,6:三星,7:金立,8:魅族,9:乐视,10:其他,11:苹果(只有 platform_os 为不限时支持此选项);传值为 [] 表示不限;当 platform_os 表示 iOS 的时候,没有设备品牌定向")
+    private String deviceBrand;
+    /**
+     * 设备价格 1:1,500元以下,2:1,501~2,000,3:2,001~2,500,4:2,501~3,000,5、3,001~3,500,6:3,501~4,000,7:4,001~4,500,8:4,501~5,000,9:5,001~5,500,10:5,500元以上,传值为 [] 表示不限
+     */
+    @Excel(name = "设备价格 1:1,500元以下,2:1,501~2,000,3:2,001~2,500,4:2,501~3,000,5、3,001~3,500,6:3,501~4,000,7:4,001~4,500,8:4,501~5,000,9:5,001~5,500,10:5,500元以上,传值为 [] 表示不限", width = 15)
+    @ApiModelProperty(value = "设备价格 1:1,500元以下,2:1,501~2,000,3:2,001~2,500,4:2,501~3,000,5、3,001~3,500,6:3,501~4,000,7:4,001~4,500,8:4,501~5,000,9:5,001~5,500,10:5,500元以上,传值为 [] 表示不限")
+    private String devicePrice;
+    /**
+     * 商业兴趣类型 0:默认值 1:智能投放 2:兴趣标签
+     */
+    @Excel(name = "商业兴趣类型 0:默认值 1:智能投放 2:兴趣标签", width = 15)
+    @ApiModelProperty(value = "商业兴趣类型 0:默认值 1:智能投放 2:兴趣标签")
+    private Integer businessInterestType;
+    /**
+     * 商业兴趣
+     */
+    @Excel(name = "商业兴趣", width = 15)
+    @ApiModelProperty(value = "商业兴趣")
+    private String businessInterest;
+    /**
+     * 网红类别
+     */
+    @Excel(name = "网红类别", width = 15)
+    @ApiModelProperty(value = "网红类别")
+    private String fansStar;
+    /**
+     * 兴趣视频
+     */
+    @Excel(name = "兴趣视频", width = 15)
+    @ApiModelProperty(value = "兴趣视频")
+    private String interestVideo;
+    /**
+     * APP行为-按分类
+     */
+    @Excel(name = "APP行为-按分类", width = 15)
+    @ApiModelProperty(value = "APP行为-按分类")
+    private String appInterest;
+    /**
+     * APP行为-按APP名称
+     */
+    @Excel(name = "APP行为-按APP名称", width = 15)
+    @ApiModelProperty(value = "APP行为-按APP名称")
+    private String appIds;
+    /**
+     * 定向人群包
+     */
+    @Excel(name = "定向人群包", width = 15)
+    @ApiModelProperty(value = "定向人群包")
+    private String population;
+    /**
+     * 付费人群包
+     */
+    @Excel(name = "付费人群包", width = 15)
+    @ApiModelProperty(value = "付费人群包")
+    private String paidAudience;
+    /**
+     * 排除人群包
+     */
+    @Excel(name = "排除人群包", width = 15)
+    @ApiModelProperty(value = "排除人群包")
+    private String excludePopulation;
+    /**
+     * 开启智能扩量 默认为0,为1时打开智能扩量,其他数值报错;关闭智能扩量时,以下三个字段必须为0
+     */
+    @Excel(name = "开启智能扩量 默认为0,为1时打开智能扩量,其他数值报错;关闭智能扩量时,以下三个字段必须为0", width = 15)
+    @ApiModelProperty(value = "开启智能扩量 默认为0,为1时打开智能扩量,其他数值报错;关闭智能扩量时,以下三个字段必须为0")
+    private Integer isOpen;
+    /**
+     * 不可突破年龄 默认为0(可突破/无需控制),定向age数据不为空时,可设为1(不可突破)
+     */
+    @Excel(name = "不可突破年龄 默认为0(可突破/无需控制),定向age数据不为空时,可设为1(不可突破)", width = 15)
+    @ApiModelProperty(value = "不可突破年龄 默认为0(可突破/无需控制),定向age数据不为空时,可设为1(不可突破)")
+    private Integer noAgeBreak;
+    /**
+     * 不可突破性别 默认为0(可突破/无需控制),定向gender数据不为空时,可设为1(不可突破
+     */
+    @Excel(name = "不可突破性别 默认为0(可突破/无需控制),定向gender数据不为空时,可设为1(不可突破", width = 15)
+    @ApiModelProperty(value = "不可突破性别 默认为0(可突破/无需控制),定向gender数据不为空时,可设为1(不可突破")
+    private Integer noGenderBreak;
+    /**
+     * 不可突破地域 默认为0(可突破/无需控制),定向region数据不为空时,可设为1(不可突破)
+     */
+    @Excel(name = "不可突破地域 默认为0(可突破/无需控制),定向region数据不为空时,可设为1(不可突破)", width = 15)
+    @ApiModelProperty(value = "不可突破地域 默认为0(可突破/无需控制),定向region数据不为空时,可设为1(不可突破)")
+    private Integer noAreaBreak;
+    /**
+     * 行为定向关键词
+     */
+    @Excel(name = "行为定向关键词", width = 15)
+    @ApiModelProperty(value = "行为定向关键词")
+    private String keyword;
+    /**
+     * 行为定向 类目词
+     */
+    @Excel(name = "行为定向 类目词", width = 15)
+    @ApiModelProperty(value = "行为定向 类目词")
+    private String label;
+    /**
+     * 兴趣定向类目词
+     */
+    @Excel(name = "兴趣定向类目词", width = 15)
+    @ApiModelProperty(value = "兴趣定向类目词")
+    private String interestLabel;
+    /**
+     * 在多少天内发生行为的用户 0:7天 1:15天 2:30天 3:90天 4:180天
+     */
+    @Excel(name = "在多少天内发生行为的用户 0:7天 1:15天 2:30天 3:90天 4:180天", width = 15)
+    @ApiModelProperty(value = "在多少天内发生行为的用户 0:7天 1:15天 2:30天 3:90天 4:180天")
+    private Integer timeType;
+    /**
+     * 行为强度	0:不限 1:高强度
+     */
+    @Excel(name = "行为强度	0:不限 1:高强度", width = 15)
+    @ApiModelProperty(value = "行为强度	0:不限 1:高强度")
+    private Integer strengthType;
+    /**
+     * 行为场景	1:社区 2:APP 4:推广
+     */
+    @Excel(name = "行为场景	1:社区 2:APP 4:推广", width = 15)
+    @ApiModelProperty(value = "行为场景	1:社区 2:APP 4:推广")
+    private String sceneType;
+    /**
+     * 定向模板创建时间
+     */
+    @ApiModelProperty(value = "定向模板创建时间")
+    private Date createTime;
+    /**
+     * 定向模板修改时间
+     */
+    @ApiModelProperty(value = "定向模板修改时间")
+    private Date updateTime;
+}

+ 15 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouCampaignLevelOperationRecord.java

@@ -92,6 +92,21 @@ public class AiKuaishouCampaignLevelOperationRecord {
         this.createTime = new Date();
     }
 
+    public AiKuaishouCampaignLevelOperationRecord(AiKuaishouAccountAutoStrategy strategy, Long campaignId, Integer code, String message,String campaignName,String campaignUuid) {
+        this.accountId = strategy.getAccountId();
+        this.dayBudget = strategy.getCampaignDayBudget().longValue();
+        this.dayBudgetSchedule = strategy.getCampaignDayBudgetSchedule();
+        this.campaignType = strategy.getCampaignType();
+        this.campaignId = campaignId;
+        this.status = code;
+        this.message = message;
+        this.operationType = 1;
+        this.createTime = new Date();
+        this.campaignName = campaignName;
+        this.aiStrategyUuid = campaignUuid;
+        this.createType = 3;
+    }
+
     public AiKuaishouCampaignLevelOperationRecord(KuaishouProjectStrategy strategy, Long campaignId, Integer code, String message) {
         this.accountId = strategy.getAccountId();
         this.dayBudget = strategy.getCampaignDayBudget();

+ 69 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/enums/KuaishouAutoTypeEnum.java

@@ -0,0 +1,69 @@
+package cn.com.ctop.kuaishou.modules.ai.enums;
+
+/**
+ * 账户自动投放重构枚举
+ */
+public enum KuaishouAutoTypeEnum {
+    /**
+     * 程序化、自定义都是每小时建一次,每天建20次
+     * (2:00—22:00),根据设置的总数,将需要创
+     * 建的数量平均分到每个小时。
+     * 1、若某个小时,可用素材创建完后没有达到既定
+     * 需要创建的数量,剩余可创建数量平均分摊到之
+     * 后的时间上;
+     * 2、若上个小时,匹配创建时有剩余未创建,下一
+     * 小时需延续上小时未创建的素材继续创建。
+     * <p>
+     * type字段
+     * 第一位创意创建方式: 4-自定义,7-程序化创意2.0
+     * 第二位素材获取方式: 1:素材上新 2:历史高质量 3:历史遗漏素材 4:历史打捞
+     * 快手创意素材获取类型
+     */
+    KUAISHOU_CUSTOM_UP_NEW("41", "自定义上新"),
+    KUAISHOU_CUSTOM_HISTORY_TOP("42", "自定义高质量"),
+    KUAISHOU_CUSTOM_MISS("43", "自定义历史遗漏"),
+    KUAISHOU_CUSTOM_HISTORY_CATCH("44", "自定义历史打捞"),
+    KUAISHOU_PROGRAM_UP_NEW("71", "程序化上新"),
+    KUAISHOU_PROGRAM_HISTORY_TOP("72", "程序化高质量"),
+    KUAISHOU_PROGRAM_MISS("73", "程序化历史遗漏"),
+    KUAISHOU_PROGRAM_HISTORY_CATCH("74", "程序化历史打捞");
+
+    /**
+     * 类型
+     */
+    private String type;
+    /**
+     * 名称
+     */
+    private String name;
+
+    KuaishouAutoTypeEnum(String type, String name) {
+        this.type = type;
+        this.name = name;
+    }
+
+    public static String getNameByType(String type) {
+        for (KuaishouAutoTypeEnum createTypeEnum : KuaishouAutoTypeEnum.values()) {
+            if (createTypeEnum.getType().equals(type)) {
+                return createTypeEnum.getName();
+            }
+        }
+        return "";
+    }
+
+    public String getType() {
+        return this.type;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public void setName(String value) {
+        this.name = value;
+    }
+}

+ 20 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaishouAccountAutoStrategyMapper.java

@@ -0,0 +1,20 @@
+package cn.com.ctop.kuaishou.modules.ai.mapper;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoStrategy;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import net.sf.json.JSONObject;
+
+import java.util.List;
+
+/**
+ * 自动投放重构-账户策略表
+ *
+ * @author jeecg-boot
+ * 2021-10-12
+ * @version V1.0
+ */
+public interface AiKuaishouAccountAutoStrategyMapper extends BaseMapper<AiKuaishouAccountAutoStrategy> {
+
+    List<AiKuaishouAccountAutoStrategy> queryList(AiKuaishouAccountAutoStrategy aiKuaishouAccountAutoStrategy);
+
+}

+ 19 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaishouAccountAutoTargetMapper.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.ai.mapper;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoTarget;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 自动投放重构-本地定向表
+ *
+ * @author jeecg-boot
+ * 2021-10-12
+ * @version V1.0
+ */
+public interface AiKuaishouAccountAutoTargetMapper extends BaseMapper<AiKuaishouAccountAutoTarget> {
+
+    List<AiKuaishouAccountAutoTarget> queryPageList(@Param("accountId") Long accountId,@Param("targetName") String targetName);
+}

+ 8 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaishouAccountAutoVideoMapper.java

@@ -16,4 +16,12 @@ import java.util.List;
 public interface AiKuaishouAccountAutoVideoMapper extends BaseMapper<AiKuaishouAccountAutoVideo> {
 
     void insertBatch(@Param("videoGetList") List<AiKuaishouAccountAutoVideo> videoGetList);
+
+    List<AiKuaishouAccountAutoVideo> getUpNewVideos(@Param("accountId") Long accountId, @Param("channelType") Integer channelType, @Param("keyword") String keyword, @Param("videoCnt") Integer videoCnt, @Param("statDate") String statDate);
+
+    List<AiKuaishouAccountAutoVideo> getHistoryTopVideos(@Param("accountId") Long accountId, @Param("channelType") Integer channelType, @Param("keyword") String keyword, @Param("videoCnt") Integer videoCnt);
+
+    List<AiKuaishouAccountAutoVideo> getHistoryCatchVideos(@Param("accountId") Long accountId, @Param("channelType") Integer channelType, @Param("keyword") String keyword, @Param("videoCnt") Integer videoCnt);
+
+    List<AiKuaishouAccountAutoVideo> getZeroVideoByParams(Long accountId, Integer channelType, String keyword, Integer videoCnt);
 }

+ 31 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaishouAccountAutoStrategyMapper.xml

@@ -0,0 +1,31 @@
+<?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.ai.mapper.AiKuaishouAccountAutoStrategyMapper">
+
+    <select id="queryList" resultType="cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoStrategy">
+        SELECT
+        id,
+        account_id,
+        status,
+        create_time,
+        convert_id,
+        ocpx_action_type,
+        cpa_bid,
+        bid,
+        bid_type
+        FROM ctop_ai_kuaishou_account_auto_strategy
+        <where>
+            <if test="accountId != null">
+                and account_id = #{accountId}
+            </if>
+            <if test="userId != null">
+                and user_id = #{userId}
+            </if>
+            <if test="status != null">
+                and status = #{status}
+            </if>
+        </where>
+        order by create_time desc
+    </select>
+
+</mapper>

+ 16 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaishouAccountAutoTargetMapper.xml

@@ -0,0 +1,16 @@
+<?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.ai.mapper.AiKuaishouAccountAutoTargetMapper">
+
+    <select id="queryPageList" resultType="cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoTarget">
+        SELECT
+        *
+        FROM ctop_ai_kuaishou_account_auto_target
+        where account_id = #{accountId}
+        <if test="targetName != null">
+            and target_name = #{targetName}
+        </if>
+        order by create_time desc
+    </select>
+
+</mapper>

+ 97 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaishouAccountAutoVideoMapper.xml

@@ -28,4 +28,101 @@
         </foreach>
     </insert>
 
+
+    <select id="getUpNewVideos" resultType="cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoVideo">
+        SELECT * FROM ctop_ai_kuaishou_account_auto_video
+        WHERE status = 1
+        AND account_id = #{accountId}
+        <if test="channelType!=null">
+            AND channel_type = #{channelType}
+        </if>
+        <if test="statDate!=null">
+            AND stat_date = #{statDate}
+        </if>
+        <if test="keyword != null and keyword != '' ">
+            AND photo_name LIKE concat(#{keyword},'%')
+        </if>
+        LIMIT #{videoCnt}
+    </select>
+
+    <select id="getZeroVideoByParams" resultType="cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoVideo">
+        SELECT * FROM ctop_ai_kuaishou_account_auto_video
+        WHERE status = 1
+        AND account_id = #{accountId}
+        <if test="channelType!=null">
+            AND channel_type = #{channelType}
+        </if>
+        <if test="statDate!=null">
+            AND stat_date &lt; #{statDate}
+            AND stat_date &gt;= DATE_SUB(#{statDate},INTERVAL 7 day)
+        </if>
+        <if test="keyword != null and keyword != '' ">
+            AND photo_name LIKE concat(#{keyword},'%')
+        </if>
+        LIMIT #{videoCnt}
+    </select>
+
+
+    <select id="getHistoryTopVideos" resultType="cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoVideo">
+        select
+        account_id,
+        md5 as 'signature',
+        photo_id,
+        material_name as 'photoName',
+        channel_type,
+        material_type
+        from ctop_material_top_cost
+        where t1.account_id = #{accountId}
+        and md5 not in
+        (
+        SELECT signature FROM ctop_ai_kuaishou_account_auto_video_used
+        WHERE account_id =#{accountId}
+        AND type = 3
+        AND usage_times &lt;= 5
+        AND stat_date &gt;= DATE_SUB(#{statDate},INTERVAL 7 day)
+        group by signature
+        )
+        <if test="channelType!=null">
+            and channel_type = #{channelType}
+        </if>
+        <if test="keyword != null and keyword != '' ">
+            and material_name like concat(#{keyword},'%')
+        </if>
+        group by signature
+        ORDER BY t2.7day_cost DESC
+        LIMIT #{videoCnt}
+    </select>
+
+    <select id="getHistoryCatchVideos" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
+        select
+        account_id,
+        md5 as 'signature',
+        photo_id,
+        material_name as 'photoName',
+        channel_type,
+        material_type
+        from ctop_material_top_cost
+        where t1.account_id = #{accountId}
+        and md5 not in
+        (
+        SELECT signature FROM ctop_ai_kuaishou_account_auto_video_used
+        WHERE account_id =#{accountId}
+        AND type = 4
+        AND usage_times &lt;= 2
+        AND stat_date &gt;= DATE_SUB(#{statDate},INTERVAL 60 day)
+        group by signature
+        )
+        <if test="channelType!=null">
+            and channel_type = #{channelType}
+        </if>
+        <if test="keyword != null and keyword != '' ">
+            and material_name like concat(#{keyword},'%')
+        </if>
+        group by signature
+        ORDER BY t2.sum_cost DESC
+        LIMIT #{videoCnt}
+
+
+    </select>
+
 </mapper>

+ 20 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAccountAutoDoService.java

@@ -0,0 +1,20 @@
+package cn.com.ctop.kuaishou.modules.ai.service;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoStrategy;
+
+import java.text.ParseException;
+
+public interface IAiKuaishouAccountAutoDoService {
+    Integer autoCreateCreative(AiKuaishouAccountAutoStrategy strategy, Integer createType, Integer videoCnt);
+
+    void autoCreateProgramCreative(AiKuaishouAccountAutoStrategy strategy, Integer createType, Integer videoCnt);
+
+    void customCreativeSupplement(AiKuaishouAccountAutoStrategy strategy, Integer hour) throws ParseException;
+
+    void customCreativeLimit(AiKuaishouAccountAutoStrategy strategy);
+
+    // 组创建是否超限
+    Boolean getUnitOverrun(Long accountId);
+
+    void customCreativeLimitNew(AiKuaishouAccountAutoStrategy strategy);
+}

+ 16 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAccountAutoStrategyService.java

@@ -0,0 +1,16 @@
+package cn.com.ctop.kuaishou.modules.ai.service;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoStrategy;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.pagehelper.PageInfo;
+
+/**
+ * 自动投放重构-账户策略表
+ * @author jeecg-boot
+ * 2021-10-12
+ * @version V1.0
+ */
+public interface IAiKuaishouAccountAutoStrategyService extends IService<AiKuaishouAccountAutoStrategy> {
+
+    PageInfo<AiKuaishouAccountAutoStrategy> queryList(AiKuaishouAccountAutoStrategy aiKuaishouAccountAutoStrategy);
+}

+ 22 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAccountAutoTargetService.java

@@ -0,0 +1,22 @@
+package cn.com.ctop.kuaishou.modules.ai.service;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoTarget;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
+
+/**
+ * 自动投放重构-本地定向表
+ *
+ * @author jeecg-boot
+ * 2021-10-12
+ * @version V1.0
+ */
+public interface IAiKuaishouAccountAutoTargetService extends IService<AiKuaishouAccountAutoTarget> {
+
+    Result<Object> queryPageList(Long accountId, String targetName, Integer pageNo, Integer pageSize);
+
+    Result<Object> addLocalTarget(JSONObject requestJson);
+
+    Result<Object> updateLocalTarget(JSONObject requestJson);
+}

+ 15 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAccountAutoVideoService.java

@@ -3,6 +3,8 @@ package cn.com.ctop.kuaishou.modules.ai.service;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoVideo;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * 自动投放账户——素材
  *
@@ -12,5 +14,18 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IAiKuaishouAccountAutoVideoService extends IService<AiKuaishouAccountAutoVideo> {
 
+    // 获取上新素材(自动投放账户级重构)
+    List<AiKuaishouAccountAutoVideo> getUpNewVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate);
+
+    //获取7天高质量 (自动投放账户级重构)
+    List<AiKuaishouAccountAutoVideo> getHistoryTopVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate);
+
+    //获取遗漏素材:7天内未被创建过的素材(自动投放账户级重构)
+    List<AiKuaishouAccountAutoVideo> getMissVideoByParams(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate);
+
+    //历史素材打捞(自动投放账户级重构)
+    List<AiKuaishouAccountAutoVideo> getHistoryCatchVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate);
+
     void insertAutoVideo(Long accountId);
+
 }

File diff suppressed because it is too large
+ 1866 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountAutoDoServiceImpl.java


+ 28 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountAutoStrategyServiceImpl.java

@@ -0,0 +1,28 @@
+package cn.com.ctop.kuaishou.modules.ai.service.impl;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoStrategy;
+import cn.com.ctop.kuaishou.modules.ai.mapper.AiKuaishouAccountAutoStrategyMapper;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountAutoStrategyService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageInfo;
+import net.sf.json.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 自动投放重构-账户策略表
+ *
+ * @author jeecg-boot
+ * 2021-10-12
+ * @version V1.0
+ */
+@Service
+public class AiKuaishouAccountAutoStrategyServiceImpl extends ServiceImpl<AiKuaishouAccountAutoStrategyMapper, AiKuaishouAccountAutoStrategy> implements IAiKuaishouAccountAutoStrategyService {
+
+    @Autowired AiKuaishouAccountAutoStrategyMapper accountAutoStrategyMapper;
+
+    @Override
+    public PageInfo<AiKuaishouAccountAutoStrategy> queryList(AiKuaishouAccountAutoStrategy aiKuaishouAccountAutoStrategy) {
+        return new PageInfo<>(accountAutoStrategyMapper.queryList(aiKuaishouAccountAutoStrategy));
+    }
+}

+ 78 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountAutoTargetServiceImpl.java

@@ -0,0 +1,78 @@
+package cn.com.ctop.kuaishou.modules.ai.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoTarget;
+import cn.com.ctop.kuaishou.modules.ai.mapper.AiKuaishouAccountAutoTargetMapper;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountAutoTargetService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 自动投放重构-本地定向表
+ *
+ * @author jeecg-boot
+ * 2021-10-12
+ * @version V1.0
+ */
+@Service
+public class AiKuaishouAccountAutoTargetServiceImpl extends ServiceImpl<AiKuaishouAccountAutoTargetMapper, AiKuaishouAccountAutoTarget> implements IAiKuaishouAccountAutoTargetService {
+
+    @Autowired
+    private AiKuaishouAccountAutoTargetMapper accountAutoTargetMapper;
+
+    @Override
+    public Result<Object> queryPageList(Long accountId, String targetName, Integer pageNo, Integer pageSize) {
+        PageHelper.startPage(pageNo, pageSize);
+        List<AiKuaishouAccountAutoTarget> list = accountAutoTargetMapper.queryPageList(accountId, targetName);
+        return Result.ok(new PageInfo<>(list));
+    }
+
+    @Override
+    public Result<Object> addLocalTarget(JSONObject requestJson) {
+        QueryWrapper<AiKuaishouAccountAutoTarget> wrapper = new QueryWrapper<>();
+        wrapper.eq("account_id", requestJson.getLong("accountId"));
+        wrapper.eq("target_name", requestJson.getString("targetName")).last("limit 1");
+        AiKuaishouAccountAutoTarget one = this.getOne(wrapper);
+        if (!Check.isNull(one)) {
+            return Result.error("该账户下定向包名已存在");
+        }
+        AiKuaishouAccountAutoTarget target = JSONObject.toJavaObject(requestJson, AiKuaishouAccountAutoTarget.class);
+        if (!Check.isNull(requestJson.getJSONArray("keyword"))) {
+            target.setKeyword(JSONObject.toJSONString(requestJson.getJSONArray("keyword")));
+        }
+        boolean save = this.save(target);
+        if (save) {
+            return Result.ok("创建成功");
+        }
+        return Result.error("创建失败,定向包新增失败");
+    }
+
+    @Override
+    public Result<Object> updateLocalTarget(JSONObject requestJson) {
+        QueryWrapper<AiKuaishouAccountAutoTarget> wrapper = new QueryWrapper<>();
+        wrapper.eq("account_id", requestJson.getLong("accountId"));
+        wrapper.eq("target_name", requestJson.getString("targetName")).last("limit 1");
+        AiKuaishouAccountAutoTarget one = this.getOne(wrapper);
+        if (!Check.isNull(one) && one.getId() - requestJson.getLong("id") != 0) {
+            return Result.ok("账户下定向包名重复");
+        }
+        AiKuaishouAccountAutoTarget target = JSONObject.toJavaObject(requestJson, AiKuaishouAccountAutoTarget.class);
+        if (!Check.isNull(requestJson.getJSONArray("keyword"))) {
+            target.setKeyword(JSONObject.toJSONString(requestJson.getJSONArray("keyword")));
+        }
+        boolean update = this.saveOrUpdate(target);
+        if (update) {
+            return Result.ok("修改成功");
+        }
+        return Result.ok("修改失败");
+    }
+
+}

+ 24 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountAutoVideoServiceImpl.java

@@ -10,6 +10,7 @@ import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoVideo;
 import cn.com.ctop.kuaishou.modules.ai.mapper.AiKuaishouAccountAutoVideoMapper;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountAutoVideoService;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -37,12 +38,33 @@ import java.util.Map;
 public class AiKuaishouAccountAutoVideoServiceImpl extends ServiceImpl<AiKuaishouAccountAutoVideoMapper, AiKuaishouAccountAutoVideo> implements IAiKuaishouAccountAutoVideoService {
 
     @Autowired
-    private AiKuaishouAccountAutoVideoMapper aiKuaishouAccountAutoVideoMapper;
+    private AiKuaishouAccountAutoVideoMapper autoVideoMapper;
 
     @Autowired
     private ICtopOauthTokenService tokenService;
 
     @Override
+    public List<AiKuaishouAccountAutoVideo> getUpNewVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate) {
+        return autoVideoMapper.getUpNewVideos(accountId, channelType, keyword, videoCnt, statDate);
+    }
+
+    @Override
+    public List<AiKuaishouAccountAutoVideo> getHistoryTopVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate) {
+        return autoVideoMapper.getHistoryTopVideos(accountId, channelType, keyword, videoCnt);
+    }
+
+    @Override
+    public List<AiKuaishouAccountAutoVideo> getMissVideoByParams(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate) {
+        return autoVideoMapper.getZeroVideoByParams(accountId, channelType, keyword, videoCnt);
+    }
+
+    @Override
+    public List<AiKuaishouAccountAutoVideo> getHistoryCatchVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate) {
+        return autoVideoMapper.getHistoryCatchVideos(accountId, channelType, keyword, videoCnt);
+    }
+
+
+    @Override
     public void insertAutoVideo(Long accountId) {
         CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
         this.getVideoListByPage(token, 1);
@@ -127,7 +149,7 @@ public class AiKuaishouAccountAutoVideoServiceImpl extends ServiceImpl<AiKuaisho
                 videoGetList.add(videoGet);
             }
             if (!Check.isNull(videoGetList)) {
-                aiKuaishouAccountAutoVideoMapper.insertBatch(videoGetList);
+                autoVideoMapper.insertBatch(videoGetList);
             }
             if (doGet) {
                 getVideoListByPage(token, page + 1);

+ 20 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/controller/KuaishouChannelController.java

@@ -272,6 +272,26 @@ public class KuaishouChannelController {
     }
 
     /**
+     * 通过账户查询渠道号接口
+     */
+    @PostMapping(value = "/queryChannelList")
+        public Result<Object> queryChannelList(Long accountId, String appName,
+                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        try {
+            if (Check.isNull(accountId)|| Check.isNull(appName)) {
+                return Result.error("缺失参数");
+            }
+            PageHelper.startPage(pageNo, pageSize);
+            return kuaishouChannelService.queryChannelList(accountId, appName);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("通过账户查询渠道号异常", e);
+            return Result.error("通过账户查询渠道号失败," + e.getMessage());
+        }
+    }
+
+    /**
      * 通过账户查询渠道号级别
      */
     @PostMapping(value = "/queryChannelLevel")

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/KuaishouChannelMapper.java

@@ -47,4 +47,6 @@ public interface KuaishouChannelMapper extends BaseMapper<KuaishouChannel> {
     List<JSONObject> queryItemsListByAccountId(@Param("accountId") Long accountId, @Param("appName") String appName);
 
     KuaishouChannel queryUsedChannel(@Param("accountId") Long accountId, @Param("campaignId") Long campaignId, @Param("level") String level);
+
+    List<JSONObject> queryChannelList(@Param("accountId") Long accountId, @Param("appName") String appName);
 }

+ 21 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelMapper.xml

@@ -267,6 +267,27 @@
         GROUP BY tt2.keyword
     </select>
 
+  <select id="queryChannelList" resultType="com.alibaba.fastjson.JSONObject">
+      SELECT
+          t1.id,
+          channel_code,
+          channel_name,
+          t1.url,
+          schema_uri,
+          click_track_url,
+          actionbar_click_url
+      FROM
+          ctop_kuaishou_channel t1
+              LEFT JOIN ctop_kuaishou_channel_app_info t2 ON t1.app_id = t2.app_id
+      WHERE
+          t1.state = 1
+        AND t1.account_id = #{accountId}
+        AND t2.app_name = #{appName}
+        AND usage_times &lt; cycle_times
+      ORDER BY
+      t1.create_time DESC
+  </select>
+
 
     <select id="queryUsedChannel" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel">
         SELECT t2.*

+ 8 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/IKuaishouChannelService.java

@@ -1,5 +1,7 @@
 package cn.com.ctop.kuaishou.modules.channel.service;
 
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoVideo;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
 import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -7,6 +9,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.api.vo.Result;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.List;
+
 /**
  * 渠道号信息表
  *
@@ -37,4 +41,8 @@ public interface IKuaishouChannelService extends IService<KuaishouChannel> {
     void callBackUpdateChannelRel(String level, String channelCode, Long accoountId, Long planId, Long groupId, Integer state);
 
     KuaishouChannel queryUsedChannel(Long accountId, Long newCampaignId, String level);
+
+    Result<Object> queryChannelList(Long accountId, String appName);
+
+    List<JSONObject> queryGroupChannel(Long accountId, String appName, List<AiKuaishouAccountAutoVideo> newVideos);
 }

+ 31 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelServiceImpl.java

@@ -10,9 +10,11 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.ExportExcelUtils;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoVideo;
 import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaiShouAppInfoService;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAppPackageService;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAppListService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
@@ -1076,7 +1078,7 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                         if ("plan".equals(level)) {
                             Integer usageTimes = channelRelService.queryUsePlanCount(accountId, channelCode);
                             one.setUsageTimes(usageTimes);
-                            if(usageTimes>one.getHaveCycleTimes()){
+                            if (usageTimes > one.getHaveCycleTimes()) {
                                 one.setHaveCycleTimes(usageTimes);
                             }
                             this.saveOrUpdate(one);
@@ -1107,6 +1109,34 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
         return channel;
     }
 
+    @Override
+    public Result<Object> queryChannelList(Long accountId, String appName) {
+        List<JSONObject> kuaishouChannels = channelMapper.queryChannelList(accountId, appName);
+        PageInfo pageInfo = new PageInfo(kuaishouChannels);
+        return Result.ok(pageInfo);
+    }
+
+    //TODO
+    @Override
+    public List<JSONObject> queryGroupChannel(Long accountId, String appName, List<AiKuaishouAccountAutoVideo> newVideos) {
+        //查询账户策略
+        List<KuaishouChannelCreateStrategy> strategys = channelCreateStrategyService.queryChannelStrategyByAccountId(accountId);
+        if (Check.isNull(strategys) || strategys.isEmpty()) {
+            //查询账户所在项目策略
+            strategys = channelCreateStrategyService.queryChannelStrategyByProjectId(accountId);
+            if (Check.isNull(strategys) || strategys.isEmpty()) {
+                log.error("****** 渠道号获取失败,该账户没有创建过渠道号");
+                return null;
+            }
+        }
+        //所有策略下的 使用范围,使用层级,是否循环等字段 保持一致
+        KuaishouChannelCreateStrategy createStrategy = strategys.get(0);
+        Integer usageRange = createStrategy.getUsageRange();
+        String usageLevel = createStrategy.getUsageLevel();
+//        doGroupLevel(accountId, strategys, appName, 0, photoName);
+        return null;
+    }
+
     private Result<Object> doAccountRangeAccountLevel(Long accountId, List<KuaishouChannelCreateStrategy> strategys, String appName) throws Exception {
         List<KuaishouChannel> channelList = channelMapper.queryByAccountIdLevel(accountId, "account");
         if (!Check.isNull(channelList)) {
@@ -1212,7 +1242,6 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
             return Result.error("渠道号已无效");
         }
         for (Integer haveCycleTimes : haveCycleTimesList) {
-            //获取20个可用渠道号,筛查出一个返回给前端
             List<KuaishouChannel> list = channelMapper.queryChannelByHaveCycleTimes(haveCycleTimes, "group", strategys);
             if (Check.isNull(list)) {
                 continue;

+ 21 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/document/controller/DocumentLibraryController.java

@@ -1,11 +1,13 @@
 package cn.com.ctop.kuaishou.modules.document.controller;
 
+import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.kuaishou.modules.document.service.DocumentLibraryService;
 import org.jeecg.common.api.vo.Result;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
@@ -96,4 +98,23 @@ public class DocumentLibraryController {
 
     }
 
+
+    /**
+     * Excel导入广告语,回显广告语列表(excel)
+     */
+    @PostMapping(value = "/importAdLanguage")
+    @ResponseBody
+    public Result<Object> importAdLanguage(HttpServletResponse response, @RequestParam("file") MultipartFile file) {
+        response.setHeader("Access-Control-Allow-Origin", "*");
+        try {
+            if (Check.isNull(file)) {
+                return Result.error("执行失败,请上传应用Excel文件");
+            }
+            return documentLibraryService.importAdLanguage(file);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("Excel导入广告语异常," + e.getMessage());
+        }
+    }
+
 }

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/document/mapper/DocumentLibraryMapper.java

@@ -24,4 +24,6 @@ public interface DocumentLibraryMapper {
     List<String> getDataByAccountId(@Param("accountId") String accountId, @Param("copyWriterId") String copyWriterId);
 
     List<Map<String,String>> getDocumentByAccountId(@Param("accountId") String accountId, @Param("copyWriterId") String copyWriterId);
+
+    void insertBatch(@Param("list") List<DocumentLibraryInfo> list);
 }

+ 11 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/document/mapper/xml/DocumentLibraryMapper.xml

@@ -8,6 +8,17 @@
         (#{copyWriterId},#{copyWriter},#{accountId},#{status},#{createTime})
     </insert>
 
+    <insert id="insertBatch" parameterType="cn.com.ctop.kuaishou.modules.document.entity.DocumentLibraryInfo">
+        insert into ctop_document_library
+        (copy_writer_id,copy_writer,account_id,status,create_time)
+        values
+        <foreach collection="list" item="video" separator=",">
+            (
+            #{video.copyWriterId},#{video.copyWriter},#{video.accountId},#{video.status},#{video.createTime}
+            )
+        </foreach>
+    </insert>
+
 
     <select id="getDocumentLibraryList" resultType="com.alibaba.fastjson.JSONObject">
         SELECT t.copy_writer_id as 'copyWriterId',t.copy_writer,t.status,COUNT(t1.creative_id) as 'relatedSize',COUNT(if(t2.status= 42 ,TRUE,NULL)) as 'refusedSize'  from

+ 4 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/document/service/DocumentLibraryService.java

@@ -25,4 +25,8 @@ public interface DocumentLibraryService {
     Result getRefusedList(String copyWriterId, int pageNumber, int pageSize);
 
     Result getAcoountId(String copyWriterId);
+
+    Result<Object> importAdLanguage(MultipartFile file) throws Exception;
+
+    void insertBatch(String description,Long accountId);
 }

+ 62 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/document/service/impl/DocumentLibraryServiceImpl.java

@@ -1,13 +1,21 @@
 package cn.com.ctop.kuaishou.modules.document.service.impl;
 
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
 import cn.com.ctop.kuaishou.modules.document.entity.DocumentLibraryInfo;
 import cn.com.ctop.kuaishou.modules.document.mapper.DocumentLibraryMapper;
 import cn.com.ctop.kuaishou.modules.document.service.DocumentLibraryService;
 import cn.com.ctop.kuaishou.modules.utils.ExcelUtil;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
@@ -205,4 +213,58 @@ public class DocumentLibraryServiceImpl implements DocumentLibraryService {
         }
         return result;
     }
+
+    @Override
+    public Result<Object> importAdLanguage(MultipartFile file) throws Exception {
+        JSONObject returnJson = new JSONObject();
+        Workbook workbook = null;
+        String fileName = file.getOriginalFilename();
+        String substring = fileName.substring(fileName.lastIndexOf(".") + 1).toUpperCase();
+        if ("XLS".equals(substring)) {
+            workbook = new HSSFWorkbook(file.getInputStream());
+        } else if ("XLSX".equals(substring)) {
+            workbook = new XSSFWorkbook(file.getInputStream());
+        } else {
+            throw new Exception("文件不是Excel文件");
+        }
+        Sheet sheet = workbook.getSheet("Sheet1");
+        if (Check.isNull(sheet)) {
+            throw new Exception("Sheet标题不是默认的Sheet1");
+        }
+        int rows = sheet.getLastRowNum();// 指的行数,一共有多少行+
+        if (rows == 0) {
+            throw new Exception("请填写数据");
+        }
+        ExportExcelUtils eeu = new ExportExcelUtils();
+        JSONArray array = new JSONArray();
+        for (int i = 1; i <= rows + 1; i++) {
+            Row row = sheet.getRow(i);
+            if (row != null) {
+                String value = eeu.getCellValue(row.getCell(0));
+                if (Check.isNull(value)) {
+                    return Result.error("解析数据失败,文档中项目列缺失数据");
+                }
+                array.add(value);
+            }
+        }
+        return Result.ok(array);
+    }
+
+    @Override
+    public void insertBatch(String description,Long accountId) {
+        JSONArray array = JSONArray.parseArray(description);
+        List<DocumentLibraryInfo> list = new ArrayList<>();
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        for (int i = 0; i < array.size(); i++) {
+            DocumentLibraryInfo documentLibraryInfo = new DocumentLibraryInfo();
+            documentLibraryInfo.setCopyWriter(array.getString(i).trim());
+            documentLibraryInfo.setCopyWriterId(UUID.randomUUID().toString());
+            documentLibraryInfo.setCreateTime(formatter.format(new Date()));
+            documentLibraryInfo.setStatus(0);
+            documentLibraryInfo.setAccountId(accountId.toString());
+            list.add(documentLibraryInfo);
+        }
+
+        documentLibraryMapper.insertBatch(list);
+    }
 }

+ 6 - 1
jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-dev.yml

@@ -116,7 +116,12 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+#---------------------线上库
+#          url: jdbc:mysql://139.186.27.96:3390/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=GMT%2B8
+#          username: data
+#          password: hcst@2021
+#---------------------测试库
+          url: jdbc:mysql://139.186.165.84:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&allowMultiQueries=true
           username: hcst
           password: hcst@2020
           driver-class-name: com.mysql.jdbc.Driver