소스 검색

Merge branch 'test'

# Conflicts:
#	jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaishouUnitLevelOperationRecordMapper.java
yangzian 3 년 전
부모
커밋
ed11607e9a
58개의 변경된 파일5922개의 추가작업 그리고 511개의 파일을 삭제
  1. 9 5
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CreateSheetServiceImpl.java
  2. 7 2
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/ReportSettlementServiceImpl.java
  3. 70 0
      jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/utils/SettlementUtil.java
  4. 1 1
      jeecg-boot-finance/src/main/resources/application-test.yml
  5. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java
  6. 89 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouAccountAutoDoController.java
  7. 356 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouAccountAutoStrategyController.java
  8. 280 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouAccountAutoTargetController.java
  9. 265 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaishouAccountAutoVideoController.java
  10. 384 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAccountAutoStrategy.java
  11. 255 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAccountAutoTarget.java
  12. 139 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAccountAutoVideo.java
  13. 15 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouCampaignLevelOperationRecord.java
  14. 18 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouCreativeLevelOperationRecord.java
  15. 32 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouUnitLevelOperationRecord.java
  16. 69 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/enums/KuaishouAutoTypeEnum.java
  17. 20 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaishouAccountAutoStrategyMapper.java
  18. 21 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaishouAccountAutoTargetMapper.java
  19. 33 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaishouAccountAutoVideoMapper.java
  20. 31 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaishouAccountAutoStrategyMapper.xml
  21. 25 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaishouAccountAutoTargetMapper.xml
  22. 175 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaishouAccountAutoVideoMapper.xml
  23. 18 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAccountAutoDoService.java
  24. 16 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAccountAutoStrategyService.java
  25. 26 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAccountAutoTargetService.java
  26. 33 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAccountAutoVideoService.java
  27. 2338 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountAutoDoServiceImpl.java
  28. 28 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountAutoStrategyServiceImpl.java
  29. 83 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountAutoTargetServiceImpl.java
  30. 174 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountAutoVideoServiceImpl.java
  31. 2 16
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java
  32. 2 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouProjectCreateCreativeServiceImpl.java
  33. 1 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouGroupController.java
  34. 1 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupMapper.java
  35. 2 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupMapper.xml
  36. 1 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouGroupService.java
  37. 2 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupServiceImpl.java
  38. 6 5
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  39. 91 28
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/controller/KuaishouChannelController.java
  40. 16 13
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/entity/KuaishouChannel.java
  41. 11 8
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/entity/KuaishouChannelCreateStrategy.java
  42. 97 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/entity/KuaishouChannelUpdateRecord.java
  43. 6 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/KuaishouChannelMapper.java
  44. 15 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/KuaishouChannelUpdateRecordMapper.java
  45. 70 67
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelMapper.xml
  46. 1 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelRelMapper.xml
  47. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelUpdateRecordMapper.xml
  48. 5 3
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/IKuaishouChannelService.java
  49. 15 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/IKuaishouChannelUpdateRecordService.java
  50. 432 349
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelServiceImpl.java
  51. 19 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelUpdateRecordServiceImpl.java
  52. 21 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/document/controller/DocumentLibraryController.java
  53. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/document/mapper/DocumentLibraryMapper.java
  54. 11 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/document/mapper/xml/DocumentLibraryMapper.xml
  55. 4 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/document/service/DocumentLibraryService.java
  56. 62 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/document/service/impl/DocumentLibraryServiceImpl.java
  57. 1 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouAudienceReportDailyService.java
  58. 6 1
      jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-dev.yml

+ 9 - 5
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CreateSheetServiceImpl.java

@@ -117,6 +117,8 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
         cell.setCellStyle(style);
         sheet.autoSizeColumn(0, true);
         List<SheetBytedanceVo> resultList = new ArrayList<>(accountIdList.size());
+        //获取当前年月的 第一天 和 最后一天
+        Map<String,String> timeMap = SettlementUtil.getFirstAndLastDayOfMonth(uploadYears);
         //查看账户数据
         List<Map<String,Object>> list = reportSettlementMapper.getAccountTransactionDayBytedanceSheet(accountIdList,uploadYears);
         for (Map<String,Object> map : list) {
@@ -130,7 +132,7 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
             List<String> policyDaysList = new ArrayList<>();
             if (!Check.isNull(map.get("productName"))){
                 //查询 头条利润表  返点类型和比列
-                List<Map<String,Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("advertiserName")+"",map.get("productName")+"",null,"1",uploadYears+"-01",uploadYears+"-31");
+                List<Map<String,Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("advertiserName")+"",map.get("productName")+"",null,"1",timeMap.get("startTime"),timeMap.get("endTime"));
                 List listPolicyTIme = new ArrayList();
                 for (Map<String, Object> rate : rateMap) {
                     listPolicyTIme.add(rate.get("policyStartDate"));
@@ -187,7 +189,7 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
 
             //不使用政策 的时间段
             // 获取两个日期之间 所有的 时间 年-月-日
-            List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(uploadYears+"-01",uploadYears+"-31");
+            List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(timeMap.get("startTime"),timeMap.get("endTime"));
             // 时间差集(所有时间段 - 使用政策的时间段)
             List<String>  reduceList = betweenDaysList.stream().filter(item -> !policyDaysList.contains(item)).collect(Collectors.toList());
             //差集拼接  开始 和 结束时间
@@ -332,7 +334,9 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
 
         List<SheetKuaiShouVo> resultList = new ArrayList<>(accountIdList.size());
         //查询该时段 快手 数据
-        List<Map<String,Object>> accountList = reportSettlementMapper.getProfitKuaiShouAccountCostSheet(accountIdList,uploadYears+"-01",uploadYears+"-31");
+        //获取当前年月的 第一天 和 最后一天
+        Map<String,String> timeMap = SettlementUtil.getFirstAndLastDayOfMonth(uploadYears);
+        List<Map<String,Object>> accountList = reportSettlementMapper.getProfitKuaiShouAccountCostSheet(accountIdList,timeMap.get("startTime"),timeMap.get("endTime"));
         for (Map<String,Object> map : accountList) {
             SheetKuaiShouVo voSource = new SheetKuaiShouVo();
             voSource.setAccountId(map.get("accountId")+"");
@@ -343,7 +347,7 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
             List<String> policyDaysList = new ArrayList<>();
             if (!Check.isNull(map.get("productName"))) {
                 //查询 快手利润表  返点类型和比列
-                List<Map<String, Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("advertiserName")+"",map.get("productName") + "", null,"2", uploadYears+"-01",uploadYears+"-31");
+                List<Map<String, Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("advertiserName")+"",map.get("productName") + "", null,"2", timeMap.get("startTime"),timeMap.get("endTime"));
                 List listPolicyTIme = new ArrayList();
                 for (Map<String, Object> rate : rateMap) {
                     listPolicyTIme.add(rate.get("policyStartDate"));
@@ -406,7 +410,7 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
 
             //不使用政策 的时间段
             // 获取两个日期之间 所有的 时间 年-月-日
-            List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(uploadYears+"-01",uploadYears+"-31");
+            List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(timeMap.get("startTime"),timeMap.get("endTime"));
             // 时间差集(所有时间段 - 使用政策的时间段)
             List<String> reduceList = betweenDaysList.stream().filter(item -> !policyDaysList.contains(item)).collect(Collectors.toList());
             //差集拼接  开始 和 结束时间

+ 7 - 2
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/ReportSettlementServiceImpl.java

@@ -252,8 +252,10 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                         BufferedImage bufferImg = createExcelByTemplate.toBufferedImage(imageTookittitle);
                         ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".") + 1), byteArrayOut);
                         int startIndex = settlementList.size() +6;
+                        int hight = (int)Math.round(bufferImg.getHeight() / 28.35 / (sheet.getDefaultRowHeightInPoints() / 28.35));
+                        int width = (int)Math.round(bufferImg.getWidth() / (96/2.54) / ((sheet.getColumnWidthInPixels(settlementList.size()) / (96 / 2.54))));
                         //anchor主要用于设置图片的属性
-                        HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255, (short) 0, startIndex+(5*j)+50*j, (short) 25, startIndex+(5*j)+50*(j+1));
+                        HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255, (short) 0, startIndex+(5*j)+hight*j, (short) width, startIndex+(5*j)+hight*(j+1));
                         //HSSFClientAnchor anchor2 = new HSSFClientAnchor(0, 0, 255, 255, (short) 5, settlementList.size() + 40, (short) 10, 40 * 2);
                         anchor.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE);
                         //插入图片
@@ -491,7 +493,10 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                         ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".") + 1), byteArrayOut);
                         //anchor主要用于设置图片的属性
                         int startIndex = settlementList.size()+7;
-                        HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255, (short) 0, startIndex+(5*j)+50*j, (short) 25, startIndex+(5*j)+50*(j+1));
+                        int hight = (int)Math.round(bufferImg.getHeight() / 28.35 / (sheet.getDefaultRowHeightInPoints() / 28.35));
+                        int width = (int)Math.round(bufferImg.getWidth() / (96/2.54) / ((sheet.getColumnWidthInPixels(settlementList.size()) / (96 / 2.54))));
+                        HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255, (short) 0, startIndex+(5*j)+hight*j, (short) width, startIndex+(5*j)+hight*(j+1));
+
                         //HSSFClientAnchor anchor2 = new HSSFClientAnchor(0, 0, 255, 255, (short) 5, settlementList.size() + 40, (short) 10, 40 * 2);
                         anchor.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE);
                         //插入图片

+ 70 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/utils/SettlementUtil.java

@@ -294,4 +294,74 @@ public class SettlementUtil {
         return dayAfter;
     }
 
+
+    /**
+     * 获取当前日期 年-月 的 第一天和最后一天
+     */
+    public static Map<String,String> getFirstAndLastDayOfMonth(String yearMonth){
+        Map<String,String> map = new HashMap<>();
+        String[] year = yearMonth.split("-");
+        Integer y = Integer.valueOf(year[0]);
+        Integer m = Integer.valueOf(year[1]);
+        String firstDay = getFirstDayOfMonth(y,m);
+        String lastDay = getLastDayOfMonth(y,m);
+        map.put("startTime",firstDay);
+        map.put("endTime",lastDay);
+        return map;
+    }
+
+
+
+
+
+    /**
+     * 获取指定年月的第一天
+     * @param year
+     * @param month
+     * @return
+     */
+    public static String getFirstDayOfMonth(int year, int month) {
+        Calendar cal = Calendar.getInstance();
+        //设置年份
+        cal.set(Calendar.YEAR, year);
+        //设置月份
+        cal.set(Calendar.MONTH, month-1);
+        //获取某月最小天数
+        int firstDay = cal.getMinimum(Calendar.DATE);
+        //设置日历中月份的最小天数
+        cal.set(Calendar.DAY_OF_MONTH,firstDay);
+        //格式化日期
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        return sdf.format(cal.getTime());
+    }
+
+
+    /**
+     * 获取指定年月的最后一天
+     * @param year
+     * @param month
+     * @return
+     */
+    public static String getLastDayOfMonth(int year, int month) {
+        Calendar cal = Calendar.getInstance();
+        //设置年份
+        cal.set(Calendar.YEAR, year);
+        //设置月份
+        cal.set(Calendar.MONTH, month-1);
+        //获取某月最大天数
+        int lastDay = cal.getActualMaximum(Calendar.DATE);
+        //设置日历中月份的最大天数
+        cal.set(Calendar.DAY_OF_MONTH, lastDay);
+        //格式化日期
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        return sdf.format(cal.getTime());
+    }
+
+
+    public static void main(String[] args) {
+        System.out.println(getFirstAndLastDayOfMonth("2021-02").get("startTime"));;
+        System.out.println(getFirstAndLastDayOfMonth("2021-02").get("endTime"));;
+    }
+
+
 }

+ 1 - 1
jeecg-boot-finance/src/main/resources/application-test.yml

@@ -15,7 +15,7 @@ spring:
   cloud:
     nacos:
       discovery:
-        server-addr: 139.186.134.115:8848
+        server-addr: 192.168.0.195:8848
         service: jeecg-cloud-finance
   servlet:
     multipart:

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java

@@ -55,6 +55,11 @@ public class KuaishouInterfaceConstant {
      * 创建广告创意
      */
     public static final String AD_CREATIVE_CREATE = "/rest/openapi/v2/creative/create";
+
+    /**
+     * 批量创建&修改创意
+     */
+    public static final String AD_CREATIVE_BATCH_CREATE = "/rest/openapi/v2/creative/batch/update";
     /**
      * 程序化创意 2.0
      */

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

@@ -0,0 +1,89 @@
+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 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.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 customService = Executors.newFixedThreadPool(8);
+    static ExecutorService programService = Executors.newFixedThreadPool(8);
+
+    /**
+     * 创建自定义广告创意
+     */
+    @GetMapping(value = "/createCustomCreative")
+    public JSONObject createCustomCreative(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("今日广告组创建已超限");
+            }
+            customService.submit(() -> autoDoService.createCustomCreative(strategy));
+            returnJson.put("code", 0);
+            returnJson.put("message", "异步创建中");
+        } catch (Exception e) {
+            returnJson.put("code", -1);
+            returnJson.put("message", e.getMessage());
+        }
+        return returnJson;
+
+    }
+
+    /**
+     * 创建程序化广告创意
+     */
+    @GetMapping(value = "/createProgramCreative")
+    public JSONObject createProgramCreative(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("今日组创建已超限");
+            }
+            programService.submit(() -> autoDoService.createProgramCreative(strategy));
+            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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,280 @@
+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.JSONArray;
+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("查询异常");
+        }
+    }
+
+
+    @PostMapping(value = "/getAutoTargetByIds")
+    public Result<Object> getAutoTargetByIds(@RequestBody JSONObject data) {
+        try {
+            JSONArray ids = data.getJSONArray("ids");
+            if (Check.isNull(ids)) {
+                return Result.error("缺少参数");
+            }
+            List<String> list = JSONObject.parseObject(JSONObject.toJSONString(ids), List.class);
+            if (Check.isNull(list)) {
+                return Result.error("缺少参数");
+            }
+            List<AiKuaishouAccountAutoTarget> targets = aiKuaishouAccountAutoTargetService.getAutoTargetByIds(list);
+            return Result.ok(targets);
+        } catch (Exception e) {
+            log.error("查询异常,", e);
+            return Result.error("查询失败," + e.getMessage());
+        }
+    }
+
+    /**
+     * 导出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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,265 @@
+package cn.com.ctop.kuaishou.modules.ai.controller;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoVideo;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountAutoVideoService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 自动投放账户——素材
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-10-20
+ */
+@Slf4j
+@Api(tags = "自动投放账户——素材")
+@RestController
+@RequestMapping("/auto/aiKuaishouAccountAutoVideo")
+public class AiKuaishouAccountAutoVideoController {
+    @Autowired
+    private IAiKuaishouAccountAutoVideoService aiKuaishouAccountAutoVideoService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param aiKuaishouAccountAutoVideo
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "自动投放账户——素材-分页列表查询", notes = "自动投放账户——素材-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<AiKuaishouAccountAutoVideo>> queryPageList(AiKuaishouAccountAutoVideo aiKuaishouAccountAutoVideo,
+                                                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                   HttpServletRequest req) {
+        Result<IPage<AiKuaishouAccountAutoVideo>> result = new Result<>();
+        QueryWrapper<AiKuaishouAccountAutoVideo> queryWrapper = QueryGenerator.initQueryWrapper(aiKuaishouAccountAutoVideo, req.getParameterMap());
+        Page<AiKuaishouAccountAutoVideo> page = new Page<AiKuaishouAccountAutoVideo>(pageNo, pageSize);
+        IPage<AiKuaishouAccountAutoVideo> pageList = aiKuaishouAccountAutoVideoService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 自动投放重构清洗账户素材
+     */
+    @GetMapping(value = "/insertAutoVideo")
+    public Result<AiKuaishouAccountAutoVideo> insertAutoVideo(Long accountId) {
+        Result<AiKuaishouAccountAutoVideo> result = new Result<>();
+        try {
+            aiKuaishouAccountAutoVideoService.insertAutoVideo(accountId);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param aiKuaishouAccountAutoVideo
+     * @return
+     */
+    @ApiOperation(value = "自动投放账户——素材-添加", notes = "自动投放账户——素材-添加")
+    @PostMapping(value = "/add")
+    public Result<AiKuaishouAccountAutoVideo> add(@RequestBody AiKuaishouAccountAutoVideo aiKuaishouAccountAutoVideo) {
+        Result<AiKuaishouAccountAutoVideo> result = new Result<>();
+        try {
+            aiKuaishouAccountAutoVideoService.save(aiKuaishouAccountAutoVideo);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param aiKuaishouAccountAutoVideo
+     * @return
+     */
+    @ApiOperation(value = "自动投放账户——素材-编辑", notes = "自动投放账户——素材-编辑")
+    @PutMapping(value = "/edit")
+    public Result<AiKuaishouAccountAutoVideo> edit(@RequestBody AiKuaishouAccountAutoVideo aiKuaishouAccountAutoVideo) {
+        Result<AiKuaishouAccountAutoVideo> result = new Result<AiKuaishouAccountAutoVideo>();
+        AiKuaishouAccountAutoVideo aiKuaishouAccountAutoVideoEntity = aiKuaishouAccountAutoVideoService.getById(aiKuaishouAccountAutoVideo.getId());
+        if (aiKuaishouAccountAutoVideoEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = aiKuaishouAccountAutoVideoService.updateById(aiKuaishouAccountAutoVideo);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "自动投放账户——素材-通过id删除", notes = "自动投放账户——素材-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            aiKuaishouAccountAutoVideoService.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<AiKuaishouAccountAutoVideo> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<AiKuaishouAccountAutoVideo> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.aiKuaishouAccountAutoVideoService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "自动投放账户——素材-通过id查询", notes = "自动投放账户——素材-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<AiKuaishouAccountAutoVideo> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<AiKuaishouAccountAutoVideo> result = new Result<>();
+        AiKuaishouAccountAutoVideo aiKuaishouAccountAutoVideo = aiKuaishouAccountAutoVideoService.getById(id);
+        if (aiKuaishouAccountAutoVideo == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(aiKuaishouAccountAutoVideo);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<AiKuaishouAccountAutoVideo> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                AiKuaishouAccountAutoVideo aiKuaishouAccountAutoVideo = JSON.parseObject(deString, AiKuaishouAccountAutoVideo.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(aiKuaishouAccountAutoVideo, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<AiKuaishouAccountAutoVideo> pageList = aiKuaishouAccountAutoVideoService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "自动投放账户——素材列表");
+        mv.addObject(NormalExcelConstants.CLASS, AiKuaishouAccountAutoVideo.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<AiKuaishouAccountAutoVideo> listAiKuaishouAccountAutoVideos = ExcelImportUtil.importExcel(file.getInputStream(), AiKuaishouAccountAutoVideo.class, params);
+                aiKuaishouAccountAutoVideoService.saveBatch(listAiKuaishouAccountAutoVideos);
+                return Result.ok("文件导入成功!数据行数:" + listAiKuaishouAccountAutoVideos.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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,384 @@
+package cn.com.ctop.kuaishou.modules.ai.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import 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.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 自动投放重构-账户策略表
+ *
+ * @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 String 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 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;
+    /**程序化创意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;
+    /**单/多应用,1单应用,2多应用*/
+    @Excel(name = "单/多应用,1单应用,2多应用", width = 15)
+    @ApiModelProperty(value = "单/多应用,1单应用,2多应用")
+    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;
+    /**操作人*/
+    @Excel(name = "操作人", width = 15)
+    @ApiModelProperty(value = "操作人")
+    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;
+    /**分日预算*/
+    @Excel(name = "分日预算", width = 15)
+    @ApiModelProperty(value = "分日预算")
+    private String campaignDayBudgetSchedule;
+    /**自定义组数量*/
+    @Excel(name = "自定义组数量", width = 15)
+    @ApiModelProperty(value = "自定义组数量")
+    private Integer customUnitCnt;
+    /**程序化数量*/
+    @Excel(name = "程序化数量", width = 15)
+    @ApiModelProperty(value = "程序化数量")
+    private Integer programUnitCnt;
+    /**素材名称关键字*/
+    @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;
+    /**1 定向匹配。2素材匹配*/
+    @Excel(name = "1 定向匹配。2素材匹配", width = 15)
+    @ApiModelProperty(value = "1 定向匹配。2素材匹配")
+    private Integer matchType;
+    /**本地定向集*/
+    @Excel(name = "本地定向集", width = 15)
+    @ApiModelProperty(value = "本地定向集")
+    private String autoTargetArray;
+    /**素材来源 1-上新素材,2-高质量素材,3-遗漏素材,4-历史打捞*/
+    @Excel(name = "素材来源 1-上新素材,2-高质量素材,3-遗漏素材,4-历史打捞", width = 15)
+    @ApiModelProperty(value = "素材来源 1-上新素材,2-高质量素材,3-遗漏素材,4-历史打捞")
+    private String sourceMaterial;
+    /**创建时间*/
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**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;
+}

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 139 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAccountAutoVideo.java


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

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

@@ -1,9 +1,11 @@
 package cn.com.ctop.kuaishou.modules.ai.entity;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
+import org.springframework.beans.BeanUtils;
 
 import java.util.Date;
 
@@ -155,4 +157,20 @@ public class AiKuaishouCreativeLevelOperationRecord {
      * 1:账户自动投放 2:项目自动投放
      */
     private Integer createType;
+
+    public AiKuaishouCreativeLevelOperationRecord() {
+
+    }
+
+    public AiKuaishouCreativeLevelOperationRecord(AiKuaishouAccountAutoStrategy strategy, Integer creativeCode, JSONObject creativeParams, String creativeMessage, Long unitId, String uuid) {
+        BeanUtils.copyProperties(strategy, this);
+        this.status = creativeCode;
+        this.description = creativeParams.getString("description");
+        this.photoId = creativeParams.getString("photo_id");
+        this.message = creativeMessage;
+        this.unitId = unitId;
+        this.aiStrategyUuid = uuid;
+        this.createTime = new Date();
+        this.createType = 3;
+    }
 }

+ 32 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouUnitLevelOperationRecord.java

@@ -1,9 +1,11 @@
 package cn.com.ctop.kuaishou.modules.ai.entity;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
+import org.springframework.beans.BeanUtils;
 
 import java.util.Date;
 
@@ -193,7 +195,7 @@ public class AiKuaishouUnitLevelOperationRecord {
     private Integer gender;
     /**
      * 创建类型
-     * 1:账户自动投放 2:项目自动投放
+     * 1:账户自动投放 2:项目自动投放 3 账户重构
      */
     private Integer createType;
     /**
@@ -313,9 +315,38 @@ public class AiKuaishouUnitLevelOperationRecord {
      */
     private Integer assetMining;
     /**
+     * 本地定向ID
+     */
+    private Long autoTargetId;
+
+    /**
+     * 渠道号Id
+     */
+    private Long channelId;
+
+    /**
      * 深度转化目标出价
      */
     private Integer deepConversionBid;
     private Long targetCombineId;
 
+    public AiKuaishouUnitLevelOperationRecord() {
+
+    }
+
+    public AiKuaishouUnitLevelOperationRecord(AiKuaishouAccountAutoStrategy strategy, JSONObject unitParams, Integer unitCode, String unitMessage, String strategyUuid, Long autoTargetId, Long channelId) {
+        BeanUtils.copyProperties(strategy, this);
+        this.groupName = unitParams.getString("unit_name");
+        this.campaignId = unitParams.getLong("campaign_id");
+        this.cpaBid = unitParams.getInteger("cpa_bid");
+        this.bid = unitParams.getInteger("bid");
+        this.deepConversionBid = unitParams.getInteger("deep_conversion_bid");
+        this.createTime = new Date();
+        this.status = unitCode;
+        this.message = unitMessage;
+        this.aiStrategyUuid = strategyUuid;
+        this.createType = 3;
+        this.channelId = channelId;
+        this.autoTargetId = autoTargetId;
+    }
 }

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

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

@@ -0,0 +1,21 @@
+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);
+
+    List<AiKuaishouAccountAutoTarget> getAutoTargetByIds(@Param("ids") List<String> list);
+}

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

@@ -0,0 +1,33 @@
+package cn.com.ctop.kuaishou.modules.ai.mapper;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoVideo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 自动投放账户——素材
+ *
+ * @author jeecg-boot
+ * 2021-10-20
+ * @version V1.0
+ */
+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, @Param("createType") String createType);
+
+    List<AiKuaishouAccountAutoVideo> getHistoryTopVideos(@Param("accountId") Long accountId, @Param("channelType") Integer channelType, @Param("keyword") String keyword, @Param("videoCnt") Integer videoCnt, @Param("createType") String createType);
+
+    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);
+
+    Integer getAutoVideoUsed(@Param("accountId") Long accountId, @Param("signature") String signature, @Param("videoType") Integer videoType, @Param("createType") String createType);
+
+    void addAutoVideoUsed(@Param("accountId") Long accountId, @Param("signature") String signature, @Param("videoType") Integer videoType, @Param("createType") String createType, @Param("usageTimes") Integer usageTimes, @Param("date") String date);
+
+    void updateAutoVideoUsed(@Param("accountId") Long accountId, @Param("signature") String signature, @Param("videoType") Integer videoType, @Param("createType") String createType, @Param("usageTimes") Integer usageTimes, @Param("date") String date);
+}

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

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

@@ -0,0 +1,25 @@
+<?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>
+
+    <select id="getAutoTargetByIds" resultType="cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoTarget">
+        SELECT *
+        FROM ctop_ai_kuaishou_account_auto_target
+        WHERE id in
+        <foreach collection="ids" item="ids" separator="," open="(" close=")">
+            #{ids}
+        </foreach>
+    </select>
+
+</mapper>

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

@@ -0,0 +1,175 @@
+<?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.AiKuaishouAccountAutoVideoMapper">
+
+    <insert id="insertBatch">
+        replace into ctop_ai_kuaishou_account_auto_video(
+        account_id,
+        photo_id,
+        status,
+        material_type,
+        stat_date,
+        channel_type,
+        signature,
+        photo_name
+        )
+        values
+        <foreach collection="videoGetList" item="video" separator=",">
+            (
+            #{video.accountId},
+            #{video.photoId},
+            #{video.status},
+            #{video.materialType},
+            #{video.statDate},
+            #{video.channelType},
+            #{video.signature},
+            #{video.photoName}
+            )
+        </foreach>
+    </insert>
+
+
+    <select id="getUpNewVideos" resultType="cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoVideo">
+        SELECT * FROM ctop_ai_kuaishou_account_auto_video
+        WHERE account_id = #{accountId}
+        <if test="createType ==custom">
+            AND custom_status = 1
+        </if>
+        <if test="createType ==program">
+            AND program_status = 1
+        </if>
+        <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 custom_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 video_type = 2
+        AND usage_times &lt;= 5
+        <if test="createType !=null">
+            AND create_type = #{createType}
+        </if>
+        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 video_type = 4
+        AND create_type = 'custom'
+        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>
+
+
+    <select id="getAutoVideoUsed" resultType="java.lang.Integer">
+        SELECT usage_times
+        FROM ctop_ai_kuaishou_account_auto_video_used
+        WHERE signature = #{signature}
+          AND account_id = #{accountId}
+          AND video_type = #{videoType}
+          AND create_type = #{createType} limit 1
+    </select>
+
+
+    <insert id="addAutoVideoUsed">
+        replace
+        into ctop_ai_kuaishou_account_auto_video_used
+        (
+        account_id,
+        signature,
+        video_type,
+        create_type,
+        stat_date,
+        usage_times)
+        values
+        (
+        #{accountId},
+        #{signature},
+        #{videoType},
+        #{createType},
+        #{date},
+        #{usageTimes}
+        )
+    </insert>
+
+    <update id="updateAutoVideoUsed">
+        UPDATE ctop_ai_kuaishou_account_auto_video_used
+        SET usage_times = #{usageTimes},
+            stat_date   = #{date}
+        WHERE signature = #{signature}
+          AND account_id = #{accountId}
+          AND video_type = #{videoType}
+          AND create_type = #{createType}
+    </update>
+</mapper>

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

@@ -0,0 +1,18 @@
+package cn.com.ctop.kuaishou.modules.ai.service;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAccountAutoStrategy;
+
+import java.text.ParseException;
+
+public interface IAiKuaishouAccountAutoDoService {
+
+    //创建自定义广告创意
+    void createCustomCreative(AiKuaishouAccountAutoStrategy strategy);
+
+    //创建程序化广告创意
+    void createProgramCreative(AiKuaishouAccountAutoStrategy strategy);
+
+    // 组创建是否超限
+    Boolean getUnitOverrun(Long accountId);
+
+}

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

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

@@ -0,0 +1,26 @@
+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;
+
+import java.util.List;
+
+/**
+ * 自动投放重构-本地定向表
+ *
+ * @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);
+
+    List<AiKuaishouAccountAutoTarget> getAutoTargetByIds(List<String> list);
+}

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

@@ -0,0 +1,33 @@
+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;
+
+/**
+ * 自动投放账户——素材
+ *
+ * @author jeecg-boot
+ * 2021-10-20
+ * @version V1.0
+ */
+public interface IAiKuaishouAccountAutoVideoService extends IService<AiKuaishouAccountAutoVideo> {
+
+    // 获取上新素材(自动投放账户级重构)
+    List<AiKuaishouAccountAutoVideo> getUpNewVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate, String createType);
+
+    //获取7天高质量 (自动投放账户级重构)
+    List<AiKuaishouAccountAutoVideo> getHistoryTopVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate, String createType);
+
+    //获取遗漏素材: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);
+
+    //自动投放重构——记录(高质量,历史打捞)使用次数
+    void saveOrUpdateAutoVideoUsedCount(Long accountId, String signature, Integer videoType, String createType);
+}

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2338 - 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));
+    }
+}

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

@@ -0,0 +1,83 @@
+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("修改失败");
+    }
+
+    @Override
+    public List<AiKuaishouAccountAutoTarget> getAutoTargetByIds(List<String> list) {
+        return accountAutoTargetMapper.getAutoTargetByIds(list);
+    }
+
+}

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

@@ -0,0 +1,174 @@
+package cn.com.ctop.kuaishou.modules.ai.service.impl;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.enums.MaterialEnum;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
+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.mapper.AiKuaishouAccountAutoVideoMapper;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountAutoVideoService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 自动投放账户——素材
+ *
+ * @author jeecg-boot
+ * 2021-10-20
+ * @version V1.0
+ */
+@Slf4j
+@Service
+public class AiKuaishouAccountAutoVideoServiceImpl extends ServiceImpl<AiKuaishouAccountAutoVideoMapper, AiKuaishouAccountAutoVideo> implements IAiKuaishouAccountAutoVideoService {
+
+    @Autowired
+    private AiKuaishouAccountAutoVideoMapper autoVideoMapper;
+
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+
+    @Override
+    public List<AiKuaishouAccountAutoVideo> getUpNewVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate, String createType) {
+        return autoVideoMapper.getUpNewVideos(accountId, channelType, keyword, videoCnt, statDate, createType);
+    }
+
+    @Override
+    public List<AiKuaishouAccountAutoVideo> getHistoryTopVideos(Long accountId, Integer channelType, String keyword, Integer videoCnt, String statDate, String createType) {
+        return autoVideoMapper.getHistoryTopVideos(accountId, channelType, keyword, videoCnt, createType);
+    }
+
+    @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 saveOrUpdateAutoVideoUsedCount(Long accountId, String signature, Integer videoType, String createType) {
+        Integer usageTimes = autoVideoMapper.getAutoVideoUsed(accountId, signature, videoType, createType);
+        String date = DateUtils.formatDate(new Date());
+        if (Check.isNull(usageTimes)) {
+            usageTimes = 1;
+            autoVideoMapper.addAutoVideoUsed(accountId, signature, videoType, createType, usageTimes, date);
+        } else {
+            usageTimes += 1;
+            autoVideoMapper.updateAutoVideoUsed(accountId, signature, videoType, createType, usageTimes, date);
+        }
+    }
+
+    @Override
+    public void insertAutoVideo(Long accountId) {
+        CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+        this.getVideoListByPage(token, 1);
+    }
+
+    private void getVideoListByPage(CtopOauthToken token, int page) {
+        try {
+            String date = DateUtils.formatDate(new Date());
+            Integer pageSize = 500;
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_LIST;
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Content-Type", "application/json");
+            headers.put("Access-Token", token.getAccessToken());
+            Map<String, Object> param = new HashMap<>();
+            param.put("advertiser_id", token.getAccountId());
+            param.put("page_size", pageSize);
+            param.put("page", page);
+            param.put("start_date", date);
+            param.put("end_date", date);
+            String result = HttpUtils.httpPostRequest(url, param, headers);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (Check.isNull(resultJson)) {
+                return;
+            }
+            Integer code = resultJson.getInteger("code");
+            String message = resultJson.getString("message");
+            if (null == code || code != 0) {
+                log.error("获取快手视频列表数据异常:{},accountId:{}", message, token.getAccountId());
+                return;
+            }
+            JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+            if (null == details || details.size() <= 0) {
+                log.info("快手视频列表信息为空=》accountId:{}", token.getAccountId());
+                return;
+            }
+            Boolean doGet = true;
+            if (details.size() < pageSize) {
+                doGet = false;
+            }
+
+            List<AiKuaishouAccountAutoVideo> videoGetList = new ArrayList<>();
+            for (int i = 0; i < details.size(); i++) {
+                JSONObject detailJson = details.getJSONObject(i);
+                if (Check.isNull(detailJson)) {
+                    continue;
+                }
+                String photoId = detailJson.getString("photo_id");
+                Long accountId = token.getAccountId();
+                QueryWrapper<AiKuaishouAccountAutoVideo> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("photo_id", photoId);
+                queryWrapper.eq("account_id", accountId).last("limit 1");
+                AiKuaishouAccountAutoVideo one = this.getOne(queryWrapper);
+                if (!Check.isNull(one)) {
+                    continue;
+                }
+                AiKuaishouAccountAutoVideo videoGet = new AiKuaishouAccountAutoVideo();
+                videoGet.setAccountId(accountId);
+                videoGet.setPhotoId(photoId);
+                videoGet.setPhotoName(detailJson.getString("photo_name"));
+                videoGet.setStatDate(date);
+                String signature = detailJson.getString("signature");
+                videoGet.setSignature(signature);
+                Integer source = detailJson.getInteger("source");
+                if (source == 2) {
+                    videoGet.setChannelType(1);
+                } else {
+                    videoGet.setChannelType(0);
+                }
+                Integer newStatus = detailJson.getInteger("new_status");
+                if (newStatus == 1) {
+                    //状态1是可用,其他状态不录存
+                    videoGet.setCustomStatus(1);
+                    videoGet.setProgramStatus(1);
+                } else {
+                    continue;
+                }
+                Integer width = detailJson.getInteger("width");
+                Integer height = detailJson.getInteger("height");
+                Integer type = MaterialEnum.getTypeBySize(width, height);
+                if (!Check.isNull(type)) {
+                    videoGet.setMaterialType(type);
+                }
+                videoGetList.add(videoGet);
+            }
+            if (!Check.isNull(videoGetList)) {
+                autoVideoMapper.insertBatch(videoGetList);
+            }
+            if (doGet) {
+                getVideoListByPage(token, page + 1);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

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

@@ -801,7 +801,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         Long unitNum = customUnitCnt * hour / 20;
         log.info("{}当前时间内需要创建组总数:{}", strategy.getAccountId(), unitNum);
         //查询当前账户创建自定义类型组数量
-        int unitCreateCnt = groupService.queryToDayBuiltCount(strategy.getAccountId());
+        int unitCreateCnt = groupService.queryToDayBuiltCount(strategy.getAccountId(),4);
         log.info("{}截止目前创建组总数:{}", strategy.getAccountId(), unitCreateCnt);
         long remindCnt = unitNum - unitCreateCnt;
         if (remindCnt >= 1) {
@@ -834,7 +834,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         }
         log.info("{}当天可创建组总数:{}", strategy.getAccountId(), unitNum);
         //查询当前账户创建自定义类型组数量
-        int unitCreateCnt = groupService.queryToDayBuiltCount(strategy.getAccountId());
+        int unitCreateCnt = groupService.queryToDayBuiltCount(strategy.getAccountId(),4);
         log.info("{}截止目前创建组总数:{}", strategy.getAccountId(), unitCreateCnt);
         long remindCnt = unitNum - unitCreateCnt;
         if (remindCnt >= 1) {
@@ -1439,20 +1439,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         return Long.valueOf(bidString);
     }
 
-    private JSONArray cleanPramgramErrorScence(JSONArray scenceArray) {
-        JSONArray result = new JSONArray();
-        if (null == scenceArray || scenceArray.isEmpty()) {
-            return result;
-        }
-        for (int i = 0; i < scenceArray.size(); i++) {
-            Integer senceId = scenceArray.getInteger(i);
-            if (senceId != 5 && senceId != 3) {
-                result.add(senceId);
-            }
-        }
-        return result;
-    }
-
     /**
      * 获取定向包
      *

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

@@ -145,7 +145,7 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
         int unitNum = customUnitCnt * hour / 20;
         log.info("{}当前时间内需要创建组总数:{}", strategy.getAccountId(), unitNum);
         //查询当前账户创建自定义类型组数量
-        int unitCreateCnt = groupService.queryToDayBuiltCount(strategy.getAccountId());
+        int unitCreateCnt = groupService.queryToDayBuiltCount(strategy.getAccountId(), 4);
         log.info("{}截止目前创建组总数:{}", strategy.getAccountId(), unitCreateCnt);
         int remindCnt = unitNum - unitCreateCnt;
         int concat = strategy.getSourceMaterial().contains("3") ? 3 : 0;
@@ -185,7 +185,7 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
             }
             log.info("{}可创建组总数:{}", strategy.getAccountId(), customUnitCnt);
             //查询当前账户创建自定义类型组数量
-            int unitCreateCnt = groupService.queryToDayBuiltCount(strategy.getAccountId());
+            int unitCreateCnt = groupService.queryToDayBuiltCount(strategy.getAccountId(), 4);
             log.info("{}截止目前创建组总数:{}", strategy.getAccountId(), unitCreateCnt);
             int remindCnt = customUnitCnt - unitCreateCnt;
             if (remindCnt >= 1) {

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouGroupController.java

@@ -184,7 +184,7 @@ public class KuaiShouGroupController {
     @GetMapping(value = "/queryToDayBuiltCount")
     public Result<Object> queryToDayBuiltCount(Long accountId) {
         try {
-            int count = kuaiShouGroupService.queryToDayBuiltCount(accountId);
+            int count = kuaiShouGroupService.queryToDayBuiltCount(accountId, 4);
             return Result.ok(600 - count);
         } catch (Exception e) {
             e.printStackTrace();

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupMapper.java

@@ -30,7 +30,7 @@ public interface KuaiShouGroupMapper extends BaseMapper<KuaiShouGroup> {
 
     List<KuaiShouGroup> queryUnitInfoByCampaignId(@Param("accountId") Long accountId, @Param("campaignId") Long campaignId);
 
-    Integer queryToDayBuiltCount(@Param("accountId") Long accountId, @Param("date") String date);
+    Integer queryToDayBuiltCount(@Param("accountId") Long accountId, @Param("date") String date,@Param("unitType") Integer unitType);
 
     void deleteByAccountId(@Param("accountId") Long accountId);
 

+ 2 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupMapper.xml

@@ -139,7 +139,8 @@
         SELECT count(1) FROM ctop_kuaishou_group
         WHERE account_id = #{accountId}
           AND create_channel =1
-          AND LOCATE(#{date}, group_create_time)
+          AND group_create_time like concat(#{date},'%')
+          AND unit_type = #{unitType}
     </select>
     <select id="getNewDataByAccountIdAndDate" resultType="java.lang.Integer">
      select

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouGroupService.java

@@ -39,7 +39,7 @@ public interface IKuaiShouGroupService extends IService<KuaiShouGroup> {
 
     KuaiShouGroup selectGroupByUnitId(Long accountId, Long unitId);
 
-    Integer queryToDayBuiltCount(Long accountId);
+    Integer queryToDayBuiltCount(Long accountId,Integer unitType);
 
     void deleteByAccountId(Long accountId);
 

+ 2 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupServiceImpl.java

@@ -132,9 +132,9 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
     }
 
     @Override
-    public Integer queryToDayBuiltCount(Long accountId) {
+    public Integer queryToDayBuiltCount(Long accountId,Integer unitType) {
         String date = DateUtil.formatDate(new Date());
-        return groupMapper.queryToDayBuiltCount(accountId, date);
+        return groupMapper.queryToDayBuiltCount(accountId, date,unitType);
     }
 
     @Override

+ 6 - 5
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -2080,15 +2080,15 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                 if (code == 0) {
                     JSONObject dataJson = resultJson.getJSONObject("data");
                     if (!Check.isNull(dataJson)) {
-                        JSONArray add_creative_ids = dataJson.getJSONArray("add_creative_ids");
-                        if (!Check.isNull(add_creative_ids)) {
+                        JSONArray addCreativeIds = dataJson.getJSONArray("add_creative_ids");
+                        if (!Check.isNull(addCreativeIds)) {
                             Thread thread = new Thread() {
                                 @Override
                                 public void run() {
                                     try {
                                         Thread.sleep(100);
-                                        getCreativeByCreativeIds(accessToken, advertiserId, add_creative_ids);
-                                        createLandPageAndUnit(requestJson, add_creative_ids);
+                                        getCreativeByCreativeIds(accessToken, advertiserId, addCreativeIds);
+                                        createLandPageAndUnit(requestJson, addCreativeIds);
                                     } catch (InterruptedException e) {
                                         e.printStackTrace();
                                     }
@@ -2102,7 +2102,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                         returnMap.put("code", 0);
                         returnMap.put("message", "success");
                         returnMap.put("success", true);
-                        returnMap.put("count", add_creative_ids.size());
+                        returnMap.put("count", addCreativeIds.size());
+                        returnMap.put("ids",addCreativeIds);
                     }
                 } else {
                     if (code == 500000 && count <= 4) {

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

@@ -68,17 +68,17 @@ public class KuaishouChannelController {
      * 查询渠道号管理首页数据
      */
     @GetMapping(value = "/channelManagementHome")
-    public Result<Object> channelManagementHome(Long productId, Long projectId, Long accountId, String userId,
-                                                @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+    public Result<Object> channelManagementHome(KuaishouChannel kuaishouChannel, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
         try {
-            String roleCode = sysRoleService.getRoleCodeByUserId(userId);
-            if ("admin".equals(roleCode) || "sale".contains(roleCode) || "meidaManager".equals(roleCode)) {
-                userId = null;
+            String roleCode = sysRoleService.getRoleCodeByUserId(kuaishouChannel.getUserId());
+            if (Check.isNull(roleCode)) {
+                return Result.error("缺失 人员信息");
+            }
+            if ("admin".equals(roleCode) || roleCode.contains("sale") || "meidaManager".equals(roleCode)) {
+                kuaishouChannel.setUserId(null);
             }
-
             PageHelper.startPage(pageNo, pageSize);
-            return kuaishouChannelService.channelManagementHome(productId, projectId, accountId, userId);
+            return kuaishouChannelService.channelManagementHome(kuaishouChannel);
         } catch (Exception e) {
             e.printStackTrace();
             return Result.error("查询渠道号管理首页数据异常");
@@ -92,10 +92,14 @@ public class KuaishouChannelController {
     @GetMapping(value = "/channelNumberDetails")
     public Result<Object> channelNumberDetails(KuaishouChannel kuaishouChannel, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
         try {
-            if (Check.isNull(kuaishouChannel.getAccountId()) && Check.isNull(kuaishouChannel.getProjectId())) {
+            if (Check.isNull(kuaishouChannel.getAccountId())) {
                 return Result.error("请选择账户");
             }
             return kuaishouChannelService.channelNumberDetails(kuaishouChannel, pageNo, pageSize);
+
+
+
+
         } catch (Exception e) {
             e.printStackTrace();
             return Result.error("查询渠道号详情异常");
@@ -139,10 +143,10 @@ public class KuaishouChannelController {
 
 
     /**
-     * 修改渠道号
+     * 修改渠道号状态
      */
-    @GetMapping(value = "/updateChannel")
-    public Result<Object> updateChannel(KuaishouChannel channel) {
+    @GetMapping(value = "/updateChannelState")
+    public Result<Object> updateChannelState(KuaishouChannel channel) {
         try {
             if (Check.isNull(channel.getId())) {
                 return Result.error("缺失参数");
@@ -161,6 +165,41 @@ public class KuaishouChannelController {
     }
 
     /**
+     * 修改首页账户渠道号状态
+     */
+    @GetMapping(value = "/updateAccountChannelState")
+    public Result<Object> updateAccountChannelState(KuaishouChannel channel) {
+        try {
+            if (Check.isNull(channel.getAccountId())) {
+                return Result.error("缺失参数");
+            }
+            QueryWrapper<KuaishouChannel> wrapper = new QueryWrapper<>();
+            wrapper.eq("account_id", channel.getAccountId());
+            kuaishouChannelService.update(channel, wrapper);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("修改渠道号异常");
+        }
+        return Result.ok("修改成功");
+    }
+
+    /**
+     * 修改渠道号
+     */
+    @GetMapping(value = "/updateChannels")
+    public Result<Object> updateChannels(KuaishouChannel channel) {
+        try {
+            if (Check.isNull(channel.getAccountId())||Check.isNull(channel.getUserId())) {
+                return Result.error("缺失参数");
+            }
+            return kuaishouChannelService.updateChannels(channel);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("修改渠道号异常");
+        }
+    }
+
+    /**
      * 导出单品模板
      */
     @GetMapping("/exportChannelTemplate")
@@ -172,28 +211,46 @@ public class KuaishouChannelController {
             OutputStream os = response.getOutputStream();
             ExportExcelUtils eeu = new ExportExcelUtils();
             XSSFWorkbook workbook = new XSSFWorkbook();
-            String[] titles = {"产品(固定项,勿修改)", "项目(固定项,勿修改)", "使用范围(1代表账户,2代表项目)", "账户ID(和项目对应)", "渠道号创建人(固定项,勿修改)", "渠道号(如:数字加字母)", "渠道号名称", "下载链接", "应用包名", "应用名称", "应用标记", "隐私政策链接"
-                    , "第三方点击监测链接", "是否关联单品(0代表不关联,1代表关联)", "关联单品名称", "使用层级(账户:account,计划:plan,组:group)", "是否循环(0代表不循环,1代表循环)", "循环次数", "调起链接(选填)", "第三方actionBar监测链接(选填)"};
+            String[] titles = {
+                    "产品(固定项,勿修改)",
+                    "项目(固定项,勿修改)",
+                    "渠道号创建人(固定项,勿修改)",
+                    "使用范围(1代表账户,2代表项目)",
+                    "账户ID(和项目对应)",
+                    "渠道号(如:数字加字母)",
+                    "渠道号名称",
+                    "下载链接",
+                    "应用包名",
+                    "应用名称",
+                    "应用标记",
+                    "隐私政策链接",
+                    "第三方点击监测链接",
+                    "是否关联单品(0代表不关联,1代表关联)",
+                    "关联单品名称",
+                    "使用层级(账户:account,计划:plan,组:group)",
+                    "是否循环(0代表不循环,1代表循环)",
+                    "调起链接(选填)",
+                    "第三方actionBar监测链接(选填)"
+            };
             List<List<Object>> list = new ArrayList<>();
             List<Object> ids = new ArrayList<>();
             ids.add(productId);//产品
             ids.add(projectId);//项目
+            ids.add(userId);//渠道号创建人
             ids.add(1);//使用范围(1项目,2账户)
             ids.add(23212);//账户ID
-            ids.add(userId);//渠道号创建人
             ids.add("KS_0001");//渠道号(数字加字母)
             ids.add("快手0001");//渠道号名称
             ids.add("http://test.com.cn");//下载链接
             ids.add("com.test.hcst");//应用包名
             ids.add("示例包_HCST");//应用名称
             ids.add("hcst");//应用标记
-            ids.add("http://test.com.cn");//隐私政策链接
-            ids.add("http://test.com.cn");//第三方点击监测链接
+            ids.add("http://test123.com.cn");//隐私政策链接
+            ids.add("http://test123456.com.cn");//第三方点击监测链接
             ids.add(1);//是否关联单品(0否,1是)
             ids.add("剑来");//关联单品名称
             ids.add("account");//使用层级(账户:account,计划:plan,组:group)
             ids.add(1);//是否循环(0否,1是)
-            ids.add(10);//循环次数
             list.add(ids);
             eeu.exportExcelForAttendance(workbook, 0, "Sheet1", titles, list);
             eeu.putResponseHeader(response, "渠道号模板.xlsx");
@@ -241,29 +298,35 @@ public class KuaishouChannelController {
     }
 
     /**
-     * 定制创建渠道号
+     * 通过账户查询渠道号接口
      */
-    @PostMapping(value = "/customizedCreate")
-    public Result<Object> customizedCreate(@RequestBody JSONObject request) {
+    @PostMapping(value = "/queryChannel")
+    public Result<Object> queryChannel(Long accountId, String usageLevel, String appName, String photoName) {
         try {
-            return kuaishouChannelService.customizedCreate(request, 3);
+            if (Check.isNull(accountId) || Check.isNull(usageLevel) || Check.isNull(appName)) {
+                return Result.error("缺失参数");
+            }
+            return kuaishouChannelService.queryChannel(accountId, usageLevel, appName, photoName);
         } catch (Exception e) {
             e.printStackTrace();
-            log.error("定制创建渠道号异常", e);
-            return Result.error("定制创建渠道号失败," + e.getMessage());
+            log.error("通过账户查询渠道号异常", e);
+            return Result.error("通过账户查询渠道号失败," + e.getMessage());
         }
     }
 
     /**
      * 通过账户查询渠道号接口
      */
-    @PostMapping(value = "/queryChannel")
-    public Result<Object> queryChannel(Long accountId, String usageLevel, String appName, String photoName) {
+    @GetMapping(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(usageLevel) || Check.isNull(appName)) {
+            if (Check.isNull(accountId) || Check.isNull(appName)) {
                 return Result.error("缺失参数");
             }
-            return kuaishouChannelService.queryChannel(accountId, usageLevel, appName, photoName);
+            PageHelper.startPage(pageNo, pageSize);
+            return kuaishouChannelService.queryChannelList(accountId, appName);
         } catch (Exception e) {
             e.printStackTrace();
             log.error("通过账户查询渠道号异常", e);

+ 16 - 13
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/entity/KuaishouChannel.java

@@ -74,7 +74,12 @@ public class KuaishouChannel {
     private Integer createType;
 
     /**
-     * 状态 0无效,1有效
+     * 渠道号状态 0无效,1有效
+     */
+    private Integer channelState;
+
+    /**
+     * 账户是否使用渠道号 0不用,1使用
      */
     private Integer state;
 
@@ -175,18 +180,6 @@ public class KuaishouChannel {
     @ApiModelProperty(value = "是否循环重复使用 0:否,1:是")
     private Integer isCycle;
     /**
-     * 可循环次数
-     */
-    @Excel(name = "可循环次数", width = 15)
-    @ApiModelProperty(value = "可循环次数")
-    private Integer cycleTimes;
-    /**
-     * 已循环次数
-     */
-    @Excel(name = "已循环次数", width = 15)
-    @ApiModelProperty(value = "已循环次数")
-    private Integer haveCycleTimes;
-    /**
      * createTime
      */
     @ApiModelProperty(value = "createTime")
@@ -202,4 +195,14 @@ public class KuaishouChannel {
 
     @TableField(exist = false)
     private List<KuaishouChannelItems> items;
+
+    @TableField(exist = false)
+    private String authName;
+
+    @TableField(exist = false)
+    private Long campaignId;
+
+    @TableField(exist = false)
+    private Long unitId;
+
 }

+ 11 - 8
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/entity/KuaishouChannelCreateStrategy.java

@@ -64,7 +64,7 @@ public class KuaishouChannelCreateStrategy {
     @ApiModelProperty(value = "账户id")
     private Long accountId;
     /**
-     * 创建方式 1-批量,2-excel导入,3-自定义
+     * 创建方式 1-批量,2-excel导入
      */
     @Excel(name = "创建方式 1-批量,2-excel导入,3-自定义", width = 15)
     @ApiModelProperty(value = "创建方式 1-批量,2-excel导入,3-自定义")
@@ -88,6 +88,10 @@ public class KuaishouChannelCreateStrategy {
     @ApiModelProperty(value = "编号长度")
     private Integer numberLength;
     /**
+     * 编号原始值
+     */
+    private String numberValue;
+    /**
      * 编号最小值
      */
     @Excel(name = "编号最小值", width = 15)
@@ -148,12 +152,6 @@ public class KuaishouChannelCreateStrategy {
     @ApiModelProperty(value = "是否循环重复使用 0:否,1:是")
     private Integer isCycle;
     /**
-     * 可循环次数
-     */
-    @Excel(name = "可循环次数", width = 15)
-    @ApiModelProperty(value = "可循环次数")
-    private Integer cycleTimes;
-    /**
      * 应用标记
      */
     @Excel(name = "应用标记", width = 15)
@@ -187,6 +185,7 @@ public class KuaishouChannelCreateStrategy {
     @Excel(name = "图片MD5标识", width = 15)
     @ApiModelProperty(value = "图片MD5标识")
     private String imageToken;
+
     /**
      * createTime
      */
@@ -198,7 +197,6 @@ public class KuaishouChannelCreateStrategy {
     @ApiModelProperty(value = "updateTime")
     private Date updateTime;
 
-    @TableField(exist = false)
     private Long appId;
 
     @TableField(exist = false)
@@ -207,4 +205,9 @@ public class KuaishouChannelCreateStrategy {
     @TableField(exist = false)
     private String itemName;
 
+    @TableField(exist = false)
+    private String projectName;
+    @TableField(exist = false)
+    private String ProductName;
+
 }

+ 97 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/entity/KuaishouChannelUpdateRecord.java

@@ -0,0 +1,97 @@
+package cn.com.ctop.kuaishou.modules.channel.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 渠道号修改记录留存表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-11-17
+ */
+@Data
+@TableName("ctop_kuaishou_channel_update_record")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_channel_update_record对象", description = "渠道号修改记录留存表")
+public class KuaishouChannelUpdateRecord {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 操作人
+     */
+    @Excel(name = "操作人", width = 15)
+    @ApiModelProperty(value = "操作人")
+    private String userId;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+    /**
+     * 调起链接
+     */
+    @Excel(name = "调起链接", width = 15)
+    @ApiModelProperty(value = "调起链接")
+    private String schemaUri;
+    /**
+     * 第三方点击检测链接
+     */
+    @Excel(name = "第三方点击检测链接", width = 15)
+    @ApiModelProperty(value = "第三方点击检测链接")
+    private String clickTrackUrl;
+    /**
+     * 第三方点击按钮监测链接
+     */
+    @Excel(name = "第三方点击按钮监测链接", width = 15)
+    @ApiModelProperty(value = "第三方点击按钮监测链接")
+    private String actionbarClickUrl;
+    /**
+     * 是否关联单品 0:否,1:是
+     */
+    @Excel(name = "是否关联单品 0:否,1:是", width = 15)
+    @ApiModelProperty(value = "是否关联单品 0:否,1:是")
+    private Integer isHaveItem;
+    /**
+     * 是否循环使用 0:否,1:是
+     */
+    @Excel(name = "是否循环使用 0:否,1:是", width = 15)
+    @ApiModelProperty(value = "是否循环使用 0:否,1:是")
+    private Integer isCycle;
+    /**
+     * 操作时间
+     */
+    @Excel(name = "操作时间", width = 15)
+    @ApiModelProperty(value = "操作时间")
+    private String operationTime;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

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

@@ -18,7 +18,7 @@ import java.util.List;
  */
 public interface KuaishouChannelMapper extends BaseMapper<KuaishouChannel> {
 
-    List<JSONObject> channelManagementHome(@Param("productId") Long productId, @Param("projectId") Long projectId, @Param("accountId") Long accountId, @Param("userId") String userId);
+    List<JSONObject> channelManagementHome(KuaishouChannel kuaishouChannel);
 
     Long channelNumberDetailsTotal(KuaishouChannel kuaishouChannel);
 
@@ -26,7 +26,7 @@ public interface KuaishouChannelMapper extends BaseMapper<KuaishouChannel> {
 
     Long channelNumberUsageDetailsListTotal(KuaishouChannel kuaishouChannel);
 
-    List<JSONObject> channelNumberUsageDetailsList(KuaishouChannel kuaishouChannel);
+    List<KuaishouChannel> channelNumberUsageDetailsList(KuaishouChannel kuaishouChannel);
 
     List<JSONObject> channelNumberBindingItemInfo(@Param("request") JSONArray request);
 
@@ -47,4 +47,8 @@ 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);
+
+    List<KuaishouChannel> queryChannelListByAccount(@Param("accountId") Long accountId);
 }

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.channel.mapper;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelUpdateRecord;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 渠道号修改记录留存表
+ *
+ * @author jeecg-boot
+ * 2021-11-17
+ * @version V1.0
+ */
+public interface KuaishouChannelUpdateRecordMapper extends BaseMapper<KuaishouChannelUpdateRecord> {
+
+}

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

@@ -3,8 +3,8 @@
 <mapper namespace="cn.com.ctop.kuaishou.modules.channel.mapper.KuaishouChannelMapper">
 
     <select id="channelManagementHome" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT * FROM (
         SELECT
+               t1.id,
         IFNULL(t1.product_name, '')as 'productName',
         IFNULL(t1.project_name, '')as 'projectName',
         IFNULL(t1.account_id, '')as 'accountId',
@@ -12,51 +12,31 @@
         IFNULL(t2.realname, '')as 'realname',
         MAX(t1.state_date) as 'stateDate',
         IFNULL(t1.create_type, '') as 'createType',
+        IFNULL(t1.state,0) as 'state',
+        usage_level as 'usageLevel',
+        (select auth_name from ctop_user_allocation where account_id = t1.account_id) as 'authName',
         t1.create_time
         FROM ctop_kuaishou_channel t1
         LEFT JOIN sys_user t2 ON t1.user_id = t2.id
-        where account_id is not null
-        <if test="userId != null">
-            and t1.user_id = #{userId}
-        </if>
-        <if test="projectId != null">
-            and project_id = #{projectId}
-        </if>
-        <if test="productId != null">
-            and product_id = #{productId}
-        </if>
-        <if test="accountId != null">
-            and account_id= #{accountId}
-        </if>
+        <where>
+            <if test="userId != null">
+                and t1.user_id = #{userId}
+            </if>
+            <if test="projectId != null">
+                and project_id = #{projectId}
+            </if>
+            <if test="productId != null">
+                and product_id = #{productId}
+            </if>
+            <if test="accountId != null">
+                and account_id= #{accountId}
+            </if>
+            <if test="state != null">
+                and state= #{state}
+            </if>
+        </where>
         GROUP BY account_id
-        UNION ALL
-        SELECT
-        IFNULL(t1.product_name, '')as 'productName',
-        IFNULL(t1.project_name, '')as 'projectName',
-        IFNULL(t1.account_id, '')as 'accountId',
-        IFNULL(t1.project_id, '')as 'projectId',
-        IFNULL(t2.realname, '')as 'realname',
-        MAX(t1.state_date) as 'stateDate',
-        IFNULL(t1.create_type, '') as 'createType',
-        t1.create_time
-        FROM ctop_kuaishou_channel t1
-        LEFT JOIN sys_user t2 ON t1.user_id = t2.id
-        where account_id is null
-        <if test="userId != null">
-            and t1.user_id = #{userId}
-        </if>
-        <if test="projectId != null">
-            and project_id = #{projectId}
-        </if>
-        <if test="productId != null">
-            and product_id = #{productId}
-        </if>
-        <if test="accountId != null">
-            and account_id= #{accountId}
-        </if>
-        GROUP BY project_id
-        ) t
-        ORDER BY t.create_time DESC
+        ORDER BY create_time DESC
     </select>
 
     <select id="channelNumberDetailsTotal" resultType="java.lang.Long">
@@ -66,12 +46,6 @@
             <if test="accountId != null">
                 AND account_id = #{accountId}
             </if>
-            <if test="projectId != null">
-                AND project_id = #{projectId}
-            </if>
-            <if test="createType != null">
-                AND create_type = #{createType}
-            </if>
             <if test="channelName != null">
                 AND LOCATE(#{channelName},channel_name)
             </if>
@@ -88,12 +62,6 @@
             <if test="accountId != null">
                 AND account_id = #{accountId}
             </if>
-            <if test="projectId != null">
-                AND project_id = #{projectId}
-            </if>
-            <if test="createType != null">
-                AND create_type = #{createType}
-            </if>
             <if test="channelName != null">
                 AND LOCATE(#{channelName},channel_name)
             </if>
@@ -115,22 +83,23 @@
           AND t3.unit_id is not null
     </select>
 
-    <select id="channelNumberUsageDetailsList" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT CASE
-                   t1.usage_range
-                   WHEN 1 THEN
-                       '账户'
-                   WHEN 2 THEN
-                       '项目'
-                   ELSE ''
-                   END AS 'usageRange', IFNULL(t3.channel_code, '') AS 'channelCode', IFNULL(t1.project_name, '') AS 'projectName', IFNULL(t2.auth_name, '') AS 'authName', IFNULL(t3.account_id, '') AS 'accountId', IFNULL(t3.campaign_id, '') AS 'campaignId', IFNULL(t3.unit_id, '') AS 'unitId'
+    <select id="channelNumberUsageDetailsList" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel">
+        SELECT  t1.usage_level,
+               t3.channel_code,
+               t1.channel_name,
+              t1.project_name,
+              t2.auth_name,
+              t3.account_id,
+              t3.campaign_id,
+              t3.unit_id,
+               t3.create_time
         FROM ctop_kuaishou_channel_rel t3
-                 INNER JOIN ctop_kuaishou_channel t1 ON t1.account_id = t3.account_id
-            AND t1.channel_code = t3.channel_code
-                 LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+        INNER JOIN ctop_kuaishou_channel t1 ON t1.account_id = t3.account_id AND t1.channel_code = t3.channel_code
+        LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
         WHERE t3.account_id = #{accountId}
           AND t3.channel_code = #{channelCode}
           AND t3.unit_id is not null
+          order by t3.create_time
     </select>
 
     <select id="channelNumberBindingItemInfo" resultType="com.alibaba.fastjson.JSONObject">
@@ -223,7 +192,8 @@
         channel_name,
         click_track_url,
         actionbar_click_url,
-        schema_uri
+        schema_uri,
+        have_cycle_times
         FROM `ctop_kuaishou_channel`
         WHERE strategy_id IN
         <foreach collection="strategys" item="item" separator=","
@@ -267,6 +237,39 @@
         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="queryChannelListByAccount" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel">
+      SELECT
+          id,
+          channel_code
+      FROM
+          ctop_kuaishou_channel
+      WHERE channel_state = 1
+        AND state = 1
+        AND account_id = #{accountId}
+    </select>
+
 
     <select id="queryUsedChannel" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel">
         SELECT t2.*

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelRelMapper.xml

@@ -4,7 +4,7 @@
 
     <select id="queryByAccountChannelCode"
             resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelRel">
-        SELECT *
+        SELECT t1.*
         FROM ctop_kuaishou_channel_rel t1
                  LEFT JOIN ctop_kuaishou_channel_app_info t2 ON t1.app_id = t2.app_id
         WHERE t1.account_id =#{accountId}

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

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

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

@@ -16,7 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
  */
 public interface IKuaishouChannelService extends IService<KuaishouChannel> {
 
-    Result<Object> channelManagementHome(Long productId, Long projectId, Long accountId, String userId);
+    Result<Object> channelManagementHome(KuaishouChannel kuaishouChannel);
 
     Result<Object> channelNumberDetails(KuaishouChannel kuaishouCha, Integer pageNo, Integer pageSizennel);
 
@@ -28,8 +28,6 @@ public interface IKuaishouChannelService extends IService<KuaishouChannel> {
 
     Result<Object> systemBatchCreation(JSONObject request);
 
-    Result<Object> customizedCreate(JSONObject request, Integer createType) throws Exception;
-
     Result<Object> queryChannel(Long accountId, String usageLevel, String appName, String photoName) throws Exception;
 
     Result<Object> queryChannelLevel(JSONObject request);
@@ -37,4 +35,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);
+
+    Result<Object> updateChannels(KuaishouChannel channel);
 }

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.channel.service;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelUpdateRecord;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 渠道号修改记录留存表
+ *
+ * @author jeecg-boot
+ * 2021-11-17
+ * @version V1.0
+ */
+public interface IKuaishouChannelUpdateRecordService extends IService<KuaishouChannelUpdateRecord> {
+
+}

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 432 - 349
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelServiceImpl.java


+ 19 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelUpdateRecordServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.channel.service.impl;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelUpdateRecord;
+import cn.com.ctop.kuaishou.modules.channel.mapper.KuaishouChannelUpdateRecordMapper;
+import cn.com.ctop.kuaishou.modules.channel.service.IKuaishouChannelUpdateRecordService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 渠道号修改记录留存表
+ *
+ * @author jeecg-boot
+ * 2021-11-17
+ * @version V1.0
+ */
+@Service
+public class KuaishouChannelUpdateRecordServiceImpl extends ServiceImpl<KuaishouChannelUpdateRecordMapper, KuaishouChannelUpdateRecord> implements IKuaishouChannelUpdateRecordService {
+
+}

+ 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;
@@ -206,4 +214,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);
+    }
 }

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouAudienceReportDailyService.java

@@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @Version: V1.0
  */
 public interface IKuaishouAudienceReportDailyService extends IService<KuaishouAudienceReportDaily> {
-    /**
+    /*
      * 人群分析报表
      *
      * @param

+ 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