浏览代码

Merge branch 'test'

# Conflicts:
#	jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java
#	jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java
zhaoxian 3 年之前
父节点
当前提交
a960eee280
共有 61 个文件被更改,包括 4817 次插入111 次删除
  1. 4 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/ProjectMapper.java
  2. 1 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java
  3. 19 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml
  4. 8 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml
  5. 1 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java
  6. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java
  7. 63 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/ExportExcelUtils.java
  8. 4 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java
  9. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaishouAdvertiserStrategy.java
  10. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaishouAdvertiserStrategyMapper.java
  11. 14 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaishouAdvertiserStrategyMapper.xml
  12. 4 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouAdvertiserStrategyService.java
  13. 5 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IKuaishouAppPackageService.java
  14. 45 35
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAdvertiserStrategyServiceImpl.java
  15. 209 38
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java
  16. 2 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaishouAppPackageServiceImpl.java
  17. 30 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouAppListController.java
  18. 3 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouAppListMapper.java
  19. 10 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouAppListMapper.xml
  20. 7 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouAppListService.java
  21. 19 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouAppListServiceImpl.java
  22. 246 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/controller/KuaishouChannelAppInfoController.java
  23. 415 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/controller/KuaishouChannelController.java
  24. 246 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/controller/KuaishouChannelCreateStrategyController.java
  25. 328 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/controller/KuaishouChannelItemsController.java
  26. 205 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/entity/KuaishouChannel.java
  27. 135 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/entity/KuaishouChannelAppInfo.java
  28. 210 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/entity/KuaishouChannelCreateStrategy.java
  29. 87 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/entity/KuaishouChannelItems.java
  30. 57 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/entity/KuaishouChannelItemsRel.java
  31. 77 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/entity/KuaishouChannelRel.java
  32. 17 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/KuaishouChannelAppInfoMapper.java
  33. 20 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/KuaishouChannelCreateStrategyMapper.java
  34. 27 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/KuaishouChannelItemsMapper.java
  35. 19 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/KuaishouChannelItemsRelMapper.java
  36. 48 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/KuaishouChannelMapper.java
  37. 21 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/KuaishouChannelRelMapper.java
  38. 5 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelAppInfoMapper.xml
  39. 25 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelCreateStrategyMapper.xml
  40. 81 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelItemsMapper.xml
  41. 11 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelItemsRelMapper.xml
  42. 261 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelMapper.xml
  43. 38 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelRelMapper.xml
  44. 15 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/IKuaishouChannelAppInfoService.java
  45. 20 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/IKuaishouChannelCreateStrategyService.java
  46. 19 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/IKuaishouChannelItemsRelService.java
  47. 32 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/IKuaishouChannelItemsService.java
  48. 20 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/IKuaishouChannelRelService.java
  49. 38 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/IKuaishouChannelService.java
  50. 19 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelAppInfoServiceImpl.java
  51. 35 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelCreateStrategyServiceImpl.java
  52. 30 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelItemsRelServiceImpl.java
  53. 173 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelItemsServiceImpl.java
  54. 36 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelRelServiceImpl.java
  55. 1259 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelServiceImpl.java
  56. 1 1
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/NewMonitorController.java
  57. 6 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/NewMonitorMapper.java
  58. 27 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/NewMonitorMapper.xml
  59. 11 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/NewMonitorServiceImpl.java
  60. 29 27
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AiKuaishouAdvertiserStrategyController.java
  61. 8 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java

+ 4 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/ProjectMapper.java

@@ -20,6 +20,8 @@ public interface ProjectMapper extends BaseMapper<Project> {
 
 
     String getNameByAccountId(@Param("accountId") Long accountId);
     String getNameByAccountId(@Param("accountId") Long accountId);
 
 
+    String getNameByProjectId(@Param("projectId") Long projectId);
+
     JSONObject getWarningInfoByProjectId(@Param("projectId") Long projectId);
     JSONObject getWarningInfoByProjectId(@Param("projectId") Long projectId);
 
 
     String querySupplierCodeById(@Param("projectId") Long projectId);
     String querySupplierCodeById(@Param("projectId") Long projectId);
@@ -35,4 +37,6 @@ public interface ProjectMapper extends BaseMapper<Project> {
     JSONObject getProjectByAccountId(@Param("accountId") Long accountId);
     JSONObject getProjectByAccountId(@Param("accountId") Long accountId);
 
 
     List<JSONObject> queryProductList(@Param("projectList") List<JSONObject> projectList);
     List<JSONObject> queryProductList(@Param("projectList") List<JSONObject> projectList);
+
+    JSONObject getProduct(@Param("accountId") Long accountId, @Param("projectId") Long projectId);
 }
 }

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java

@@ -70,5 +70,5 @@ public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
 
 
     List<UserAllocation> getAccountInfoBySalesId(@Param("sales")Set<String> sales,@Param("mediaId")String mediaId,@Param("advertiserId")String advertiserId,@Param("productId")String productId);
     List<UserAllocation> getAccountInfoBySalesId(@Param("sales")Set<String> sales,@Param("mediaId")String mediaId,@Param("advertiserId")String advertiserId,@Param("productId")String productId);
 
 
-    List<JSONObject> getAccountListByProjectListV2(@Param("list")List list);
+    List<Long> getAccountListByProjectId(@Param("projectId") Long projectId);
 }
 }

+ 19 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml

@@ -10,6 +10,11 @@
      )
      )
     </select>
     </select>
 
 
+    <select id="getNameByProjectId" resultType="java.lang.String">
+     select project_name from ctop_project
+     where id = #{projectId}
+    </select>
+
     <select id="getWarningInfoByProjectId" resultType="com.alibaba.fastjson.JSONObject">
     <select id="getWarningInfoByProjectId" resultType="com.alibaba.fastjson.JSONObject">
      select
      select
      id projectId,
      id projectId,
@@ -98,6 +103,7 @@
         SELECT t1.product_id as 'productId',t2.product_name as 'productName' FROM ctop_project t1
         SELECT t1.product_id as 'productId',t2.product_name as 'productName' FROM ctop_project t1
         LEFT JOIN ctop_product t2 ON t1.product_id = t2.id
         LEFT JOIN ctop_product t2 ON t1.product_id = t2.id
         WHERE t1.product_id is not null
         WHERE t1.product_id is not null
+        AND t2.product_name is not null
         and t1.id IN
         and t1.id IN
         <foreach item="item" index="index" collection="projectList" open="(" separator="," close=")">
         <foreach item="item" index="index" collection="projectList" open="(" separator="," close=")">
             #{item.projectId}
             #{item.projectId}
@@ -105,4 +111,17 @@
         GROUP BY t1.product_id
         GROUP BY t1.product_id
     </select>
     </select>
 
 
+    <select id="getProduct" resultType="com.alibaba.fastjson.JSONObject">
+        select DISTINCT t1.id as 'projectId', product_id as 'productId', t1.project_name as 'projectName'
+        from ctop_project t1 left join ctop_user_allocation t2 ON t1.id = t2.project_id
+        <where>
+        <if test="projectId != null and projectId != ''">
+           and t1.id = #{projectId}
+        </if>
+        <if test="accountId != null and accountId != ''">
+            and t2.account_id = #{accountId}
+        </if>
+        </where>
+    </select>
+
 </mapper>
 </mapper>

+ 8 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml

@@ -245,6 +245,14 @@
         WHERE del_flag = 0
         WHERE del_flag = 0
           and account_id = #{accountId}
           and account_id = #{accountId}
     </select>
     </select>
+
+    <!-- 根据账户id 查看财务账户 -->
+    <select id="getAccountListByProjectId" resultType="java.lang.Long">
+        select account_id from ctop_user_allocation
+        WHERE account_status = 0
+          AND project_id = #{projectId}
+    </select>
+
     <select id="getAccountInfoBySalesId" resultType="cn.com.ctop.common.module.entity.UserAllocation">
     <select id="getAccountInfoBySalesId" resultType="cn.com.ctop.common.module.entity.UserAllocation">
         select cua.*
         select cua.*
             from ctop_user_allocation cua
             from ctop_user_allocation cua

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java

@@ -71,5 +71,5 @@ public interface IUserAllocationService extends IService<UserAllocation> {
 
 
     Result<UserAllocation> editUserAlloCation(UserAllocation userAllocation);
     Result<UserAllocation> editUserAlloCation(UserAllocation userAllocation);
 
 
-    Map<Long, List<JSONObject>> getAccountListByProjectListV2(List<JSONObject> projectList);
+    List<Long> getAccountListByProjectId(Long projectId);
 }
 }

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java

@@ -330,5 +330,10 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
         return result;
         return result;
     }
     }
 
 
+    @Override
+    public List<Long> getAccountListByProjectId(Long projectId) {
+        return userAllocationMapper.getAccountListByProjectId(projectId);
+    }
+
 
 
 }
 }

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

@@ -1,10 +1,17 @@
 package cn.com.ctop.common.module.utils;
 package cn.com.ctop.common.module.utils;
 
 
 
 
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.xssf.usermodel.*;
 import org.apache.poi.xssf.usermodel.*;
 
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
 public class ExportExcelUtils {
 public class ExportExcelUtils {
@@ -264,5 +271,61 @@ public class ExportExcelUtils {
         }
         }
     }
     }
 
 
+    //发送响应流方法
+    public void putResponseHeader(HttpServletResponse response, String fileName) {
+        try {
+            try {
+                fileName = new String(fileName.getBytes(), "ISO8859-1");
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            }
+//            response.setContentType("multipart/form-data;charset=ISO8859-1");
+            response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+            response.addHeader("Pargam", "no-cache");
+            response.addHeader("Cache-Control", "no-cache");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
 
 
+    public String getCellValue(Cell cell) {
+        String value = "";
+        if (cell != null) {
+            // 以下是判断数据的类型
+            switch (cell.getCellType()) {
+                case HSSFCell.CELL_TYPE_NUMERIC: // 数字
+                    value = cell.getNumericCellValue() + "";
+                    if (HSSFDateUtil.isCellDateFormatted(cell)) {
+                        Date date = cell.getDateCellValue();
+                        if (date != null) {
+                            value = new SimpleDateFormat("yyyy-MM-dd").format(date);
+                        } else {
+                            value = "";
+                        }
+                    } else {
+                        value = new DecimalFormat("0").format(cell.getNumericCellValue());
+                    }
+                    break;
+                case HSSFCell.CELL_TYPE_STRING: // 字符串
+                    value = cell.getStringCellValue();
+                    break;
+                case HSSFCell.CELL_TYPE_BOOLEAN: // Boolean
+                    value = cell.getBooleanCellValue() + "";
+                    break;
+                case HSSFCell.CELL_TYPE_FORMULA: // 公式
+                    value = cell.getCellFormula() + "";
+                    break;
+                case HSSFCell.CELL_TYPE_BLANK: // 空值
+                    value = "";
+                    break;
+                case HSSFCell.CELL_TYPE_ERROR: // 故障
+                    value = "非法字符";
+                    break;
+                default:
+                    value = "未知类型";
+                    break;
+            }
+        }
+        return value.trim();
+    }
 }
 }

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

@@ -113,6 +113,10 @@ public class KuaishouInterfaceConstant {
      */
      */
     public static final String APP_CREATE = "/rest/openapi/v1/file/ad/app/create";
     public static final String APP_CREATE = "/rest/openapi/v1/file/ad/app/create";
     /**
     /**
+     * 创建应用
+     */
+    public static final String APP_UPDATE = "/rest/openapi/v1/file/ad/app/update";
+    /**
      * 创建广告获取应用列表
      * 创建广告获取应用列表
      */
      */
     public static final String APP_LIST = "/rest/openapi/v1/file/ad/app/list";
     public static final String APP_LIST = "/rest/openapi/v1/file/ad/app/list";

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

@@ -388,6 +388,8 @@ public class AiKuaishouAdvertiserStrategy {
     private Integer historyTop;
     private Integer historyTop;
     private Integer multipleBids;
     private Integer multipleBids;
     private Integer systemOptimization;
     private Integer systemOptimization;
+    private String usageLevel;
+    private Integer useChannel;
 
 
 
 
     @TableField(exist = false)
     @TableField(exist = false)

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

@@ -1,7 +1,11 @@
 package cn.com.ctop.kuaishou.modules.ai.mapper;
 package cn.com.ctop.kuaishou.modules.ai.mapper;
 
 
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.github.pagehelper.PageInfo;
+
+import java.util.List;
 
 
 /**
 /**
  * 快手账户策略设置信息表
  * 快手账户策略设置信息表
@@ -11,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
  */
 public interface AiKuaishouAdvertiserStrategyMapper extends BaseMapper<AiKuaishouAdvertiserStrategy> {
 public interface AiKuaishouAdvertiserStrategyMapper extends BaseMapper<AiKuaishouAdvertiserStrategy> {
 
 
+    List<AiKuaishouAdvertiserStrategy> queryList(AiKuaishouAdvertiserStrategy aiKuaishouAdvertiserStrategy);
 }
 }

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

@@ -2,4 +2,18 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!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.AiKuaishouAdvertiserStrategyMapper">
 <mapper namespace="cn.com.ctop.kuaishou.modules.ai.mapper.AiKuaishouAdvertiserStrategyMapper">
 
 
+    <select id="queryList" resultType="cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy">
+        SELECT *
+        FROM ctop_ai_kuaishou_advertiser_strategy
+        <where>
+            <if test="accountId != null">
+                and account_id = #{accountId}
+            </if>
+            <if test="userId != null">
+                and user_id = #{userId}
+            </if>
+        </where>
+        order by create_time desc
+    </select>
+
 </mapper>
 </mapper>

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

@@ -1,7 +1,9 @@
 package cn.com.ctop.kuaishou.modules.ai.service;
 package cn.com.ctop.kuaishou.modules.ai.service;
 
 
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
 import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.github.pagehelper.PageInfo;
 
 
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -26,4 +28,6 @@ public interface IAiKuaishouAdvertiserStrategyService extends IService<AiKuaisho
     Map<String, Object> aiHistoricalMissingMaterial(Long accountId);
     Map<String, Object> aiHistoricalMissingMaterial(Long accountId);
 
 
     List<AiKuaishouAdvertiserStrategy> getAllEffectStrategy();
     List<AiKuaishouAdvertiserStrategy> getAllEffectStrategy();
+
+    PageInfo<AiKuaishouAdvertiserStrategy> queryList(AiKuaishouAdvertiserStrategy aiKuaishouAdvertiserStrategy);
 }
 }

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.ai.service;
 package cn.com.ctop.kuaishou.modules.ai.service;
 
 
+import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAppPackage;
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAppPackage;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
@@ -19,11 +20,11 @@ public interface IKuaishouAppPackageService extends IService<KuaishouAppPackage>
 
 
     Result<Object> importExcel(MultipartFile file, Long projectId, Integer platform, String imageUrl) throws Exception;
     Result<Object> importExcel(MultipartFile file, Long projectId, Integer platform, String imageUrl) throws Exception;
 
 
-    Result<Object> pushAppPackage(Long id, JSONArray accountIds,JSONObject requestJson);
+    Result<Object> pushAppPackage(Long id, JSONArray accountIds, JSONObject requestJson);
 
 
     Result<Object> queryPushResults(String id, JSONArray accountIds, String status);
     Result<Object> queryPushResults(String id, JSONArray accountIds, String status);
 
 
-    List<Long> queryByAppVersion(Long projectId,String appVersion,Integer dataStatus);
+    List<Long> queryByAppVersion(Long projectId, String appVersion, Integer dataStatus);
 
 
     void createAppAndGroupRel(JSONObject request);
     void createAppAndGroupRel(JSONObject request);
 
 
@@ -42,4 +43,6 @@ public interface IKuaishouAppPackageService extends IService<KuaishouAppPackage>
     Result<Object> getAppsDetail(List<Long> list);
     Result<Object> getAppsDetail(List<Long> list);
 
 
     JSONObject queryAppId(Long appTemId, Long accountId);
     JSONObject queryAppId(Long appTemId, Long accountId);
+
+    JSONObject getImageToken(String md5, Long accountId, CtopOauthToken oauthToken);
 }
 }

+ 45 - 35
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAdvertiserStrategyServiceImpl.java

@@ -14,6 +14,7 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouVideoRelateCreativesS
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -23,25 +24,28 @@ import java.util.Map;
 
 
 /**
 /**
  * 快手账户策略设置信息表
  * 快手账户策略设置信息表
+ *
  * @author jeecg-boot
  * @author jeecg-boot
- * @date   2021-01-25
  * @version V1.0
  * @version V1.0
+ * @date 2021-01-25
  */
  */
 @Service
 @Service
 public class AiKuaishouAdvertiserStrategyServiceImpl extends ServiceImpl<AiKuaishouAdvertiserStrategyMapper, AiKuaishouAdvertiserStrategy> implements IAiKuaishouAdvertiserStrategyService {
 public class AiKuaishouAdvertiserStrategyServiceImpl extends ServiceImpl<AiKuaishouAdvertiserStrategyMapper, AiKuaishouAdvertiserStrategy> implements IAiKuaishouAdvertiserStrategyService {
-    public static final String TEST_CREATIVE_URL= "http://139.186.27.96:31012/ai_historical_missing_material";
-    public static final String TEST_PROGRAM_CREATIVE_URL= "http://139.186.27.96:31012/ai_programme_new_material";
+    public static final String TEST_CREATIVE_URL = "http://139.186.27.96:31012/ai_historical_missing_material";
+    public static final String TEST_PROGRAM_CREATIVE_URL = "http://139.186.27.96:31012/ai_programme_new_material";
     @Autowired
     @Autowired
     private IUserAllocationService userAllocationService;
     private IUserAllocationService userAllocationService;
     @Autowired
     @Autowired
     private IKuaiShouVideoGetService videoGetService;
     private IKuaiShouVideoGetService videoGetService;
     @Autowired
     @Autowired
     private IKuaishouVideoRelateCreativesService relateCreativesService;
     private IKuaishouVideoRelateCreativesService relateCreativesService;
+    @Autowired
+    private AiKuaishouAdvertiserStrategyMapper kuaishouAdvertiserStrategyMapper;
 
 
     @Override
     @Override
     public AiKuaishouAdvertiserStrategy getByAccountId(Long accountId) {
     public AiKuaishouAdvertiserStrategy getByAccountId(Long accountId) {
-        QueryWrapper<AiKuaishouAdvertiserStrategy>queryWrapper =new QueryWrapper<>();
-        queryWrapper.eq("account_id",accountId);
+        QueryWrapper<AiKuaishouAdvertiserStrategy> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
         queryWrapper.orderByDesc("id");
         queryWrapper.orderByDesc("id");
         queryWrapper.last("limit 1");
         queryWrapper.last("limit 1");
         return this.getOne(queryWrapper);
         return this.getOne(queryWrapper);
@@ -49,79 +53,85 @@ public class AiKuaishouAdvertiserStrategyServiceImpl extends ServiceImpl<AiKuais
 
 
     @Override
     @Override
     public Map<String, Object> testCreate(Long accountId) {
     public Map<String, Object> testCreate(Long accountId) {
-        Map<String,Object>result = new HashMap<>();
-        if(null == accountId||accountId == 0){
+        Map<String, Object> result = new HashMap<>();
+        if (null == accountId || accountId == 0) {
             ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             return result;
             return result;
         }
         }
         AiKuaishouAdvertiserStrategy aiKuaishouAdvertiserStrategy = this.getByAccountId(accountId);
         AiKuaishouAdvertiserStrategy aiKuaishouAdvertiserStrategy = this.getByAccountId(accountId);
-        if(null == aiKuaishouAdvertiserStrategy||null == aiKuaishouAdvertiserStrategy.getStatus()||aiKuaishouAdvertiserStrategy.getStatus()!=1){
+        if (null == aiKuaishouAdvertiserStrategy || null == aiKuaishouAdvertiserStrategy.getStatus() || aiKuaishouAdvertiserStrategy.getStatus() != 1) {
             ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             return result;
             return result;
         }
         }
         UserAllocation allocation = userAllocationService.getByAccountId(accountId);
         UserAllocation allocation = userAllocationService.getByAccountId(accountId);
-        if(null == allocation){
+        if (null == allocation) {
             ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             return result;
             return result;
         }
         }
         JSONObject params = new JSONObject();
         JSONObject params = new JSONObject();
-        params.put("account_id",accountId);
-        params.put("test_video_cnt",1);
+        params.put("account_id", accountId);
+        params.put("test_video_cnt", 1);
         String request = null;
         String request = null;
         //程序化
         //程序化
-        if(aiKuaishouAdvertiserStrategy.getOpenProgramCreate() == 1){
-            request = HttpUtils.httpPostRequest(TEST_PROGRAM_CREATIVE_URL,params,new HashMap<>());
-        }else{
+        if (aiKuaishouAdvertiserStrategy.getOpenProgramCreate() == 1) {
+            request = HttpUtils.httpPostRequest(TEST_PROGRAM_CREATIVE_URL, params, new HashMap<>());
+        } else {
             request = HttpUtils.httpPostRequest(TEST_CREATIVE_URL, params, new HashMap<>());
             request = HttpUtils.httpPostRequest(TEST_CREATIVE_URL, params, new HashMap<>());
         }
         }
         JSONObject requestObject = JSONObject.parseObject(request);
         JSONObject requestObject = JSONObject.parseObject(request);
         String message = requestObject.getString("message");
         String message = requestObject.getString("message");
         Integer code = requestObject.getInteger("code");
         Integer code = requestObject.getInteger("code");
-        result.put("code",code);
-        result.put("message",message);
+        result.put("code", code);
+        result.put("message", message);
         return result;
         return result;
     }
     }
+
     @Override
     @Override
     public Map<String, Object> aiHistoricalMissingMaterial(Long accountId) {
     public Map<String, Object> aiHistoricalMissingMaterial(Long accountId) {
-        Map<String,Object>result = new HashMap<>();
-        if(null == accountId||accountId == 0){
-            ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
+        Map<String, Object> result = new HashMap<>();
+        if (null == accountId || accountId == 0) {
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             return result;
             return result;
         }
         }
         AiKuaishouAdvertiserStrategy strategy = this.getByAccountId(accountId);
         AiKuaishouAdvertiserStrategy strategy = this.getByAccountId(accountId);
-        if(null == strategy||strategy.getStatus()!=1){
-            ResultMapUtils.setResultMap(result,StatusCode.KUAISHOU_AI_STRATEGY_HAS_NOT_EXIST);
+        if (null == strategy || strategy.getStatus() != 1) {
+            ResultMapUtils.setResultMap(result, StatusCode.KUAISHOU_AI_STRATEGY_HAS_NOT_EXIST);
             return result;
             return result;
         }
         }
         this.historicalMissingMaterialCreateCreative(strategy);
         this.historicalMissingMaterialCreateCreative(strategy);
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
         return result;
     }
     }
 
 
     @Override
     @Override
     public List<AiKuaishouAdvertiserStrategy> getAllEffectStrategy() {
     public List<AiKuaishouAdvertiserStrategy> getAllEffectStrategy() {
-        QueryWrapper<AiKuaishouAdvertiserStrategy>queryWrapper= new QueryWrapper<>();
-        queryWrapper.eq("status",1);
+        QueryWrapper<AiKuaishouAdvertiserStrategy> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("status", 1);
         queryWrapper.orderByDesc("id");
         queryWrapper.orderByDesc("id");
         return this.list(queryWrapper);
         return this.list(queryWrapper);
     }
     }
 
 
-    private Map<String,Object> historicalMissingMaterialCreateCreative(AiKuaishouAdvertiserStrategy strategy) {
-        Map<String,Object>result =new HashMap<>();
+    @Override
+    public PageInfo<AiKuaishouAdvertiserStrategy> queryList(AiKuaishouAdvertiserStrategy aiKuaishouAdvertiserStrategy) {
+        return new PageInfo<>(kuaishouAdvertiserStrategyMapper.queryList(aiKuaishouAdvertiserStrategy));
+    }
+
+    private Map<String, Object> historicalMissingMaterialCreateCreative(AiKuaishouAdvertiserStrategy strategy) {
+        Map<String, Object> result = new HashMap<>();
         //判定是否单一应用
         //判定是否单一应用
-        if(strategy.getSingleAppid()==1){
+        if (strategy.getSingleAppid() == 1) {
             //TODO 参数拼接
             //TODO 参数拼接
-            Map<String,Object>params =new HashMap<>();
+            Map<String, Object> params = new HashMap<>();
             //1:直接查询历史素材
             //1:直接查询历史素材
             List<JSONObject> materialList = relateCreativesService.getVideoZeroListByMap(params);
             List<JSONObject> materialList = relateCreativesService.getVideoZeroListByMap(params);
             if (Check.isNull(materialList)) {
             if (Check.isNull(materialList)) {
-                ResultMapUtils.setResultMap(result,StatusCode.KUAISHOU_AI_STRATEGY_HAS_NO_HISTORY_MATERIAL);
+                ResultMapUtils.setResultMap(result, StatusCode.KUAISHOU_AI_STRATEGY_HAS_NO_HISTORY_MATERIAL);
                 return result;
                 return result;
             }
             }
             materialList = videoGetService.getVideoInfoAndImageList(materialList);
             materialList = videoGetService.getVideoInfoAndImageList(materialList);
             //补充遗漏素材
             //补充遗漏素材
-            JSONObject hisMatParams = formatHisMatParams(strategy,materialList,"补充遗漏素材");
-        }else{
+            JSONObject hisMatParams = formatHisMatParams(strategy, materialList, "补充遗漏素材");
+        } else {
             //
             //
 
 
         }
         }
@@ -130,10 +140,10 @@ public class AiKuaishouAdvertiserStrategyServiceImpl extends ServiceImpl<AiKuais
 
 
     private JSONObject formatHisMatParams(AiKuaishouAdvertiserStrategy strategy, List<JSONObject> materialList, String fixString) {
     private JSONObject formatHisMatParams(AiKuaishouAdvertiserStrategy strategy, List<JSONObject> materialList, String fixString) {
         JSONObject result = new JSONObject();
         JSONObject result = new JSONObject();
-        result.put("video",materialList);
-        result.put("operation_type",1);
-        result.put("account_id",strategy.getAccountId());
-        result.put("ai_strategy_remark",fixString);
+        result.put("video", materialList);
+        result.put("operation_type", 1);
+        result.put("account_id", strategy.getAccountId());
+        result.put("ai_strategy_remark", fixString);
 
 
         return result;
         return result;
     }
     }

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

@@ -8,19 +8,43 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
-import cn.com.ctop.kuaishou.modules.ai.entity.*;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaiShouAppInfo;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouCampaignLevelOperationRecord;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouCreativeLevelOperationRecord;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouUnitLevelOperationRecord;
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaiShouAppMultipleBids;
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAccountCreativeOverrunInfo;
 import cn.com.ctop.kuaishou.modules.ai.enums.KuaishouCreativeAdsenceTypeEnum;
 import cn.com.ctop.kuaishou.modules.ai.enums.KuaishouCreativeAdsenceTypeEnum;
 import cn.com.ctop.kuaishou.modules.ai.enums.KuaishouCreativeMatTypeEnum;
 import cn.com.ctop.kuaishou.modules.ai.enums.KuaishouCreativeMatTypeEnum;
-import cn.com.ctop.kuaishou.modules.ai.service.*;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaiShouAppInfoService;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouCampaignLevelOperationRecordService;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouCreateCreativeService;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouCreativeLevelOperationRecordService;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouUnitLevelOperationRecordService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaiShouAppMultipleBidsService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAccountCreativeOverrunInfoService;
+import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouLandpagePackageService;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
-import cn.com.ctop.kuaishou.modules.batch.service.*;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAppListService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel;
+import cn.com.ctop.kuaishou.modules.channel.service.IKuaishouChannelService;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.RedisUtil;
 import org.jeecg.common.util.RedisUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
@@ -29,7 +53,14 @@ import org.springframework.stereotype.Service;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.ParseException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.UUID;
 
 
 @Slf4j
 @Slf4j
 @Service
 @Service
@@ -64,6 +95,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     private IKuaishouLandpagePackageService landpagePackageService;
     private IKuaishouLandpagePackageService landpagePackageService;
     @Autowired
     @Autowired
     private IKuaiShouAppMultipleBidsService kuaiShouAppMultipleBidsService;
     private IKuaiShouAppMultipleBidsService kuaiShouAppMultipleBidsService;
+    @Autowired
+    private IKuaishouChannelService channelService;
 
 
 
 
     /**
     /**
@@ -117,7 +150,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                             log.info("账户:{},{} 到 {} 未获取到相应素材({})", accountId, startTime, endTime, replaceString);
                             log.info("账户:{},{} 到 {} 未获取到相应素材({})", accountId, startTime, endTime, replaceString);
                             continue;
                             continue;
                         }
                         }
-                        Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN", createType, appInfo.getAppId(), strategyUuid);
+                        Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN", createType, appInfo.getAppId(), strategyUuid, null);
                         for (KuaiShouVideoGet videoItem : allVideos) {
                         for (KuaiShouVideoGet videoItem : allVideos) {
                             Boolean unitOverrun = getUnitOverrun(accountId);
                             Boolean unitOverrun = getUnitOverrun(accountId);
                             if (unitOverrun) {
                             if (unitOverrun) {
@@ -137,8 +170,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                                 continue;
                                 continue;
                             }
                             }
                             //开始创建组+创意
                             //开始创建组+创意
-                            String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appInfo.getAppId());
-                            JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
+                            String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appInfo.getAppId(), null);
+                            JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId(), null);
                             log.info("创建广告组入参:{}", unitParams);
                             log.info("创建广告组入参:{}", unitParams);
                             Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                             Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                             Integer unitCode = (Integer) unitCreateResult.get("code");
                             Integer unitCode = (Integer) unitCreateResult.get("code");
@@ -164,7 +197,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                             unitLevelOperationRecord.setUnitId(unitId);
                             unitLevelOperationRecord.setUnitId(unitId);
                             unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
                             unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
                             videoCnt--;
                             videoCnt--;
-                            JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy);
+                            JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy, null);
                             createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, appInfo.getAppVersion());
                             createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, appInfo.getAppVersion());
                             if (videoCnt <= 0) {
                             if (videoCnt <= 0) {
                                 return videoCnt;
                                 return videoCnt;
@@ -209,10 +242,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                             log.info("该账户创意创建已超限=>accountId:{}", accountId);
                             log.info("该账户创意创建已超限=>accountId:{}", accountId);
                             return 0L;
                             return 0L;
                         }
                         }
-                        Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
+                        Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid, null);
                         //开始创建组+创意
                         //开始创建组+创意
-                        String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appId);
-                        JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
+                        String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appId, null);
+                        JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId, null);
                         unitParams.remove("cpa_bid");
                         unitParams.remove("cpa_bid");
                         unitParams.put("cpa_bid", multipleBids.getCpaBid());
                         unitParams.put("cpa_bid", multipleBids.getCpaBid());
                         if (!Check.isNull(multipleBids.getDeepConversionBid())) {
                         if (!Check.isNull(multipleBids.getDeepConversionBid())) {
@@ -245,7 +278,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         unitLevelOperationRecord.setUnitId(unitId);
                         unitLevelOperationRecord.setUnitId(unitId);
                         unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
                         unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
                         videoCnt--;
                         videoCnt--;
-                        JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy);
+                        JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy, null);
                         createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, null);
                         createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, null);
                         if (videoCnt <= 0) {
                         if (videoCnt <= 0) {
                             return videoCnt;
                             return videoCnt;
@@ -262,19 +295,47 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 return videoCnt;
                 return videoCnt;
             }
             }
             Long appId = null;
             Long appId = null;
+            String appName = null;
             if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
             if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
                 appId = JSONArray.parseArray(strategy.getAppIdArray()).getLong(0);
                 appId = JSONArray.parseArray(strategy.getAppIdArray()).getLong(0);
                 if (Check.isNull(appId)) {
                 if (Check.isNull(appId)) {
                     return videoCnt;
                     return videoCnt;
                 }
                 }
+                KuaiShouAppList appInfo = appListService.getAppInfo(accountId, appId);
+                if (!Check.isNull(appInfo)) {
+                    appName = appInfo.getAppName();
+                }
             }
             }
-            Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
+            //渠道号应用层级,account-账户,plan-计划,group-组
+            String level = strategy.getUsageLevel();
+            Integer useChannel = strategy.getUseChannel();//0不使用,1使用
+            KuaishouChannel channel = null;
+            if (!Check.isNull(useChannel) && useChannel == 1 && ("account".equals(level) || "plan".equals(level))) {
+                try {
+                    Result<Object> result = channelService.queryChannel(accountId, level, appName);
+                    Integer code = result.getCode();
+                    if (code == 200) {
+                        channel = (KuaishouChannel) result.getResult();
+                        if (Check.isNull(channel)) {
+                            log.info("账户:{},{}", accountId, result.getMessage());
+                            return videoCnt;
+                        } else {
+                            log.info("获取渠道号:{}", channel.getChannelCode());
+                        }
+                    } else {
+                        log.error("通过账户(" + accountId + ")未获取到渠道号!!!");
+                        return videoCnt;
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+            Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid, channel);
             if (null == newCampaignId) {
             if (null == newCampaignId) {
                 return videoCnt;
                 return videoCnt;
             }
             }
             //3、在“上新”计划中新增广告组,一个素材搭配n张封面,组成一个广告组
             //3、在“上新”计划中新增广告组,一个素材搭配n张封面,组成一个广告组
             for (KuaiShouVideoGet videoItem : newVideos) {
             for (KuaiShouVideoGet videoItem : newVideos) {
-
                 Boolean unitOverrun = getUnitOverrun(accountId);
                 Boolean unitOverrun = getUnitOverrun(accountId);
                 if (unitOverrun) {
                 if (unitOverrun) {
                     log.error("组创建超限,accountId:{}", accountId);
                     log.error("组创建超限,accountId:{}", accountId);
@@ -291,8 +352,29 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                     log.info("未获取到视频封面=>videoSignature:{}", videoItem.getSignature());
                     log.info("未获取到视频封面=>videoSignature:{}", videoItem.getSignature());
                     continue;
                     continue;
                 }
                 }
-                String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appId);
-                JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
+                //获取组级渠道号
+                if (!Check.isNull(useChannel) && useChannel == 1 && "group".equals(level)) {
+                    try {
+                        Result<Object> result = channelService.queryChannel(accountId, level, appName);
+                        Integer code = result.getCode();
+                        if (code == 200) {
+                            channel = (KuaishouChannel) result.getResult();
+                            if (Check.isNull(channel)) {
+                                log.info("(组级)账户:{},{}", accountId, result.getMessage());
+                                continue;
+                            } else {
+                                log.info("(组级)获取到渠道号:{}", channel.getChannelCode());
+                            }
+                        } else {
+                            log.error("(组级)通过账户(" + accountId + ")未获取到渠道号!!!");
+                            continue;
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+                String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appId, channel);
+                JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId, channel);
                 log.info("创建广告组入参:{}", unitParams);
                 log.info("创建广告组入参:{}", unitParams);
                 Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                 Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                 Integer unitCode = (Integer) unitCreateResult.get("code");
                 Integer unitCode = (Integer) unitCreateResult.get("code");
@@ -312,13 +394,19 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 if (unitCode != 0) {
                 if (unitCode != 0) {
                     log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
                     log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
                     unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
                     unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
+                    if (!Check.isNull(channel)) {
+                        channelService.callBackUpdateChannelRel(level, channel.getChannelCode(), accountId, newCampaignId, null,0);
+                    }
                     continue;
                     continue;
                 }
                 }
                 Long unitId = (Long) unitCreateResult.get("unitId");
                 Long unitId = (Long) unitCreateResult.get("unitId");
                 unitLevelOperationRecord.setUnitId(unitId);
                 unitLevelOperationRecord.setUnitId(unitId);
                 unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
                 unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
                 videoCnt--;
                 videoCnt--;
-                JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy);
+                if (!Check.isNull(channel)) {
+                    channelService.callBackUpdateChannelRel(level, channel.getChannelCode(), accountId, newCampaignId, unitId,1);
+                }
+                JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy, channel);//TODO 添加素材
                 createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, null);
                 createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, null);
                 if (videoCnt <= 0) {
                 if (videoCnt <= 0) {
                     return 0L;
                     return 0L;
@@ -408,7 +496,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                             log.info("该账户创意创建已超限=>accountId:{}", accountId);
                             log.info("该账户创意创建已超限=>accountId:{}", accountId);
                             return;
                             return;
                         }
                         }
-                        Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN", createType, appInfo.getAppId(), strategyUuid);
+                        Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN", createType, appInfo.getAppId(), strategyUuid, null);
                         //创建组+创意
                         //创建组+创意
                         List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
                         List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
                         for (int j = 1; j < splitVideos.size() + 1; j++) {
                         for (int j = 1; j < splitVideos.size() + 1; j++) {
@@ -421,8 +509,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                                 }
                                 }
                             }
                             }
                             //创建组
                             //创建组
-                            String unitName = getName(strategy.getGroupName(), strategy, createType, null, "unit", newCampaignId, appInfo.getAppId());
-                            JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
+                            String unitName = getName(strategy.getGroupName(), strategy, createType, null, "unit", newCampaignId, appInfo.getAppId(), null);
+                            JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId(), null);
                             log.info("创建广告组入参:{}", unitParams);
                             log.info("创建广告组入参:{}", unitParams);
                             Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                             Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                             Integer unitCode = (Integer) unitCreateResult.get("code");
                             Integer unitCode = (Integer) unitCreateResult.get("code");
@@ -447,7 +535,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                             Long unitId = (Long) unitCreateResult.get("unitId");
                             Long unitId = (Long) unitCreateResult.get("unitId");
                             unitLevelOperationRecord.setUnitId(unitId);
                             unitLevelOperationRecord.setUnitId(unitId);
                             unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
                             unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
-                            JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, appInfo.getAppVersion());
+                            JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, appInfo.getAppVersion(), null);
                             createProgramCreative(token, creativeParams, strategy);
                             createProgramCreative(token, creativeParams, strategy);
                         }
                         }
                     }
                     }
@@ -491,10 +579,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                             if (!Check.isNull(multipleBids.getTrackUrl())) {
                             if (!Check.isNull(multipleBids.getTrackUrl())) {
                                 strategy.setClickTrackUrl(multipleBids.getTrackUrl());
                                 strategy.setClickTrackUrl(multipleBids.getTrackUrl());
                             }
                             }
-                            Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
+                            Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid, null);
                             //创建组
                             //创建组
-                            String unitName = getName(strategy.getGroupName(), strategy, createType, videoGet.getPhotoName(), "unit", newCampaignId, appId);
-                            JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
+                            String unitName = getName(strategy.getGroupName(), strategy, createType, videoGet.getPhotoName(), "unit", newCampaignId, appId, null);
+                            JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId, null);
                             unitParams.remove("cpa_bid");
                             unitParams.remove("cpa_bid");
                             unitParams.put("cpa_bid", multipleBids.getCpaBid());
                             unitParams.put("cpa_bid", multipleBids.getCpaBid());
                             if (!Check.isNull(multipleBids.getDeepConversionBid())) {
                             if (!Check.isNull(multipleBids.getDeepConversionBid())) {
@@ -527,7 +615,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                             Long unitId = (Long) unitCreateResult.get("unitId");
                             Long unitId = (Long) unitCreateResult.get("unitId");
                             unitLevelOperationRecord.setUnitId(unitId);
                             unitLevelOperationRecord.setUnitId(unitId);
                             unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
                             unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
-                            JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, null);
+                            JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, null, null);
                             createProgramCreative(token, creativeParams, strategy);
                             createProgramCreative(token, creativeParams, strategy);
                         }
                         }
                     }
                     }
@@ -541,6 +629,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 return;
                 return;
             }
             }
             Long appId = null;
             Long appId = null;
+            String appName = null;
             String appIdString = strategy.getAppIdArray();
             String appIdString = strategy.getAppIdArray();
             if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
             if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
                 if (!Check.isNull(appIdString) && !Check.isNull(JSON.parseArray(appIdString))) {
                 if (!Check.isNull(appIdString) && !Check.isNull(JSON.parseArray(appIdString))) {
@@ -548,9 +637,37 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                     if (Check.isNull(appId)) {
                     if (Check.isNull(appId)) {
                         return;
                         return;
                     }
                     }
+                    KuaiShouAppList appInfo = appListService.getAppInfo(accountId, appId);
+                    if (!Check.isNull(appInfo)) {
+                        appName = appInfo.getAppName();
+                    }
                 }
                 }
             }
             }
-            Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid);
+            //渠道号应用层级,account-账户,plan-计划,group-组
+            String level = strategy.getUsageLevel();
+            Integer useChannel = strategy.getUseChannel();//0不使用,1使用
+            KuaishouChannel channel = null;
+            if (!Check.isNull(useChannel) && useChannel == 1 && ("account".equals(level) || "plan".equals(level))) {
+                try {
+                    Result<Object> result = channelService.queryChannel(accountId, level, appName);
+                    Integer code = result.getCode();
+                    if (code == 200) {
+                        channel = (KuaishouChannel) result.getResult();
+                        if (Check.isNull(channel)) {
+                            log.info("账户:{},{}", accountId, result.getMessage());
+                            return;
+                        } else {
+                            log.info("获取渠道号:{}", channel.getChannelCode());
+                        }
+                    } else {
+                        log.error("通过账户(" + accountId + ")未获取到渠道号!!!");
+                        return;
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+            Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY", createType, appId, strategyUuid, channel);
             if (null == newCampaignId) {
             if (null == newCampaignId) {
                 return;
                 return;
             }
             }
@@ -571,9 +688,31 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         return;
                         return;
                     }
                     }
                 }
                 }
+                //获取组级渠道号
+                if (!Check.isNull(useChannel) && useChannel == 1 && "group".equals(level)) {
+                    try {
+                        Result<Object> result = channelService.queryChannel(accountId, level, appName);
+                        Integer code = result.getCode();
+                        if (code == 200) {
+                            channel = (KuaishouChannel) result.getResult();
+                            if (Check.isNull(channel)) {
+                                log.info("(组级)账户:{},{}", accountId, result.getMessage());
+                                continue;
+                            } else {
+                                log.info("(组级)获取到渠道号:{}", channel.getChannelCode());
+                            }
+                        } else {
+                            log.error("(组级)通过账户(" + accountId + ")未获取到渠道号!!!");
+                            continue;
+                        }
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+
                 //创建组
                 //创建组
-                String unitName = getName(strategy.getGroupName(), strategy, createType, null, "unit", newCampaignId, appId);
-                JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
+                String unitName = getName(strategy.getGroupName(), strategy, createType, null, "unit", newCampaignId, appId, channel);
+                JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId, channel);
                 log.info("创建广告组入参:{}", unitParams);
                 log.info("创建广告组入参:{}", unitParams);
                 Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                 Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                 Integer unitCode = (Integer) unitCreateResult.get("code");
                 Integer unitCode = (Integer) unitCreateResult.get("code");
@@ -593,12 +732,18 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 if (unitCode != 0) {
                 if (unitCode != 0) {
                     log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
                     log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
                     unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
                     unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
+                    if (!Check.isNull(channel)) {
+                        channelService.callBackUpdateChannelRel(level, channel.getChannelCode(), accountId, newCampaignId, null,0);
+                    }
                     return;
                     return;
                 }
                 }
                 Long unitId = (Long) unitCreateResult.get("unitId");
                 Long unitId = (Long) unitCreateResult.get("unitId");
                 unitLevelOperationRecord.setUnitId(unitId);
                 unitLevelOperationRecord.setUnitId(unitId);
                 unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
                 unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
-                JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, null);
+                if (!Check.isNull(channel)) {
+                    channelService.callBackUpdateChannelRel(level, channel.getChannelCode(), accountId, newCampaignId, unitId,1);
+                }
+                JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, null, channel);
                 createProgramCreative(token, creativeParams, strategy);
                 createProgramCreative(token, creativeParams, strategy);
             }
             }
         }
         }
@@ -707,7 +852,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         }
         }
     }
     }
 
 
-    private JSONObject programCreativeParams(CtopOauthToken token, Long unitId, List<KuaiShouVideoGet> list, AiKuaishouAdvertiserStrategy strategy, Integer creativeCnt, String appVersion) {
+    private JSONObject programCreativeParams(CtopOauthToken token, Long unitId, List<KuaiShouVideoGet> list, AiKuaishouAdvertiserStrategy strategy, Integer creativeCnt, String appVersion, KuaishouChannel channel) {
         JSONObject programJson = new JSONObject();
         JSONObject programJson = new JSONObject();
         programJson.put("advertiser_id", token.getAccountId());
         programJson.put("advertiser_id", token.getAccountId());
         programJson.put("unit_id", unitId);
         programJson.put("unit_id", unitId);
@@ -749,7 +894,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         programJson.put("cover_image_tokens", coverImageTokens);
         programJson.put("cover_image_tokens", coverImageTokens);
 
 
         if (!Check.isNull(strategy.getSiteId())) {
         if (!Check.isNull(strategy.getSiteId())) {
-            if (!strategy.getSiteId().equals("-1") ) {
+            if (!strategy.getSiteId().equals("-1")) {
                 programJson.put("site_id", strategy.getSiteId());
                 programJson.put("site_id", strategy.getSiteId());
             }
             }
 
 
@@ -764,10 +909,15 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (!Check.isNull(strategy.getClickTrackUrl())) {
         if (!Check.isNull(strategy.getClickTrackUrl())) {
             programJson.put("click_url", strategy.getClickTrackUrl());
             programJson.put("click_url", strategy.getClickTrackUrl());
         }
         }
+        if (!Check.isNull(channel) && !Check.isNull(channel.getActionbarClickUrl())) {
+            programJson.put("click_url", channel.getActionbarClickUrl());
+        }
         if (!Check.isNull(strategy.getActionbarClickUrl())) {
         if (!Check.isNull(strategy.getActionbarClickUrl())) {
             programJson.put("actionbar_click_url", strategy.getActionbarClickUrl());
             programJson.put("actionbar_click_url", strategy.getActionbarClickUrl());
         }
         }
-
+        if (!Check.isNull(channel) && !Check.isNull(channel.getActionbarClickUrl())) {
+            programJson.put("actionbar_click_url", channel.getActionbarClickUrl());
+        }
         JSONArray captions = getCaptions(strategy.getDescription());
         JSONArray captions = getCaptions(strategy.getDescription());
         programJson.put("captions", captions);
         programJson.put("captions", captions);
         if (!Check.isNull(strategy.getCreativeCategory())) {
         if (!Check.isNull(strategy.getCreativeCategory())) {
@@ -907,7 +1057,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     }
     }
 
 
 
 
-    private Long getCampaignId(AiKuaishouAdvertiserStrategy strategy, CtopOauthToken token, String replaceString, String checkType, Integer createType, Long appId, String uuid) {
+    private Long getCampaignId(AiKuaishouAdvertiserStrategy strategy, CtopOauthToken token, String replaceString, String checkType, Integer createType, Long appId, String uuid, KuaishouChannel channel) {
         Long campaignId = null;
         Long campaignId = null;
         if ("ALL_CAMPAIGN".equals(checkType)) {
         if ("ALL_CAMPAIGN".equals(checkType)) {
             campaignId = campaignService.getCampaignIdByAccountAndName(strategy.getAccountId(), replaceString);
             campaignId = campaignService.getCampaignIdByAccountAndName(strategy.getAccountId(), replaceString);
@@ -922,7 +1072,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         // 不存在“上新”计划,则创建一个计划
         // 不存在“上新”计划,则创建一个计划
         JSONObject campaignParams = new JSONObject();
         JSONObject campaignParams = new JSONObject();
         campaignParams.put("advertiser_id", token.getAccountId());
         campaignParams.put("advertiser_id", token.getAccountId());
-        String campaignName = getName(strategy.getCampaignName(), strategy, createType, null, "plan", null, appId);
+        String campaignName = getName(strategy.getCampaignName(), strategy, createType, null, "plan", null, appId, channel);
         campaignParams.put("campaign_name", campaignName);
         campaignParams.put("campaign_name", campaignName);
         campaignParams.put("type", strategy.getCampaignType());
         campaignParams.put("type", strategy.getCampaignType());
         if (null != strategy.getCampaignDayBudget() && strategy.getCampaignDayBudget() != 0) {
         if (null != strategy.getCampaignDayBudget() && strategy.getCampaignDayBudget() != 0) {
@@ -953,7 +1103,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     }
     }
 
 
     private JSONObject createUnitParams(CtopOauthToken token, Long campaignId, AiKuaishouAdvertiserStrategy strategy,
     private JSONObject createUnitParams(CtopOauthToken token, Long campaignId, AiKuaishouAdvertiserStrategy strategy,
-                                        String unitName, Long appId) {
+                                        String unitName, Long appId, KuaishouChannel channel) {
         // 拼装创建组的入参 json
         // 拼装创建组的入参 json
         JSONObject unitParams = new JSONObject();
         JSONObject unitParams = new JSONObject();
         Integer unitType = strategy.getUnitType();
         Integer unitType = strategy.getUnitType();
@@ -1019,10 +1169,16 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             if (!Check.isNull(appId)) {
             if (!Check.isNull(appId)) {
                 unitParams.put("app_id", appId);
                 unitParams.put("app_id", appId);
             }
             }
+            if (!Check.isNull(channel) && !Check.isNull(channel.getAppId())) {
+                unitParams.put("app_id", channel.getAppId());
+            }
             // 直达链接
             // 直达链接
             if (!Check.isNull(strategy.getSchemaUri())) {
             if (!Check.isNull(strategy.getSchemaUri())) {
                 unitParams.put("schema_uri", strategy.getSchemaUri());
                 unitParams.put("schema_uri", strategy.getSchemaUri());
             }
             }
+            if (!Check.isNull(channel) && !Check.isNull(channel.getSchemaUri())) {
+                unitParams.put("schema_uri", channel.getSchemaUri());
+            }
             // 优先从系统应用商店下载
             // 优先从系统应用商店下载
             if (null != strategy.getUseAppMarket()) {
             if (null != strategy.getUseAppMarket()) {
                 unitParams.put("use_app_market", strategy.getUseAppMarket());
                 unitParams.put("use_app_market", strategy.getUseAppMarket());
@@ -1426,7 +1582,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         return imageGet.getImageToken();
         return imageGet.getImageToken();
     }
     }
 
 
-    private JSONObject creativeParams(CtopOauthToken token, Long unitId, KuaiShouVideoGet videoItem, AiKuaishouAdvertiserStrategy strategy) {
+    private JSONObject creativeParams(CtopOauthToken token, Long unitId, KuaiShouVideoGet videoItem, AiKuaishouAdvertiserStrategy strategy, KuaishouChannel channel) {
         JSONObject creativeParams = new JSONObject();
         JSONObject creativeParams = new JSONObject();
         creativeParams.put("advertiser_id", token.getAccountId());
         creativeParams.put("advertiser_id", token.getAccountId());
         creativeParams.put("unit_id", unitId);
         creativeParams.put("unit_id", unitId);
@@ -1455,13 +1611,16 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         }
         }
         // 安卓下载中间页ID
         // 安卓下载中间页ID
         if (!Check.isNull(strategy.getSiteId())) {
         if (!Check.isNull(strategy.getSiteId())) {
-            if (!strategy.getSiteId().equals("-1") ) {
+            if (!strategy.getSiteId().equals("-1")) {
                 creativeParams.put("site_id", strategy.getSiteId());
                 creativeParams.put("site_id", strategy.getSiteId());
             }
             }
         }
         }
         if (null != strategy.getClickTrackUrl() && !"".equals(strategy.getClickTrackUrl())) {
         if (null != strategy.getClickTrackUrl() && !"".equals(strategy.getClickTrackUrl())) {
             creativeParams.put("click_track_url", strategy.getClickTrackUrl());
             creativeParams.put("click_track_url", strategy.getClickTrackUrl());
         }
         }
+        if (!Check.isNull(channel) && !Check.isNull(channel.getClickTrackUrl())) {
+            creativeParams.put("click_track_url", channel.getClickTrackUrl());
+        }
         if (null != strategy.getImpressionUrl() && !"".equals(strategy.getImpressionUrl())) {
         if (null != strategy.getImpressionUrl() && !"".equals(strategy.getImpressionUrl())) {
             creativeParams.put("impression_url", strategy.getImpressionUrl());
             creativeParams.put("impression_url", strategy.getImpressionUrl());
         }
         }
@@ -1472,6 +1631,9 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (null != strategy.getActionbarClickUrl() && !"".equals(strategy.getActionbarClickUrl())) {
         if (null != strategy.getActionbarClickUrl() && !"".equals(strategy.getActionbarClickUrl())) {
             creativeParams.put("actionbar_click_url", strategy.getActionbarClickUrl());
             creativeParams.put("actionbar_click_url", strategy.getActionbarClickUrl());
         }
         }
+        if (!Check.isNull(channel) && !Check.isNull(channel.getActionbarClickUrl())) {
+            creativeParams.put("actionbar_click_url", channel.getActionbarClickUrl());
+        }
         if (null != strategy.getCreativeCategory()) {
         if (null != strategy.getCreativeCategory()) {
             creativeParams.put("creative_category", strategy.getCreativeCategory());
             creativeParams.put("creative_category", strategy.getCreativeCategory());
         }
         }
@@ -1534,7 +1696,16 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     private IKuaiShouAppListService appListService;
     private IKuaiShouAppListService appListService;
 
 
 
 
-    private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy, Integer createType, String materialName, String type, Long campaignId, Long appId) {
+    private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy, Integer createType, String materialName, String type, Long campaignId, Long appId, KuaishouChannel channel) {
+        if (wildcard.contains("{{渠道号}}") || wildcard.contains("{{渠道号名称}}")) {
+            if (Check.isNull(channel)) {
+                wildcard = wildcard.replace("{{渠道号}}", "");
+                wildcard = wildcard.replace("{{渠道号名称}}", "");
+            } else {
+                wildcard = wildcard.replace("{{渠道号}}", channel.getChannelCode());
+                wildcard = wildcard.replace("{{渠道号名称}}", channel.getChannelName());
+            }
+        }
         if (wildcard.contains("{{应用名称}}") || wildcard.contains("{{应用标记}}")) {
         if (wildcard.contains("{{应用名称}}") || wildcard.contains("{{应用标记}}")) {
             KuaiShouAppList getAppInfo = appListService.getAppInfo(strategy.getAccountId(), appId);
             KuaiShouAppList getAppInfo = appListService.getAppInfo(strategy.getAccountId(), appId);
             if (!Check.isNull(getAppInfo)) {
             if (!Check.isNull(getAppInfo)) {

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

@@ -320,7 +320,8 @@ public class KuaishouAppPackageServiceImpl extends ServiceImpl<KuaishouAppPackag
     /**
     /**
      * 获取图片token
      * 获取图片token
      */
      */
-    private JSONObject getImageToken(String md5, Long accountId, CtopOauthToken oauthToken) {
+    @Override
+    public JSONObject getImageToken(String md5, Long accountId, CtopOauthToken oauthToken) {
         JSONObject request = new JSONObject();
         JSONObject request = new JSONObject();
         if (!Check.isNull(md5)) {
         if (!Check.isNull(md5)) {
             QueryWrapper<KuaiShouImageGet> queryWrapper = new QueryWrapper<>();
             QueryWrapper<KuaiShouImageGet> queryWrapper = new QueryWrapper<>();

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

@@ -19,7 +19,14 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
 import java.util.Arrays;
@@ -70,6 +77,28 @@ public class KuaiShouAppListController {
         return result;
         return result;
     }
     }
 
 
+    @PostMapping(value = "/getAppNames")
+    public Result<List<KuaiShouAppList>> getAppNames(@RequestBody JSONObject requestJson) {
+        Result<List<KuaiShouAppList>> result = new Result<>();
+        try {
+            if (Check.isNull(requestJson.getJSONArray("appIdArray"))) {
+                throw new Exception("请选择应用id");
+            }
+            JSONArray appIds = requestJson.getJSONArray("appIdArray");
+            if (Check.isNull(appIds)) {
+                throw new Exception("应用id列表不能为空");
+            }
+            List<KuaiShouAppList> list = kuaiShouAppListService.getAppNames(appIds);
+            result.setResult(list);
+            result.setSuccess(true);
+            result.setMessage("刷新成功");
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.success(e.getMessage());
+        }
+        return result;
+    }
+
 
 
     /**
     /**
      * 分页列表查询
      * 分页列表查询

+ 3 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouAppListMapper.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
@@ -15,4 +16,6 @@ import java.util.List;
 public interface KuaiShouAppListMapper extends BaseMapper<KuaiShouAppList> {
 public interface KuaiShouAppListMapper extends BaseMapper<KuaiShouAppList> {
 
 
     void replaceBatch(@Param("addList") List<KuaiShouAppList> addList);
     void replaceBatch(@Param("addList") List<KuaiShouAppList> addList);
+
+    List<KuaiShouAppList> getAppNames(@Param("appIds") JSONArray appIds);
 }
 }

+ 10 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouAppListMapper.xml

@@ -31,4 +31,14 @@
         </foreach>
         </foreach>
     </insert>
     </insert>
 
 
+    <select id="getAppNames" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList">
+        SELECT account_id,app_id,app_version,app_name,package_name
+        FROM ctop_kuaishou_app_list
+        WHERE app_id IN
+        <foreach collection="appIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+    </select>
+
 </mapper>
 </mapper>

+ 7 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouAppListService.java

@@ -1,8 +1,11 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 package cn.com.ctop.kuaishou.modules.batch.service;
 
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 
+import java.util.List;
+
 /**
 /**
  * @Description: 快手-应用列表
  * @Description: 快手-应用列表
  * @Author: jeecg-boot
  * @Author: jeecg-boot
@@ -12,4 +15,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 public interface IKuaiShouAppListService extends IService<KuaiShouAppList> {
 public interface IKuaiShouAppListService extends IService<KuaiShouAppList> {
 
 
     KuaiShouAppList getAppInfo(Long accountId, Long appId);
     KuaiShouAppList getAppInfo(Long accountId, Long appId);
+
+    List<KuaiShouAppList> getAppListByAccountId(Long accountId);
+
+    List<KuaiShouAppList> getAppNames(JSONArray appIds);
 }
 }

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

@@ -3,10 +3,14 @@ package cn.com.ctop.kuaishou.modules.batch.service.impl;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAppListMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAppListMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAppListService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAppListService;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.util.List;
+
 /**
 /**
  * @Description: 快手-应用列表
  * @Description: 快手-应用列表
  * @Author: jeecg-boot
  * @Author: jeecg-boot
@@ -16,6 +20,8 @@ import org.springframework.stereotype.Service;
 @Service
 @Service
 public class KuaiShouAppListServiceImpl extends ServiceImpl<KuaiShouAppListMapper, KuaiShouAppList> implements IKuaiShouAppListService {
 public class KuaiShouAppListServiceImpl extends ServiceImpl<KuaiShouAppListMapper, KuaiShouAppList> implements IKuaiShouAppListService {
 
 
+    @Autowired
+    private KuaiShouAppListMapper shouAppListMapper;
     @Override
     @Override
     public KuaiShouAppList getAppInfo(Long accountId, Long appId) {
     public KuaiShouAppList getAppInfo(Long accountId, Long appId) {
         QueryWrapper<KuaiShouAppList> queryWrapper = new QueryWrapper<>();
         QueryWrapper<KuaiShouAppList> queryWrapper = new QueryWrapper<>();
@@ -25,4 +31,17 @@ public class KuaiShouAppListServiceImpl extends ServiceImpl<KuaiShouAppListMappe
         queryWrapper.last("limit 1");
         queryWrapper.last("limit 1");
         return this.getOne(queryWrapper);
         return this.getOne(queryWrapper);
     }
     }
+
+    @Override
+    public List<KuaiShouAppList> getAppListByAccountId(Long accountId) {
+        QueryWrapper<KuaiShouAppList> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
+        queryWrapper.eq("platform", 1);
+        return this.list(queryWrapper);
+    }
+
+    @Override
+    public List<KuaiShouAppList> getAppNames(JSONArray appIds) {
+        return shouAppListMapper.getAppNames(appIds);
+    }
 }
 }

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

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

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

@@ -0,0 +1,415 @@
+package cn.com.ctop.kuaishou.modules.channel.controller;
+
+import cn.com.ctop.common.module.service.ISysRoleExtService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel;
+import cn.com.ctop.kuaishou.modules.channel.service.IKuaishouChannelService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.pagehelper.PageHelper;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+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.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.ResponseBody;
+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.OutputStream;
+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-08-30
+ */
+@Slf4j
+@Api(tags = "渠道号信息表")
+@RestController
+@RequestMapping("/channel")
+public class KuaishouChannelController {
+    @Autowired
+    private IKuaishouChannelService kuaishouChannelService;
+    @Autowired
+    private ISysRoleExtService sysRoleService;
+
+    /**
+     * 查询渠道号管理首页数据
+     */
+    @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) {
+        try {
+            String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+            if ("admin".equals(roleCode) || "sale".contains(roleCode) || "meidaManager".equals(roleCode)) {
+                userId = null;
+            }
+
+            PageHelper.startPage(pageNo, pageSize);
+            return kuaishouChannelService.channelManagementHome(productId, projectId, accountId, userId);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("查询渠道号管理首页数据异常");
+        }
+    }
+
+
+    /**
+     * 渠道号详情
+     */
+    @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())) {
+                return Result.error("请选择账户");
+            }
+            return kuaishouChannelService.channelNumberDetails(kuaishouChannel, pageNo, pageSize);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("查询渠道号详情异常");
+        }
+    }
+
+
+    /**
+     * 渠道号使用详情列表
+     */
+    @GetMapping(value = "/channelNumberUsageDetailsList")
+    public Result<Object> channelNumberUsageDetailsList(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.getChannelCode())) {
+                return Result.error("缺失参数");
+            }
+            return kuaishouChannelService.channelNumberUsageDetailsList(kuaishouChannel, pageNo, pageSize);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("查询渠道号详情异常");
+        }
+    }
+
+
+    /**
+     * 渠道号绑定单品列表页
+     */
+    @PostMapping(value = "/channelNumberBindingItemInfo")
+    public Result<Object> channelNumberBindingItemInfo(@RequestBody JSONObject request) {
+        try {
+            if (request.isEmpty()) {
+                return Result.error("请选择信息");
+            }
+            JSONArray ids = request.getJSONArray("ids");
+            return kuaishouChannelService.channelNumberBindingItemInfo(ids);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("查询渠道号绑定单品列表异常");
+        }
+    }
+
+
+    /**
+     * 修改渠道号
+     */
+    @GetMapping(value = "/updateChannel")
+    public Result<Object> updateChannel(KuaishouChannel channel) {
+        try {
+            if (Check.isNull(channel.getId())) {
+                return Result.error("缺失参数");
+            }
+            KuaishouChannel kuaishouChannelEntity = kuaishouChannelService.getById(channel.getId());
+            if (kuaishouChannelEntity == null) {
+                return Result.error("未找到对应实体");
+            } else {
+                kuaishouChannelService.updateById(channel);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("修改渠道号异常");
+        }
+        return Result.ok("修改成功");
+    }
+
+    /**
+     * 导出单品模板
+     */
+    @GetMapping("/exportChannelTemplate")
+    public Result<Object> getExcel(HttpServletResponse response, Long projectId, Long productId, String userId) {
+        try {
+            if (Check.isNull(projectId) || Check.isNull(productId)) {
+                return Result.error("缺少参数");
+            }
+            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监测链接(选填)"};
+            List<List<Object>> list = new ArrayList<>();
+            List<Object> ids = new ArrayList<>();
+            ids.add(productId);//产品
+            ids.add(projectId);//项目
+            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(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");
+            workbook.write(os);
+            os.flush();
+            os.close();
+        } catch (IOException e) {
+            log.error(e.getMessage());
+        }
+        return Result.ok("success");
+    }
+
+    /**
+     * 系统批量创建渠道号
+     */
+    @PostMapping(value = "/systemBatchCreation")
+    public Result<Object> systemBatchCreation(@RequestBody JSONObject request) {
+        try {
+            return kuaishouChannelService.systemBatchCreation(request);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("系统批量创建渠道号异常", e);
+            return Result.error("系统批量创建渠道号失败," + e.getMessage());
+        }
+    }
+
+
+    /**
+     * 导入渠道号EXCEL批量创建
+     */
+    @PostMapping(value = "/importChannelExcel")
+    @ResponseBody
+    public Result<Object> importChannelExcel(HttpServletResponse response, @RequestParam("file") MultipartFile file, @RequestParam("imageUrl") String imageUrl) {
+        response.setHeader("Access-Control-Allow-Origin", "*");
+        try {
+            if (Check.isNull(file) || Check.isNull(imageUrl)) {
+                return Result.error("请上传图标和文档");
+            }
+            return kuaishouChannelService.importChannelExcel(file, imageUrl);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("excel批量添加渠道号异常", e);
+            return Result.error("excel批量添加渠道号失败," + e.getMessage());
+        }
+    }
+
+    /**
+     * 定制创建渠道号
+     */
+    @PostMapping(value = "/customizedCreate")
+    public Result<Object> customizedCreate(@RequestBody JSONObject request) {
+        try {
+            return kuaishouChannelService.customizedCreate(request, 3);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("定制创建渠道号异常", e);
+            return Result.error("定制创建渠道号失败," + e.getMessage());
+        }
+    }
+
+    /**
+     * 通过账户查询渠道号接口
+     */
+    @PostMapping(value = "/queryChannel")
+    public Result<Object> queryChannel(Long accountId, String usageLevel,String appName) {
+        try {
+            if (Check.isNull(accountId) || Check.isNull(usageLevel)|| Check.isNull(appName)) {
+                return Result.error("缺失参数");
+            }
+            return kuaishouChannelService.queryChannel(accountId, usageLevel,appName);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("通过账户查询渠道号异常", e);
+            return Result.error("通过账户查询渠道号失败," + e.getMessage());
+        }
+    }
+
+    /**
+     * 通过账户查询渠道号级别
+     */
+    @PostMapping(value = "/queryChannelLevel")
+    public Result<Object> queryChannelLevel(@RequestBody JSONObject request) {
+        try {
+            if (Check.isNull(request.getLong("accountId")) || Check.isNull(request.getJSONArray("appNameArray"))) {
+                return Result.error("缺失参数");
+            }
+            return kuaishouChannelService.queryChannelLevel(request);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("通过账户查询渠道号级别异常", e);
+            return Result.error("通过账户查询渠道号级别失败," + e.getMessage());
+        }
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "渠道号信息表-通过id删除", notes = "渠道号信息表-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            kuaishouChannelService.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<KuaishouChannel> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<KuaishouChannel> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaishouChannelService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "渠道号信息表-通过id查询", notes = "渠道号信息表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaishouChannel> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaishouChannel> result = new Result<>();
+        KuaishouChannel kuaishouChannel = kuaishouChannelService.getById(id);
+        if (kuaishouChannel == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaishouChannel);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaishouChannel> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaishouChannel kuaishouChannel = JSON.parseObject(deString, KuaishouChannel.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaishouChannel, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaishouChannel> pageList = kuaishouChannelService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "渠道号信息表列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaishouChannel.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<KuaishouChannel> listKuaishouChannels = ExcelImportUtil.importExcel(file.getInputStream(), KuaishouChannel.class, params);
+                kuaishouChannelService.saveBatch(listKuaishouChannels);
+                return Result.ok("文件导入成功!数据行数:" + listKuaishouChannels.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("文件导入失败!");
+    }
+
+}

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

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

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

@@ -0,0 +1,328 @@
+package cn.com.ctop.kuaishou.modules.channel.controller;
+
+import cn.com.ctop.common.module.service.ISysRoleExtService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelItems;
+import cn.com.ctop.kuaishou.modules.channel.service.IKuaishouChannelItemsService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.pagehelper.PageHelper;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+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.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.ResponseBody;
+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.OutputStream;
+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-08-30
+ */
+@Slf4j
+@Api(tags = "渠道号对应单品信息表")
+@RestController
+@RequestMapping("/channelItem")
+public class KuaishouChannelItemsController {
+    @Autowired
+    private IKuaishouChannelItemsService kuaishouChannelItemsService;
+    @Autowired
+    private ISysRoleExtService sysRoleService;
+
+    /**
+     * 查询单品列表
+     */
+    @GetMapping(value = "/queryChannelItemList")
+    public Result<Object> queryChannelItemList(KuaishouChannelItems kuaishouChannelItems, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        try {
+            String roleCode = sysRoleService.getRoleCodeByUserId(kuaishouChannelItems.getUserId());
+            if ("admin".equals(roleCode) || "sale".contains(roleCode) || "meidaManager".equals(roleCode)) {
+                kuaishouChannelItems.setUserId(null);
+            }
+            PageHelper.startPage(pageNo, pageSize);
+            return kuaishouChannelItemsService.queryChannelItemList(kuaishouChannelItems);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("查询单品列表异常");
+        }
+    }
+
+    /**
+     * 根据项目查询单品集合
+     */
+    @GetMapping(value = "/queryAllChannelItemByProjectId")
+    public Result<Object> queryAllChannelItemByProjectId(Long projectId) {
+        try {
+            if (Check.isNull(projectId)) {
+                return Result.error("请选择项目");
+            }
+            return kuaishouChannelItemsService.queryAllChannelItemByProjectId(projectId);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("根据项目查询单品集合异常");
+        }
+    }
+
+    /**
+     * 新增单品
+     *
+     * @return
+     */
+    @PostMapping(value = "/addChannelItem")
+    public Result<Object> addChannelItem(@RequestBody JSONArray request) {
+        try {
+            if (request.isEmpty()) {
+                return Result.error("请添加信息");
+            }
+            return kuaishouChannelItemsService.addChannelItem(request);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            return Result.error("新增单品异常");
+        }
+    }
+
+    /**
+     * 修改渠道号
+     */
+    @GetMapping(value = "/updateChannelItems")
+    public Result<Object> updateChannelItems(KuaishouChannelItems item) {
+        try {
+            if (Check.isNull(item.getId())) {
+                return Result.error("缺失参数");
+            }
+            KuaishouChannelItems itemEntity = kuaishouChannelItemsService.getById(item.getId());
+            if (itemEntity == null) {
+                return Result.error("未找到对应实体");
+            } else {
+                kuaishouChannelItemsService.updateById(item);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("修改渠道号异常");
+        }
+        return Result.ok("修改成功");
+    }
+
+    /**
+     * 渠道号绑定单品
+     */
+    @PostMapping(value = "/channelBindingItem")
+    public Result<Object> channelBindingItem(@RequestBody JSONArray request) {
+        try {
+            if (request.isEmpty()) {
+                return Result.error("请选择信息");
+            }
+            return kuaishouChannelItemsService.channelBindingItem(request);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("修改渠道号异常");
+        }
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "渠道号对应单品信息表-通过id删除", notes = "渠道号对应单品信息表-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            kuaishouChannelItemsService.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<KuaishouChannelItems> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<KuaishouChannelItems> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaishouChannelItemsService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "渠道号对应单品信息表-通过id查询", notes = "渠道号对应单品信息表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaishouChannelItems> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaishouChannelItems> result = new Result<>();
+        KuaishouChannelItems kuaishouChannelItems = kuaishouChannelItemsService.getById(id);
+        if (kuaishouChannelItems == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaishouChannelItems);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出单品模板
+     */
+    @GetMapping("/exportItemTemplate")
+    public Result<Object> getExcel(HttpServletResponse response, Long projectId) {
+        try {
+            if (Check.isNull(projectId)) {
+                return Result.error("请选择项目");
+            }
+            OutputStream os = response.getOutputStream();
+            ExportExcelUtils eeu = new ExportExcelUtils();
+            XSSFWorkbook workbook = new XSSFWorkbook();
+            String[] titles = {"项目", "单品名称", "素材关键词"};
+            List<List<Object>> list = new ArrayList<>();
+            List<Object> ids = new ArrayList<>();
+            ids.add(projectId);
+            list.add(ids);
+            eeu.exportExcelForAttendance(workbook, 0, "Sheet1", titles, list);
+            eeu.putResponseHeader(response, "单品模板.xlsx");
+            workbook.write(os);
+            os.flush();
+            os.close();
+        } catch (IOException e) {
+            log.error(e.getMessage());
+        }
+        return Result.ok("success");
+    }
+
+    /**
+     * 导入单品EXCEL批量创建
+     */
+    @PostMapping(value = "/importItemExcel")
+    @ResponseBody
+    public Result<Object> importItemExcel(HttpServletResponse response, @RequestParam("file") MultipartFile file) {
+        response.setHeader("Access-Control-Allow-Origin", "*");
+        try {
+            if (Check.isNull(file)) {
+                return Result.error("执行失败,请上传应用Excel文件");
+            }
+            return kuaishouChannelItemsService.importItemExcel(file);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("excel批量添加单品异常", e);
+            return Result.error("excel批量添加单品失败," + e.getMessage());
+        }
+    }
+
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaishouChannelItems> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaishouChannelItems kuaishouChannelItems = JSON.parseObject(deString, KuaishouChannelItems.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaishouChannelItems, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaishouChannelItems> pageList = kuaishouChannelItemsService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "渠道号对应单品信息表列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaishouChannelItems.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("渠道号对应单品信息表列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @returnexportAppTemplate
+     */
+    @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<KuaishouChannelItems> listKuaishouChannelItemss = ExcelImportUtil.importExcel(file.getInputStream(), KuaishouChannelItems.class, params);
+                kuaishouChannelItemsService.saveBatch(listKuaishouChannelItemss);
+                return Result.ok("文件导入成功!数据行数:" + listKuaishouChannelItemss.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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,205 @@
+package cn.com.ctop.kuaishou.modules.channel.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.util.Date;
+import java.util.List;
+
+/**
+ * 渠道号信息表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-08-30
+ */
+@Data
+@TableName("ctop_kuaishou_channel")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_channel对象", description = "渠道号信息表")
+public class KuaishouChannel {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 策略ID
+     */
+    private Long strategyId;
+    /**
+     * 项目id
+     */
+    @Excel(name = "项目id", width = 15)
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+    /**
+     * 产品ID
+     */
+    private Long productId;
+    /**
+     * 项目名称
+     */
+    @Excel(name = "项目名称", width = 15)
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
+    /**
+     * 产品名
+     */
+    @Excel(name = "产品名", width = 15)
+    @ApiModelProperty(value = "产品名")
+    private String productName;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+    /**
+     * 创建方式 1-批量,2-excel导入,3-自定义
+     */
+    @Excel(name = "创建方式 1-批量,2-excel导入,3-自定义", width = 15)
+    @ApiModelProperty(value = "创建方式 1-批量,2-excel导入,3-自定义")
+    private Integer createType;
+
+    /**
+     * 状态 0无效,1有效
+     */
+    private Integer state;
+
+    /**
+     * 使用范围,1账户,2项目
+     */
+    private Integer usageRange;
+    /**
+     * 渠道号锁 0 不可用,1可用
+     */
+    private Integer channelLock;
+
+    /**
+     * 创建人
+     */
+    @Excel(name = "创建人", width = 15)
+    @ApiModelProperty(value = "创建人")
+    private String userId;
+    /**
+     * 创建日期
+     */
+    @Excel(name = "创建日期", width = 15)
+    @ApiModelProperty(value = "创建日期")
+    private String stateDate;
+    /**
+     * 应用id
+     */
+    @Excel(name = "应用id", width = 15)
+    @ApiModelProperty(value = "应用id")
+    private Long appId;
+
+    /**
+     * 应用记录id
+     */
+    private Long channelAppInfoId;
+    /**
+     * 渠道号
+     */
+    @Excel(name = "渠道号", width = 15)
+    @ApiModelProperty(value = "渠道号")
+    private String channelCode;
+    /**
+     * 编号
+     */
+    private Long channelNumber;
+    /**
+     * 渠道名称
+     */
+    @Excel(name = "渠道名称", width = 15)
+    @ApiModelProperty(value = "渠道名称")
+    private String channelName;
+    /**
+     * 下载链接
+     */
+    @Excel(name = "下载链接", width = 15)
+    @ApiModelProperty(value = "下载链接")
+    private String url;
+    /**
+     * 调起链接
+     */
+    @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;
+    /**
+     * 使用范围层级,账户:account,计划:plan,组:group
+     */
+    @Excel(name = "使用范围层级,账户:account,计划:plan,组:group", width = 15)
+    @ApiModelProperty(value = "使用范围层级,账户:account,计划:plan,组:group")
+    private String usageLevel;
+    /**
+     * 已使用次数
+     */
+    @Excel(name = "已使用次数", width = 15)
+    @ApiModelProperty(value = "已使用次数")
+    private Integer usageTimes;
+    /**
+     * 是否循环重复使用 0:否,1:是
+     */
+    @Excel(name = "是否循环重复使用 0:否,1:是", width = 15)
+    @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")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+
+    @TableField(exist = false)
+    private String itemName;
+
+    @TableField(exist = false)
+    private List<KuaishouChannelItems> items;
+}

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

@@ -0,0 +1,135 @@
+package cn.com.ctop.kuaishou.modules.channel.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 渠道功能创建的应用记录
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-09-02
+ */
+@Data
+@TableName("ctop_kuaishou_channel_app_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_channel_app_info对象", description = "渠道功能创建的应用记录")
+public class KuaishouChannelAppInfo {
+
+    /**
+     * 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 appVersion;
+    /**
+     * 应用名称
+     */
+    @Excel(name = "应用名称", width = 15)
+    @ApiModelProperty(value = "应用名称")
+    private String appName;
+    /**
+     * 操作类型,add新增,update修改
+     */
+    private String type;
+    /**
+     * 应用包名
+     */
+    @Excel(name = "应用包名	", width = 15)
+    @ApiModelProperty(value = "应用包名	")
+    private String packageName;
+    /**
+     * 应用类型 1:Android应用下载,2:Android网页游戏,3:iOS应用下载,4:iOS网页游戏
+     */
+    @Excel(name = "应用类型 1:Android应用下载,2:Android网页游戏,3:iOS应用下载,4:iOS网页游戏", width = 15)
+    @ApiModelProperty(value = "应用类型 1:Android应用下载,2:Android网页游戏,3:iOS应用下载,4:iOS网页游戏")
+    private Integer platform;
+    /**
+     * 应用下载地址/网页游戏链接地址
+     */
+    @Excel(name = "应用下载地址/网页游戏链接地址	", width = 15)
+    @ApiModelProperty(value = "应用下载地址/网页游戏链接地址	")
+    private String url;
+    /**
+     * 是否接入快手广告监测SDK	 0:未接入,1:已接入
+     */
+    @Excel(name = "是否接入快手广告监测SDK	 0:未接入,1:已接入", width = 15)
+    @ApiModelProperty(value = "是否接入快手广告监测SDK	 0:未接入,1:已接入")
+    private Integer useSdk;
+    /**
+     * app隐私政策链接 安卓类应用必填
+     */
+    @Excel(name = "app隐私政策链接 安卓类应用必填", width = 15)
+    @ApiModelProperty(value = "app隐私政策链接 安卓类应用必填")
+    private String appPrivacyUrl;
+    /**
+     * 图标
+     */
+    @Excel(name = "图标", width = 15)
+    @ApiModelProperty(value = "图标")
+    private String imageToken;
+    /**
+     * 应用图标链接地址
+     */
+    @Excel(name = "应用图标链接地址", width = 15)
+    @ApiModelProperty(value = "应用图标链接地址")
+    private String appIconUrl;
+    /**
+     * 状态 0 待创建  1 创建中 2 创建成功 3 创建失败
+     */
+    @Excel(name = "状态 1 创建成功, 0 创建失败", width = 15)
+    @ApiModelProperty(value = "状态 1 创建成功, 0 创建失败")
+    private Integer state;
+    /**
+     * 备注
+     */
+    @Excel(name = "备注", width = 15)
+    @ApiModelProperty(value = "备注")
+    private String remark;
+    /**
+     * app_id
+     */
+    @Excel(name = "app_id", width = 15)
+    @ApiModelProperty(value = "app_id")
+    private Long appId;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+}

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

@@ -0,0 +1,210 @@
+package cn.com.ctop.kuaishou.modules.channel.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.util.Date;
+
+/**
+ * 渠道号创建策略表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-09-01
+ */
+@Data
+@TableName("ctop_kuaishou_channel_create_strategy")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_channel_create_strategy对象", description = "渠道号创建策略表")
+public class KuaishouChannelCreateStrategy {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 使用范围,1账户,2项目
+     */
+    @Excel(name = "使用范围,1账户,2项目", width = 15)
+    @ApiModelProperty(value = "使用范围,1账户,2项目")
+    private Integer usageRange;
+    /**
+     * 使用范围层级,账户:account,计划:plan,组:group
+     */
+    @Excel(name = "使用范围层级,账户:account,计划:plan,组:group", width = 15)
+    @ApiModelProperty(value = "使用范围层级,账户:account,计划:plan,组:group")
+    private String usageLevel;
+    /**
+     * 产品id
+     */
+    @Excel(name = "产品id", width = 15)
+    @ApiModelProperty(value = "产品id")
+    private Long productId;
+    /**
+     * 项目id
+     */
+    @Excel(name = "项目id", width = 15)
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+    /**
+     * 创建方式 1-批量,2-excel导入,3-自定义
+     */
+    @Excel(name = "创建方式 1-批量,2-excel导入,3-自定义", width = 15)
+    @ApiModelProperty(value = "创建方式 1-批量,2-excel导入,3-自定义")
+    private Integer createType;
+    /**
+     * 创建人
+     */
+    @Excel(name = "创建人", width = 15)
+    @ApiModelProperty(value = "创建人")
+    private String userId;
+    /**
+     * 创建日期
+     */
+    @Excel(name = "创建日期", width = 15)
+    @ApiModelProperty(value = "创建日期")
+    private String stateDate;
+    /**
+     * 编号长度
+     */
+    @Excel(name = "编号长度", width = 15)
+    @ApiModelProperty(value = "编号长度")
+    private Integer numberLength;
+    /**
+     * 编号最小值
+     */
+    @Excel(name = "编号最小值", width = 15)
+    @ApiModelProperty(value = "编号最小值")
+    private Integer numberMin;
+    /**
+     * 编号最大值
+     */
+    @Excel(name = "编号最大值", width = 15)
+    @ApiModelProperty(value = "编号最大值")
+    private Integer numberMax;
+    /**
+     * 渠道号
+     */
+    @Excel(name = "渠道号", width = 15)
+    @ApiModelProperty(value = "渠道号")
+    private String channelCode;
+    /**
+     * 渠道名称
+     */
+    @Excel(name = "渠道名称", width = 15)
+    @ApiModelProperty(value = "渠道名称")
+    private String channelName;
+    /**
+     * 下载链接
+     */
+    @Excel(name = "下载链接", width = 15)
+    @ApiModelProperty(value = "下载链接")
+    private String url;
+    /**
+     * 调起链接
+     */
+    @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 Integer cycleTimes;
+    /**
+     * 应用标记
+     */
+    @Excel(name = "应用标记", width = 15)
+    @ApiModelProperty(value = "应用标记")
+    private String appVersion;
+    /**
+     * 应用包名
+     */
+    @Excel(name = "应用包名", width = 15)
+    @ApiModelProperty(value = "应用包名")
+    private String packageName;
+    /**
+     * 应用名称
+     */
+    @Excel(name = "应用名称", width = 15)
+    @ApiModelProperty(value = "应用名称")
+    private String appName;
+    /**
+     * 应用图标链接地址
+     */
+    @Excel(name = "应用图标链接地址", width = 15)
+    @ApiModelProperty(value = "应用图标链接地址")
+    private String appIconUrl;
+    /**
+     * 安卓类应用必填 隐私政策链接
+     */
+    private String appPrivacyUrl;
+    /**
+     * 图片MD5标识
+     */
+    @Excel(name = "图片MD5标识", width = 15)
+    @ApiModelProperty(value = "图片MD5标识")
+    private String imageToken;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+
+    @TableField(exist = false)
+    private Long appId;
+
+    @TableField(exist = false)
+    private Long channelAppInfoId;
+
+    @TableField(exist = false)
+    private String itemName;
+
+}

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

@@ -0,0 +1,87 @@
+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-08-30
+ */
+@Data
+@TableName("ctop_kuaishou_channel_items")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_channel_items对象", description = "渠道号对应单品信息表")
+public class KuaishouChannelItems {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 项目id
+     */
+    @Excel(name = "项目id", width = 15)
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+    /**
+     * 项目名称
+     */
+    @Excel(name = "项目名称", width = 15)
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
+
+    private Integer state;
+    /**
+     * 单品名称
+     */
+    @Excel(name = "单品名称", width = 15)
+    @ApiModelProperty(value = "单品名称")
+    private String itemName;
+    /**
+     * 素材关键词
+     */
+    @Excel(name = "素材关键词", width = 15)
+    @ApiModelProperty(value = "素材关键词")
+    private String keyword;
+    /**
+     * 创建人
+     */
+    @Excel(name = "创建人", width = 15)
+    @ApiModelProperty(value = "创建人")
+    private String userId;
+    /**
+     * 日期
+     */
+    @Excel(name = "日期", width = 15)
+    @ApiModelProperty(value = "日期")
+    private String stateDate;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

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

@@ -0,0 +1,57 @@
+package cn.com.ctop.kuaishou.modules.channel.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-09-06
+ */
+@Data
+@TableName("ctop_kuaishou_channel_items_rel")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_channel_items_rel对象", description = "渠道号和单品关系表")
+public class KuaishouChannelItemsRel {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 渠道id
+     */
+    @Excel(name = "渠道id", width = 15)
+    @ApiModelProperty(value = "渠道id")
+    private Long channelId;
+    /**
+     * 单品id
+     */
+    @Excel(name = "单品id", width = 15)
+    @ApiModelProperty(value = "单品id")
+    private Long itemId;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

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

@@ -0,0 +1,77 @@
+package cn.com.ctop.kuaishou.modules.channel.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-09-06
+ */
+@Data
+@TableName("ctop_kuaishou_channel_rel")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_channel_rel对象", description = "渠道号绑定关系表")
+public class KuaishouChannelRel {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 渠道id
+     */
+    @Excel(name = "渠道编码", width = 15)
+    @ApiModelProperty(value = "渠道id")
+    private String channelCode;
+    /**
+     * 项目id
+     */
+    @Excel(name = "项目id", width = 15)
+    @ApiModelProperty(value = "项目id")
+    private Long projectId;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+
+    private Long appId;
+    /**
+     * 计划ID
+     */
+    @Excel(name = "计划ID", width = 15)
+    @ApiModelProperty(value = "计划ID")
+    private Long campaignId;
+    /**
+     * 组id
+     */
+    @Excel(name = "组id", width = 15)
+    @ApiModelProperty(value = "组id")
+    private Long unitId;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

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

@@ -0,0 +1,17 @@
+package cn.com.ctop.kuaishou.modules.channel.mapper;
+
+import java.util.List;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelAppInfo;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 渠道功能创建的应用记录
+ * @author jeecg-boot
+ * 2021-09-02
+ * @version V1.0
+ */
+public interface KuaishouChannelAppInfoMapper extends BaseMapper<KuaishouChannelAppInfo> {
+
+}

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

@@ -0,0 +1,20 @@
+package cn.com.ctop.kuaishou.modules.channel.mapper;
+
+import java.util.List;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelCreateStrategy;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 渠道号创建策略表
+ * @author jeecg-boot
+ * 2021-09-01
+ * @version V1.0
+ */
+public interface KuaishouChannelCreateStrategyMapper extends BaseMapper<KuaishouChannelCreateStrategy> {
+
+    List<KuaishouChannelCreateStrategy> queryChannelStrategyByAccountId(@Param("accountId") Long accountId);
+
+    List<KuaishouChannelCreateStrategy> queryChannelStrategyByProjectId(@Param("accountId") Long accountId);
+}

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

@@ -0,0 +1,27 @@
+package cn.com.ctop.kuaishou.modules.channel.mapper;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelItems;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 渠道号对应单品信息表
+ *
+ * @author jeecg-boot
+ * 2021-08-30
+ * @version V1.0
+ */
+public interface KuaishouChannelItemsMapper extends BaseMapper<KuaishouChannelItems> {
+
+    void replaceBatch(@Param("itemList") List<KuaishouChannelItems> itemList);
+
+    List<JSONObject> queryChannelItemList(KuaishouChannelItems kuaishouChannelItems);
+
+    List<JSONObject> queryAllChannelItemByProjectId(@Param("projectId") Long projectId);
+
+    KuaishouChannelItems queryByProjectIdAndName(@Param("projectId") Long projectId, @Param("itemName") String itemName);
+
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.channel.mapper;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelItems;
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelItemsRel;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import java.util.List;
+
+/**
+ * 渠道号和单品关系表
+ *
+ * @author jeecg-boot
+ * 2021-09-06
+ * @version V1.0
+ */
+public interface KuaishouChannelItemsRelMapper extends BaseMapper<KuaishouChannelItemsRel> {
+
+    List<KuaishouChannelItems> queryItems(Long channelId);
+}

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

@@ -0,0 +1,48 @@
+package cn.com.ctop.kuaishou.modules.channel.mapper;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel;
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelCreateStrategy;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 渠道号信息表
+ *
+ * @author jeecg-boot
+ * 2021-08-30
+ * @version V1.0
+ */
+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);
+
+    Long channelNumberDetailsTotal(KuaishouChannel kuaishouChannel);
+
+    List<KuaishouChannel> channelNumberDetails(KuaishouChannel kuaishouChannel);
+
+    Long channelNumberUsageDetailsListTotal(KuaishouChannel kuaishouChannel);
+
+    List<JSONObject> channelNumberUsageDetailsList(KuaishouChannel kuaishouChannel);
+
+    List<JSONObject> channelNumberBindingItemInfo(@Param("request") JSONArray request);
+
+    List<KuaishouChannel> queryFollowOrder(@Param("accountId") Long accountId, @Param("usedId") Long usedId, @Param("usageRange") Integer usageRange);
+
+    KuaishouChannel queryByAccountId(@Param("accountId") Long accountId);
+
+    List<KuaishouChannel> queryMaxChannelNumber(@Param("strategyId") Long strategyId);
+
+    Integer queryUsedChannelNumber(@Param("strategyId") Long strategyId);
+
+    List<KuaishouChannel> queryByAccountIdLevel(@Param("accountId") Long accountId, @Param("usageLevel") String usageLevel);
+
+    List<Integer> queryUsedLevel(@Param("strategys") List<KuaishouChannelCreateStrategy> strategys);
+
+    List<KuaishouChannel> queryChannelByHaveCycleTimes(@Param("haveCycleTimes") Integer haveCycleTimes, @Param("usageLevel") String usageLevel, @Param("strategys") List<KuaishouChannelCreateStrategy> strategys);
+
+    List<JSONObject> queryItemsListByAccountId(@Param("accountId") Long accountId, @Param("appName") String appName);
+}

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

@@ -0,0 +1,21 @@
+package cn.com.ctop.kuaishou.modules.channel.mapper;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelRel;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 渠道号绑定关系表
+ *
+ * @author jeecg-boot
+ * 2021-09-06
+ * @version V1.0
+ */
+public interface KuaishouChannelRelMapper extends BaseMapper<KuaishouChannelRel> {
+
+    KuaishouChannelRel queryByAccountChannelCode(@Param("channelCode") String channelCode, @Param("accountId") Long accountId, @Param("appName")  String appName);
+
+    Integer queryUsePlanCount(@Param("accountId") Long accountId, @Param("channelCode") String channelCode);
+
+    Integer queryUseGroupCount(@Param("accountId") Long accountId, @Param("channelCode") String channelCode);
+}

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelAppInfoMapper.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.KuaishouChannelAppInfoMapper">
+
+</mapper>

+ 25 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/mapper/xml/KuaishouChannelCreateStrategyMapper.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.channel.mapper.KuaishouChannelCreateStrategyMapper">
+
+    <select id="queryChannelStrategyByAccountId" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelCreateStrategy">
+        SELECT
+            *
+        FROM
+            ctop_kuaishou_channel_create_strategy
+        WHERE
+            account_id =#{accountId}
+        ORDER BY
+            create_time
+    </select>
+    <select id="queryChannelStrategyByProjectId" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelCreateStrategy">
+        SELECT
+            *
+        FROM
+            ctop_kuaishou_channel_create_strategy
+        WHERE
+                project_id = ( SELECT project_id FROM ctop_user_allocation WHERE account_id = #{accountId} )
+        ORDER BY
+            create_time
+    </select>
+</mapper>

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

@@ -0,0 +1,81 @@
+<?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.KuaishouChannelItemsMapper">
+
+
+    <insert id="replaceBatch">
+        replace into ctop_kuaishou_channel_items (
+        id,
+        project_id,
+        project_name,
+        state,
+        item_name,
+        keyword,
+        user_id,
+        state_date
+        )
+        values
+        <foreach collection="itemList" item="item" separator=",">
+            (
+            #{item.id},
+            #{item.projectId},
+            #{item.projectName},
+            #{item.state},
+            #{item.itemName},
+            #{item.keyword},
+            #{item.userId},
+            #{item.stateDate}
+            )
+        </foreach>
+    </insert>
+
+    <select id="queryChannelItemList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        id,
+        project_id,
+        project_name,
+        item_name,
+        keyword,
+        state,
+        create_time
+        FROM ctop_kuaishou_channel_items
+        <where>
+            <if test="projectId != null">
+                and project_id = #{projectId}
+            </if>
+            <if test="itemName != null">
+                AND LOCATE(#{itemName},item_name)
+            </if>
+            <if test="keyword != null">
+                AND LOCATE(#{keyword},keyword)
+            </if>
+            <if test="state != null">
+                AND state = #{state}
+            </if>
+            <if test="userId != null">
+                AND user_id = #{userId}
+            </if>
+        </where>
+        ORDER BY create_time DESC
+    </select>
+
+    <select id="queryAllChannelItemByProjectId"
+            resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelItems">
+        SELECT id,
+               item_name,
+               keyword
+        FROM ctop_kuaishou_channel_items
+        WHERE project_id = #{projectId}
+          AND state = 1
+        ORDER BY create_time DESC
+    </select>
+
+    <select id="queryByProjectIdAndName" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelItems">
+        SELECT item_name
+        FROM ctop_kuaishou_channel_items
+        WHERE project_id = #{projectId}
+          AND item_name = #{itemName} limit 1
+    </select>
+
+
+</mapper>

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

@@ -0,0 +1,11 @@
+<?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.KuaishouChannelItemsRelMapper">
+
+    <select id="queryItems" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelItems">
+        SELECT t2.item_name, t2.project_id, t2.project_name, t2.state, keyword
+        FROM ctop_kuaishou_channel_items_rel t1
+                 LEFT JOIN ctop_kuaishou_channel_items t2 ON t1.item_id = t2.id
+        WHERE t1.channel_id = #{channelId}
+    </select>
+</mapper>

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

@@ -0,0 +1,261 @@
+<?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.KuaishouChannelMapper">
+
+    <select id="channelManagementHome" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT * FROM (
+        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 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>
+        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
+    </select>
+
+    <select id="channelNumberDetailsTotal" resultType="java.lang.Long">
+        SELECT IFNULL(SUM(1), 0)
+        FROM ctop_kuaishou_channel
+        <where>
+            <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>
+            <if test="channelCode != null">
+                AND LOCATE(#{channelCode},channel_code)
+            </if>
+        </where>
+    </select>
+
+    <select id="channelNumberDetails" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel">
+        SELECT *
+        FROM ctop_kuaishou_channel
+        <where>
+            <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>
+            <if test="channelCode != null">
+                AND LOCATE(#{channelCode},channel_code)
+            </if>
+        </where>
+        order by create_time desc
+    </select>
+
+    <select id="channelNumberUsageDetailsListTotal" resultType="java.lang.Long">
+        SELECT IFNULL(SUM(1), 0)
+        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
+        WHERE t3.account_id = #{accountId}
+          AND t3.channel_code = #{channelCode}
+          AND t3.unit_id is not null
+    </select>
+
+    <select id="channelNumberUsageDetailsList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT IFNULL((SELECT MAX(tt.create_time)
+                       FROM ctop_kuaishou_creative tt
+                       WHERE tt.unit_id = t3.unit_id),
+                      '-') as 'createTime', 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'
+        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
+        WHERE t3.account_id = #{accountId}
+          AND t3.channel_code = #{channelCode}
+          AND t3.unit_id is not null
+    </select>
+
+    <select id="channelNumberBindingItemInfo" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t1.id,
+        IFNULL(t1.product_name, '')as 'productName',
+        IFNULL(t1.project_name, '')as 'projectName',
+        IFNULL(t1.project_Id, '')as 'project_Id',
+        IFNULL(t1.channel_code, '') as 'channelCode',
+        IFNULL(t1.channel_name, '') as 'channelName'
+        FROM ctop_kuaishou_channel t1
+        WHERE t1.id IN
+        <foreach collection="request" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+    </select>
+
+
+    <select id="queryFollowOrder" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel">
+        SELECT id,
+               channel_code,
+               usage_level,
+               usage_range,
+               usage_times
+        FROM `ctop_kuaishou_channel`
+        WHERE account_id = #{accountId}
+          AND state = 1
+          AND usage_times &lt; cycle_times
+          AND id > #{usedId}
+          AND usage_range = #{usageRange}
+        ORDER BY channel_code, channel_number limit 10
+
+    </select>
+
+    <select id="queryByAccountId" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel">
+        SELECT id,
+               channel_code,
+               usage_level,
+               usage_range,
+               is_have_item
+        FROM `ctop_kuaishou_channel`
+        WHERE account_id = #{accountId}
+        ORDER BY usage_range limit 1
+    </select>
+
+    <select id="queryMaxChannelNumber" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel">
+        SELECT have_cycle_times, max(channel_number) as channel_number
+        FROM `ctop_kuaishou_channel`
+        where strategy_id = #{strategyId}
+        group by have_cycle_times
+    </select>
+
+    <select id="queryUsedChannelNumber" resultType="java.lang.Integer">
+        SELECT count(1)
+        from `ctop_kuaishou_channel`
+        where strategy_id = #{strategyId}
+    </select>
+
+    <select id="queryByAccountIdLevel" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel">
+        SELECT id,
+               channel_code,
+               usage_level,
+               usage_range,
+               usage_times,
+               is_have_item,
+               cycle_times,
+               channel_name,
+               click_track_url,
+               actionbar_click_url,
+               schema_uri
+        FROM `ctop_kuaishou_channel`
+        WHERE account_id = #{accountId}
+          and usage_level = #{usageLevel}
+          AND state = 1
+          and channel_lock = 1
+    </select>
+
+    <select id="queryChannelByHaveCycleTimes" resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel">
+        SELECT id,
+        channel_code,
+        usage_level,
+        usage_range,
+        usage_times,
+        is_have_item,
+        cycle_times,
+        channel_name,
+        click_track_url,
+        actionbar_click_url,
+        schema_uri
+        FROM `ctop_kuaishou_channel`
+        WHERE strategy_id IN
+        <foreach collection="strategys" item="item" separator=","
+                 open="(" close=")">
+            #{item.id}
+        </foreach>
+        AND have_cycle_times = #{haveCycleTimes}
+        AND state = 1
+        and usage_level = #{usageLevel}
+        and channel_lock = 1
+        ORDER BY usage_times
+    </select>
+
+
+    <select id="queryUsedLevel" resultType="java.lang.Integer">
+        SELECT have_cycle_times
+        FROM `ctop_kuaishou_channel`
+        where strategy_id in
+        <foreach collection="strategys" item="item" separator=","
+                 open="(" close=")">
+            #{item.id}
+        </foreach>
+        AND state = 1
+        group by have_cycle_times
+    </select>
+
+    <select id="queryItemsListByAccountId" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            tt2.item_name as 'itemName',
+            tt1.channel_code as 'channelCode',
+            tt4.app_name as 'appName'
+        FROM
+            ctop_kuaishou_channel_rel tt1
+                INNER JOIN ( SELECT t3.item_name, t1.channel_code FROM ctop_kuaishou_channel t1 INNER JOIN ctop_kuaishou_channel_items_rel t2 ON t1.id = t2.channel_id LEFT JOIN ctop_kuaishou_channel_items t3 ON t2.item_id = t3.id WHERE t1.is_have_item = 1 AND t3.item_name IS NOT NULL ) tt2 ON tt2.channel_code = tt1.channel_code
+                INNER JOIN ctop_kuaishou_channel_app_info tt4 ON tt1.app_id = tt4.app_id
+        WHERE
+            tt1.account_id = #{accountId}
+          AND tt4.app_name = #{appName}
+        GROUP BY
+            tt2.item_name
+    </select>
+
+</mapper>

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

@@ -0,0 +1,38 @@
+<?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.KuaishouChannelRelMapper">
+
+    <select id="queryByAccountChannelCode"
+            resultType="cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelRel">
+        SELECT *
+        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}
+          AND t2.app_name = #{appName}
+          AND channel_code =  #{channelCode} limit 1
+    </select>
+
+    <select id="queryUsePlanCount" resultType="java.lang.Integer">
+        SELECT IFNULL(SUM(1), 0)
+        FROM (
+                 SELECT 1
+                 FROM ctop_kuaishou_channel_rel
+                 WHERE account_id = #{accountId}
+                   AND channel_code = #{channelCode}
+                   AND app_id is not null
+                   AND campaign_id is not null
+                 GROUP BY campaign_id
+             ) t
+    </select>
+
+    <select id="queryUseGroupCount" resultType="java.lang.Integer">
+        SELECT IFNULL(SUM(1), 0)
+        FROM (SELECT 1
+              FROM ctop_kuaishou_channel_rel
+              WHERE account_id = #{accountId}
+                AND channel_code = #{channelCode}
+                AND app_id IS NOT NULL
+                AND unit_id IS NOT NULL
+              GROUP BY unit_id) t
+    </select>
+</mapper>

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.channel.service;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelAppInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 渠道功能创建的应用记录
+ *
+ * @author jeecg-boot
+ * 2021-09-02
+ * @version V1.0
+ */
+public interface IKuaishouChannelAppInfoService extends IService<KuaishouChannelAppInfo> {
+
+}

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

@@ -0,0 +1,20 @@
+package cn.com.ctop.kuaishou.modules.channel.service;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelCreateStrategy;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 渠道号创建策略表
+ *
+ * @author jeecg-boot
+ * 2021-09-01
+ * @version V1.0
+ */
+public interface IKuaishouChannelCreateStrategyService extends IService<KuaishouChannelCreateStrategy> {
+
+    List<KuaishouChannelCreateStrategy> queryChannelStrategyByAccountId(Long accountId);
+
+    List<KuaishouChannelCreateStrategy> queryChannelStrategyByProjectId(Long accountId);
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.channel.service;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelItems;
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelItemsRel;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 渠道号和单品关系表
+ *
+ * @author jeecg-boot
+ * 2021-09-06
+ * @version V1.0
+ */
+public interface IKuaishouChannelItemsRelService extends IService<KuaishouChannelItemsRel> {
+
+    List<KuaishouChannelItems> queryItems(Long channelId);
+}

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

@@ -0,0 +1,32 @@
+package cn.com.ctop.kuaishou.modules.channel.service;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelItems;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * 渠道号对应单品信息表
+ *
+ * @author jeecg-boot
+ * 2021-08-30
+ * @version V1.0
+ */
+public interface IKuaishouChannelItemsService extends IService<KuaishouChannelItems> {
+
+    Result<Object> queryChannelItemList(KuaishouChannelItems kuaishouChannelItems);
+
+    Result<Object> queryAllChannelItemByProjectId(Long projectId);
+
+    Result<Object> addChannelItem(JSONArray request);
+
+    Result<Object> channelBindingItem(JSONArray request);
+
+    Result<Object> importItemExcel(MultipartFile file) throws Exception;
+
+}

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

@@ -0,0 +1,20 @@
+package cn.com.ctop.kuaishou.modules.channel.service;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelRel;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 渠道号绑定关系表
+ *
+ * @author jeecg-boot
+ * 2021-09-06
+ * @version V1.0
+ */
+public interface IKuaishouChannelRelService extends IService<KuaishouChannelRel> {
+
+    KuaishouChannelRel queryByAccountChannelCode(String channelCode, Long accountId,String appName);
+
+    Integer queryUsePlanCount(Long accountId, String channelCode);
+
+    Integer queryUseGroupCount(Long accountId, String channelCode);
+}

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

@@ -0,0 +1,38 @@
+package cn.com.ctop.kuaishou.modules.channel.service;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannel;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 渠道号信息表
+ *
+ * @author jeecg-boot
+ * 2021-08-30
+ * @version V1.0
+ */
+public interface IKuaishouChannelService extends IService<KuaishouChannel> {
+
+    Result<Object> channelManagementHome(Long productId, Long projectId, Long accountId, String userId);
+
+    Result<Object> channelNumberDetails(KuaishouChannel kuaishouCha, Integer pageNo, Integer pageSizennel);
+
+    Result<Object> channelNumberUsageDetailsList(KuaishouChannel kuaishouChannel, Integer pageNo, Integer pageSize);
+
+    Result<Object> channelNumberBindingItemInfo(JSONArray request);
+
+    Result<Object> importChannelExcel(MultipartFile file, String imageUrl) throws Exception;
+
+    Result<Object> systemBatchCreation(JSONObject request);
+
+    Result<Object> customizedCreate(JSONObject request, Integer createType) throws Exception;
+
+    Result<Object> queryChannel(Long accountId, String usageLevel,String appName) throws Exception;
+
+    Result<Object> queryChannelLevel(JSONObject request);
+
+    void callBackUpdateChannelRel(String level, String channelCode, Long accoountId, Long planId, Long groupId,Integer state);
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.channel.service.impl;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelAppInfo;
+import cn.com.ctop.kuaishou.modules.channel.mapper.KuaishouChannelAppInfoMapper;
+import cn.com.ctop.kuaishou.modules.channel.service.IKuaishouChannelAppInfoService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 渠道功能创建的应用记录
+ *
+ * @author jeecg-boot
+ * 2021-09-02
+ * @version V1.0
+ */
+@Service
+public class KuaishouChannelAppInfoServiceImpl extends ServiceImpl<KuaishouChannelAppInfoMapper, KuaishouChannelAppInfo> implements IKuaishouChannelAppInfoService {
+
+}

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

@@ -0,0 +1,35 @@
+package cn.com.ctop.kuaishou.modules.channel.service.impl;
+
+import cn.com.ctop.common.module.mapper.ProjectMapper;
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelCreateStrategy;
+import cn.com.ctop.kuaishou.modules.channel.mapper.KuaishouChannelCreateStrategyMapper;
+import cn.com.ctop.kuaishou.modules.channel.service.IKuaishouChannelCreateStrategyService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 渠道号创建策略表
+ *
+ * @author jeecg-boot
+ * 2021-09-01
+ * @version V1.0
+ */
+@Service
+public class KuaishouChannelCreateStrategyServiceImpl extends ServiceImpl<KuaishouChannelCreateStrategyMapper, KuaishouChannelCreateStrategy> implements IKuaishouChannelCreateStrategyService {
+
+    @Autowired
+    private KuaishouChannelCreateStrategyMapper createStrategyMapper;
+
+    @Override
+    public List<KuaishouChannelCreateStrategy> queryChannelStrategyByAccountId(Long accountId) {
+        return createStrategyMapper.queryChannelStrategyByAccountId(accountId);
+    }
+
+    @Override
+    public List<KuaishouChannelCreateStrategy> queryChannelStrategyByProjectId(Long accountId) {
+        return createStrategyMapper.queryChannelStrategyByProjectId(accountId);
+    }
+}

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

@@ -0,0 +1,30 @@
+package cn.com.ctop.kuaishou.modules.channel.service.impl;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelItems;
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelItemsRel;
+import cn.com.ctop.kuaishou.modules.channel.mapper.KuaishouChannelItemsRelMapper;
+import cn.com.ctop.kuaishou.modules.channel.service.IKuaishouChannelItemsRelService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 渠道号和单品关系表
+ *
+ * @author jeecg-boot
+ * 2021-09-06
+ * @version V1.0
+ */
+@Service
+public class KuaishouChannelItemsRelServiceImpl extends ServiceImpl<KuaishouChannelItemsRelMapper, KuaishouChannelItemsRel> implements IKuaishouChannelItemsRelService {
+
+    @Autowired
+    KuaishouChannelItemsRelMapper channelItemsRelMapper;
+
+    @Override
+    public List<KuaishouChannelItems> queryItems(Long channelId) {
+        return channelItemsRelMapper.queryItems(channelId);
+    }
+}

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

@@ -0,0 +1,173 @@
+package cn.com.ctop.kuaishou.modules.channel.service.impl;
+
+import cn.com.ctop.common.module.mapper.ProjectMapper;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAppPackage;
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelItems;
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelItemsRel;
+import cn.com.ctop.kuaishou.modules.channel.mapper.KuaishouChannelItemsMapper;
+import cn.com.ctop.kuaishou.modules.channel.service.IKuaishouChannelItemsRelService;
+import cn.com.ctop.kuaishou.modules.channel.service.IKuaishouChannelItemsService;
+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 com.github.pagehelper.PageInfo;
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Cell;
+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.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.MD5Util;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 渠道号对应单品信息表
+ *
+ * @author jeecg-boot
+ * 2021-08-30
+ * @version V1.0
+ */
+@Service
+public class KuaishouChannelItemsServiceImpl extends ServiceImpl<KuaishouChannelItemsMapper, KuaishouChannelItems> implements IKuaishouChannelItemsService {
+
+    @Autowired
+    private KuaishouChannelItemsMapper channelItemsMapper;
+
+    @Autowired
+    private ProjectMapper projectMapper;
+
+    @Autowired
+    private IKuaishouChannelItemsRelService channelItemsRelService;
+
+    @Override
+    public Result<Object> queryChannelItemList(KuaishouChannelItems kuaishouChannelItems) {
+        List<JSONObject> list = channelItemsMapper.queryChannelItemList(kuaishouChannelItems);
+        return Result.ok(new PageInfo<>(list));
+    }
+
+    @Override
+    public Result<Object> queryAllChannelItemByProjectId(Long projectId) {
+        List<JSONObject> list = channelItemsMapper.queryAllChannelItemByProjectId(projectId);
+        return Result.ok(list);
+    }
+
+    @Override
+    public Result<Object> addChannelItem(JSONArray request) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = null;
+        if (!Check.isNull(sysUser)) {
+            userId = sysUser.getId();
+        }
+        List<KuaishouChannelItems> itemList = new ArrayList<>();
+        for (int i = 0; i < request.size(); i++) {
+            JSONObject jsonObject = request.getJSONObject(i);
+            Long projectId = jsonObject.getLong("projectId");
+            String itemName = jsonObject.getString("itemName");
+            KuaishouChannelItems one = channelItemsMapper.queryByProjectIdAndName(projectId, itemName);
+            if (Check.isNull(one)) {
+                KuaishouChannelItems item = new KuaishouChannelItems();
+                item.setProjectId(projectId);
+                item.setProjectName(projectMapper.getNameByProjectId(projectId));
+                item.setState(1);
+                item.setItemName(itemName);
+                item.setKeyword(jsonObject.getString("keyword"));
+                item.setStateDate(DateUtils.getNowDate("yyyy-MM-dd"));
+                item.setUserId(userId);
+                itemList.add(item);
+            }
+        }
+        if (!itemList.isEmpty()) {
+            channelItemsMapper.replaceBatch(itemList);
+        }
+        return Result.ok("添加成功");
+    }
+
+    @Override
+    public Result<Object> channelBindingItem(JSONArray request) {
+        for (int i = 0; i < request.size(); i++) {
+            JSONObject object = request.getJSONObject(i);
+            if (Check.isNull(object.getLong("id")) || Check.isNull(object.getLong("channelId"))) {
+                continue;
+            }
+            QueryWrapper<KuaishouChannelItemsRel> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("channel_id", object.getLong("channelId"));
+            queryWrapper.eq("item_id", object.getLong("id")).last("limit 1");
+            KuaishouChannelItemsRel one = channelItemsRelService.getOne(queryWrapper);
+            if (Check.isNull(one)) {
+                KuaishouChannelItemsRel rel = new KuaishouChannelItemsRel();
+                rel.setItemId(object.getLong("id"));
+                rel.setChannelId(object.getLong("channelId"));
+                channelItemsRelService.save(rel);
+            }
+        }
+        return Result.ok("绑定成功");
+    }
+
+    @Override
+    public Result<Object> importItemExcel(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 projectId = eeu.getCellValue(row.getCell(0));
+                String itemName = eeu.getCellValue(row.getCell(1));
+                String keyword = eeu.getCellValue(row.getCell(2));
+                if (Check.isNull(projectId)) {
+                    return Result.error("解析数据失败,文档中项目列缺失数据");
+                } else if (Check.isNull(itemName)) {
+                    return Result.error("解析数据失败,文档中单品名称列缺失数据");
+                } else if (Check.isNull(keyword)) {
+                    return Result.error("解析数据失败,文档中素材关键词列缺失数据");
+                }
+                JSONObject obj = new JSONObject();
+                obj.put("projectId", projectId);
+                obj.put("itemName", itemName);
+                obj.put("keyword", keyword);
+                array.add(obj);
+            }
+        }
+        if (!array.isEmpty()) {
+            addChannelItem(array);
+        }
+        return Result.ok("添加成功");
+    }
+
+}

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

@@ -0,0 +1,36 @@
+package cn.com.ctop.kuaishou.modules.channel.service.impl;
+
+import cn.com.ctop.kuaishou.modules.channel.entity.KuaishouChannelRel;
+import cn.com.ctop.kuaishou.modules.channel.mapper.KuaishouChannelRelMapper;
+import cn.com.ctop.kuaishou.modules.channel.service.IKuaishouChannelRelService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 渠道号绑定关系表
+ *
+ * @author jeecg-boot
+ * 2021-09-06
+ * @version V1.0
+ */
+@Service
+public class KuaishouChannelRelServiceImpl extends ServiceImpl<KuaishouChannelRelMapper, KuaishouChannelRel> implements IKuaishouChannelRelService {
+    @Autowired
+    private KuaishouChannelRelMapper channelRelMapper;
+
+    @Override
+    public KuaishouChannelRel queryByAccountChannelCode(String channelCode, Long accountId,String appName) {
+        return channelRelMapper.queryByAccountChannelCode(channelCode, accountId, appName);
+    }
+
+    @Override
+    public Integer queryUsePlanCount(Long accountId, String channelCode) {
+        return channelRelMapper.queryUsePlanCount(accountId,  channelCode);
+    }
+
+    @Override
+    public Integer queryUseGroupCount(Long accountId, String channelCode) {
+        return channelRelMapper.queryUseGroupCount(accountId,  channelCode);
+    }
+}

文件差异内容过多而无法显示
+ 1259 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelServiceImpl.java


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

@@ -38,7 +38,7 @@ public class NewMonitorController {
             newMonitorService.synchronousKuaiShouMonitor(type, aLong);
             newMonitorService.synchronousKuaiShouMonitor(type, aLong);
         }
         }
         for (Long aLong : touTiaoAccountId) {
         for (Long aLong : touTiaoAccountId) {
-            newMonitorService.synchronousKuaiShouMonitor(type, aLong);
+            newMonitorService.synchronousTouTiaoMonitor(type, aLong);
         }
         }
 
 
         return new Result();
         return new Result();

+ 6 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/NewMonitorMapper.java

@@ -17,10 +17,16 @@ public interface NewMonitorMapper {
 
 
     List<Map> getKuaiShouGroup(@Param("date") String date, @Param("accountId") String accountId);
     List<Map> getKuaiShouGroup(@Param("date") String date, @Param("accountId") String accountId);
 
 
+    List<Map> getKuaiShouGroupNow(@Param("date") String date, @Param("accountId") String accountId);
+
     List<Map> getKuaiShouCampaign(@Param("date") String date, @Param("accountId") String accountId);
     List<Map> getKuaiShouCampaign(@Param("date") String date, @Param("accountId") String accountId);
 
 
+    List<Map> getKuaiShouCampaignNow(@Param("date") String date, @Param("accountId") String accountId);
+
     List<Map> getTouTiaoCampaign(@Param("date") String date, @Param("accountId") String accountId);
     List<Map> getTouTiaoCampaign(@Param("date") String date, @Param("accountId") String accountId);
 
 
+    List<Map> getTouTiaoCampaignNow(@Param("date") String date, @Param("accountId") String accountId);
+
     BigDecimal getGroupCharge(@Param("unitId") String unitId, @Param("afterDate") String afterDate);
     BigDecimal getGroupCharge(@Param("unitId") String unitId, @Param("afterDate") String afterDate);
 
 
     BigDecimal getCampaignCharge(@Param("campaignId") String campaignId, @Param("afterDate") String afterDate);
     BigDecimal getCampaignCharge(@Param("campaignId") String campaignId, @Param("afterDate") String afterDate);

+ 27 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/NewMonitorMapper.xml

@@ -35,6 +35,15 @@
      </where>
      </where>
     </select>
     </select>
 
 
+    <select id="getKuaiShouGroupNow" resultType="Map">
+        SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.unit_id as 'unitId',t.group_create_time as 'groupCreatTime',DATE_FORMAT(DATE_ADD(t.group_create_time,INTERVAL 7 DAY),'%Y-%m-%d') as 'afterTime'
+        from ctop_user_allocation t1 LEFT JOIN  ctop_kuaishou_group t on t1.account_id=t.account_id
+        <where>
+            and t.account_id=#{accountId}
+            and  t.group_create_time &gt;= #{date}
+        </where>
+    </select>
+
     <select id="getKuaiShouCampaign" resultType="Map">
     <select id="getKuaiShouCampaign" resultType="Map">
         SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.campaign_id as 'campaignId',t.put_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.put_create_time,INTERVAL 7 DAY),'%Y-%m-%d') as 'afterTime'
         SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.campaign_id as 'campaignId',t.put_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.put_create_time,INTERVAL 7 DAY),'%Y-%m-%d') as 'afterTime'
         from ctop_user_allocation t1 LEFT JOIN  ctop_kuaishou_campaign t on t1.account_id=t.account_id
         from ctop_user_allocation t1 LEFT JOIN  ctop_kuaishou_campaign t on t1.account_id=t.account_id
@@ -51,6 +60,15 @@
         </where>
         </where>
     </select>
     </select>
 
 
+    <select id="getKuaiShouCampaignNow" resultType="Map">
+        SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.campaign_id as 'campaignId',t.put_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.put_create_time,INTERVAL 7 DAY),'%Y-%m-%d') as 'afterTime'
+        from ctop_user_allocation t1 LEFT JOIN  ctop_kuaishou_campaign t on t1.account_id=t.account_id
+        <where>
+            and t.account_id=#{accountId}
+            and  t.put_create_time &gt;=#{date}
+        </where>
+    </select>
+
     <select id="getTouTiaoCampaign" resultType="Map">
     <select id="getTouTiaoCampaign" resultType="Map">
         SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.id as 'campaignId',t.ad_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.ad_create_time,INTERVAL 7 DAY),'%Y-%m-%d') as 'afterTime'
         SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.id as 'campaignId',t.ad_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.ad_create_time,INTERVAL 7 DAY),'%Y-%m-%d') as 'afterTime'
         from ctop_user_allocation t1 LEFT JOIN  ctop_bytedance_advertise_plan t on t1.account_id=t.account_id
         from ctop_user_allocation t1 LEFT JOIN  ctop_bytedance_advertise_plan t on t1.account_id=t.account_id
@@ -67,6 +85,15 @@
         </where>
         </where>
     </select>
     </select>
 
 
+    <select id="getTouTiaoCampaignNow" resultType="Map">
+        SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.id as 'campaignId',t.ad_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.ad_create_time,INTERVAL 7 DAY),'%Y-%m-%d') as 'afterTime'
+        from ctop_user_allocation t1 LEFT JOIN  ctop_bytedance_advertise_plan t on t1.account_id=t.account_id
+        <where>
+            and t.account_id=#{accountId}
+            and  t.ad_create_time &gt;= #{date}
+        </where>
+    </select>
+
     <select id="getGroupCharge" resultType="java.math.BigDecimal">
     <select id="getGroupCharge" resultType="java.math.BigDecimal">
 
 
         select sum(charge) from ctop_kuaishou_report_daily_group t where t.stat_date &lt; #{afterDate} and t.unit_id=#{unitId}
         select sum(charge) from ctop_kuaishou_report_daily_group t where t.stat_date &lt; #{afterDate} and t.unit_id=#{unitId}

+ 11 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/NewMonitorServiceImpl.java

@@ -34,7 +34,7 @@ public class NewMonitorServiceImpl implements NewMonitorService {
      */
      */
     @Async("calcThreadExecutor")
     @Async("calcThreadExecutor")
     public Result synchronousKuaiShouMonitor(String type, Long accId) {
     public Result synchronousKuaiShouMonitor(String type, Long accId) {
-        log.info("同步快手新上数据:{}",accId);
+        log.info("同步快手新上数据:{}", accId);
         Result result = new Result();
         Result result = new Result();
         List<Map> kuaiShouGroup = new ArrayList<>();
         List<Map> kuaiShouGroup = new ArrayList<>();
         List<Map> kuaiShouCampaign = new ArrayList<>();
         List<Map> kuaiShouCampaign = new ArrayList<>();
@@ -45,6 +45,9 @@ public class NewMonitorServiceImpl implements NewMonitorService {
             if (type.equals("0")) {
             if (type.equals("0")) {
                 //查询创建不满7天的快手组信息
                 //查询创建不满7天的快手组信息
                 kuaiShouGroup = newMonitorMapper.getKuaiShouGroup(sdf.format(new Date()), String.valueOf(accId));
                 kuaiShouGroup = newMonitorMapper.getKuaiShouGroup(sdf.format(new Date()), String.valueOf(accId));
+            } else if (type.equals("1")) {
+                //查询当日快手组信息
+                kuaiShouGroup = newMonitorMapper.getKuaiShouGroupNow(sdf.format(new Date()), String.valueOf(accId));
             } else {
             } else {
                 //查询全量快手组信息
                 //查询全量快手组信息
                 kuaiShouGroup = newMonitorMapper.getKuaiShouGroup(null, String.valueOf(accId));
                 kuaiShouGroup = newMonitorMapper.getKuaiShouGroup(null, String.valueOf(accId));
@@ -89,6 +92,9 @@ public class NewMonitorServiceImpl implements NewMonitorService {
             if (type.equals("0")) {
             if (type.equals("0")) {
                 //查询创建不满7天的快手广告计划
                 //查询创建不满7天的快手广告计划
                 kuaiShouCampaign = newMonitorMapper.getKuaiShouCampaign(sdf.format(new Date()), String.valueOf(accId));
                 kuaiShouCampaign = newMonitorMapper.getKuaiShouCampaign(sdf.format(new Date()), String.valueOf(accId));
+            } else if (type.equals("1")) {
+                //查询当日快手广告计划
+                kuaiShouCampaign = newMonitorMapper.getKuaiShouCampaignNow(sdf.format(new Date()), String.valueOf(accId));
             } else {
             } else {
                 //查询全量快手广告计划
                 //查询全量快手广告计划
                 kuaiShouCampaign = newMonitorMapper.getKuaiShouCampaign(null, String.valueOf(accId));
                 kuaiShouCampaign = newMonitorMapper.getKuaiShouCampaign(null, String.valueOf(accId));
@@ -140,7 +146,7 @@ public class NewMonitorServiceImpl implements NewMonitorService {
      * @return
      * @return
      */
      */
     public Result synchronousTouTiaoMonitor(String type, Long accId) {
     public Result synchronousTouTiaoMonitor(String type, Long accId) {
-        log.info("同步头条新上数据:{}",accId);
+        log.info("同步头条新上数据:{}", accId);
         Result result = new Result();
         Result result = new Result();
         List<Map> kuaiShouGroup = new ArrayList<>();
         List<Map> kuaiShouGroup = new ArrayList<>();
         List<Map> kuaiShouCampaign = new ArrayList<>();
         List<Map> kuaiShouCampaign = new ArrayList<>();
@@ -151,6 +157,9 @@ public class NewMonitorServiceImpl implements NewMonitorService {
             if (type.equals("0")) {
             if (type.equals("0")) {
                 //查询创建不满7天的头条广告计划
                 //查询创建不满7天的头条广告计划
                 TouTiaoCampaign = newMonitorMapper.getTouTiaoCampaign(sdf.format(new Date()), String.valueOf(accId));
                 TouTiaoCampaign = newMonitorMapper.getTouTiaoCampaign(sdf.format(new Date()), String.valueOf(accId));
+            } else if (type.equals("1")) {
+                //查询当日头条广告计划
+                TouTiaoCampaign = newMonitorMapper.getTouTiaoCampaignNow(sdf.format(new Date()), String.valueOf(accId));
             } else {
             } else {
                 //查询全量头条广告计划
                 //查询全量头条广告计划
                 TouTiaoCampaign = newMonitorMapper.getTouTiaoCampaign(null, String.valueOf(accId));
                 TouTiaoCampaign = newMonitorMapper.getTouTiaoCampaign(null, String.valueOf(accId));

+ 29 - 27
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AiKuaishouAdvertiserStrategyController.java

@@ -12,20 +12,26 @@ import cn.com.ctop.kuaishou.modules.ai.service.IKuaiShouAppMultipleBidsService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouVideoRelateCreativesService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouVideoRelateCreativesService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.system.service.ISysRoleService;
 import org.jeecg.modules.system.service.ISysRoleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * 快手账户策略设置信息表
  * 快手账户策略设置信息表
@@ -59,35 +65,31 @@ public class AiKuaishouAdvertiserStrategyController {
      * @return
      * @return
      */
      */
     @GetMapping(value = "/list")
     @GetMapping(value = "/list")
-    public Result<IPage<AiKuaishouAdvertiserStrategy>> queryPageList(AiKuaishouAdvertiserStrategy aiKuaishouAdvertiserStrategy,
-                                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                                     HttpServletRequest req) {
-        Result<IPage<AiKuaishouAdvertiserStrategy>> result = new Result<>();
-        QueryWrapper<AiKuaishouAdvertiserStrategy> queryWrapper = QueryGenerator.initQueryWrapper(aiKuaishouAdvertiserStrategy, req.getParameterMap());
-        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        String roleCode = sysRoleService.getRoleCodeByUserId(user.getId());
-        if (!CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
-            queryWrapper.eq("user_id", user.getId());
+    public Result<PageInfo<AiKuaishouAdvertiserStrategy>> queryPageList(AiKuaishouAdvertiserStrategy aiKuaishouAdvertiserStrategy,
+                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                      HttpServletRequest req) {
+        Result<PageInfo<AiKuaishouAdvertiserStrategy>> result = new Result<>();
+        String roleCode = sysRoleService.getRoleCodeByUserId(aiKuaishouAdvertiserStrategy.getUserId());
+        if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
+            aiKuaishouAdvertiserStrategy.setUserId(null);
         }
         }
-        Page<AiKuaishouAdvertiserStrategy> page = new Page<>(pageNo, pageSize);
-        queryWrapper.orderByDesc("id");
-        IPage<AiKuaishouAdvertiserStrategy> pageList = aiKuaishouAdvertiserStrategyService.page(page, queryWrapper);
-        List<AiKuaishouAdvertiserStrategy> records = pageList.getRecords();
+        PageHelper.startPage(pageNo, pageSize);
+        PageInfo<AiKuaishouAdvertiserStrategy> pageInfo = aiKuaishouAdvertiserStrategyService.queryList(aiKuaishouAdvertiserStrategy);
+        List<AiKuaishouAdvertiserStrategy> list = pageInfo.getList();
         List<AiKuaishouAdvertiserStrategy> setData = new ArrayList<>();
         List<AiKuaishouAdvertiserStrategy> setData = new ArrayList<>();
-        if (null != records && !records.isEmpty()) {
-            records.forEach(record -> {
+        if (null != list && !list.isEmpty()) {
+            list.forEach(record -> {
                 Long accountId = record.getAccountId();
                 Long accountId = record.getAccountId();
                 UserAllocation allocation = allocationService.getByAccountId(accountId);
                 UserAllocation allocation = allocationService.getByAccountId(accountId);
                 if (null != allocation) {
                 if (null != allocation) {
                     record.setAuthName(allocation.getAuthName());
                     record.setAuthName(allocation.getAuthName());
                 }
                 }
-                setData.add(record);
             });
             });
-            pageList.setRecords(setData);
         }
         }
+        pageInfo.setList(list);
         result.setSuccess(true);
         result.setSuccess(true);
-        result.setResult(pageList);
+        result.setResult(pageInfo);
         return result;
         return result;
     }
     }
 
 

+ 8 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java

@@ -199,7 +199,10 @@ public class ProjectMemberController {
                 for (JSONObject object : list) {
                 for (JSONObject object : list) {
                     List<JSONObject> proList = new ArrayList<>();
                     List<JSONObject> proList = new ArrayList<>();
                     for (JSONObject have : haveList) {
                     for (JSONObject have : haveList) {
-                        if (object.getLong("productId") == have.getLong("productId")) {
+                        if (Check.isNull(have.getLong("productId"))) {
+                            continue;
+                        }
+                        if (object.getLong("productId") - have.getLong("productId") == 0) {
                             proList.add(have);
                             proList.add(have);
                         }
                         }
                     }
                     }
@@ -250,7 +253,10 @@ public class ProjectMemberController {
                 for (JSONObject object : list) {
                 for (JSONObject object : list) {
                     List<JSONObject> proList = new ArrayList<>();
                     List<JSONObject> proList = new ArrayList<>();
                     for (JSONObject have : projectList) {
                     for (JSONObject have : projectList) {
-                        if (object.getLong("productId") == have.getLong("productId")) {
+                        if (Check.isNull(have.getLong("productId"))) {
+                            continue;
+                        }
+                        if (object.getLong("productId") - have.getLong("productId") == 0) {
                             proList.add(have);
                             proList.add(have);
                         }
                         }
                     }
                     }